/* Tokens mirror the app's asset catalog (BooksiePaper / Card / Ink / Muted / Accent). */
:root {
  --paper: #faf8f5;
  --card: #ffffff;
  --ink: #1c1917;
  --muted: #78716c;
  --blue: #007aff; /* the desktop app's Color.blue */
  --blue-a: #d6e6ff;
  --blue-b: #e9f1ff;
  --blue-c: #f2f2fa;
  --accent: #0f5257;
  --accent-ink: #ffffff;
  --line: rgba(28, 25, 23, 0.09);
  --stage-a: #dcebe9;
  --stage-b: #eef3f0;
  --stage-c: #f4efe7;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.05), 0 12px 32px -8px rgba(28, 25, 23, 0.14);

  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;
  --serif: Georgia, "Times New Roman", serif;

  --r-lg: 20px;
  --r-md: 14px;
  --gutter: clamp(16px, 4vw, 40px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1c1917;
    --card: #292524;
    --ink: #faf8f5;
    --muted: #a8a29e;
    --blue: #0a84ff;
    --blue-a: #143053;
    --blue-b: #182640;
    --blue-c: #1e2230;
    --accent: #5ec4b6;
    --accent-ink: #10201e;
    --line: rgba(250, 248, 245, 0.1);
    --stage-a: #1f3532;
    --stage-b: #222826;
    --stage-c: #262220;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -8px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: 1200px; margin-inline: auto; padding-inline: var(--gutter); }
section.wrap { padding-block: clamp(56px, 9vw, 120px) 0; }

/* Type */
h1, h2, h3 { font-weight: 500; letter-spacing: -0.03em; line-height: 1.04; }
h1 { font-size: clamp(2.6rem, 7vw, 5rem); }
h2.big { font-size: clamp(2.2rem, 5vw, 3.6rem); }
.soft, .soft-h { color: var(--muted); }
.lede { color: var(--muted); font-size: clamp(1.05rem, 1.6vw, 1.2rem); max-width: 34em; }
.eyebrow {
  display: flex; align-items: center; gap: 8px;
  font: 500 12px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 20px;
}
.em { font-size: 13px; line-height: 1; flex: none; }
.fine { text-align: center; color: var(--muted); font-size: 13px; margin-top: 16px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding-inline: 20px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 500; font-size: 15px; transition: background-color .2s, opacity .2s, transform .2s;
}
.btn:active { transform: scale(0.98); }
.btn-sm { height: 36px; padding-inline: 16px; font-size: 14px; }
.btn-dark { background: var(--ink); color: var(--paper); }
.btn-dark:hover { opacity: 0.86; }
.btn-ghost { background: var(--card); border-color: var(--line); }
.btn-ghost:hover { background: color-mix(in srgb, var(--card) 70%, var(--ink) 6%); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover:not(:disabled) { opacity: 0.88; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.ico { width: 18px; height: 18px; fill: currentColor; flex: none; }
.btn-sm .ico { width: 16px; height: 16px; }
.platforms { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.platforms.center { justify-content: center; }
.plat { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.plat em { font-style: normal; font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; opacity: .8; }

/* Nav */
.nav {
  max-width: 1200px; margin-inline: auto; padding: 20px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.wordmark { font: 400 1.6rem/1 var(--serif); letter-spacing: -0.02em; }
.wordmark.sm { font-size: 1.25rem; }
.nav-links { display: flex; gap: 28px; font-size: 14px; color: var(--muted); margin-left: auto; }
.nav-links a:hover { color: var(--ink); }

/* Stages: soft tinted plates that hold real app screenshots */
.stage {
  position: relative; overflow: hidden; border-radius: var(--r-lg);
  background: linear-gradient(155deg, var(--stage-a), var(--stage-b) 55%, var(--stage-c));
}
.shot { border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); background: #fff; line-height: 0; }
.shot.bare { background: none; box-shadow: none; border-radius: 0; }
.shot.bare img { max-width: 760px; margin-inline: auto; }
.shot img { width: 100%; height: auto; display: block; }
.stage-hero {
  padding: clamp(16px, 4vw, 56px); margin: 0;
  background:
    radial-gradient(60% 70% at 8% 0%, rgba(143, 201, 192, .55), transparent 70%),
    radial-gradient(50% 60% at 100% 20%, rgba(232, 201, 160, .5), transparent 70%),
    radial-gradient(60% 60% at 60% 110%, rgba(157, 180, 214, .5), transparent 70%),
    var(--stage-b);
}
.collage { position: relative; max-width: 1000px; margin-inline: auto; padding-bottom: 14%; }
.collage .back { width: 82%; }
.collage .card { position: absolute; right: 0; bottom: 0; width: 40%; border-radius: 3.4%; box-shadow: 0 30px 70px -18px rgba(15, 40, 40, .45), 0 2px 8px rgba(0, 0, 0, .08); }
.stage-how { min-height: 0; padding: clamp(16px, 3vw, 40px); display: grid; }
.panel[hidden] { display: none; }
.card.solo { position: static; width: min(440px, 100%); margin-inline: auto; border-radius: 3.4%; }
.tile { aspect-ratio: 1 / 1; overflow: hidden; border-radius: var(--r-lg); border: 1px solid var(--line); background: #fff; line-height: 0; }
.tile img { width: 100%; height: 100%; object-fit: cover; object-position: 0 0; display: block; }
.tile-listen { position: relative; background: linear-gradient(155deg, var(--stage-a), var(--stage-b) 55%, var(--stage-c)); }
.tile-listen img { position: absolute; left: 9%; bottom: 9%; width: 175%; max-width: none; height: auto; border-radius: 12px; border: 1px solid var(--line); background: #fff; }

/* Hero */
.hero { padding-top: clamp(24px, 5vw, 64px); }
.hero-head { display: grid; gap: 0; margin-bottom: clamp(32px, 5vw, 56px); }
.hero-head .lede { margin-top: 24px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.hero-cta.center { justify-content: center; }

/* How it works */
.how-main { min-width: 0; }
.how { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: clamp(24px, 4vw, 64px); align-items: start; }
.tabs { list-style: none; padding: 0; display: grid; gap: 2px; margin-bottom: 28px; }
.tab {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 0;
  background: none; border: 0; text-align: left;
  font: 500 13px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  transition: color .2s;
}
.tab .em { opacity: 0; transition: opacity .2s; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"] .em { opacity: 1; }
.quote { background: color-mix(in srgb, var(--ink) 4%, var(--paper)); border-radius: var(--r-md); padding: 24px; }
.quote-text { font: 400 1.35rem/1.3 var(--serif); letter-spacing: -0.01em; }
.quote-src { margin-top: 16px; font-size: 13px; color: var(--muted); }
.how-head { margin-bottom: 28px; }
.how-head h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
.soft-h { font-size: clamp(1.8rem, 3.6vw, 2.6rem); font-weight: 500; letter-spacing: -0.03em; line-height: 1.08; margin-top: 4px; }
/* Features */
.feat-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 40px; }
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feat h3 { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; letter-spacing: -0.01em; margin: 20px 0 8px; line-height: 1.3; }
.feat h3 svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.feat p { color: var(--muted); font-size: 15px; max-width: 30em; }
/* Rules */
.rules { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(32px, 6vw, 96px); }
.rules-lead .lede { margin-top: 24px; }
.rule-list { border-top: 1px solid var(--line); }
.rule-list > div { padding: 22px 0; border-bottom: 1px solid var(--line); }
.rule-list dt { font: 400 1.4rem/1.2 var(--serif); letter-spacing: -0.01em; }
.rule-list dd { margin-top: 6px; color: var(--muted); font-size: 15px; max-width: 34em; }

/* CTA + footer */
.stage-cta { text-align: center; padding: clamp(56px, 10vw, 112px) 20px; display: grid; justify-items: center; }
.stage-cta .lede { margin-top: 18px; }
.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-block: 48px 40px; color: var(--muted); font-size: 14px; align-items: baseline; }
.foot .wordmark { color: var(--ink); }

/* Responsive */
@media (max-width: 960px) {
  .how, .rules { grid-template-columns: 1fr; }
  .tabs { display: flex; gap: 20px; overflow-x: auto; margin-bottom: 20px; }
  .tab { width: auto; white-space: nowrap; }
  .quote { display: none; }
  .feat-grid { grid-template-columns: 1fr; }
  .tile { aspect-ratio: 4 / 3; }
}
@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav { justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* Download dropdown + modal */
.chev { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; margin-left: 2px; opacity: .75; }
.btn .free { opacity: .55; font-weight: 400; }
.btn-sm .chev { width: 12px; height: 12px; }
.dl { margin: auto; border: 0; border-radius: var(--r-lg); padding: 24px; width: min(440px, calc(100vw - 32px)); background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .4); }
.dl::backdrop { background: rgba(28, 25, 23, .45); backdrop-filter: blur(4px); }
.dl-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.dl-head h2 { font-size: 1.35rem; letter-spacing: -0.02em; line-height: 1.2; }
.dl-x { width: 32px; height: 32px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--ink) 7%, transparent); font-size: 20px; line-height: 1; flex: none; }
.dl-x:hover { background: color-mix(in srgb, var(--ink) 12%, transparent); }
.dl-sub { color: var(--muted); margin: 6px 0 18px; font-size: 15px; }
.dl-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.dl-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); transition: border-color .2s, background-color .2s; }
.dl-opt:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.dl-name { font-weight: 500; display: grid; gap: 2px; }
.dl-name em { font-style: normal; font-weight: 400; font-size: 13px; color: var(--muted); }
.dl-tag { font: 500 11px/1 var(--mono); letter-spacing: .06em; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 5px 8px; border-radius: 5px; }
.dl-hint { margin-top: 16px; font-size: 13px; color: var(--muted); }
.dl-group + .dl-group { margin-top: 20px; }
.dl-group-title {
  font: 500 12px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.dl-new {
  font: 500 10px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent-ink); background: var(--accent);
  padding: 4px 7px; border-radius: 5px;
}

/* Platform pills that open the download modal. */
.plat-go {
  all: unset; cursor: pointer;
  font: 500 11px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); border-radius: 4px;
}
.plat-go:hover { text-decoration: underline; }

/* Closing panel uses the app's blue. */
.stage.stage-cta {
  background:
    radial-gradient(70% 90% at 50% 0%, color-mix(in srgb, var(--blue) 26%, transparent), transparent 70%),
    linear-gradient(155deg, var(--blue-a), var(--blue-b) 55%, var(--blue-c));
}

/* Button hover: a soft light follows the pointer; the button lifts and settles on press. */
.btn { position: relative; overflow: hidden; isolation: isolate; }
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; pointer-events: none;
  background: radial-gradient(90px circle at var(--bx, 50%) var(--by, 50%), rgba(255, 255, 255, .28), transparent 70%);
  transition: opacity .25s ease;
}
.btn-ghost::before { background: radial-gradient(90px circle at var(--bx, 50%) var(--by, 50%), color-mix(in srgb, var(--ink) 9%, transparent), transparent 70%); }
.btn:hover::before { opacity: 1; }
.btn-dark:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -8px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .06) inset; }
.btn-ghost:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--ink) 22%, transparent); box-shadow: 0 8px 18px -10px rgba(0, 0, 0, .3); }
.btn:active { transform: translateY(0) scale(.97); box-shadow: none; transition-duration: .08s; }
.btn:focus-visible { outline-offset: 3px; }
@media (hover: none) { .btn::before { display: none; } }
@media (prefers-reduced-motion: reduce) { .btn::before { display: none; } .btn:hover { transform: none; } }

/* --- Subtle motion ---------------------------------------------------- */
:root { --ease: cubic-bezier(.2, .7, .2, 1); }
html, body { overflow-x: clip; }

/* Nav: sticks, and frosts once the page scrolls. */
.nav { position: sticky; top: 0; z-index: 20; }
.nav::before {
  content: ""; position: absolute; inset: 0 auto 0 50%; width: 100vw; transform: translateX(-50%); z-index: -1;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line); opacity: 0; transition: opacity .25s var(--ease);
}
.nav.scrolled::before { opacity: 1; }
.nav-links a { position: relative; transition: color .2s; }
.nav-links a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }
.nav-links a.active { color: var(--ink); }

/* Sections ease in (only when JS has marked them). */
.js [data-r] { opacity: 0; transform: translateY(16px); transition: opacity .7s var(--ease) var(--d, 0ms), transform .7s var(--ease) var(--d, 0ms); }
.js [data-r].in { opacity: 1; transform: none; }

/* Buttons: smooth lift, arrow nudges. */
.btn { transition: background-color .2s, opacity .2s, transform .2s var(--ease), box-shadow .2s, border-color .2s; }
.btn .chev { transition: transform .2s var(--ease); }
.btn:hover .chev { transform: translateY(2px); }
.btn-ghost span[aria-hidden] { display: inline-block; transition: transform .25s var(--ease); }
.btn-ghost:hover span[aria-hidden] { transform: translateX(3px); }

/* Hero cards drift with the pointer. */
.collage .back, .collage .card { transition: transform .5s var(--ease); will-change: transform; }
.collage .back { transform: translate(calc(var(--mx, 0) * -6px), calc(var(--my, 0) * -4px)); }
.collage .card { transform: translate(calc(var(--mx, 0) * 10px), calc(var(--my, 0) * 8px)); }

/* How it works: panels and copy fade between tabs. */
.panel.enter { animation: rise .45s var(--ease); }
.how-head, .quote { transition: opacity .14s ease; }
.how-head.swap, .quote.swap { opacity: 0; }
.tab { transition: color .2s, transform .2s var(--ease); }
.tab:hover { transform: translateX(2px); }

/* Feature tiles lift on hover. */
.tile { transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.feat:hover .tile { transform: translateY(-4px); box-shadow: var(--shadow); }
.tile img { transition: transform .7s var(--ease); }
.feat:hover .tile:not(.tile-listen) img { transform: scale(1.03); }
.feat:hover .tile-listen img { transform: scale(1.03); transform-origin: left bottom; }

/* Rules nudge on hover. */
.rule-list > div { transition: transform .3s var(--ease); }
.rule-list > div:hover { transform: translateX(6px); }

/* Modal. */
.dl[open] { animation: pop .25s var(--ease); }
.dl[open]::backdrop { animation: fade .25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .js [data-r] { opacity: 1; transform: none; }
  .panel.enter, .dl[open], .dl[open]::backdrop { animation: none; }
  .collage .back, .collage .card { transform: none; }
}

/* Download options: version and size on the right. */
.dl-side { display: grid; justify-items: end; gap: 4px; flex: none; }
.dl-size { font-size: 12px; color: var(--muted); }
