/* Write On! — light paper-blue, white cards, navy ink, blue to press, amber for rewards. Tokens from brand/BRAND.md. */

:root {
  --bg: #F4F9FD;
  --bg-alt: #E9F3FB;
  --surface: #FFFFFF;
  --surface-ink: #12354F;
  --on-surface-ink: #EAF2FA;
  --ink: #12354F;
  --ink-muted: #4D6480;
  --ink-faint: #6E8299;
  --primary: #1F6FB2;
  --primary-hover: #2E7FC2;
  --primary-on: #FFFFFF;
  --primary-soft: #E9F3FB;
  --link: #1F6FB2;
  --accent: #F2A65A;
  --accent-on: #12354F;
  --accent-soft: #FDEFE0;
  --accent-text: #B4651A;
  --border: #DCE8F3;
  --border-strong: #C2D6E8;
  --fill: rgba(18, 53, 79, 0.05);
  --fill-strong: rgba(18, 53, 79, 0.09);
  --sky: #97CDF4;
  --sky-soft: #C9E5FB;

  /* The nine stages: one blue ramp. */
  --s1: #C9E5FB; --s2: #AFD9F8; --s3: #97CDF4; --s4: #7DBDEE; --s5: #63ADE7;
  --s6: #4A9CDD; --s7: #3789CE; --s8: #2A76B8; --s9: #1F6FB2;

  /* Book covers are printed things: they keep their colors in every theme. */
  --c-navy: #12354F; --c-blue: #1F6FB2; --c-violet: #6B4FD0; --c-teal: #0E7E99;
  --c-indigo: #4A5BA8; --c-amber: #B4651A; --c-rose: #C2453F;

  --sans: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;

  --max: 1160px;
  --gutter: clamp(20px, 5vw, 40px);
  --section: clamp(80px, 10vw, 128px);
  --radius: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 2px 8px rgba(18, 53, 79, 0.06);
  --shadow-md: 0 8px 20px rgba(18, 53, 79, 0.1);
  --shadow-lg: 0 16px 34px rgba(18, 53, 79, 0.14);
}

/* Dark is opt-in: the theme toggle sets data-theme="dark". Light is the default for everyone. */
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0D1B2A;
  --bg-alt: #101F31;
  --surface: #13263A;
  --surface-ink: #19304A;
  --on-surface-ink: #EAF2FA;
  --ink: #EAF2FA;
  --ink-muted: #A9BED4;
  --ink-faint: #8098B2;
  --primary: #6FB2E8;
  --primary-hover: #8FC6F0;
  --primary-on: #0D1B2A;
  --primary-soft: #15304A;
  --link: #8FC6F0;
  --accent-on: #0D1B2A;
  --accent-soft: #38291A;
  --accent-text: #F2A65A;
  --border: #24405C;
  --border-strong: #33557A;
  --fill: rgba(234, 242, 250, 0.06);
  --fill-strong: rgba(234, 242, 250, 0.11);
  --sky: #BFE0FA;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 34px rgba(0, 0, 0, 0.35);
}

/* ---------------------------------------------------------------- Base */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, figure, dl, dd, ol, blockquote { margin: 0; }
ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }

h1, h2, h3 { font-weight: 800; letter-spacing: -0.02em; text-wrap: balance; }
/* Plus Jakarta's heavy weights set full stops and commas a little loose; pull them back in headings. */
.pt { margin-left: -0.07em; }
h1 { font-size: clamp(3rem, 8vw, 5.5rem); line-height: 1.04; letter-spacing: -0.035em; }
h2 { font-size: clamp(2.1rem, 4.6vw, 3.25rem); line-height: 1.1; }
h3 { font-size: 1.5rem; line-height: 1.25; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.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: -60px; z-index: 30;
  padding: 10px 16px; border-radius: 999px;
  background: var(--primary); color: var(--primary-on); text-decoration: none; font-weight: 700;
}
.skip:focus { top: 12px; }

:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: 8px; }

/* The section eyebrow: the logo's three written lines, then the label. */
.label {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px;
  font: 700 13px/1.2 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}
.label::before {
  content: ''; width: 18px; height: 13px; flex: none;
  background:
    linear-gradient(var(--sky), var(--sky)) 0 0 / 12px 3px no-repeat,
    linear-gradient(var(--sky), var(--sky)) 0 5px / 18px 3px no-repeat,
    linear-gradient(var(--sky), var(--sky)) 0 10px / 9px 3px no-repeat;
}

.lede { font-size: clamp(1.15rem, 2vw, 1.3rem); line-height: 1.55; color: var(--ink-muted); max-width: 34ch; }
.fine { font-size: 15px; line-height: 1.5; color: var(--ink-muted); }
.muted { color: var(--ink-muted); }

.prose { display: grid; gap: 1em; font-size: clamp(1.0625rem, 1.5vw, 1.125rem); line-height: 1.65; color: var(--ink-muted); max-width: 38em; }

/* Buttons: blue to press. One filled, one outlined. */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  height: 54px; padding: 0 28px; border-radius: 999px;
  background: var(--primary); color: var(--primary-on);
  font: 700 17px/1 var(--sans); text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, background 0.15s ease;
}
.button:hover { background: var(--primary-hover); }
.button:active { transform: scale(0.98); }
.button-secondary { background: var(--surface); color: var(--primary); border: 2px solid var(--border-strong); box-shadow: none; }
.button-secondary:hover { background: var(--primary-soft); }
.button-light { background: #FFFFFF; color: #12354F; }
.button-light:hover { background: #EAF2FA; }

.section { padding-block: var(--section); }
.section-alt { background: var(--bg-alt); }

.split { display: grid; gap: 28px; align-items: start; }
@media (min-width: 900px) {
  .split { grid-template-columns: 5fr 6fr; gap: 64px; }
  .split-center { align-items: center; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

/* ---------------------------------------------------------------- Nav */

.nav {
  position: sticky; top: 0; z-index: 20;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.nav.scrolled { background: var(--surface); border-bottom-color: var(--border); box-shadow: var(--shadow-sm); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }

.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { height: 48px; width: auto; }

.nav-links { display: flex; gap: 32px; }
.nav-links a { font-size: 16px; font-weight: 700; text-decoration: none; color: var(--ink); transition: color 0.15s ease; }
.nav-links a:hover { color: var(--primary); }

.nav-end { display: flex; align-items: center; gap: 20px; }
.theme-toggle {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid var(--border-strong); background: var(--surface); color: var(--ink); cursor: pointer;
  transition: border-color 0.15s ease;
}
.theme-toggle:hover { border-color: var(--primary); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .moon,
[data-theme='dark'] .theme-toggle .sun { display: block; }
.theme-toggle .sun,
[data-theme='dark'] .theme-toggle .moon { display: none; }

/* The logo follows the chosen theme. */
.logo-dark,
[data-theme='dark'] .logo-light { display: none; }
[data-theme='dark'] .logo-dark { display: block; }

.nav-toggle { display: none; }

@media (max-width: 759px) {
  .brand img { height: 40px; }
  .nav-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 6px;
    width: 44px; height: 44px; margin-right: -10px; padding: 0 10px;
    background: none; border: 0; cursor: pointer;
  }
  .nav-toggle-bar { display: block; height: 2.5px; border-radius: 2px; background: var(--ink); transition: transform 0.2s ease; }
  .nav.open .nav-toggle-bar:first-of-type { transform: translateY(4px) rotate(45deg); }
  .nav.open .nav-toggle-bar:last-of-type { transform: translateY(-4px) rotate(-45deg); }
  .nav.open { background: var(--surface); }

  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0;
    padding: 4px var(--gutter) 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    display: none;
  }
  .nav.open .nav-links { display: flex; }
  .nav-links a { padding: 14px 0; font-size: 19px; border-bottom: 1px solid var(--border); }
  .nav-links a:last-child { border-bottom: 0; }
}

/* ---------------------------------------------------------------- Hero */

.hero { padding-top: clamp(32px, 6vw, 72px); padding-bottom: var(--section); }
.hero-grid { display: grid; gap: 56px; align-items: center; }
.hero-copy h1 { margin-bottom: 24px; }
.hero-copy .lede { margin-bottom: 32px; max-width: 30em; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-copy .fine { margin-top: 22px; }

@media (min-width: 960px) {
  .hero-grid { grid-template-columns: 1.15fr 0.85fr; }
}

/* The phone: a sketch of the app's story path, in the app's own colors. */
.phone {
  justify-self: center;
  width: min(300px, 100%);
  padding: 10px;
  border-radius: 48px;
  background: #12354F;
  box-shadow: var(--shadow-lg);
}
.phone-screen {
  position: relative;
  height: 600px;
  overflow: hidden;
  border-radius: 38px;
  background: #F4F9FD;
  color: #12354F;
  padding: 0 18px;
}
.phone-screen::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 90px;
  background: linear-gradient(to bottom, rgba(244, 249, 253, 0), #F4F9FD);
}
.ph-status { display: flex; align-items: center; justify-content: space-between; height: 46px; font: 700 12px/1 var(--sans); padding: 0 8px; }
.ph-island { width: 78px; height: 22px; border-radius: 12px; background: #000; }
.ph-dots { font-size: 6px; letter-spacing: 1px; }
.ph-head { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: end; margin-top: 14px; }
.ph-title { font: 800 19px/1.2 var(--sans); letter-spacing: -0.02em; }
.ph-meta { font-size: 11px; color: #4D6480; margin-top: 2px; }
.ph-meter { display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; margin-top: 16px; }
.ph-meter i { height: 7px; border-radius: 4px; background: rgba(18, 53, 79, 0.09); position: relative; overflow: hidden; }
.ph-meter .done.s1 { background: var(--s1); }
.ph-meter .done.s2 { background: var(--s2); }
.ph-meter .half::after { content: ''; position: absolute; inset: 0 50% 0 0; background: var(--s3); border-radius: 4px; }
.ph-note { font-size: 11px; color: #4D6480; margin: 14px 0 6px; }
.ph-path { position: relative; }
.ph-path::before { content: ''; position: absolute; left: 15px; top: 20px; bottom: 20px; border-left: 2px dotted #C2D6E8; }
.ph-path li { position: relative; display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: center; height: 50px; }
.ph-path b {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  font: 700 12px/1 var(--sans); color: #4D6480;
  background: #FFFFFF; border: 1.5px solid #C2D6E8;
}
.ph-path li span { font: 700 14px/1.25 var(--sans); }
.ph-path small { display: block; font: 500 10.5px/1.3 var(--sans); color: #4D6480; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-path em { font: 800 8.5px/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; font-style: normal; color: #B4651A; margin-left: 6px; vertical-align: 2px; }
.ph-path .done b { border: 0; color: #12354F; font-size: 13px; }
.ph-path .done.s1 b { background: var(--s1); }
.ph-path .done.s2 b { background: var(--s2); }
.ph-path .next b { border: 3px solid var(--s3); color: #12354F; box-shadow: 0 0 0 4px #FFFFFF, 0 0 0 7px var(--accent); }

/* ---------------------------------------------------------------- Covers */

.cover {
  --w: 190px;
  --c: var(--c-navy);
  position: relative;
  width: var(--w);
  aspect-ratio: 2 / 3;
  border-radius: calc(var(--w) * 0.04);
  overflow: hidden;
  flex: none;
  box-shadow: 0 16px 28px -14px rgba(18, 53, 79, 0.5), 0 2px 4px rgba(18, 53, 79, 0.12);
}
.cover::before { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 3%; background: rgba(0, 0, 0, 0.14); z-index: 1; }
.cover::after { content: ''; position: absolute; top: 0; bottom: 0; left: 3%; width: 1px; background: rgba(255, 255, 255, 0.18); z-index: 1; }
.c-navy { --c: var(--c-navy); }
.c-blue { --c: var(--c-blue); }
.c-violet { --c: var(--c-violet); }
.c-teal { --c: var(--c-teal); }
.c-indigo { --c: var(--c-indigo); }
.c-amber { --c: var(--c-amber); }
.c-rose { --c: var(--c-rose); }
.cover-title { font-weight: 800; letter-spacing: -0.02em; text-wrap: balance; }

.cover-classic { background: var(--c); padding: calc(var(--w) * 0.05); }
.cover-classic .cover-frame {
  height: 100%; border: 1px solid rgba(255, 255, 255, 0.5); border-radius: calc(var(--w) * 0.06);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12%;
  padding: 12%; text-align: center;
}
.cover-classic .cover-title { color: #FFFFFF; font-size: calc(var(--w) * 0.105); line-height: 1.15; }
.cover-classic .cover-line { width: 18%; height: 3px; border-radius: 2px; background: var(--accent); }

.cover-plate { background: #F4F9FD; }
.cover-plate img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.cover-plate .cover-rule { display: block; height: 2.5%; background: var(--c); }
.cover-plate .cover-title { display: block; padding: 9%; color: #12354F; font-size: calc(var(--w) * 0.095); line-height: 1.2; }

.cover-band { background: #F4F9FD; display: flex; flex-direction: column; justify-content: center; }
.cover-band .band-fill { display: block; background: var(--c); padding: 14% 10%; text-align: center; }
.cover-band .cover-title { color: #FFFFFF; font-size: calc(var(--w) * 0.095); line-height: 1.18; }

.cover-minimal { background: var(--c); padding: calc(var(--w) * 0.1); }
.cover-minimal .cover-title { display: block; color: #FFFFFF; font-size: calc(var(--w) * 0.13); line-height: 1.06; }

.cover-xs { --w: 54px; box-shadow: 0 6px 10px -6px rgba(18, 53, 79, 0.5); }
.cover-xs .cover-frame { padding: 8%; border-radius: 3px; }
.cover-xs .cover-title { font-size: 6.5px; }

/* The published stamp: navy, ringed in amber. */
.stamp {
  position: absolute; left: 50%; top: 74%; z-index: 2;
  transform: translate(-50%, -50%) rotate(-10deg);
  padding: 3px; border: 3px solid var(--accent); border-radius: 16px;
  background: #12354F; color: #FFFFFF; text-align: center;
}
.stamp i { display: block; font-style: normal; color: var(--accent); font-size: 13px; line-height: 1; padding-top: 6px; }
.stamp b { display: block; padding: 2px 14px 0; font: 800 15px/1.3 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; }
.stamp small { display: block; padding: 0 0 6px; font: 700 8.5px/1.4 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.stamp-sm { top: 80%; }
.stamp-sm b { font-size: 11px; padding: 1px 10px 6px; }
.stamp-sm i { font-size: 10px; padding-top: 4px; }

/* ---------------------------------------------------------------- Why it matters */

.stat { display: grid; justify-items: center; gap: 22px; text-align: center; }
.stat-ring {
  display: grid; place-items: center;
  width: clamp(180px, 22vw, 220px); aspect-ratio: 1;
  border-radius: 50%;
  border: 12px solid var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.stat-ring span { font: 800 clamp(3rem, 6vw, 3.9rem)/1 var(--sans); letter-spacing: -0.04em; }
.stat figcaption { max-width: 26em; display: grid; gap: 10px; }
.stat figcaption p { font-size: 17px; line-height: 1.55; }
.stat a { font-size: 14px; font-weight: 700; color: var(--link); }
h2 + .prose { margin-top: 24px; }

.turn { margin-top: clamp(48px, 7vw, 72px); padding-top: clamp(32px, 5vw, 48px); border-top: 2px solid var(--border); display: grid; gap: 14px; max-width: 46em; }
.turn-lead { font: 800 clamp(1.4rem, 2.6vw, 1.9rem)/1.3 var(--sans); letter-spacing: -0.02em; text-wrap: balance; }
.turn-more { font-size: 1.125rem; line-height: 1.65; color: var(--ink-muted); }

/* ---------------------------------------------------------------- The nine stages */

.stages {
  position: relative;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px 12px;
  margin-top: clamp(48px, 7vw, 80px);
}
.stages li {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  position: relative; font-weight: 700; font-size: 15px; text-align: center;
}
.stop {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  font: 800 17px/1 var(--sans); color: #12354F;
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow 0.4s ease;
}
.stop.s1 { background: var(--s1); } .stop.s2 { background: var(--s2); } .stop.s3 { background: var(--s3); }
.stop.s4 { background: var(--s4); } .stop.s5 { background: var(--s5); color: #FFFFFF; } .stop.s6 { background: var(--s6); color: #FFFFFF; }
.stop.s7 { background: var(--s7); color: #FFFFFF; } .stop.s8 { background: var(--s8); color: #FFFFFF; } .stop.s9 { background: var(--s9); color: #FFFFFF; }
.stages em {
  position: absolute; top: calc(100% + 4px);
  font: 800 11px/1 var(--sans); font-style: normal; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-text); white-space: nowrap;
  opacity: 0; transition: opacity 0.4s ease;
}
.stages .here .stop { box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px var(--accent); }
.stages .here em { opacity: 1; }

@media (min-width: 900px) {
  .stages { grid-template-columns: repeat(9, 1fr); }
  .stages::before { content: ''; position: absolute; top: 23px; left: 5.5%; right: 5.5%; height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--s1), var(--s9)); opacity: 0.45; }
}

/* ---------------------------------------------------------------- How it works */

.steps { display: grid; gap: clamp(64px, 9vw, 104px); margin-top: clamp(48px, 7vw, 72px); }
.step { display: grid; gap: 32px; align-items: center; }
.step-num { font: 800 15px/1 var(--sans); color: var(--primary); margin-bottom: 12px; }
.step-copy h3 { margin-bottom: 12px; }
.step-copy p:not(.step-num) { color: var(--ink-muted); max-width: 30em; }

@media (min-width: 900px) {
  .step { grid-template-columns: 5fr 7fr; gap: 72px; }
  .step:nth-child(even) .step-copy { order: 2; }
}

.genres { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px 16px; }
.genres figure { width: calc((100% - 32px) / 3); }
.genres img { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.genres figcaption { margin-top: 8px; font-size: 15px; font-weight: 800; }
.g-fantasy figcaption { color: #6B4FD0; } .g-scifi figcaption { color: #0E7E99; } .g-mystery figcaption { color: #4A5BA8; }
.g-comedy figcaption { color: #B4651A; } .g-friendship figcaption { color: #C2453F; }
[data-theme='dark'] .genres figcaption { color: var(--ink); }
@media (max-width: 520px) {
  .genres figure { width: calc((100% - 16px) / 2); }
}

.sheet { padding: 28px; max-width: 520px; margin-inline: auto; width: 100%; }
.sheet-label { font: 700 12px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--primary); }
.sheet-title { font: 800 28px/1.2 var(--sans); letter-spacing: -0.02em; margin: 6px 0 20px; }
.sheet-fields { display: grid; gap: 16px; }
.sheet-fields dt { font-weight: 700; font-size: 15px; }
.sheet-fields dd {
  margin-top: 6px; padding: 12px 16px;
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--radius-md);
  font-size: 16px; line-height: 1.5;
}
.saved { margin-top: 14px; font-size: 13px; font-weight: 600; color: var(--ink-faint); text-align: right; }

.compare { padding: 28px; max-width: 520px; margin-inline: auto; display: grid; gap: 18px; width: 100%; }
.compare-row span { display: block; font: 700 12px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 6px; }
.compare-row.after span { color: var(--accent-text); }
.compare-row p { font: 600 20px/1.45 var(--sans); }
.compare-row .muted { font-weight: 500; }
.compare-note { padding-top: 16px; border-top: 1px solid var(--border); font-size: 15px; color: var(--ink-muted); }

.publish { display: flex; justify-content: center; align-items: flex-end; gap: clamp(16px, 4vw, 36px); }
.publish .cover:first-child { --w: clamp(130px, 30vw, 190px); }
.publish .cover:last-child { --w: clamp(140px, 33vw, 210px); }

/* ---------------------------------------------------------------- See what you wrote */

.illustrate { padding: 22px; display: grid; gap: 16px; max-width: 540px; width: 100%; justify-self: center; }
.illustrate blockquote { font: 600 clamp(1.1rem, 2vw, 1.3rem)/1.5 var(--sans); padding: 4px 6px 0; }
.illustrate img { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: var(--radius-md); }
.illustrate figcaption { font-size: 14px; color: var(--ink-muted); }

/* ---------------------------------------------------------------- Keep going */

.rewards-art { display: grid; gap: 16px; max-width: 480px; width: 100%; justify-self: center; }
@media (max-width: 899px) {
  .rewards-art { order: 2; }
}
.rewards { display: grid; grid-template-columns: repeat(3, 1fr); padding: 22px 8px; background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.reward { display: grid; justify-items: center; gap: 2px; text-align: center; }
.reward svg { width: 24px; height: 24px; color: var(--accent); }
.reward b { font: 800 28px/1.2 var(--sans); letter-spacing: -0.02em; margin-top: 4px; }
.reward small { font-size: 14px; color: var(--ink-muted); }
.badges { display: flex; flex-wrap: wrap; gap: 10px; padding: 20px; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 8px; border-radius: 999px;
  border: 2px dashed var(--border-strong); color: var(--ink-faint);
  font-weight: 700; font-size: 14px;
}
.badge::before { content: '★'; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--fill-strong); font-size: 13px; }
.badge.earned { border: 2px solid transparent; background: var(--accent-soft); color: var(--ink); }
.badge.earned::before { background: var(--accent); color: #12354F; }

/* ---------------------------------------------------------------- Coach demo */

.demo { max-width: 720px; margin: clamp(48px, 7vw, 64px) auto 0; }
.demo-genres { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.demo-genres button,
.chat-quick button {
  height: 40px; padding: 0 18px; border-radius: 999px;
  border: 2px solid var(--border-strong); background: var(--surface);
  font-size: 15px; font-weight: 700; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.demo-genres button:hover,
.chat-quick button:hover { border-color: var(--primary); }
.demo-genres [aria-checked='true'] { background: var(--primary); color: var(--primary-on); border-color: var(--primary); }

.chat { overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.chat-mark { width: 24px; height: 24px; flex: none; }
.chat-name { font-weight: 800; font-size: 17px; line-height: 1.3; }
.chat-context { font-size: 14px; color: var(--ink-muted); line-height: 1.3; }

.chat-thread {
  height: 330px; overflow-y: auto; overscroll-behavior: contain;
  padding: 24px; display: flex; flex-direction: column; gap: 18px;
  background: var(--bg);
}
.msg-coach { display: grid; grid-template-columns: 16px 1fr; gap: 12px; padding-right: 24px; }
.msg-coach svg { width: 16px; height: 16px; margin-top: 4px; }
.msg-coach p { font: 500 17px/1.6 var(--sans); }
.msg-hint { display: inline-block; font: 800 11px/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-text); background: var(--accent-soft); padding: 5px 8px; border-radius: 999px; margin-bottom: 8px; }
.msg-writer {
  align-self: flex-end; max-width: 80%;
  padding: 10px 16px; border-radius: 20px 20px 6px 20px;
  background: var(--primary); color: var(--primary-on); font-size: 16px; font-weight: 600; line-height: 1.45;
}
.msg-enter { animation: rise 0.32s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.thinking { display: grid; gap: 7px; padding: 6px 0; }
.thinking i { display: block; height: 9px; border-radius: 6px; background: var(--sky); animation: ink 1.05s ease-in-out infinite alternate; }
.thinking i:nth-child(1) { width: 76%; }
.thinking i:nth-child(2) { width: 96%; animation-delay: 0.14s; }
.thinking i:nth-child(3) { width: 56%; animation-delay: 0.28s; }
@keyframes ink { from { opacity: 0.35; } to { opacity: 1; } }

.chat-quick { display: flex; gap: 8px; padding: 14px 24px 0; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--border); }
.chat-quick::-webkit-scrollbar { display: none; }
.chat-quick button { flex: none; height: 36px; padding: 0 14px; font-size: 14px; }
.chat-quick button:disabled { opacity: 0.4; cursor: default; }

.chat-form {
  display: flex; align-items: center; margin: 12px 24px 24px;
  border: 2px solid var(--border-strong); border-radius: 999px; background: var(--surface);
}
.chat-form:focus-within { border-color: var(--primary); }
.chat-form input { flex: 1; min-width: 0; height: 48px; padding: 0 20px; border: 0; background: transparent; font-size: 16px; }
.chat-form input:focus { outline: none; }
.chat-form input::placeholder { color: var(--ink-faint); }
.chat-form button { display: grid; place-items: center; width: 40px; height: 40px; margin-right: 4px; border: 0; border-radius: 50%; background: var(--primary); cursor: pointer; }
.chat-form svg { width: 20px; height: 20px; fill: none; stroke: var(--primary-on); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.demo-note { margin-top: 16px; text-align: center; }

@media (max-width: 520px) {
  .chat-head, .chat-thread { padding-inline: 18px; }
  .chat-quick { padding-inline: 18px; }
  .chat-form { margin-inline: 18px; }
  .chat-thread { height: 340px; }
}

/* ---------------------------------------------------------------- Story Shelf */

.shelf { margin-top: clamp(40px, 6vw, 64px); overflow-x: auto; scrollbar-width: none; padding: 12px 4px 0; }
.shelf::-webkit-scrollbar { display: none; }
.shelf-row { display: flex; gap: clamp(14px, 3vw, 28px); align-items: flex-end; justify-content: center; min-width: max-content; padding: 0 12px; }
.shelf-row .cover { --w: clamp(112px, 15vw, 150px); }
.shelf-plank { height: 12px; margin-top: -2px; border-radius: 6px; background: var(--border-strong); box-shadow: 0 8px 14px -8px rgba(18, 53, 79, 0.35); min-width: max-content; }
.shelf-note { margin-top: 18px; text-align: center; }

/* ---------------------------------------------------------------- Teachers */

.facts { display: grid; gap: 20px; margin-top: clamp(40px, 6vw, 56px); }
.facts div { padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.facts dt { font: 800 20px/1.3 var(--sans); letter-spacing: -0.01em; }
.facts dd { margin-top: 8px; color: var(--ink-muted); font-size: 16px; line-height: 1.6; }
@media (min-width: 900px) {
  .facts { grid-template-columns: 1fr 1fr; gap: 24px; }
}

/* ---------------------------------------------------------------- About */

.about h2 { margin-bottom: 24px; }

/* ---------------------------------------------------------------- Closing: the one dark band */

.closing {
  background: var(--surface-ink);
  color: var(--on-surface-ink);
  padding-block: var(--section);
}
.closing-inner { display: flex; flex-direction: column; align-items: center; text-align: center; }
.closing-mark { width: 120px; height: auto; margin-bottom: 32px; }
.closing h2 { max-width: 20em; margin-bottom: 20px; font-size: clamp(1.9rem, 4vw, 2.9rem); }
.closing .lede { margin-bottom: 32px; max-width: 30em; color: #A9BED4; }

/* ---------------------------------------------------------------- Footer */

.footer { padding: 36px 0 52px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between; }
.footer .brand img { height: 36px; }
.footer p { font-size: 14px; color: var(--ink-muted); }
.to-top { font-size: 14px; font-weight: 700; color: var(--primary); text-decoration: none; }
.to-top:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- Motion */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
