/* ==========================================================================
   Writer — writer.gr
   A static, self-contained marketing + docs site.
   ========================================================================== */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: light;

  --paper: #f7f4ee;
  --paper-2: #efeae0;
  --paper-3: #e8e2d6;
  --surface: #fffefa;
  --surface-2: #fbf9f3;
  --ink: #151a21;
  --ink-2: #47505d;
  --ink-3: #5f6a79;
  --line: #e2ddd2;
  --line-2: #ece8df;

  --accent: #0b5fd7;
  --accent-2: #0a47a3;
  --accent-soft: #e6efff;
  --accent-ink: #ffffff;
  --warm: #d9552f;
  --warm-soft: #fdeee8;
  --green: #177a55;
  --green-soft: #e5f5ee;
  --gold: #b7791f;

  --code-bg: #10151d;
  --code-bg-2: #0b0f15;
  --code-ink: #dbe4f0;
  --code-muted: #7f8b9b;

  --font-display: "Literata", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;

  --shadow-xs: 0 1px 2px rgba(21, 26, 33, .04);
  --shadow-sm: 0 2px 6px rgba(21, 26, 33, .05), 0 1px 2px rgba(21, 26, 33, .04);
  --shadow-md: 0 18px 44px -28px rgba(21, 26, 33, .35), 0 3px 10px rgba(21, 26, 33, .05);
  --shadow-lg: 0 54px 120px -54px rgba(21, 26, 33, .45), 0 14px 38px -24px rgba(21, 26, 33, .22);

  --header-h: 68px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --dur: .55s;
}

html[data-theme="dark"] {
  color-scheme: dark;

  --paper: #0a0d12;
  --paper-2: #0f141b;
  --paper-3: #151b24;
  --surface: #121923;
  --surface-2: #0e141c;
  --ink: #eef2f8;
  --ink-2: #adb7c5;
  --ink-3: #7f8b9b;
  --line: #232c38;
  --line-2: #1a222c;

  --accent: #74a8ff;
  --accent-2: #a8c8ff;
  --accent-soft: #12213c;
  --accent-ink: #071426;
  --warm: #ff8a66;
  --warm-soft: #2a1813;
  --green: #4fd1a1;
  --green-soft: #10251e;
  --gold: #e0b25b;

  --code-bg: #0b1017;
  --code-bg-2: #080c12;
  --code-ink: #dbe4f0;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .35);
  --shadow-md: 0 24px 60px -32px rgba(0, 0, 0, .8), 0 3px 12px rgba(0, 0, 0, .35);
  --shadow-lg: 0 60px 140px -60px rgba(0, 0, 0, .9), 0 18px 44px -28px rgba(0, 0, 0, .6);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, h5, h6 { margin: 0; font-family: var(--font-display); font-weight: 600; line-height: 1.12; letter-spacing: -.018em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }

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

/* ---------------------------------------------------------------- layout */
.wrap {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.wrap-narrow { width: min(900px, calc(100% - 48px)); margin-inline: auto; }

.section { padding: clamp(64px, 8vw, 118px) 0; position: relative; }
.section-tight { padding: clamp(44px, 6vw, 76px) 0; }
.section-alt { background: var(--paper-2); border-block: 1px solid var(--line); }

.section-head { max-width: 760px; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head.center { margin-inline: auto; text-align: center; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 18px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}

h2.section-title {
  font-size: clamp(2rem, 3.6vw, 3.1rem);
  letter-spacing: -.03em;
  text-wrap: balance;
}
.section-lede {
  margin-top: 18px;
  max-width: 62ch;
  font-size: clamp(1rem, 1.3vw, 1.12rem);
  color: var(--ink-2);
  text-wrap: pretty;
}
.center .section-lede { margin-inline: auto; }

.mono { font-family: var(--font-mono); }
.muted { color: var(--ink-2); }
.small { font-size: .86rem; }
.accent { color: var(--accent); }
.nowrap { white-space: nowrap; }

.mark {
  background: linear-gradient(transparent 64%, var(--accent-soft) 64%);
  padding: 0 .06em;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed;
  top: -100px; left: 16px;
  z-index: 1000;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--paper);
  font-size: .9rem;
}
.skip-link:focus { top: 12px; }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  height: var(--header-h);
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(16px) saturate(140%);
  transition: border-color .25s ease, background .25s ease;
}
.site-header.scrolled {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 26px;
  height: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -.03em;
}
.brand img { width: 30px; height: 30px; }
.brand .version {
  margin-left: 2px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--ink-3);
  background: var(--surface);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.main-nav a {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--ink-2);
  transition: color .18s ease, background .18s ease;
}
.main-nav a:hover { color: var(--ink); background: var(--paper-2); }
.main-nav a[aria-current="page"] { color: var(--ink); background: var(--paper-2); }

.header-actions { display: flex; align-items: center; gap: 8px; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: border-color .18s ease, color .18s ease, background .18s ease;
}
.lang-switch:hover { border-color: var(--ink-3); color: var(--ink); background: var(--paper-2); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  transition: border-color .18s ease, color .18s ease, background .18s ease;
}
.icon-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: block; }
html[data-theme="dark"] .theme-toggle .moon { display: none; }

.nav-toggle { display: none; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: -.005em;
  white-space: nowrap;
  transition: transform .18s var(--ease), background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.btn svg { width: 17px; height: 17px; flex: 0 0 auto; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent); color: var(--accent-ink); }

.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 24px -14px color-mix(in srgb, var(--accent) 70%, transparent);
}
.btn-accent:hover { background: var(--accent-2); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--ink-3); box-shadow: var(--shadow-sm); }

.btn-quiet {
  height: 38px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: .85rem;
  background: transparent;
  border-color: var(--line);
  color: var(--ink-2);
}
.btn-quiet:hover { color: var(--ink); border-color: var(--ink-3); }

.btn-sm { height: 38px; padding: 0 15px; font-size: .85rem; border-radius: 9px; }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--accent);
}
.text-link svg { width: 15px; height: 15px; transition: transform .18s ease; }
.text-link:hover svg { transform: translateX(3px); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

/* ---------------------------------------------------------------- hero */
.hero {
  position: relative;
  overflow: clip;
  padding: clamp(52px, 7vw, 92px) 0 clamp(56px, 8vw, 104px);
  background:
    radial-gradient(900px 420px at 78% -8%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 68%),
    radial-gradient(700px 380px at 8% 12%, color-mix(in srgb, var(--warm) 7%, transparent), transparent 70%);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--ink) 5%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--ink) 5%, transparent) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 20%, #000 20%, transparent 78%);
  opacity: .5;
  pointer-events: none;
}
.hero > .wrap { position: relative; z-index: 1; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, .94fr) minmax(0, 1.06fr);
  gap: clamp(34px, 5vw, 70px);
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.55rem, 5vw, 4.35rem);
  line-height: 1.02;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.hero .lede {
  margin-top: 24px;
  max-width: 54ch;
  font-size: clamp(1.02rem, 1.35vw, 1.16rem);
  color: var(--ink-2);
  text-wrap: pretty;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}
.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  list-style: none;
  font-size: .84rem;
  color: var(--ink-2);
}
.hero-points li { display: inline-flex; align-items: center; gap: 7px; }
.hero-points svg { width: 14px; height: 14px; color: var(--green); }

.hero-demo { position: relative; }
.hero-demo .window { position: relative; z-index: 1; }
.hero-demo::after {
  content: "";
  position: absolute;
  inset: 12% -4% -6% 8%;
  z-index: 0;
  border-radius: 40px;
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 22%, transparent), color-mix(in srgb, var(--warm) 14%, transparent));
  filter: blur(46px);
  opacity: .55;
  pointer-events: none;
}

.window {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.window-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}
.window-bar .dots { display: flex; gap: 5px; }
.window-bar .dots i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--line);
}
.window-bar .dots i:nth-child(1) { background: #ee6a5f; }
.window-bar .dots i:nth-child(2) { background: #f5bd4f; }
.window-bar .dots i:nth-child(3) { background: #61c454; }
.window-bar .address {
  flex: 1;
  min-width: 0;
  padding: 4px 10px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.window-bar .live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
}
.window-bar .live i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
  animation: pulse 2.4s ease infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--green) 6%, transparent); }
}

.hero-demo .window writer-editor {
  border: 0;
  border-radius: 0;
  --wr-radius-lg: 0;
  --wr-content-max-width: 40rem;
  --wr-font-size: 14.5px;
}

/* Demo typography ----------------------------------------------------------
   Writer's built-in scale maps h1 to 6xl. On the serif-editorial theme that is
   calc(1.125rem * 7.478) — a 134px heading inside a 40rem column. It is the
   right contract for a print layout, but it turns the marketing hero into a
   2000px-tall window. Keep the theme's families, colors and rhythm; cap the
   display sizes for embedded demos. The variables are !important because both
   the editor (inline host style) and the labs (injected scoped CSS) set them
   at runtime. */
writer-editor,
.preview-prose {
  --wr-font-size-base: 15px !important;
  --wr-h1-size: 2.15em !important;
  --wr-h2-size: 1.6em !important;
  --wr-h3-size: 1.32em !important;
  --wr-h4-size: 1.15em !important;
  --wr-h5-size: 1em !important;
  --wr-h6-size: .9em !important;
}
.hero-demo-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 7px 8px 7px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.hero-demo-bar .seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 9px;
  background: var(--paper-2);
}
.hero-demo-bar .seg button {
  padding: 6px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.hero-demo-bar .seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}
.hero-demo-bar .spacer { flex: 1; }
.hero-demo-bar .hint { font-size: 11.5px; color: var(--ink-3); }

/* ---------------------------------------------------------------- stats */
.stat-band {
  border-block: 1px solid var(--line);
  background: var(--ink);
  color: var(--paper);
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.stat {
  padding: 32px 26px;
  border-left: 1px solid color-mix(in srgb, var(--paper) 14%, transparent);
}
.stat:first-child { border-left: 0; padding-left: 0; }
.stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 2.6vw, 2.3rem);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1;
}
.stat span {
  display: block;
  margin-top: 9px;
  font-size: .82rem;
  color: color-mix(in srgb, var(--paper) 62%, transparent);
}
html[data-theme="dark"] .stat-band { background: var(--surface); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .stat span { color: var(--ink-3); }
html[data-theme="dark"] .stat { border-color: var(--line); }

/* ---------------------------------------------------------------- release band */
.release-band {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 22px 28px;
  align-items: center;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.release-mark {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 24px;
  border-right: 1px solid var(--line);
}
.release-version {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}
.release-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.release-copy h2 { font-size: clamp(1.15rem, 2vw, 1.45rem); letter-spacing: -.02em; }
.release-copy p { margin-top: 8px; color: var(--ink-2); font-size: .93rem; max-width: 72ch; }
.release-band .btn { white-space: nowrap; }
@media (max-width: 820px) {
  .release-band { grid-template-columns: minmax(0, 1fr); }
  .release-mark {
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
    padding: 0 0 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .release-name { white-space: normal; }
}

/* ---------------------------------------------------------------- cards */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

/* Grid and flex children must be allowed to shrink; otherwise wide code/tables
   expand their track and force a horizontal scrollbar on the whole page. */
.grid-2 > *,
.grid-3 > *,
.api-board > *,
.lab > *,
.playground-grid > *,
.sdk-grid > *,
.demo-tiles > *,
.media-shell,
.demo-card,
.inspector,
.lab-output,
.preview { min-width: 0; }

.card {
  position: relative;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: transform .22s var(--ease), box-shadow .22s ease, border-color .22s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--ink) 14%, var(--line));
}
.card h3 { margin-top: 18px; font-size: 1.2rem; }
.card p { margin-top: 9px; font-size: .92rem; line-height: 1.6; color: var(--ink-2); }
.card .tag {
  display: inline-block;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: linear-gradient(160deg, var(--surface), var(--paper-2));
  color: var(--accent);
}
.card-icon svg { width: 21px; height: 21px; }
.card-warm .card-icon { color: var(--warm); background: linear-gradient(160deg, var(--surface), var(--warm-soft)); }
.card-green .card-icon { color: var(--green); background: linear-gradient(160deg, var(--surface), var(--green-soft)); }

.card-link { display: flex; flex-direction: column; height: 100%; color: inherit; }
.card-link h3 { color: var(--ink); }
.card-link .more { margin-top: auto; padding-top: 18px; }

/* ---------------------------------------------------------------- flow */
.flow-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(26px, 4vw, 46px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.flow-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 14%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: .35;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, #000, transparent 78%);
  pointer-events: none;
}
.flow { position: relative; z-index: 1; }

.flow-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
}
.flow-node {
  flex: 1 1 150px;
  min-width: 0;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.flow-node .kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.flow-node strong {
  display: block;
  margin-top: 6px;
  font-size: .98rem;
  font-weight: 600;
}
.flow-node .detail {
  display: block;
  margin-top: 4px;
  font-size: .76rem;
  color: var(--ink-3);
}
.flow-node.contract {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  background: linear-gradient(165deg, var(--surface), var(--accent-soft));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 8%, transparent);
}
.flow-node.contract .kicker { color: var(--accent); }
.flow-node.contract strong { color: var(--ink); }
.flow-node .seal {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 9px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
  color: var(--ink-3);
}
.flow-arrow svg { width: 18px; height: 18px; }

.flow-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.flow-targets .chip { text-transform: none; letter-spacing: 0; font-size: 11px; }
.flow-caption {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: .8rem;
  color: var(--ink-3);
}
.flow-caption svg { width: 14px; height: 14px; color: var(--green); }

/* ---------------------------------------------------------------- steps */
.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 40px;
  border-top: 1px solid var(--line);
}
.step {
  padding: 24px 22px 8px 0;
  border-right: 1px solid var(--line);
}
.step:last-child { border-right: 0; }
.step .n {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--accent);
}
.step h3 { margin-top: 10px; font-size: 1.05rem; }
.step p { margin-top: 7px; font-size: .86rem; color: var(--ink-2); }

/* ---------------------------------------------------------------- code */
.code {
  position: relative;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-ink);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.code figcaption {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid color-mix(in srgb, #fff 9%, transparent);
  background: var(--code-bg-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--code-muted);
}
.code figcaption .name { color: color-mix(in srgb, var(--code-ink) 55%, transparent); }
.code figcaption .spacer { flex: 1; }
.code pre {
  margin: 0;
  padding: 20px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.72;
  tab-size: 2;
}
.code code { font-family: inherit; white-space: pre; }
.code .copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, #fff 13%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, #fff 5%, transparent);
  color: var(--code-ink);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .04em;
  transition: background .18s ease, border-color .18s ease;
}
.code .copy:hover { background: color-mix(in srgb, #fff 10%, transparent); border-color: color-mix(in srgb, #fff 24%, transparent); }
.code .copy svg { width: 13px; height: 13px; }
.code .copy.copied { color: #7ee2b8; border-color: color-mix(in srgb, #7ee2b8 40%, transparent); }

/* token colours */
.tok-c { color: #7d8da3; font-style: italic; }
.tok-s { color: #a5d6a7; }
.tok-k { color: #8ab4ff; }
.tok-n { color: #ffcc80; }
.tok-f { color: #ffd479; }
.tok-v { color: #f6a5c0; }
.tok-p { color: #c3a6ff; }

/* inline code */
code.inline {
  padding: .12em .38em;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: .84em;
  color: var(--ink);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- tabs */
.tabs { position: relative; }
.tabs, .tabs > *, .tablist { min-width: 0; max-width: 100%; }
.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper-2);
  width: fit-content;
  max-width: 100%;
}
.tablist [role="tab"] {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-2);
  transition: background .18s ease, color .18s ease;
}
.tablist [role="tab"]:hover { color: var(--ink); }
.tablist [role="tab"][aria-selected="true"] {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}
.tablist [role="tab"] .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px; height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  font-size: 9.5px;
}
.tab-panel[hidden] { display: none; }
.tab-panel { animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- demo shell */
.demo-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: visible;
}
.demo-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.demo-head .title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.demo-head .title i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 15%, transparent);
}
.demo-head .spacer { flex: 1; }

.demo-body { padding: clamp(14px, 2vw, 22px); }

.demo-editor writer-editor {
  --wr-color-accent: var(--accent);
  --wr-color-accent-contrast: var(--accent-ink);
  --wr-color-bg: var(--surface);
  --wr-color-bg-subtle: var(--surface-2);
  --wr-color-border: var(--line);
  --wr-color-text: var(--ink);
  --wr-color-muted: var(--ink-3);
  --wr-color-danger: var(--warm);
  --wr-font-sans: var(--font-ui);
  --wr-font-mono: var(--font-mono);
  --wr-radius: 8px;
  --wr-radius-lg: 12px;
  box-shadow: var(--shadow-sm);
}

.playground-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}
.playground-stage { min-width: 0; }
.playground-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: calc(var(--header-h) + 16px);
}
.control-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.control-card h4 {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.control-card h4:not(:first-child) { margin-top: 16px; }
.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-2);
}
.seg button {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}
.field {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: .84rem;
}
.field:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: .82rem;
  color: var(--ink-2);
  cursor: pointer;
}
.check input { accent-color: var(--accent); }
.btn-stack { display: grid; gap: 6px; }
.btn-stack .btn { width: 100%; justify-content: flex-start; height: 36px; padding: 0 11px; font-size: .8rem; border-radius: 8px; }
.btn-stack .btn svg { width: 14px; height: 14px; color: var(--ink-3); }

/* IR / console */
.inspector {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.inspector-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid color-mix(in srgb, #fff 8%, transparent);
  background: var(--code-bg-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--code-muted);
}
.inspector-head .spacer { flex: 1; }
.inspector pre {
  margin: 0;
  padding: 14px;
  max-height: 360px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.65;
  color: var(--code-ink);
  white-space: pre;
}
.inspector .stats {
  padding: 8px 12px;
  border-top: 1px solid color-mix(in srgb, #fff 8%, transparent);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--code-muted);
}
.event-log {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 150px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.6;
}
.event-log li {
  display: flex;
  gap: 8px;
  padding: 3px 12px;
  color: var(--ink-2);
  border-bottom: 1px dashed var(--line-2);
}
.event-log li:last-child { border-bottom: 0; }
.event-log .time { color: var(--ink-3); }
.event-log .evt { color: var(--accent); }

/* lab */
.lab {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  gap: 16px;
  align-items: stretch;
}
.lab-input {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.lab-input .bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.lab-input .bar .spacer { flex: 1; }
.lab-input textarea {
  flex: 1;
  min-height: 320px;
  width: 100%;
  padding: 16px;
  border: 0;
  resize: vertical;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  outline: none;
}
.lab-output {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.lab-output .tablist {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  width: 100%;
  background: var(--surface-2);
}
.lab-output .code {
  flex: 1;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}
.lab-output .code pre { flex: 1; max-height: 520px; }
.lab-output .preview {
  flex: 1;
  padding: 22px;
  overflow: auto;
  max-height: 520px;
  background: var(--surface);
}
.lab-output .preview > :first-child { margin-top: 0; }
.preview-prose { font-size: .95rem; line-height: 1.7; }
.preview-prose h1 { font-size: 1.8rem; margin: 0 0 .55em; }
.preview-prose h2 { font-size: 1.4rem; margin: 1.3em 0 .5em; }
.preview-prose h3 { font-size: 1.15rem; margin: 1.2em 0 .45em; }
.preview-prose p { margin: 0 0 .85em; }
.preview-prose ul, .preview-prose ol { margin: 0 0 .9em; padding-left: 1.4em; }
.preview-prose li { margin: .2em 0; }
.preview-prose blockquote {
  margin: 0 0 1em;
  padding: 10px 16px;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  color: var(--ink-2);
}
.preview-prose table { width: 100%; border-collapse: collapse; margin: 0 0 1em; font-size: .88rem; }
.preview-prose th, .preview-prose td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.preview-prose thead th { background: var(--surface-2); }
.preview-prose pre { padding: 14px; border-radius: 8px; background: var(--code-bg); color: var(--code-ink); overflow: auto; font-family: var(--font-mono); font-size: .82rem; }
.preview-prose code { font-family: var(--font-mono); font-size: .86em; }
.preview-prose :not(pre) > code { padding: .1em .35em; border-radius: 4px; background: var(--paper-2); }
.preview-prose img { max-width: 100%; height: auto; border-radius: 8px; }
.preview-prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.preview-prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.preview-prose mark { background: color-mix(in srgb, var(--accent) 24%, transparent); padding: 0 .12em; border-radius: 3px; }
.preview-prose .wr-callout {
  margin: 0 0 1em;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--accent-soft);
}
.preview-prose .wr-callout-title { margin: 0 0 .35em; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.preview-prose .wr-callout-note { border-color: var(--accent); }
.preview-prose .wr-callout-warning, .preview-prose .wr-callout-caution { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, var(--surface)); }
.preview-prose .wr-callout-danger, .preview-prose .wr-callout-error { border-color: var(--warm); background: var(--warm-soft); }
.preview-prose .wr-callout-tip, .preview-prose .wr-callout-success { border-color: var(--green); background: var(--green-soft); }
.preview-prose .wr-math { font-family: var(--font-mono); font-size: .88em; color: var(--ink-2); }
.preview-prose .wr-toc { padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); margin: 0 0 1em; }
.preview-prose .wr-toc ul { margin: 0; padding-left: 1.1em; }
.preview-prose .wr-toc a { text-decoration: none; }

/* small demo tiles */
.demo-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.demo-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .18s ease, box-shadow .18s ease, transform .2s var(--ease);
}
.demo-tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--ink) 14%, var(--line)); box-shadow: var(--shadow-sm); }
.demo-tile h3 { font-size: 1.02rem; }
.demo-tile p { font-size: .84rem; color: var(--ink-2); }
.demo-tile .top { display: flex; align-items: center; gap: 9px; }
.demo-tile .top svg { width: 18px; height: 18px; color: var(--accent); }
.demo-tile .foot { margin-top: auto; padding-top: 8px; }

/* media demo */
.media-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 12px;
  min-height: 380px;
}
.media-shell writer-media-manager { display: block; }
.media-shell writer-media-manager .panel { margin: 0 auto; }
.media-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 340px;
  text-align: center;
  color: var(--ink-2);
}
.media-empty svg { width: 42px; height: 42px; color: var(--ink-3); }
.media-picked {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
  background: var(--surface);
}

/* component buttons */
.component-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* api demo */
.api-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.api-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.api-actions .btn { height: 34px; padding: 0 11px; font-size: 11.5px; border-radius: 7px; }
.pdf-result {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-2);
  white-space: pre-wrap;
  min-height: 54px;
}
.pdf-result.ok { border-color: color-mix(in srgb, var(--green) 40%, var(--line)); background: var(--green-soft); color: var(--green); }
.pdf-result.err { border-color: color-mix(in srgb, var(--warm) 40%, var(--line)); background: var(--warm-soft); color: var(--warm); }

/* ---------------------------------------------------------------- sdk */
.sdk-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.sdk-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.sdk-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sdk-head .logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}
.sdk-head h3 { font-size: 1.05rem; }
.sdk-head .pkg { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); }
.sdk-col .code { flex: 1; }
.sdk-col .code pre { min-height: 236px; }

.parity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: .84rem;
  color: var(--ink-2);
}
.parity .oklist { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.parity .ok {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
}
.parity .ok svg { width: 11px; height: 11px; }

/* ---------------------------------------------------------------- quickstart */
.quickstart .tabs { display: grid; gap: 14px; }
.quickstart .tablist { margin-bottom: 0; }
.qs-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
  gap: 16px;
  align-items: stretch;
}
.qs-notes {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.qs-notes h3 { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.qs-notes ul { display: grid; gap: 9px; list-style: none; }
.qs-notes li { display: flex; gap: 9px; font-size: .84rem; color: var(--ink-2); }
.qs-notes li svg { width: 14px; height: 14px; flex: 0 0 auto; margin-top: 3px; color: var(--green); }
.qs-notes .foot { margin-top: auto; font-size: .78rem; color: var(--ink-3); }

/* ---------------------------------------------------------------- callouts */
.note, .warn, .tip {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface);
  font-size: .88rem;
  color: var(--ink-2);
}
.note svg, .warn svg, .tip svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 2px; color: var(--accent); }
.warn { border-left-color: var(--warm); background: var(--warm-soft); }
.warn svg { color: var(--warm); }
.tip { border-left-color: var(--green); background: var(--green-soft); }
.tip svg { color: var(--green); }
.note strong, .warn strong, .tip strong { color: var(--ink); }

/* ---------------------------------------------------------------- docs */
.docs-hero {
  padding: clamp(42px, 6vw, 72px) 0 clamp(28px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}
.docs-hero h1 { font-size: clamp(2.2rem, 4.4vw, 3.6rem); letter-spacing: -.032em; }
.docs-hero .lede { margin-top: 14px; max-width: 66ch; color: var(--ink-2); }
.docs-hero .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }

.docs-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: clamp(28px, 4vw, 64px);
  padding: clamp(34px, 5vw, 60px) 0 90px;
  align-items: start;
}
.docs-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 22px);
  max-height: calc(100vh - var(--header-h) - 40px);
  overflow: auto;
  padding-right: 8px;
}
.docs-sidebar .label {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.docs-nav { display: grid; gap: 1px; }
.docs-nav a {
  display: block;
  padding: 7px 10px;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  font-size: .84rem;
  color: var(--ink-2);
}
.docs-nav a:hover { color: var(--ink); background: var(--paper-2); }
.docs-nav a.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); }
.docs-nav .sub { padding-left: 18px; font-size: .79rem; }
.docs-nav .gap { height: 12px; }

.prose { min-width: 0; max-width: 820px; }
.prose > section { padding-top: 8px; margin-bottom: 54px; scroll-margin-top: calc(var(--header-h) + 24px); }
.prose h2 {
  font-size: clamp(1.65rem, 2.6vw, 2.1rem);
  letter-spacing: -.025em;
  padding-bottom: 12px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.prose h3 { margin: 30px 0 10px; font-size: 1.22rem; }
.prose h3[id], .prose h4[id] { scroll-margin-top: calc(var(--header-h) + 24px); }
.prose h4 { margin: 22px 0 8px; font-family: var(--font-ui); font-size: .98rem; font-weight: 650; }
.prose p { margin: 0 0 14px; color: var(--ink-2); }
.prose strong { color: var(--ink); font-weight: 650; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 1.3em; color: var(--ink-2); }
.prose li { margin: 5px 0; }
.prose li::marker { color: var(--ink-3); }
.prose a:not(.btn) { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.prose code.inline { white-space: normal; overflow-wrap: anywhere; }
.prose .code { margin: 16px 0 18px; }
.prose .note, .prose .warn, .prose .tip { margin: 18px 0; }
.prose blockquote {
  margin: 18px 0;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--line);
  color: var(--ink-2);
}
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

.table-wrap { margin: 16px 0 20px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
table.api {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
table.api th, table.api td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-2);
  text-align: left;
  vertical-align: top;
}
table.api thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
table.api tr:last-child td { border-bottom: 0; }
table.api td code { font-family: var(--font-mono); font-size: .92em; color: var(--ink); }
table.api td:first-child { white-space: nowrap; }

.docs-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: .84rem;
  color: var(--ink-3);
}

/* ---------------------------------------------------------------- faq */
.faq { border-top: 1px solid var(--line); }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 4px;
  list-style: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -.01em;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .plus {
  position: relative;
  flex: 0 0 auto;
  width: 18px; height: 18px;
  margin-left: auto;
}
.faq-item summary .plus::before,
.faq-item summary .plus::after {
  content: "";
  position: absolute;
  inset: 8px 0 auto 0;
  height: 2px;
  border-radius: 2px;
  background: var(--ink-3);
  transition: transform .2s ease;
}
.faq-item summary .plus::after { transform: rotate(90deg); }
.faq-item[open] summary .plus::after { transform: rotate(0deg); }
.faq-item .answer { padding: 0 34px 22px 4px; color: var(--ink-2); font-size: .92rem; max-width: 74ch; }

/* ---------------------------------------------------------------- cta */
.cta-band {
  position: relative;
  overflow: hidden;
  padding: clamp(54px, 7vw, 90px) 0;
  background: var(--ink);
  color: var(--paper);
}
.cta-band::before {
  content: "";
  position: absolute;
  inset: -40% -10%;
  background:
    radial-gradient(600px 300px at 20% 20%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 70%),
    radial-gradient(500px 260px at 82% 80%, color-mix(in srgb, var(--warm) 28%, transparent), transparent 70%);
  opacity: .55;
  pointer-events: none;
}
.cta-band .wrap { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 28px; justify-content: space-between; }
.cta-band h2 { font-size: clamp(1.9rem, 3.4vw, 2.8rem); letter-spacing: -.03em; max-width: 18ch; }
.cta-band p { margin-top: 10px; color: color-mix(in srgb, var(--paper) 66%, transparent); max-width: 48ch; }
.cta-band .actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cta-band .btn-ghost { background: transparent; border-color: color-mix(in srgb, var(--paper) 24%, transparent); color: var(--paper); }
.cta-band .btn-ghost:hover { border-color: var(--paper); }
.cta-band .btn-accent { background: var(--paper); color: var(--ink); }
.cta-band .btn-accent:hover { background: var(--accent); color: var(--accent-ink); }
html[data-theme="dark"] .cta-band { background: var(--surface); color: var(--ink); border-top: 1px solid var(--line); }
html[data-theme="dark"] .cta-band p { color: var(--ink-2); }
html[data-theme="dark"] .cta-band .btn-accent { background: var(--accent); color: var(--accent-ink); }
html[data-theme="dark"] .cta-band .btn-ghost { border-color: var(--line); color: var(--ink); }

/* ---------------------------------------------------------------- footer */
.site-footer {
  padding: 58px 0 34px;
  background: var(--paper);
  border-top: 1px solid var(--line);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, minmax(0, 1fr));
  gap: 34px;
}
.footer-brand .brand { margin: 0 0 12px; }
.footer-brand p { max-width: 36ch; font-size: .85rem; color: var(--ink-2); }
.footer-brand .badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.footer-col h3 {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.footer-col a {
  display: block;
  padding: 4px 0;
  font-size: .85rem;
  color: var(--ink-2);
}
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  margin-top: 44px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: .76rem;
  color: var(--ink-3);
}
.footer-bottom .mono { font-size: 10px; }
.footer-bottom a {
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--ink-3) 50%, transparent);
  text-underline-offset: 2px;
}
.footer-bottom a:hover { color: var(--accent); }

/* ---------------------------------------------------------------- reveal */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: var(--delay, 0ms);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .window-bar .live i { animation: none; }
  .btn:hover, .card:hover, .demo-tile:hover { transform: none; }
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-demo { order: 2; }
  .hero-copy { order: 1; }
  .hero h1 { max-width: 18ch; }
  .playground-grid { grid-template-columns: minmax(0, 1fr); }
  .playground-side { position: static; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sdk-grid { grid-template-columns: minmax(0, 1fr); }
  .sdk-col .code pre { min-height: 0; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step:nth-child(2) { border-right: 0; }
  .step:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .footer-grid { grid-template-columns: 1.4fr repeat(2, minmax(0, 1fr)); }

  .main-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    max-height: calc(100dvh - var(--header-h));
    overflow: auto;
    padding: 12px 16px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
    box-shadow: var(--shadow-md);
    z-index: 60;
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 11px 12px; font-size: .95rem; }
  .nav-toggle { display: inline-flex; }
}

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .docs-sidebar {
    position: static;
    max-height: none;
    padding: 0 0 8px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 8px;
  }
  .docs-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; }
  .docs-nav .gap { display: none; }
  .lab { grid-template-columns: minmax(0, 1fr); }
  .qs-grid { grid-template-columns: minmax(0, 1fr); }
  .api-board { grid-template-columns: minmax(0, 1fr); }
  .demo-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; padding-left: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid color-mix(in srgb, var(--paper) 14%, transparent); }
}

@media (max-width: 760px) {
  :root { --header-h: 60px; }
  .wrap, .wrap-narrow { width: calc(100% - 32px); }
  body { font-size: 16px; }

  .main-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px 16px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
    box-shadow: var(--shadow-md);
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 11px 12px; font-size: .95rem; }
  .nav-toggle { display: inline-flex; }

  .brand .version { display: none; }
  .hero { padding-top: 34px; }
  .hero h1 { font-size: clamp(2.15rem, 8.4vw, 3rem); }
  .hero .lede { font-size: .98rem; }
  .hero-cta .btn { flex: 1 1 auto; }
  .hero-points { gap: 8px 16px; font-size: .78rem; }

  .grid-3, .grid-2, .demo-tiles { grid-template-columns: minmax(0, 1fr); }
  .flow-row { flex-direction: column; }
  .flow-arrow { transform: rotate(90deg); flex-basis: 22px; }
  .flow-node { flex-basis: auto; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .step { border-right: 0; border-bottom: 1px solid var(--line); padding-right: 0; }
  .step:last-child { border-bottom: 0; }

  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }

  .docs-nav { grid-template-columns: minmax(0, 1fr); }
  .prose h2 { font-size: 1.55rem; }
  .table-wrap table.api { min-width: 560px; }

  .hero-demo-bar .hint { display: none; }
  .hero-demo-bar .seg { flex: 1; }
  .hero-demo-bar .seg button { flex: 1; }
}

/* ---------------------------------------------------------------- demo extras */
.demo-error {
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--warm) 40%, var(--line));
  border-radius: 8px;
  background: var(--warm-soft);
  color: var(--warm);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.6;
}
.lab-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
}
.lab-meta .spacer { flex: 1; }
.media-shell { overflow-x: auto; }
.media-shell writer-media-manager {
  --wr-color-accent: var(--accent);
  --wr-color-accent-contrast: var(--accent-ink);
  --wr-color-bg: var(--surface);
  --wr-color-bg-subtle: var(--surface-2);
  --wr-color-border: var(--line);
  --wr-color-text: var(--ink);
  --wr-color-muted: var(--ink-3);
  --wr-color-danger: var(--warm);
  --wr-font-sans: var(--font-ui);
  --wr-font-mono: var(--font-mono);
  --wr-radius: 8px;
  --wr-radius-lg: 12px;
}
.media-pick-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.media-pick-row img {
  width: 44px; height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.media-pick-row code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .media-shell { padding: 0; border: 0; background: transparent; min-height: 0; }
  .media-empty { min-height: 300px; }
}

@media (max-width: 480px) {
  .header-actions .btn { display: none; }
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .stat { border-left: 0; padding-left: 0; border-bottom: 1px solid color-mix(in srgb, var(--paper) 14%, transparent); }
  .stat:last-child { border-bottom: 0; }
  .btn { height: 44px; padding: 0 16px; font-size: .9rem; }
  .hero-cta { flex-direction: column; }
  .hero-cta .btn { width: 100%; }
  .quickstart .tablist { width: 100%; }
  .quickstart .tablist [role="tab"] { flex: 1 1 auto; justify-content: center; padding: 0 8px; }
  .demo-body { padding: 10px; }
  .card { padding: 22px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
}
