/* =========================================================
   Rosseau Maamor · The Pine-Descent Expedition
   World: Cordillera pine forest at night. Greens carry the page;
   UP maroon and gold, and the indigo and rust of a woven sablay
   band, appear only as accents and in the woven divider.
   ========================================================= */

/* ---------- Type (self-hosted) ---------- */
@font-face { font-family: "Young Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("assets/fonts/young-serif-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Young Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("assets/fonts/young-serif-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("assets/fonts/public-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("assets/fonts/public-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Public Sans"; font-style: italic; font-weight: 100 900; font-display: swap;
  src: url("assets/fonts/public-sans-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("assets/fonts/ibm-plex-mono-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F; }

/* ---------- Tokens ---------- */
:root {
  --bg: #0e1f19;
  --surface: #13291f;
  --surface-2: #193427;
  --surface-3: #21402f;
  --line: rgba(236, 230, 214, 0.12);
  --line-2: rgba(236, 230, 214, 0.24);
  --ink: #ece6d6;
  --ink-2: #c4cbbb;
  --ink-3: #98a99a;

  --gold: #e8b04a;          /* UP gold */
  --gold-ink: #f2cd7f;      /* gold as text on dark */
  --maroon: #8a1c2b;        /* UP maroon */
  --maroon-ink: #e7899a;    /* maroon as text on dark */
  --green: #3f9a68;         /* UP green, lifted for dark */
  --green-ink: #8fd3a9;
  --indigo: #4a5fb3;        /* sablay band blue */
  --rust: #c8553d;          /* sablay band orange-red */

  --on-gold: #1c1406;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px -12px rgba(0, 0, 0, 0.55);

  --sky-top: #08140f;
  --sky-mid: #11291f;
  --sky-low: #24453a;
  --sun: #f1c46d;

  --display: "Young Serif", Georgia, serif;
  --sans: "Public Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  --hud-h: 64px;
  --rail-w: 188px;
  --wrap: 1120px;
  --pad: clamp(20px, 4vw, 56px);
  --r: 10px;
  --r-sm: 6px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* The woven band, after the maroon, gold, green and indigo diamonds of a Cordillera sablay */
  --weave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='12'%3E%3Crect width='48' height='12' fill='%238a1c2b'/%3E%3Crect width='48' height='1.6' fill='%23e8b04a'/%3E%3Crect y='10.4' width='48' height='1.6' fill='%233f9a68'/%3E%3Cpath d='M3 6l3-3 3 3-3 3zM15 6l3-3 3 3-3 3zM27 6l3-3 3 3-3 3zM39 6l3-3 3 3-3 3z' fill='%23e8b04a'/%3E%3Cpath d='M9 6l3-3 3 3-3 3zM33 6l3-3 3 3-3 3z' fill='%234a5fb3'/%3E%3Cpath d='M21 6l3-3 3 3-3 3zM45 6l3-3 3 3-3 3z' fill='%23c8553d'/%3E%3C/svg%3E");

  color-scheme: dark;
  accent-color: var(--gold);
}

/* Reward theme: Dawn over the ridge */
html[data-theme="dawn"] {
  --bg: #f3eee2;
  --surface: #fbf8f1;
  --surface-2: #ece5d4;
  --surface-3: #e2d9c4;
  --line: rgba(20, 40, 30, 0.13);
  --line-2: rgba(20, 40, 30, 0.28);
  --ink: #15271f;
  --ink-2: #33473c;
  --ink-3: #536559;
  --gold-ink: #8a5a06;
  --maroon-ink: #8a1c2b;
  --green-ink: #1f6b43;
  --shadow: 0 1px 2px rgba(60, 45, 20, 0.12), 0 8px 24px -14px rgba(60, 45, 20, 0.35);
  --sky-top: #f5d9a8;
  --sky-mid: #eec08f;
  --sky-low: #dba07a;
  --sun: #fff1cc;
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; scrollbar-color: var(--surface-3) var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  min-height: 100dvh; overflow-x: hidden;
  caret-color: var(--gold);
}
::selection { background: var(--gold); color: var(--on-gold); }
img, svg { display: block; }
button { font: inherit; color: inherit; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 400; line-height: 1.08; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-weight: 500; letter-spacing: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg use, .ico { stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border: 3px solid var(--bg); border-radius: 12px; }

.skip {
  position: fixed; left: 12px; top: 12px; z-index: 300; padding: 10px 16px;
  background: var(--gold); color: var(--on-gold); border-radius: var(--r-sm); font-weight: 600; text-decoration: none;
  transform: translateY(-160%); transition: transform .2s var(--ease);
}
.skip:focus { transform: none; }

/* The woven band */
.weave { display: block; height: 8px; width: 96px; background: var(--weave) left center / 32px 8px repeat-x; border-radius: 2px; }
.weave--center { margin-inline: auto; width: 168px; }

/* ---------- Buttons: one primary, one secondary ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 0 20px; border-radius: var(--r-sm);
  font: 600 15px/1 var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap;
  border: 1px solid transparent;
  transition: background-color .18s, border-color .18s, color .18s, transform .18s var(--ease);
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: translateY(1px) scale(.98); }
.btn--primary { background: var(--gold); color: var(--on-gold); box-shadow: var(--shadow); }
.btn--primary:hover { background: #f2c062; }
.btn--secondary { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn--secondary:hover { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 8%, transparent); }
.btn--sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn .arrow { transition: transform .2s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }
html[data-theme="dawn"] .btn--primary { background: #c98a19; color: #fffaf0; }
html[data-theme="dawn"] .btn--primary:hover { background: #b57a10; }

/* Segmented control: for choices, never for labels */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.seg button {
  min-height: 36px; padding: 0 12px; border: 1px solid transparent; border-radius: 5px; background: none; cursor: pointer;
  font: 500 14px var(--sans); color: var(--ink-2); transition: background-color .18s, color .18s, border-color .18s;
}
.seg button:hover { color: var(--ink); background: var(--surface-2); }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--ink); border-color: var(--line-2); }

/* Small status text with a dot, not a pill */
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.status--done { color: var(--gold-ink); }
.status--done::before { background: var(--gold); }
.status--live { color: var(--green-ink); }
.status--live::before { background: var(--green); }

.meta { font-size: 14px; color: var(--ink-3); }
.skills-line { font-size: 14px; color: var(--ink-3); }
.skills-line b { color: var(--ink-2); font-weight: 600; }

/* ---------- Loading gate ---------- */
.gate {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; text-align: center;
  background: var(--bg); transition: opacity .6s var(--ease), visibility .6s;
}
.gate[hidden] { display: none; }
.gate.is-done { opacity: 0; visibility: hidden; }
.gate__art { position: absolute; inset: 0; }
.gate__art svg { width: 100%; height: 100%; }
.gate__inner { position: relative; display: grid; justify-items: center; gap: 14px; padding: 28px; max-width: 640px; }
.gate__name { font: 400 clamp(40px, 7vw, 76px)/1 var(--display); }
.gate__role { font-size: 17px; color: var(--ink-2); }
.gate__event { font-size: 15px; color: var(--gold-ink); }
.gate__bar { width: min(320px, 70vw); height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 8px; }
.gate__bar span { display: block; height: 100%; width: 0; background: var(--gold); transition: width .3s var(--ease); }
.gate__status { font-size: 14px; color: var(--ink-3); min-height: 1.6em; }
.gate__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 6px; }

/* ---------- HUD ---------- */
.hud {
  position: fixed; inset: 0 0 auto 0; z-index: 60; height: var(--hud-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 20px 0 24px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.hud::after { content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 4px; background: var(--weave) left center / 16px 4px repeat-x; opacity: .9; }
.hud__brand { display: flex; align-items: center; gap: 12px; min-height: 44px; text-decoration: none; }
.hud__mark { width: 66px; height: auto; filter: invert(1); }
html[data-theme="dawn"] .hud__mark { filter: none; }
.hud__who { display: grid; line-height: 1.2; }
.hud__who b { font: 400 17px/1.15 var(--display); white-space: nowrap; }
.hud__who span { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.hud__right { display: flex; align-items: center; gap: 10px; }
.hud__resume svg { width: 17px; height: 17px; }
.hud__progress { display: flex; align-items: center; gap: 14px; padding: 0 10px; color: var(--ink-2); font-size: 14px; }
.hud__stat { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.hud__stat svg { width: 17px; height: 17px; color: var(--gold); }
.hud__stat b { color: var(--ink); font-weight: 600; }
.xp { width: 84px; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.xp span { display: block; height: 100%; width: 0; background: var(--gold); transition: width .8s var(--ease); }
.hud__btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px;
  background: none; border: 1px solid transparent; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; color: var(--ink-2);
  font-variant-numeric: tabular-nums; transition: background-color .18s, color .18s, border-color .18s;
}
.hud__btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.hud__btn svg { width: 18px; height: 18px; color: var(--gold); }
.hud__btn b { color: var(--ink); font-weight: 600; }
.hud__badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--maroon); color: #fff;
  font-size: 12px; font-weight: 700; display: inline-grid; place-items: center;
}
.hud__badge[hidden] { display: none; }

/* ---------- Rail (desktop) ---------- */
.rail {
  position: fixed; z-index: 50; left: 0; top: calc(var(--hud-h) + 4px); bottom: 0; width: var(--rail-w);
  padding: 18px 12px 18px; overflow-y: auto; scrollbar-width: thin;
  background: var(--bg); border-right: 1px solid var(--line);
}
.rail__group { margin-bottom: 10px; }
.rail__group-label { display: block; padding: 0 10px 4px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.rail__btn {
  display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px;
  min-height: 44px; padding: 5px 8px; border-radius: 8px; border: 1px solid transparent;
  text-decoration: none; color: var(--ink-2); transition: background-color .18s, color .18s, border-color .18s;
}
.rail__icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; background: var(--surface); border: 1px solid var(--line); }
.rail__icon svg { width: 16px; height: 16px; }
.rail__text { display: grid; line-height: 1.2; min-width: 0; }
.rail__text b { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.rail__text span { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.rail__check { width: 14px; height: 14px; color: var(--green-ink); opacity: 0; }
.rail__btn.is-stamped .rail__check { opacity: 1; }
.rail__btn:hover { background: var(--surface); }
.rail__btn[aria-current="page"] { background: var(--surface-2); border-color: var(--line); }
.rail__btn[aria-current="page"] .rail__icon { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }

/* ---------- Tab bar (phones) ---------- */
.tabbar { display: none; }

/* ---------- Stage and panels ---------- */
.stage { padding: calc(var(--hud-h) + 4px) 0 0 var(--rail-w); min-height: 100dvh; outline: none; }
.panel { display: none; position: relative; min-height: calc(100dvh - var(--hud-h)); }
.panel.is-active { display: block; animation: panel-in .45s var(--ease) both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.wrap { width: min(var(--wrap), 100% - 2 * var(--pad)); margin-inline: auto; }
.panel__inner { padding: clamp(40px, 7vh, 80px) 0 clamp(56px, 9vh, 104px); }
.panel__head { display: grid; gap: 16px; margin-bottom: clamp(32px, 5vh, 52px); max-width: 720px; }
.panel__head h2 { font-size: clamp(36px, 4.4vw, 56px); }
.panel__head p { color: var(--ink-2); font-size: 18px; max-width: 62ch; }
.panel__head p.meta { font-size: 14px; color: var(--ink-3); margin-top: -6px; }
.panel--forest { background: var(--bg); }

/* Surfaces: flat, bordered, no blur, no corner ornament */
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }

/* ---------- Home ---------- */
.hero { overflow: hidden; }
.hero.is-active { display: grid; align-items: end; }
.hero__art { position: absolute; inset: 0; }
.hero__art svg { width: 100%; height: 100%; }
.hero__art::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 82%, transparent) 38%, color-mix(in srgb, var(--bg) 10%, transparent) 70%, transparent 100%),
    linear-gradient(0deg, var(--bg) 0%, transparent 34%);
}
.hero__grid {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: clamp(24px, 4vw, 56px); align-items: end; padding: clamp(40px, 7vh, 88px) 0 clamp(32px, 6vh, 72px);
}
.hero__copy { display: grid; gap: 22px; align-content: end; }
.hero h1 { display: grid; gap: 14px; }
.h1__name { font-size: clamp(52px, 7vw, 96px); line-height: .98; letter-spacing: -0.02em; }
.h1__role { font: 500 clamp(19px, 1.7vw, 23px)/1.35 var(--sans); color: var(--gold-ink); letter-spacing: 0; max-width: 34ch; }
.hero__tagline { font-size: clamp(17px, 1.4vw, 19px); color: var(--ink-2); max-width: 52ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.creds { display: grid; gap: 10px; padding-top: 22px; border-top: 1px solid var(--line); max-width: 640px; }
.cred { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; font-size: 15px; }
.cred svg { width: 18px; height: 18px; margin-top: 3px; color: var(--green-ink); }
.cred b { font-weight: 600; }
.cred span { color: var(--ink-3); }
.hero__note { font-size: 14px; color: var(--ink-3); max-width: 60ch; }
.hero__note button { background: none; border: 0; padding: 0; color: var(--gold-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit; }
.hero__figure { position: relative; align-self: end; display: grid; justify-items: center; }
.hero__portrait {
  height: min(560px, 66vh); width: auto; max-width: 100%; object-fit: contain; object-position: bottom;
  -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 80%, transparent 100%);
}

[data-enter] > * { animation: rise .8s var(--ease) both; }
[data-enter] > *:nth-child(2) { animation-delay: .06s; }
[data-enter] > *:nth-child(3) { animation-delay: .12s; }
[data-enter] > *:nth-child(4) { animation-delay: .18s; }
[data-enter] > *:nth-child(5) { animation-delay: .24s; }
[data-enter] > *:nth-child(6) { animation-delay: .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- Main quest: mission board ---------- */
.board { display: grid; grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.4fr); gap: 20px; align-items: start; }
.board__list { display: grid; gap: 6px; }
.board__item {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; text-align: left;
  padding: 14px 16px; border-radius: 8px; background: none; border: 1px solid var(--line); cursor: pointer;
  transition: background-color .18s, border-color .18s;
}
.board__item:hover { background: var(--surface); }
.board__item[aria-selected="true"] { background: var(--surface-2); border-color: var(--line-2); }
.board__item b { font: 400 19px/1.2 var(--display); }
.board__item .meta { grid-column: 1 / -1; }
.board__detail { padding: clamp(22px, 3vw, 36px); display: grid; gap: 18px; align-content: start; min-height: 100%; }
.board__detail h3 { font-size: clamp(26px, 2.6vw, 34px); }
.objectives { display: grid; gap: 12px; max-width: 68ch; }
.objectives li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; color: var(--ink-2); }
.objectives svg { width: 18px; height: 18px; margin-top: 3px; color: var(--gold); }

/* ---------- Quest log ---------- */
.trail { display: grid; }
.entry-row {
  display: grid; grid-template-columns: 170px 1fr; gap: 8px 32px; padding: 28px 0;
  border-top: 1px solid var(--line);
}
.entry-row:last-child { border-bottom: 1px solid var(--line); }
.entry-row__when { font-size: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.entry-row__when b { display: block; color: var(--gold-ink); font-weight: 600; font-size: 15px; }
.entry-row__body { display: grid; gap: 10px; max-width: 75ch; }
.entry-row__body h3 { font-size: 25px; }
.entry-row__org { color: var(--ink-2); }
.notes { display: grid; gap: 6px; color: var(--ink-2); }
.notes li { display: grid; grid-template-columns: 14px 1fr; gap: 8px; }
.notes li::before { content: ""; width: 6px; height: 6px; margin-top: 10px; background: var(--maroon-ink); transform: rotate(45deg); }
.more { border-top: 1px dashed var(--line-2); padding-top: 6px; }
.more summary {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; list-style: none;
  font-weight: 600; font-size: 15px; color: var(--gold-ink);
}
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: ""; width: 8px; height: 8px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .2s var(--ease); }
.more[open] summary::before { transform: rotate(45deg); }
.more summary span { font-weight: 400; color: var(--ink-3); }
.more[open] > ul { margin-bottom: 6px; }
.prologue { margin-top: clamp(48px, 7vh, 72px); }
.prologue h3.sub { font-size: 30px; margin-bottom: 20px; }
.school { display: grid; grid-template-columns: minmax(200px, 0.7fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.school__photo { padding: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; cursor: zoom-in; background: none; }
.school__photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 15%; transition: transform .5s var(--ease); }
.school__photo:hover img { transform: scale(1.03); }
.school__list { display: grid; }
.school__row { display: grid; grid-template-columns: 110px 1fr; gap: 6px 24px; padding: 18px 0; border-top: 1px solid var(--line); }
.school__row:first-child { border-top: 0; padding-top: 0; }
.school__row h4 { font-size: 21px; }
.school__row p { color: var(--ink-2); }
.school__row .honors { color: var(--gold-ink); font-size: 14px; font-weight: 600; }

/* ---------- Atelier ---------- */
.logos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.logo { display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.logo--feature { grid-column: 1 / -1; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); grid-template-rows: auto; }
.logo__stage {
  position: relative; display: block; aspect-ratio: 1; width: 100%; padding: 0; border: 0; cursor: zoom-in; overflow: hidden;
  background: #0a0f0d; transition: background-color .35s;
}
.logo--feature .logo__stage { aspect-ratio: 5 / 4; }
.logo__stage[data-tile="light"] { background: #f4efe4; }
.logo__stage[data-tile="none"] { background: var(--surface-2); }
.logo__stage img { position: absolute; inset: 9%; width: 82%; height: 82%; object-fit: contain; transition: transform .5s var(--ease); animation: logo-in .4s var(--ease) both; }
/* Every version of a logo shares one frame, so the emblem stays the same size when you switch */
.logo__stage:hover img { transform: scale(1.03); }
@keyframes logo-in { from { opacity: 0; } }
.logo__info { padding: 22px 22px 24px; display: grid; gap: 12px; align-content: start; }
.logo--feature .logo__info { padding: clamp(24px, 3vw, 40px); align-content: center; }
.logo h3 { font-size: 24px; }
.logo--feature h3 { font-size: clamp(28px, 2.8vw, 38px); }
.logo__text { color: var(--ink-2); font-size: 15px; max-width: 60ch; }
.logo__badge { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--gold-ink); }
.logo__badge svg { width: 16px; height: 16px; }

/* ---------- Side quests ---------- */
.thesis { display: grid; grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr); gap: clamp(24px, 3vw, 44px); padding: clamp(18px, 2.4vw, 28px); margin-bottom: 24px; }
.thesis__poster { display: block; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: zoom-in; background: #777; align-self: start; }
.thesis__poster img { width: 100%; height: auto; transition: transform .5s var(--ease); }
.thesis__poster:hover img { transform: scale(1.02); }
.thesis__info { display: grid; gap: 14px; align-content: start; }
.thesis__info h3 { font-size: clamp(28px, 2.8vw, 38px); }
.thesis__sub { color: var(--gold-ink); font-weight: 500; }
.thesis__sum { color: var(--ink-2); font-size: 16px; max-width: 64ch; }
.thesis__links { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin-top: 6px; }
.qr { display: flex; align-items: center; gap: 12px; }
.qr img { width: 92px; height: 92px; border-radius: 8px; background: #fff; padding: 6px; }
.qr span { font-size: 13px; color: var(--ink-3); line-height: 1.4; max-width: 14ch; }
.bookq { padding: clamp(18px, 2.4vw, 28px); display: grid; grid-template-columns: minmax(240px, 0.6fr) minmax(0, 1.4fr); gap: clamp(24px, 3vw, 44px); align-items: center; }
.bookq__info { display: grid; gap: 14px; align-content: center; }
.bookq__info h3 { font-size: clamp(26px, 2.4vw, 32px); }
.bookq__fil { font-size: 16px; font-style: italic; }
.bookq__en { font-size: 15px; color: var(--ink-2); }
.book { display: grid; gap: 14px; border-radius: 12px; overflow: hidden; padding: 6px 0; }
.book__stage {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; width: 100%; max-width: 820px; margin: 0 auto;
  aspect-ratio: 1556 / 1100; perspective: 2200px; cursor: pointer; transition: transform .6s var(--ease);
}
.book__stage.is-cover { transform: translateX(-25%); }
.book__stage.is-back { transform: translateX(25%); }
.book__page { position: relative; overflow: hidden; box-shadow: var(--shadow); }
.book__page:empty { box-shadow: none; }
.book__page img, .book__face img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; }
.book__page--l { border-radius: 6px 0 0 6px; }
.book__page--r { border-radius: 0 6px 6px 0; }
.book__page--l:not(:empty)::after { content: ""; position: absolute; inset: 0 0 0 auto; width: 14%; background: linear-gradient(to left, rgba(0,0,0,.26), transparent); pointer-events: none; }
.book__page--r:not(:empty)::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 14%; background: linear-gradient(to right, rgba(0,0,0,.26), transparent); pointer-events: none; }
.book__leaf { position: absolute; top: 0; bottom: 0; width: 50%; transform-style: preserve-3d; z-index: 3; }
.book__leaf--r { left: 50%; transform-origin: left center; }
.book__leaf--l { left: 0; transform-origin: right center; }
.book__face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; background: var(--surface); }
.book__face--back { transform: rotateY(180deg); }
.book__leaf--r .book__face:first-child { border-radius: 0 6px 6px 0; }
.book__leaf--l .book__face:first-child { border-radius: 6px 0 0 6px; }
.book__stage.is-single { grid-template-columns: 1fr; max-width: 420px; aspect-ratio: 778 / 1100; }
.book__stage.is-single .book__page--l { display: none; }
.book__stage.is-single .book__page--r { border-radius: 6px; transform-origin: left center; }
.book__stage.is-single .book__page--r::after { display: none; }
.book__controls { display: flex; align-items: center; justify-content: center; gap: 16px; }
.btn--icon { width: 46px; padding: 0; }
.flip { transform: scaleX(-1); }
.book__where { min-width: 230px; text-align: center; font-size: 14px; color: var(--gold-ink); }
.book__where .mono { font-size: 13px; }

/* ---------- Dispatches ---------- */
.dispatches { display: grid; gap: 20px; }
.dispatch { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: clamp(20px, 3vw, 40px); padding: clamp(16px, 2vw, 24px); align-items: center; }
.dispatch__media { display: grid; gap: 10px; }
.dispatch__media.is-pair { grid-template-columns: 1fr 1fr; }
.dispatch__media:not(.is-pair) { max-width: 520px; }
.dispatch__img { padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: zoom-in; background: none; }
.dispatch__img img { width: 100%; aspect-ratio: 1; object-fit: cover; transition: transform .5s var(--ease); }
.dispatch__img:hover img { transform: scale(1.03); }
.dispatch__info { display: grid; gap: 14px; align-content: center; justify-items: start; }
.dispatch__info h3 { font-size: clamp(26px, 2.4vw, 32px); }
.dispatch__info p:not(.meta) { color: var(--ink-2); max-width: 52ch; }

/* ---------- Skills ---------- */
.tree { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 48px; }
.branch h3 { display: flex; align-items: center; gap: 12px; font-size: 22px; padding-bottom: 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.branch h3::before { content: ""; width: 10px; height: 10px; transform: rotate(45deg); background: var(--c, var(--gold)); flex: none; }
.branch[data-c="teal"] { --c: var(--green); }
.branch[data-c="gold"] { --c: var(--gold); }
.branch[data-c="ember"] { --c: var(--rust); }
.branch li { padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); font-size: 15px; }

/* ---------- Feats ---------- */
.draw { display: grid; grid-template-columns: minmax(250px, 0.75fr) minmax(0, 2fr); gap: clamp(20px, 3vw, 40px); align-items: center; margin-bottom: clamp(32px, 5vh, 52px); }
.deck { padding: 26px; display: grid; gap: 18px; justify-items: start; }
.deck__stack { position: relative; width: 120px; height: 168px; margin: 4px 0 6px 10px; }
.deck__stack span { position: absolute; inset: 0; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card-back); }
.deck__stack span:nth-child(1) { transform: translate(-9px, 7px) rotate(-5deg); opacity: .55; }
.deck__stack span:nth-child(2) { transform: translate(-4px, 3px) rotate(-2.5deg); opacity: .8; }
.deck__stack span:nth-child(3) { transition: transform .25s var(--ease); }
.deck:hover .deck__stack span:nth-child(3) { transform: translateY(-4px); }
.deck p { color: var(--ink-2); font-size: 15px; }
.deck__btns { display: flex; flex-wrap: wrap; gap: 10px; }
.reveal { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: center; }
.card { perspective: 1000px; aspect-ratio: 5 / 7; max-height: 340px; width: 100%; }
.card__inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .8s var(--ease); }
.card.is-flipped .card__inner { transform: rotateY(180deg); }
.card__face { position: absolute; inset: 0; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.card__back { background: var(--card-back); border: 1px solid var(--line-2); }
.card--idle { opacity: .5; }
.card__front {
  transform: rotateY(180deg); display: grid; align-content: end; gap: 8px; padding: 18px;
  --rc: var(--ink-3);
  background: var(--surface-2); border: 1.5px solid var(--rc);
}
.card[data-r="5"] .card__front { --rc: var(--gold); }
.card[data-r="4"] .card__front { --rc: var(--green); }
.card__sigil { position: absolute; inset: 28px 16px auto auto; width: 50%; aspect-ratio: 1; }
.card__stars { display: flex; gap: 2px; color: var(--rc); }
.card__stars svg { width: 15px; height: 15px; }
.card__stars svg use { fill: currentColor; stroke: none; }
.card__kind { font-size: 12px; font-weight: 700; color: var(--rc); }
.card__name { font: 400 21px/1.1 var(--display); }
.card__text { font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.collection__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.collection__head h3 { font-size: 26px; }
.collection__head span { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.collection { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.slot {
  aspect-ratio: 5 / 4; border-radius: 8px; border: 1px dashed var(--line-2); display: grid; place-items: center; text-align: center;
  padding: 10px; color: var(--ink-3); font-size: 12px; background: none;
}
.slot svg { width: 18px; height: 18px; }
.slot.is-owned { border-style: solid; color: var(--ink); font: 400 15px/1.15 var(--display); cursor: pointer; background: var(--surface); transition: background-color .18s, border-color .18s; }
.slot.is-owned:hover { background: var(--surface-2); }
.slot[data-r="5"].is-owned { border-color: var(--gold); }
.slot[data-r="4"].is-owned { border-color: var(--green); }
.slot .stars { display: block; font: 600 11px var(--sans); color: var(--gold-ink); margin-top: 6px; letter-spacing: .1em; }

/* ---------- Codex ---------- */
.codex__tracks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.track-card { display: grid; align-content: start; gap: 6px; text-align: left; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); font: inherit; cursor: pointer; transition: background-color .18s, border-color .18s; }
.track-card:hover { background: var(--surface-2); }
.track-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.track-card[aria-pressed="true"] { border-color: var(--gold); background: var(--surface-2); }
.track-card b { font: 400 19px/1.2 var(--display); }
.track-card span { font-size: 14px; color: var(--ink-2); }
.track-card .meta { color: var(--gold-ink); font-weight: 600; margin-top: 4px; }
.track-card--lead { grid-row: span 2; align-content: center; border-left: 3px solid var(--gold); }
.track-card--lead b { font-size: 23px; }
.entries__head { font: 400 21px/1.2 var(--display); margin: 28px 0 6px; }
.entries__head:first-child { margin-top: 4px; }
.training:has(+ .entries__head) { border-bottom: 1px solid var(--line); }
.codex__filters { margin-bottom: 16px; }
.entries { display: grid; }
.training { display: grid; grid-template-columns: 60px minmax(0, 1fr) 70px; gap: 18px; align-items: baseline; padding: 14px 0; border-top: 1px solid var(--line); font-size: 15px; }
.training:last-child { border-bottom: 1px solid var(--line); }
.training__y { color: var(--gold-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.training__t b { display: block; font-weight: 600; }
.training__t span { font-size: 14px; color: var(--ink-3); }
.training__h { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }

@media (max-width: 1180px) and (min-width: 641px) { .codex__tracks { grid-template-columns: repeat(2, minmax(0, 1fr)); } .track-card--lead { grid-row: auto; grid-column: 1 / -1; } }

/* ---------- Guild ---------- */
.guild { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 48px; }
.member { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; padding: 18px 0; border-top: 1px solid var(--line); }
.member h3 { font-size: 20px; }
.member p { grid-column: 1; color: var(--ink-2); font-size: 15px; }
.member .num { grid-row: 1; grid-column: 2; color: var(--ink-3); font-size: 14px; }
.member .badge { grid-column: 1 / -1; color: var(--gold-ink); font-size: 14px; font-weight: 600; }

/* ---------- Contact ---------- */
.invite { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.invite h2 { font-size: clamp(40px, 5vw, 64px); max-width: 14ch; }
.invite__lead { color: var(--ink-2); font-size: 18px; max-width: 52ch; margin: 18px 0 28px; }
.ways { display: grid; gap: 10px; max-width: 560px; }
.way { display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; }
.way__ico { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--gold); }
.way__ico svg { width: 20px; height: 20px; }
.way b { display: block; font-weight: 600; }
.way span { color: var(--ink-2); font-size: 15px; word-break: break-word; }
.member-card { margin: 0; padding: 10px; display: grid; gap: 12px; }
.member-card img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 20%; border-radius: 6px; }
.member-card figcaption { display: grid; gap: 4px; padding: 0 6px 6px; --rc: var(--gold); }
.member-card figcaption b { font: 400 19px/1.2 var(--display); }
.member-card figcaption span:last-child { font-size: 14px; color: var(--ink-3); }

/* ---------- One-page Resume (paper) ---------- */
.panel--paper { background: #e9e4d7; color: #1c2a23; --ink: #1c2a23; --ink-2: #34443b; --ink-3: #56665c; --line: rgba(28, 42, 35, 0.14); --line-2: rgba(28, 42, 35, 0.28); --gold-ink: #7d5208; }
.resume-bar { position: sticky; top: calc(var(--hud-h) + 4px); z-index: 5; background: #1c2a23; color: #ece6d6; }
.resume-bar .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding: 8px 0; }
.resume-bar p { font-size: 15px; color: #c4cbbb; }
.resume-bar .btn--secondary { color: #ece6d6; border-color: rgba(236, 230, 214, .3); }
.resume-bar__btns { display: flex; flex-wrap: wrap; gap: 10px; }
.paper {
  width: min(900px, 100% - 2 * var(--pad)); margin: 32px auto 72px; background: #fdfbf6; color: #1c2a23;
  border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 18px 40px -24px rgba(0,0,0,.35);
  padding: clamp(28px, 5vw, 64px);
}
.paper header { display: grid; gap: 8px; padding-bottom: 22px; }
.paper h1 { font-size: clamp(34px, 4.4vw, 48px); }
.paper__role { font-size: 18px; font-weight: 600; color: #7d5208; }
.paper__contact { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14.5px; color: #34443b; }
.paper .weave { width: 100%; height: 6px; background-size: 24px 6px; margin-bottom: 26px; }
.paper section { margin-bottom: 26px; }
.paper h2 { font-size: 22px; padding-bottom: 6px; border-bottom: 1px solid rgba(28, 42, 35, .2); margin-bottom: 12px; }
.paper p, .paper li { font-size: 15px; line-height: 1.55; }
.paper__summary { max-width: 75ch; }
.cv-job { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; margin-bottom: 16px; break-inside: avoid; }
.cv-job h3 { font: 700 16px/1.35 var(--sans); }
.cv-job .when { font-size: 14px; color: #56665c; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cv-job .org { grid-column: 1 / -1; font-size: 14.5px; color: #34443b; }
.cv-job ul { grid-column: 1 / -1; margin-top: 6px; display: grid; gap: 4px; padding-left: 18px; list-style: disc; }
.cv-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; }
.cv-list { display: grid; gap: 6px; }
.cv-list li { display: grid; grid-template-columns: 1fr auto; gap: 12px; break-inside: avoid; }
.cv-list li span:last-child { color: #56665c; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cv-skills { display: grid; gap: 6px; }
.cv-skills b { font-weight: 700; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 120; right: 18px; bottom: 18px; display: grid; gap: 10px; width: min(360px, calc(100vw - 36px)); }
.toast {
  display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: center; padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow);
  animation: toast-in .45s var(--ease) both;
}
.toast.is-out { animation: toast-out .35s var(--ease) both; }
.toast__ico { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; background: var(--gold); color: var(--on-gold); }
.toast__ico svg { width: 18px; height: 18px; }
.toast small { display: block; font-size: 12.5px; font-weight: 600; color: var(--gold-ink); }
.toast b { font: 400 17px/1.2 var(--display); }
.toast p { font-size: 14px; color: var(--ink-2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(14px); } }

/* ---------- Modal ---------- */
.modal { padding: 0; border: 0; background: none; color: var(--ink); max-width: min(620px, calc(100vw - 28px)); width: 100%; }
.modal::backdrop { background: rgba(4, 10, 8, .7); }
.modal[open] { animation: rise .35s var(--ease) both; }
.modal--wide { max-width: min(1100px, calc(100vw - 28px)); }
.modal__frame { position: relative; padding: 28px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow); max-height: calc(100dvh - 40px); overflow: auto; }
.modal--wide .modal__frame { padding: 16px; }
.modal__close { position: absolute; right: 10px; top: 10px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; cursor: pointer; color: var(--ink-2); border-radius: 8px; z-index: 2; }
.modal__close:hover { color: var(--ink); background: var(--surface-2); }
.modal__close svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.modal__body h2 { font-size: 30px; margin-bottom: 8px; padding-right: 40px; }
.modal__body > p { color: var(--ink-2); margin-bottom: 18px; }
.zoom { display: grid; place-items: center; border-radius: 8px; overflow: hidden; }
.zoom img { max-width: 100%; max-height: 82vh; width: auto; height: auto; }
.zoom[data-tile="light"] { background: #f4efe4; padding: 24px; }
.zoom[data-tile="dark"] { background: #0a0f0d; padding: 24px; }
.is-invert { filter: invert(1); }
.tasks-list { display: grid; }
.task { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.task__name { font-weight: 600; }
.task__reward { font-size: 14px; color: var(--ink-3); }
.task__reward b { color: var(--gold-ink); font-weight: 600; }
.task__bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.task__bar span { display: block; height: 100%; background: var(--green); transition: width .6s var(--ease); }
.task.is-claimable .task__bar span { background: var(--gold); }
.task .btn, .task__state { grid-row: 1 / 3; grid-column: 2; }
.task__state { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--green-ink); }
.task__state svg { width: 16px; height: 16px; }
.achs { display: grid; gap: 8px; }
.ach { display: grid; grid-template-columns: 36px 1fr; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.ach__ico { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); color: var(--ink-3); }
.ach__ico svg { width: 17px; height: 17px; }
.ach b { font-weight: 600; }
.ach p { font-size: 14px; color: var(--ink-3); }
.ach.is-done { border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.ach.is-done .ach__ico { background: var(--gold); color: var(--on-gold); }
.summary { display: grid; gap: 14px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-2); }
.summary h3 { font-size: 22px; }
.summary dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; font-size: 15px; }
.summary dt { color: var(--ink-2); }
.summary dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.summary__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-nav { display: grid; gap: 6px; }
.sheet-nav .rail__group-label { padding-left: 2px; margin-top: 8px; }

/* ---------- Key art motion ---------- */
.art-mist { animation: drift 40s linear infinite alternate; }
.art-mist--slow { animation-duration: 64s; animation-direction: alternate-reverse; }
@keyframes drift { from { transform: translateX(-3%); } to { transform: translateX(3%); } }
.art-aurora { opacity: 0; transition: opacity 2s; }
html[data-aurora="on"] .art-aurora { opacity: 1; }
.art-layer { transition: transform .6s var(--ease); will-change: transform; }
html[data-sigil="on"] .hud__mark { filter: invert(1) drop-shadow(0 1px 0 var(--gold)) drop-shadow(0 -1px 0 var(--gold)); }

.noscript { padding: 120px 24px; max-width: 720px; margin: 0 auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .hud__progress { display: none; }
  .logos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tree { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collection { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  :root { --rail-w: 0px; --hud-h: 58px; }
  .rail { display: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 55; left: 0; right: 0; bottom: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line);
  }
  .tabbar a, .tabbar button {
    display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 56px; padding: 4px 2px; border-radius: 8px;
    background: none; border: 0; cursor: pointer; text-decoration: none; color: var(--ink-3); font-size: 12px; font-weight: 600;
  }
  .tabbar svg { width: 20px; height: 20px; }
  .tabbar [aria-current="page"] { color: var(--gold-ink); background: var(--surface); }
  .stage { padding-bottom: 84px; }
  .toasts { bottom: 90px; }
  .hud { padding: 0 10px 0 14px; }
  .hud__resume span { display: none; }
  .hud__resume { width: 44px; padding: 0; min-height: 44px; }
  .hero__grid { grid-template-columns: 1fr; }
  .hero__figure { display: none; }
  .hero__art::after { background: linear-gradient(0deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 88%, transparent) 55%, color-mix(in srgb, var(--bg) 55%, transparent) 100%); }
  .board, .thesis, .bookq, .dispatch, .invite, .school, .draw { grid-template-columns: 1fr; }
  .logo--feature { grid-template-columns: 1fr; }
  .logo--feature .logo__stage { aspect-ratio: 1; }
  .thesis__poster { max-width: 420px; }
  .member-card { max-width: 360px; }
  .resume-bar { top: var(--hud-h); }
  .qr { display: none; }
}
@media (max-width: 640px) {
  .hud__who span { display: none; }
  .hud__btn-label { display: none; }
  .hud__btn { padding: 0; width: 44px; justify-content: center; }
  .hud__right { gap: 2px; }
  .hud__mark { width: 52px; }
  .hud__who b { font-size: 15px; }
  .hud__badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; font-size: 11px; }
  .h1__name { font-size: clamp(44px, 12.5vw, 60px); }
  .hero__actions .btn { width: 100%; }
  .entry-row { grid-template-columns: 1fr; padding: 22px 0; }
  .school__row { grid-template-columns: 1fr; }
  .logos, .tree, .guild, .cv-cols { grid-template-columns: 1fr; }
  .collection { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .slot { font-size: 11px; padding: 6px; }
  .slot.is-owned { font-size: 13px; }
  .reveal { gap: 8px; }
  .card__name { font-size: 14px; }
  .card__text { display: none; }
  .card__front { padding: 10px; }
  .training { grid-template-columns: 48px minmax(0, 1fr) 56px; gap: 12px; }
  .codex__tracks { grid-template-columns: 1fr; }
  .track-card--lead { grid-row: auto; }
  .book__where { min-width: 0; font-size: 13px; }
  .cv-job { grid-template-columns: 1fr; }
  .cv-list li { grid-template-columns: 1fr; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .art-mist { animation: none !important; }
}

/* ---------- Print: the one-page Resume only ---------- */
@media print {
  @page { margin: 14mm 14mm 16mm; }
  html, body { background: #fff !important; }
  .hud, .rail, .tabbar, .gate, .toasts, .skip, .modal, .resume-bar, .panel:not(#resume) { display: none !important; }
  .stage { padding: 0 !important; }
  #resume { display: block !important; background: #fff !important; animation: none !important; min-height: 0; }
  .paper { width: 100%; margin: 0; padding: 0; box-shadow: none; }
  .paper a { text-decoration: none; }
  .paper section, .cv-job { break-inside: avoid; }
}

/* Critique fixes: no card-in-card for version switchers; Resume measure */
.logo .seg { background: none; border: 0; padding: 0; gap: 6px; }
.logo .seg button { border-color: var(--line-2); }
.paper p, .cv-job li, .cv-list li > span:first-child { max-width: 64ch; }
.cv-job li, .notes li, .objectives li span { text-wrap: pretty; }

.hud__who b, .hud__who span { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1100px) { .hud__who span { display: none; } }
@media (max-width: 380px) { .hud__who { display: none; } }
.hero__note button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; vertical-align: middle; }

/* ---------- Feats: every card visible, drawn cards foiled ---------- */
.slot {
  position: relative; aspect-ratio: auto; min-height: 150px; display: grid; align-content: end; justify-items: start; gap: 4px;
  text-align: left; padding: 14px 14px 12px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  background: var(--surface); color: var(--ink-3); cursor: pointer; font: inherit;
  transition: border-color .2s, background-color .2s, color .2s;
}
.slot:hover { border-color: var(--line-2); color: var(--ink-2); }
.slot__kind { font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
.slot__name { font: 400 16px/1.15 var(--display); color: var(--ink-2); }
.slot__text { font-size: 12.5px; line-height: 1.4; color: var(--ink-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.slot__stars { font-size: 11px; letter-spacing: .12em; color: var(--ink-3); }
.slot.is-foiled { color: var(--ink); background: var(--surface-2); }
.slot.is-foiled .slot__name { color: var(--ink); }
.slot.is-foiled .slot__text { color: var(--ink-2); }
.slot.is-foiled[data-r="5"] { border-color: var(--gold); }
.slot.is-foiled[data-r="5"] .slot__stars, .slot.is-foiled[data-r="5"] .slot__kind { color: var(--gold-ink); }
.slot.is-foiled[data-r="4"] { border-color: var(--green); }
.slot.is-foiled[data-r="4"] .slot__stars, .slot.is-foiled[data-r="4"] .slot__kind { color: var(--green-ink); }
.slot.is-foiled[data-r="3"] { border-color: var(--line-2); }
.slot.is-foiled[data-r="3"] .slot__stars { color: var(--ink-2); }
.slot.is-new::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, color-mix(in srgb, var(--gold) 35%, transparent) 50%, transparent 70%);
  transform: translateX(-100%); animation: foil 1.2s var(--ease) .2s 1 both;
}
@keyframes foil { to { transform: translateX(100%); } }
.collection { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
@media (max-width: 640px) { .collection { grid-template-columns: repeat(2, minmax(0, 1fr)); } .slot { min-height: 132px; } .slot__text { display: none; } }

/* ---------- Resume: one A4 page ---------- */
.cv-earlier { font-size: 14.5px; color: #34443b; margin-top: -4px; }
.cv-list--stack li { display: grid; grid-template-columns: 1fr; gap: 0; }
.cv-list--stack li span { color: #56665c; white-space: normal; }
.cv-cols > section { min-width: 0; }
@media print {
  @page { size: A4; margin: 11mm 13mm 11mm; }
  .paper { font-size: 9.6pt; }
  .paper header { padding-bottom: 6pt; gap: 2pt; }
  .paper h1 { font-size: 22pt; }
  .paper__role { font-size: 11pt; }
  .paper__contact { font-size: 9pt; }
  .paper .weave { margin-bottom: 8pt; height: 4px; background-size: 16px 4px; }
  .paper section { margin-bottom: 7pt; }
  .paper h2 { font-size: 12pt; padding-bottom: 2pt; margin-bottom: 4pt; }
  .paper p, .paper li { font-size: 9.4pt; line-height: 1.38; max-width: none; }
  .cv-job { margin-bottom: 5pt; }
  .cv-job h3 { font-size: 10pt; }
  .cv-job .when, .cv-job .org, .cv-earlier { font-size: 9pt; }
  .cv-job ul { margin-top: 2pt; gap: 1pt; }
  .cv-list { gap: 3pt; }
  .cv-cols { gap: 0 22pt; }
  .cv-skills { gap: 2pt; }
}

/* Resume print fixes */
.cv-list.cv-list--stack li > span, .cv-list.cv-list--stack li > span:last-child { white-space: normal; max-width: none; }
@media print {
  :root, html[data-theme] { color-scheme: light; }
  html, body, .app, .stage { background: #fff !important; }
  .paper p, .paper li { font-size: 9.2pt; line-height: 1.34; }
  .paper section { margin-bottom: 6pt; }
}

/* ---------- Woven band: theme-tuned Cordillera accents ---------- */
:root {
  /* Night: the band sits in the forest. A green ground, muted gold edges, small hints of maroon and indigo. */
  --weave-base: #1f3d2d;
  --weave-edge-a: #b8964f;
  --weave-edge-b: #3f7a56;
  --weave-d1: #d6b366;
  --weave-d2: #b25a66;
  --weave-d3: #7d8fc7;
  --card-back-ground: #15301f;
  --card-back-line: rgba(214, 179, 102, .45);
  --aurora-1: #6fd4a0;
  --aurora-2: #e8c46a;
}
html[data-theme="dawn"] {
  /* Dawn: a pale woven band like sunlit cloth */
  --weave-base: #e4d8bd;
  --weave-edge-a: #b07a1c;
  --weave-edge-b: #3f7a55;
  --weave-d1: #b07a1c;
  --weave-d2: #8a1c2b;
  --weave-d3: #34508f;
  --card-back-ground: #efe6d2;
  --card-back-line: rgba(138, 90, 6, .45);
  --aurora-1: #e88f6a;
  --aurora-2: #b07a1c;
}
.hud::after { opacity: .75; }

/* ---------- Aurora reward ---------- */
.art-aurora { opacity: 0; transition: opacity 1.6s var(--ease); mix-blend-mode: screen; }
html[data-theme="dawn"] .art-aurora { mix-blend-mode: multiply; }
html[data-aurora="on"] .art-aurora { opacity: 1; }
.aur { transform-box: fill-box; transform-origin: 50% 50%; animation: aurora-sway 14s ease-in-out infinite alternate; }
.aur--2 { animation-duration: 19s; animation-direction: alternate-reverse; }
@keyframes aurora-sway {
  0% { transform: translateX(-2%) scaleY(0.9); }
  50% { transform: translateX(1%) scaleY(1.15); }
  100% { transform: translateX(3%) scaleY(0.95); }
}
@media (prefers-reduced-motion: reduce) { .aur { animation: none; } }

.hero__note button { min-height: 0; padding: 12px 2px; margin: -12px 0; vertical-align: baseline; display: inline; }

/* ---------- Aurora reward on every chapter ---------- */
.sky-aurora {
  position: fixed; z-index: 0; left: var(--rail-w); right: 0; top: calc(var(--hud-h) + 4px);
  height: min(62vh, 560px); pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity 1.6s var(--ease), visibility 1.6s;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 45%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 45%, transparent 100%);
}
.sky-aurora svg { width: 100%; height: 100%; }
html[data-aurora="on"] .sky-aurora { opacity: .7; visibility: visible; }
html[data-aurora="on"] .sky-aurora .art-aurora { opacity: 1; }
.stage { position: relative; z-index: 1; }
/* Chapters let the sky through; surfaces and the résumé paper stay solid for reading */
.panel--forest, .panel--paper { background: transparent; }
.resume-bar { z-index: 6; }
@media print { .sky-aurora { display: none !important; } }

/* ---------- Aurora responds to the pointer and to scrolling ---------- */
.art-aurora {
  transform: translate(calc(var(--aur-x, 0) * 1px), calc(var(--aur-y, 0) * 1px)) skewX(calc(var(--aur-skew, 0) * 1deg));
  transition: transform 1.2s var(--ease), opacity 1.6s var(--ease);
}
html[data-aurora="on"] .art-aurora { opacity: var(--aur-glow, 1); }
html[data-aurora="on"] .sky-aurora .art-aurora { opacity: var(--aur-glow, 1); }

/* ---------- Holographic foil ---------- */
.holo, .glare { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2; }
.holo {
  background: linear-gradient(115deg, rgba(255,122,122,.9) 0%, rgba(255,214,110,.9) 17%, rgba(141,255,178,.9) 34%, rgba(110,200,255,.9) 51%, rgba(214,160,255,.9) 68%, rgba(255,122,122,.9) 85%, rgba(255,214,110,.9) 100%);
  background-size: 300% 300%;
  background-position: var(--hx, 30%) var(--hy, 50%);
  mix-blend-mode: color-dodge; opacity: .32; filter: saturate(1.1) brightness(.9);
  transition: opacity .3s, background-position .25s ease-out;
}
.glare {
  background: radial-gradient(circle at var(--gx, 30%) var(--gy, 20%), rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 45%);
  mix-blend-mode: overlay; opacity: .6; transition: opacity .3s;
}
html[data-theme="dawn"] .holo { mix-blend-mode: multiply; opacity: .28; }
html[data-theme="dawn"] .glare { mix-blend-mode: soft-light; }
.slot.is-foiled, .card.is-flipped .card__inner { transform-style: preserve-3d; }
.slot.is-foiled { transform: perspective(700px) var(--tilt, rotateX(0) rotateY(0)); transition: transform .35s var(--ease), border-color .2s, background-color .2s; }
.slot.is-foiled:hover .holo { opacity: .55; }
.slot.is-foiled:hover .glare { opacity: .9; }
.slot.is-foiled .holo { animation: holo-drift 6s ease-in-out infinite alternate; }
.slot.is-foiled:hover .holo { animation: none; }
@keyframes holo-drift { from { background-position: 10% 30%; } to { background-position: 90% 70%; } }
.card.is-flipped { transform: perspective(900px) var(--tilt, rotateX(0) rotateY(0)); transition: transform .35s var(--ease); }
.card.is-flipped:hover .holo { opacity: .55; }

/* ---------- 3D card viewer ---------- */
.viewer {
  --vw: min(300px, 70vw); position: relative; display: grid; place-items: center;
  height: calc(var(--vw) * 1.4 + 60px); perspective: 1200px; cursor: grab; touch-action: none; user-select: none;
  border-radius: 12px; outline-offset: 4px; margin: 6px 0 14px;
  background: var(--surface); border: 1px solid var(--line);
}
.viewer.is-drag { cursor: grabbing; }
.v-card { position: relative; width: var(--vw); aspect-ratio: 5 / 7; transform-style: preserve-3d; will-change: transform; }
.v-face { position: absolute; inset: 0; border-radius: 14px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.v-front { display: grid; align-content: end; gap: 8px; padding: 22px; }
.v-front .card__name { font-size: 26px; }
.v-front .card__text { font-size: 14px; }
.v-front .card__stars svg { width: 18px; height: 18px; }
.v-back { transform: rotateY(180deg) translateZ(7px); }
.v-edge { position: absolute; inset: 0; border-radius: 14px; background: color-mix(in srgb, var(--rc, var(--gold)) 55%, var(--bg)); }
.v-card[data-r="5"] { --rc: var(--gold); }
.v-card[data-r="4"] { --rc: var(--green); }
.v-card[data-r="3"] { --rc: var(--ink-3); }
.viewer .holo { opacity: .5; }
.viewer[data-side="back"] .holo { opacity: 0; }
.viewer__btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* ---------- Book in full view ---------- */
.modal--book { max-width: min(1400px, calc(100vw - 24px)); }
.modal--book .modal__frame { padding: 18px 18px 14px; background: var(--bg); }
.modal--book .book { padding: 0; overflow: visible; }
.modal--book .book__stage { max-width: min(1320px, calc((100dvh - 180px) * 1.4145)); }
.modal--book .book__stage.is-single { max-width: min(600px, calc((100dvh - 180px) * 0.707)); }
.modal--book .book__full { display: none; }
.bookq__info .btn { justify-self: start; }

@media (prefers-reduced-motion: reduce) {
  .slot.is-foiled, .card.is-flipped { transform: none !important; }
  .slot.is-foiled .holo { animation: none; }
}

/* The viewer reuses the card front styles, but it is not a flip-card face */
.v-face.v-front { transform: translateZ(0); }
.v-face.v-back { border: 1px solid var(--line-2); }

/* Holo tuning: a sheen, not a rainbow wash */
.viewer .holo { opacity: .2; mix-blend-mode: color-dodge; }
.viewer:not(.is-drag) .holo { transition: opacity .3s; }
.viewer .glare { opacity: .55; }
.viewer:focus { outline: none; }
.viewer:focus-visible { outline: 2px solid var(--line-2); }
.modal--book .book:focus { outline: none; }
.modal--book .book:focus-visible { outline: 2px solid var(--line-2); outline-offset: 4px; }
/* Collection foil: quiet at rest, livelier under the pointer, text stays readable */
.slot.is-foiled .holo { opacity: .16; }
.slot.is-foiled:hover .holo, .card.is-flipped:hover .holo { opacity: .3; }
.card.is-flipped .holo { opacity: .18; }
.slot.is-foiled .slot__name, .slot.is-foiled .slot__text, .slot.is-foiled .slot__kind, .slot.is-foiled .slot__stars { position: relative; z-index: 3; }
/* Foil is shown by the holographic sheen and the coloured border, not a strip on one edge */
@keyframes holo-drift { from { background-position: 10% 30%; } to { background-position: 90% 70%; } }
/* Rarity colour inside the 3D viewer */
.v-card[data-r="5"] .card__front { --rc: var(--gold); }
.v-card[data-r="4"] .card__front { --rc: var(--green); }
.v-card[data-r="3"] .card__front { --rc: var(--ink-3); }
