/*
 * Link To Card - one stylesheet for the marketing site and the dashboard.
 *
 * The look: warm paper, ink outlines, one loud tangerine, hard offset shadows
 * (never blur), a black serif for display type and mono for labels. Every
 * surface is a "card": 2px ink border + offset shadow.
 *
 * INDEX
 *   1  Tokens       colour, type, space, radius, shadow (light, dark, .band, .cta-band)
 *   2  Base         fonts, reset, headings, links, focus
 *   3  Layout       .container .section .section-alt .band .cta-band .page-top
 *                   .section-head .section-foot .eyebrow .lead .muted .hint
 *                   .stack .cluster .visually-hidden .link-arrow
 *   4  Chrome       .skip-link .site-header .brand .site-nav .site-footer
 *   5  Components   .btn (-primary -secondary -ghost -danger -sm -block, [aria-busy], [disabled])
 *                   .field .label .field-error .input .select .textarea .code-input
 *                   .check (checkbox, radio)  .segmented  .thumbs .thumb (thumbnail picker)
 *                   .tabs .tab  .card (-pop -quiet)  .table-wrap .table .table-caption  .badge (-accent -ok -warn -danger)
 *                   .alert (-info -ok -warn -danger)  .meter (-warn -danger, <progress>)
 *                   .modal (-header -body -footer, <dialog>)  .empty  .toast-region .toast (-ok -danger)
 *                   .code-block .copy-btn  code  .stepper (li.is-done, li[aria-current="step"])
 *                   mark.placeholder
 *   6  Prose        .prose (Markdown)  .page .page-legal  .docs .docs-menu .docs-nav .pager
 *   7  Marketing    .hero .playground .chat .msg .unfurl .composer .more .snippet
 *                   .steps .gallery .sample .plans .plan .topup .rules .rule-tag .faq .cta
 *   8  Small pages  .auth .auth-card .lost .contact-grid
 *   9  Motion       keyframes; everything is switched off under prefers-reduced-motion
 */

/* ---------------------------------------------------------------- 1 Tokens */
:root {
  color-scheme: light dark;

  --paper: #f6efe0;          /* page background */
  --paper-2: #eee5d0;        /* alternate sections, insets */
  --surface: #fffdf8;        /* cards, inputs */
  --ink: #18150f;            /* text and every strong outline */
  --text-muted: #5a5245;     /* 6.6:1 on --paper */
  --border: #d5c9ae;         /* hairlines inside cards */
  --accent: #ff5a26;         /* tangerine: primary button, shadows, marks. Text on it is --on-accent. */
  --accent-text: #b5390b;    /* the accent when it is text on paper; 5.2:1 */
  --on-accent: #18150f;
  --hl: #ffd43b;             /* marker yellow; text on it is always #18150f */
  --link: #2440d6;           /* the blue of a bare hyperlink */
  --focus: #2440d6;
  --shadow-ink: #18150f;
  --ok: #1c6b3a;
  --ok-soft: #dcefd9;
  --warn: #7a4a00;
  --warn-soft: #fde9b6;
  --danger: #b42318;
  --danger-soft: #fbded8;
  --info-soft: #e1e6fb;
  --code-bg: #18150f;        /* code is always light-on-ink */
  --code-text: #f4ecda;
  --code-muted: #a99f8a;

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-display: 'Source Serif 4', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: clamp(2rem, 1.35rem + 2.9vw, 3.25rem);
  --text-hero: clamp(2.75rem, 1.3rem + 6.2vw, 5.25rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --container: 74rem;
  --header-h: 4rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171510;
    --paper-2: #1f1c16;
    --surface: #24211a;
    --ink: #f4ecda;
    --text-muted: #b8ae9a;   /* 8:1 on --paper */
    --border: #453f32;
    --accent: #ff6a3a;
    --accent-text: #ff8d63;
    --link: #93a5ff;
    --focus: #ffd43b;
    --shadow-ink: #000;
    --ok: #86d6a2;
    --ok-soft: #16301f;
    --warn: #f3c56b;
    --warn-soft: #33270f;
    --danger: #ff9f95;
    --danger-soft: #3a1a1a;
    --info-soft: #1f2545;
    --code-bg: #0e0c09;
  }
}

/* Tokens built from other tokens. They are declared on every scope that re-themes, so they follow the local --ink. */
:root,
.band,
.site-footer,
.cta-band {
  --line: var(--ink);        /* card and control outlines */
  --shadow-sm: 2px 2px 0 var(--shadow-ink);
  --shadow: 4px 4px 0 var(--shadow-ink);
  --shadow-lg: 8px 8px 0 var(--shadow-ink);
}

/* An ink section on a paper page. It re-declares the tokens, so every component inside adapts. */
.band,
.site-footer {
  --paper: #18150f;
  --paper-2: #221f18;
  --surface: #24211a;
  --ink: #f4ecda;
  --text-muted: #b8ae9a;
  --border: #453f32;
  --accent: #ff6a3a;
  --accent-text: #ff8d63;
  --link: #93a5ff;
  --focus: #ffd43b;
  --shadow-ink: #000;
  --code-bg: #0e0c09;
  color: var(--ink);
  background: var(--paper);
}

/* A tangerine section. Ink text and ink outlines in both colour schemes. */
.cta-band {
  --paper: var(--accent);
  --surface: #fffdf8;
  --ink: #18150f;
  --text-muted: #18150f;
  --shadow-ink: #18150f;
  --focus: #18150f;
  color: var(--ink);
  background: var(--accent);
}

@media (prefers-color-scheme: dark) {
  .band,
  .site-footer {
    --paper: #0e0c09;
    --paper-2: #171510;
  }
}

/* ---------------------------------------------------------------- 2 Base */
@font-face { font-family: 'Inter'; font-weight: 400; font-style: normal; font-display: swap; src: url('/assets/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-style: normal; font-display: swap; src: url('/assets/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-style: normal; font-display: swap; src: url('/assets/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-style: normal; font-display: swap; src: url('/assets/fonts/inter-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Source Serif 4'; font-weight: 900; font-style: normal; font-display: swap; src: url('/assets/fonts/source-serif-4-latin-900-normal.woff2') format('woff2'); }
@font-face { font-family: 'Source Serif 4'; font-weight: 900; font-style: italic; font-display: swap; src: url('/assets/fonts/source-serif-4-latin-900-italic.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-style: normal; font-display: swap; src: url('/assets/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); }

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 400 var(--text-md)/1.6 var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

#content { flex: 1; }
#content:focus { outline: none; }

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote, pre, fieldset { margin: 0; }
fieldset { min-width: 0; padding: 0; border: 0; }
legend { padding: 0; }
img, svg { max-width: 100%; }
img { height: auto; }
[hidden] { display: none !important; }

h1, h2 {
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.012em;
  text-wrap: balance;
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-lg); font-weight: 700; line-height: 1.3; }
h4 { font-size: var(--text-md); font-weight: 700; }
h1 em, h2 em {
  padding-inline: 0.08em;
  background: linear-gradient(transparent 56%, var(--hl) 56% 90%, transparent 90%);
}
/* Cream type cannot sit on marker yellow: on dark paper the word itself turns yellow. */
.band :is(h1, h2) em { color: var(--hl); background: none; }
@media (prefers-color-scheme: dark) {
  h1 em, h2 em { color: var(--hl); background: none; }
  .cta-band :is(h1, h2) em { color: inherit; text-decoration: underline; }
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 3px; }

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

::selection { color: #18150f; background: var(--hl); }

code, kbd, samp, pre { font-family: var(--font-mono); font-weight: 400; }
:not(pre) > code {
  padding: 0.1em 0.35em;
  font-size: 0.875em;
  background: var(--paper-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
}

mark.placeholder {
  padding: 0 0.25em;
  color: #18150f;
  background: var(--hl);
  border-radius: 3px;
}

/* ---------------------------------------------------------------- 3 Layout */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.section-alt { background: var(--paper-2); border-block: 2px solid var(--line); }
.page-top { padding-top: clamp(2.5rem, 6vw, 4.5rem); }

.section-head { max-width: 44rem; margin-bottom: clamp(2rem, 4vw, 3rem); }
.section-head > * + * { margin-top: var(--space-4); }
.section-head > p:not(.eyebrow):not(.hint) { font-size: var(--text-lg); color: var(--text-muted); }
.section-foot { margin-top: var(--space-6); color: var(--text-muted); }

/* A mono label, stuck on slightly crooked. */
.eyebrow {
  display: inline-block;
  padding: 0.3em 0.7em;
  font: 400 var(--text-xs)/1.4 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border-radius: 4px;
  transform: rotate(-1.5deg);
}

.lead { font-size: var(--text-xl); line-height: 1.35; font-weight: 500; }
.muted { color: var(--text-muted); }
.hint { font-size: var(--text-sm); color: var(--text-muted); }
.stack > * + * { margin-top: var(--space-4); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); }

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

.link-arrow { font-weight: 600; }
.link-arrow::after { content: '\2192'; display: inline-block; margin-left: 0.35em; transition: transform 0.15s; }
.link-arrow:hover::after { transform: translateX(4px); }

/* ---------------------------------------------------------------- 4 Chrome */
.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -4rem;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  font-weight: 600;
  color: #18150f;
  background: var(--hl);
  border: 2px solid #18150f;
  border-radius: var(--radius);
}
.skip-link:focus { top: var(--space-3); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  border-bottom: 2px solid var(--line);
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font: 900 1.3125rem/1 var(--font-display);
  letter-spacing: -0.02em;
  white-space: nowrap;
  text-decoration: none;
}
.brand-mark { flex: none; overflow: visible; transition: transform 0.15s; }
.brand:hover .brand-mark { transform: rotate(-8deg); }
.brand-mark-shadow { fill: var(--accent); }
.brand-mark-card { fill: var(--surface); stroke: currentColor; stroke-width: 2; }
.brand-mark-image { fill: currentColor; }
.brand-mark-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.8rem, 2.6vw, 1.75rem);
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
}
.site-nav > a:not(.btn) { padding-block: 0.3rem; text-decoration: none; border-bottom: 2px solid transparent; }
.site-nav > a:not(.btn):hover,
.site-nav > a[aria-current='page'] { border-bottom-color: var(--accent); }

@media (max-width: 34rem) {
  .site-header .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .site-nav { font-size: var(--text-sm); }
}

.site-footer { margin-top: auto; padding-block: var(--space-8) var(--space-6); border-top: 2px solid var(--line); }
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr));
  gap: var(--space-6) var(--space-5);
}
.footer-brand > * + * { margin-top: var(--space-4); }
.footer-brand p { max-width: 18rem; font: 900 var(--text-xl)/1.15 var(--font-display); letter-spacing: -0.01em; }
.site-footer h2 {
  margin-bottom: var(--space-3);
  font: 400 var(--text-xs)/1.4 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.site-footer ul { padding: 0; list-style: none; }
.site-footer li + li { margin-top: var(--space-2); }
.site-footer nav a { font-size: 0.9375rem; text-decoration: none; overflow-wrap: anywhere; }
.site-footer nav a:hover { text-decoration: underline; }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-5);
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  font-size: var(--text-sm);
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
@media (max-width: 56rem) {
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------- 5 Components */

/* Buttons: a key you can press. Hover lifts, :active pushes it into its shadow. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 2.75rem;
  padding: 0.5rem 1.15rem;
  font: 600 var(--text-md)/1.2 var(--font-sans);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 3px 3px 0 var(--shadow-ink);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--shadow-ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--shadow-ink); }
.btn-primary { color: var(--on-accent); background: var(--accent); }
.btn-danger { color: #fff; background: #b42318; }
.btn-sm { min-height: 2.125rem; padding: 0.25rem 0.75rem; font-size: var(--text-sm); box-shadow: 2px 2px 0 var(--shadow-ink); }
.btn-sm:hover { box-shadow: 3px 3px 0 var(--shadow-ink); }
.btn-sm:active { transform: translate(2px, 2px); }
.btn-ghost, .btn-ghost:hover, .btn-ghost:active { background: transparent; border-color: transparent; box-shadow: none; transform: none; }
.btn-ghost:hover { background: var(--paper-2); border-color: var(--line); }
.btn-block { display: flex; width: 100%; }
.btn:disabled,
.btn[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: 3px 3px 0 var(--shadow-ink); }
.btn[aria-busy='true'] { cursor: progress; }
.btn[aria-busy='true']::before {
  content: '';
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.cta-band .btn-primary { color: #f6efe0; background: #18150f; }

/* Form fields */
.field { display: grid; gap: 0.4rem; align-content: start; }
.label { font-size: var(--text-sm); font-weight: 600; }
.field-error { font-size: var(--text-sm); color: var(--danger); }

.input,
.select,
.textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  transition: box-shadow 0.1s;
}
.input::placeholder,
.textarea::placeholder { color: var(--text-muted); opacity: 0.8; }
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible { outline-offset: 0; box-shadow: 4px 4px 0 var(--accent); }
.input[aria-invalid='true'],
.textarea[aria-invalid='true'] { border-color: var(--danger); }
.input:disabled,
.select:disabled,
.textarea:disabled { opacity: 0.6; cursor: not-allowed; }
.textarea { min-height: 9rem; line-height: 1.5; resize: vertical; }
.code-input { font: 400 var(--text-sm)/1.6 var(--font-mono); tab-size: 2; white-space: pre; overflow-wrap: normal; }
.select {
  padding-right: 2.25rem;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 1.15rem) 55%, calc(100% - 0.8rem) 55%;
  background-size: 0.35rem 0.35rem;
  background-repeat: no-repeat;
}

/* Checkbox and radio: <label class="check"><input type="checkbox"> Text</label> */
.check { display: inline-flex; align-items: flex-start; gap: 0.6rem; cursor: pointer; }
.check input {
  flex: none;
  display: grid;
  place-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.15rem 0 0;
  appearance: none;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
}
.check input[type='radio'] { border-radius: 50%; }
.check input:checked { background: var(--accent); }
.check input:checked::after {
  content: '';
  width: 0.35rem;
  height: 0.65rem;
  margin-top: -0.12rem;
  border: solid var(--on-accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.check input[type='radio']:checked::after { width: 0.5rem; height: 0.5rem; margin: 0; background: var(--on-accent); border: 0; border-radius: 50%; transform: none; }

/* Segmented control: a radio group in one outline. */
.segmented {
  display: inline-flex;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
}
.segmented label { position: relative; cursor: pointer; }
.segmented label + label { border-left: 2px solid var(--line); }
.segmented input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.segmented span {
  display: block;
  min-height: calc(2.75rem - 4px);
  padding: 0.5rem 0.9rem;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.5rem;
}
.segmented label:first-child span { border-radius: 7px 0 0 7px; }
.segmented label:last-child span { border-radius: 0 7px 7px 0; }
.segmented input:checked + span { color: var(--paper); background: var(--ink); }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Thumbnail picker: a radio group of small pictures. */
.thumbs { display: grid; grid-template-columns: repeat(auto-fit, minmax(3rem, 1fr)); gap: var(--space-2) var(--space-3); }
.thumb { position: relative; display: grid; gap: 0.25rem; cursor: pointer; }
.thumb input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.thumb img,
.thumb-blank {
  display: block;
  width: 100%;
  aspect-ratio: 1200 / 630;
  background: var(--paper-2);
  border: 2px solid var(--line);
  border-radius: 7px;
  transition: transform 0.1s, box-shadow 0.1s;
}
.thumb span:last-child { font: 400 0.6875rem/1.3 var(--font-mono); text-align: center; color: var(--text-muted); }
.thumb:hover img,
.thumb:hover .thumb-blank { transform: translate(-1px, -1px); box-shadow: 2px 2px 0 var(--shadow-ink); }
.thumb input:checked ~ img,
.thumb input:checked ~ .thumb-blank { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--accent); }
.thumb input:checked ~ span:last-child { color: var(--ink); font-weight: 700; }
.thumb input:focus-visible ~ img,
.thumb input:focus-visible ~ .thumb-blank { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Tabs: folder tabs on a line. Mark the open one with aria-selected="true" or aria-current="page". */
.tabs { display: flex; gap: var(--space-1); overflow-x: auto; border-bottom: 2px solid var(--line); }
.tab {
  flex: none;
  margin-bottom: -2px;
  padding: 0.55rem 1rem;
  font: 600 0.9375rem/1.4 var(--font-sans);
  color: var(--text-muted);
  text-decoration: none;
  background: none;
  border: 2px solid transparent;
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected='true'],
.tab[aria-current='page'] { color: var(--ink); background: var(--surface); border-color: var(--line); box-shadow: inset 0 3px 0 var(--accent); }

.card {
  padding: var(--space-5);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card-pop { box-shadow: 8px 8px 0 var(--accent); }
.card h2 { font-size: var(--text-2xl); line-height: 1.1; }
.card-quiet { border: 1px solid var(--border); box-shadow: none; }

/* Tables always sit in .table-wrap, which scrolls sideways on small screens. */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
}
.table-wrap table { width: 100%; font-size: 0.9375rem; line-height: 1.45; border-collapse: collapse; }
.table-wrap th,
.table-wrap td { padding: 0.7rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.table-wrap thead th {
  font: 400 var(--text-xs)/1.4 var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--paper-2);
  border-bottom: 2px solid var(--line);
}
.table-wrap tbody th { font-weight: 600; }
.table-wrap tbody tr:last-child > * { border-bottom: 0; }
/* An identifier such as invalid_request must not break mid-word; the wrapper scrolls instead. */
.table-wrap td:first-child code, .table-wrap td:nth-child(2) code { white-space: nowrap; }
.table-caption { margin: var(--space-6) 0 var(--space-3); font-weight: 600; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.1rem 0.55rem;
  font: 400 var(--text-xs)/1.5 var(--font-mono);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 999px;
}
.badge-accent { color: var(--on-accent); background: var(--accent); }
.badge-ok { color: var(--ok); background: var(--ok-soft); border-color: var(--ok); }
.badge-warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn); }
.badge-danger { color: var(--danger); background: var(--danger-soft); border-color: var(--danger); }

.alert {
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  background: var(--surface);
  border: 2px solid var(--line);
  border-left-width: 8px;
  border-radius: var(--radius);
}
.alert-info { background: var(--info-soft); border-color: var(--link); }
.alert-ok { background: var(--ok-soft); border-color: var(--ok); }
.alert-warn { background: var(--warn-soft); border-color: var(--warn); }
.alert-danger { background: var(--danger-soft); border-color: var(--danger); }

/* <progress class="meter" value="40" max="100"> */
.meter {
  display: block;
  width: 100%;
  height: 1rem;
  overflow: hidden;
  appearance: none;
  color: var(--accent);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 999px;
}
.meter::-webkit-progress-bar { background: transparent; }
.meter::-webkit-progress-value { background: currentColor; border-right: 2px solid var(--line); }
.meter::-moz-progress-bar { background: currentColor; }
.meter-warn { color: var(--hl); }
.meter-danger { color: #d92d20; }

/* <dialog class="modal"> */
.modal {
  width: min(32rem, calc(100vw - 2rem));
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 8px 8px 0 var(--accent);
}
.modal::backdrop { background: rgb(24 21 15 / 0.65); }
.modal-header { padding: var(--space-5) var(--space-5) 0; }
.modal-header h2 { font-size: var(--text-2xl); }
.modal-body { padding: var(--space-4) var(--space-5); }
.modal-body > * + * { margin-top: var(--space-4); }
.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.empty {
  padding: var(--space-7) var(--space-5);
  text-align: center;
  color: var(--text-muted);
  border: 2px dashed var(--text-muted);
  border-radius: var(--radius-lg);
}
.empty > * + * { margin-top: var(--space-3); }
.empty h2, .empty h3 { font: 900 var(--text-2xl)/1.1 var(--font-display); color: var(--ink); }

/* Toasts: put .toast elements into one fixed .toast-region (role="status"). */
.toast-region {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 80;
  display: grid;
  gap: var(--space-2);
  width: min(24rem, calc(100vw - 2rem));
}
.toast {
  padding: 0.7rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--accent);
  animation: toast-in 0.2s ease-out;
}
.toast-ok { box-shadow: 4px 4px 0 #3fb968; }
.toast-danger { box-shadow: 4px 4px 0 #d92d20; }

/* Code block with a language tag on its top edge and a Copy button (site.js: data-copy). */
.code-block {
  position: relative;
  color: var(--code-text);
  background: var(--code-bg);
  border: 2px solid var(--line);
  border-radius: var(--radius);
}
.code-block pre {
  padding: 1.1rem 1.15rem;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.7;
  tab-size: 2;
}
.code-block[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  left: 0.9rem;
  padding: 0 0.5em;
  font: 400 0.6875rem/1.5 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #18150f;
  background: var(--hl);
  border: 1.5px solid #18150f;
  border-radius: 4px;
  transform: translateY(-55%) rotate(-2deg);
}
/* The Copy button sits on the top edge, like the language tag, so it never covers code. */
.copy-btn {
  position: absolute;
  top: 0;
  right: 0.9rem;
  padding: 0 0.6em;
  font: 400 0.6875rem/1.5 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #18150f;
  background: #fffdf8;
  border: 1.5px solid #18150f;
  border-radius: 4px;
  box-shadow: 2px 2px 0 var(--accent);
  transform: translateY(-55%);
  cursor: pointer;
}
.copy-btn:hover { background: var(--hl); }
.copy-btn:active { box-shadow: none; transform: translate(2px, calc(-55% + 2px)); }

/* Stepper: <ol class="stepper"><li class="is-done">..</li><li aria-current="step">..</li><li>..</li></ol> */
.stepper { display: flex; padding: 0; list-style: none; counter-reset: stepper; }
.stepper li {
  position: relative;
  flex: 1;
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  padding-inline: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: center;
  color: var(--text-muted);
  counter-increment: stepper;
}
.stepper li::before {
  content: counter(stepper);
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  font: 900 var(--text-md)/1 var(--font-display);
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 50%;
}
.stepper li + li::after {
  content: '';
  position: absolute;
  top: calc(1.125rem - 1px);
  right: 50%;
  width: 100%;
  border-top: 2px dashed var(--text-muted);
}
.stepper li.is-done { color: var(--ink); }
.stepper li.is-done::before { content: '\2713'; font-family: var(--font-sans); color: var(--paper); background: var(--ink); }
.stepper li.is-done + li::after { border-top-style: solid; border-top-color: var(--line); }
.stepper li[aria-current='step'] { font-weight: 700; color: var(--ink); }
.stepper li[aria-current='step']::before { color: var(--on-accent); background: var(--accent); box-shadow: 3px 3px 0 var(--shadow-ink); }

/* ---------------------------------------------------------------- 6 Prose */
.prose { max-width: 44rem; font-size: 1.0625rem; line-height: 1.72; overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.15em; }
.prose h1 { margin-top: var(--space-4); font-size: clamp(2.25rem, 1.6rem + 2.8vw, 3.25rem); }
.prose h1 + * { margin-top: 1.5em; }
.prose h2 { margin-top: 2.4em; font-size: clamp(1.5rem, 1.3rem + 0.9vw, 1.875rem); line-height: 1.15; letter-spacing: -0.012em; }
.prose h3 { margin-top: 2em; font-size: 1.1875rem; }
.prose h4 { margin-top: 1.6em; }
.prose :is(h2, h3, h4) + * { margin-top: 0.7em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.4em; }
.prose li > ul, .prose li > ol { margin-top: 0.4em; }
.prose ::marker { color: var(--accent-text); font-weight: 600; }
.prose strong { font-weight: 600; }
.prose blockquote { padding: 0.2em 0 0.2em 1.1em; color: var(--text-muted); border-left: 4px solid var(--accent); }
.prose hr { margin-block: 2.5em; border: 0; border-top: 2px dashed var(--border); }
.prose .code-block, .prose .table-wrap { margin-block: 1.6em; font-size: var(--text-md); }
.prose .anchor { margin-left: 0.3em; font-family: var(--font-sans); font-weight: 400; color: var(--accent-text); text-decoration: none; opacity: 0; }
.prose :is(h2, h3, h4):hover .anchor, .prose .anchor:focus-visible { opacity: 1; }

.page { padding-block: clamp(2rem, 6vw, 4.5rem) clamp(3rem, 8vw, 6rem); }
.page > .prose { margin-inline: auto; }
.page-legal > .prose { max-width: 42rem; }
/* Long-form pages are a sheet of paper lying on the desk. */
@media (min-width: 48rem) {
  .page > .prose {
    max-width: 54rem;
    padding: clamp(2.5rem, 5vw, 4.5rem) clamp(2.5rem, 6vw, 5rem);
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
  }
  .page-legal > .prose { max-width: 52rem; }
}

.docs {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: var(--space-7);
  padding-block: var(--space-7) clamp(3rem, 8vw, 6rem);
}
.docs-sidebar {
  position: sticky;
  top: calc(var(--header-h) + var(--space-5));
  align-self: start;
  max-height: calc(100vh - var(--header-h) - var(--space-7));
  overflow-y: auto;
  padding: 0 6px 6px 0;
}
.docs-menu > summary { display: none; }
.docs-nav ul { display: grid; gap: 2px; padding: 0; list-style: none; }
.docs-nav a {
  display: block;
  padding: 0.4rem 0.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius);
}
.docs-nav a:hover { color: var(--ink); background: var(--paper-2); }
.docs-nav a[aria-current='page'] { color: var(--ink); background: var(--surface); border-color: var(--line); box-shadow: 3px 3px 0 var(--accent); }
@media (max-width: 60rem) {
  .docs { grid-template-columns: minmax(0, 1fr); gap: var(--space-5); padding-top: var(--space-5); }
  .docs-sidebar { position: static; max-height: none; padding: 0; overflow: visible; }
  .docs-menu { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
  .docs-menu > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    font-weight: 600;
    list-style: none;
    cursor: pointer;
  }
  .docs-menu > summary::-webkit-details-marker { display: none; }
  .docs-menu > summary::after { content: '+'; font: 400 1.25rem/1 var(--font-mono); }
  .docs-menu[open] > summary::after { content: '\2212'; }
  .docs-menu[open] > summary { border-bottom: 2px solid var(--line); }
  .docs-nav { padding: var(--space-2); }
}

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); max-width: 44rem; margin-top: var(--space-8); }
.pager a {
  display: block;
  padding: 0.8rem 1rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 3px 3px 0 var(--shadow-ink);
  transition: transform 0.08s, box-shadow 0.08s;
}
.pager a:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--accent); }
.pager a span { display: block; margin-bottom: 0.2rem; font: 400 var(--text-xs)/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.pager-next { text-align: right; }

/* ---------------------------------------------------------------- 7 Marketing */
.hero { position: relative; padding-block: clamp(2rem, 5vw, 4rem) clamp(3rem, 7vw, 5.5rem); overflow: clip; }
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1.5px 1.5px, color-mix(in srgb, var(--border) 65%, transparent) 1.5px, transparent 0);
  background-size: 24px 24px;
  -webkit-mask-image: linear-gradient(#000 55%, transparent);
  mask-image: linear-gradient(#000 55%, transparent);
  pointer-events: none;
}
.hero > * { position: relative; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: var(--space-7) clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.hero-copy > * + * { margin-top: var(--space-5); }
.hero-copy h1 { font-size: var(--text-hero); line-height: 0.98; }
.hero-copy > p:not([class]) { max-width: 30rem; font-size: var(--text-lg); color: var(--text-muted); }
.hero-actions { margin-top: var(--space-6); }
.hero-actions .btn { min-height: 3.5rem; padding-inline: 1.9rem; font-size: 1.1875rem; font-weight: 700; box-shadow: 5px 5px 0 var(--shadow-ink); }
.hero-actions .btn:hover { box-shadow: 7px 7px 0 var(--shadow-ink); transform: translate(-2px, -2px); }
.hero-actions .btn:active { box-shadow: 0 0 0 var(--shadow-ink); transform: translate(5px, 5px); }
.hero-copy .hint { margin-top: var(--space-3); }

/* The playground is a chat window lying on two loose cards. */
.playground { position: relative; }
.playground::before,
.playground::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--line);
  border-radius: 18px;
}
.playground::before { background: var(--hl); transform: rotate(3deg) translate(8px, 4px); }
.playground::after { background: var(--accent); transform: rotate(-2deg) translate(-6px, 6px); }
.chat {
  position: relative;
  z-index: 1;
  overflow: hidden;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 18px;
}
.chat-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.5rem 0.9rem;
  font: 400 var(--text-xs)/1.5 var(--font-mono);
  color: var(--text-muted);
  border-bottom: 2px solid var(--line);
}
.chat-dots { display: inline-flex; gap: 5px; }
.chat-dots i { width: 10px; height: 10px; border: 2px solid var(--line); border-radius: 50%; }
.chat-dots i:first-child { background: var(--accent); }
.chat-dots i:nth-child(2) { background: var(--hl); }
.chat-live { display: inline-flex; align-items: center; gap: 0.4em; margin-left: auto; color: var(--ink); text-transform: uppercase; letter-spacing: 0.06em; }
.chat-live::before { content: ''; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; animation: pulse 1.6s ease-in-out infinite; }

.chat-thread { padding: 0.9rem 1.1rem 1.1rem; }
.msg + .msg { margin-top: 0.35rem; }
.msg-label { margin-bottom: 0.3rem; font: 400 0.6875rem/1.4 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.msg-row { display: flex; align-items: flex-start; gap: var(--space-2); }
.msg-bubble {
  min-width: 0;
  padding: 0.45rem 0.75rem;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 4px 14px 14px 14px;
}
.msg-link { display: block; overflow: hidden; font: 400 0.8125rem/1.6 var(--font-mono); text-overflow: ellipsis; white-space: nowrap; }
.msg-plain .msg-bubble { color: var(--text-muted); border: 2px dashed var(--border); }
.msg-rich .msg-label { color: var(--ink); }
.msg-rich .msg-bubble { padding: 0.6rem 0.75rem 0.75rem; }
.msg-rich .msg-link { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.msg-arrow {
  flex: none;
  width: 2.75rem;
  height: 3.25rem;
  margin: 0.3rem 0 -2rem;
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.unfurl {
  margin-top: 0.5rem;
  overflow: hidden;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--shadow-ink);
  transform-origin: 0 0;
  animation: unfurl 0.7s cubic-bezier(0.2, 0.9, 0.25, 1.12) 0.3s both;
}
.unfurl-frame { position: relative; aspect-ratio: 1200 / 630; background: var(--paper-2); }
.unfurl-frame img { display: block; width: 100%; height: 100%; transition: opacity 0.15s; }
.unfurl-frame img.is-fresh { animation: pop 0.3s ease-out; }
.unfurl-frame[aria-busy='true'] img { opacity: 0.55; }
.unfurl-frame[aria-busy='true']::after {
  content: 'rendering';
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.1rem 0.5rem;
  font: 400 0.6875rem/1.5 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #18150f;
  background: var(--hl);
  border: 1.5px solid #18150f;
  border-radius: 4px;
  animation: pulse 1s ease-in-out infinite;
}
.unfurl-status { position: absolute; inset: 0; display: grid; place-items: center; font: 400 var(--text-sm)/1.4 var(--font-mono); color: var(--text-muted); }
.unfurl-error { position: absolute; inset: auto 0.5rem 0.5rem; font-size: var(--text-sm); }
.unfurl-meta { display: grid; gap: 0.1rem; padding: 0.55rem 0.75rem 0.65rem; border-top: 2px solid var(--line); }
.unfurl-host { font: 400 0.6875rem/1.4 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.unfurl-meta strong { font-size: 0.9375rem; line-height: 1.3; overflow-wrap: anywhere; }
.unfurl-desc { display: -webkit-box; overflow: hidden; font-size: var(--text-sm); line-height: 1.4; color: var(--text-muted); -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }

.composer { display: grid; gap: 0.9rem; padding: 1rem 1.1rem 1.1rem; background: var(--paper-2); border-top: 2px solid var(--line); }
.composer-title .label { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); font-size: var(--text-md); }
.composer-cue { font: 400 var(--text-xs)/1.4 var(--font-mono); color: var(--accent-text); }
.composer-cue::before { content: '\2191\00a0'; }
.composer-title .input { min-height: 3.1rem; font-size: 1.0625rem; font-weight: 500; box-shadow: 4px 4px 0 var(--shadow-ink); }
.composer-title .input:focus-visible { box-shadow: 4px 4px 0 var(--accent); }
.more > summary { display: inline-flex; align-items: center; gap: 0.5em; font-size: var(--text-sm); font-weight: 600; list-style: none; cursor: pointer; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before {
  content: '+';
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  font: 400 1rem/1 var(--font-mono);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 5px;
}
.more[open] > summary::before { content: '\2212'; }
.more-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-3); margin-top: var(--space-3); }
.field-wide { grid-column: 1 / -1; }

.snippet {
  display: grid;
  grid-template-columns: minmax(0, 21rem) minmax(0, 1fr);
  gap: var(--space-5) var(--space-7);
  align-items: center;
  margin-top: clamp(3rem, 6vw, 4.5rem);
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.snippet-text > * + * { margin-top: var(--space-3); }
.snippet-text h2 { font-size: var(--text-2xl); line-height: 1.1; }
.snippet-text p { font-size: 0.9375rem; color: var(--text-muted); }
.snippet-code pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* How it works: three numbered rows joined by a dashed line. */
.steps { padding: 0; list-style: none; counter-reset: step; }
.steps > li {
  position: relative;
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) minmax(0, 1.3fr);
  gap: var(--space-4) var(--space-6);
  align-items: start;
  padding-bottom: var(--space-7);
  counter-increment: step;
}
.steps > li:last-child { padding-bottom: 0; }
.steps > li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  font: 900 2.25rem/1 var(--font-display);
  color: var(--on-accent);
  background: var(--accent);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 4px 4px 0 var(--hl);
  transform: rotate(-3deg);
}
.steps > li:nth-child(2)::before { transform: rotate(2.5deg); }
.steps > li:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 5rem;
  bottom: 0.75rem;
  left: calc(2rem - 1px);
  border-left: 2px dashed var(--text-muted);
}
.step-text { padding-top: 0.35rem; }
.step-text h3 { font: 900 var(--text-2xl)/1.1 var(--font-display); letter-spacing: -0.015em; }
.step-text p { margin-top: var(--space-3); color: var(--text-muted); }

/* The starter templates as prints taped to the page. */
.gallery { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-7) var(--space-6); }
.sample {
  --tilt: -1.4deg;
  position: relative;
  grid-column: span 2;
  padding: 0.6rem 0.6rem 0;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0 var(--shadow-ink);
  transform: rotate(var(--tilt));
  transition: transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.3), box-shadow 0.2s;
}
.sample:nth-child(2) { --tilt: 1.1deg; }
.sample:nth-child(3) { --tilt: -0.7deg; }
.sample:nth-child(4) { grid-column: 2 / span 2; --tilt: 1.5deg; }
.sample:nth-child(5) { --tilt: -1.1deg; }
.sample:hover { transform: rotate(0) translateY(-4px); box-shadow: 10px 10px 0 var(--accent); }
/* The strip of tape that holds the print. */
.sample::before {
  content: '';
  position: absolute;
  top: -0.8rem;
  left: 50%;
  width: 5.5rem;
  height: 1.5rem;
  background: color-mix(in srgb, var(--hl) 80%, transparent);
  border: 1px solid rgb(24 21 15 / 0.25);
  transform: translateX(-50%) rotate(calc(var(--tilt) * -2.5));
}
.sample-frame img,
.sample-missing { display: block; width: 100%; aspect-ratio: 1200 / 630; border: 1px solid var(--border); border-radius: 4px; }
.sample-missing { display: grid; place-items: center; font: 400 var(--text-sm)/1 var(--font-mono); color: var(--text-muted); background: var(--paper-2); }
.sample figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); padding: 0.55rem 0.3rem 0.6rem; font-weight: 600; }
.sample figcaption code { padding: 0; color: var(--accent-text); background: none; border: 0; }
.sample figcaption code::before { content: 'template='; color: var(--text-muted); }

/* Pricing */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); align-items: stretch; }
.plan {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 6px 6px 0 var(--shadow-ink);
}
.plan[data-plan='starter'] { box-shadow: 6px 6px 0 var(--hl); }
.plan[data-plan='pro'] { box-shadow: 6px 6px 0 var(--accent); }
.plan-name {
  align-self: flex-start;
  padding: 0.25em 0.7em;
  font: 400 var(--text-sm)/1.4 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border-radius: 4px;
  transform: rotate(-2deg);
}
.plan-price { display: flex; align-items: baseline; gap: var(--space-2); }
.plan-amount { font: 900 3.5rem/1 var(--font-display); letter-spacing: -0.03em; }
.plan-period { color: var(--text-muted); }
.plan-quota { padding: 0.5rem 0.75rem; color: #18150f; background: var(--hl); border: 2px solid #18150f; border-radius: var(--radius); }
.plan-quota strong { font-size: var(--text-lg); }
.plan-features { flex: 1; display: grid; gap: var(--space-2); align-content: start; padding: 0; font-size: 0.9375rem; list-style: none; }
.plan-features li { position: relative; padding-left: 1.6rem; }
.plan-features li::before { content: '\2713'; position: absolute; left: 0; font-weight: 700; color: var(--accent-text); }
.plan-billing { font-size: var(--text-sm); color: var(--text-muted); }

.topup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  margin-top: var(--space-7);
  padding: var(--space-5);
  background: var(--surface);
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
}
.topup h3 { font: 900 var(--text-2xl)/1.1 var(--font-display); letter-spacing: -0.015em; }
.topup p { max-width: 46rem; margin-top: var(--space-2); }
.topup .btn { flex: none; }

/* What counts: six short rules; the first three carry their count. */
.rules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); }
.rules > div { position: relative; padding: var(--space-5); background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-lg); }
.rules dt { font-size: var(--text-lg); font-weight: 700; line-height: 1.3; }
.rules dd { margin-top: var(--space-2); font-size: 0.9375rem; color: var(--text-muted); }
.rule-tag {
  position: absolute;
  top: 0;
  right: 1rem;
  padding: 0.1rem 0.5rem;
  font: 400 var(--text-xs)/1.5 var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #18150f;
  background: var(--hl);
  border: 1.5px solid #18150f;
  border-radius: 4px;
  transform: translateY(-55%) rotate(2deg);
}

/* FAQ */
.faq-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); gap: var(--space-6) var(--space-8); align-items: start; }
.faq-grid .section-head { position: sticky; top: calc(var(--header-h) + var(--space-6)); margin-bottom: 0; }
.faq { border-top: 2px solid var(--line); }
.faq-item { border-bottom: 2px solid var(--line); }
.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 1.1rem 0;
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.35;
  list-style: none;
  cursor: pointer;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  flex: none;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  font: 400 1.375rem/1 var(--font-mono);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 8px;
  box-shadow: 2px 2px 0 var(--shadow-ink);
  transition: transform 0.15s, background-color 0.15s;
}
.faq-item[open] summary::after { color: var(--on-accent); background: var(--accent); transform: rotate(45deg); }
.faq-item > div { max-width: 42rem; padding-bottom: 1.25rem; color: var(--text-muted); }
.faq-item > div > * + * { margin-top: var(--space-3); }

.cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-6); }
.cta > div:first-child { max-width: 40rem; }
.cta p { margin-top: var(--space-3); font-size: var(--text-lg); }
.cta a:not(.btn) { text-decoration-color: currentColor; }

/* ---------------------------------------------------------------- 8 Small pages */
.auth { display: grid; place-items: center; padding-block: clamp(3rem, 9vw, 7rem); }
.auth-card { position: relative; width: min(100%, 28rem); padding: clamp(1.5rem, 5vw, 2.25rem); }
.auth-card > * + *, .auth-card form > * + * { margin-top: var(--space-4); }
.auth-card h1 { font-size: clamp(2rem, 1.6rem + 1.6vw, 2.5rem); }
.auth-card .stack > * { margin-top: 0; }
.auth-card .stack > * + * { margin-top: var(--space-4); }

.lost { text-align: center; }
.lost > * + * { margin-top: var(--space-5); }
.lost h1 { max-width: 14em; }
.lost .cluster { justify-content: center; }
.lost-code { font: 900 clamp(7rem, 34vw, 15rem)/0.85 var(--font-display); letter-spacing: -0.04em; }
.lost-code span { display: inline-block; color: var(--accent); transform: rotate(14deg) translateY(0.04em); }

.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-7); align-items: start; }
.contact-grid .section-head { margin-bottom: 0; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 62rem) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .playground { max-width: 44rem; }
  .snippet { grid-template-columns: minmax(0, 1fr); }
  .steps > li { grid-template-columns: 4rem minmax(0, 1fr); }
  .steps > li > .code-block { grid-column: 2; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sample, .sample:nth-child(4) { grid-column: auto; }
  .plans, .rules { grid-template-columns: minmax(0, 1fr); }
  .plans { max-width: 32rem; }
  .faq-grid, .contact-grid { grid-template-columns: minmax(0, 1fr); }
  .faq-grid .section-head { position: static; }
  .topup { flex-direction: column; align-items: flex-start; }
}
@media (min-width: 40rem) and (max-width: 62rem) {
  .rules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 40rem) {
  .gallery { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
  .steps > li { grid-template-columns: 3rem minmax(0, 1fr); gap: var(--space-3) var(--space-4); padding-bottom: var(--space-6); }
  .steps > li::before { width: 3rem; height: 3rem; font-size: 1.75rem; border-radius: 12px; }
  .steps > li:not(:last-child)::after { top: 3.9rem; left: calc(1.5rem - 1px); }
  .steps > li > .code-block { z-index: 1; grid-column: 1 / -1; }
  .snippet-code pre { white-space: pre; overflow-wrap: normal; }
  .chat-thread { padding-inline: 0.8rem; }
  .composer { padding-inline: 0.8rem; }
  .more-grid { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { gap: var(--space-5); }
  .footer-grid nav:last-child { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------- 9 Motion */
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes pop { from { opacity: 0.4; transform: scale(0.97); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes unfurl {
  from { opacity: 0; transform: scale(0.9, 0.2); }
  60% { opacity: 1; }
}

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

/* Pricing: the "paid plans are coming soon" note shown while checkout is off. */
#coming-soon { margin-bottom: var(--space-5); }
