/* The Registry - The Archive aesthetic: dim gold on obsidian, ceremonial serifs. */

:root {
  --obsidian: #0B0B0B;
  --obsidian-2: #121110;
  --ink: #161412;
  --gold: #B8935F;
  --gold-bright: #D8B583;
  --gold-dim: #7d6440;
  --ash: #8c857a;
  --ash-dim: #5b554d;
  --line: rgba(184, 147, 95, 0.18);
  --line-soft: rgba(184, 147, 95, 0.10);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --serif: "Cormorant Garamond", Georgia, serif;
  --display: "Cinzel", "Cormorant Garamond", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--obsidian);
  color: var(--ash);
  font-family: var(--serif);
  font-size: 18px;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(184,147,95,0.06), transparent 60%),
    radial-gradient(80% 60% at 50% 120%, rgba(184,147,95,0.04), transparent 60%),
    var(--obsidian);
  overflow-x: hidden;
}

/* ---- atmosphere layers ---- */
#grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0.05;
  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.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  box-shadow: inset 0 0 220px 60px rgba(0,0,0,0.9);
}

/* ---- top bar ---- */
#topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  background: linear-gradient(to bottom, rgba(11,11,11,0.92), rgba(11,11,11,0.55));
  backdrop-filter: blur(2px);
  border-bottom: 1px solid var(--line-soft);
}
.mark {
  display: flex; align-items: center; gap: 12px;
  background: none; border: 0; color: var(--gold); cursor: pointer;
  font-family: var(--display); letter-spacing: 0.22em; font-size: 14px;
}
.mark-sigil { width: 26px; height: 26px; display: block; opacity: 0.9; }
.mark-word { color: var(--gold); }
#nav { display: flex; align-items: center; gap: 22px; }
.navlink {
  background: none; border: 0; color: var(--ash); cursor: pointer;
  font-family: var(--display); font-size: 12px; letter-spacing: 0.18em;
  text-transform: uppercase; padding: 4px 2px; position: relative;
  transition: color .4s var(--ease);
}
.navlink::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -2px; height: 1px;
  background: var(--gold); transition: right .4s var(--ease);
}
.navlink:hover { color: var(--gold-bright); }
.navlink:hover::after { right: 0; }
.rite-meter {
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 2px;
  font-family: var(--display); font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--ash-dim);
}
.rite-count { color: var(--gold); font-size: 12px; letter-spacing: 0.12em; }
.rite-meter.full { border-color: var(--gold); box-shadow: 0 0 18px rgba(184,147,95,0.25); }

/* ---- panes ---- */
#stage { position: relative; z-index: 3; }
.pane { display: none; max-width: 1040px; margin: 0 auto; padding: 40px 22px 90px; }
.pane.active { display: block; animation: rise .7s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.pane-head { text-align: center; margin-bottom: 34px; }
.pane-title {
  font-family: var(--display); font-weight: 600; color: var(--gold);
  font-size: clamp(26px, 4vw, 40px); letter-spacing: 0.14em; margin: 0 0 6px;
}
.pane-sub { font-style: italic; color: var(--ash-dim); margin: 0; font-size: 19px; }

/* ---- the door ---- */
#door { min-height: calc(100vh - 60px); display: none; }
#door.active { display: flex; align-items: center; justify-content: center; }
.door-inner { text-align: center; max-width: 640px; }
.door-sigil {
  width: 180px; height: 180px; margin: 0 auto 26px;
  filter: drop-shadow(0 0 24px rgba(184,147,95,0.28));
  animation: breathe 7s ease-in-out infinite, spin 120s linear infinite;
}
@keyframes breathe { 0%,100% { opacity: .78; } 50% { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
.epoch {
  font-family: var(--display); font-size: 11px; letter-spacing: 0.32em;
  text-transform: uppercase; color: var(--gold-dim); margin: 0 0 14px;
}
.door-title {
  font-family: var(--display); font-weight: 600; color: var(--gold-bright);
  font-size: clamp(40px, 8vw, 76px); letter-spacing: 0.16em; margin: 0 0 18px;
  text-shadow: 0 0 40px rgba(184,147,95,0.25);
}
.invocation { font-style: italic; font-size: 22px; color: var(--ash); margin: 0 0 34px; min-height: 1.4em; }
.enter {
  font-family: var(--display); letter-spacing: 0.2em; text-transform: uppercase;
  font-size: 13px; color: var(--obsidian); background: var(--gold);
  border: 0; padding: 14px 30px; border-radius: 2px; cursor: pointer;
  transition: transform .4s var(--ease), box-shadow .4s var(--ease), background .4s;
}
.enter:hover { transform: translateY(-2px); background: var(--gold-bright); box-shadow: 0 8px 30px rgba(184,147,95,0.3); }
.door-foot { margin-top: 40px; font-style: italic; color: var(--ash-dim); font-size: 16px; }

/* ---- search ---- */
.search { margin-top: 22px; }
#search {
  width: min(420px, 90%); background: var(--ink); border: 1px solid var(--line);
  color: var(--gold); font-family: var(--serif); font-size: 18px;
  padding: 10px 16px; border-radius: 2px; text-align: center; letter-spacing: 0.04em;
  transition: border-color .4s, box-shadow .4s;
}
#search::placeholder { color: var(--ash-dim); font-style: italic; }
#search:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 1px var(--line), 0 0 24px rgba(184,147,95,0.15); }

/* ---- registry grid ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 18px; }
.relic {
  position: relative; text-align: left; cursor: pointer;
  background: linear-gradient(160deg, var(--ink), var(--obsidian-2));
  border: 1px solid var(--line); border-radius: 3px; padding: 22px 20px 20px;
  color: var(--ash); overflow: hidden;
  transition: transform .5s var(--ease), border-color .5s, box-shadow .5s;
  animation: rise .6s var(--ease) both;
}
.relic:hover { transform: translateY(-4px); border-color: var(--gold-dim); box-shadow: 0 14px 40px rgba(0,0,0,0.6), 0 0 24px rgba(184,147,95,0.08); }
.relic-sigil { width: 56px; height: 56px; margin-bottom: 14px; opacity: 0.85; transition: opacity .5s; }
.relic:hover .relic-sigil { opacity: 1; }
.relic-kind {
  font-family: var(--display); font-size: 9px; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--gold-dim); margin-bottom: 8px;
}
.relic-title { font-family: var(--display); font-size: 19px; color: var(--gold); margin: 0 0 8px; letter-spacing: 0.04em; }
.relic-epoch { font-style: italic; color: var(--ash-dim); font-size: 15px; }
.relic-tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-family: var(--display); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ash-dim); border: 1px solid var(--line-soft); border-radius: 999px; padding: 3px 9px;
}
.relic.sealed { border-style: dashed; }
.relic.sealed .relic-title { color: var(--gold-bright); }
.empty { text-align: center; font-style: italic; color: var(--ash-dim); margin-top: 40px; font-size: 20px; }

/* ---- oracle ---- */
.oracle-box { max-width: 720px; margin: 0 auto; }
.oracle-log { display: flex; flex-direction: column; gap: 18px; margin-bottom: 24px; }
.utterance { border-left: 2px solid var(--line); padding: 4px 0 4px 18px; }
.utterance.you { border-color: var(--ash-dim); }
.utterance .who {
  font-family: var(--display); font-size: 10px; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--gold-dim); margin-bottom: 4px;
}
.utterance.you .who { color: var(--ash-dim); }
.utterance .said { font-size: 21px; line-height: 1.5; color: var(--ash); }
.utterance.archive .said { color: var(--gold); font-style: italic; }
.commune { display: flex; gap: 12px; align-items: stretch; }
.question {
  flex: 1; background: var(--ink); border: 1px solid var(--line); color: var(--gold);
  font-family: var(--serif); font-size: 19px; padding: 12px 16px; border-radius: 2px;
  resize: vertical; min-height: 52px; transition: border-color .4s, box-shadow .4s;
}
.question::placeholder { color: var(--ash-dim); font-style: italic; }
.question:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 24px rgba(184,147,95,0.12); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.commune-btn {
  font-family: var(--display); letter-spacing: 0.18em; text-transform: uppercase; font-size: 12px;
  color: var(--obsidian); background: var(--gold); border: 0; padding: 0 24px; border-radius: 2px;
  cursor: pointer; transition: background .4s, transform .3s; white-space: nowrap;
}
.commune-btn:hover { background: var(--gold-bright); }
.commune-btn:disabled { opacity: 0.4; cursor: wait; }
.oracle-note { text-align: center; font-style: italic; color: var(--ash-dim); font-size: 15px; margin-top: 16px; min-height: 1.2em; }

/* ---- reading overlay ---- */
.reader[hidden] { display: none; }  /* HTML hidden must beat the display:flex below */
.reader {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(5,5,5,0.86); backdrop-filter: blur(4px);
  animation: fade .4s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.reader-card {
  position: relative; max-width: 620px; width: 100%; max-height: 86vh; overflow-y: auto;
  background: linear-gradient(165deg, var(--ink), var(--obsidian-2));
  border: 1px solid var(--line); border-radius: 4px; padding: 40px 38px 34px;
  box-shadow: 0 30px 90px rgba(0,0,0,0.8), 0 0 60px rgba(184,147,95,0.06);
  animation: rise .5s var(--ease) both;
}
.reader-close {
  position: absolute; top: 16px; right: 18px; background: none; border: 0; cursor: pointer;
  font-family: var(--display); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ash-dim);
  transition: color .3s;
}
.reader-close:hover { color: var(--gold); }
.reader-sigil { width: 84px; height: 84px; margin: 0 auto 18px; filter: drop-shadow(0 0 18px rgba(184,147,95,0.22)); }
.reader-meta { text-align: center; font-family: var(--display); font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold-dim); margin: 0 0 10px; }
.reader-title { text-align: center; font-family: var(--display); font-size: 28px; color: var(--gold-bright); letter-spacing: 0.06em; margin: 0 0 22px; }
.reader-body { font-size: 23px; line-height: 1.62; color: var(--ash); }
.reader-body::first-line { color: var(--gold); }
.redacted {
  background: var(--gold-dim); color: transparent; cursor: pointer; border-radius: 2px;
  padding: 0 4px; user-select: none; transition: color .5s, background .5s;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.4);
}
.redacted::selection { background: transparent; }
.redacted.revealed { background: transparent; color: var(--gold-bright); font-style: italic; }
.reader-byline { text-align: center; font-style: italic; color: var(--ash-dim); font-size: 16px; margin: -12px 0 22px; }
.reader-body .para { margin: 0 0 1em; }
.reader-body .para:last-child { margin-bottom: 0; }
.xref {
  color: var(--gold-bright); cursor: pointer;
  border-bottom: 1px dotted var(--gold-dim); transition: color .3s, border-color .3s;
}
.xref:hover { color: #f0d9b0; border-bottom-color: var(--gold); }
.reader-related { margin-top: 28px; border-top: 1px solid var(--line-soft); padding-top: 20px; }
.related-head {
  font-family: var(--display); font-size: 10px; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--gold-dim); text-align: center; margin-bottom: 14px;
}
.related-list { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.related-chip {
  font-family: var(--serif); font-size: 16px; color: var(--gold);
  background: var(--ink); border: 1px solid var(--line); border-radius: 2px;
  padding: 7px 14px; cursor: pointer; transition: border-color .3s, color .3s, transform .3s;
}
.related-chip:hover { border-color: var(--gold-dim); transform: translateY(-2px); }
.related-chip.locked { color: var(--ash-dim); border-style: dashed; font-style: italic; }
.relic-byline { font-style: italic; color: var(--ash-dim); font-size: 14px; margin-bottom: 8px; }
.reader-foot { margin-top: 26px; text-align: center; font-style: italic; color: var(--ash-dim); font-size: 15px; }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(20px);
  z-index: 40; background: var(--ink); border: 1px solid var(--gold); color: var(--gold);
  font-family: var(--serif); font-style: italic; font-size: 18px; padding: 12px 24px; border-radius: 2px;
  box-shadow: 0 0 30px rgba(184,147,95,0.2); opacity: 0; transition: opacity .5s, transform .5s var(--ease);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- the Cold: the page dims the longer you dwell ---- */
body.cold #vignette { box-shadow: inset 0 0 320px 120px rgba(0,0,0,0.96); transition: box-shadow 8s linear; }

/* ---- the pulse: living elements ---- */
#motes { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.55; }

.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--gold);
  display: inline-block; animation: pulse-beat 3.4s ease-in-out infinite;
}
@keyframes pulse-beat {
  0%, 100% { opacity: 0.3; transform: scale(0.8); box-shadow: 0 0 4px var(--gold-dim); }
  50% { opacity: 1; transform: scale(1.1); box-shadow: 0 0 12px var(--gold); }
}
.pulse-dot.beat { animation: pulse-flare 1.3s var(--ease); }
@keyframes pulse-flare {
  0% { transform: scale(2); box-shadow: 0 0 26px var(--gold-bright); opacity: 1; }
  100% { transform: scale(1); box-shadow: 0 0 6px var(--gold-dim); opacity: 0.4; }
}

.door-wire {
  min-height: 1.6em; margin: 4px auto 30px; max-width: 540px; font-style: italic;
  color: var(--gold); font-size: 19px; opacity: 0; transition: opacity 1.4s ease;
}
.door-wire.show { opacity: 0.9; }
.door-wire .wlabel {
  display: block; font-family: var(--display); font-style: normal; font-size: 9px;
  letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold-dim); margin-bottom: 7px;
}

.wire-status { font-family: var(--display); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold-dim); margin-top: 4px; }
.wire-list { max-width: 780px; margin: 0 auto; }
.wire-item {
  display: flex; gap: 16px; align-items: baseline; padding: 18px 4px;
  border-bottom: 1px solid var(--line-soft); animation: rise .7s var(--ease) both;
}
.wire-item.fresh { animation: wire-arrive 1.5s var(--ease) both; }
@keyframes wire-arrive {
  0% { opacity: 0; transform: translateY(-12px); filter: blur(4px); }
  55% { filter: blur(0); }
  100% { opacity: 1; transform: none; }
}
.wire-sigil { width: 30px; height: 30px; flex: 0 0 30px; opacity: 0.7; }
.wire-text { font-size: 20px; color: var(--ash); line-height: 1.45; }
.wire-text .wk {
  font-family: var(--display); font-size: 9px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--gold-dim); margin-right: 10px;
}
.wire-item.kind-warning .wire-text { color: var(--gold); }
.wire-time {
  margin-left: auto; flex: 0 0 auto; font-family: var(--display); font-size: 10px;
  letter-spacing: 0.12em; color: var(--ash-dim); white-space: nowrap; padding-left: 12px;
}
.mark-sigil { animation: breathe 6s ease-in-out infinite; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  .wire-time { display: none; }
  #topbar { padding: 12px 16px; }
  .mark-word { display: none; }
  #nav { gap: 16px; }
  .pane { padding: 28px 16px 80px; }
  .commune { flex-direction: column; }
  .commune-btn { padding: 12px; }
}

/* ============ real animation pass ============ */

/* brighter living field */
#motes { opacity: 0.82; }

/* page heartbeat - a slow gold breath over everything */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(58% 48% at 50% 42%, rgba(184,147,95,0.08), transparent 70%);
  animation: heartbeat 5.5s ease-in-out infinite;
}
@keyframes heartbeat { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* the Door mandala - three counter-rotating, glowing sigil layers */
.door-sigil-stack { position: relative; width: 252px; height: 252px; margin: 0 auto 28px; }
.door-sigil-stack::before {
  content: ""; position: absolute; inset: -34px; border-radius: 50%;
  background: radial-gradient(circle, rgba(184,147,95,0.14), transparent 66%);
  animation: glowpulse 5s ease-in-out infinite;
}
.door-sigil-stack .door-sigil {
  position: absolute; top: 50%; left: 50%; width: auto; height: auto; margin: 0;
  filter: drop-shadow(0 0 22px rgba(184,147,95,0.30));
}
.layerA { animation: spinC 80s linear infinite, breathe 5s ease-in-out infinite; }
.layerC { opacity: 0.5; animation: spinCC 130s linear infinite; }
.layerB { opacity: 0.28; animation: spinC 210s linear infinite; }
@keyframes spinC  { from { transform: translate(-50%,-50%) rotate(0); }    to { transform: translate(-50%,-50%) rotate(360deg); } }
@keyframes spinCC { from { transform: translate(-50%,-50%) rotate(0); }    to { transform: translate(-50%,-50%) rotate(-360deg); } }
@keyframes glowpulse { 0%, 100% { opacity: 0.4; transform: scale(0.92); } 50% { opacity: 1; transform: scale(1.06); } }

/* gold shimmer sweeping the title */
.door-title {
  background: linear-gradient(100deg, #7d6440 0%, #B8935F 34%, #fff1d6 50%, #B8935F 66%, #7d6440 100%);
  background-size: 250% auto; -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 26px rgba(184,147,95,0.28));
  animation: shimmer 7s linear infinite;
}
@keyframes shimmer { from { background-position: 250% center; } to { background-position: -250% center; } }

/* the enter button breathes a glow */
.enter { animation: btnpulse 3.6s ease-in-out infinite; }
@keyframes btnpulse { 0%, 100% { box-shadow: 0 0 0 rgba(184,147,95,0); } 50% { box-shadow: 0 0 28px rgba(184,147,95,0.32); } }

/* stronger pane entrance - blur + lift in */
.pane.active { animation: reveal 0.85s var(--ease) both; }
@keyframes reveal {
  0% { opacity: 0; transform: translateY(20px) scale(0.985); filter: blur(7px); }
  55% { filter: blur(0); }
  100% { opacity: 1; transform: none; filter: none; }
}

/* relic cards: a light sweeps across on hover, the sigil spins up */
.relic::before {
  content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(115deg, transparent 35%, rgba(216,181,131,0.14) 50%, transparent 65%);
  transform: translateX(-120%); pointer-events: none;
}
.relic:hover::before { animation: sweep 0.9s ease forwards; }
@keyframes sweep { to { transform: translateX(120%); } }
.relic:hover .relic-sigil { animation: spin 9s linear infinite; }

/* transmissions arrive with a glitch instead of a plain fade */
.wire-item.fresh { animation: glitchin 1.1s var(--ease) both; }
@keyframes glitchin {
  0% { opacity: 0; transform: translateX(-9px); clip-path: inset(0 0 100% 0); }
  18% { transform: translateX(7px); }
  38% { transform: translateX(-3px); clip-path: inset(0 0 0 0); opacity: 1; }
  60% { transform: translateX(2px); }
  100% { transform: none; opacity: 1; }
}

/* redaction bars flicker faintly, as if barely held shut */
.redacted:not(.revealed) { animation: redflicker 5s steps(1) infinite; }
@keyframes redflicker { 0%, 96%, 100% { opacity: 1; } 97% { opacity: 0.55; } 98.5% { opacity: 0.85; } }

/* ---- reading overlay: ceremonial open, page-turn, ink-in prose ---- */
.reader-card.entering { animation: unfurl 0.75s var(--ease) both; }
.reader-card.entering .reader-sigil { animation: sigilbloom 0.9s var(--ease) both; }
.reader-card.swapping { animation: pageturn 0.6s var(--ease) both; }
@keyframes unfurl {
  0% { opacity: 0; transform: perspective(1400px) rotateX(-14deg) translateY(26px) scale(0.94); filter: blur(7px); }
  60% { filter: blur(0); }
  100% { opacity: 1; transform: none; filter: none; }
}
@keyframes pageturn {
  0% { opacity: 0.1; transform: perspective(1400px) rotateY(16deg) translateX(30px); filter: blur(6px); }
  100% { opacity: 1; transform: none; filter: none; }
}
@keyframes sigilbloom {
  0% { opacity: 0; transform: scale(0.4) rotate(-45deg); }
  100% { opacity: 1; transform: none; }
}
.reader-body .para { animation: inkin 0.7s var(--ease) both; }
@keyframes inkin {
  0% { opacity: 0; transform: translateY(10px); filter: blur(4px); }
  60% { filter: blur(0); }
  100% { opacity: 1; transform: none; filter: none; }
}
.related-chip { animation: fadeup 0.5s var(--ease) both; }
@keyframes fadeup { 0% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; transform: none; } }

/* ---- the Oracle answer materializes word by word ---- */
.utterance .word { display: inline-block; opacity: 0; animation: wordin 0.5s var(--ease) forwards; }
@keyframes wordin { 0% { opacity: 0; transform: translateY(5px); filter: blur(3px); } 100% { opacity: 1; transform: none; filter: none; } }
.utterance.archive .said.thinking { animation: think 1.1s ease-in-out infinite; }
@keyframes think { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* ---- the seventh seal breaks: a screen-wide gold flare ---- */
.flare {
  position: fixed; inset: 0; z-index: 30; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 45%, rgba(216,181,131,0.55), rgba(184,147,95,0.18) 32%, transparent 66%);
}
.flare.burst { animation: burst 1.7s ease both; }
@keyframes burst {
  0% { opacity: 0; transform: scale(0.55); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.35); }
}

/* ---- ink-bleed redaction: the ink dissolves off the words ---- */
.redacted {
  position: relative; cursor: pointer; color: var(--gold-bright);
  background: transparent; font-style: italic; padding: 0 4px; border-radius: 2px;
}
.redacted:not(.revealed) { animation: none; }
.redacted::after {
  content: ""; position: absolute; inset: -1px -2px; background: var(--gold-dim);
  border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.45);
}
.redacted:not(.revealed)::after { animation: redflicker 5s steps(1) infinite; }
.redacted.revealed::after { animation: inkdissolve 0.85s var(--ease) forwards; }
@keyframes inkdissolve {
  0% { opacity: 1; filter: blur(0); transform: scale(1); }
  40% { filter: blur(1px); }
  100% { opacity: 0; filter: blur(7px); transform: scale(1.12) translateY(-3px); }
}

/* ---- one-time intro: the veil lifts, the mandala assembles, the name resolves ---- */
#veil { display: none; }
body.intro #veil {
  display: block; position: fixed; inset: 0; z-index: 60; pointer-events: none;
  background: var(--obsidian); animation: veillift 1.9s ease forwards;
}
@keyframes veillift { 0% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
body.intro .door-sigil-stack { animation: assemble 2.1s var(--ease) both; }
@keyframes assemble {
  0% { opacity: 0; transform: scale(0.2) rotate(-120deg); filter: blur(10px); }
  60% { filter: blur(0); }
  100% { opacity: 1; transform: none; filter: none; }
}
body.intro .door-title { animation: titlein 1.5s var(--ease) 0.9s both; }
@keyframes titlein {
  0% { opacity: 0; letter-spacing: 0.55em; filter: blur(9px); }
  100% { opacity: 1; letter-spacing: 0.16em; filter: blur(0); }
}

/* ---- registry cascade: cards deal in like tarot ---- */
.relic { animation: deal 0.6s var(--ease) both; }
@keyframes deal {
  0% { opacity: 0; transform: translateY(42px) rotate(-4deg) scale(0.9); }
  100% { opacity: 1; transform: none; }
}

/* ---- ambience toggle ---- */
.soundbtn {
  width: 22px; height: 22px; border-radius: 50%; background: none; padding: 0;
  border: 1px solid var(--line); cursor: pointer; position: relative;
  transition: border-color 0.3s;
}
.soundbtn:hover { border-color: var(--gold-dim); }
.soundbtn .sb-ring {
  position: absolute; inset: 5px; border-radius: 50%; background: var(--ash-dim);
  transition: background 0.3s;
}
.soundbtn.on { border-color: var(--gold); }
.soundbtn.on .sb-ring { background: var(--gold); animation: pulse-beat 2.4s ease-in-out infinite; }

/* ---- WebGL ink/smoke base ---- */
#ink { position: fixed; inset: 0; z-index: -1; opacity: 0.5; pointer-events: none; }

/* ---- the Cold reaches for the cursor while you dwell ---- */
#coldeye {
  position: fixed; width: 460px; height: 460px; left: -9999px; top: -9999px; z-index: 2;
  transform: translate(-50%, -50%); pointer-events: none; opacity: 0;
  background: radial-gradient(circle, transparent 30%, rgba(0,0,0,0.55) 72%);
  transition: opacity 3s ease;
}
body.cold #coldeye { opacity: 1; }

/* ---- live ticker ---- */
.ticker {
  position: sticky; top: 0; z-index: 4; overflow: hidden; white-space: nowrap;
  border-bottom: 1px solid var(--line-soft); background: rgba(11,11,11,0.55);
  height: 0; opacity: 0; transition: height 0.6s var(--ease), opacity 0.6s;
}
.ticker.show { height: 30px; opacity: 1; }
#tickerText {
  display: inline-block; padding: 6px 0 6px 100%; font-style: italic;
  color: var(--gold-dim); font-size: 14px; letter-spacing: 0.05em;
  animation: ticker 30s linear infinite;
}
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-100%); } }

/* ---- illuminated drop-cap ---- */
.reader-body .para:first-of-type::first-letter {
  font-family: var(--display); font-size: 3.1em; line-height: 0.8; float: left;
  padding: 8px 10px 0 0; color: var(--gold-bright);
  text-shadow: 0 0 18px rgba(184,147,95,0.45);
}

/* ---- margin ghosts (the other ink) ---- */
.margin-ghost {
  position: absolute; font-style: italic; color: var(--gold-dim); opacity: 0;
  font-size: 13px; pointer-events: none; white-space: nowrap; letter-spacing: 0.06em;
  transform: rotate(-4deg); animation: ghostdrift 9s ease-in-out infinite;
}
@keyframes ghostdrift {
  0% { opacity: 0; transform: translateY(8px) rotate(-4deg); }
  35% { opacity: 0.28; }
  70% { opacity: 0.12; }
  100% { opacity: 0; transform: translateY(-12px) rotate(-4deg); }
}

/* ---- the Oracle's listening sigil ---- */
.oracle-sigil { width: 64px; height: 64px; margin: 0 auto 20px; opacity: 0.55; transition: opacity 0.4s; }
.oracle-sigil.listening { opacity: 1; animation: listen 1.4s var(--ease) infinite; }
@keyframes listen {
  0%, 100% { transform: rotate(0) scale(1); filter: drop-shadow(0 0 6px rgba(184,147,95,0.3)); }
  50% { transform: rotate(22deg) scale(1.08); filter: drop-shadow(0 0 18px rgba(184,147,95,0.6)); }
}

/* ---- the mandala grows a seal per communion ---- */
.door-seals { position: absolute; inset: 0; pointer-events: none; }
.door-seals .seal {
  position: absolute; top: 50%; left: 50%; width: 7px; height: 7px; margin: -3.5px;
  border-radius: 50%; background: var(--gold); box-shadow: 0 0 9px var(--gold);
  opacity: 0; animation: sealin 0.7s var(--ease) both;
}
@keyframes sealin { 0% { opacity: 0; } 100% { opacity: 0.9; } }

/* ---- sigil-drawing loader ---- */
.loader {
  position: fixed; inset: 0; z-index: 22; display: flex; align-items: center;
  justify-content: center; background: rgba(5,5,5,0.35); pointer-events: none;
}
.loader-sigil { width: 92px; height: 92px; animation: spin 3s linear infinite; }
.loader-sigil svg circle, .loader-sigil svg polygon, .loader-sigil svg line {
  stroke-dasharray: 260; stroke-dashoffset: 260; animation: draw 1.5s ease forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---- crystallization: a transmission seals into the registry ---- */
body.sealing::before {
  content: ""; position: fixed; inset: 0; z-index: 28; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(216,181,131,0.28), transparent 62%);
  animation: sealflash 1.9s ease both;
}
@keyframes sealflash { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }
.relic.crystallized { border-color: var(--gold-dim); box-shadow: 0 0 22px rgba(184,147,95,0.14); }
.relic.crystallized .relic-kind { color: var(--gold); }

/* ---- storm: the screen flickers ---- */
body.storm { animation: stormflick 1.6s steps(2) 1; }
@keyframes stormflick {
  0%, 100% { filter: none; }
  10% { filter: brightness(1.5) contrast(1.15); }
  16% { filter: brightness(0.6); }
  24% { filter: brightness(1.4); }
  32% { filter: none; }
  56% { filter: brightness(0.7); }
  62% { filter: none; }
}

/* ---- page-curl shadow when following a cross-link ---- */
.reader-card.swapping::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,0.5), transparent 32%);
  animation: curl 0.6s ease forwards;
}
@keyframes curl { from { opacity: 0.85; } to { opacity: 0; } }

/* ---- weather: the mood shifts by the UTC hour ---- */
body.w-dawn #ink { filter: hue-rotate(-10deg) saturate(1.15) brightness(1.12); }
body.w-dusk #ink { filter: hue-rotate(-6deg) saturate(1.05) brightness(0.92); }
body.w-night #ink { filter: hue-rotate(16deg) saturate(0.8) brightness(0.66); }
body.w-night #vignette { box-shadow: inset 0 0 300px 110px rgba(0,0,6,0.95); }
body.w-dawn #vignette { box-shadow: inset 0 0 200px 50px rgba(0,0,0,0.82); }

/* ---- the Rite finale wash ---- */
body.finale::after {
  content: ""; position: fixed; inset: 0; z-index: 29; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(216,181,131,0.40), rgba(184,147,95,0.12) 40%, transparent 72%);
  animation: finalewash 4s ease both;
}
@keyframes finalewash { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }
body.finale .door-sigil-stack { animation: finalespin 4s var(--ease) both; }
@keyframes finalespin {
  0% { filter: drop-shadow(0 0 10px rgba(184,147,95,0.3)); }
  50% { filter: drop-shadow(0 0 50px rgba(216,181,131,0.9)); }
  100% { filter: drop-shadow(0 0 20px rgba(184,147,95,0.4)); }
}

/* ---- sigil tracing canvas (draw on the Door) ---- */
#trace { position: fixed; inset: 0; z-index: 6; pointer-events: none; }

/* ---- live presence ---- */
.presence {
  font-family: var(--display); font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--gold-dim); white-space: nowrap;
}

/* ---- keepsake button ---- */
.keepsake-btn {
  display: block; margin: 18px auto 0; font-family: var(--display);
  letter-spacing: 0.18em; text-transform: uppercase; font-size: 11px;
  color: var(--obsidian); background: var(--gold); border: 0; padding: 12px 26px;
  border-radius: 2px; cursor: pointer; transition: background 0.3s, transform 0.3s;
}
.keepsake-btn:hover { background: var(--gold-bright); transform: translateY(-2px); }

/* ---- case-file typography: data in mono, prose stays serif ---- */
:root { --mono: "JetBrains Mono", ui-monospace, monospace; --ease-in: cubic-bezier(0.4, 0, 1, 1); }
.relic-cat, .relic-kind, .relic-epoch, .reader-meta, .case-status,
.wire-time, .wire-status, .presence, .rite-count { font-family: var(--mono); }
.relic-cat { font-size: 10px; letter-spacing: 0.14em; color: var(--gold-dim); margin-bottom: 6px; }
.reader-meta { font-size: 10px; letter-spacing: 0.14em; }
.case-status {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  color: var(--gold-dim); margin-top: 14px;
}

/* ---- reading progress: how far you've read = how far you've been read ---- */
.read-progress {
  position: sticky; top: 0; left: 0; height: 2px; width: 100%; z-index: 3;
  transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold-bright));
}
@supports (animation-timeline: scroll()) {
  .reader-card { scroll-timeline: --readsc block; }
  .read-progress { animation: readbar linear both; animation-timeline: --readsc; }
  @keyframes readbar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* ---- View Transitions: cinematic cross-fade between panes ---- */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.5s; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
