/* Margin — public site
   Warm paper and ink, restrained terracotta. Lora for reading, Poppins for the
   controls, exactly as in the app. Buildless: one stylesheet, no framework. */

@font-face { font-family: "Lora"; src: url("/assets/fonts/Lora-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Lora"; src: url("/assets/fonts/Lora-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/assets/fonts/Poppins-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/assets/fonts/Poppins-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/assets/fonts/Poppins-SemiBold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  color-scheme: light dark;
  /* Palette lifted from MarginTheme.swift and MarginModeArt.swift */
  --paper: #f7f3e8;
  --paper-deep: #efe9da;
  --surface: #fdfaf1;
  --ink: #1f1d19;
  --muted: #625f58;
  --line: rgba(31, 29, 25, .13);
  --line-strong: rgba(31, 29, 25, .26);
  --accent: #d97757;
  --accent-ink: #934d36;   /* terracotta dark enough for text on paper */
  --accent-soft: rgba(217, 119, 87, .12);
  --blue: #6a9bcc;
  --green: #788c5d;
  --green-ink: #415432;
  --plaque: #fbf6ea;
  --plaque-line: rgba(43, 38, 32, .14);
  --art-ink: #2b2620;
  --shadow: 0 1px 2px rgba(43, 38, 32, .06), 0 14px 40px -18px rgba(43, 38, 32, .28);

  --serif: "Lora", Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --measure: 62ch;
  --gutter: clamp(20px, 5vw, 48px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141413;
    --paper-deep: #1b1a18;
    --surface: #23221f;
    --ink: #faf9f5;
    --muted: #cdc7bc;
    --line: rgba(250, 249, 245, .14);
    --line-strong: rgba(250, 249, 245, .3);
    --accent: #e0896a;
    --accent-ink: #f0b39a;
    --accent-soft: rgba(224, 137, 106, .16);
    --green-ink: #c6d9aa;
    --plaque: #efe6d4;
    --plaque-line: rgba(43, 38, 32, .22);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 44px -18px rgba(0, 0, 0, .6);
  }
}

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

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

html {
  background: var(--paper);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 400 1.0625rem/1.7 var(--serif);
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }

a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }

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

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; letter-spacing: -.015em; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.5rem, 2rem + 3.4vw, 4.5rem); }
h2 { font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
ul, ol { padding-left: 1.3em; }
li { margin: .35em 0; }
strong { font-weight: 600; }
kbd, code { font-family: var(--sans); font-size: .92em; font-weight: 500; padding: .08em .4em; border-radius: 6px; background: var(--paper-deep); border: 1px solid var(--line); }

.eyebrow {
  font: 500 .8rem/1.4 var(--sans);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 .9rem;
}
.eyebrow--accent { color: var(--accent-ink); }

.lede { font-size: clamp(1.15rem, 1.05rem + .5vw, 1.375rem); line-height: 1.55; color: var(--muted); max-width: 34em; }
.muted { color: var(--muted); }
.small { font: 400 .9rem/1.6 var(--sans); }
.wrap { width: min(100% - 2 * var(--gutter), 1120px); margin-inline: auto; }
.measure { max-width: var(--measure); }

.skip {
  position: absolute; left: 16px; top: -100px;
  padding: 10px 14px; border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font: 500 .9rem var(--sans); box-shadow: var(--shadow); z-index: 20;
}
.skip:focus { top: 12px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- Header / nav ---------- */

.site-header { padding: 22px 0 18px; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px 28px; flex-wrap: wrap; }

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font: 400 1.5rem/1 var(--serif); }
.brand svg { width: 38px; height: 38px; flex: none; border-radius: 9px; }
@media (prefers-color-scheme: dark) { .brand svg { box-shadow: 0 0 0 1px var(--line-strong); } }

.site-nav { display: flex; flex-wrap: wrap; gap: 6px 4px; font: 500 .9rem/1 var(--sans); }
.site-nav a { color: var(--muted); text-decoration: none; padding: 10px 12px; border-radius: 999px; }
.site-nav a:hover { color: var(--ink); background: var(--paper-deep); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--paper-deep); }

/* ---------- Buttons / pills ---------- */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: 10px 22px; border-radius: 999px;
  font: 500 .95rem/1.2 var(--sans); text-decoration: none;
  border: 1.5px solid transparent; cursor: pointer;
  transition: transform .2s var(--ease), background-color .2s var(--ease), border-color .2s var(--ease);
}
.button--primary { background: var(--ink); color: var(--paper); }
.button--primary:hover { transform: translateY(-1px); }
.button--ghost { color: var(--ink); border-color: var(--line-strong); background: transparent; }
.button--ghost:hover { border-color: var(--ink); }
.button svg { width: 18px; height: 18px; }

.pill {
  display: inline-flex; align-items: center; gap: .55em;
  padding: 6px 14px 6px 10px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--muted);
  font: 500 .8rem/1.3 var(--sans);
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }

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

.hero { padding: clamp(28px, 6vw, 72px) 0 clamp(40px, 7vw, 96px); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(32px, 6vw, 88px); align-items: center; }
.hero-copy h1 { margin: 0 0 .5em; }
.hero-copy .lede { margin-bottom: 1.6em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: center; margin-bottom: 26px; }
.hero-status { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; font: 400 .9rem/1.5 var(--sans); color: var(--muted); }

/* The editor illustration: real HTML, fictional writing. */
.sheet-figure { margin: 0; position: relative; }
.sheet-figure figcaption { margin-top: 14px; font: 400 .82rem/1.5 var(--sans); color: var(--muted); text-align: center; text-wrap: balance; }

.sheet {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 26px 26px 34px;
  box-shadow: var(--shadow);
  overflow: visible;
  max-width: 440px;
  margin-inline: auto;
}
.sheet::before {  /* faint second sheet behind, a stack of paper */
  content: ""; position: absolute; inset: 10px -8px -8px 10px; z-index: -1;
  border-radius: 28px; background: var(--paper-deep); border: 1px solid var(--line);
}
.sheet-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.sheet-chrome { display: flex; gap: 6px; }
.sheet-chrome span { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); }
.sheet-chrome svg { width: 15px; height: 15px; }
.sheet-chrome .is-accent { color: var(--accent-ink); }

.orb {
  position: relative; width: 46px; height: 46px; border-radius: 50%;
  background: var(--plaque);
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 7px var(--accent-soft);
  display: grid; place-items: center;
}
.orb svg { width: 36px; height: 36px; }
.orb-count {
  position: absolute; top: -7px; right: -7px;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--accent); color: #fff;
  font: 600 .72rem/20px var(--sans); text-align: center;
}

.note { font-family: var(--serif); color: var(--art-ink); }
@media (prefers-color-scheme: dark) { .note { color: var(--ink); } }
.note-title { font-size: 1.5rem; margin: 0 0 .5em; letter-spacing: -.01em; }
.note-h { font-size: 1.28rem; font-weight: 700; margin: .1em 0 .35em; line-height: 1.25; }
.note p { font-size: 1.02rem; line-height: 1.55; margin: 0 0 .6em; }
.note ul, .note ol { margin: 0 0 .7em; padding-left: 1.15em; font-size: 1.02rem; line-height: 1.5; }
.note li { margin: .1em 0; }
.note mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 .1em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.note-caret { display: inline-block; width: 2px; height: 1.05em; background: var(--accent); vertical-align: -.15em; margin-left: 1px; border-radius: 1px; animation: caret 1.1s steps(2, start) infinite; }
@keyframes caret { to { visibility: hidden; } }

/* A seed card, as the sheet shows it (MarginSeedViews.swift) */
.seed {
  position: relative;
  margin: 24px -10px -60px;  /* peeks below the sheet */
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px 14px;
  box-shadow: var(--shadow);
  font-family: var(--sans);
}
.seed::before {
  content: ""; position: absolute; inset: 0; border-radius: 18px;
  background: var(--accent-soft); opacity: .55; pointer-events: none;
}
.seed > * { position: relative; }
.seed-q { display: flex; gap: 10px; align-items: flex-start; font: 400 .95rem/1.45 var(--sans); color: var(--ink); margin: 0; }
.seed-q::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-top: .42em; }
.seed-q--reflect::before { background: var(--green); }
.seed-tag { display: flex; align-items: center; gap: 6px; margin: 8px 0 0 20px; font: 400 .74rem/1.3 var(--sans); color: var(--muted); }
.seed-tag svg { width: 13px; height: 13px; color: var(--accent-ink); }
.seed-anchor { margin: 6px 0 0 20px; font: 400 .82rem/1.4 var(--sans); color: var(--muted); }
.seed-actions { display: flex; justify-content: flex-end; gap: 18px; margin-top: 12px; font: 500 .78rem/1 var(--sans); }
.seed-actions span { display: inline-flex; align-items: center; gap: 5px; }
.seed-actions .plant { color: var(--accent-ink); }
.seed-actions .dismiss { color: var(--muted); }
.seed-actions svg { width: 12px; height: 12px; }

/* ---------- Sections ---------- */

.section { padding: clamp(48px, 7vw, 104px) 0; }
.section--tint { background: var(--paper-deep); }
.section-head { max-width: 46rem; margin-bottom: clamp(28px, 4vw, 48px); }
.section-head h2 { margin-bottom: .5em; }
.section-head .lede { font-size: 1.15rem; }

.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* Three beats: write, pause, decide */
.beats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px clamp(24px, 4vw, 56px); counter-reset: beat; list-style: none; padding: 0; margin: 0; }
.beat { counter-increment: beat; padding-top: 22px; border-top: 1px solid var(--line-strong); position: relative; }
.beat::before {
  content: counter(beat, decimal-leading-zero);
  display: block; font: 400 .85rem/1 var(--sans); letter-spacing: .08em; color: var(--accent-ink); margin-bottom: 18px;
}
.beat h3 { font-size: 1.45rem; margin-bottom: .45em; }
.beat p { color: var(--muted); font-size: 1rem; }
.beat .ui { font-family: var(--sans); font-weight: 500; font-size: .92em; color: var(--ink); }

/* ---------- Room to wander (interactive demo) ---------- */

.wander { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 4vw, 64px); align-items: start; }

.excerpt {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 22px 24px 20px; box-shadow: var(--shadow);
}
.excerpt-label { font: 500 .78rem/1.4 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.excerpt .note p { font-size: 1.08rem; line-height: 1.6; }
.excerpt .note-h { font-size: 1.15rem; }
.phrase {
  display: inline; text-align: inherit; line-height: inherit; white-space: normal;
  font: inherit; color: inherit; cursor: pointer;
  background: transparent; border: 0; padding: 0 .15em; margin: 0 -.15em;
  border-radius: 5px;
  text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: .2em;
  transition: background-color .2s var(--ease);
}
.phrase:hover { background: var(--accent-soft); }
.phrase[aria-pressed="true"] { background: var(--accent-soft); text-decoration-thickness: 2.5px; }
.excerpt-hint { margin: 14px 0 0; font: 400 .85rem/1.5 var(--sans); color: var(--muted); }

.modes { min-width: 0; }
.tablist { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 22px; }
.tab {
  appearance: none; -webkit-appearance: none;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 16px 10px 14px; border-radius: 20px; cursor: pointer;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line);
  font: 600 .95rem/1.2 var(--sans);
  transition: border-color .2s var(--ease), background-color .2s var(--ease), transform .2s var(--ease);
}
.tab:hover { border-color: var(--line-strong); }
.tab[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); }
.tab .art { width: 64px; height: 64px; }
.tab-name { display: inline-flex; align-items: center; gap: 6px; }
.tab-name svg { width: 14px; height: 14px; color: var(--accent); opacity: 0; transition: opacity .2s; }
.tab[aria-selected="true"] .tab-name svg { opacity: 1; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px;
  padding: clamp(22px, 3vw, 34px); box-shadow: var(--shadow);
}
.panel[hidden] { display: none; }
.no-js .tablist { display: none; }
.no-js .panel + .panel { margin-top: 16px; }
.no-js .excerpt-hint { display: none; }
.panel-head { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 20px; align-items: center; margin-bottom: 22px; }
.panel-head .art { width: 112px; height: 112px; }
.panel-head h3 { font-size: 1.75rem; margin-bottom: .2em; }
.panel-summary { font: 400 1rem/1.5 var(--sans); color: var(--muted); margin: 0; }
.panel-body p { font-size: 1.02rem; }
.panel .seed { margin: 20px 0 0; }
.panel .seed-q { font-size: 1rem; }
.forms { margin: 22px 0 0; }
.forms h4 { font: 500 .8rem/1.4 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.forms ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.forms li { margin: 0; font: 400 .85rem/1.35 var(--sans); color: var(--ink); background: var(--paper-deep); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
.forms q { quotes: "“" "”"; color: var(--accent-ink); }
.demo-note { margin: 22px 0 0; font: 400 .85rem/1.55 var(--sans); color: var(--muted); }

/* Illustration plaques and their one-shot entries (MarginModeArt.swift). */
.art { --plaque-fill: var(--plaque); }
.art .plaque { fill: var(--plaque-fill); stroke: var(--plaque-line); stroke-width: 1; }
.art .pencil, .art .boat, .art .stars, .art .star, .art .eye { transform-box: view-box; }
.art .pencil { transform-origin: 50px 100px; transform: rotate(-6deg); }
.art .eye { transform-box: fill-box; transform-origin: center; }
.art .boat { transform-origin: 50px 100px; transform: rotate(-4deg); }
.art .stars { transform-origin: 50px 50px; }
.art .star { transform-box: fill-box; transform-origin: center; }
.art .trail-reveal { stroke-dasharray: 100; stroke-dashoffset: 0; }

.is-playing .pencil { animation: pencil-nod 1.05s var(--ease) both; }
.is-playing .eye { animation: blink 1.05s linear both; }
.is-playing .boat { animation: boat-bob 1.05s var(--ease) both; }
.is-playing .trail-reveal { animation: trail-draw .6s ease-out both; }
.is-playing .stars { animation: stars-turn 1.05s var(--ease) both; }
.is-playing .star { animation: star-twinkle 1.05s var(--ease) both; }

@keyframes pencil-nod { 0% { transform: rotate(-6deg); } 38% { transform: rotate(4.5deg); } 68% { transform: rotate(-8deg); } 100% { transform: rotate(-6deg); } }
@keyframes blink { 0%, 60% { transform: scaleY(1); } 66% { transform: scaleY(.1); } 76%, 100% { transform: scaleY(1); } }
@keyframes boat-bob { 0% { transform: rotate(-4deg) translateY(0); } 40% { transform: rotate(4deg) translateY(-3px); } 72% { transform: rotate(-5.5deg) translateY(0); } 100% { transform: rotate(-4deg) translateY(0); } }
@keyframes trail-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes stars-turn { 0% { transform: rotate(0deg); } 40% { transform: rotate(16deg); } 72% { transform: rotate(-3deg); } 100% { transform: rotate(0deg); } }
@keyframes star-twinkle { 0% { transform: scale(1); } 40% { transform: scale(var(--twinkle, 1.3)); } 100% { transform: scale(1); } }

/* ---------- Previews ---------- */

.previews { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3vw, 40px); list-style: none; padding: 0; margin: 0; }
.preview { margin: 0; }
.preview-frame {
  border-radius: 28px; overflow: hidden;
  border: 1px solid var(--line); background: #f7f3e8;
  box-shadow: var(--shadow);
}
.preview-frame img { width: 100%; height: auto; aspect-ratio: 720 / 1564; }
.preview figcaption { margin-top: 16px; font: 400 .92rem/1.55 var(--sans); color: var(--muted); }
.preview figcaption strong { display: block; color: var(--ink); font-weight: 600; margin-bottom: .2em; }
.previews-note { margin-top: 28px; font: 400 .85rem/1.55 var(--sans); color: var(--muted); max-width: 60ch; }

/* ---------- Features (definition list) ---------- */

.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(32px, 5vw, 72px); margin: 0; }
.feature { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 0 18px; padding: 26px 0; border-top: 1px solid var(--line); }
.feature-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--paper-deep); border: 1px solid var(--line); display: grid; place-items: center; color: var(--accent-ink); }
.feature-icon svg { width: 22px; height: 22px; }
.feature dt { font: 600 1.05rem/1.35 var(--sans); color: var(--ink); padding-top: 8px; }
.feature dd { grid-column: 2; margin: 6px 0 0; color: var(--muted); font-size: 1rem; }
.feature dd .ui { font-family: var(--sans); font-weight: 500; font-size: .92em; color: var(--ink); }

/* ---------- Release band ---------- */

.release .wrap {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px 48px; align-items: center;
  padding: clamp(28px, 4vw, 48px); border-radius: 28px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.release h2 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem); margin-bottom: .4em; }
.release p { color: var(--muted); max-width: 48ch; }
.release-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.release-trio { display: flex; gap: 6px; margin-bottom: 18px; }
.release-trio .art { width: 54px; height: 54px; }

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

.site-footer { padding: 40px 0 48px; border-top: 1px solid var(--line); font: 400 .9rem/1.6 var(--sans); color: var(--muted); }
.site-footer .wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 28px 40px; }
.site-footer h2 { font: 500 .78rem/1.4 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 0 0 6px; }
.site-footer a { color: var(--ink); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-brand .brand { margin-bottom: 10px; }
.footer-brand p { max-width: 36ch; }
.site-footer .meta { grid-column: 1 / -1; padding-top: 22px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: .82rem; }

/* ---------- Document pages (Support, Privacy) ---------- */

.doc { padding: clamp(24px, 4vw, 56px) 0 clamp(56px, 7vw, 96px); }
.doc-intro { max-width: 52rem; margin-bottom: clamp(28px, 4vw, 48px); }
.doc-intro h1 { font-size: clamp(2.2rem, 1.8rem + 2.2vw, 3.6rem); margin-bottom: .5em; }
.contact {
  display: grid; grid-template-columns: 4px minmax(0, 1fr); gap: 0 18px;
  margin: 28px 0 0; max-width: 46rem;
}
.contact::before { content: ""; background: var(--accent); border-radius: 2px; }
.contact p { margin: 0 0 .5em; }
.contact a { overflow-wrap: anywhere; }
.contact .small { color: var(--muted); }

.doc-layout { display: grid; grid-template-columns: 220px minmax(0, 46rem); gap: clamp(32px, 5vw, 72px); align-items: start; }
.contents { position: sticky; top: 24px; font: 400 .9rem/1.5 var(--sans); border-left: 2px solid var(--line); padding-left: 18px; display: flex; flex-direction: column; gap: 10px; }
.contents a { color: var(--muted); text-decoration: none; }
.contents a:hover, .contents a:focus-visible { color: var(--ink); }
.contents-label { font: 500 .74rem/1.4 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }

.doc-article { min-width: 0; }
.doc-article section { scroll-margin-top: 24px; }
.doc-article section + section { margin-top: clamp(32px, 4vw, 56px); }
.doc-article h2 { font-size: clamp(1.5rem, 1.3rem + .8vw, 1.9rem); margin: 0 0 .6em; }
.doc-article h2 + p, .doc-article h2 + details { margin-top: 0; }
.doc-article section > p + p { margin-top: -.2em; }

details { border-top: 1px solid var(--line); }
details:last-of-type { border-bottom: 1px solid var(--line); }
summary {
  list-style: none; cursor: pointer;
  display: grid; grid-template-columns: minmax(0, 1fr) 24px; gap: 16px; align-items: center;
  padding: 16px 0; font: 600 1.05rem/1.4 var(--sans); color: var(--ink);
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: ""; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line-strong);
  background:
    linear-gradient(currentColor, currentColor) center / 10px 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1.5px 10px no-repeat;
  color: var(--ink); transition: transform .25s var(--ease);
}
details[open] summary::after { transform: rotate(45deg); }
summary:hover { color: var(--accent-ink); }
details > :last-child:not(summary) { padding-bottom: 20px; }
details p, details ul { margin: 0 0 .7em; color: var(--ink); }
details .ui, .doc-article .ui { font-family: var(--sans); font-weight: 500; font-size: .92em; }

.doc-note { margin-top: 32px; font: 400 .9rem/1.6 var(--sans); color: var(--muted); }
.callout { padding: 18px 22px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: 1rem; }
.callout--flag { border-left: 4px solid var(--accent); }

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .wander { grid-template-columns: 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .site-footer .wrap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .sheet-figure { margin-top: 44px; }
  .sheet { max-width: 480px; }
  .beats { grid-template-columns: 1fr; gap: 26px; }
  .beat { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 0 12px; }
  .beat::before { margin: .35em 0 0; }
  .beat h3, .beat p { grid-column: 2; }
  .previews { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .preview figcaption { font-size: .85rem; }
  .features { grid-template-columns: 1fr; }
  .release .wrap { grid-template-columns: 1fr; }
  .doc-layout { grid-template-columns: 1fr; gap: 28px; }
  .contents { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px 16px; border-left: 0; padding-left: 0; }
  .contents-label { flex-basis: 100%; }
}

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .site-header { padding: 16px 0 10px; }
  .brand { font-size: 1.35rem; }
  .brand svg { width: 34px; height: 34px; }
  .site-nav { margin-left: -7px; font-size: .8rem; gap: 0; }
  .site-nav a { padding: 9px 7px; }
  .hero { padding-top: 20px; }
  .hero-actions .button { flex: 1 1 auto; }
  .sheet { padding: 20px 18px 30px; border-radius: 24px; }
  .sheet::before { inset: 8px -6px -6px 8px; }
  .seed { margin: 20px -6px -54px; padding: 14px 14px 12px; }
  .note-title { font-size: 1.35rem; }
  .sheet-figure figcaption { margin-top: 68px; }
  .previews { grid-template-columns: 1fr; gap: 28px; }
  .preview { max-width: 340px; margin-inline: auto; }
  .tablist { gap: 8px; }
  .tab { padding: 12px 6px 10px; font-size: .85rem; border-radius: 16px; }
  .tab .art { width: 52px; height: 52px; }
  .panel-head { grid-template-columns: 84px minmax(0, 1fr); gap: 14px; }
  .panel-head .art { width: 84px; height: 84px; }
  .panel-head h3 { font-size: 1.45rem; }
  .feature { grid-template-columns: 40px minmax(0, 1fr); gap: 0 14px; }
  .feature-icon { width: 40px; height: 40px; }
  .site-footer .wrap { grid-template-columns: 1fr; }
  .release-actions .button { flex: 1 1 auto; }
}

@media (min-width: 901px) {
  .sheet-figure figcaption { margin-top: 74px; }
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .note-caret { animation: none; }
  .is-playing .pencil, .is-playing .eye, .is-playing .boat, .is-playing .trail-reveal, .is-playing .stars, .is-playing .star { animation: none; }
}

@media (prefers-contrast: more) {
  :root { --line: rgba(31, 29, 25, .4); --line-strong: rgba(31, 29, 25, .7); --muted: #3d3a34; }
  @media (prefers-color-scheme: dark) { :root { --line: rgba(250, 249, 245, .4); --line-strong: rgba(250, 249, 245, .7); --muted: #ebe6dc; } }
}

@media print {
  .site-nav, .skip, .hero-actions, .release-actions { display: none; }
  body { background: #fff; color: #000; }
}
