/* Ballad: the marketing site.
   Two themes, the same as the app's (balladui/src/constants/palette.ts and theme.ts):
   Reading Room (the default) and Midnight Book Club ([data-theme="midnight"]).
   Components use the tokens below only, never raw colors. */

/* ---------- Tokens ---------- */
:root {
  --page: #FBF7EF;
  --page-deep: #F3ECDD;
  --surface: #FFFFFF;
  --ink: #14231E;
  --ink-2: #4E5F58;
  --border: #DFDED6;
  --primary: #0F7B5F;
  --on-primary: #FFFFFF;
  --primary-soft: #E3EFE7;
  --highlight: #F5A524;
  --on-highlight: #14231E;
  --like: #C2185B;
  --link: #0F7B5F;
  --shadow: rgba(15, 75, 55, 0.14);
  --shadow-strong: rgba(15, 60, 45, 0.24);
  --glow: transparent;
  --statement-bg: #0F7B5F;
  --statement-ink: #FFFFFF;
  --statement-accent: #F5A524;

  /* Bright colors for tiles, spines and avatars, each with its text color. */
  --pop-emerald: #0F7B5F; --on-emerald: #FFFFFF;
  --pop-marigold: #F5A524; --on-marigold: #14231E;
  --pop-berry: #C2185B; --on-berry: #FFFFFF;
  --pop-sky: #6EC1E4; --on-sky: #14231E;
  --pop-lilac: #B9A6F2; --on-lilac: #14231E;

  --display: 'Young Serif', Georgia, 'Times New Roman', serif;
  /* Young Serif has no italic: Literata's stands in, as in the app. */
  --display-italic: 'Literata', Georgia, serif;
  --display-scale: 1;
  --reading: 'Literata', Georgia, 'Times New Roman', serif;
  --ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --radius: 22px;
  --wrap: 1160px;
  --gutter: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

:root[data-theme="midnight"] {
  --page: #16123A;
  --page-deep: #110E2E;
  --surface: #241D57;
  --ink: #F5F0FF;
  --ink-2: #B7B0D9;
  --border: #3E346B;
  --primary: #C6F432;
  --on-primary: #16123A;
  --primary-soft: #2C2560;
  --highlight: #C6F432;
  --on-highlight: #16123A;
  --like: #FF6B57;
  --link: #B69CFF;
  --shadow: rgba(0, 0, 0, 0.35);
  --shadow-strong: rgba(0, 0, 0, 0.5);
  --glow: rgba(198, 244, 50, 0.35);
  --statement-bg: #241D57;
  --statement-ink: #F5F0FF;
  --statement-accent: #C6F432;

  --pop-emerald: #4FE3D0; --on-emerald: #16123A;
  --pop-marigold: #C6F432; --on-marigold: #16123A;
  --pop-berry: #FF6B57; --on-berry: #16123A;
  --pop-sky: #4FE3D0; --on-sky: #16123A;
  --pop-lilac: #B69CFF; --on-lilac: #16123A;

  --display: 'Instrument Serif', Georgia, serif;
  --display-italic: 'Instrument Serif', Georgia, serif;
  /* Instrument Serif is narrow and small on its body: set it larger. */
  --display-scale: 1.18;
  --reading: 'Source Serif 4', Georgia, serif;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--reading);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .5s var(--ease), color .5s var(--ease);
}
img, svg { display: block; }
a { color: var(--link); text-underline-offset: 3px; }
p { margin: 0 0 1em; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0; line-height: 1.08; letter-spacing: -0.01em; }
h1 em, h2 em, h3 em { font-family: var(--display-italic); font-style: italic; }
:root:not([data-theme="midnight"]) h1 em, :root:not([data-theme="midnight"]) h2 em { letter-spacing: -0.02em; }
::selection { background: var(--highlight); color: var(--on-highlight); }
:focus-visible { outline: 3px solid var(--highlight); outline-offset: 3px; border-radius: 8px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ico.fill { fill: currentColor; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-family: var(--ui); font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }

.kicker {
  font-family: var(--ui); font-size: .78rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-2); margin: 0 0 14px;
}
.center { text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 26px; border-radius: 999px; border: 2px solid transparent;
  font-family: var(--ui); font-size: 1rem; font-weight: 650; text-decoration: none; white-space: nowrap;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background-color .25s var(--ease);
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 10px 24px -10px var(--shadow-strong), 0 0 0 0 var(--glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -12px var(--shadow-strong), 0 0 28px -4px var(--glow); }
.btn-primary .ico { transition: transform .25s var(--ease); }
.btn-primary:hover .ico { transform: translateX(3px); }
.btn-ghost { color: var(--ink); border-color: var(--border); background: transparent; }
.btn-ghost:hover { border-color: var(--ink); }
.btn-small { min-height: 42px; padding: 0 18px; font-size: .92rem; }
.btn-large { min-height: 60px; padding: 0 34px; font-size: 1.08rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--page) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background-color .5s var(--ease);
}
.site-header.scrolled { border-bottom-color: var(--border); }
.header-row { display: flex; align-items: center; gap: 24px; height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--primary); color: var(--on-primary);
  font-family: var(--display); font-size: calc(1.55rem * var(--display-scale)); line-height: 1;
  position: relative; overflow: hidden; padding: 0 0 8px;
}
/* The logo's underline: a pen scribble under the letter. */
.brand-mark::before {
  content: ''; position: absolute; left: 6px; right: 6px; bottom: 5px; height: 6px; background: var(--highlight);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='70 378 374 70' preserveAspectRatio='none'%3E%3Cpath d='M84 434C150 398 214 408 266 414S372 432 430 392' fill='none' stroke='%23000' stroke-width='28' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='70 378 374 70' preserveAspectRatio='none'%3E%3Cpath d='M84 434C150 398 214 408 266 414S372 432 430 392' fill='none' stroke='%23000' stroke-width='28' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
:root[data-theme="midnight"] .brand-mark { box-shadow: 0 0 22px -4px var(--glow); }
:root[data-theme="midnight"] .brand-mark::before { background: var(--page); }
.brand-name { font-family: var(--display); font-size: calc(1.3rem * var(--display-scale)); white-space: nowrap; }
.site-nav { display: none; gap: 30px; margin-left: auto; }
.site-nav a { font-family: var(--ui); font-size: .95rem; font-weight: 550; color: var(--ink-2); text-decoration: none; transition: color .2s; }
.site-nav a:hover { color: var(--ink); }
.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.site-nav + .header-actions { margin-left: 0; }
.theme-toggle {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink); cursor: pointer;
  transition: transform .3s var(--ease), border-color .2s;
}
.theme-toggle:hover { border-color: var(--ink); transform: rotate(-12deg); }
.theme-toggle .ico { grid-area: 1 / 1; transition: opacity .3s, transform .4s var(--ease); }
.theme-toggle .sun { opacity: 0; transform: scale(.5) rotate(-60deg); }
:root[data-theme="midnight"] .theme-toggle .sun { opacity: 1; transform: none; }
:root[data-theme="midnight"] .theme-toggle .moon { opacity: 0; transform: scale(.5) rotate(60deg); }

/* ---------- Hero ---------- */
.hero { position: relative; padding: clamp(32px, 6vw, 72px) 0 clamp(88px, 10vw, 128px); overflow: hidden; }
.glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; pointer-events: none; }
.glow-a { width: 520px; height: 520px; right: -140px; top: -120px; background: color-mix(in srgb, var(--pop-sky) 45%, transparent); }
.glow-b { width: 420px; height: 420px; left: -180px; bottom: -160px; background: color-mix(in srgb, var(--pop-lilac) 40%, transparent); }
:root[data-theme="midnight"] .glow-a { background: rgba(182, 156, 255, .28); }
:root[data-theme="midnight"] .glow-b { background: rgba(79, 227, 208, .16); }

.hero-grid { position: relative; display: grid; gap: 56px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 22px; padding: 7px 14px 7px 12px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  font-family: var(--ui); font-size: .85rem; font-weight: 600; color: var(--ink-2);
}
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 50%, transparent); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.hero h1 { font-size: calc(clamp(2.55rem, 6.4vw, 4.75rem) * var(--display-scale)); line-height: 1.04; margin-bottom: 26px; text-wrap: balance; }
.underlined { position: relative; display: inline-block; font-family: var(--display-italic); font-style: italic; color: var(--primary); }
:root:not([data-theme="midnight"]) .underlined { letter-spacing: -0.02em; }
.scribble { position: absolute; left: -2%; bottom: -0.16em; width: 104%; height: .32em; overflow: visible; }
.scribble path { fill: none; stroke: var(--highlight); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 320; stroke-dashoffset: 0; }
.js .scribble path { stroke-dashoffset: 320; animation: draw 1.1s .75s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.lead { font-size: clamp(1.1rem, 1.6vw, 1.28rem); line-height: 1.6; color: var(--ink-2); max-width: 34em; margin-bottom: 32px; }
.lead strong { color: var(--ink); font-weight: 600; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 26px; }
.fine { display: flex; flex-wrap: wrap; gap: 8px 22px; list-style: none; margin: 0; padding: 0; font-family: var(--ui); font-size: .9rem; color: var(--ink-2); }
.fine li { display: flex; align-items: center; gap: 8px; }
.fine li::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--highlight); }

/* The phone and its companions */
.hero-art { position: relative; display: grid; place-items: center; min-height: 600px; }
.sun-disc {
  position: absolute; width: min(470px, 92vw); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--highlight) 92%, white), var(--highlight));
  opacity: .9;
}
:root[data-theme="midnight"] .sun-disc { background: radial-gradient(circle at 35% 30%, #3A2F86, #241D57 70%); box-shadow: 0 0 120px -10px rgba(182, 156, 255, .45); }
.phone {
  position: relative; width: 300px; height: 610px; border-radius: 46px; padding: 10px;
  background: #121212; box-shadow: 0 50px 80px -30px var(--shadow-strong), 0 0 0 2px #2b2b2b inset;
  transform: rotate(3deg);
}
.screen { position: relative; height: 100%; border-radius: 37px; overflow: hidden; background: var(--page); display: flex; flex-direction: column; font-family: var(--ui); }
.status { display: flex; justify-content: space-between; align-items: center; height: 40px; padding: 4px 24px 0; font-size: 12px; font-weight: 700; color: var(--ink); flex: none; }
.notch { width: 80px; height: 22px; border-radius: 20px; background: #121212; }
.bars { display: flex; gap: 2px; align-items: flex-end; }
.bars i { width: 3px; background: var(--ink); border-radius: 2px; }
.bars i:nth-child(1) { height: 5px; } .bars i:nth-child(2) { height: 8px; } .bars i:nth-child(3) { height: 11px; }
.app-body { flex: 1; min-height: 0; overflow: hidden; padding: 6px 12px 0; display: flex; flex-direction: column; gap: 14px; }
.compose {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 999px;
  background: var(--primary); color: var(--on-primary); font-family: var(--reading); font-style: italic; font-size: 13px;
}
:root[data-theme="midnight"] .compose { background: var(--surface); color: var(--ink); border: 1px solid #B69CFF; }
.compose .ico { width: 16px; height: 16px; }
.post { position: relative; background: var(--surface); border-radius: 18px; padding: 14px 14px 10px; box-shadow: 0 8px 20px -12px var(--shadow-strong); margin-top: 8px; }
.catalog-tab {
  position: absolute; top: -9px; left: 16px; padding: 1px 10px; border-radius: 6px 6px 0 0;
  background: var(--highlight); color: var(--on-highlight); font-size: 10px; font-weight: 700; letter-spacing: .04em;
}
:root[data-theme="midnight"] .catalog-tab { display: none; }
.post-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--av); color: var(--av-ink); font-family: var(--ui); font-size: 11px; font-weight: 700;
}
.avatar.sm { width: 28px; height: 28px; font-size: 10px; }
.who { display: flex; flex-direction: column; line-height: 1.2; }
.who b { font-family: var(--display); font-weight: 400; font-size: calc(13px * var(--display-scale)); color: var(--ink); }
.who small { font-size: 10.5px; color: var(--ink-2); }
.post-text { font-family: var(--reading); font-size: 12.5px; line-height: 1.5; color: var(--ink); margin: 0 0 10px; }
.post-pic { position: relative; height: 128px; border-radius: 12px; background: color-mix(in srgb, var(--pop-sky) 55%, var(--surface)); overflow: hidden; }
:root[data-theme="midnight"] .post-pic { background: #2E2668; }
.stack { position: absolute; left: 22%; height: 18px; border-radius: 3px; }
.stack.s1 { bottom: 14px; width: 56%; background: var(--pop-berry); }
.stack.s2 { bottom: 32px; width: 50%; left: 25%; background: var(--pop-emerald); }
.stack.s3 { bottom: 50px; width: 46%; left: 24%; background: var(--pop-marigold); transform: rotate(-3deg); }
:root[data-theme="midnight"] .stack.s2 { background: #B69CFF; }
.stack::after { content: ''; position: absolute; inset: 5px 8px auto auto; width: 30%; height: 2px; background: rgba(255,255,255,.55); border-radius: 2px; }
.mug { position: absolute; right: 16%; bottom: 14px; width: 30px; height: 34px; border-radius: 4px 4px 9px 9px; background: var(--page); }
.mug::after { content: ''; position: absolute; right: -9px; top: 8px; width: 9px; height: 13px; border: 3px solid var(--page); border-left: 0; border-radius: 0 8px 8px 0; }
.post-actions { display: flex; gap: 16px; align-items: center; padding-top: 9px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.post-actions span { display: inline-flex; align-items: center; gap: 5px; }
.post-actions .ico { width: 17px; height: 17px; }
.post-actions .liked { color: var(--like); }
.post-actions .push { margin-left: auto; }
.post-peek { opacity: .92; }
.tabbar { display: flex; height: 66px; flex: none; border-top: 1px solid var(--border); background: var(--page); padding-bottom: 8px; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; font-weight: 600; color: var(--ink-2); }
.tab .pill { display: grid; place-items: center; width: 46px; height: 28px; border-radius: 999px; }
.tab.on { color: var(--primary); }
.tab.on .pill { background: var(--primary); color: var(--on-primary); }
:root[data-theme="midnight"] .tabbar { margin: 0 14px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); height: 56px; padding: 0; }
:root[data-theme="midnight"] .tab.on .pill { background: transparent; color: var(--primary); position: relative; }
:root[data-theme="midnight"] .tab.on .pill::after { content: ''; position: absolute; bottom: -2px; width: 5px; height: 5px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 10px 2px var(--glow); }

.index-card {
  position: absolute; left: -10px; bottom: -34px; width: 250px; margin: 0; padding: 26px 20px 16px 30px;
  background: var(--surface); border-radius: 6px; box-shadow: 0 24px 40px -18px var(--shadow-strong);
  background-image:
    linear-gradient(90deg, transparent 20px, color-mix(in srgb, var(--like) 45%, transparent) 20px, color-mix(in srgb, var(--like) 45%, transparent) 21.5px, transparent 21.5px),
    repeating-linear-gradient(to bottom, transparent 0 23px, color-mix(in srgb, var(--pop-sky) 40%, transparent) 23px 24px);
  background-position: 0 0, 0 14px;
  transform: rotate(-5deg);
}
.index-card blockquote { margin: 0 0 6px; font-family: var(--reading); font-size: 14px; line-height: 24px; color: var(--ink); }
.index-card figcaption { font-family: var(--reading); font-style: italic; font-size: 13px; line-height: 24px; color: var(--primary); }
:root[data-theme="midnight"] .index-card figcaption { color: #B69CFF; }
.card-source { display: block; margin-top: 6px; font-family: var(--ui); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.stamp {
  position: absolute; top: -14px; right: 14px; padding: 4px 10px; border: 2px solid var(--like); border-radius: 6px;
  font-family: var(--ui); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--like); background: var(--surface); transform: rotate(6deg);
}
.toast {
  position: absolute; right: -12px; top: 6px; display: flex; align-items: center; gap: 10px; padding: 9px 16px 9px 9px;
  border-radius: 999px; background: var(--surface); box-shadow: 0 18px 34px -16px var(--shadow-strong);
  font-family: var(--ui); font-size: 13px; color: var(--ink-2); white-space: nowrap;
}
.toast b { color: var(--ink); }
.toast .heart { width: 18px; height: 18px; color: var(--like); }
.float-a { animation: bob 7s ease-in-out infinite; }
.float-b { animation: bob 6s ease-in-out -2s infinite; }
@keyframes bob { 50% { translate: 0 -10px; } }

/* ---------- Entrances ---------- */
.js .rise { opacity: 0; transform: translateY(18px); animation: rise .9s var(--ease) forwards; animation-delay: calc(var(--d, 0) * 110ms + 80ms); }
@keyframes rise { to { opacity: 1; transform: none; } }
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Shelf ---------- */
.shelf-section { padding: clamp(40px, 6vw, 72px) 0 clamp(48px, 7vw, 88px); background: var(--page-deep); transition: background-color .5s var(--ease); }
.shelf-section .kicker { margin-bottom: 30px; }
.shelf {
  display: flex; align-items: flex-end; justify-content: center; gap: 5px; height: 190px; padding: 0 12px;
  border-bottom: 12px solid color-mix(in srgb, var(--ink) 82%, var(--highlight)); border-radius: 0 0 4px 4px;
  position: relative; overflow: hidden;
}
:root[data-theme="midnight"] .shelf { border-bottom-color: #3E346B; }
.shelf::after { content: ''; position: absolute; left: 0; right: 0; bottom: -26px; height: 14px; background: linear-gradient(var(--shadow), transparent); }
.spine {
  display: flex; align-items: center; justify-content: center; height: var(--h); width: var(--w); flex: none;
  border-radius: 4px 4px 1px 1px; background: var(--c); color: var(--t);
  writing-mode: vertical-rl;
  font-family: var(--ui); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
  box-shadow: inset 4px 0 0 rgba(255,255,255,.18), inset -3px 0 0 rgba(0,0,0,.12);
  transition: translate .35s var(--ease);
}
.spine:hover { translate: 0 -10px; }
.spine.lean { transform: rotate(-8deg); transform-origin: bottom left; margin-left: 24px; }
.shelf-caption { max-width: 34em; margin: 44px auto 0; text-align: center; color: var(--ink-2); font-size: 1.05rem; }

/* ---------- Sections ---------- */
.section { padding: clamp(72px, 10vw, 128px) 0; }
.section-head { max-width: 760px; margin-bottom: clamp(36px, 5vw, 60px); }
.section-head.center { margin-left: auto; margin-right: auto; }
.section h2, .final h2 { font-size: calc(clamp(2.1rem, 4.4vw, 3.4rem) * var(--display-scale)); text-wrap: balance; }
.section h2 em, .final h2 em { color: var(--primary); }
.section-lead { color: var(--ink-2); font-size: 1.12rem; margin-top: 18px; max-width: 36em; }
.section-head.center .section-lead { margin-left: auto; margin-right: auto; }

/* Features: index cards with folder tabs */
.features { display: grid; gap: 34px 22px; }
.feature {
  position: relative; padding: 32px 28px 26px; background: var(--surface); border-radius: 4px var(--radius) var(--radius) var(--radius);
  box-shadow: 0 1px 0 var(--border), 0 18px 36px -24px var(--shadow-strong);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.feature:hover { transform: translateY(-4px); box-shadow: 0 1px 0 var(--border), 0 26px 44px -24px var(--shadow-strong); }
.folder-tab {
  position: absolute; top: -26px; left: 0; height: 27px; padding: 5px 18px 0; border-radius: 12px 12px 0 0;
  background: var(--surface); font-family: var(--ui); font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2);
}
.feature-icon { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 16px; background: var(--c); color: var(--t); margin-bottom: 20px; }
.feature-icon .ico { width: 24px; height: 24px; }
.feature h3 { font-size: calc(1.45rem * var(--display-scale)); margin-bottom: 10px; }
.feature p { margin: 0; color: var(--ink-2); font-size: 1rem; line-height: 1.62; }
:root[data-theme="midnight"] .feature { border: 1px solid var(--border); border-radius: var(--radius); }
:root[data-theme="midnight"] .folder-tab { position: static; display: inline-block; height: auto; margin-bottom: 18px; padding: 4px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }
:root[data-theme="midnight"] .feature-icon { float: right; margin: -6px 0 0 12px; }

/* Statement band */
.statement { padding: 0 var(--gutter); }
.statement-inner {
  max-width: var(--wrap); margin: 0 auto; padding: clamp(56px, 8vw, 104px) clamp(24px, 6vw, 96px);
  border-radius: 36px; background: var(--statement-bg); color: var(--statement-ink); text-align: center; position: relative; overflow: hidden;
}
.statement-inner::before, .statement-inner::after { content: ''; position: absolute; border-radius: 50%; opacity: .16; }
.statement-inner::before { width: 340px; height: 340px; left: -110px; top: -140px; background: var(--statement-accent); }
.statement-inner::after { width: 260px; height: 260px; right: -70px; bottom: -120px; background: var(--pop-sky); }
:root[data-theme="midnight"] .statement-inner { border: 1px solid var(--border); box-shadow: 0 0 80px -30px var(--glow); }
.statement .kicker { color: var(--statement-accent); position: relative; }
.statement h2 { position: relative; font-size: calc(clamp(1.9rem, 4.2vw, 3.3rem) * var(--display-scale)); max-width: 18em; margin: 0 auto 22px; text-wrap: balance; }
.statement-sub { position: relative; max-width: 34em; margin: 0 auto; font-size: 1.15rem; opacity: .86; }

/* Coming next */
.next-grid { display: grid; gap: 56px; align-items: center; }
.next-copy > p:not(.kicker) { color: var(--ink-2); font-size: 1.12rem; margin-top: 18px; max-width: 32em; }
.soon-list { list-style: none; margin: 34px 0 0; padding: 0; display: grid; gap: 18px; }
.soon-list li { display: flex; gap: 16px; align-items: flex-start; }
.soon-list b { display: block; font-family: var(--display); font-weight: 400; font-size: calc(1.15rem * var(--display-scale)); }
.soon-list span:not(.soon-dot) { color: var(--ink-2); font-size: .98rem; }
.soon-dot { width: 14px; height: 14px; margin-top: 7px; flex: none; border-radius: 4px; background: var(--c); transform: rotate(45deg); }
.next-art { display: grid; place-items: center; padding: 20px 0; }
.note-card {
  position: relative; width: min(100%, 470px); padding: 46px 30px 28px 52px; border-radius: 8px;
  background-color: var(--surface);
  background-image:
    linear-gradient(90deg, transparent 34px, color-mix(in srgb, var(--like) 50%, transparent) 34px, color-mix(in srgb, var(--like) 50%, transparent) 36px, transparent 36px),
    repeating-linear-gradient(to bottom, transparent 0 31px, color-mix(in srgb, var(--pop-sky) 45%, transparent) 31px 32px);
  background-position: 0 0, 0 22px;
  box-shadow: 0 30px 60px -30px var(--shadow-strong);
  transform: rotate(2deg);
}
.note-line { display: grid; gap: 14px; }
.note-quote { font-family: var(--reading); font-size: 1.12rem; line-height: 32px; color: var(--ink); }
.note-margin {
  font-family: var(--reading); font-style: italic; font-size: 1.02rem; line-height: 32px; color: var(--primary);
  padding-left: 14px; border-left: 3px solid var(--highlight);
}
:root[data-theme="midnight"] .note-margin { color: #B69CFF; }
.note-foot { display: flex; align-items: center; gap: 10px; margin-top: 22px; font-family: var(--ui); font-size: .88rem; color: var(--ink-2); }
.note-foot b { color: var(--ink); }
.soon-seal {
  position: absolute; top: -26px; right: -14px; display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%;
  background: var(--highlight); color: var(--on-highlight); text-align: center;
  font-family: var(--ui); font-size: .72rem; font-weight: 800; letter-spacing: .14em; line-height: 1.25; text-transform: uppercase;
  box-shadow: 0 0 0 5px var(--page), 0 0 0 7px var(--highlight);
  transform: rotate(12deg);
}
:root[data-theme="midnight"] .soon-seal { box-shadow: 0 0 0 5px var(--page), 0 0 0 7px var(--highlight), 0 0 40px 0 var(--glow); }

/* Two reading lights */
.lights { background: var(--page-deep); transition: background-color .5s var(--ease); }
.light-cards { display: grid; gap: 22px; max-width: 900px; margin: 0 auto; }
.light-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 30px; text-align: left;
  border-radius: var(--radius); border: 2px solid transparent; cursor: pointer; font: inherit;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .3s;
}
.light-card:hover { transform: translateY(-4px); }
.light-card.rr { background: #FBF7EF; color: #14231E; box-shadow: 0 18px 40px -26px rgba(15, 60, 45, .35); }
.light-card.mb { background: #16123A; color: #F5F0FF; box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .5); }
.light-card[aria-pressed="true"].rr { border-color: #0F7B5F; }
.light-card[aria-pressed="true"].mb { border-color: #C6F432; box-shadow: 0 0 36px -8px rgba(198, 244, 50, .45); }
.swatches { display: flex; gap: 6px; }
.swatches i { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.light-name { font-size: 1.85rem; line-height: 1.1; }
.rr .light-name { font-family: 'Young Serif', Georgia, serif; }
.mb .light-name { font-family: 'Instrument Serif', Georgia, serif; font-style: italic; font-size: 2.2rem; }
.light-desc { font-size: 1rem; line-height: 1.55; }
.rr .light-desc { font-family: 'Literata', Georgia, serif; color: #4E5F58; }
.mb .light-desc { font-family: 'Source Serif 4', Georgia, serif; color: #B7B0D9; }
.light-cta { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 9px 16px; border-radius: 999px; font-family: var(--ui); font-size: .9rem; font-weight: 650; }
.rr .light-cta { background: #0F7B5F; color: #FFFFFF; }
.mb .light-cta { background: #C6F432; color: #16123A; }
.light-cta .ico { width: 18px; height: 18px; }
.light-card .when-on, .light-card[aria-pressed="true"] .when-off { display: none; }
.light-card[aria-pressed="true"] .when-on { display: inline; }

/* House rules: a library card */
.rules-grid { display: grid; gap: 48px; align-items: start; }
.library-card {
  list-style: none; margin: 0; padding: 10px 0; background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 1px 0 var(--border), 0 22px 44px -28px var(--shadow-strong);
  background-image: linear-gradient(var(--highlight), var(--highlight)); background-size: 100% 8px; background-repeat: no-repeat;
  padding-top: 18px;
}
:root[data-theme="midnight"] .library-card { border: 1px solid var(--border); }
.library-card li { display: flex; gap: 18px; padding: 20px 26px; border-bottom: 1px dashed var(--border); color: var(--ink-2); font-size: 1rem; line-height: 1.6; }
.library-card li:last-child { border-bottom: 0; }
.library-card b { color: var(--ink); font-weight: 600; }
.rule-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.rule-icon.age { font-family: var(--ui); font-size: .82rem; font-weight: 800; }

/* FAQ */
.faq-wrap { max-width: 880px; }
.faq { border-top: 1px solid var(--border); }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 4px; cursor: pointer; list-style: none;
  font-family: var(--display); font-size: calc(1.28rem * var(--display-scale)); line-height: 1.3;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .ico { width: 22px; height: 22px; color: var(--primary); transition: transform .3s var(--ease); }
.faq details[open] summary .ico { transform: rotate(45deg); }
.faq summary:hover { color: var(--primary); }
.faq details p { margin: -6px 0 0; padding: 0 44px 26px 4px; color: var(--ink-2); }

/* Final call */
.final { padding: 0 0 clamp(80px, 10vw, 128px); }
.final-inner { position: relative; text-align: center; max-width: 820px; }
.final-mark {
  display: block; font-family: var(--display); font-size: calc(9rem * var(--display-scale)); line-height: .9; color: var(--highlight);
  margin-bottom: 10px;
}
:root[data-theme="midnight"] .final-mark { text-shadow: 0 0 50px var(--glow); }
.final h2 { margin-bottom: 18px; }
.final p { color: var(--ink-2); font-size: 1.15rem; margin-bottom: 34px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 48px 0 28px; background: var(--page-deep); transition: background-color .5s var(--ease); }
.footer-row { display: grid; gap: 28px; }
.footer-brand p { margin: 14px 0 0; color: var(--ink-2); font-size: .98rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.footer-nav a { font-family: var(--ui); font-size: .95rem; font-weight: 550; color: var(--ink-2); text-decoration: none; }
.footer-nav a:hover { color: var(--ink); }
.footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--border); font-family: var(--ui); font-size: .85rem; color: var(--ink-2); }

/* ---------- Not found ---------- */
.lost { min-height: calc(100vh - 72px); min-height: calc(100dvh - 72px); display: grid; place-items: center; text-align: center; padding: 48px 0; }
.lost h1 { font-size: calc(clamp(2.4rem, 6vw, 4rem) * var(--display-scale)); margin: 22px 0 16px; }
.lost h1 em { color: var(--primary); }
.lost p { color: var(--ink-2); font-size: 1.12rem; max-width: 28em; margin: 0 auto 30px; }
.due-stamp {
  display: inline-block; padding: 8px 18px; border: 3px solid var(--like); border-radius: 10px; color: var(--like);
  font-family: var(--ui); font-weight: 800; letter-spacing: .2em; text-transform: uppercase; transform: rotate(-6deg);
}

/* ---------- Larger screens ---------- */
@media (min-width: 640px) {
  .features { grid-template-columns: repeat(2, 1fr); }
  .light-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .site-nav { display: flex; }
  .hero-grid { grid-template-columns: 1.05fr .95fr; }
  .hero-art { min-height: 640px; }
  .next-grid { grid-template-columns: 1fr 1fr; gap: 72px; }
  .rules-grid { grid-template-columns: .9fr 1.1fr; gap: 72px; }
  .rules-grid > div { position: sticky; top: 110px; }
  .footer-row { grid-template-columns: 1fr auto; align-items: start; }
}
@media (min-width: 1040px) {
  .features { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Small screens ---------- */
@media (max-width: 899px) {
  .hero-copy { text-align: left; }
  .index-card { left: -4px; bottom: -30px; width: 220px; padding: 22px 16px 14px 28px; }
  .toast { right: -4px; top: 0; }
}
@media (max-width: 520px) {
  .header-row { gap: 12px; }
  .brand { gap: 9px; }
  .brand-name { font-size: calc(1.02rem * var(--display-scale)); }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: calc(1.3rem * var(--display-scale)); }
  .brand-mark::before { left: 5px; right: 5px; bottom: 4px; height: 5px; }
  .header-actions { gap: 8px; }
  .theme-toggle { width: 38px; height: 38px; }
  .header-actions .btn-small { min-height: 38px; padding: 0 13px; font-size: .82rem; }
  .cta-row .btn { flex: 1 1 100%; }
  .hero-art { min-height: 560px; margin: 0 -8px 64px; }
  .phone { width: 262px; height: 540px; border-radius: 42px; }
  .screen { border-radius: 33px; }
  .index-card { width: 196px; bottom: -96px; }
  .index-card blockquote { font-size: 12.5px; line-height: 22px; }
  .index-card figcaption { font-size: 12px; line-height: 22px; }
  .toast { font-size: 12px; top: -6px; }
  .shelf { height: 150px; gap: 4px; }
  .spine { font-size: 9.5px; width: calc(var(--w) * .72); }
  .hide-sm { display: none; }
  .feature { padding: 28px 22px 22px; }
  .library-card li { padding: 18px 18px; gap: 14px; }
  .faq details p { padding-right: 4px; }
  .soon-seal { width: 78px; height: 78px; right: -4px; font-size: .64rem; }
  .note-card { padding: 42px 22px 24px 46px; }
}
@media (max-width: 380px) {
  .header-actions .btn-small { display: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .rise, .js .reveal { opacity: 1; transform: none; }
  .js .scribble path { stroke-dashoffset: 0; }
}
