/* ==========================================================================
   The Emperor — throne room stylesheet
   Gold on deep royal violet. Mobile-first, no framework, no build step.
   ========================================================================== */

@font-face {
  font-family: 'Cinzel';
  src: url('/static/fonts/cinzel.woff2') format('woff2-variations'),
       url('/static/fonts/cinzel.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'InterVar';
  src: url('/static/fonts/inter.woff2') format('woff2-variations'),
       url('/static/fonts/inter.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-0: #0a0613;
  --bg-1: #150c28;
  --bg-2: #1d1136;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.055);
  --panel-solid: #170e2b;
  --line: rgba(240, 192, 90, 0.16);
  --line-soft: rgba(255, 255, 255, 0.07);
  --gold: #f0c05a;
  --gold-2: #d9a127;
  --gold-3: #ffe9b0;
  --royal: #8b5cf6;
  --royal-2: #4c1d95;
  --teal: #6fd3c0;
  --ink: #f0ebf9;
  --muted: #a89cc4;
  --muted-2: #80739443;
  --danger: #ff9f9f;
  --ok: #7ee0a8;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
  --serif: 'Cinzel', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --sans: 'InterVar', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Layered royal backdrop: violet pools, a warm gold glow, and a fine grain. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1100px 600px at 12% -10%, rgba(124, 58, 237, 0.32), transparent 62%),
    radial-gradient(900px 500px at 90% 0%, rgba(240, 192, 90, 0.14), transparent 60%),
    radial-gradient(900px 700px at 50% 110%, rgba(76, 29, 149, 0.35), transparent 65%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 45%, #08040f 100%);
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.30'/%3E%3C/svg%3E");
}

a { color: var(--gold-3); text-decoration: none; }
a:hover { color: #fff; }
p { margin: 0 0 1em; }
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: 0.01em;
}
img { max-width: 100%; height: auto; }
::selection { background: rgba(240, 192, 90, 0.3); }

.wrap { width: min(1180px, 100% - 2rem); margin-inline: auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: linear-gradient(180deg, rgba(10, 6, 19, 0.92), rgba(10, 6, 19, 0.72));
  border-bottom: 1px solid var(--line);
}
.site-header .bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  flex: 1 1 auto;
  min-width: 0;
}
.brand .crest { width: 34px; height: 34px; flex: 0 0 auto; }
.brand .wordmark {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
  background: linear-gradient(100deg, var(--gold-3), var(--gold), var(--gold-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand .sub {
  display: block;
  font-family: var(--sans);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}
.site-nav { display: flex; align-items: center; gap: 0.35rem; }
.site-nav a {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.5rem 0.7rem;
  border-radius: 999px;
}
.site-nav a:hover { color: var(--ink); background: var(--panel); }
.site-nav a[aria-current='page'] { color: var(--gold-3); background: rgba(240, 192, 90, 0.09); }
.nav-toggle {
  display: none;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.78rem 1.3rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  text-align: center;
  justify-content: center;
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold-3), var(--gold) 45%, var(--gold-2));
  color: #241503;
  box-shadow: 0 14px 34px -16px rgba(240, 192, 90, 0.8);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -16px rgba(240, 192, 90, 0.95); color: #241503; }
.btn-ghost {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover { background: var(--panel-2); color: #fff; transform: translateY(-1px); }
.btn[disabled], .btn.is-disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.btn-sm { padding: 0.5rem 0.9rem; font-size: 0.8rem; }

/* ---------------------------------------------------------------- hero */
.hero { position: relative; padding: 3.2rem 0 1.4rem; }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.1rem;
}
.kicker .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(126, 224, 168, 0.65);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(126, 224, 168, 0.55); }
  70% { box-shadow: 0 0 0 12px rgba(126, 224, 168, 0); }
  100% { box-shadow: 0 0 0 0 rgba(126, 224, 168, 0); }
}
.hero h1 {
  font-size: clamp(2rem, 5.4vw, 3.5rem);
  max-width: 20ch;
  background: linear-gradient(105deg, #fff 4%, var(--gold-3) 32%, var(--gold) 62%, #b98420 96%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.7rem;
}
.hero .lede { font-size: clamp(1rem, 1.6vw, 1.12rem); color: #cfc4e6; max-width: 62ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.5rem; }
.hero-side-note { font-size: 0.78rem; color: var(--muted); margin-top: 0.9rem; }

/* ---------------------------------------------------------------- cards */
.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin-bottom: 0.35rem; }
.card .card-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.hairline { height: 1px; background: var(--line); border: 0; margin: 1.1rem 0; }

/* ---------------------------------------------------------------- ladder */
.ladder {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.1rem;
  align-items: center;
  margin-top: 1.6rem;
}
.medallion {
  width: 74px; height: 74px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: #2a1904;
  background: conic-gradient(from 210deg, var(--gold-3), var(--gold), var(--gold-2), var(--gold-3));
  box-shadow: inset 0 0 0 4px rgba(10, 6, 19, 0.55), 0 12px 30px -14px rgba(240, 192, 90, 0.85);
  flex: 0 0 auto;
}
.ladder .meta { min-width: 0; }
.ladder .level-name {
  font-family: var(--serif);
  font-size: 1.15rem;
  letter-spacing: 0.05em;
}
.ladder .numbers { color: var(--muted); font-size: 0.84rem; }
.progress {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  border: 1px solid var(--line-soft);
  margin: 0.55rem 0 0.4rem;
}
.progress .fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-2), var(--gold), var(--gold-3));
  position: relative;
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  min-width: 4px;
}
.progress .fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.55) 50%, transparent 80%);
  background-size: 220% 100%;
  animation: shimmer 3.4s linear infinite;
}
@keyframes shimmer { from { background-position: 220% 0; } to { background-position: -60% 0; } }
.raised-total { font-family: var(--serif); font-size: 1.05rem; color: var(--gold-3); }

/* ---------------------------------------------------------------- coronation */
.coronation {
  border: 1px solid rgba(240, 192, 90, 0.45);
  background:
    radial-gradient(600px 200px at 12% 0%, rgba(240, 192, 90, 0.16), transparent 70%),
    linear-gradient(180deg, rgba(240, 192, 90, 0.08), rgba(255, 255, 255, 0.02));
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  margin: 1.6rem 0 0;
  position: relative;
  overflow: hidden;
}
.coronation .tag {
  font-size: 0.66rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold);
}
.coronation .speech { font-family: var(--serif); font-size: 1.1rem; margin: 0.5rem 0 0.7rem; }
.coronation .reaction { color: var(--teal); font-size: 0.92rem; }

/* ---------------------------------------------------------------- layout */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 1.3rem;
  padding: 2rem 0 3rem;
  align-items: start;
}
.side { display: grid; gap: 1.3rem; position: sticky; top: 84px; }

/* ---------------------------------------------------------------- feed */
.feed-card { display: flex; flex-direction: column; min-height: 560px; }
.feed-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}
.feed-head > div:first-child { min-width: 0; flex: 1 1 auto; }
.feed-title { font-family: var(--serif); font-size: 1.12rem; letter-spacing: 0.06em; }
.live-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.62rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ok);
  border: 1px solid rgba(126, 224, 168, 0.35);
  background: rgba(126, 224, 168, 0.08);
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
}
.live-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); animation: pulse 2.4s infinite; }
.feed {
  overflow-y: auto;
  max-height: 660px;
  flex: 1 1 auto;
  padding-right: 0.45rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 192, 90, 0.35) transparent;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.feed::-webkit-scrollbar { width: 8px; }
.feed::-webkit-scrollbar-thumb { background: rgba(240, 192, 90, 0.28); border-radius: 99px; }

.msg { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 0.8rem; animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.msg .avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: linear-gradient(150deg, #2a1a4d, #150c28);
}
.msg .avatar svg { width: 24px; height: 24px; }
.msg.emperor .avatar { background: linear-gradient(150deg, rgba(240, 192, 90, 0.3), rgba(76, 29, 149, 0.35)); border-color: rgba(240, 192, 90, 0.5); }
.msg.advisor .avatar { background: linear-gradient(150deg, rgba(111, 211, 192, 0.22), rgba(76, 29, 149, 0.3)); border-color: rgba(111, 211, 192, 0.42); }
.msg .who { display: flex; align-items: baseline; gap: 0.55rem; flex-wrap: wrap; margin-bottom: 0.3rem; }
.msg .name { font-family: var(--serif); font-size: 0.9rem; letter-spacing: 0.06em; }
.msg.emperor .name { color: var(--gold-3); }
.msg.advisor .name { color: var(--teal); }
.msg .when { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.06em; }
.msg .bubble {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-left: 3px solid rgba(240, 192, 90, 0.55);
  border-radius: 4px var(--radius-sm) var(--radius-sm) var(--radius-sm);
  padding: 0.8rem 1rem;
  font-size: 0.96rem;
}
.msg.advisor .bubble { border-left-color: rgba(111, 211, 192, 0.55); background: rgba(111, 211, 192, 0.045); }
.msg.answer .bubble { border-left-color: var(--royal); background: rgba(139, 92, 246, 0.07); }
.msg .bubble p:last-child { margin-bottom: 0; }
.msg .permalink { font-size: 0.68rem; color: var(--muted); opacity: 0; transition: opacity 0.2s; }
.msg:hover .permalink, .msg:focus-within .permalink { opacity: 1; }
.msg .tie {
  display: inline-block;
  font-size: 0.6rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--royal);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 99px; padding: 0.1rem 0.45rem; margin-left: 0.4rem;
}
.new-pill {
  position: sticky; bottom: 0.4rem; align-self: center;
  background: var(--gold);
  color: #241503;
  border: 0; border-radius: 999px;
  padding: 0.42rem 0.9rem;
  font-size: 0.76rem; font-weight: 700; cursor: pointer;
  display: none;
}
.new-pill.show { display: inline-block; }
.typing { display: flex; gap: 5px; align-items: center; color: var(--muted); font-size: 0.76rem; }
.typing[hidden] { display: none; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: blink 1.3s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* ---------------------------------------------------------------- petition */
.petition textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  background: rgba(6, 3, 12, 0.6);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.95rem;
  padding: 0.75rem 0.85rem;
  transition: border-color 0.2s;
}
.petition textarea:focus { outline: none; border-color: rgba(240, 192, 90, 0.55); box-shadow: 0 0 0 3px rgba(240, 192, 90, 0.12); }
.petition textarea:disabled { opacity: 0.5; }
.petition-row { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin-top: 0.7rem; }
.counter { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.06em; }
.counter.over { color: var(--danger); }
.petition-note { font-size: 0.74rem; color: var(--muted); margin: 0.8rem 0 0; }
.ask-state {
  margin-top: 0.9rem;
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  font-size: 0.88rem;
  display: none;
  border: 1px solid var(--line-soft);
  background: rgba(6, 3, 12, 0.5);
}
.ask-state.show { display: block; animation: rise 0.35s ease both; }
.ask-state.pending { border-color: rgba(240, 192, 90, 0.4); color: var(--gold-3); }
.ask-state.error { border-color: rgba(255, 159, 159, 0.4); color: var(--danger); }
.ask-state.done { border-color: rgba(126, 224, 168, 0.4); color: var(--ok); }

/* ---------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.stat {
  background: rgba(6, 3, 12, 0.45);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.8rem;
}
.stat .k { font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-family: var(--serif); font-size: 1.15rem; }
.stat .v small { font-family: var(--sans); font-size: 0.7rem; color: var(--muted); }

/* ---------------------------------------------------------------- notice */
.notice {
  display: flex; align-items: flex-start; gap: 0.7rem;
  background: rgba(240, 192, 90, 0.08);
  border: 1px solid rgba(240, 192, 90, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  margin: 1.1rem 0 0;
}
.notice strong { color: var(--gold-3); }

/* ---------------------------------------------------------------- tables */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--line-soft); }
.table th { font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- ladder list */
.rungs { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.rung {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.9rem;
  background: rgba(6, 3, 12, 0.35);
}
.rung.unlocked { border-color: rgba(240, 192, 90, 0.4); background: rgba(240, 192, 90, 0.06); }
.rung .num {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}
.rung.unlocked .num { background: linear-gradient(140deg, var(--gold-3), var(--gold-2)); color: #2a1904; border-color: transparent; }
.rung .name { font-family: var(--serif); font-size: 1rem; }
.rung .desc { font-size: 0.84rem; color: var(--muted); }
.rung .goal { font-family: var(--serif); color: var(--gold-3); white-space: nowrap; }
.rung .when { font-size: 0.7rem; color: var(--muted); display: block; text-align: right; }

/* ---------------------------------------------------------------- footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2.2rem 0 2.6rem;
  margin-top: 1rem;
  background: linear-gradient(180deg, transparent, rgba(10, 6, 19, 0.85));
}
.disclosure {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  background: rgba(6, 3, 12, 0.5);
  font-size: 0.84rem;
  color: #c6bbdd;
}
.disclosure strong { color: var(--gold-3); }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--gold-3); }
.footer-fine { font-size: 0.72rem; color: var(--muted); margin-top: 0.9rem; }

/* ---------------------------------------------------------------- prose pages */
.prose { max-width: 74ch; }
.prose h2 { margin-top: 2rem; }
.prose ul { padding-left: 1.1rem; }
.prose li { margin-bottom: 0.45rem; }
.prose .lede { font-size: 1.05rem; color: #cfc4e6; }
.pull {
  border-left: 3px solid var(--gold);
  padding: 0.2rem 0 0.2rem 1rem;
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--gold-3);
  margin: 1.6rem 0;
}
.page-head { padding: 2.6rem 0 0.6rem; }
.page-head h1 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); }

/* ---------------------------------------------------------------- admin */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.2rem; }
.admin-grid input[type='text'], .admin-grid input[type='number'], .admin-grid select, .admin-grid textarea {
  width: 100%; background: rgba(6, 3, 12, 0.6); border: 1px solid var(--line-soft);
  border-radius: 10px; color: var(--ink); padding: 0.55rem 0.7rem; font-family: var(--sans); font-size: 0.9rem;
}
label.field { display: block; margin-bottom: 0.7rem; font-size: 0.78rem; color: var(--muted); letter-spacing: 0.06em; }
label.field span { display: block; margin-bottom: 0.25rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: 0.35rem; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 960px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; order: -1; }
  .feed { max-height: 560px; }
}
@media (max-width: 720px) {
  body { font-size: 15.5px; }
  .ladder { grid-template-columns: auto 1fr; }
  .ladder .cta { grid-column: 1 / -1; }
  .brand .sub { display: none; }
  .site-nav { display: none; }
  .site-nav.open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    padding: 0.7rem;
    background: rgba(10, 6, 19, 0.98);
    border-bottom: 1px solid var(--line);
  }
  .nav-toggle { display: inline-flex; }
  .msg { grid-template-columns: 38px minmax(0, 1fr); gap: 0.65rem; }
  .msg .avatar { width: 38px; height: 38px; }
  .msg .avatar svg { width: 20px; height: 20px; }
}
@media (max-width: 480px) {
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { width: 100%; }
}
@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
@media print {
  body::before, body::after, .site-nav, .petition, .hero-cta { display: none; }
}

/* ==========================================================================
   Serialisation: recap header, now-playing strip, quote cards, decrees
   ========================================================================== */

.recap-card { background: linear-gradient(180deg, rgba(240,192,90,.07), var(--panel)); }
.recap-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .35rem; }
.recap-head .card-kicker { margin-bottom: 0; }
.day-badge {
  font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-3);
  border: 1px solid var(--line); border-radius: 999px; padding: .22rem .6rem;
  background: rgba(240,192,90,.08);
}
.recap { font-size: .95rem; color: #cfc4e6; margin: 0; max-width: 80ch; }
.recap a { white-space: nowrap; }

.now-playing {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .55rem;
  border: 1px solid rgba(139,92,246,.35);
  background: linear-gradient(180deg, rgba(139,92,246,.12), rgba(139,92,246,.04));
  border-radius: var(--radius-sm);
  padding: .55rem .8rem;
  margin-bottom: .9rem;
  font-size: .82rem;
}
.now-playing .np-label {
  font-size: .6rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold);
}
.now-playing strong { font-family: var(--serif); font-size: .95rem; letter-spacing: .04em; }
.now-playing .np-meta { color: var(--muted); font-size: .72rem; }
.now-playing .np-topic { color: #d8cff0; flex: 1 1 16ch; }
.now-playing .np-outcome { flex: 1 1 100%; font-size: .72rem; color: var(--muted); font-style: italic; }

.quotes { display: grid; gap: 1.1rem; }
.quote {
  margin: 0;
  border: 1px solid var(--line-soft);
  border-left: 3px solid rgba(240,192,90,.6);
  border-radius: 4px var(--radius) var(--radius) 4px;
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.015));
  padding: 1.2rem 1.35rem;
  box-shadow: var(--shadow);
}
.quote.advisor { border-left-color: rgba(111,211,192,.65); }
.quote blockquote {
  margin: 0 0 .8rem;
  font-family: var(--serif);
  font-size: clamp(1.05rem, 2.1vw, 1.35rem);
  line-height: 1.42;
  color: #f6f1ff;
}
.quote figcaption {
  display: flex; flex-wrap: wrap; align-items: center; gap: .7rem;
  font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.quote figcaption .who { color: var(--gold-3); }
.quote.advisor figcaption .who { color: var(--teal); }
.quote figcaption .btn { margin-left: auto; }
.decree-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; }
.decree-head .seal {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: .8rem; color: #2a1904;
  background: conic-gradient(from 210deg, var(--gold-3), var(--gold-2), var(--gold-3));
}
.decree-head .chapter { font-size: .66rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }

.ask-why { font-size: .74rem; color: var(--muted); margin: .5rem 0 0; max-width: 22ch; }

.canon-body h2 { font-size: 1.15rem; margin-top: 1.8rem; }
.canon-body h2:first-child { margin-top: 0; }
.canon-body h3 { font-size: 1rem; color: var(--gold-3); }
.canon-body ul { padding-left: 1.1rem; }
.canon-body li { margin-bottom: .45rem; font-size: .93rem; color: #d8cff0; }
.canon-body p { font-size: .93rem; color: #d8cff0; }

@media (max-width: 1080px) {
  .site-nav { display: none; }
  .site-nav.open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    padding: 0.7rem;
    background: rgba(10, 6, 19, 0.98);
    border-bottom: 1px solid var(--line);
  }
  .nav-toggle { display: inline-flex; }
}

/* line of the day + quote cards */
.line-of-day { background: linear-gradient(180deg, rgba(139,92,246,.10), var(--panel)); }
.line-of-day blockquote {
  margin: .2rem 0 .5rem;
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2.3vw, 1.5rem);
  line-height: 1.4;
  color: #fff;
}
.lod-meta { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-3); margin: 0; }
.lod-note { display: block; margin-top: .35rem; text-transform: none; letter-spacing: 0; color: var(--muted); font-style: italic; }
.share-card { border-left-width: 4px; }
.share-card blockquote { font-size: clamp(1.25rem, 3vw, 1.9rem); }
.decree-cost {
  font-size: .86rem; color: var(--teal); margin: 0 0 .8rem;
  border-left: 2px solid rgba(111,211,192,.4); padding-left: .7rem;
}
.rung.endless { border-style: dashed; opacity: .85; }
.rung.endless .num { font-size: 1.1rem; color: var(--gold); background: transparent; border-color: var(--line); }
.sketch-break {
  display: flex; align-items: center; gap: .8rem;
  margin: .3rem 0 .1rem;
  color: var(--muted);
  font-family: var(--serif);
  font-size: .68rem;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.sketch-break::before, .sketch-break::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240,192,90,.35), transparent);
}
.sketch-break span { white-space: nowrap; opacity: .8; }

/* support page: preset amounts */
.donate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}
.donate-card {
  display: grid;
  gap: .35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  background: linear-gradient(180deg, rgba(240,192,90,.09), rgba(255,255,255,.02));
  color: var(--ink);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.donate-card:hover {
  transform: translateY(-2px);
  border-color: rgba(240,192,90,.55);
  box-shadow: 0 18px 40px -24px rgba(240,192,90,.7);
  color: #fff;
}
.donate-card .amt {
  font-family: var(--serif);
  font-size: 2rem;
  line-height: 1;
  background: linear-gradient(100deg, var(--gold-3), var(--gold-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.donate-card .name { font-family: var(--serif); font-size: 1rem; letter-spacing: .03em; color: var(--gold-3); }
.donate-card.custom .name { color: var(--royal); }
.donate-card .note { font-size: .82rem; color: var(--muted); line-height: 1.5; }
.donate-card .go {
  font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold);
  margin-top: .35rem;
}
@media (max-width: 520px) {
  .donate-grid { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .donate-card { padding: .9rem; }
  .donate-card .amt { font-size: 1.6rem; }
  .donate-card .note { display: none; }
}
@media (max-width: 360px) { .donate-grid { grid-template-columns: 1fr; } }

/* the gold button in the nav must keep its dark ink text (nav link colour was winning) */
.site-nav a.btn-gold, .site-nav a.btn-gold:hover { color: #241503; }

/* feed direction: say which end is new */
.feed-order {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem .8rem;
  font-size: .76rem;
  color: var(--muted);
  margin-top: .2rem;
}
.feed-order .order-hint strong { color: var(--gold-2); font-weight: 600; }
.feed-head-right { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.latest-jump {
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold-3);
  border: 1px solid rgba(240, 192, 90, .32);
  border-radius: 999px;
  padding: .3rem .68rem;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.latest-jump:hover { background: rgba(240, 192, 90, .13); border-color: rgba(240, 192, 90, .6); color: #fff; }
.tag-latest {
  font-size: .6rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #241503;
  background: linear-gradient(100deg, var(--gold-3), var(--gold-2));
  border-radius: 999px;
  padding: .1rem .42rem;
  font-weight: 700;
}
/* the anchor must not hide under the sticky header */
#latest { scroll-margin-top: 90px; }
@media (max-width: 560px) {
  .feed-order { font-size: .72rem; }
  .order-hint { display: block; }
  .latest-jump { padding: .26rem .58rem; }
}

/* the feed's direction has to be legible, not a whisper */
.feed-order .order-hint {
  color: var(--ink-2);
  font-size: .8rem;
  letter-spacing: .01em;
}
.feed-order .order-hint .arrow {
  color: var(--gold-2);
  font-weight: 700;
  margin-right: .35rem;
}
.latest-jump {
  background: rgba(240, 192, 90, .12);
  font-weight: 600;
  letter-spacing: .06em;
}
.feed-card, .feed-head { scroll-margin-top: 96px; }

/* narrow screens: stack the feed header so the direction statement stays readable */
@media (max-width: 640px) {
  .feed-head { flex-direction: column; align-items: stretch; gap: .55rem; }
  .feed-head-right { justify-content: space-between; }
  .feed-title { white-space: nowrap; }
  .feed-order { flex-direction: column; gap: .2rem; }
  .feed-order .order-hint { font-size: .78rem; line-height: 1.35; }
  .latest-jump { font-size: .64rem; letter-spacing: .05em; padding: .34rem .6rem; }
}

/* twohanders-footer — scoped with th- prefixes: .footer-links already exists in the site footers */
.th-family {
  text-align: center;
  margin-top: 1.6rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: .78rem;
  line-height: 1.7;
  color: var(--muted, #a89cc4);
}
.th-family p { margin: .2rem 0; }
.th-family a { color: inherit; text-decoration: none; border-bottom: 1px solid rgba(240, 192, 90, .35); }
.th-family a:hover { color: var(--gold, #f0c05a); border-bottom-color: currentColor; }
.th-family .th-legal { letter-spacing: .04em; }
.th-family .th-nav { font-size: .8rem; }
.th-family .th-showline a, .th-family .th-nav a { display: inline; }
.th-family .th-showline { opacity: .85; }

/* legal pages */
.legal h2 { font-family: var(--serif, Georgia, serif); font-size: 1.05rem; letter-spacing: .04em;
            margin: 1.8rem 0 .5rem; color: var(--gold-3, #ffe9b0); }
.legal p { margin: 0 0 .9rem; }
.legal .legal-updated { margin-top: 2rem; font-size: .78rem; color: var(--muted, #a89cc4); }

/* one centred footer: nav row, fine print and the family block share an axis.
   The disclosure panel keeps its paragraph text flush left, where prose belongs. */
.site-footer { text-align: center; }
.site-footer .footer-links { justify-content: center; }
.site-footer .footer-fine { text-align: center; }
.site-footer .disclosure { text-align: left; }

/* scene of the day: the pinned, shareable thing at the top of the feed */
.scene-of-day { border: 1px solid rgba(240,192,90,.22); border-radius: 16px; padding: 1rem 1.1rem;
  background: linear-gradient(180deg, rgba(240,192,90,.05), rgba(255,255,255,.01)); }
.sod-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .7rem; }
.sod-kicker { font-family: var(--display, Cinzel), serif; font-size: .72rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--gold, #f0c05a); }
.sod-open { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold, #f0c05a);
  text-decoration: none; }
.sod-card { display: block; border-radius: 10px; overflow: hidden; border: 1px solid rgba(255,255,255,.07); }
.sod-card img { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; background: #0d0718; }
.sod-note { margin: .6rem 0 0; font-size: .78rem; color: var(--muted, #9c93b5); }
.sod-note a { color: var(--gold, #f0c05a); }

/* the crier: a notice between chapters, full width, not a character */
.crier { display: flex; align-items: baseline; gap: .7rem; margin: 1rem 0; padding: .85rem 1rem;
  border-top: 1px solid rgba(240,192,90,.3); border-bottom: 1px solid rgba(240,192,90,.3);
  background: linear-gradient(90deg, rgba(240,192,90,.06), transparent 72%);
  font-family: var(--body, Inter), sans-serif; font-size: .95rem; color: var(--ink, #f0ebf9); }
.crier-bell { color: var(--gold, #f0c05a); font-size: .8rem; }
.crier-text { flex: 1; font-style: italic; }
.crier-when { font-family: ui-monospace, monospace; font-size: .66rem; color: var(--muted, #9c93b5); }
