/* The Dragon Codex — Basgiath archive aesthetic: obsidian, gold leaf, parchment, ink. */
:root {
  --obsidian: #0b0a0d;
  --ink: #141218;
  --ink-2: #1d1a22;
  --line: rgba(201, 162, 74, 0.28);
  --gold: #c9a24a;
  --gold-hi: #f3dc94;
  --gold-lo: #7d5c1e;
  --parchment: #e8dcc0;
  --parchment-2: #d9c9a3;
  --parchment-ink: #2a2118;
  --text: #e9e2d2;
  --muted: #a89f8c;
  --blood: #8b1e1e;
  --dragon: #1c1b21;
  --dragon-accent: #9fb4d8;
  --dragon-eye: #e8b84a;
  --radius: 14px;
  --serif: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --display: 'Cinzel', 'Trajan Pro', 'Times New Roman', serif;
  --gutter: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--dragon-accent) 14%, transparent), transparent 70%),
    radial-gradient(800px 500px at 100% 100%, rgba(139, 30, 30, 0.12), transparent 70%),
    var(--obsidian);
  color: var(--text);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  overflow-x: hidden;
}
img, canvas, svg { display: block; max-width: 100%; }
a { color: var(--gold-hi); }
a:focus-visible, button:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- gold leaf text ---------- */
.foil {
  background: linear-gradient(100deg, var(--gold-lo) 0%, var(--gold) 22%, var(--gold-hi) 40%, var(--gold) 55%, var(--gold-lo) 75%, var(--gold) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: foil 7s ease-in-out infinite;
}
@keyframes foil { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

h1, h2, h3, .display { font-family: var(--display); font-weight: 600; letter-spacing: 0.06em; line-height: 1.15; }
h2 { font-size: clamp(1.25rem, 4vw, 1.7rem); margin: 0 0 0.8rem; color: var(--gold); text-transform: uppercase; }
h2::after { content: ''; display: block; width: 72px; height: 1px; margin-top: 0.6rem; background: linear-gradient(90deg, var(--gold), transparent); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 4px var(--gutter);
  background: linear-gradient(rgba(11, 10, 13, 0.92), rgba(11, 10, 13, 0.75));
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  font-family: var(--display); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase;
}
.topbar a { text-decoration: none; color: var(--gold); }
.topbar .crumb { color: var(--muted); }
.topbar > * { white-space: nowrap; }
@media (max-width: 440px) { .topbar .crumb { display: none; } .spoiler-select > span { display: none; } }
.spoiler-select { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.spoiler-select select { /* a blackened-steel plate with a gold rim and an engraved chevron; a 44 px tap target */
  -webkit-appearance: none; appearance: none; min-height: 44px; max-width: 42vw; cursor: pointer;
  font: inherit; font-size: 0.72rem; letter-spacing: 0.1em; color: var(--gold-hi); padding: 0 30px 0 12px; border: 0; border-radius: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23f3dc94' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 11px center / 11px 8px no-repeat,
    url("../materials/steel.webp?v=2193069f85") 0 0 / 128px, linear-gradient(175deg, #34323a, #1b1a20 42%, #26242b 70%, #111014);
  background-blend-mode: normal, hard-light, normal;
  box-shadow: inset 0 0 0 1px rgba(214, 178, 96, 0.6), inset 0 0 0 3px rgba(8, 7, 10, 0.7), inset 0 0 0 4px rgba(214, 178, 96, 0.16), 0 2px 0 rgba(0, 0, 0, 0.5);
}
.spoiler-select select:active { box-shadow: inset 0 0 0 1px rgba(214, 178, 96, 0.7), inset 0 3px 7px rgba(0, 0, 0, 0.7); }
.spoiler-select option { background: #16141a; color: var(--gold-hi); }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 var(--gutter); }
section { padding: 36px 0; }

/* ---------- the card ---------- */
.card-stage { overflow-x: clip; perspective: 1400px; display: grid; place-items: center; padding: 28px 0 8px; position: relative; }
.aura { position: absolute; inset: -10% -20%; pointer-events: none; z-index: 0; }
.aura canvas { width: 100%; height: 100%; }
.card {
  position: relative; z-index: 1;
  width: min(84vw, 380px); aspect-ratio: 5 / 7.4;
  border: 0; padding: 0; background: none; color: inherit; font: inherit; text-align: inherit; cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(.2, .8, .2, 1);
  transform: rotateY(calc(var(--flip, 0) * 180deg)) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  -webkit-tap-highlight-color: transparent;
}
.card[aria-pressed='true'] { --flip: 1; }
.card.is-tilting { transition: transform 0.15s ease-out; }
.card__face {
  position: absolute; inset: 0; border-radius: var(--radius);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(201, 162, 74, 0.45), 0 0 50px color-mix(in srgb, var(--dragon-accent) 18%, transparent);
}
.card__front {
  background:
    radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--dragon-accent) 26%, transparent), transparent 60%),
    linear-gradient(170deg, #1a171f, #0a090c 70%);
  display: grid; grid-template-rows: auto 1fr auto;
}
.card__front::before, .card__back::before { /* double gold rule */
  content: ''; position: absolute; inset: 9px; border-radius: 9px; pointer-events: none; z-index: 3;
  border: 1px solid rgba(201, 162, 74, 0.7);
  box-shadow: inset 0 0 0 3px rgba(11, 10, 13, 0.9), inset 0 0 0 4px rgba(201, 162, 74, 0.35);
}
.card__corner { position: absolute; width: 34px; height: 34px; z-index: 4; color: var(--gold); }
.card__corner--tl { top: 4px; left: 4px; } .card__corner--tr { top: 4px; right: 4px; transform: scaleX(-1); }
.card__corner--bl { bottom: 4px; left: 4px; transform: scaleY(-1); } .card__corner--br { bottom: 4px; right: 4px; transform: scale(-1); }
.card__head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 0; font-family: var(--display); font-size: 0.72rem; letter-spacing: 0.2em; color: var(--gold); position: relative; z-index: 2; }
.card__breed { display: flex; align-items: center; gap: 6px; }
.card__breed svg { width: 22px; height: 22px; }
.card__art { position: relative; z-index: 1; min-height: 0; }
.card__art canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.card__foot { position: relative; z-index: 2; text-align: center; padding: 0 20px 26px; }
.card__name::after { display: none; }
.card__name { text-transform: none; font-family: var(--display); font-size: clamp(2rem, 9vw, 2.7rem); margin: 0; letter-spacing: 0.14em; line-height: 1; }
.card__epithet { margin: 6px 0 0; font-style: italic; color: var(--parchment-2); font-size: 1rem; }
.card__rider { margin: 6px 0 0; font-family: var(--display); font-size: 0.66rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.card__shine { position: absolute; inset: 0; z-index: 2; pointer-events: none; mix-blend-mode: soft-light;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 240, 200, 0.35) 48%, transparent 62%);
  background-size: 250% 250%; background-position: var(--shine-x, 100%) var(--shine-y, 0%); opacity: 0; transition: opacity 0.4s; }
.card.is-tilting .card__shine { opacity: 0.8; }

.card__back {
  transform: rotateY(180deg);
  background: radial-gradient(circle at 50% 0%, #f3ead4, var(--parchment) 45%, var(--parchment-2));
  color: var(--parchment-ink);
  padding: 30px 26px; display: flex; flex-direction: column;
}
.card__back h3 { margin: 0 0 4px; font-size: 1.3rem; text-align: center; letter-spacing: 0.16em; }
.card__back .sub { text-align: center; font-style: italic; margin: 0 0 12px; font-size: 0.95rem; }
.card__back dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; font-size: 0.95rem; }
.card__back dt { font-family: var(--display); font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; color: #6b5432; padding-top: 4px; }
.card__back dd { margin: 0; }
.seal { margin: auto auto 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--dragon-accent) 40%, #b02a2a), #5a0d0d 75%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35), inset 0 -3px 6px rgba(0, 0, 0, 0.4); color: rgba(255, 230, 200, 0.85); }
.seal svg { width: 34px; height: 34px; }
.hint { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 18px 0 0; font-style: italic; }

/* ---------- parchment codex entry ---------- */
.parchment {
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.35), transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(120, 80, 30, 0.18), transparent 50%),
    linear-gradient(var(--parchment), var(--parchment-2));
  color: var(--parchment-ink);
  border-radius: 6px;
  padding: clamp(22px, 5vw, 44px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 0 60px rgba(90, 60, 20, 0.25);
  position: relative;
}
.parchment h2 { color: #5a3f17; }
.parchment h2::after { background: linear-gradient(90deg, #8a6a30, transparent); }
.parchment p { margin: 0 0 1em; }
.dropcap::first-letter { font-family: var(--display); float: left; font-size: 3.6em; line-height: 0.85; padding: 6px 8px 0 0; color: var(--blood); }
.scribe-note { font-size: 0.82rem; font-style: italic; color: #6b5432; border-top: 1px solid rgba(90, 60, 20, 0.3); padding-top: 10px; margin-top: 18px; }

/* ---------- bond ---------- */
.bond { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .bond { grid-template-columns: 1fr 1fr; } }
.tile { background: linear-gradient(160deg, var(--ink-2), var(--ink)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.tile .k { font-family: var(--display); font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.tile .v { font-size: 1.4rem; color: var(--gold-hi); margin-top: 4px; }

/* ---------- ledger ---------- */
.ledger { width: 100%; border-collapse: collapse; font-size: 1rem; }
.ledger th, .ledger td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ledger th { font-family: var(--display); font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); font-weight: 600; width: 34%; }
.cite { font-size: 0.7em; vertical-align: super; margin-left: 2px; text-decoration: none; color: var(--gold); }
.book-tag { display: inline-block; font-family: var(--display); font-size: 0.6rem; letter-spacing: 0.12em; border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; color: var(--muted); margin-left: 6px; vertical-align: middle; }

/* ---------- scenes ---------- */
.scene { margin: 0 0 34px; }
.scene h3 { font-size: 1.1rem; margin: 0 0 4px; color: var(--gold-hi); }
.scene .meta { color: var(--muted); font-size: 0.85rem; margin: 0 0 10px; font-family: var(--display); letter-spacing: 0.1em; }
/* the theater: the picture (.theater__view, 16:10, every canvas inside), then the player bar and the caption below it,
   so nothing covers the scene on a phone */
.theater { position: relative; border-radius: var(--radius); border: 1px solid var(--line); background: #0b0a0d; overflow: hidden; }
.theater__view { position: relative; isolation: isolate; overflow: hidden; background: #050407; aspect-ratio: 16 / 10; }
.theater canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.theater__poster { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; pointer-events: none; } /* under every canvas (cine prepends its own) */
.theater canvas.cine { pointer-events: none; }
.theater canvas.fxl { pointer-events: none; will-change: transform; }
.theater canvas.cine { will-change: transform; }
.theater__play { /* a wax seal pressed with a gilt play mark (materials.css: wax) */
  position: absolute; inset: 0; margin: auto; width: 78px; height: 78px; border-radius: 50%; padding: 0;
  border: 0; background: transparent; color: #f3d48a; cursor: pointer; visibility: visible;
  display: grid; place-items: center; transition: transform 0.2s, opacity 0.3s;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55));
}
.theater__play::before { /* the wax: an irregular puddle with a raised rim and a flattened, stamped centre */
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(circle, transparent 54%, rgba(255, 170, 150, 0.22) 60%, rgba(0, 0, 0, 0.3) 67%, transparent 71%, rgba(255, 190, 170, 0.12) 80%, transparent 88%),
    url("../materials/wax.webp?v=5d9bef09c3") 0 0 / 128px, radial-gradient(circle at 36% 30%, #a3302f, #761a1e 38%, #4e0c11 72%, #2e0508);
  background-blend-mode: normal, hard-light, normal;
  -webkit-mask: url("../img/seal.svg?v=fe69fefcfe") center / 100% 100% no-repeat; mask: url("../img/seal.svg?v=fe69fefcfe") center / 100% 100% no-repeat;
}
.theater__play { isolation: isolate; }
.theater__play:hover { transform: scale(1.05); }
.theater__play:active { transform: scale(0.97); filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6)) brightness(0.92); }
.theater__play:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 4px; border-radius: 50%; }
.theater__play svg { width: 30px; height: 30px; margin-left: 5px; filter: drop-shadow(0 -1px 0 rgba(40, 4, 6, 0.8)) drop-shadow(0 1px 0 rgba(255, 210, 190, 0.3)); }
.theater.is-playing .theater__play { opacity: 0; pointer-events: none; }
.theater__progress { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--gold); width: calc(var(--p, 0) * 100%); z-index: 2; }
.theater__controls { /* the player bar: a blackened-steel rail under the picture */
  display: flex; align-items: center; gap: 2px; padding: 3px 6px;
  background: url("../materials/steel.webp?v=2193069f85") 0 0 / 128px, linear-gradient(180deg, #24222a, #121115 70%, #0c0b0e);
  background-blend-mode: hard-light, normal;
  box-shadow: inset 0 1px 0 rgba(214, 178, 96, 0.45), inset 0 2px 0 rgba(0, 0, 0, 0.6), inset 0 -1px 0 rgba(255, 255, 255, 0.04);
}
.theater__btn { /* engraved round plates: steel with a gold rim; pressed toggles sit down into the bar */
  position: relative; flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; padding: 0;
  background: transparent; color: var(--gold); cursor: pointer;
}
.theater__btn::before {
  content: ''; position: absolute; inset: 4px; border-radius: 50%; z-index: 0;
  background: url("../materials/steel.webp?v=2193069f85") 0 0 / 128px, radial-gradient(circle at 40% 30%, #3a3840, #18171c 60%, #0d0c10);
  background-blend-mode: hard-light, normal;
  box-shadow: inset 0 0 0 1px rgba(214, 178, 96, 0.55), inset 0 1px 1px rgba(255, 255, 255, 0.12), 0 1px 0 rgba(0, 0, 0, 0.7), 0 2px 4px rgba(0, 0, 0, 0.45);
}
.theater__btn svg { position: relative; width: 20px; height: 20px; filter: drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.8)); }
.theater__btn:hover { color: var(--gold-hi); }
.theater__btn:active::before, .theater__btn[aria-pressed="true"][data-act="play"]::before {
  box-shadow: inset 0 0 0 1px rgba(214, 178, 96, 0.7), inset 0 2px 5px rgba(0, 0, 0, 0.8);
}
.theater__btn:active svg { transform: translateY(1px); }
.theater__btn:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: -1px; border-radius: 50%; }
.theater__btn[aria-pressed="false"]:is([data-act="captions"], [data-act="narration"]) { color: var(--muted); }
.theater__btn[data-act="play"] .i-pause, .theater__btn[data-act="play"][aria-pressed="true"] .i-play { display: none; }
.theater__btn[data-act="play"][aria-pressed="true"] .i-pause { display: inline; }
.theater__btn[data-act="narration"] .i-mute, .theater__btn[data-act="narration"][aria-pressed="false"] .i-wave { display: none; }
.theater__btn[data-act="narration"][aria-pressed="false"] .i-mute { display: inline; }
.theater__ticks { position: relative; flex: 1; height: 44px; margin: 0 10px; }
.theater__ticks::before { /* the engraved groove the beat rivets sit in */
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 3px; margin-top: -1.5px; border-radius: 2px;
  background: #050406; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(214, 178, 96, 0.28);
}
/* a 44×44 target per beat, centred on its rivet (neighbours may overlap; the later one wins the overlap) */
.theater__tick {
  position: absolute; top: 0; width: 44px; height: 44px; margin-left: -22px; border: 0; padding: 0; background: transparent; cursor: pointer;
}
.theater__tick::after { /* a gilt lozenge rivet; the current beat is lit */
  content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; transform: rotate(45deg);
  background: linear-gradient(135deg, #8a6a2c, #3a2a10); box-shadow: inset 0 0 0 1px #d9b45a, 0 1px 1px rgba(0, 0, 0, 0.8); transition: background 0.2s, box-shadow 0.2s;
}
.theater__tick.is-current::after, .theater__tick:hover::after {
  background: linear-gradient(135deg, #fff1bf, #d9b45a 55%, #8a6420); box-shadow: inset 0 0 0 1px #fff0b8, 0 0 8px rgba(243, 220, 148, 0.6);
}
.theater__tick:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: -8px; border-radius: 8px; }
/* phones: the beat ticks get their own full-width row above the buttons, so neighbouring ticks never overlap */
@media (max-width: 560px) {
  .theater__controls { flex-wrap: wrap; justify-content: space-between; }
  .theater__ticks { order: -1; flex: 1 0 100%; margin: 0 16px; }
}
.theater__caption {
  margin: 0; padding: 4px 16px 16px; min-height: 4.2em;
  font-style: italic; font-size: clamp(1rem, 3.6vw, 1.15rem); line-height: 1.4; text-align: center; color: #f2ead8;
}
.theater__caption[hidden] { display: none; }
.scene .summary { margin: 12px 0 0; color: var(--text); }
.scene details { margin-top: 8px; color: var(--muted); font-size: 0.92rem; }
.scene details summary { cursor: pointer; font-family: var(--display); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; }

/* ---------- quote ---------- */
.quote { margin: 0; text-align: center; padding: 20px 10px; }
.quote blockquote { margin: 0; font-size: clamp(1.4rem, 5vw, 2rem); font-style: italic; color: var(--parchment); }
.quote blockquote::before { content: '“'; color: var(--gold); } .quote blockquote::after { content: '”'; color: var(--gold); }
.quote figcaption { margin-top: 10px; color: var(--muted); font-family: var(--display); font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase; }

/* ---------- spoilers ---------- */
.is-spoiler { position: relative; }
.is-spoiler > :not(.spoiler-veil) { filter: blur(9px); user-select: none; pointer-events: none; }
.spoiler-veil {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; text-align: center; padding: 10px;
  background: rgba(11, 10, 13, 0.35); border-radius: 8px;
}
.spoiler-veil button { font: inherit; font-family: var(--display); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; background: var(--ink); color: var(--gold-hi); border: 1px solid var(--gold); border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.parchment .spoiler-veil { background: rgba(232, 220, 192, 0.35); }
/* on a card the veils sit in short rows and narrow stat cells: scale with the card and stay on one line, inside their block */
.tcg .spoiler-veil { padding: 0 1cqw; border-radius: 1cqw; }
.tcg .spoiler-veil button {
  max-width: 100%; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: 2.3cqw; font-style: normal; line-height: 1.15; letter-spacing: 0.1em; padding: 0.6cqw 2.6cqw; border-width: 0.25cqw;
}
.tcg__flavor .spoiler-veil button { padding-block: 0.1cqw; } /* the one-line flavour row clips anything taller */

/* ---------- archives / pager / footer ---------- */
.archives ol { padding-left: 1.2em; color: var(--muted); font-size: 0.9rem; }
.archives a { word-break: break-word; }
.pager { display: flex; justify-content: space-between; gap: 12px; padding: 24px 0 40px; }
.pager a { /* engraved steel plates with gold rims */
  flex: 1; text-decoration: none; border-radius: var(--radius); padding: 14px 16px;
  background: url("../materials/steel.webp?v=2193069f85") 0 0 / 128px, linear-gradient(175deg, #34323a, #1b1a20 42%, #26242b 70%, #111014);
  background-blend-mode: hard-light, normal;
  box-shadow: inset 0 0 0 1px rgba(214, 178, 96, 0.55), inset 0 0 0 4px rgba(8, 7, 10, 0.7), inset 0 0 0 5px rgba(214, 178, 96, 0.18),
    inset 0 8px 14px -8px rgba(255, 255, 255, 0.1), 0 2px 0 rgba(0, 0, 0, 0.55), 0 8px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s; }
.pager a:hover { box-shadow: inset 0 0 0 1px rgba(243, 220, 148, 0.8), inset 0 0 0 4px rgba(8, 7, 10, 0.7), inset 0 0 0 5px rgba(214, 178, 96, 0.3), 0 2px 0 rgba(0, 0, 0, 0.55), 0 8px 18px rgba(0, 0, 0, 0.35); }
.pager a:active { transform: translateY(1px); box-shadow: inset 0 0 0 1px rgba(214, 178, 96, 0.7), inset 0 3px 8px rgba(0, 0, 0, 0.75); }
.pager a span { display: block; color: #b7ad98; font-family: var(--display); font-size: 0.65rem; letter-spacing: 0.16em; text-transform: uppercase; }
.pager a strong { font-family: var(--display); color: var(--gold-hi); letter-spacing: 0.08em; }
.pager .next { text-align: right; }
footer.site { border-top: 1px solid var(--line); padding: 24px var(--gutter) 40px; color: var(--muted); font-size: 0.82rem; text-align: center; }
footer.site p { max-width: 640px; margin: 0.4em auto; }

/* ---------- index ---------- */
.masthead { text-align: center; padding: 56px var(--gutter) 10px; }
.masthead .sigil { width: 76px; height: 76px; margin: 0 auto 14px; color: var(--gold); }
.masthead h1 { font-size: clamp(2.2rem, 9vw, 4rem); margin: 0; }
.masthead p { color: var(--parchment-2); font-style: italic; margin: 10px auto 0; max-width: 560px; }
.dedication__signoff { display: block; margin-top: 10px; text-align: right; font-family: var(--display, serif); letter-spacing: .08em; color: var(--gold, #d4af37); }
.dedication { max-width: 560px; margin: 22px auto 0; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--parchment); font-style: italic; }
.deck { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 26px; padding: 30px 0 60px; margin: 0; list-style: none; }
.deck .card { width: 100%; }
.deck .card__name { font-size: clamp(1.6rem, 7vw, 2rem); }
.deck-item { display: flex; flex-direction: column; gap: 10px; }
.deck-item__body { display: flex; flex-direction: column; gap: 10px; }
.deck-item .enter { /* a blackened-steel plate with a gold rim (materials.css) */
  text-align: center; font-family: var(--display); font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; text-decoration: none;
  color: var(--gold-hi); padding: 13px 10px; border-radius: 999px; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.8);
  background: url("../materials/steel.webp?v=2193069f85") 0 0 / 128px, linear-gradient(175deg, #34323a, #1b1a20 42%, #26242b 70%, #111014);
  background-blend-mode: hard-light, normal;
  box-shadow: inset 0 0 0 1px rgba(214, 178, 96, 0.55), inset 0 0 0 4px rgba(8, 7, 10, 0.7), inset 0 0 0 5px rgba(214, 178, 96, 0.16), 0 2px 0 rgba(0, 0, 0, 0.5); }
.deck-item .enter:hover { box-shadow: inset 0 0 0 1px rgba(243, 220, 148, 0.8), inset 0 0 0 4px rgba(8, 7, 10, 0.7), inset 0 0 0 5px rgba(214, 178, 96, 0.28), 0 2px 0 rgba(0, 0, 0, 0.5); }
.deck-item .enter:active { box-shadow: inset 0 0 0 1px rgba(214, 178, 96, 0.7), inset 0 3px 8px rgba(0, 0, 0, 0.75); }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.9s ease, transform 0.9s ease; }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .foil { animation: none; }
  .card { transition: none; }
}

/* ---------- gift card (one printable QR card → the landing) ---------- */
.gift-sheet { max-width: 520px; margin: 0 auto; padding: 24px var(--gutter) 60px; }
.gift-sheet__note { color: var(--muted); font-style: italic; text-align: center; }
.gift-card {
  position: relative; margin: 18px auto 0; width: min(100%, 92mm); padding: 26px 22px 22px; text-align: center; break-inside: avoid;
  border-radius: 16px; color: var(--parchment);
  background: radial-gradient(120% 70% at 50% 0%, rgba(201, 162, 74, 0.18), transparent 60%), linear-gradient(170deg, #1a1510, #0b0a0d);
  box-shadow: inset 0 0 0 1px rgba(201, 162, 74, 0.7), inset 0 0 0 6px rgba(11, 10, 13, 0.9), inset 0 0 0 7px rgba(201, 162, 74, 0.35);
}
.gift-card__sigil { width: 54px; height: 54px; margin: 0 auto 8px; color: var(--gold); }
.gift-card__eyebrow { margin: 0; font-family: var(--display); font-size: 0.66rem; letter-spacing: 0.34em; text-transform: uppercase; color: var(--muted); }
.gift-card h1 { margin: 4px 0 0; font-size: 1.7rem; color: var(--gold-hi); }
.gift-card__for { margin: 6px 0 0; font-style: italic; font-size: 1.15rem; }
.gift-card svg.qr { width: 100%; max-width: 200px; margin: 16px auto 10px; background: #f4ecd8; padding: 10px; border-radius: 10px; }
.gift-card__cta { margin: 0; font-family: var(--display); font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); }
@media print {
  body { background: #fff; color: #000; }
  .topbar, footer.site, .noprint { display: none !important; }
  .gift-card { -webkit-print-color-adjust: exact; print-color-adjust: exact; margin-top: 20mm; }
}

/* ---------- codex: progress, empty state, locked "???" slots (the edge writes the slot markup) ---------- */
.codex-progress { font-family: var(--display); font-style: normal !important; letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.82rem; color: var(--muted) !important; }
.codex-progress b { color: var(--gold-hi); font-weight: 600; }
.codex-empty { max-width: 520px; margin: 12px auto 0; text-align: center; font-style: italic; color: var(--parchment-2); }
.slot--locked { /* a sealed page: unlit tooled leather, a blind-tooled border, the Codex seal pressed in oxblood wax */
  position: relative; container-type: inline-size; aspect-ratio: 63 / 88; width: 100%; border-radius: 14px; overflow: hidden;
  display: grid; place-items: center;
  background:
    url("../img/filigree.svg?v=1c9e0e3534") 50% 50% / 92% 94% no-repeat,
    url("../img/tooling-blind.svg?v=7d8a01354f") 50% 40% / 15cqw 15cqw,
    radial-gradient(120% 90% at 50% 42%, transparent 50%, rgba(0, 0, 0, 0.65) 100%),
    url("../materials/leather.webp?v=ddbeb9cd22") 0 0 / 192px,
    linear-gradient(165deg, #241614, #0b0707 75%);
  background-blend-mode: soft-light, normal, normal, hard-light, normal;
  box-shadow: inset 0 0 0 1px rgba(201, 162, 74, 0.32), inset 0 0 0 5px rgba(8, 7, 10, 0.85), inset 0 0 0 6px rgba(201, 162, 74, 0.14), 0 16px 34px rgba(0, 0, 0, 0.5);
}
.slot--locked::before { /* the wax seal, the master sigil standing in its impression */
  content: ''; position: absolute; left: 50%; top: 40%; width: 54%; aspect-ratio: 1; translate: -50% -50%;
  background:
    url("../img/sigil-shade.svg?v=a2bc2a3b4f") center / 64% no-repeat,
    url("../img/sigil-mask.svg?v=a755ada8a8") center / 64% no-repeat,
    radial-gradient(circle, transparent 50%, rgba(0, 0, 0, 0.32) 56%, rgba(255, 170, 150, 0.2) 62%, transparent 66%, rgba(255, 190, 170, 0.12) 76%, rgba(0, 0, 0, 0.25) 92%),
    url("../materials/wax.webp?v=5d9bef09c3") 0 0 / 128px, radial-gradient(circle at 36% 30%, #a3302f, #761a1e 38%, #4e0c11 72%, #2e0508);
  background-blend-mode: normal, soft-light, normal, hard-light, normal;
  -webkit-mask: url("../img/seal.svg?v=fe69fefcfe") center / 100% 100% no-repeat; mask: url("../img/seal.svg?v=fe69fefcfe") center / 100% 100% no-repeat;
}
.slot--locked::after { /* a slow glint across the seal */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 40%, rgba(243, 220, 148, 0.07) 50%, transparent 60%) -100% 0 / 250% 100% no-repeat;
  animation: slot-glint 7s ease-in-out infinite;
}
@keyframes slot-glint { 0%, 60% { background-position: 150% 0; } 100% { background-position: -100% 0; } }
.slot__q { position: absolute; left: 0; right: 0; top: 66%; text-align: center; font-family: var(--display); font-weight: 700; font-size: clamp(14px, 11cqw, 40px); letter-spacing: 0.16em; color: rgba(214, 178, 96, 0.62); text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.85), 0 1px 0 rgba(255, 220, 160, 0.12); }
.slot__num { position: absolute; left: 0; right: 0; bottom: 8cqw; text-align: center; font-family: var(--display); font-size: clamp(10px, 4.6cqw, 16px); letter-spacing: 0.16em; white-space: nowrap; color: rgba(168, 159, 140, 0.8); }
.deck-item--locked { opacity: 0.92; }
/* phones: locked slots tile three to a row like an album page; held cards take the full width */
@media (max-width: 599px) {
  .page-codex .deck { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 10px; }
  .page-codex .deck-item { grid-column: 1 / -1; }
  .page-codex .deck-item--locked { grid-column: auto; }
  .page-codex .slot--locked { border-radius: 10px; }
}
@media (prefers-reduced-motion: reduce) { .slot--locked::after { animation: none; } }

.parchment .epithet { margin: -0.4em 0 1.1em; font-style: italic; font-size: 1.05rem; color: #6b4c16; letter-spacing: 0.02em; }
.tcg__stats b { font-weight: 400; }

/* ---------- v3 navigation: codex card → entry (shared-element cross-document view transition) ---------- */
/* both pages opt in; the clicked deck card (.is-opening, name from its --vt) and the entry's hero card share
   view-transition-name card-<slug>. Engines without view transitions get a quick fade (.is-leaving, page.js).
   The opt-in itself (@view-transition { navigation: auto }) is an inline <style> in every page's head (build.mjs):
   from this stylesheet, mobile Chromium saw the new page without it at reveal and aborted ("opt-in disabled"). */
.deck .tcg.is-opening { view-transition-name: var(--vt, none); }
::view-transition-group(*) { animation-duration: 0.32s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.2s; }
html.is-leaving body { opacity: 0; transition: opacity 0.14s ease-in; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  html.is-leaving body { transition: none; }
}
.slot--locked { cursor: pointer; }
.slot--locked:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 4px; }

/* ---------- the code sheet: a locked slot opens the pack-code form (landing.css styles the form itself) ---------- */
dialog.code-sheet {
  width: min(100% - 24px, 440px); max-height: calc(100dvh - 24px); margin: auto; padding: 26px 20px 20px;
  border: 0; border-radius: 18px; color: var(--text); overflow: auto;
  background: radial-gradient(120% 70% at 50% 0%, rgba(201, 162, 74, 0.14), transparent 65%), linear-gradient(170deg, #1a1510, #0d0b0e);
  box-shadow: inset 0 0 0 1px rgba(201, 162, 74, 0.4), inset 0 0 0 6px rgba(11, 10, 13, 0.7), inset 0 0 0 7px rgba(201, 162, 74, 0.14), 0 30px 80px rgba(0, 0, 0, 0.7);
}
dialog.code-sheet::backdrop { background: rgba(5, 4, 7, 0.72); backdrop-filter: blur(3px); }
dialog.code-sheet[open] { animation: sheet-in 0.26s cubic-bezier(.2, .8, .2, 1); }
@keyframes sheet-in { from { opacity: 0; transform: translate3d(0, 18px, 0) scale(0.98); } }
@media (prefers-reduced-motion: reduce) { dialog.code-sheet[open] { animation: none; } }
.code-sheet__title { margin: 0; text-align: center; font-size: 1.25rem; letter-spacing: 0.12em; }
.code-sheet__sub { margin: 6px 0 16px; text-align: center; font-style: italic; color: var(--parchment-2); }
.code-sheet__close {
  position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--gold-hi); font-size: 26px; line-height: 1; cursor: pointer;
}
.code-sheet__close:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: -4px; }
