/* ==========================================================
   BookWorm · Paper & Lamplight, on the web
   Four looks, like the app: Light, Dark, Retro, Marginalia.
   Every colour and the display face come from the tokens below.
   ========================================================== */
:root, [data-theme="light"] {
  --paper:   #FAF6EF;
  --paper-2: #F2ECE1;
  --paper-3: #E9E0D1;
  --ink:     #2C1810;
  --ink-2:   #5E4536;
  --ink-3:   #7D6556;
  --rule:    rgba(44, 24, 16, .12);
  --accent:  #2F7A4C;              /* AA-safe action green; brand #4CAF72 is too light for text */
  --glow:    rgba(76, 175, 114, .18);
  --ember:   #BF360C;
  --gold:    #C9A84C;
  --btn-bg:  #2F7A4C;
  --btn-fg:  #FFFFFF;
  --nav-bg:  rgba(250, 246, 239, .72);
  --nav-line: rgba(44, 24, 16, .10);
  --nav-shadow: 0 10px 30px -12px rgba(90, 55, 30, .28);
  --menu-bg: #FFFDF8;
  --shadow:  0 24px 60px -24px rgba(90, 55, 30, .35);
  --display: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --display-weight: 700;
  --display-track: -.02em;
  /* widgets follow light/dark only, never Retro or Marginalia, exactly like the app */
  --w-paper: #FBF8F2; --w-ink: #2C1810; --w-ink-2: #7D6556; --w-ember: #BF360C; --w-gold: #C9A84C; --w-track: #EADFCF;
  color-scheme: light;
}
[data-theme="dark"] {
  --paper:   #0C0C0C;
  --paper-2: #1C1C1E;
  --paper-3: #2C2C2E;
  --ink:     #F5F1EA;
  --ink-2:   #CFC6BB;
  --ink-3:   #A39A90;
  --rule:    rgba(255, 255, 255, .12);
  --accent:  #6CC892;
  --glow:    rgba(76, 175, 114, .14);
  --ember:   #E8A06A;
  --gold:    #D4A84C;
  --btn-bg:  #4CAF72;
  --btn-fg:  #0B1F13;
  --nav-bg:  rgba(28, 28, 30, .72);
  --nav-line: rgba(255, 255, 255, .10);
  --nav-shadow: 0 10px 30px -12px rgba(0, 0, 0, .8);
  --menu-bg: #2C2C2E;
  --shadow:  0 24px 60px -24px rgba(0, 0, 0, .8);
  --w-paper: #2C2C2E; --w-ink: #F5F1EA; --w-ink-2: #A39A90; --w-ember: #E8A06A; --w-gold: #D4A84C; --w-track: #3A3A3C;
  color-scheme: dark;
}
[data-theme="retro"] {
  --paper:   #F3EBD9;
  --paper-2: #EADFC8;
  --paper-3: #DDCFB2;
  --ink:     #2B1D14;
  --ink-2:   #5A4334;
  --ink-3:   #6B5242;
  --rule:    rgba(43, 29, 20, .18);
  --accent:  #1F5E4A;
  --glow:    rgba(227, 169, 43, .22);
  --ember:   #B4400F;
  --gold:    #B8860B;
  --btn-bg:  #E3A92B;
  --btn-fg:  #2B1D14;
  --nav-bg:  rgba(243, 235, 217, .86);
  --nav-line: #2B1D14;
  --nav-shadow: 4px 4px 0 #2B1D14;
  --menu-bg: #F8F1E2;
  --shadow:  8px 8px 0 rgba(43, 29, 20, .9);
  --display: ui-monospace, "SF Mono", Menlo, "Courier New", monospace;
  --display-weight: 700;
  --display-track: -.045em;
  color-scheme: light;
}
[data-theme="marginalia"] {
  --paper:   #F7EEDD;
  --paper-2: #EFE3CC;
  --paper-3: #E4D5B8;
  --ink:     #23392B;
  --ink-2:   #3F5547;
  --ink-3:   #536657;
  --rule:    rgba(35, 57, 43, .16);
  --accent:  #2F6B4A;
  --glow:    rgba(163, 64, 42, .10);
  --ember:   #A3402A;
  --gold:    #A97C1F;
  --btn-bg:  #23392B;
  --btn-fg:  #F7EEDD;
  --nav-bg:  rgba(247, 238, 221, .86);
  --nav-line: rgba(35, 57, 43, .45);
  --nav-shadow: 0 8px 22px -14px rgba(35, 57, 43, .5);
  --menu-bg: #FBF4E6;
  --shadow:  0 20px 44px -26px rgba(35, 57, 43, .55);
  --display: "Marker Felt", "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive;
  --display-weight: 400;
  --display-track: 0;
  color-scheme: light;
}
:root {
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans", "Apple SD Gothic Neo", "Noto Sans", sans-serif;
  --gutter: 16px;
  --wrap: 1120px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}
@media (min-width: 720px) { :root { --gutter: 32px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 96px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background-color .45s var(--ease-out), color .45s var(--ease-out);
}
/* Retro: the sunset stripes across the top. Marginalia: ruled paper and a red margin. */
[data-theme="retro"] body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: 8px; z-index: 60;
  background: linear-gradient(#2E6B54 0 25%, #E3A92B 25% 50%, #D9662A 50% 75%, #9A3A1E 75% 100%);
}
[data-theme="marginalia"] body {
  background-image: repeating-linear-gradient(transparent 0 37px, rgba(120, 140, 150, .2) 37px 38px);
}
[data-theme="marginalia"] body::before {
  content: ""; position: fixed; top: 0; bottom: 0; left: max(6px, calc(var(--gutter) - 12px)); width: 2px; z-index: 0;
  background: rgba(196, 92, 70, .42); pointer-events: none;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; position: relative; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -80px; z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---------- type ---------- */
.eyebrow { font: 600 .78rem/1.3 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin: 0 0 16px; }
:lang(zh) .eyebrow, :lang(ja) .eyebrow, :lang(ko) .eyebrow, :lang(hi) .eyebrow { letter-spacing: .06em; }
h1, h2, h3 { font-family: var(--display); font-weight: var(--display-weight); letter-spacing: var(--display-track); margin: 0; text-wrap: balance; }
h1 { font-size: clamp(3rem, 11vw, 6.4rem); line-height: .98; }
h2 { font-size: clamp(2.1rem, 6.2vw, 3.6rem); line-height: 1.06; }
h3 { font-size: 1.35rem; line-height: 1.2; }
:lang(zh) h1, :lang(ja) h1, :lang(ko) h1, :lang(hi) h1 { line-height: 1.15; letter-spacing: 0; }
/* CJK lines break between any two characters; size the hero so each line stays whole on a phone */
:lang(zh) h1, :lang(ja) h1, :lang(ko) h1 { font-size: clamp(2.4rem, 10vw, 5.6rem); word-break: keep-all; word-break: auto-phrase; }
:lang(zh) h2, :lang(ja) h2, :lang(ko) h2, :lang(hi) h2 { line-height: 1.25; letter-spacing: 0; }
.lede { font-size: clamp(1.1rem, 2.4vw, 1.3rem); line-height: 1.55; color: var(--ink-2); max-width: 34ch; text-wrap: pretty; }
p { text-wrap: pretty; }

/* ---------- the nav: one floating sheet of paper ---------- */
.nav { position: fixed; z-index: 50; top: max(10px, env(safe-area-inset-top)); left: 0; right: 0; padding-inline: 10px; pointer-events: none; }
[data-theme="retro"] .nav { top: max(18px, env(safe-area-inset-top)); }
.nav-pill {
  pointer-events: auto;
  margin-inline: auto; max-width: 1080px;
  display: flex; align-items: center; gap: 6px;
  min-height: 60px; padding: 8px 8px 8px 14px;
  border-radius: 22px;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(1.5) blur(18px);
  backdrop-filter: saturate(1.5) blur(18px);
  border: 1px solid var(--nav-line);
  box-shadow: var(--nav-shadow);
  transition: max-width .5s var(--ease-out), min-height .35s var(--ease-out), background-color .45s, box-shadow .45s, border-color .45s;
}
[data-theme="retro"] .nav-pill { border-width: 2px; border-radius: 14px; -webkit-backdrop-filter: none; backdrop-filter: none; }
[data-theme="marginalia"] .nav-pill { border-width: 1.5px; border-radius: 18px 22px 16px 24px; }
.nav.compact .nav-pill { max-width: 760px; min-height: 54px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: var(--display-weight) 1.15rem/1 var(--display); letter-spacing: var(--display-track); margin-right: auto; min-height: 44px; padding-right: 6px; }
.brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 2px 8px rgba(0,0,0,.14); }
.nav-links { display: none; gap: 2px; }
.nav-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 12px; text-decoration: none; font: 500 .95rem/1 var(--sans); color: var(--ink-2); transition: background-color .2s, color .2s; }
.nav-links a:hover { background: var(--rule); color: var(--ink); }
.nav-links a[aria-current="true"] { color: var(--ink); background: var(--rule); }
@media (min-width: 1000px) { .nav-links { display: flex; } .brand { margin-right: 0; } .nav-links { margin-right: auto; margin-left: 10px; } }
.nav-tool {
  appearance: none; border: 0; background: transparent; color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 44px; min-height: 44px; padding: 0 10px; border-radius: 12px;
  font: 600 .9rem/1 var(--sans);
  transition: background-color .2s, transform .16s var(--ease-out);
}
.nav-tool:hover, .nav-tool[aria-expanded="true"] { background: var(--rule); }
.nav-tool:active { transform: scale(.96); }
.nav-tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-tool .code { text-transform: uppercase; font-size: .78rem; letter-spacing: .04em; }
.swatch { width: 20px; height: 20px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.18); }
.sw-light { background: linear-gradient(135deg, #FAF6EF 50%, #4CAF72 50%); }
.sw-dark { background: linear-gradient(135deg, #1C1C1E 50%, #4CAF72 50%); }
.sw-retro { background: linear-gradient(#2E6B54 0 25%, #E3A92B 25% 50%, #D9662A 50% 75%, #9A3A1E 75%); }
.sw-marginalia { background: repeating-linear-gradient(#F7EEDD 0 4px, #C9D3D6 4px 5px); box-shadow: inset 0 0 0 1.5px #A3402A; }
.get {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; margin-left: 2px;
  border-radius: 14px; background: var(--btn-bg); color: var(--btn-fg);
  font: 600 .95rem/1 var(--sans); text-decoration: none; white-space: nowrap;
  transition: transform .16s var(--ease-out), filter .2s, background-color .45s;
}
[data-theme="retro"] .get { border: 2px solid var(--ink); border-radius: 10px; }
.get:hover { filter: brightness(1.06); }
.get:active { transform: scale(.97); }
@media (max-width: 420px) { .brand span { display: none; } .get { padding: 0 14px; } }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 60;
  min-width: 220px; padding: 6px; border-radius: 16px;
  background: var(--menu-bg); border: 1px solid var(--nav-line); box-shadow: 0 18px 48px -16px rgba(0,0,0,.35);
  opacity: 0; transform: translateY(-6px) scale(.97); transform-origin: top right; visibility: hidden;
  transition: opacity .18s var(--ease-out), transform .18s var(--ease-out), visibility 0s .18s;
  max-height: min(70vh, 460px); overflow: auto;
}
[data-theme="retro"] .menu { border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); border-radius: 12px; }
/* On a phone the buttons sit mid-bar, so a menu hung from its own button runs off the screen.
   There both menus hang from the bar itself, full width, just under it. */
@media (max-width: 640px) {
  .nav-pill { position: relative; }
  .menu-wrap { position: static; }
  .menu { left: 0; right: 0; min-width: 0; transform-origin: top center; }
}
.menu.open { opacity: 1; transform: none; visibility: visible; transition: opacity .18s var(--ease-out), transform .18s var(--ease-out), visibility 0s; }
.menu p { margin: 6px 10px 6px; font: 600 .72rem/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.menu button, .menu a {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px;
  border: 0; border-radius: 11px; background: transparent; color: var(--ink); text-decoration: none; text-align: left;
  font: 500 1rem/1.2 var(--sans); cursor: pointer;
}
.menu button:hover, .menu a:hover, .menu button:focus-visible, .menu a:focus-visible { background: var(--rule); outline: none; }
.menu .tick { margin-left: auto; width: 18px; height: 18px; stroke: var(--accent); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.menu [aria-checked="true"] .tick, .menu [aria-current="page"] .tick { visibility: visible; }
.menu .native { color: var(--ink-3); font-size: .85rem; margin-left: auto; }
.menu [aria-current="page"] .native { margin-left: 0; }

/* ---------- App Store badge (Apple's official artwork) ---------- */
.badge { display: inline-block; border-radius: 12px; transition: transform .16s var(--ease-out); }
.badge img { height: 54px; width: auto; }
.badge:active { transform: scale(.97); }
[data-theme="retro"] .badge { box-shadow: 4px 4px 0 var(--ink); }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; margin-top: 32px; }
.cta-note { font-size: .92rem; color: var(--ink-3); margin: 0; }

/* ---------- hero ---------- */
.hero { position: relative; padding: 112px 0 0; overflow: clip; isolation: isolate; }
.hero::before { content: ""; position: absolute; z-index: -1; width: 900px; height: 700px; left: -320px; top: -300px; background: radial-gradient(closest-side, var(--glow), transparent); }
.hero h1 em { font-style: italic; font-weight: inherit; }
[data-theme="marginalia"] .hero h1 em { font-style: normal; color: var(--ember); }
.hero .lede { margin-top: 22px; }
.hero-art { position: relative; margin: 40px auto 0; max-width: 980px; }
.hero-art .art {
  width: 100%; aspect-ratio: 1600 / 1308;
  -webkit-mask-image: linear-gradient(transparent, #000 10%, #000 62%, transparent 98%), linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(transparent, #000 10%, #000 62%, transparent 98%), linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-composite: intersect;
}
@media (max-width: 719px) { .hero-art { margin-inline: -28%; margin-top: 24px; } .hero-worm { left: 24% !important; } }
.hero-worm { position: absolute; width: clamp(92px, 17vw, 168px); left: clamp(-8px, 2vw, 40px); bottom: 6%; filter: drop-shadow(0 10px 14px rgba(60, 40, 20, .25)); }
@media (min-width: 960px) {
  .hero { padding-top: 150px; }
  .hero .split { display: grid; grid-template-columns: 1.15fr 1fr; align-items: end; gap: 48px; }
  .hero h1 { font-size: clamp(4rem, 7vw, 6.4rem); }
  .hero .lede { margin-top: 0; }
  .hero-side { padding-bottom: 14px; }
}

/* ---------- motion: only hides content when JS and motion are both available ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); transition-delay: var(--d, 0s); }
  .js .reveal.in { opacity: 1; transform: none; }
  .js .hero-art { opacity: 0; transform: translateY(40px) scale(.97); animation: lift 1.1s var(--ease-out) .25s forwards; }
  .js .hero-worm { opacity: 0; transform: translateY(24px) rotate(-6deg); animation: peek .8s var(--ease-out) 1.05s forwards; }
  @keyframes lift { to { opacity: 1; transform: none; } }
  @keyframes peek { 60% { opacity: 1; transform: translateY(-4px) rotate(2deg); } to { opacity: 1; transform: none; } }
  /* changing theme: screenshots cross-fade in as their new look arrives */
  .shot-img { transition: opacity .35s var(--ease-out); }
  .shot-img.swapping { opacity: 0; }
}

/* ---------- sections ---------- */
section { position: relative; }
.section { padding: 96px 0; }
@media (min-width: 960px) { .section { padding: 140px 0; } }
.section-head { max-width: 660px; margin-bottom: 48px; }
.section-head p:not(.eyebrow) { color: var(--ink-2); font-size: 1.12rem; margin: 18px 0 0; }
.rule-mark { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--ink-3); padding: 8px 0; }
.rule-mark::before, .rule-mark::after { content: ""; height: 1px; width: min(26vw, 180px); background: var(--rule); }

/* a phone sinking into the page */
.shot img {
  width: 100%; aspect-ratio: 720 / 1207;
  -webkit-mask-image: linear-gradient(#000 70%, transparent), linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(#000 70%, transparent), linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  mask-composite: intersect;
}

/* ---------- the habit, in three beats ---------- */
.beats { display: grid; gap: 72px; }
.beat .shot { max-width: 380px; margin: 32px auto 0; }
.beat-num { font: 600 .78rem/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 14px; }
.beat h3 { font-size: clamp(1.9rem, 5vw, 2.6rem); line-height: 1.1; }
.beat p { color: var(--ink-2); margin: 16px 0 0; max-width: 38ch; font-size: 1.1rem; }
.stage { display: none; }
@media (min-width: 960px) {
  .habit { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 80px; }
  .beats { gap: 0; }
  .beat { min-height: 88vh; display: flex; flex-direction: column; justify-content: center; transition: opacity .5s var(--ease-out); }
  .js .beat { opacity: .28; }
  .js .beat.active { opacity: 1; }
  .beat .shot { display: none; }
  .stage { display: block; position: sticky; top: 100px; height: calc(100vh - 130px); max-height: 760px; }
  .stage .shot { position: absolute; inset: 0; opacity: 0; transform: translateY(14px) scale(.985); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }
  .stage .shot.active { opacity: 1; transform: none; }
}
.worm { display: flex; align-items: center; margin-top: 28px; height: 40px; }
.worm i { width: 22px; height: 22px; border-radius: 50%; margin-right: -6px; background: var(--paper-3); border: 2px solid var(--paper); transition: background-color .35s var(--ease-out), transform .35s var(--ease-out); transition-delay: calc(var(--i) * 110ms); }
.worm i:last-child { width: 30px; height: 30px; position: relative; }
.worm i:last-child::before, .worm i:last-child::after { content: ""; position: absolute; width: 2px; height: 9px; top: -8px; background: currentColor; border-radius: 2px; color: var(--paper-3); transition: color .35s; transition-delay: calc(var(--i) * 110ms); }
.worm i:last-child::before { left: 9px; transform: rotate(-18deg); }
.worm i:last-child::after { right: 9px; transform: rotate(18deg); }
.worm-label { margin: 10px 0 0; font: 600 .95rem/1.2 var(--sans); color: var(--ink-3); }
.lit .worm i { background: var(--ember); transform: scale(1.04); }
.lit .worm i:last-child::before, .lit .worm i:last-child::after { color: var(--ember); }
.lit .worm-label { color: var(--ember); }
@media (prefers-reduced-motion: reduce) { .worm i, .worm i::before, .worm i::after { transition: none; } }
.shelf { display: flex; align-items: flex-end; gap: 4px; height: 76px; margin-top: 28px; padding: 0 6px; border-bottom: 4px solid var(--ink-2); width: max-content; max-width: 100%; }
.shelf b { display: block; width: 14px; border-radius: 3px 3px 1px 1px; background: var(--c); height: var(--h); }
@media (prefers-reduced-motion: no-preference) {
  .js .shelf b { transform: translateY(-120px); opacity: 0; transition: transform .55s cubic-bezier(.34, 1.4, .64, 1), opacity .2s; transition-delay: calc(var(--i) * 70ms); }
  .js .lit .shelf b { transform: none; opacity: 1; }
}
.shelf b.gold { background: var(--gold); box-shadow: inset 0 6px 0 rgba(255,255,255,.35), inset 0 -6px 0 rgba(0,0,0,.12); }

/* ---------- look inside ---------- */
.strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(72vw, 300px);
  gap: 20px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter);
  padding: 8px var(--gutter) 24px; margin-inline: calc(-1 * var(--gutter)); scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }
.strip figure { margin: 0; scroll-snap-align: start; }
.strip figcaption { font: var(--display-weight) 1.05rem/1.3 var(--display); letter-spacing: var(--display-track); margin-top: 6px; }
.strip figcaption span { display: block; font: 400 .92rem/1.45 var(--sans); letter-spacing: 0; color: var(--ink-3); margin-top: 4px; }
@media (min-width: 1100px) { .strip { grid-auto-flow: row; grid-template-columns: repeat(5, 1fr); overflow: visible; margin-inline: 0; padding-inline: 0; } }
.spread { margin-top: 64px; display: grid; border-top: 1px solid var(--rule); }
.spread article { padding: 26px 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 2.2rem 1fr; gap: 0 14px; }
.spread svg { width: 26px; height: 26px; stroke: var(--accent); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; margin-top: 2px; }
.spread h3 { font-size: 1.25rem; }
.spread p { grid-column: 2; margin: 6px 0 0; color: var(--ink-2); font-size: 1rem; }
@media (min-width: 820px) {
  .spread { grid-template-columns: 1fr 1fr; column-gap: 72px; position: relative; }
  .spread::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: linear-gradient(var(--rule), transparent); }
}

/* ---------- widgets and the Lock Screen ---------- */
.glance { display: grid; gap: 48px; align-items: center; }
.glance ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; }
.glance li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; color: var(--ink-2); }
.glance li svg { width: 22px; height: 22px; stroke: var(--accent); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-top: 3px; }
.screens { display: grid; gap: 20px; }
@media (min-width: 640px) { .screens { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .glance { grid-template-columns: .85fr 1.15fr; gap: 64px; } }
.screen { position: relative; border-radius: 34px; padding: 22px 16px 26px; min-height: 420px; overflow: hidden; color: #fff; box-shadow: var(--shadow); isolation: isolate; }
[data-theme="retro"] .screen { border: 2px solid var(--ink); }
.screen.home { background: radial-gradient(120% 80% at 20% 0%, #F2C98F, transparent 60%), radial-gradient(90% 70% at 100% 100%, #2E5E4E, transparent 70%), linear-gradient(160deg, #C9845A, #4A3A5C); }
.screen.lock { background: radial-gradient(90% 60% at 50% 0%, #F0B46A55, transparent 70%), linear-gradient(180deg, #1B2233, #0E1220 70%); }
.screen-label { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font: 600 .72rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.75); }
.widgets { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.w { background: var(--w-paper); color: var(--w-ink); border-radius: 22px; padding: 14px; box-shadow: 0 10px 24px -10px rgba(0,0,0,.45); }
.w.small { aspect-ratio: 1; display: flex; flex-direction: column; }
.w.medium { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.w-top { display: flex; justify-content: space-between; align-items: flex-start; }
.book { width: 46px; aspect-ratio: 2 / 3; border-radius: 3px 5px 5px 3px; background: url(/assets/cover-infinity.webp) center / cover; position: relative; box-shadow: 2px 4px 8px rgba(0,0,0,.35), inset 3px 0 0 rgba(0,0,0,.18); }
.book::after { content: ""; position: absolute; right: 8px; top: -2px; width: 5px; height: 16px; background: var(--w-gold); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); }
.mini-worm { display: flex; align-items: center; }
.mini-worm i { width: 9px; height: 9px; border-radius: 50%; background: var(--w-ember); margin-left: -2px; }
.mini-worm i:last-child { width: 12px; height: 12px; }
.w-title { font: 700 .95rem/1.15 ui-serif, "New York", Georgia, serif; margin-top: auto; }
.w-sub { font-size: .72rem; color: var(--w-ink-2); margin-top: 3px; line-height: 1.3; }
.w-rule { height: 1px; background: var(--w-track); margin-top: 8px; }
.ring { --p: 100; width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--w-gold) calc(var(--p) * 1%), var(--w-track) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--w-paper); }
.ring b { position: relative; font: 700 1.6rem/1 ui-serif, "New York", Georgia, serif; text-align: center; }
.ring b small { display: block; font: 500 .62rem/1.2 var(--sans); color: var(--w-ink-2); margin-top: 2px; }
.w-cap { font: 600 .62rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--w-ink-2); }
.w-line { font: 600 1.05rem/1.25 ui-serif, "New York", Georgia, serif; margin-top: 8px; }
.streak-w .mini-worm i { width: 12px; height: 12px; margin-left: -3px; }
.streak-w .mini-worm i:last-child { width: 16px; height: 16px; }
.streak-w b { font: 700 3rem/1 ui-serif, "New York", Georgia, serif; color: var(--w-ember); margin-top: auto; }
.w-streak { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: .74rem; color: var(--w-ember); font-weight: 600; }
.clock { text-align: center; margin-top: 18px; }
.clock small { display: block; font: 600 .95rem/1 var(--sans); color: rgba(255,255,255,.85); }
.clock b { display: block; font: 700 4.4rem/1 ui-rounded, "SF Pro Rounded", var(--sans); letter-spacing: -.02em; margin-top: 4px; }
.live { margin-top: 48px; background: var(--w-paper); color: var(--w-ink); border-radius: 24px; padding: 14px; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; box-shadow: 0 12px 30px -12px rgba(0,0,0,.6); }
.live .book { width: 40px; }
.live-state { display: flex; align-items: center; gap: 6px; font: 600 .7rem/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: #2F7A4C; }
[data-theme="dark"] .live-state { color: #6CC892; }
.live-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.live-time { font: 700 1.9rem/1.05 ui-serif, "New York", Georgia, serif; font-variant-numeric: tabular-nums; margin-top: 4px; }
.live-title { font-size: .74rem; color: var(--w-ink-2); margin-top: 2px; }
.live-btn { width: 44px; height: 44px; border-radius: 50%; background: #2F7A4C; display: grid; place-items: center; }
.live-btn i { width: 4px; height: 14px; background: #fff; border-radius: 2px; box-shadow: 7px 0 0 #fff; margin-left: -7px; }
.island { margin: 8px auto 0; width: 210px; height: 34px; border-radius: 20px; background: #000; display: flex; align-items: center; justify-content: space-between; padding: 0 6px 0 5px; }
.island .book { width: 16px; border-radius: 2px; box-shadow: none; }
.island .book::after { display: none; }
.island span { font: 600 .82rem/1 var(--sans); color: #6CC892; font-variant-numeric: tabular-nums; padding-right: 8px; }

/* ---------- four ways to read it ---------- */
.looks { display: grid; gap: 40px; }
.looks-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 28px; max-width: 460px; }
.look {
  appearance: none; cursor: pointer; text-align: left;
  display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center;
  min-height: 64px; padding: 12px 14px; border-radius: 16px;
  border: 1.5px solid var(--rule); background: transparent; color: var(--ink);
  transition: border-color .25s, background-color .25s, transform .16s var(--ease-out);
}
.look:active { transform: scale(.98); }
.look .swatch { width: 28px; height: 28px; grid-row: span 2; }
.look b { font: 600 1rem/1.1 var(--sans); }
.look small { font-size: .8rem; color: var(--ink-3); line-height: 1.25; }
.look[aria-checked="true"] { border-color: var(--ink); background: var(--rule); }
.look-desc { color: var(--ink-2); font-size: 1.12rem; min-height: 3.4em; margin: 18px 0 0; max-width: 38ch; }
.look-phones { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 640px; }
.look-phones .shot:last-child { margin-top: 48px; }
@media (min-width: 960px) { .looks { grid-template-columns: 1fr 1.15fr; align-items: center; gap: 64px; } .look-phones { gap: 24px; } }

/* ---------- note from the maker ---------- */
.maker { display: grid; gap: 28px; align-items: center; max-width: 880px; }
.maker img { width: 132px; height: 132px; border-radius: 50%; object-fit: cover; object-position: 50% 30%; box-shadow: var(--shadow); }
[data-theme="retro"] .maker img { border: 2px solid var(--ink); }
.maker blockquote { margin: 0; font: 400 clamp(1.35rem, 3.4vw, 1.75rem)/1.45 var(--display); text-wrap: pretty; }
[data-theme="retro"] .maker blockquote { font-size: clamp(1.15rem, 2.8vw, 1.45rem); letter-spacing: -.02em; }
.maker blockquote p { margin: 0 0 .7em; }
.signature { font: 400 2.2rem/1 "Snell Roundhand", "Apple Chancery", "Segoe Script", cursive; color: var(--ink-2); margin: 6px 0 0; }
.tipline { margin: 20px 0 0; font-size: 1rem; color: var(--ink-2); }
.tipline b { color: var(--ink); font-weight: 600; }
@media (min-width: 760px) { .maker { grid-template-columns: 160px 1fr; gap: 48px; } .maker img { width: 160px; height: 160px; } }

/* ---------- FAQ ---------- */
.faq { max-width: 820px; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq details:first-of-type { border-top: 1px solid var(--rule); }
.faq summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 20px;
  min-height: 64px; padding: 16px 0; font: var(--display-weight) 1.2rem/1.3 var(--display); letter-spacing: var(--display-track);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary i { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--rule); position: relative; transition: transform .3s var(--ease-out), background-color .2s; }
.faq summary i::before, .faq summary i::after { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 1.8px; background: var(--ink); border-radius: 2px; transform: translate(-50%, -50%); }
.faq summary i::after { transform: translate(-50%, -50%) rotate(90deg); transition: transform .3s var(--ease-out); }
.faq details[open] summary i::after { transform: translate(-50%, -50%) rotate(0deg); }
.faq summary:hover i { background: var(--rule); }
.faq .answer { padding: 0 52px 24px 0; color: var(--ink-2); }
.faq .answer p { margin: 0; }
.faq .answer a { color: var(--accent); text-underline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) { .faq details[open] .answer { animation: open .35s var(--ease-out); } @keyframes open { from { opacity: 0; transform: translateY(-6px); } } }

/* ---------- closing ---------- */
.closing { text-align: center; padding: 120px 0 132px; overflow: clip; }
.closing::before { content: ""; position: absolute; inset: auto 0 0; height: 70%; z-index: -1; background: radial-gradient(60% 70% at 50% 100%, var(--glow), transparent); }
.closing .sleep { width: 160px; margin: 0 auto 8px; }
.closing h2 { max-width: 14ch; margin-inline: auto; }
.closing p { color: var(--ink-2); font-size: 1.12rem; margin: 18px auto 0; max-width: 34ch; }
.closing .cta-row { justify-content: center; }

/* ---------- footer: three short columns of links, so every page reaches every other ---------- */
footer { border-top: 1px solid var(--rule); padding: 56px 0 calc(28px + env(safe-area-inset-bottom)); font-size: .95rem; color: var(--ink-3); }
.foot { display: grid; gap: 36px 28px; grid-template-columns: 1fr 1fr; }
.foot-brand { grid-column: 1 / -1; }
.foot-brand p { margin: 12px 0 18px; max-width: 30ch; color: var(--ink-2); }
.foot-brand .brand { display: inline-flex; }
.badge.small img { height: 40px; }
footer h2 { font: 600 .74rem/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 6px; }
footer nav { display: flex; flex-direction: column; }
footer nav a { text-decoration: none; display: inline-flex; min-height: 40px; align-items: center; color: var(--ink-2); }
footer nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.foot-base { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--rule); font-size: .85rem; }
@media (min-width: 820px) { .foot { grid-template-columns: 1.4fr 1fr 1fr 1fr; } .foot-brand { grid-column: auto; } }

.hero-art picture { display: block; }

/* ---------- links that lead deeper ---------- */
.more { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: 14px; color: var(--accent); font-weight: 600; text-decoration: none; }
.more::after { content: "→"; transition: transform .2s var(--ease-out); }
.more:hover::after { transform: translateX(3px); }
.more.inline { display: inline; min-height: 0; margin: 0; white-space: nowrap; }
.faq .more { margin-top: 22px; }

/* ==========================================================
   Inner pages: a quieter header, readable prose, the calculator
   ========================================================== */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 8px; padding: 0; margin: 0 0 22px; font-size: .88rem; color: var(--ink-3); }
.crumbs li + li::before { content: "›"; margin-right: 8px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; text-underline-offset: 3px; }
.page-head { position: relative; padding: 120px 0 56px; overflow: clip; isolation: isolate; }
.page-head::before { content: ""; position: absolute; z-index: -1; width: 800px; height: 600px; left: -300px; top: -280px; background: radial-gradient(closest-side, var(--glow), transparent); }
.page-head h1 { font-size: clamp(2.5rem, 8vw, 4.6rem); line-height: 1.02; max-width: 16ch; }
.page-head .lede { margin-top: 20px; max-width: 46ch; }
.page-head .meta { margin: 18px 0 0; font-size: .9rem; color: var(--ink-3); }
@media (min-width: 960px) { .page-head { padding-top: 150px; } }
.page-split { display: grid; gap: 40px; align-items: center; }
@media (min-width: 960px) { .page-split { grid-template-columns: 1.1fr .9fr; gap: 64px; } .page-split .shot { max-width: 380px; justify-self: end; width: 100%; } }
.page-split .shot { max-width: 340px; margin-inline: auto; }
.points { display: grid; gap: 40px; }
@media (min-width: 820px) { .points { grid-template-columns: 1fr 1fr; column-gap: 64px; } }
.point h2, .point h3 { font-size: clamp(1.5rem, 3.4vw, 2rem); line-height: 1.15; }
.point p { color: var(--ink-2); margin: 12px 0 0; }
.band { background: var(--paper-2); }
[data-theme="marginalia"] .band { background: color-mix(in srgb, var(--paper-2) 70%, transparent); }

/* prose: guides and long answers */
.prose { max-width: 680px; font-size: 1.12rem; line-height: 1.75; color: var(--ink-2); }
.prose > * + * { margin-top: 1.1em; }
.prose p { margin: 0; }
.prose h2 { font-size: clamp(1.6rem, 4vw, 2.1rem); line-height: 1.15; color: var(--ink); margin-top: 2em; }
.prose h3 { font-size: 1.3rem; color: var(--ink); margin-top: 1.6em; }
.prose strong { color: var(--ink); }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0; }
.prose li + li { margin-top: .45em; }
.prose table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); }
.prose th { color: var(--ink); font-weight: 600; }
.prose td:not(:first-child), .prose th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.prose .note { padding: 18px 20px; border-radius: 16px; background: var(--paper-2); color: var(--ink-2); font-size: 1rem; }
[data-theme="retro"] .prose .note { border: 2px solid var(--ink); border-radius: 10px; }

/* cards that lead to other pages */
.cards { display: grid; gap: 16px; }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card { display: flex; flex-direction: column; gap: 8px; padding: 24px; border-radius: 22px; background: var(--paper-2); text-decoration: none; color: var(--ink); min-height: 180px; transition: transform .2s var(--ease-out), background-color .2s; }
.card:hover { transform: translateY(-3px); }
[data-theme="retro"] .card { border: 2px solid var(--ink); border-radius: 12px; box-shadow: 4px 4px 0 var(--ink); }
.card small { font: 600 .74rem/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.card h3 { font-size: 1.35rem; }
.card p { margin: 0; color: var(--ink-2); font-size: .98rem; }
.card span.go { margin-top: auto; color: var(--accent); font-weight: 600; }

/* app call to action at the end of inner pages */
.cta-band { text-align: center; padding: 96px 0; }
.cta-band h2 { max-width: 16ch; margin-inline: auto; }
.cta-band p { color: var(--ink-2); margin: 16px auto 0; max-width: 40ch; font-size: 1.1rem; }
.cta-band .cta-row { justify-content: center; }

/* ---------- reading goal calculator ---------- */
.calc { max-width: 760px; padding: 28px; border-radius: 28px; background: var(--paper-2); box-shadow: var(--shadow); }
[data-theme="retro"] .calc { border: 2px solid var(--ink); border-radius: 14px; }
@media (max-width: 480px) { .calc { padding: 20px 16px; border-radius: 22px; } }
.calc-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; border-radius: 16px; background: var(--rule); margin-bottom: 24px; }
.calc-tabs button { appearance: none; border: 0; cursor: pointer; min-height: 44px; border-radius: 12px; background: transparent; color: var(--ink-2); font: 600 .95rem/1.2 var(--sans); padding: 6px 10px; }
.calc-tabs button[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.calc-fields { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.calc-fields .wide { grid-column: 1 / -1; }
.calc label { display: block; font: 600 .9rem/1.3 var(--sans); color: var(--ink-2); margin-bottom: 6px; }
.calc input { width: 100%; min-height: 52px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--rule); background: var(--paper); color: var(--ink); font: 600 1.15rem/1 var(--sans); font-variant-numeric: tabular-nums; }
.calc input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); }
[data-theme="retro"] .calc input { border: 2px solid var(--ink); border-radius: 8px; }
.calc-result { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--rule); display: grid; gap: 4px; }
.calc-big { font: var(--display-weight) clamp(3rem, 12vw, 4.6rem)/1 var(--display); letter-spacing: var(--display-track); color: var(--ink); font-variant-numeric: tabular-nums; }
.calc-big small { font: 600 1.05rem/1 var(--sans); letter-spacing: 0; color: var(--ink-2); margin-left: 8px; }
.calc-sub { color: var(--ink-2); margin: 6px 0 0; }
.calc-hint { color: var(--ink-3); font-size: .9rem; margin: 10px 0 0; }
.calc [hidden] { display: none; }

/* ---------- phones and tablets: the section links get their own row under the bar ----------
   Scrolls sideways if the words are long, tucks away while reading down, returns on the way up. */
.nav-links a[aria-current="page"] { color: var(--ink); background: var(--rule); }
@media (max-width: 999px) {
  .nav-pill { flex-wrap: wrap; row-gap: 0; }
  .nav-links {
    display: flex; order: 99; flex: 0 0 100%;
    margin: 6px -2px -2px; padding-top: 6px; border-top: 1px solid var(--nav-line);
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    max-height: 60px; transition: max-height .3s var(--ease-out), opacity .2s, margin .3s var(--ease-out), padding .3s var(--ease-out);
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { flex: none; padding: 0 12px; font-size: .92rem; }
  .nav.tuck .nav-links { max-height: 0; opacity: 0; margin-top: 0; margin-bottom: 0; padding-top: 0; border-top-color: transparent; pointer-events: none; }
  .hero { padding-top: 168px; }
  .page-head { padding-top: 172px; }
  html { scroll-padding-top: 140px; }
}
@media (prefers-reduced-motion: reduce) { .nav-links { transition: none; } }

/* home: four guide/tool cards; two columns on tablets, four on wide screens */
@media (min-width: 720px) and (max-width: 1099px) { .cards.learn { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .cards.learn { grid-template-columns: repeat(4, 1fr); } }
#learn .more { margin-top: 24px; }
/* narrowest phones: the globe alone says "language", which keeps long Get buttons (pl, fr) on one row */
@media (max-width: 400px) { #lang-btn .code { display: none; } .get { padding: 0 12px; font-size: .9rem; } }
@media (max-width: 999px) {
  .nav-links { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); padding-right: 24px; }
}

/* five links need room: labels never wrap, and the scrolled bar only slims a little on wide screens */
.nav-links a { white-space: nowrap; }
@media (min-width: 1000px) { .nav.compact .nav-pill { max-width: 1020px; } }

/* ==========================================================
   The bookshelf: guides and tools as cloth-bound books on a plank
   ========================================================== */
.bookshelf { position: relative; margin-top: 8px; }
.books {
  --gap: 22px; display: grid; grid-auto-flow: column; grid-auto-columns: min(58vw, 220px); gap: var(--gap);
  align-items: start;   /* every book stands on the same line, whatever its caption */ overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  padding: 28px var(--gutter) 0; margin-inline: calc(-1 * var(--gutter)); scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
}
.books::-webkit-scrollbar { display: none; }
@media (min-width: 900px) {
  .books { --gap: clamp(24px, 3vw, 44px); grid-auto-flow: row; grid-template-columns: repeat(var(--n, 4), 1fr); overflow: visible; margin-inline: 0; padding-inline: 8px; }
}
.tome { scroll-snap-align: start; display: block; text-decoration: none; color: inherit; outline: none; }
.tome:focus-visible .cover { outline: 3px solid var(--accent); outline-offset: 4px; }
.cover {
  --cloth: #2F5D4A; --foil: #E9D9A6;
  position: relative; aspect-ratio: 2 / 3; border-radius: 3px 8px 8px 3px;
  background:
    linear-gradient(90deg, rgba(0,0,0,.34) 0, rgba(0,0,0,.08) 5%, rgba(255,255,255,.10) 7%, rgba(0,0,0,0) 12%),   /* spine and hinge */
    radial-gradient(120% 80% at 30% 0%, rgba(255,255,255,.14), transparent 60%),                                /* lamp light */
    var(--cloth);
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 6px 0 0 -2px #F3EBDC, 7px 0 0 -2px rgba(0,0,0,.2), 10px 0 0 -4px #E8DCC6,  /* page block */
              0 18px 28px -14px rgba(40, 24, 12, .55), 0 4px 6px rgba(40, 24, 12, .18);
  color: var(--foil); padding: 22px 20px 20px 26px; display: flex; flex-direction: column;
  transform-origin: bottom center;
  transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out);
}
.cover::before {           /* a blind-stamped frame, inset like a real case binding */
  content: ""; position: absolute; inset: 10px 10px 10px 16px; border: 1px solid color-mix(in srgb, var(--foil) 45%, transparent);
  border-radius: 2px; pointer-events: none;
}
.cover::after {            /* the ribbon bookmark */
  content: ""; position: absolute; right: 22px; bottom: -14px; width: 10px; height: 34px; background: var(--ribbon, #C9A84C);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); box-shadow: 0 2px 2px rgba(0,0,0,.2);
}
.cover small { position: relative; font: 600 .66rem/1.2 var(--sans); letter-spacing: .18em; text-transform: uppercase; opacity: .85; }
.cover h3 { position: relative; margin-top: 14px; font-family: ui-serif, "New York", Georgia, serif; font-weight: 700; font-size: clamp(1.1rem, 1.6vw, 1.32rem); line-height: 1.2; letter-spacing: -.01em; color: var(--foil); text-wrap: balance; }
.cover .rule { position: relative; width: 34px; height: 1px; background: currentColor; opacity: .55; margin-top: 16px; }
.cover .go { position: relative; margin-top: auto; font: 600 .85rem/1.2 var(--sans); opacity: .95; }
.tome:hover .cover, .tome:focus-visible .cover { transform: translateY(-10px) rotate(-1.2deg); box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 6px 0 0 -2px #F3EBDC, 7px 0 0 -2px rgba(0,0,0,.2), 10px 0 0 -4px #E8DCC6, 0 30px 36px -16px rgba(40, 24, 12, .55), 0 6px 10px rgba(40, 24, 12, .16); }
@media (prefers-reduced-motion: reduce) { .cover { transition: none; } .tome:hover .cover, .tome:focus-visible .cover { transform: none; } }
.tome p { margin: 26px 2px 0; font-size: .95rem; line-height: 1.5; color: var(--ink-2); }
/* each book stands on its own piece of plank; the pieces overlap the gaps, so a row reads as one shelf
   (and still works when the row scrolls sideways on a phone) */
.stand { position: relative; padding-bottom: 18px; }
.stand::after { content: ""; position: absolute; left: calc(var(--gap) / -2); right: calc(var(--gap) / -2); bottom: 0; height: 18px; z-index: -1;
  background: linear-gradient(#B9895A, #9C6C42 45%, #7D5232); box-shadow: 0 10px 18px -8px rgba(60, 35, 15, .55), inset 0 1px 0 rgba(255, 230, 190, .5); }
.stand { isolation: isolate; }
.tome p { margin-top: 18px; }
[data-theme="dark"] .stand::after { background: linear-gradient(#5A4433, #45342A 45%, #33271F); box-shadow: 0 10px 18px -8px rgba(0,0,0,.8), inset 0 1px 0 rgba(255, 220, 170, .18); }
[data-theme="dark"] .cover { box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 6px 0 0 -2px #CFC6B6, 7px 0 0 -2px rgba(0,0,0,.4), 10px 0 0 -4px #BDB3A1, 0 18px 28px -14px rgba(0,0,0,.9); }
[data-theme="retro"] .cover { border: 2px solid var(--ink); border-radius: 4px 10px 10px 4px; box-shadow: 6px 6px 0 var(--ink); }
[data-theme="retro"] .tome:hover .cover { box-shadow: 9px 10px 0 var(--ink); }
[data-theme="retro"] .stand::after { background: #9A3A1E; border-block: 2px solid var(--ink); box-shadow: 0 4px 0 var(--ink); border-radius: 0; }
[data-theme="marginalia"] .stand::after { background: transparent; height: 10px; box-shadow: none; border-top: 2.5px solid var(--ink); border-radius: 40% 60% 0 0 / 6px 4px 0 0; }
[data-theme="marginalia"] .cover { border-radius: 4px 10px 9px 5px; }

/* cloth colours, one per book */
.cloth-green  { --cloth: #2F5D4A; }
.cloth-oxblood{ --cloth: #6E2A2A; }
.cloth-navy   { --cloth: #263A5A; }
.cloth-ochre  { --cloth: #8A5A1C; --foil: #F5E6BF; --ribbon: #2F5D4A; }
@media (min-width: 900px) { .books { max-width: calc(var(--n, 4) * 270px); } }
