/* =====================================================================
   MORIBUND — "Opening Credits"
   The site plays like the opening sequence of Book I: monochrome film
   frames cut by title cards, one line of narration per cut.
   Loaded after styles.css and cinema.css on every page; it owns the look.

   Palette   black, white and grey only (owner rule: no colour accents)
   Type      the official wordmark is the only "MORIBUND" (assets/brand)
             EB Garamond 600     headings
             Bellefair             subtitles, credit lines, buttons
             EB Garamond           reading copy
   Frames    the Higgsfield scenes, graded to black-and-white film
   ===================================================================== */

@font-face { font-family: "Bellefair"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/bellefair-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; }

/* ---------- 1. Tokens ---------- */
:root, html[data-theme="light"], html[data-theme="dark"] {
  --bg: #000;
  --bg-soft: #070707;
  --text: #f2f2f0;
  --text-2: #d6d6d3;
  --silver: #c8c8c6;
  --muted: #a3a3a0;
  --faint: #6f6f6c;
  --line: rgba(242, 242, 240, .14);
  --line-strong: rgba(242, 242, 240, .34);
  --surface: transparent;
  --surface-2: rgba(242, 242, 240, .04);
  --axia: linear-gradient(90deg, transparent, rgba(242, 242, 240, .4) 50%, transparent);
  --metal: none;
  --title: "EB Garamond", Georgia, "Times New Roman", serif;
  --sub: "Bellefair", "Times New Roman", serif;
  --copy: "EB Garamond", Georgia, serif;
  --serif: var(--title);
  --display: var(--sub);
  --sans: var(--copy);
  --radius: 0px;
  --frame-grade: grayscale(1) contrast(1.08) brightness(.96);
  /* One fluid type scale for every page and device */
  --fs-label: .78rem;
  --fs-small: .94rem;
  --fs-body: clamp(1.04rem, .98rem + .3vw, 1.14rem);
  --fs-lead: clamp(1.12rem, 1rem + .6vw, 1.32rem);
  --fs-h3: clamp(1.22rem, 1.1rem + .6vw, 1.5rem);
  --fs-h2: clamp(1.8rem, 1.3rem + 2.6vw, 3.1rem);
  --fs-h1: clamp(2.4rem, 1.6rem + 4.2vw, 4.4rem);
  --mark-h: 21px;
}
body { background: #000; color: var(--text); font-family: var(--copy); font-size: var(--fs-body); }
::selection { background: var(--text); color: #000; }

/* Film grain over everything, like the frames themselves. */
.site-noise { opacity: .07; mix-blend-mode: screen; }

/* ---------- 2. Type ---------- */
h1, h2, .section-head h2, .page-head h1, .callout h2, .book-intro h1, .book-intro h2, .chapter-head h1 {
  font-family: var(--title); font-weight: 600; letter-spacing: .01em; color: var(--text);
}
.section-head h2, .callout h2 { font-size: clamp(1.9rem, 6.6vw, 3.4rem); line-height: 1.08; }
.page-head h1, .book-intro h1, .book-intro h2 { font-size: clamp(2.4rem, 9vw, 4.6rem); line-height: 1.02; }
h3, .card h3, .card h2.card-title { font-family: var(--sub); font-weight: 400; font-size: 1.32rem; letter-spacing: .04em; }
p, li, .lede, .section-head p { font-family: var(--copy); }
.eyebrow, .credit-line, .breadcrumbs, .record-facts dt, .footer-grid h4, .toc-label, .pager-dir, .spectrum b, .way-name, .hero-kicker, .numeral {
  font-family: var(--sub); font-weight: 400; letter-spacing: .26em; text-transform: uppercase; color: var(--silver);
}
.eyebrow { font-size: .74rem; }
.credit-line { font-family: var(--sub); text-transform: none; letter-spacing: .24em; font-size: .8rem; color: var(--text); }
.subtitle { font-family: var(--sub); font-weight: 400; letter-spacing: .06em; color: var(--text); text-wrap: balance; }
.title-card {
  margin: 0; font-family: var(--title); font-weight: 600; text-transform: uppercase; color: #f4f4f2;
  letter-spacing: .3em; padding-left: .3em; line-height: 1; white-space: nowrap; text-align: center;
  text-shadow: 0 4px 40px rgba(0, 0, 0, .75);
}

/* ---------- 3. Header ---------- */
.site-header::before { background: linear-gradient(to bottom, rgba(0, 0, 0, .92), rgba(0, 0, 0, .55) 70%, rgba(0, 0, 0, 0)); }
.site-header.scrolled::before, .menu-open .site-header::before { background: rgba(0, 0, 0, .9); }
.site-header, .site-header.scrolled, .menu-open .site-header { border-bottom-color: var(--line); }
.desktop-nav a { font-family: var(--sub); letter-spacing: .2em; font-size: .78rem; }
.desktop-nav .nav-account { border-color: var(--line-strong); }
.menu-btn { border: 0; }
.menu-lines { width: 26px; height: 12px; }
.menu-lines span { height: 1.2px; }
.menu-lines span:last-child { top: 10px; }
.menu-btn[aria-expanded="true"] .menu-lines span:first-child, .menu-btn[aria-expanded="true"] .menu-lines span:last-child { top: 5px; }
.mobile-panel a { font-family: var(--title); font-weight: 600; letter-spacing: .02em; }
.mobile-panel a[aria-current="page"] { font-style: normal; color: var(--muted); }
.mobile-minor a { font-family: var(--sub); }

/* ---------- 4. Buttons: credit cards ---------- */
.btn {
  min-height: 54px; padding: 0 28px; gap: 14px; border-radius: 0; border: 1px solid var(--line-strong);
  background: transparent; color: var(--text); box-shadow: none;
  font-family: var(--sub); font-weight: 400; font-size: 1.04rem; letter-spacing: .14em; text-transform: none;
  transition: border-color .3s ease, background-color .3s ease, transform .14s ease;
}
.btn::before { display: none; }
.btn.primary { border-color: rgba(242, 242, 240, .9); background: rgba(0, 0, 0, .35); color: var(--text); }
.btn.ghost { -webkit-backdrop-filter: none; backdrop-filter: none; background: transparent; }
.btn .arrow { width: 24px; }
.btn:active { transform: scale(.98); background: rgba(242, 242, 240, .08); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover, .btn.primary:hover { border-color: var(--text); background: rgba(242, 242, 240, .08); box-shadow: none; transform: none; }
  .btn:hover .arrow { transform: translateX(6px); }
  .credit-link:hover { color: var(--text); border-bottom-color: var(--text); }
}
.credit-link {
  display: inline-block; padding: 10px 0 4px; font-family: var(--sub); font-size: .92rem; letter-spacing: .18em;
  color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line-strong);
}
.frame-tag { display: inline-block; padding: 7px 14px 6px; border: 1px solid var(--line-strong); font-family: var(--sub); font-size: .86rem; letter-spacing: .14em; color: var(--text); }

/* ---------- 5. Frames: every scene is a monochrome film frame ---------- */
.act-poster img, .act-canvas, .axia-art img, .record-card img, .closing-art, .film-frame img { filter: var(--frame-grade); }
.act-flash { background: radial-gradient(ellipse 62% 52% at 50% 52%, rgba(255, 255, 255, .95), rgba(240, 240, 240, .3) 45%, transparent 76%); }
.act h2, .act h3 { font-family: var(--title); font-weight: 600; }
.act p { font-family: var(--sub); letter-spacing: .03em; }

/* ---------- 6. The opening (homepage act I) ----------
   The frame starts letterboxed under the header, the title card cut across it.
   Scrolling opens the frame to full screen while the camera pushes to the Door. */
.act-opening { --frame-top: calc(var(--header-h) + var(--safe-t) + 10px); --frame-h: 50svh; --actions-h: 112px; }
.act-opening .act-stage { background: #000; }
.opening-frame {
  position: absolute; inset: 0; z-index: -1; overflow: hidden;
  --k: calc(1 - min(1, var(--p, 0) * 3));
  clip-path: inset(calc(var(--frame-top) * var(--k)) 0 calc((100% - var(--frame-top) - var(--frame-h)) * var(--k)) 0);
}
.opening-frame .act-poster, .opening-frame .act-canvas { z-index: 0; }
.opening-frame .act-shade { z-index: 1; background: linear-gradient(to bottom, rgba(0, 0, 0, .25), rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, .7)); }
.opening-frame .act-flash { z-index: 2; }
.opening-layout { display: block; position: relative; }
.opening-layout > * { position: absolute; left: 0; right: 0; margin-inline: auto; }
.act-opening .title-card { top: calc(var(--frame-top) + var(--frame-h) * .34); font-size: min(11.2vw, 8.8rem); }
.opening-subtitle { top: calc(var(--frame-top) + var(--frame-h) * .74); max-width: 24em; padding: 0 var(--gutter); margin: 0 auto; text-align: center; font-size: clamp(.95rem, 3.7vw, 1.4rem); line-height: 1.38; }
.opening-credit { top: calc(var(--frame-top) + var(--frame-h) * .9); margin: 0; text-align: center; font-size: clamp(.7rem, 2.8vw, .88rem); color: var(--text); }
/* Narration sits on the light shaft: a soft local scrim keeps it readable without darkening the frame. */
.opening-subtitle, .opening-credit, .opening-late { text-shadow: 0 0 3px #000, 0 0 14px #000, 0 0 30px rgba(0, 0, 0, .9); }
.opening-subtitle::before, .opening-credit::before {
  content: ""; position: absolute; inset: -18px 8%; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 50% 50% at 50% 50%, rgba(0, 0, 0, .62), rgba(0, 0, 0, 0) 100%);
}
.opening-actions { top: calc(var(--frame-top) + var(--frame-h) + 26px); display: grid; justify-items: center; gap: 14px; width: min(100% - 2 * var(--gutter), 420px); }
.opening-actions .btn { width: 100%; }
@media (max-width: 480px) { .opening-actions .btn { padding: 0 16px; letter-spacing: .07em; font-size: 1rem; white-space: nowrap; } }
.next-frame {
  top: calc(var(--frame-top) + var(--frame-h) + 26px + var(--actions-h) + 22px); width: calc(100% - 2 * var(--gutter)); max-width: 980px;
  height: clamp(110px, calc(100svh - var(--frame-top) - var(--frame-h) - var(--actions-h) - 64px - var(--safe-b)), 240px);
  display: block; overflow: hidden; text-decoration: none; border: 1px solid var(--line);
}
.next-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: var(--frame-grade) brightness(.75); }
.next-frame-text { position: absolute; inset: 0; display: grid; align-content: center; justify-items: end; gap: 6px; padding: 0 clamp(16px, 5vw, 48px); text-align: right; }
.next-frame-title { font-family: var(--sub); font-size: clamp(1.15rem, 4.8vw, 1.9rem); letter-spacing: .12em; color: var(--text); text-shadow: 0 2px 20px #000; }
.opening-late { top: 72svh; text-align: center; font-size: clamp(1.1rem, 4.6vw, 1.7rem); padding: 0 var(--gutter); text-shadow: 0 2px 26px #000; }
/* Without the scroll engine the opening is one still screen with everything visible. */
@media (min-width: 900px) {
  .act-opening { --frame-h: 56svh; }
  .opening-actions { width: max-content; grid-auto-flow: column; align-items: center; gap: 36px; }
  .opening-actions .btn { width: auto; min-width: 320px; }
}
@media (max-height: 700px) and (max-width: 899px) {
  .act-opening { --frame-h: 46svh; }
}
@media (max-height: 560px) and (max-width: 899px) { .next-frame { display: none; } }

/* ---------- 7. The other acts take the same grammar ---------- */
.book-copy h2, .stack-layout h2, .archive-head h2, .axia-intro h2 { font-family: var(--title); font-weight: 600; }
.pillar-beat h3 { font-family: var(--title); font-weight: 600; }
.arch-door { border-radius: 0; border-color: var(--line); background: rgba(0, 0, 0, .78); }
.arch-door::before { border-radius: 0; }
.arch-door h3 { font-family: var(--sub); font-weight: 400; letter-spacing: .1em; }
p.axia-q { font-family: var(--sub); font-style: normal; letter-spacing: .04em; }
.spectrum li::before { background: var(--silver); box-shadow: none; opacity: calc(.35 + var(--i, 0) * .1); }
.cover-frame img { border-color: var(--line); filter: grayscale(1) contrast(1.06); }  /* the Book I cover joins the black, white and grey palette */

/* ---------- 8. Sections after the acts ---------- */
.record-card { border-color: var(--line); }
.record-label h3 { font-family: var(--sub); font-weight: 400; letter-spacing: .1em; }
.way-body strong, .closing h2, .desk b { font-family: var(--title); font-weight: 600; }
.format-list { font-family: var(--sub); }
.closing-art { opacity: .35; }
.guest-strip, .ways .container, .desk-list, .record-facts { border-top-color: var(--line-strong); }

/* Chapter frames: Book I as a reel of film frames */
.chapter-frames { padding-top: clamp(80px, 14vw, 150px); }
.frame-list { list-style: none; margin: clamp(26px, 5vw, 44px) 0 0; padding: 0; display: grid; gap: 14px; }
.film-frame { position: relative; display: block; overflow: hidden; aspect-ratio: 16 / 8; border: 1px solid var(--line); text-decoration: none; background: #000; }
.film-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: var(--frame-grade) brightness(.72); transition: transform 1.2s var(--ease-out), filter .6s ease; }
.film-frame-text { position: absolute; inset: 0; display: grid; align-content: center; justify-items: end; gap: 6px; padding: 0 clamp(16px, 5vw, 44px); text-align: right; text-shadow: 0 2px 18px #000; }
.film-frame-title { font-family: var(--sub); font-size: clamp(1.2rem, 5vw, 2rem); letter-spacing: .1em; color: var(--text); }
.film-frame:active img { filter: var(--frame-grade) brightness(.9); }
@media (hover: hover) and (pointer: fine) { .film-frame:hover img { transform: scale(1.03); filter: var(--frame-grade) brightness(.9); } }
@media (min-width: 900px) { .frame-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; } }

/* ---------- 9. Inner pages: a letterboxed frame behind every title ---------- */
body[data-scene] main::before {
  height: min(70svh, 620px); opacity: .75; filter: var(--frame-grade);
  background: linear-gradient(to bottom, rgba(0, 0, 0, .35), rgba(0, 0, 0, .55) 60%, #000 100%), var(--page-scene) center 40% / cover no-repeat;
}
.card, .archive-card, .policy-card, .feature-panel, .contact-card, .stat-card, .faq-item, .app-panel, .callout, .auth-card, .account-panel, .legal-card {
  background: transparent; border: 1px solid var(--line); box-shadow: none; border-radius: 0;
}
.callout { background: rgba(0, 0, 0, .55); }
.card-index, .metric { font-family: var(--title); font-weight: 600; color: var(--text); }
.notice { background: transparent; border: 1px solid var(--line); border-left: 1px solid var(--line-strong); color: var(--silver); }
.section.boundary { background: transparent; border-color: var(--line); }
.points-table, .feature-row, .toc-list li, .toc-row { border-color: var(--line); }
.points-table { background: transparent; }
.points-table th { font-family: var(--sub); font-weight: 400; letter-spacing: .2em; }
.feature-row strong { font-family: var(--sub); font-weight: 400; letter-spacing: .06em; font-size: 1.08rem; }
.badge, .toc-state, .status-pill, .store-placeholder { border-radius: 0; border-color: var(--line-strong); font-family: var(--sub); letter-spacing: .1em; }
.faq-item summary { font-family: var(--sub); font-weight: 400; letter-spacing: .06em; font-size: 1.12rem; }
.toc a, .legal p, .legal li { font-family: var(--copy); }
.legal h2 { font-family: var(--title); font-weight: 600; }
.toc { border-radius: 0; background: transparent; border-color: var(--line); }

/* Book page and reader */
.toc-num { font-family: var(--title); font-weight: 600; color: var(--text); }
.toc-name { font-family: var(--sub); letter-spacing: .06em; font-size: 1.2rem; }
.book-subtitle { font-family: var(--sub); font-style: normal; letter-spacing: .1em; }
.reader-toolbar { background: rgba(0, 0, 0, .94); }
.reader-select, .reader-size button { border-radius: 0; background: transparent; border-color: var(--line-strong); font-family: var(--sub); letter-spacing: .04em; }
.chapter-head h1 { font-family: var(--title); font-weight: 600; }
.chapter-head .eyebrow { font-family: var(--sub); }
.chapter-byline { font-family: var(--sub); font-style: normal; letter-spacing: .1em; }
.chapter-body.is-verse h2 { font-family: var(--sub); font-weight: 400; letter-spacing: .08em; }
.reader-gate, .reader-end, .reader-notice { background: transparent; border-color: var(--line); }
.reader-gate h2, .reader-end h2 { font-family: var(--title); font-weight: 600; }
.pager-link { background: transparent; border-color: var(--line); }
.pager-title { font-family: var(--sub); letter-spacing: .06em; }
.scene-break span::before, .scene-break span::after { content: ""; }

/* Account and forms */
.auth-tabs { background: transparent; border-color: var(--line); }
.auth-tab { font-family: var(--sub); font-weight: 400; font-size: .92rem; letter-spacing: .14em; }
.auth-tab.active { background: rgba(242, 242, 240, .06); box-shadow: inset 0 -1px 0 var(--text); }
.form-group label { font-family: var(--sub); font-weight: 400; letter-spacing: .2em; }
.form-control { background: transparent; border-color: var(--line-strong); font-family: var(--copy); }
.auth-message.error { color: #e3e3e1; text-decoration: underline; text-decoration-color: rgba(242, 242, 240, .5); }
.auth-message.success { color: var(--text); }
/* Axia dispositions keep their names; on the website they read in greyscale. */
[data-axia-disposition] { --axia-accent: var(--silver) !important; }
.axia-progress-fill { background: var(--text); }

/* ---------- 10. Footer ---------- */
.site-footer { background: #000; }
.site-footer::before { background: var(--line-strong); opacity: 1; }
.footer-grid h4 { font-size: .72rem; }
.footer-grid a { font-family: var(--copy); }

/* ---------- 11. Reduced motion: scroll scenes still run (the visitor drives them); words fade without blur ---------- */
@media (prefers-reduced-motion: reduce) {
  .cinema .words .w { filter: none; transform: none; }
}

/* Small labels never drop below the 11px floor. */
.record-facts dt, .toc-label, .pager-dir { font-size: .76rem; }

/* Motion off: the Axia questions read as a list over a darkened frame, not stacked on the art. */
html:not(.cinema) .axia-layout > * + * { margin-top: 30px; }
html:not(.cinema) .act-axia .act-shade { background: rgba(0, 0, 0, .62); }
html:not(.cinema) .act-axia .act-inner { padding-block: 120px 80px; }

/* ---------- Review fixes: credits typography carried through the acts ---------- */
.opening-credit { letter-spacing: .24em; color: #ececea; font-size: clamp(.82rem, 2.6vw, .95rem); }
/* Act headings are title cards: tracked capitals in the credit face. MORIBUND itself is the official wordmark image. */
.book-copy h2, .stack-layout h2, .archive-head h2, .axia-intro h2, .pillar-beat h3, .way-body strong, .closing h2, .chapter-frames .section-head h2 {
  font-family: var(--sub); font-weight: 400; text-transform: uppercase; letter-spacing: .16em; line-height: 1.18;
  font-size: clamp(1.4rem, 5.4vw, 2.7rem); text-wrap: balance;
}
.way-body strong { font-size: clamp(1.2rem, 4.6vw, 2rem); }
.way-name img { width: 24px; height: 24px; }

/* No glass in this world: the scrolled header is a solid black band. */
.site-header.scrolled::before, .menu-open .site-header::before { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(0, 0, 0, .94); }

/* ---------- Opening credits: scratched film and word-by-word narration (credits.js) ---------- */
.act-opening { --k: calc(1 - min(1, var(--p, 0) * 3)); }
.opening-frame { --k: calc(1 - min(1, var(--p, 0) * 3)); }
/* Scratches and dust ride over the frame and its title card, clipped to the same letterbox. */
.film-scratches {
  position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none;
  mix-blend-mode: screen; opacity: .8;
  clip-path: inset(calc(var(--frame-top) * var(--k)) 0 calc((100% - var(--frame-top) - var(--frame-h)) * var(--k)) 0);
}
/* The title card burns in like a projected credit: uneven flicker, then steady. */
@keyframes credit-burn {
  0% { opacity: 0; filter: blur(10px) brightness(2); }
  10% { opacity: .85; filter: blur(3px) brightness(1.6); }
  14% { opacity: .1; }
  22% { opacity: .95; filter: blur(1px) brightness(1.3); }
  28% { opacity: .35; }
  38% { opacity: 1; filter: none; }
  52% { opacity: .8; }
  56%, 100% { opacity: 1; filter: none; }
}
@keyframes credit-jitter {
  0% { opacity: 0; transform: translate3d(-2px, 1px, 0); }
  20% { opacity: .9; transform: translate3d(1px, 0, 0); }
  26% { opacity: .3; }
  40% { opacity: 1; transform: translate3d(-1px, 0, 0); }
  100% { opacity: 1; transform: none; }
}
/* Word-by-word: each word sharpens out of a blur in turn when its scene comes on. */
.cinema .words .w {
  display: inline-block; opacity: 0; filter: blur(7px); transform: translate3d(0, .22em, 0);
  transition: opacity .55s ease, filter .7s var(--ease-out), transform .7s var(--ease-out);
  transition-delay: calc(var(--i, 0) * var(--step, 70ms) + 120ms);
}
.cinema .beat.on .words .w, .cinema .beat.on.words .w, .cinema .beat.on > .words .w { opacity: 1; filter: none; transform: none; }
.cinema .beat:not(.on) .words .w, .cinema .beat.words:not(.on) .w { transition-delay: 0ms; transition-duration: .3s; }
@media (prefers-reduced-motion: no-preference) {
  .cinema .act-opening .title-card { animation: credit-burn 1.6s steps(1, end) .25s backwards; }
  .cinema .act-opening .opening-credit { animation: credit-jitter 1.1s steps(1, end) 1.5s backwards; }
}

/* =====================================================================
   Theme picker and the Light theme ("printed credits")
   Dark stays the default. Light is black type on off-white paper; the film
   itself (acts, chapter frames, the closing band) stays dark in both themes.
   ===================================================================== */
.theme-pick { position: relative; display: none; }
@media (min-width: 1051px) { .theme-pick { display: block; margin-left: 10px; } }
.theme-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 0; background: transparent; color: var(--text); cursor: pointer; }
.theme-btn[aria-expanded="true"] { border-color: var(--line-strong); }
.theme-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 120; min-width: 160px; padding: 6px;
  display: grid; background: var(--bg); border: 1px solid var(--line-strong); box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
}
.theme-pop[hidden] { display: none; }
.theme-pop button, .mobile-theme button {
  font-family: var(--sub); font-size: .98rem; letter-spacing: .12em; color: var(--muted); background: transparent; border: 0; border-radius: 0;
  text-align: left; padding: 10px 12px; cursor: pointer; touch-action: manipulation;
}
.theme-pop button[aria-checked="true"], .mobile-theme button[aria-pressed="true"] { color: var(--text); box-shadow: inset 2px 0 0 var(--text); }
.theme-pop button:focus-visible, .mobile-theme button:focus-visible { outline: 1px solid var(--text); outline-offset: -1px; }
@media (hover: hover) and (pointer: fine) { .theme-pop button:hover, .theme-btn:hover { color: var(--text); background: var(--surface-2); } }
.mobile-theme { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding-top: 22px; margin-top: 16px; border-top: 1px solid var(--line); }
.mobile-theme-label { font-family: var(--sub); font-size: .72rem; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); margin-right: 10px; }
.mobile-theme button { padding: 10px 12px; min-height: 44px; }
.mobile-theme button[aria-pressed="true"] { box-shadow: inset 0 -1px 0 var(--text); }

/* ---------- Light theme tokens ---------- */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f3f1;
  --bg-soft: #e8e8e5;
  --text: #0c0c0c;
  --text-2: #262623;
  --silver: #34342f;
  --muted: #55554f;
  --faint: #8d8d87;
  --line: rgba(12, 12, 12, .14);
  --line-strong: rgba(12, 12, 12, .4);
  --surface-2: rgba(12, 12, 12, .045);
  --axia: linear-gradient(90deg, transparent, rgba(12, 12, 12, .35) 50%, transparent);
}
html[data-theme="light"] body { background: var(--bg); }
html[data-theme="light"] ::selection { background: #0c0c0c; color: #f3f3f1; }

/* The film stays film: scenes, frames and the closing band keep their dark grade and white type. */
html[data-theme="light"] :is(.act, .film-frame, .next-frame, .closing, .end-card) {
  color-scheme: dark;
  --bg: #000; --text: #f2f2f0; --text-2: #d6d6d3; --muted: #a3a3a0; --silver: #c8c8c6; --faint: #6f6f6c;
  --line: rgba(242, 242, 240, .14); --line-strong: rgba(242, 242, 240, .34); --surface-2: rgba(242, 242, 240, .04);
  color: var(--text);
}

/* Header, menu and footer become paper; the white brand marks print in black. */
html[data-theme="light"] .site-header::before { background: linear-gradient(to bottom, rgba(243, 243, 241, .97), rgba(243, 243, 241, .9) 70%, rgba(243, 243, 241, .0)); }
html[data-theme="light"] .site-header.scrolled::before, html[data-theme="light"] .menu-open .site-header::before { background: rgba(243, 243, 241, .97); }
html[data-theme="light"] .menu-open .site-header::before { background: var(--bg); }
html[data-theme="light"] :is(.site-header .brand-wordmark, .site-footer .brand-wordmark) { filter: invert(1); }
html[data-theme="light"] .site-footer { background: var(--bg); }
html[data-theme="light"] .reader-toolbar { background: rgba(243, 243, 241, .96); }

/* Inner-page scenes read as a faded print behind dark type. */
html[data-theme="light"] body[data-scene] main::before {
  opacity: .5;
  background: linear-gradient(to bottom, rgba(243, 243, 241, .62), rgba(243, 243, 241, .86) 55%, var(--bg) 100%), var(--page-scene) center 40% / cover no-repeat;
}

/* Components that carried hard-coded dark values. */
html[data-theme="light"] .btn.primary { background: transparent; border-color: var(--text); color: var(--text); }
html[data-theme="light"] .btn:active { background: rgba(12, 12, 12, .08); }
@media (hover: hover) and (pointer: fine) { html[data-theme="light"] .btn:hover, html[data-theme="light"] .btn.primary:hover { background: rgba(12, 12, 12, .06); border-color: var(--text); } }
html[data-theme="light"] .callout { background: rgba(255, 255, 255, .55); }
html[data-theme="light"] .auth-message.error { color: var(--text); text-decoration-color: rgba(12, 12, 12, .5); }
html[data-theme="light"] .theme-pop { box-shadow: 0 18px 40px rgba(0, 0, 0, .12); }
html[data-theme="light"] .site-noise { mix-blend-mode: multiply; opacity: .05; }
/* A crisp paper header edge over the film, and line icons printed dark. */
html[data-theme="light"] .site-header::before { background: rgba(243, 243, 241, .97); }
html[data-theme="light"] .way-name img { filter: invert(1); mix-blend-mode: multiply; }


/* =====================================================================
   Brand system (2026-11-16): one wordmark, the M monogram stamp, one type scale
   ===================================================================== */
/* The official wordmark: white in the header and footer (printed dark in Light), silver as the opening title. */
.brand-wordmark { height: var(--mark-h); width: auto; }
/* --mark-h is set per screen class in "Device classes" at the end of this file. */
.footer-seal { width: 46px; height: auto; opacity: 1; }
.act-opening .title-card {
  /* Never wider than the frame is tall allows (phones on their side), never wider than 940px at 16px. */
  width: min(84vw, 58.75rem, var(--frame-h) * 2.3); padding: 0; letter-spacing: 0; font-size: 0; line-height: 0;
  top: calc(var(--frame-top) + var(--frame-h) * .36);
}
.title-mark { display: block; width: 100%; height: auto; filter: drop-shadow(0 4px 26px rgba(0, 0, 0, .78)); }

/* The M monogram is the stamp: reader ornaments, end of chapter, loading. */
.scene-break, .chapter-rule { color: var(--muted); }
.scene-break { letter-spacing: 0; padding-left: 0; font-size: 0; margin: 2.4em 0; }
.scene-break span, .chapter-rule span {
  display: inline-block; font-size: 0; background: currentColor;
  -webkit-mask: url("assets/brand/monogram.svg") center / contain no-repeat; mask: url("assets/brand/monogram.svg") center / contain no-repeat;
}
.scene-break span { width: 14px; height: 17px; }
.scene-break span::before, .scene-break span::after { content: none; }
.chapter-rule span { width: 13px; height: 16px; flex: none; }
.chapter-body::after {
  content: ""; display: block; width: 24px; height: 29px; margin: 3.4em auto 0; background: var(--muted);
  -webkit-mask: url("assets/brand/monogram.svg") center / contain no-repeat; mask: url("assets/brand/monogram.svg") center / contain no-repeat;
}
.gate-sigil {
  width: 28px; height: 34px; border: 0; transform: none; background: var(--muted);
  -webkit-mask: url("assets/brand/monogram.svg") center / contain no-repeat; mask: url("assets/brand/monogram.svg") center / contain no-repeat;
}
.gate-sigil::after { content: none; }
@keyframes stamp-breathe { 50% { opacity: .35; } }
@media (prefers-reduced-motion: no-preference) { .reader-loading .gate-sigil { animation: stamp-breathe 1.8s ease-in-out infinite; } }

/* One type scale. Headings: EB Garamond 600, slightly tight; labels stay Bellefair. */
h1, h2, .section-head h2, .page-head h1, .callout h2, .book-intro h1, .book-intro h2, .chapter-head h1, .legal h2, .reader-gate h2, .reader-end h2 { letter-spacing: -.008em; }
.page-head h1, .book-intro h1, .book-intro h2 { font-size: var(--fs-h1); line-height: 1.02; }
.section-head h2, .callout h2 { font-size: var(--fs-h2); line-height: 1.08; }
.chapter-head h1 { font-size: clamp(2rem, 1.5rem + 2.6vw, 3.2rem); }
h3, .card h3, .card h2.card-title, .contact-card h3 { font-size: var(--fs-h3); line-height: 1.25; }
.lede, .page-head .lede, .section-head p { font-size: var(--fs-lead); line-height: 1.5; }
.notice, .feature-row > span, .toc a, .footer-grid a { font-size: var(--fs-small); }
.mobile-panel a { font-weight: 600; letter-spacing: -.005em; }
/* Bellefair has one weight: the small menu links must not inherit a fake bold. */
.mobile-panel .mobile-minor a { font-weight: 400; letter-spacing: .24em; }
/* Secondary text uses the second grey, never a tinted one. */
.hero-sub, .book-copy p, .stack-layout p, .archive-head p, .axia-layout p, .closing p { color: var(--text-2); }

/* Light theme: the silver stamp prints darker so it holds on paper. */
html[data-theme="light"] .footer-seal { filter: brightness(.38) contrast(1.25); }

/* Bellefair ships one weight (400). Stop browsers faking a bold for it anywhere;
   EB Garamond has real weights and italics, so nothing else changes. */
html { font-synthesis: style small-caps; }

/* =====================================================================
   Device classes (2026-11-16): five screen classes, checked at 8 sizes
   small phone <=380 | phone 381-580 | tablet 581-1050 | laptop 1051-1599 | wide >=1600
   Tokens are set on ":root, html[data-theme]" so they beat the theme blocks.
   ===================================================================== */
:root, html[data-theme] { --header-h: 72px; --mark-h: 21px; --gutter: clamp(20px, 5.4vw, 44px); --max: 73.75rem; }
@media (max-width: 380px) { :root, html[data-theme] { --header-h: 58px; --mark-h: 18px; --gutter: 18px; } }
@media (min-width: 381px) and (max-width: 580px) { :root, html[data-theme] { --header-h: 64px; --mark-h: 19px; } }
@media (min-width: 581px) and (max-width: 1050px) { :root, html[data-theme] { --header-h: 68px; --mark-h: 20px; } }
/* Wide screens: everything set in rem grows with the root size, so the page fills the screen instead of shrinking into its middle. */
@media (min-width: 1600px) { html { font-size: 106.25%; } :root, html[data-theme] { --header-h: 80px; --mark-h: 24px; --gutter: 56px; } }
@media (min-width: 1920px) { html { font-size: 112.5%; } :root, html[data-theme] { --header-h: 84px; --mark-h: 26px; --gutter: 64px; } }
@media (min-width: 2400px) { html { font-size: 125%; } :root, html[data-theme] { --header-h: 92px; --mark-h: 29px; --gutter: 80px; } }
/* Phones on their side: the screen is short, so the header gives back height. */
@media (orientation: landscape) and (max-height: 500px) { :root, html[data-theme] { --header-h: 54px; --mark-h: 18px; } }

/* The opening: narration and credit hang from the bottom of the frame, so a longer line
   pushes upward into free space instead of running into the credit below it. */
.opening-credit { top: calc(var(--frame-top) + var(--frame-h) - 1.1rem); translate: 0 -100%; }
.opening-subtitle { top: calc(var(--frame-top) + var(--frame-h) - 3.6rem); translate: 0 -100%; }
.opening-actions { width: min(100% - 2 * var(--gutter), 26.25rem); }
.next-frame { max-width: 61.25rem; }
/* From 900px the two opening actions sit side by side, so they take one row of height, not two. */
@media (min-width: 900px) { .act-opening { --actions-h: 70px; } .opening-actions { width: max-content; } .opening-actions .btn { min-width: 20rem; } }
@media (max-width: 380px) {
  .opening-credit { letter-spacing: .14em; font-size: .76rem; }
  .opening-actions .btn { font-size: .92rem; letter-spacing: .04em; padding: 0 12px; }
  .next-frame-title { font-size: 1.05rem; letter-spacing: .06em; }
}
/* Not enough height below the buttons for the next-chapter strip: leave it out. */
@media (max-height: 620px) and (max-width: 899px) { .next-frame { display: none; } }
@media (orientation: landscape) and (max-height: 500px) {
  .act-opening { --frame-h: calc(100svh - var(--frame-top) - 150px - var(--safe-b)); }
  .act-opening .title-card { top: calc(var(--frame-top) + var(--frame-h) * .1); width: min(84vw, var(--frame-h) * 1.9); }
  .opening-subtitle { max-width: 46em; font-size: .98rem; }
}

/* Controls keep their label on one line. */
.text-link { white-space: nowrap; }
@media (max-width: 380px) { .btn { padding-inline: 14px; letter-spacing: .08em; } }
.auth-tab { white-space: nowrap; font-size: .88rem; letter-spacing: .08em; padding-inline: 8px; }
.app-only-strip .btn { flex: none; white-space: nowrap; }
.account-shell > div:first-child { container-type: inline-size; }
@container (max-width: 520px) { .app-only-strip { flex-direction: column; align-items: flex-start; } }

/* Small labels never drop below the label size. */
.form-group label, .spectrum b, .footer-grid h4, .toc-state, .eyebrow, .text-link { font-size: var(--fs-label); }

/* Reading measure: about 70 to 75 characters a line wherever people read at length. */
.reader-article, .reader-pager { max-width: 42.5rem; }
.chapter-body { max-width: 29em; margin-inline: auto; }
.page-head .lede, .page-lede, .callout p, .book-intro .lede, .section-head p { max-width: 30em; }
.split p { max-width: 32em; }
.section-head.center p { margin-inline: auto; }
.reader-back { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }

/* Policy pages: back link, effective date and title stacked with air between them,
   the index beside the text on laptops and in two short columns above it elsewhere. */
.container .container { width: 100%; }
.page-hero { padding-bottom: clamp(20px, 4vw, 36px); }
.back-link {
  display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 6px;
  font-family: var(--sub); font-size: var(--fs-small); letter-spacing: .08em; color: var(--muted);
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 5px;
}
.page-hero .eyebrow { display: block; margin-bottom: 14px; }
.page-title { font-family: var(--title); font-weight: 600; font-size: var(--fs-h1); line-height: 1.04; letter-spacing: -.008em; margin: 0 0 .4em; text-wrap: balance; }
.page-lede { font-size: var(--fs-lead); line-height: 1.5; color: var(--text-2); margin: 0; }
.page-layout { display: grid; gap: 28px; }
.page-layout .toc { columns: 2 13em; column-gap: 32px; padding: 18px 22px; }
.page-layout .toc strong {
  column-span: all; display: block; margin-bottom: 8px;
  font-family: var(--sub); font-weight: 400; font-size: var(--fs-label); letter-spacing: .2em; text-transform: uppercase; color: var(--silver);
}
.page-layout .toc a { break-inside: avoid; }
.legal { max-width: 29em; }
@media (min-width: 1101px) {
  .page-layout { grid-template-columns: 15rem minmax(0, 1fr); gap: clamp(40px, 5vw, 80px); align-items: start; }
  .page-layout .toc { columns: auto; position: sticky; top: calc(var(--header-h) + var(--safe-t) + 24px); }
}

/* =====================================================================
   Logo flight (2026-11-17): homepage only. At the top the header carries no logo;
   the opening title glides into the logo spot as the visitor scrolls (credits.js).
   ===================================================================== */
html.cinema .home .site-header .brand-wordmark { opacity: 0; animation: brand-fallback 0s 4s forwards; }  /* if credits.js never runs, the logo comes back */
html.cinema.flight .home .site-header .brand-wordmark { animation: none; opacity: var(--brand-o, 0); }
@keyframes brand-fallback { to { opacity: 1; } }
.home .brand:focus-visible .brand-wordmark, .menu-open .site-header .brand-wordmark { opacity: 1 !important; }
html.flown .act-opening .title-mark { opacity: var(--title-o, 0); }
.flight-mark {
  position: fixed; left: 0; top: 0; z-index: 101; pointer-events: none; opacity: 0;
  transform-origin: 0 0; will-change: transform, opacity;
}
.flight-mark > img, .flight-mark > canvas { display: block; width: 100%; height: auto; }
.flight-mark > img { filter: drop-shadow(0 4px 26px rgba(0, 0, 0, calc(.78 * (1 - var(--ink, 0))))); }
/* With metal.js: the chrome canvas flies on top, the silver logo under it becomes a still soft shadow. */
.flight-mark.metal > canvas { position: absolute; inset: 0; height: 100%; }
.flight-mark.metal > img { filter: brightness(0) blur(12px); opacity: calc(.72 * (1 - var(--ink, 0))); transform: translateY(4px); }
/* On paper the header logo is printed dark, so the silver mark darkens as it lands. */
html[data-theme="light"] .flight-mark { filter: brightness(calc(1 - .9 * var(--ink, 0))); }
.menu-open .flight-mark, html:not(.flight) .flight-mark { visibility: hidden; }

/* =====================================================================
   Metallic Paint (2026-11-17): the opening title as liquid chrome (metal.js).
   The canvas sits over the silver logo; the logo itself becomes the soft
   shadow under it (a static layer, so the moving metal never re-filters).
   ===================================================================== */
.title-metal { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; opacity: var(--title-o, 1); }
.act-opening .title-card.metal-on .title-mark { filter: brightness(0) blur(12px); opacity: calc(.72 * var(--title-o, 1)); transform: translateY(4px); }

/* =====================================================================
   Linework (2026-11-17): four drawn-line effects (linework.js).
   The wordmark traces itself in; section headings turn to dashed outlines
   under the cursor; inner-page scenes sit as a halftone screen the cursor
   resolves; a comet rides a drawn line down the homepage. Greys only.
   They move for everyone, reduced-motion settings included (owner's
   choice, 2026-11-17, as for the chrome title).
   ===================================================================== */
/* 1. The wordmark draws itself from its own outlines, then the silver wipes in under them.
   The title is held dark for every visitor until linework.js takes it (the page's scripts run
   after the Supabase file arrives, which can take a second); if it never comes, the burn-in plays at 2s. */
.cinema .act-opening .title-card:not(.lw-drawn) { animation: credit-burn 1.6s steps(1, end) 2s backwards; }
.cinema .act-opening .title-card.lw-drawn { animation: none; }
.lw-mark {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; pointer-events: none;
  fill: none; stroke: #f4f4f2; stroke-linejoin: round; stroke-linecap: round;
  filter: drop-shadow(0 0 3px rgba(242, 242, 240, .45)) drop-shadow(0 2px 14px rgba(0, 0, 0, .8));
  transition: opacity 1.2s ease;
}
.lw-mark.is-done { opacity: 0; }
.act-opening .title-card.lw-draw .title-mark, .act-opening .title-card.lw-draw .title-metal { opacity: 0; }
.act-opening .title-card.lw-settle .title-mark, .act-opening .title-card.lw-settle .title-metal {
  -webkit-mask-image: linear-gradient(90deg, #000 40%, transparent 60%); mask-image: linear-gradient(90deg, #000 40%, transparent 60%);
  -webkit-mask-size: 260% 100%; mask-size: 260% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: 100% 0; mask-position: 100% 0;
}
.act-opening .title-card.lw-settle.is-in .title-mark, .act-opening .title-card.lw-settle.is-in .title-metal {
  -webkit-mask-position: 0 0; mask-position: 0 0;
  transition: -webkit-mask-position 1.4s cubic-bezier(.45, 0, .25, 1), mask-position 1.4s cubic-bezier(.45, 0, .25, 1);
}

/* 2. Tech Text: each letter keeps its glyph; its dashed outline shows over it near the cursor. */
.lw-sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.lw-word { display: inline-block; white-space: nowrap; }
.lw-c { position: relative; display: inline-block; }
[data-lw-tt] .lw-c > .lw-gh, [data-lw-tt] .fx-c > .fx-gh { opacity: calc(1 - var(--lw-v, 0)); }
.lw-tt {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none;
  opacity: var(--lw-v, 0); fill: none; stroke: currentColor; stroke-width: var(--lw-sw, 1px);
  stroke-dasharray: var(--lw-dash, 3px 2px); stroke-linecap: butt; stroke-linejoin: round;
}
.lw-tt text { text-transform: none; letter-spacing: 0; }
@keyframes lw-march { to { stroke-dashoffset: var(--lw-period, -5px); } }
/* styles.css cuts every animation to .001ms under reduced motion (with !important); the march moves for everyone. */
.lw-live .lw-tt text { animation: lw-march .9s linear infinite; animation-duration: .9s !important; animation-iteration-count: infinite !important; }

/* 3. Halftone lens: over the inner-page scene, in the same box as the scene itself (main::before). */
.lw-halftone {
  position: absolute; top: 0; left: 0; z-index: -1; width: 100%; height: 70vh; height: min(70svh, 620px);
  display: block; pointer-events: none;
}
html[data-theme="light"] .lw-halftone { display: none; }    /* on paper the scene is a faded print, left plain */

/* 4. Scroll comet: one fixed canvas over the page. Difference blending keeps it light on the film
   and prints it dark where it crosses paper in the Light theme. Below the header and scene counter. */
.lw-comet {
  position: fixed; left: 0; top: 0; z-index: 60; width: 100%; height: 100vh; height: 100lvh;
  display: block; pointer-events: none; mix-blend-mode: difference;
}
.menu-open .lw-comet { visibility: hidden; }

/* =====================================================================
   App emblem (2026-11-17): the M as a turning 3D chrome emblem (emblem.js).
   Beside the heading on laptops, under the intro on phones. Drag to spin it.
   ===================================================================== */
.page-head.has-emblem { display: grid; align-items: center; column-gap: clamp(28px, 5vw, 72px); max-width: none; }
.page-head.has-emblem > h1, .page-head.has-emblem > .lede { grid-column: 1; }
.app-emblem { position: relative; width: clamp(180px, 46vw, 15.5rem); aspect-ratio: 10 / 11; justify-self: center; margin-top: 18px; touch-action: pan-y; }
@media (min-width: 900px) {
  .page-head.has-emblem { grid-template-columns: minmax(0, 1fr) auto; }
  .page-head.has-emblem > .app-emblem { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; width: clamp(200px, 21vw, 17rem); }
}
.app-emblem > img { position: absolute; left: 50%; top: 50%; width: 46%; height: auto; transform: translate(-50%, -50%); filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .6)); transition: opacity .6s var(--ease-out); }
.app-emblem > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.app-emblem.is-dragging > canvas { cursor: grabbing; }
.app-emblem.emblem-on > img { opacity: 0; }
html[data-theme="light"] .app-emblem > img { filter: brightness(.38) contrast(1.25); }

/* ---------- Scene counter (credits.js 1d) ----------
   01–05 down the right edge while the five homepage scenes play. The scenes stay dark in
   every theme, so the counter is always light type with a soft shadow for the bright frames. */
.act-index {
  position: fixed; top: 50%; right: max(18px, env(safe-area-inset-right, 0px)); z-index: 80;
  color: #f2f2f0; text-shadow: 0 1px 10px rgba(0, 0, 0, .85);
  opacity: 0; visibility: hidden; transform: translate3d(8px, -50%, 0);
  transition: opacity .5s cubic-bezier(.16, 1, .3, 1), transform .6s cubic-bezier(.16, 1, .3, 1), visibility 0s linear .6s;
}
.act-index.is-shown { opacity: 1; visibility: visible; transform: translate3d(0, -50%, 0); transition-delay: 0s; }
.act-index ol { list-style: none; margin: 0; padding: 0; display: grid; }
.act-index a {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-height: 32px; padding-left: 14px;
  color: inherit; text-decoration: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  font-family: var(--display); font-size: .64rem; font-weight: 600; letter-spacing: .24em; text-transform: uppercase;
}
.act-index-n { font-variant-numeric: tabular-nums; opacity: .45; transition: opacity .35s; }
.act-index-name { white-space: nowrap; opacity: 0; transform: translateX(6px); transition: opacity .35s, transform .45s cubic-bezier(.16, 1, .3, 1); }
.act-index-line { flex: none; width: 10px; height: 1px; background: currentColor; opacity: .4; box-shadow: 0 0 6px rgba(0, 0, 0, .7); transition: width .5s cubic-bezier(.16, 1, .3, 1), opacity .35s; }
.act-index a[aria-current] .act-index-n { opacity: 1; }
.act-index a[aria-current] .act-index-name { opacity: 1; transform: none; }
.act-index a[aria-current] .act-index-line { width: 30px; opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .act-index a:hover .act-index-n, .act-index a:hover .act-index-line { opacity: 1; }
  .act-index a:hover .act-index-name { opacity: .75; transform: none; }
}
.act-index a:focus-visible { outline: 1px solid currentColor; outline-offset: 3px; }
.act-index a:focus-visible .act-index-name { opacity: 1; transform: none; }
/* Phones and tablets: the current scene's name runs down the edge above the numbers, so it
   never sits on the scene's text (computers show it beside the number instead). */
.act-index-title { display: none; }
@media (max-width: 1050px) {
  .act-index-title {
    display: block; position: absolute; bottom: calc(100% + 14px); right: 6px;
    writing-mode: vertical-rl; white-space: nowrap; pointer-events: none;
    font-family: var(--display); font-size: .62rem; font-weight: 600; letter-spacing: .3em; text-transform: uppercase;
    transition: opacity .3s ease, transform .5s cubic-bezier(.16, 1, .3, 1);
  }
  .act-index-title.is-swapping { opacity: 0; transform: translateY(-8px); transition-duration: .2s; }
  .act-index-title.is-covered { opacity: 0; }
}
@media (max-width: 580px) { .act-index-title { right: max(2px, env(safe-area-inset-right, 0px)); bottom: calc(100% + 10px); font-size: .58rem; letter-spacing: .26em; } }
/* Tablets: numbers only; the scene names need the width of a computer screen. */
@media (max-width: 1050px) { .act-index-name { display: none; } }
/* A button of the scene passing under the counter: the counter fades out of its way. */
.act-index.is-shown.is-yielding { opacity: 0; pointer-events: none; }
/* Phones: numbers and ticks (no names), each with a wide tap area reaching to the screen edge. */
@media (max-width: 580px) {
  .act-index { right: 0; }
  .act-index a { width: 48px; min-height: 34px; padding: 0 max(4px, env(safe-area-inset-right, 0px)) 0 0; gap: 4px; font-size: .6rem; letter-spacing: .12em; }
  .act-index-name { display: none; }
  .act-index-line { width: 4px; }
  .act-index a[aria-current] .act-index-line, .act-index a:active .act-index-line { width: 10px; opacity: 1; }
  .act-index a:active .act-index-n { opacity: 1; }
}
@media (orientation: landscape) and (max-height: 500px) { .act-index a { min-height: 24px; } }

/* ---------- End card: the monogram in glass (glass.js) ----------
   The closing band's black runs on into a last frame: the monogram arrives in a grey glass
   tile, the glass melts away and the plain silver mark stays. Without WebGL it is just the mark. */
.end-card { display: grid; place-items: center; padding: 0 var(--gutter) clamp(96px, 16vw, 190px); background: #000; }
.end-card-tile { position: relative; display: grid; place-items: center; width: clamp(196px, 46vw, 300px); aspect-ratio: 1; -webkit-tap-highlight-color: transparent; }
.end-card-tile > img { width: 48%; height: auto; }
.end-card-tile > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; }
.end-card.glass-ready .end-card-tile { cursor: pointer; }
.end-card:is(.glass-armed, .glass-play) .end-card-tile > img { opacity: 0; }
.end-card:is(.glass-armed, .glass-play) .end-card-tile > canvas { opacity: 1; }

/* ---------- What's new card (first visit; whats-new.js) ---------- */
.wn-card { position: fixed; z-index: 90; left: 0; right: 0; bottom: 0; max-height: 86vh; overflow-y: auto; box-sizing: border-box; padding: 22px var(--gutter, 20px) calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--bg); color: var(--text-2); border: 1px solid var(--line-strong); border-bottom: 0; opacity: 0; transform: translate3d(0, 24px, 0); transition: transform .3s cubic-bezier(.22, .8, .3, 1), opacity .3s ease-out; }
.wn-card[hidden] { display: none; }
.wn-card.is-open { opacity: 1; transform: none; }
.wn-card:focus { outline: none; }
.wn-card:focus-visible { outline: 1px solid var(--line-strong); outline-offset: -4px; }
@media (min-width: 768px) {
  .wn-card { left: auto; right: 24px; bottom: 24px; width: 380px; padding: 24px 26px; border-bottom: 1px solid var(--line-strong); max-height: min(calc(100vh - 48px), 60vh); }
}
.wn-title { margin: 0 44px 14px 0; font-family: var(--sub); font-weight: 400; font-size: var(--fs-label); letter-spacing: .22em; text-transform: uppercase; color: var(--silver); }
.wn-close { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; border: 0; background: none; color: var(--silver); font: inherit; font-size: 1.6rem; line-height: 1; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.wn-close:focus-visible, .wn-btn:focus-visible { outline: 1px solid var(--line-strong); outline-offset: 2px; }
.wn-list { list-style: none; margin: 0; padding: 0; }
.wn-row { padding: 14px 0; border-top: 1px solid var(--line); }
.wn-row[hidden] { display: none; }
.wn-head { margin: 0 0 4px; font-family: var(--sub); font-weight: 400; font-size: 1.2rem; line-height: 1.25; color: var(--text); }
.wn-copy { margin: 0; font-family: var(--copy); font-size: var(--fs-small); line-height: 1.45; color: var(--muted); }
.wn-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; margin-top: 10px; padding: 0 20px; box-sizing: border-box; border: 1px solid var(--line-strong); background: transparent; color: var(--text); font-family: var(--sub); font-size: .86rem; letter-spacing: .16em; text-transform: uppercase; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.wn-btn:hover { background: var(--surface-2); }
/* the card never climbs over the header or the home banner: at most 60% of the screen on wider screens (above),
   and on phones a short sheet that never climbs over the header or the home banner (owner, 2026-11-19: panels must not
   cover the page). It scrolls inside itself; the page above stays readable and tappable. */
@media (max-width: 767px) {
  .wn-card { max-height: min(48vh, 360px); max-height: min(48dvh, 360px); padding-top: 16px; }
  .wn-title { margin-bottom: 8px; }
  .wn-row { padding: 10px 0; }
  .wn-head { font-size: 1.05rem; }
  .wn-btn { margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .wn-card { transform: none; transition: opacity .3s ease-out; }
}

/* ---------- Home announcement strip (Aeternum is here; words live in whats-new.js AETERNUM) ---------- */
/* A quiet line under the header, in the What's new card's type: one link to the public game, no motion, both themes from the tokens. */
.announce-strip { border-bottom: 1px solid var(--line); background: var(--bg-soft); color: var(--muted); }
.announce-inner { padding: 12px 0; }
/* the home page's header floats over the top of the page (main has no top padding there): start the strip below it */
.home .announce-strip { padding-top: calc(var(--header-h) + var(--safe-t, 0px)); } /* the same offset as every other home element under the header (notch included) */
.announce-copy { margin: 0; font-family: var(--copy); font-size: var(--fs-small); line-height: 1.45; text-align: center; }
.announce-head { margin-right: .35em; font-family: var(--sub); font-weight: 400; font-size: 1.05rem; letter-spacing: .04em; color: var(--text); }
.announce-link { display: inline-block; margin-left: .35em; padding: 6px 0; color: var(--text); font-family: var(--sub); letter-spacing: .08em; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.announce-link:hover { color: var(--silver); }
@media (max-width: 699px) {
  /* phones: as short as the approved words allow, so the opening film keeps most of the first screen */
  .announce-inner { padding: 8px 0; }
  .announce-copy { text-align: left; font-size: .86rem; line-height: 1.35; }
  .announce-head { font-size: .95rem; }
}

/* ---------- iPad and tablets (768-1366px, Split View, Stage Manager) ---------- */
:root { --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); }
/* Landscape iPads and installed apps: keep everything out from under the rounded corners and any side inset. */
.container { width: min(calc(100% - 2 * max(var(--gutter), var(--safe-l), var(--safe-r))), var(--max)); }
.mobile-panel { padding-left: max(var(--gutter), var(--safe-l)); padding-right: max(var(--gutter), var(--safe-r)); }
.footer-bottom { padding-bottom: var(--safe-b); }
@media (min-width: 700px) and (max-width: 1366px) {
  .mobile-panel a { font-size: clamp(2rem, 4.6vw, 2.8rem); }
  .menu-btn { width: 48px; height: 48px; }
  .theme-btn, .reader-size button, .reader-select, .reader-cine button, .reader-back { min-height: 44px; }
  .reader-size button { min-width: 44px; }
  .reader-toolbar-inner { min-height: 60px; }
}
@media (min-width: 700px) and (max-width: 1050px) and (orientation: portrait) {
  .pt-titles { bottom: calc(clamp(40px, 8svh, 96px) + env(safe-area-inset-bottom, 0px)); }
}
/* ---------- Offline reading: save controls (contents page and reader) ---------- */
.offline-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 0 0 18px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.offline-bar[hidden] { display: none; }
.offline-bar p, .offline-panel p { margin: 0; }
.offline-total, .offline-meta { color: var(--muted); font-family: var(--sub); font-size: .84rem; letter-spacing: .05em; }
.offline-fine { flex-basis: 100%; color: var(--muted); font-size: .86rem; line-height: 1.5; max-width: 62ch; }
.offline-banner { flex-basis: 100%; font-family: var(--sub); font-size: .9rem; letter-spacing: .06em; padding: 10px 14px; border: 1px solid var(--line-strong); }
.offline-state { font-family: var(--sub); font-size: .86rem; letter-spacing: .08em; color: var(--text); }
.offline-err { flex-basis: 100%; font-size: .9rem; color: var(--text); border-left: 2px solid var(--text); padding-left: 10px; }
.offline-btn { height: 38px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 0; background: transparent; color: var(--text); font-family: var(--sub); font-size: .84rem; letter-spacing: .08em; cursor: pointer; transition: background .2s ease, border-color .2s ease; }
.offline-btn:hover:not(:disabled) { border-color: var(--text); background: rgba(242, 242, 240, .06); }
html[data-theme="light"] .offline-btn:hover:not(:disabled) { background: rgba(20, 20, 20, .05); }
.offline-btn.primary { border-color: var(--text); }
.offline-btn:disabled { opacity: .5; cursor: default; }
.offline-btn:focus-visible { outline: 1px solid var(--text); outline-offset: 2px; }
.toc-list li { display: block; }
.toc-offline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 0 8px 14px 74px; }
@media (max-width: 580px) { .toc-offline { padding-left: 8px; } }
span.toc-row.is-locked { cursor: default; }
span.toc-row.is-locked:hover { background: transparent; }
.offline-panel { margin: 18px 0 0; text-align: left; }
.offline-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.offline-panel .offline-total, .offline-panel .offline-err, .offline-panel .offline-fine { margin-top: 10px; }
.pager-link.is-off { opacity: .45; cursor: default; }
.pager-link.is-off:hover { transform: none; border-color: var(--line); }

/* ---------- How to install (install.html; install-guide.js) ----------
   Without script every guide shows, one after another. With script (.ig-ready) only the
   visitor's guide shows, under a chooser. Drawings are line art in currentColor. */
.ig { max-width: 760px; }
.ig-detected { margin: 0 0 18px; font-family: var(--copy); font-size: var(--fs-body); color: var(--text-2); }
.ig-detected[hidden], .ig-pick[hidden], .ig-guide[hidden], .ig-slot:empty { display: none; }
.ig-pick { display: grid; gap: 8px; margin: 0 0 28px; max-width: 460px; }
.ig-label { font-family: var(--sub); font-size: .86rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.ig-select { min-height: 54px; width: 100%; box-sizing: border-box; padding: 0 40px 0 14px; border: 1px solid var(--line-strong); border-radius: 0; -webkit-appearance: none; appearance: none; background-color: var(--bg); color: var(--text); font-family: var(--copy); font-size: 16px; }
select.ig-select { background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: right 20px center, right 14px center; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; }
.ig-select:focus, .ig-select:focus-visible { border-color: var(--text); background-color: var(--surface-2); outline: 1px solid var(--text); outline-offset: 2px; }
.ig-copy-field { margin-top: 12px; padding-right: 14px; }
.ig-guide { padding: 28px 0 8px; border-top: 1px solid var(--line); }
.ig-ready .ig-guide { border-top: 0; padding-top: 0; }
.ig-title { margin: 0 0 16px; font-family: var(--sub); font-weight: 400; font-size: var(--fs-h3, 1.4rem); line-height: 1.25; color: var(--text); }
.ig-steps { margin: 0; padding: 0 0 0 1.4em; }
.ig-step { margin: 0 0 22px; padding-left: 6px; font-family: var(--copy); font-size: var(--fs-body); line-height: 1.55; color: var(--text-2); }
.ig-step > p { margin: 0; }
.ig-step::marker { font-family: var(--sub); color: var(--muted); }
.ig-figure { margin: 12px 0 0; color: var(--text-2); }
.ig-art { display: block; width: 100%; max-width: 340px; height: auto; }
.ig-btn { margin-top: 12px; min-height: 54px; }
.ig-notes p { max-width: 760px; color: var(--muted); }
.ig-account-note { margin: 0; padding: 14px var(--gutter, 20px); border-bottom: 1px solid var(--line); font-family: var(--copy); font-size: var(--fs-small); color: var(--text-2); text-align: center; }

/* the latest game update line in the What's new card (whats-new.js gameUpdate; shown only with the Aeternum announcement) */
.wn-copy a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
