/* Creator Guard docs — Pastel Blocks look of creator-guard.com (tailwind.config.js tokens). */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  src: url('/fonts/bricolage-latin.woff2') format('woff2');
}

:root {
  --cream: #FBF8F3;
  --ink: #241543;
  --blush: #D12A5F;
  --lav: #D8CFFB;
  --rose: #FAD0E0;
  --butter: #FAE88E;
  --mint: #CDEFD8;

  --bg: var(--cream);
  --surface: #ffffff;
  --text: var(--ink);
  --muted: rgba(36, 21, 67, 0.68);
  --line: rgba(36, 21, 67, 0.18);
  --line-strong: var(--ink);
  --link: #b0204f;
  --accent-bg: var(--lav);
  --inline-code-bg: rgba(36, 21, 67, 0.07);
  --shadow: 3px 3px 0 var(--ink);
  --shadow-soft: 4px 4px 0 rgba(36, 21, 67, 0.16);

  --accent-text: var(--text);

  /* light code theme (the dark one is in the dark tokens) */
  --code-bg: #f5f1fc;
  --code-head: #ebe4fa;
  --code-text: #241543;
  --code-muted: #5c5276;
  --code-line: var(--ink);
  --copy-line: rgba(36, 21, 67, 0.3);
  --tok-str: #17703f;
  --tok-key: #5a3bc0;
  --tok-num: #8a5300;
  --tok-kw: #b0204f;
  --tok-com: #6b6283;
  --tok-var: #0b5f8a;

  /* callouts + beta banner: pastel tints in light, muted tints in dark */
  --note-bg: color-mix(in srgb, var(--mint) 55%, var(--surface));
  --warn-bg: color-mix(in srgb, var(--butter) 60%, var(--surface));

  --radius: 14px;
  --font-display: 'Bricolage Grotesque', Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  color-scheme: light;
}

/* Dark = brand dark: pastel accents (lavender blocks, rose links) on near-black. Two entry points with the same tokens: the system setting
   (unless the visitor picked light with the toggle) and an explicit data-theme="dark" (src/theme.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f0d13;
    --surface: #18151f;
    --text: #fbf8f3;
    --muted: #bdb6ca;
    --line: rgba(251, 248, 243, 0.12);
    --line-strong: rgba(216, 207, 251, 0.5);
    --link: #ff9ec2;
    --accent-bg: var(--lav);
    --accent-text: var(--ink);
    --inline-code-bg: rgba(216, 207, 251, 0.12);
    --shadow: 3px 3px 0 rgba(216, 207, 251, 0.3);
    --shadow-soft: 4px 4px 0 rgba(216, 207, 251, 0.12);
    --note-bg: #1c2b24;
    --warn-bg: #2c2817;
    /* dark code theme: pastel tokens on near-black */
    --code-bg: #0b0910;
    --code-head: #1a1622;
    --code-text: #f1ecff;
    --code-muted: #a99cc9;
    --code-line: rgba(216, 207, 251, 0.35);
    --copy-line: rgba(241, 236, 255, 0.35);
    --tok-str: #b8f0c8;
    --tok-key: #d8cffb;
    --tok-num: #fae88e;
    --tok-kw: #ffb0cd;
    --tok-com: #968bb5;
    --tok-var: #a9dcff;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0f0d13;
  --surface: #18151f;
  --text: #fbf8f3;
  --muted: #bdb6ca;
  --line: rgba(251, 248, 243, 0.12);
  --line-strong: rgba(216, 207, 251, 0.5);
  --link: #ff9ec2;
  --accent-bg: var(--lav);
  --accent-text: var(--ink);
  --inline-code-bg: rgba(216, 207, 251, 0.12);
  --shadow: 3px 3px 0 rgba(216, 207, 251, 0.3);
  --shadow-soft: 4px 4px 0 rgba(216, 207, 251, 0.12);
  --note-bg: #1c2b24;
  --warn-bg: #2c2817;
  /* dark code theme: pastel tokens on near-black */
  --code-bg: #0b0910;
  --code-head: #1a1622;
  --code-text: #f1ecff;
  --code-muted: #a99cc9;
  --code-line: rgba(216, 207, 251, 0.35);
  --copy-line: rgba(241, 236, 255, 0.35);
  --tok-str: #b8f0c8;
  --tok-key: #d8cffb;
  --tok-num: #fae88e;
  --tok-kw: #ffb0cd;
  --tok-com: #968bb5;
  --tok-var: #a9dcff;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font-body);
  overflow-x: hidden;
}
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--blush); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; height: auto; }

.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 0.5rem; z-index: 50; background: var(--surface); padding: 0.5rem 0.75rem; border: 2px solid var(--line-strong); border-radius: 8px; }

/* ── header ─────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.6rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--text); }
.brand img { display: block; width: 110px; height: auto; }
.brand .logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .brand .logo-light { display: none; }
  :root:not([data-theme='light']) .brand .logo-dark { display: block; }
}
:root[data-theme='dark'] .brand .logo-light { display: none; }
:root[data-theme='dark'] .brand .logo-dark { display: block; }
.brand-tag {
  font: 700 0.8rem/1 var(--font-display);
  padding: 0.3rem 0.55rem; border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--accent-bg); color: var(--accent-text);
}
.header-links { margin-left: auto; display: flex; gap: 1.1rem; font: 600 0.92rem var(--font-display); }
.header-links a { color: var(--text); text-decoration: none; }
.header-links a:hover { text-decoration: underline; }
.menu-toggle { display: none; }

/* theme toggle (needs src/theme.js): moon in light, sun in dark */
.theme-toggle {
  display: none; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem; padding: 0; cursor: pointer;
  color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px;
}
.theme-js .theme-toggle { display: inline-flex; }
.theme-toggle:hover { background: var(--accent-bg); color: var(--accent-text); }
.theme-toggle svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .i-moon { fill: currentColor; stroke: none; }
.theme-toggle .i-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme='light']) .theme-toggle .i-moon { display: none; }
}
:root[data-theme='dark'] .theme-toggle .i-sun { display: block; }
:root[data-theme='dark'] .theme-toggle .i-moon { display: none; }

/* ── layout ─────────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 210px;
  gap: 2.5rem;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.sidebar { position: sticky; top: 4.2rem; align-self: start; max-height: calc(100vh - 4.5rem); overflow-y: auto; padding: 1.5rem 0 2rem; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.nav-group + .nav-group { margin-top: 1.25rem; }
.nav-heading { margin: 0 0 0.35rem; font: 800 0.75rem/1.2 var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.sidebar a {
  display: block; padding: 0.32rem 0.7rem; border-radius: 10px; border: 1px solid transparent;
  color: var(--text); text-decoration: none; font: 500 0.95rem/1.35 var(--font-body);
}
.sidebar a:hover { background: var(--inline-code-bg); }
.sidebar a[aria-current='page'] { background: var(--accent-bg); color: var(--accent-text); border-color: var(--line-strong); font-weight: 700; box-shadow: var(--shadow); }

.content { min-width: 0; padding: 2rem 0 3rem; }
.toc { position: sticky; top: 4.2rem; align-self: start; padding: 2.2rem 0; font-size: 0.875rem; }
.toc-heading { margin: 0 0 0.5rem; font: 800 0.75rem var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.toc ul { list-style: none; margin: 0; padding: 0 0 0 0.75rem; border-left: 2px solid var(--line); }
.toc li { margin: 0.3rem 0; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--text); }
.toc code { font-size: 0.85em; }

/* ── prose ──────────────────────────────────────────── */
.prose { max-width: 48rem; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--font-display); line-height: 1.2; position: relative; }
.prose h1 { font-size: clamp(2rem, 4vw, 2.6rem); font-weight: 800; margin: 0 0 1rem; letter-spacing: -0.01em; }
.prose h2 { font-size: 1.55rem; font-weight: 800; margin: 2.6rem 0 0.8rem; padding-top: 0.4rem; }
.prose h3, .prose .h3-look { font-size: 1.2rem; font-weight: 700; margin: 2rem 0 0.6rem; padding-top: 0; }
.prose h4, .prose .h4-look { font-size: 1.02rem; font-weight: 700; margin: 1.6rem 0 0.5rem; }
.anchor { position: absolute; left: -1.1em; color: var(--muted); text-decoration: none; opacity: 0; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }
.prose p, .prose ul, .prose ol { margin: 0 0 1rem; }
.prose li { margin: 0.25rem 0; }
.prose .lead { font-size: 1.12rem; color: var(--muted); }
.prose :not(pre) > code {
  font: 0.86em var(--font-mono); background: var(--inline-code-bg);
  padding: 0.12em 0.38em; border-radius: 6px; overflow-wrap: anywhere;
}
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

/* cards on the home page */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; margin: 1.5rem 0 2rem; padding: 0; list-style: none; }
.cards li { margin: 0; }
.cards a {
  display: block; height: 100%; padding: 1rem 1.1rem; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--shadow);
  transition: transform 0.12s, box-shadow 0.12s;
}
.cards a:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }
.cards strong { display: block; font: 800 1.05rem var(--font-display); margin-bottom: 0.25rem; }
.cards span { color: var(--muted); font-size: 0.93rem; }
.cards li:nth-child(4n+1) a { background: var(--mint); color: var(--ink); }
.cards li:nth-child(4n+2) a { background: var(--lav); color: var(--ink); }
.cards li:nth-child(4n+3) a { background: var(--butter); color: var(--ink); }
.cards li:nth-child(4n+4) a { background: var(--rose); color: var(--ink); }
.cards li a span { color: rgba(36, 21, 67, 0.75); }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 0 1.25rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 520px; }
th, td { text-align: left; vertical-align: top; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); }
thead th { font: 700 0.82rem var(--font-display); background: var(--inline-code-bg); }
tbody tr:last-child td { border-bottom: 0; }
td p { margin: 0 0 0.4rem; }
td p:last-child { margin: 0; }
table.fields td:first-child { white-space: nowrap; }

/* callouts */
.callout { margin: 1.25rem 0; padding: 0.9rem 1.1rem; border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.callout.note { background: var(--note-bg); }
.callout.warning { background: var(--warn-bg); }
.callout-title { margin: 0 0 0.3rem !important; font: 800 0.85rem var(--font-display); text-transform: uppercase; letter-spacing: 0.05em; }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }

/* endpoint + status chips */
.endpoint {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 1rem 0 1.25rem; padding: 0.7rem 0.9rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.endpoint code { font: 600 0.92rem var(--font-mono); overflow-wrap: anywhere; background: none !important; padding: 0 !important; }
.method { font: 800 0.8rem var(--font-display); padding: 0.25rem 0.55rem; border-radius: 8px; background: var(--mint); color: var(--ink); border: 1px solid var(--ink); }
.status { display: inline-block; min-width: 3.1em; text-align: center; font: 800 0.85rem var(--font-mono); padding: 0.15rem 0.45rem; border-radius: 8px; border: 1px solid var(--ink); color: var(--ink); }
.status.ok { background: var(--mint); }
.status.err { background: var(--rose); }
.response { margin-bottom: 1.5rem; }
.example-name { margin: 0.75rem 0 0.35rem !important; font-size: 0.85rem; color: var(--muted); }
.resp-header { margin-bottom: 0.25rem !important; }
.value-list { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0 !important; }
.value-list li { margin: 0; }

/* ── code ───────────────────────────────────────────── */
.code { margin: 0 0 1.25rem; border-radius: var(--radius); overflow: hidden; background: var(--code-bg); border: 1px solid var(--code-line); box-shadow: var(--shadow-soft); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 0.35rem 0.5rem 0.35rem 0.9rem; background: var(--code-head); }
.code-lang { font: 600 0.75rem var(--font-mono); color: var(--code-muted); text-transform: none; }
.copy {
  font: 600 0.75rem var(--font-display); color: var(--code-text); background: transparent; cursor: pointer;
  border: 1px solid var(--copy-line); border-radius: 8px; padding: 0.2rem 0.6rem; visibility: hidden;
}
.js .copy { visibility: visible; }
.copy:hover { background: var(--inline-code-bg); }
.copy.done { background: var(--mint); color: var(--ink); border-color: var(--mint); }
pre { margin: 0; padding: 0.9rem 1rem 1rem; overflow-x: auto; color: var(--code-text); font: 0.85rem/1.6 var(--font-mono); tab-size: 2; }
pre code { font: inherit; white-space: pre; }
.tok-str { color: var(--tok-str); }
.tok-key { color: var(--tok-key); }
.tok-num, .tok-lit { color: var(--tok-num); }
.tok-kw { color: var(--tok-kw); }
.tok-com { color: var(--tok-com); font-style: italic; }
.tok-var { color: var(--tok-var); }
.tok-flag { color: var(--tok-num); }

.code-tabs { margin: 0 0 1.25rem; }
.code-tabs .code { margin: 0; border-top-left-radius: 0; }
.js .code-tabs .code-lang { visibility: hidden; }
.tab-list { display: flex; gap: 0.25rem; overflow-x: auto; }
.tab-list button {
  font: 700 0.82rem var(--font-display); color: var(--text); cursor: pointer;
  padding: 0.4rem 0.85rem; border: 1px solid var(--line-strong); border-bottom: 0;
  border-radius: 10px 10px 0 0; background: var(--surface);
}
.tab-list button[aria-selected='true'] { background: var(--code-head); color: var(--code-text); border-color: var(--code-line); box-shadow: inset 0 3px 0 var(--blush); }
.js .tab-panel:not(.active) { display: none; }
.tab-panel + .tab-panel { margin-top: 0.75rem; }
.js .tab-panel + .tab-panel { margin-top: 0; }

/* ── pager + footer ─────────────────────────────────── */
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; max-width: 48rem; }
.pager a {
  display: flex; flex-direction: column; padding: 0.7rem 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius);
  text-decoration: none; color: var(--text); font: 700 0.98rem var(--font-display); background: var(--surface); box-shadow: var(--shadow-soft);
}
.pager a span { font: 500 0.78rem var(--font-body); color: var(--muted); }
.pager-next { margin-left: auto; text-align: right; }
.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 1rem 2rem; text-align: center; font-size: 0.85rem; color: var(--muted); }
.site-footer a { color: var(--muted); }
.site-footer .build-line { margin-top: 0.35rem; font-size: 0.78rem; font-variant-numeric: tabular-nums; }

/* staging builds only (RELEASE_ENV=staging) */
.env-badge {
  position: fixed; right: 0.75rem; bottom: 0.75rem; z-index: 50; pointer-events: none;
  padding: 0.2rem 0.55rem; border: 1px solid #241543; border-radius: 999px;
  background: #FAE88E; color: #241543; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em;
  box-shadow: 2px 2px 0 rgba(36, 21, 67, 0.25);
}

/* ── responsive ─────────────────────────────────────── */
@media (max-width: 1100px) {
  .shell { grid-template-columns: 230px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 820px) {
  .shell { display: block; padding: 0 1rem; }
  .menu-toggle {
    display: inline-flex; align-items: center; font: 700 0.85rem var(--font-display); color: var(--text);
    padding: 0.4rem 0.75rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); cursor: pointer;
  }
  .header-links a:nth-child(n+3) { display: none; }
  .sidebar { position: static; max-height: none; padding: 1rem 0; border-bottom: 1px solid var(--line); }
  .js .sidebar { display: none; }
  .js .sidebar.open { display: block; }
  .anchor { display: none; }
  .content { padding-top: 1.25rem; }
}
@media (max-width: 480px) {
  .header-links { display: none; }
  .brand { margin-left: auto; gap: 0.45rem; }
  .site-header { gap: 0.5rem; }
  .brand-tag { white-space: nowrap; }
  .pager { flex-direction: column; }
  .pager-next { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .site-header, .sidebar, .toc, .pager, .copy, .tab-list, .page-actions { display: none !important; }
  .shell { display: block; }
  .js .tab-panel:not(.active) { display: block; }
}

/* beta banner on every page (spec 5.7) and the error catalogue table */
.beta-banner { margin: 0 0 1.25rem; padding: 0.6rem 0.9rem; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--warn-bg); font-size: 0.92rem; }
table.errors td:first-child { white-space: nowrap; }

/* "Copy page for AI" / Markdown / "Open in Claude|ChatGPT" under every page title (llms.mjs, layout.mjs) */
.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: -0.5rem 0 1.5rem; }
.page-action {
  font: 600 0.8rem var(--font-display); color: var(--text); background: var(--surface); cursor: pointer; text-decoration: none;
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.3rem 0.8rem; line-height: 1.4;
}
.page-action:hover { background: var(--accent-bg); color: var(--accent-text); }
.copy-page { display: none; }
.js .copy-page { display: inline-block; }
.copy-page.done { background: var(--mint); color: var(--ink); }
