/* ==========================================================================
   Taking Off the Lens — 30-book interactive reader
   A letter written over an engineering document: literary serif against
   telemetry mono. Night ink, starlight vellum, and the butterscotch of a
   Martian noon (Letter I, chapter three).
   ========================================================================== */

/* ------------------------------------------------------------- fonts --- */
@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/fraunces-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/fraunces-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("../assets/fonts/literata-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("../assets/fonts/literata-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("../assets/fonts/ebgaramond-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("../assets/fonts/ebgaramond-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Atkinson";
  src: url("../assets/fonts/atkinson-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Atkinson";
  src: url("../assets/fonts/atkinson-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Atkinson";
  src: url("../assets/fonts/atkinson-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Playfair Display";
  src: url("../assets/fonts/playfair-display-latin.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Crimson Pro";
  src: url("../assets/fonts/crimson-pro-latin.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("../assets/fonts/lora-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("../assets/fonts/lora-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Cormorant";
  src: url("../assets/fonts/cormorant-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Cormorant";
  src: url("../assets/fonts/cormorant-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}

/* ------------------------------------------------------------ tokens --- */
:root {
  --night: #0B0E14;
  --night-2: #10141D;
  --night-3: #161B27;
  --starlight: #E9E4D6;
  --dim: #989DAB;
  --faint: #6A7080;
  --butterscotch: #D9A05B;
  --butterscotch-bright: #EDBC7C;
  --evening: #8FA8C8;
  --line: rgba(233, 228, 214, 0.13);
  --line-strong: rgba(233, 228, 214, 0.24);

  --display: "Fraunces", Georgia, serif;
  --serif: "Literata", Georgia, serif;
  --ui: "Atkinson", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;

  --reader-size: 1;
  --reader-leading: 1.75;
  --reader-tracking: 0em;

  /* reading page palette (overridden by reader themes) */
  --page-bg: var(--night);
  --page-ink: var(--starlight);
  --page-dim: var(--dim);
  --page-accent: var(--butterscotch);
  --page-line: var(--line);
}

html[data-reader-theme="paper"] {
  --page-bg: #F4EFE3;
  --page-ink: #26251F;
  --page-dim: #6E695C;
  --page-accent: #A8672A;
  --page-line: rgba(38, 37, 31, 0.14);
}
html[data-reader-theme="amber"] {
  --page-bg: #1A140C;
  --page-ink: #EBDCC3;
  --page-dim: #A8987E;
  --page-accent: #E0A45E;
  --page-line: rgba(235, 220, 195, 0.14);
}
html[data-reader-theme="dusk"] {
  --page-bg: #151A24;
  --page-ink: #DDE3EC;
  --page-dim: #93A0B4;
  --page-accent: #9DB8DC;
  --page-line: rgba(221, 227, 236, 0.14);
}

/* ------------------------------------------------------------- reset --- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--starlight);
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--evening); text-decoration: none; }
a:hover { color: var(--butterscotch-bright); }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
:focus-visible { outline: 2px solid var(--butterscotch); outline-offset: 2px; border-radius: 2px; }
::selection { background: rgba(217, 160, 91, 0.35); }

body[data-view="landing"] #reader { display: none; }
body[data-view="reader"] #landing,
body[data-view="reader"] .site-head { display: none; }
body[data-view="reader"] { background: var(--page-bg); color: var(--page-ink); }

/* --------------------------------------------------------- starfield --- */
/* Two drifting depth layers + the occasional meteor. All decorative,
   all switched off under prefers-reduced-motion. */
#stars {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 22%, rgba(233,228,214,.55) 48%, transparent 52%),
    radial-gradient(1px 1px at 31% 68%, rgba(233,228,214,.34) 48%, transparent 52%),
    radial-gradient(1.7px 1.7px at 47% 12%, rgba(237,188,124,.5) 48%, transparent 52%),
    radial-gradient(1px 1px at 58% 41%, rgba(233,228,214,.3) 48%, transparent 52%),
    radial-gradient(1.3px 1.3px at 72% 79%, rgba(143,168,200,.42) 48%, transparent 52%),
    radial-gradient(1px 1px at 83% 27%, rgba(233,228,214,.38) 48%, transparent 52%),
    radial-gradient(1.5px 1.5px at 91% 58%, rgba(233,228,214,.3) 48%, transparent 52%),
    radial-gradient(1px 1px at 22% 87%, rgba(233,228,214,.26) 48%, transparent 52%),
    radial-gradient(1.2px 1.2px at 66% 6%, rgba(233,228,214,.4) 48%, transparent 52%);
  background-size: 1100px 900px;
  animation: drift 240s linear infinite;
  opacity: 0.9;
}
#stars::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(0.8px 0.8px at 8% 44%, rgba(233,228,214,.22) 48%, transparent 52%),
    radial-gradient(0.9px 0.9px at 27% 15%, rgba(233,228,214,.18) 48%, transparent 52%),
    radial-gradient(0.8px 0.8px at 41% 91%, rgba(143,168,200,.2) 48%, transparent 52%),
    radial-gradient(0.7px 0.7px at 55% 62%, rgba(233,228,214,.16) 48%, transparent 52%),
    radial-gradient(0.9px 0.9px at 69% 33%, rgba(237,188,124,.18) 48%, transparent 52%),
    radial-gradient(0.7px 0.7px at 88% 82%, rgba(233,228,214,.18) 48%, transparent 52%),
    radial-gradient(0.8px 0.8px at 96% 9%, rgba(233,228,214,.15) 48%, transparent 52%);
  background-size: 760px 620px;
  animation: drift-far 420s linear infinite;
}
#stars::after {
  content: ""; position: absolute; top: 12%; left: -12%;
  width: 130px; height: 1.5px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(233, 228, 214, 0.85), transparent);
  transform: rotate(16deg);
  opacity: 0;
  animation: meteor 17s ease-in 6s infinite;
}
@keyframes drift {
  from { background-position: 0 0; }
  to { background-position: -1100px 300px; }
}
@keyframes drift-far {
  from { background-position: 0 0; }
  to { background-position: 760px -180px; }
}
@keyframes meteor {
  0%, 92% { opacity: 0; transform: rotate(16deg) translateX(0); }
  93% { opacity: 0.9; }
  98.5%, 100% { opacity: 0; transform: rotate(16deg) translateX(120vw); }
}
body[data-view="reader"] #stars { display: none; }
@media (prefers-reduced-motion: reduce) {
  #stars, #stars::before, #stars::after { animation: none; }
  #stars::after { display: none; }
  * { scroll-behavior: auto !important; }
}

/* ------------------------------------------------------ scroll reveal --- */
[data-reveal] {
  opacity: 0; transform: translateY(26px);
  transition: opacity 0.8s cubic-bezier(0.19, 1, 0.22, 1), transform 0.8s cubic-bezier(0.19, 1, 0.22, 1);
}
[data-reveal].revealed { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* ------------------------------------------------------------ chrome --- */
.site-head {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(20px, 5vw, 56px);
  background: color-mix(in srgb, var(--night) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-family: var(--display); font-style: italic; font-size: 22px;
  color: var(--starlight); letter-spacing: 0.01em;
}
.brand-sub {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.32em;
  color: var(--faint); text-transform: uppercase;
}
.site-nav { display: flex; align-items: center; gap: 18px; }
.nav-link { font-size: 15px; color: var(--dim); }
.nav-link:hover { color: var(--starlight); }
.continue-chip {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 3px;
  max-width: 260px; line-height: 1.3;
}
.continue-chip:hover { border-color: var(--butterscotch); }
.continue-kicker {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.28em;
  color: var(--butterscotch); text-transform: uppercase;
}
#continue-label {
  font-size: 13px; color: var(--dim); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 230px;
}

/* ----------------------------------------------------------- buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--ui); font-size: 15px; font-weight: 700;
  padding: 11px 22px; border-radius: 3px; border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn { white-space: nowrap; }
.btn:disabled {
  opacity: 0.5; cursor: default; pointer-events: none;
  background: transparent; color: var(--dim); border-color: var(--line-strong);
}
.btn-primary {
  background: var(--butterscotch); color: #171208; border-color: var(--butterscotch);
}
.btn-primary:hover { background: var(--butterscotch-bright); color: #171208; }
.btn-ghost {
  border-color: var(--line-strong); color: var(--starlight);
}
.btn-ghost:hover { border-color: var(--butterscotch); color: var(--butterscotch-bright); }
.btn-large { padding: 14px 28px; font-size: 16px; }
.btn-small { padding: 7px 14px; font-size: 13.5px; }
.btn.is-done { background: transparent; color: var(--dim); border-color: var(--line); pointer-events: auto; }
.linklike {
  color: var(--evening); font-size: inherit; padding: 0;
  text-decoration: underline; text-underline-offset: 3px;
}
.linklike:hover { color: var(--butterscotch-bright); }

/* ------------------------------------------------------------ landing --- */
.landing { position: relative; z-index: 1; }
.boot-error {
  margin: 14px clamp(20px, 5vw, 56px); padding: 12px 16px;
  border: 1px solid rgba(224, 122, 95, 0.5); color: #E8A093; border-radius: 3px;
}
.eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--butterscotch); margin: 0 0 18px;
}

/* hero */
.hero {
  position: relative;
  /* The orbit ornament is meant to bleed off the right edge, which means it
     extends past the viewport. Without this it drags a horizontal scrollbar
     across the whole landing page — clip the bleed here rather than reaching
     for body{overflow-x:hidden}, which would mask real overflow elsewhere. */
  overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(32px, 6vw, 88px); align-items: center;
  padding: clamp(56px, 11vh, 130px) clamp(20px, 6vw, 72px) clamp(48px, 8vh, 96px);
  max-width: 1240px; margin: 0 auto;
}

/* A faint orbital diagram behind the question — engineering meets heavens.
   One ring, one slow planet. Decorative only. */
.hero-orbit {
  position: absolute; z-index: -1; pointer-events: none;
  width: min(560px, 60vw); aspect-ratio: 1;
  right: clamp(-80px, -2vw, 20px); top: 50%;
  transform: translateY(-50%) rotate(-24deg);
  border: 1px solid rgba(233, 228, 214, 0.07);
  border-radius: 50%;
}
.hero-orbit::before {
  content: ""; position: absolute; inset: 18%;
  border: 1px dashed rgba(233, 228, 214, 0.05);
  border-radius: 50%;
}
.hero-orbit .orbit-track {
  position: absolute; inset: 0; animation: orbit 90s linear infinite;
}
.hero-orbit .planet {
  position: absolute; top: -4.5px; left: 50%; margin-left: -4.5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--butterscotch-bright), var(--butterscotch) 60%, #7A5426);
  box-shadow: 0 0 14px rgba(217, 160, 91, 0.55);
}
@keyframes orbit { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .hero-orbit .orbit-track { animation: none; } }
@media (max-width: 960px) { .hero-orbit { display: none; } }
.hero-title { margin: 0 0 26px; font-weight: 400; }
.hero-salutation {
  display: block;
  font-family: var(--display); font-style: italic;
  font-size: clamp(52px, 8.5vw, 104px);
  line-height: 1.02; letter-spacing: -0.015em;
  color: var(--starlight);
  animation: rise 0.9s cubic-bezier(0.19, 1, 0.22, 1) both;
}
.hero-question {
  display: block;
  font-family: var(--display); font-style: italic;
  font-size: clamp(28px, 4.2vw, 52px);
  line-height: 1.15; color: var(--butterscotch);
  margin-top: 10px;
  animation: rise 0.9s 0.15s cubic-bezier(0.19, 1, 0.22, 1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-salutation, .hero-question { animation: none; }
}
.hero-lede {
  font-family: var(--serif); font-size: clamp(17px, 1.5vw, 19px);
  line-height: 1.75; color: var(--dim); max-width: 34em; margin: 0 0 34px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* the transmission manifest */
.hero-manifest {
  border: 1px solid var(--line-strong); border-radius: 4px;
  padding: 26px 26px 20px; position: relative;
  background: linear-gradient(160deg, var(--night-2), var(--night));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.hero-manifest::before {
  content: ""; position: absolute; inset: 7px;
  border: 1px dashed var(--line); border-radius: 2px; pointer-events: none;
}
.manifest-head {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.3em;
  color: var(--butterscotch); margin: 0 0 18px; text-align: center;
}
.manifest-list { margin: 0; display: grid; gap: 10px; }
.manifest-list > div {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  border-bottom: 1px dotted var(--line); padding-bottom: 9px;
}
.manifest-list dt {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.22em; color: var(--faint);
}
.manifest-list dd {
  margin: 0; font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.06em;
  color: var(--starlight); text-align: right;
}
.manifest-open { color: var(--butterscotch); }
.manifest-foot {
  margin: 16px 0 0; font-family: var(--mono); font-size: 10px;
  color: var(--faint); text-align: center; letter-spacing: 0.04em; line-height: 1.7;
}

/* sections */
.section-head { max-width: 720px; margin: 0 auto 40px; text-align: center; padding: 0 20px; }
.section-head h2 {
  font-family: var(--display); font-style: italic; font-weight: 400;
  font-size: clamp(30px, 4vw, 42px); margin: 0 0 12px; color: var(--starlight);
}
.section-head p { color: var(--dim); margin: 0; font-size: 16.5px; line-height: 1.7; }

/* the letters manifest */
.letters { padding: clamp(48px, 8vh, 88px) clamp(16px, 5vw, 56px); max-width: 1080px; margin: 0 auto; }
.letters-list { border-top: 1px solid var(--line-strong); }
.letter-row { border-bottom: 1px solid var(--line); }
.letter-summary {
  display: grid;
  grid-template-columns: 58px 56px minmax(0, 1fr) 120px 100px 92px;
  align-items: center; gap: 16px;
  width: 100%; text-align: left; padding: 20px 10px;
  transition: background 0.15s ease;
}

/* The covers are the strongest thing the series owns — show them.
   Fixed 2:3 box so a slow or failed image never reflows the row. */
.letter-cover {
  width: 58px; aspect-ratio: 2 / 3; height: auto;
  object-fit: cover; border-radius: 2px;
  background: var(--night-3);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s cubic-bezier(0.19, 1, 0.22, 1), box-shadow 0.2s ease;
}
.letter-summary:hover .letter-cover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
}
.is-locked .letter-cover { opacity: 0.62; }
.letter-summary:hover .letter-cover { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .letter-cover, .letter-summary:hover .letter-cover { transition: none; transform: none; }
}
.letter-summary:hover { background: rgba(233, 228, 214, 0.035); }
.letter-numeral {
  font-family: var(--display); font-style: italic; font-size: 34px;
  color: var(--faint); text-align: center; line-height: 1;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}
.letter-summary:hover .letter-numeral {
  color: var(--butterscotch-bright);
  text-shadow: 0 0 22px rgba(217, 160, 91, 0.45);
}
.is-free .letter-numeral, .is-owned .letter-numeral { color: var(--butterscotch); }
.letter-heading { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.letter-title {
  font-family: var(--serif); font-size: 20px; color: var(--starlight); line-height: 1.3;
}
.letter-tagline { font-size: 13.5px; color: var(--faint); }
.letter-theme {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--evening);
}
.letter-length {
  font-family: var(--mono); font-size: 11.5px; color: var(--faint); text-align: right;
  white-space: nowrap;
}
.letter-status {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  text-align: center; padding: 6px 0; border-radius: 3px; border: 1px solid var(--line-strong);
}
.letter-status-free { color: #171208; background: var(--butterscotch); border-color: var(--butterscotch); font-weight: 700; }
.letter-status-owned { color: var(--butterscotch); border-color: var(--butterscotch); }
.letter-status-locked { color: var(--dim); }
.letter-detail { padding: 6px 10px 30px 100px; }
.letter-blurb {
  font-family: var(--serif); font-size: 16.5px; line-height: 1.75;
  color: var(--dim); max-width: 44em; margin: 0 0 18px;
}
.letter-contents { display: flex; gap: 16px; margin: 0 0 22px; }
.letter-contents-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.26em;
  color: var(--faint); text-transform: uppercase; padding-top: 3px;
}
.letter-contents ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 40px; max-width: 560px; }
.letter-contents li { font-size: 14px; color: var(--dim); padding: 2px 0; break-inside: avoid; }
.letter-contents li.more { color: var(--faint); font-style: italic; }
.letter-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.letter-note { width: 100%; margin: 6px 0 0; font-size: 13.5px; color: var(--faint); max-width: 46em; }

/* bundle band */
.bundle { padding: clamp(40px, 7vh, 72px) clamp(16px, 5vw, 56px); }
.bundle-card {
  max-width: 1080px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center; gap: 40px;
  border: 1px solid var(--line-strong); border-radius: 4px;
  padding: clamp(28px, 4vw, 48px);
  background:
    radial-gradient(600px 300px at 85% 20%, rgba(217, 160, 91, 0.09), transparent 60%),
    linear-gradient(160deg, var(--night-2), var(--night));
}
.bundle-cover {
  width: 150px; aspect-ratio: 2 / 3; height: auto;
  object-fit: cover; border-radius: 3px; flex-shrink: 0;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
}
.bundle-copy h2 {
  font-family: var(--display); font-style: italic; font-weight: 400;
  font-size: clamp(26px, 3.4vw, 38px); margin: 0 0 10px;
}
.bundle-count { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; color: var(--evening); margin: 0 0 6px; text-transform: uppercase; }
.bundle-note { color: var(--dim); margin: 0; }
.bundle-action { display: flex; flex-direction: column; align-items: center; gap: 12px; flex-shrink: 0; }
.bundle-price {
  font-family: var(--display); font-size: 44px; margin: 0; color: var(--butterscotch);
}

/* pull quote */
.pullquote { padding: clamp(48px, 10vh, 110px) 20px; }
.pullquote blockquote { max-width: 780px; margin: 0 auto; text-align: center; }
.pullquote p {
  font-family: var(--display); font-style: italic; font-weight: 400;
  font-size: clamp(26px, 4vw, 44px); line-height: 1.3; color: var(--starlight); margin: 0 0 22px;
}
.pullquote cite {
  font-family: var(--mono); font-style: normal; font-size: 11px;
  letter-spacing: 0.3em; color: var(--butterscotch);
}

/* how it works */
.how { padding: 0 clamp(16px, 5vw, 56px) clamp(64px, 10vh, 110px); max-width: 1080px; margin: 0 auto; }
.how-steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px;
}
.how-steps li { border-top: 1px solid var(--line-strong); padding-top: 20px; }
.how-step { font-family: var(--mono); font-size: 12px; letter-spacing: 0.2em; color: var(--butterscotch); }
.how-steps h3 { font-family: var(--serif); font-weight: 400; font-size: 20px; margin: 10px 0 8px; }
.how-steps p { color: var(--dim); font-size: 15px; margin: 0; line-height: 1.7; }

/* footer */
.site-foot {
  border-top: 1px solid var(--line);
  padding: 40px clamp(20px, 5vw, 56px) 56px;
  display: grid; gap: 18px; max-width: 1080px; margin: 0 auto;
}
.foot-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.foot-logo { height: 52px; width: auto; opacity: 0.9; }
.foot-brand-text { display: flex; flex-direction: column; }
.foot-disclaimer { color: var(--faint); font-size: 13.5px; line-height: 1.7; max-width: 62em; margin: 0; }
.foot-meta { color: var(--faint); font-size: 13px; margin: 0; }
.foot-meta a { color: var(--evening); }

/* ------------------------------------------------------------- reader --- */
.reader { position: relative; z-index: 1; min-height: 100vh; }

.reader-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; gap: 6px;
  padding: 8px clamp(8px, 2vw, 20px);
  background: color-mix(in srgb, var(--page-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--page-line);
  transition: transform 0.25s ease;
}
.reader-topbar.hidden-bar { transform: translateY(-110%); }
.reader-spacer { flex: 1; }
.bar-btn {
  font-family: var(--ui); font-size: 13.5px; color: var(--page-dim);
  padding: 7px 10px; border-radius: 3px; white-space: nowrap;
}
.bar-btn:hover:not(:disabled) { color: var(--page-ink); background: color-mix(in srgb, var(--page-ink) 8%, transparent); }
.bar-btn:disabled { opacity: 0.35; cursor: default; }
.bar-btn[aria-pressed="true"] { color: var(--page-accent); }
.bar-exit { color: var(--page-dim); }
.reader-position { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.12em; color: var(--page-dim); }
.bar-select select {
  background: transparent; color: var(--page-dim); border: 1px solid var(--page-line);
  border-radius: 3px; font-size: 12px; padding: 4px 6px; max-width: 170px;
}
.reader-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 31;
  background: transparent; pointer-events: none;
}
#reader-progress-fill {
  height: 100%; width: 0; background: var(--page-accent);
  transition: width 0.15s linear;
}

/* the page */
.page {
  --measure: 66ch;
  max-width: min(var(--measure), 92vw);
  margin: 0 auto;
  padding: clamp(84px, 12vh, 132px) 0 96px;
}
html[data-reader-measure="narrow"] .page { --measure: 58ch; }
html[data-reader-measure="wide"] .page { --measure: 76ch; }

.unit-head { text-align: center; margin-bottom: clamp(36px, 6vh, 60px); }
.unit-kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.34em;
  color: var(--page-accent); margin: 0 0 20px;
}
.unit-title {
  font-family: var(--display); font-style: italic; font-weight: 400;
  font-size: clamp(30px, 5vw, 46px); line-height: 1.15;
  color: var(--page-ink); margin: 0 0 14px;
}
.unit-meta { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; color: var(--page-dim); margin: 0; }
.unit-head::after {
  content: ""; display: block; width: 56px; height: 2px;
  background: var(--page-accent); margin: 30px auto 0; opacity: 0.8;
}

/* chapter text */
.unit-content {
  font-family: var(--serif);
  font-size: calc(18.5px * var(--reader-size));
  line-height: var(--reader-leading);
  letter-spacing: var(--reader-tracking);
  color: var(--page-ink);
}
html[data-reader-font="garamond"] .unit-content { font-family: "EB Garamond", Georgia, serif; font-size: calc(20px * var(--reader-size)); }
html[data-reader-font="crimson"] .unit-content { font-family: "Crimson Pro", Georgia, serif; font-size: calc(19.5px * var(--reader-size)); }
html[data-reader-font="lora"] .unit-content { font-family: "Lora", Georgia, serif; font-size: calc(18px * var(--reader-size)); }
html[data-reader-font="atkinson"] .unit-content { font-family: var(--ui); font-size: calc(17.5px * var(--reader-size)); }

/* heading typeface (chapter titles + in-text headings) */
html[data-reader-heading="playfair"] .unit-title,
html[data-reader-heading="playfair"] .unit-content :is(h1, h2, h3, h4) { font-family: "Playfair Display", Georgia, serif; }
html[data-reader-heading="cormorant"] .unit-title,
html[data-reader-heading="cormorant"] .unit-content :is(h1, h2, h3, h4) { font-family: "Cormorant", Georgia, serif; }
html[data-reader-heading="garamond"] .unit-title,
html[data-reader-heading="garamond"] .unit-content :is(h1, h2, h3, h4) { font-family: "EB Garamond", Georgia, serif; }
html[data-reader-heading="atkinson"] .unit-title,
html[data-reader-heading="atkinson"] .unit-content :is(h1, h2, h3, h4) { font-family: var(--ui); font-style: normal; }

.unit-content p {
  margin: 0 0 calc(0.95em * var(--reader-size));
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
  hyphenate-limit-chars: 7 4 3;
}
.unit-content h1, .unit-content h2, .unit-content h3, .unit-content h4 {
  font-family: var(--display); font-style: italic; font-weight: 400;
  line-height: 1.25; margin: 1.6em 0 0.7em; color: var(--page-ink);
}
.unit-content h1 { font-size: 1.65em; }
.unit-content h2 { font-size: 1.4em; }
.unit-content h3 { font-size: 1.18em; }
.unit-content blockquote {
  margin: 1.4em 0; padding: 0.2em 0 0.2em 1.4em;
  border-left: 2px solid var(--page-accent);
  color: var(--page-dim); font-style: italic;
}
.unit-content ul, .unit-content ol { padding-left: 1.6em; margin: 0 0 1em; }
.unit-content li { margin-bottom: 0.4em; }
.unit-content em { font-style: italic; }
.unit-content strong { font-weight: 700; }

/* text alignment (justify is the default; "left" is ragged-right) */
html[data-reader-align="left"] .unit-content p {
  text-align: left;
  -webkit-hyphens: manual;
  hyphens: manual;
}

/* page texture overlays */
body[data-view="reader"][data-texture="grain"] {
  background-image:
    radial-gradient(circle at 17% 29%, color-mix(in srgb, var(--page-ink) 2.5%, transparent) 0.6px, transparent 1.4px),
    radial-gradient(circle at 73% 61%, color-mix(in srgb, var(--page-ink) 2%, transparent) 0.6px, transparent 1.4px),
    radial-gradient(circle at 44% 83%, color-mix(in srgb, var(--page-ink) 1.6%, transparent) 0.6px, transparent 1.4px);
  background-size: 11px 13px, 17px 15px, 13px 19px;
}
body[data-view="reader"][data-texture="linen"] {
  background-image:
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--page-ink) 2%, transparent) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--page-ink) 1.4%, transparent) 0 1px, transparent 1px 3px);
}

/* scene break ornament */
hr.scene-break {
  border: none; margin: 2.2em auto; text-align: center; height: auto;
}
hr.scene-break::after {
  content: "✦ ✦ ✦";
  font-size: 0.75em; letter-spacing: 1.2em; padding-left: 1.2em;
  color: var(--page-accent); opacity: 0.75;
}
html[data-reader-divider="jewel"] hr.scene-break::after {
  content: "◆"; letter-spacing: 0; padding-left: 0; font-size: 0.7em;
}
html[data-reader-divider="fleuron"] hr.scene-break::after {
  content: "❧"; letter-spacing: 0; padding-left: 0; font-size: 1.05em;
}
html[data-reader-divider="line"] hr.scene-break {
  border-top: 1px solid var(--page-line); width: 110px;
}
html[data-reader-divider="line"] hr.scene-break::after { content: none; }

/* No drop cap. It is narrative typography — it announces a story, and it
   competes with the chapter title for the eye. These are letters that argue;
   the head (kicker, italic title, rule) already opens the chapter, and the
   first sentence should be the first thing read. */

/* chapter entrance: head and text rise softly on every chapter change */
.unit-head, .unit-content { animation: none; }
.page.unit-enter .unit-head { animation: rise 0.7s cubic-bezier(0.19, 1, 0.22, 1) both; }
.page.unit-enter .unit-content { animation: rise 0.7s 0.08s cubic-bezier(0.19, 1, 0.22, 1) both; }
@media (prefers-reduced-motion: reduce) {
  .page.unit-enter .unit-head, .page.unit-enter .unit-content { animation: none; }
}

/* closing-line signature: final italic paragraph of a chapter */
.unit-content.is-chapter > p:last-of-type em:only-child {
  display: block; text-align: center; margin-top: 2em;
  color: var(--page-accent); font-size: 1.05em;
}

/* TTS highlight */
.tts-active {
  background: color-mix(in srgb, var(--page-accent) 26%, transparent);
  border-radius: 2px;
}

/* end panel */
.end-panel {
  margin: 64px 0 0; padding: 40px clamp(20px, 4vw, 44px);
  border: 1px solid var(--page-line); border-radius: 4px; text-align: center;
  background: color-mix(in srgb, var(--page-ink) 4%, transparent);
}
.end-kicker { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.32em; color: var(--page-accent); margin: 0 0 14px; }
.end-title {
  font-family: var(--display); font-style: italic; font-weight: 400;
  font-size: clamp(24px, 3.4vw, 32px); margin: 0 0 12px; color: var(--page-ink);
}
.end-note { color: var(--page-dim); max-width: 46em; margin: 0 auto 24px; line-height: 1.7; }
.end-actions { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.end-fineprint { font-size: 13px; color: var(--page-dim); margin: 0; }
body[data-view="reader"] .btn-primary { background: var(--page-accent); border-color: var(--page-accent); }
body[data-view="reader"] .btn-ghost { border-color: var(--page-line); color: var(--page-ink); }

/* bottom nav */
.page-nav { display: flex; gap: 14px; margin-top: 56px; }
.page-nav-btn {
  flex: 1; display: flex; flex-direction: column; gap: 5px;
  border: 1px solid var(--page-line); border-radius: 4px;
  padding: 16px 18px; text-align: left; min-width: 0;
  transition: border-color 0.15s ease;
}
.page-nav-btn:hover { border-color: var(--page-accent); }
.page-nav-btn.next { text-align: right; align-items: flex-end; }
.page-nav-dir { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.22em; color: var(--page-accent); }
.page-nav-title {
  font-family: var(--serif); font-size: 15.5px; color: var(--page-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.page-foot { margin-top: 48px; text-align: center; }
.watermark { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; color: var(--page-dim); opacity: 0.65; }

/* contents drawer */
.toc-drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
  width: min(360px, 88vw);
  background: var(--page-bg);
  border-right: 1px solid var(--page-line);
  transform: translateX(-102%);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex; flex-direction: column;
  box-shadow: 30px 0 80px rgba(0, 0, 0, 0.35);
}
.toc-drawer.open { transform: none; }
.toc-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 18px 18px 14px; border-bottom: 1px solid var(--page-line);
}
.toc-volume { font-family: var(--display); font-style: italic; font-size: 17px; color: var(--page-ink); }
.toc-list { list-style: none; margin: 0; padding: 10px 0; overflow-y: auto; flex: 1; }
.toc-list li button {
  display: flex; justify-content: space-between; gap: 12px; width: 100%;
  text-align: left; padding: 11px 20px; color: var(--page-dim);
  font-family: var(--serif); font-size: 15px;
}
.toc-list li button:hover { color: var(--page-ink); background: color-mix(in srgb, var(--page-ink) 6%, transparent); }
.toc-list li.active button { color: var(--page-accent); }
.toc-list li.active button::before { content: "▸ "; }
.toc-min { font-family: var(--mono); font-size: 10.5px; color: var(--page-dim); flex-shrink: 0; padding-top: 3px; }
.toc-all {
  padding: 16px 20px; border-top: 1px solid var(--page-line);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em;
  color: var(--page-accent); text-transform: uppercase;
}
.toc-scrim { position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, 0.45); }

/* settings popover */
.settings-pop {
  position: fixed; top: 52px; right: clamp(8px, 2vw, 20px); z-index: 55;
  width: 336px; max-height: calc(100vh - 70px); overflow-y: auto;
  padding: 18px;
  background: var(--page-bg); border: 1px solid var(--page-line); border-radius: 5px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  display: grid; gap: 15px;
}
.set-row.wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.set-value {
  min-width: 52px; text-align: center; align-self: center;
  font-family: var(--mono); font-size: 12px; color: var(--page-ink);
}
.set-note {
  margin: -6px 0 0; font-size: 11.5px; color: var(--page-dim); line-height: 1.5;
}
.set-label {
  display: block; font-family: var(--mono); font-size: 9.5px;
  letter-spacing: 0.26em; text-transform: uppercase; color: var(--page-dim); margin-bottom: 8px;
}
.set-row { display: flex; gap: 6px; }
.set-row button {
  flex: 1; padding: 8px 6px; font-size: 13px; color: var(--page-dim);
  border: 1px solid var(--page-line); border-radius: 3px;
}
.set-row button:hover { color: var(--page-ink); border-color: var(--page-accent); }
.set-row button[aria-pressed="true"] {
  color: var(--page-bg); background: var(--page-accent); border-color: var(--page-accent); font-weight: 700;
}

/* loading */
.reader-loading {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  background: color-mix(in srgb, var(--page-bg) 92%, transparent);
  backdrop-filter: blur(6px);
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.2em; color: var(--page-dim);
}
.loading-mark {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--page-line); border-top-color: var(--page-accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading-mark { animation-duration: 2s; } }

/* ------------------------------------------------------------ dialogs --- */
.key-dialog {
  border: 1px solid var(--line-strong); border-radius: 5px; padding: 0;
  background: var(--night-2); color: var(--starlight);
  width: min(560px, 94vw);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
}
.key-dialog::backdrop { background: rgba(4, 6, 10, 0.7); backdrop-filter: blur(4px); }
.key-inner { padding: 32px; }
.key-dialog h2 {
  font-family: var(--display); font-style: italic; font-weight: 400;
  font-size: 28px; margin: 0 0 10px;
}
.key-hint { color: var(--dim); font-size: 14.5px; margin: 0 0 16px; }
.key-hint code { font-family: var(--mono); color: var(--butterscotch); }
#key-input {
  width: 100%; min-height: 96px; resize: vertical;
  background: var(--night); color: var(--starlight);
  border: 1px solid var(--line-strong); border-radius: 3px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; padding: 12px;
}
#key-input:focus { outline: none; border-color: var(--butterscotch); }
.key-status { min-height: 22px; font-size: 14px; color: var(--butterscotch-bright); margin: 10px 0 6px; }
.key-actions { display: flex; gap: 12px; }
.key-licenses { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 18px; }
.key-licenses h3 {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--faint); margin: 0 0 12px; font-weight: 400;
}
.license-row {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px dotted var(--line); font-size: 13.5px;
}
.license-owner { color: var(--starlight); }
.license-scope { color: var(--butterscotch); }
.license-id { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.key-licenses .btn { margin-top: 14px; }

/* quote button + toasts */
.quote-button {
  position: fixed; z-index: 70;
  background: var(--night-3); color: var(--butterscotch-bright);
  border: 1px solid var(--butterscotch); border-radius: 3px;
  font-size: 13px; padding: 8px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.quote-button.hidden { display: none; }
.toast-region {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: max-content; max-width: 92vw;
}
.toast {
  background: var(--night-3); color: var(--starlight);
  border: 1px solid var(--line-strong); border-left: 3px solid var(--butterscotch);
  border-radius: 3px; padding: 11px 18px; font-size: 14.5px;
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 92vw;
}
.toast.show { opacity: 1; transform: none; }

/* Crawlable catalog and dedicated book landing pages. These styles are also
   useful before JavaScript enhances the home page, so discovery never depends
   on a hash route or client-side rendering. */
.static-book-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px; background: var(--line-strong);
}
.static-book-card {
  min-width: 0; padding: 28px; background: var(--night-2);
}
.static-book-card h3 { margin: 8px 0 10px; font: 400 22px/1.18 var(--display); }
.static-book-card h3 a { color: var(--starlight); text-decoration: none; }
.static-book-card h3 a:hover { color: var(--butterscotch-bright); }
.static-book-card > p:last-child { color: var(--dim); font-size: 14px; line-height: 1.65; }
.static-book-number, .static-book-author {
  margin: 0; font: 400 10px/1.5 var(--mono); letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--butterscotch);
}
.static-book-author { color: var(--faint); }

.book-detail-page { min-height: 100vh; background: var(--night); color: var(--starlight); }
.book-detail-shell { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 90px; }
.book-detail-back { display: inline-block; margin-bottom: 30px; color: var(--butterscotch); text-decoration: none; }
.book-detail-card {
  display: grid; grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
  gap: clamp(34px, 6vw, 76px); align-items: center;
}
.book-detail-card > img { display: block; width: 100%; height: auto; border-radius: 3px; box-shadow: 0 30px 80px rgba(0,0,0,.46); }
.book-detail-card h1 { margin: 10px 0 14px; font: italic 400 clamp(38px, 6vw, 72px)/.98 var(--display); }
.book-detail-author { color: var(--butterscotch); font: 11px/1.5 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.book-detail-lede { max-width: 650px; color: var(--dim); font: 20px/1.6 var(--body); }
.book-detail-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.book-detail-contents, .book-detail-format { max-width: 820px; margin: 76px auto 0; }
.book-detail-contents h2, .book-detail-format h2 { font: italic 400 34px/1.1 var(--display); }
.book-detail-contents ol { columns: 2; gap: 46px; padding-left: 22px; color: var(--dim); }
.book-detail-contents li { break-inside: avoid; margin: 0 0 12px; padding-left: 7px; }
.book-detail-format p { color: var(--dim); font-size: 18px; line-height: 1.7; }

/* --------------------------------------------------------------- print --- */
@media print {
  body[data-view="reader"] .unit-content,
  body[data-view="reader"] .toc-drawer,
  body[data-view="reader"] .reader-topbar { display: none !important; }
  body[data-view="reader"] .page::after {
    content: "This is a licensed digital copy — printing is disabled. Read at lens.velunapress.com";
    display: block; text-align: center; padding: 40px 0; font-family: Georgia, serif;
  }
}

/* --------------------------------------------------------- responsive --- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; padding-top: 48px; }
  .hero-manifest { max-width: 460px; }
  .letter-summary { grid-template-columns: 52px 44px minmax(0, 1fr) 92px; }
  .letter-cover { width: 52px; }
  .letter-theme, .letter-length { display: none; }
  .letter-detail { padding-left: 10px; }
  .bundle-card { flex-direction: column; align-items: flex-start; }
  .bundle-action { align-items: flex-start; }
  .bundle-cover { width: 120px; align-self: center; }
  .how-steps { grid-template-columns: 1fr; gap: 22px; }
  .static-book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .site-head { padding: 10px 14px; flex-wrap: wrap; }
  .site-nav { gap: 10px; }
  .nav-link { display: none; }
  #continue-label { max-width: 130px; }
  .hero-actions .btn { width: 100%; }
  /* Phones: the cover carries the identity, so the numeral column goes. */
  .letter-summary { grid-template-columns: 46px minmax(0, 1fr) 84px; gap: 12px; padding: 16px 6px; }
  .letter-cover { width: 46px; }
  .letter-numeral { display: none; }
  .letter-title { font-size: 17px; }
  .letter-contents ul { columns: 1; }
  .bar-btn-label { display: none; }
  .page-nav { flex-direction: column; }
  .page-nav-btn.next { text-align: left; align-items: flex-start; }
  .key-inner { padding: 22px; }
  .settings-pop { right: 8px; left: 8px; width: auto; }
  .static-book-grid { grid-template-columns: 1fr; }
  .static-book-card { padding: 24px 18px; }
  .book-detail-shell { padding-top: 24px; }
  .book-detail-card { grid-template-columns: 1fr; }
  .book-detail-card > img { width: min(78vw, 320px); margin: 0 auto; }
  .book-detail-contents ol { columns: 1; }
}
