/* Shared by every page: tokens, header, buttons, footer. Page styles live in home.css, changelog.css and doc.css. */
:root {
  /* Brand spectrum (docs/branding.md) */
  --blue: #2196F3;
  --deep-blue: #1764E8;
  --sky: #3CC9FF;
  --yellow: #FFC93C;
  --orange: #FF9A3C;
  --purple: #6F5BFF;

  /* Light theme */
  --bg: #F6F7F9;
  --bg-alt: #EDEFF3;
  --surface: #FFFFFF;
  --surface-2: #F1F3F6;
  --border: #DADFE7;
  --text: #171B22;
  --muted: #555E6E;
  --faint: #7D8696;
  --link: #1764E8;
  --accent-ink: #1764E8;
  --btn-bg: #1764E8;
  --btn-bg-hover: #1257CC;
  --btn-text: #FFFFFF;
  --ai: #5A45F0;
  --warn: #9A6400;
  --warn-bg: #FFF4D6;
  --miss: #B4570A;
  --ok: #18794E;
  --ok-bg: #DDF3E6;
  --code-bg: #171B22;
  --code-text: #E6E9EF;
  --shadow: 0 1px 2px rgba(23,27,34,.06), 0 12px 32px -12px rgba(23,27,34,.18);

  --font-display: "Bricolage Grotesque", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --radius: 10px;
  --radius-lg: 16px;
  --max: 1160px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171B22;
    --bg-alt: #13161C;
    --surface: #232936;
    --surface-2: #1C212B;
    --border: #3A4153;
    --text: #FFFFFF;
    --muted: #A5ACBA;
    --faint: #7C8496;
    --link: #6DB8F7;
    --accent-ink: #3CC9FF;
    --btn-bg: #2196F3;
    --btn-bg-hover: #49A9F5;
    --btn-text: #06111C;
    --ai: #9C8FFF;
    --warn: #FFC93C;
    --warn-bg: rgba(255,201,60,.12);
    --miss: #FF9A3C;
    --ok: #5BD69A;
    --ok-bg: rgba(91,214,154,.12);
    --code-bg: #10131A;
    --code-text: #E6E9EF;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 24px 48px -16px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171B22;
  --bg-alt: #13161C;
  --surface: #232936;
  --surface-2: #1C212B;
  --border: #3A4153;
  --text: #FFFFFF;
  --muted: #A5ACBA;
  --faint: #7C8496;
  --link: #6DB8F7;
  --accent-ink: #3CC9FF;
  --btn-bg: #2196F3;
  --btn-bg-hover: #49A9F5;
  --btn-text: #06111C;
  --ai: #9C8FFF;
  --warn: #FFC93C;
  --warn-bg: rgba(255,201,60,.12);
  --miss: #FF9A3C;
  --ok: #5BD69A;
  --ok-bg: rgba(91,214,154,.12);
  --code-bg: #10131A;
  --code-text: #E6E9EF;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 24px 48px -16px rgba(0,0,0,.55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .2s ease-out, color .2s ease-out;
}
img { max-width: 100%; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; }
code, kbd, .mono { font-family: var(--font-mono); font-size: .9em; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; width: auto; height: auto; clip: auto; z-index: 100; padding: 8px 12px; background: var(--surface); border-radius: 8px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

/* Signature: one stripe per brand colour, like the bands in the logo. */
.spectrum { display: flex; height: 4px; }
.spectrum span { flex: 1; transform-origin: left; }
.spectrum span:nth-child(1) { background: var(--deep-blue); }
.spectrum span:nth-child(2) { background: var(--blue); }
.spectrum span:nth-child(3) { background: var(--sky); }
.spectrum span:nth-child(4) { background: var(--yellow); }
.spectrum span:nth-child(5) { background: var(--orange); }
.js .site-header .spectrum span { animation: stripe .7s var(--ease) both; }
.js .site-header .spectrum span:nth-child(2) { animation-delay: .06s; }
.js .site-header .spectrum span:nth-child(3) { animation-delay: .12s; }
.js .site-header .spectrum span:nth-child(4) { animation-delay: .18s; }
.js .site-header .spectrum span:nth-child(5) { animation-delay: .24s; }
@keyframes stripe { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Scroll reveal. Only hidden when JS is running, so the page still works without it. */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .55s var(--ease), transform .55s var(--ease); transition-delay: var(--d, 0ms); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease-out, box-shadow .2s ease-out;
}
.site-header.scrolled { border-bottom-color: var(--border); box-shadow: 0 8px 24px -18px rgba(0,0,0,.4); }
.nav { display: flex; align-items: center; gap: 28px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; transition: transform .25s var(--ease); }
.brand:hover img { transform: rotate(-8deg); }
.nav-links { display: flex; gap: 4px; font-size: 14.5px; }
.nav-links a { color: var(--muted); padding: 6px 10px; border-radius: 7px; transition: color .15s ease-out, background-color .15s ease-out; }
.nav-links a:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.nav-links a[aria-current="true"] { color: var(--text); background: var(--surface-2); }
.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
  transition: color .15s ease-out, background-color .15s ease-out;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }
#theme-toggle svg { transition: transform .35s var(--ease); }
#theme-toggle:active svg { transform: rotate(40deg) scale(.9); }
.theme-icon-light { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-light { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-dark { display: none; }
  :root:not([data-theme="light"]) .theme-icon-light { display: block; }
}
@media (max-width: 1100px) {
  .nav-links { display: none; }
  .nav .btn-sm { display: none; }
}

/* Section label used above page headings. */
.kicker { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 12.5px; color: var(--accent-ink); margin-bottom: 14px; }
.kicker::before { content: ""; width: 18px; height: 3px; border-radius: 2px; background: currentColor; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; line-height: 1.2; cursor: pointer;
  transition: background-color .15s ease-out, border-color .15s ease-out, transform .15s ease-out;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: none; transition: transform .2s var(--ease); }
.btn:hover svg.dl { transform: translateY(2px); }
.btn-primary { background: var(--btn-bg); color: var(--btn-text); }
.btn-primary:hover { background: var(--btn-bg-hover); }
.btn-ghost { border-color: var(--border); color: var(--text); background: var(--surface); }
.btn-ghost:hover { border-color: var(--faint); }
.btn-sm { padding: 8px 14px; font-size: 14px; border-radius: 8px; }
.btn small { font-weight: 500; opacity: .75; font-size: 12.5px; }

/* Footer */
footer { padding: 36px 0 48px; color: var(--muted); font-size: 14px; }
.foot { display: flex; flex-wrap: wrap; gap: 20px 32px; align-items: center; }
.foot .brand { font-size: 16px; }
.foot .brand img { width: 24px; height: 24px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.foot nav a { color: var(--muted); }
.foot .copy { margin-left: auto; }
@media (max-width: 760px) { .foot .copy { margin-left: 0; width: 100%; } }

.nav-links a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
[hidden] { display: none !important; }

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