/* =====================================================================
   Shared base for every page: fonts, tokens, reset, navigation, footer.
   Tokens first; every component reads from these.
   ===================================================================== */

/* Self-hosted variable fonts (SIL Open Font License, see fonts/OFL-*.txt), Latin subset */
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-var.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  /* surfaces — warm autumn / terminal-inspired */
  --bg: #171408;
  --bg-raise: #1d190b;
  --panel: #251f0d;
  --panel-2: #302710;
  --line: #3f3a1d;
  --line-strong: #5a5128;

  /* text */
  --text: #d8cba5;
  --muted: #9e9167;
  --faint: #717244;

  /* amber / rust / moss accents */
  --public: #d4a62a;
  --private: #b95a1f;
  --ok: #73932f;
  --warn: #d48425;
  --bad: #c65331;

  --public-dim: rgba(212, 166, 42, 0.14);
  --private-dim: rgba(185, 90, 31, 0.14);

  /* type */
  --sans: "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif;
  --display: "JetBrains Mono", "Archivo", ui-monospace, monospace;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --fs-xs: 0.78rem;
  --fs-sm: 0.875rem;
  --fs-base: 1.0625rem;
  --fs-md: 1.25rem;
  --fs-lg: 1.625rem;
  --fs-xl: clamp(1.9rem, 1.4rem + 1.6vw, 2.5rem);
  --fs-hero: clamp(2.5rem, 1.6rem + 3.6vw, 4.25rem);

  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 6px;

  --wrap: 1200px;
  --gutter: clamp(1rem, 3vw, 2rem);
  --section-gap: clamp(4.5rem, 8vw, 7.5rem);

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Preview appearance presets. */
html[data-palette="autumn"] {
  --bg: #171408;
  --bg-raise: #1d190b;
  --panel: #251f0d;
  --panel-2: #302710;
  --line: #3f3a1d;
  --line-strong: #5a5128;
  --text: #d8cba5;
  --muted: #9e9167;
  --faint: #717244;
  --public: #d4a62a;
  --private: #b95a1f;
  --ok: #73932f;
  --warn: #d48425;
  --bad: #c65331;
  --public-dim: rgba(212,166,42,.14);
  --private-dim: rgba(185,90,31,.14);
}

html[data-palette="deep-autumn"] {
  --bg: #100e07;
  --bg-raise: #171309;
  --panel: #211a0c;
  --panel-2: #2a2110;
  --line: #3a3119;
  --line-strong: #554624;
  --text: #e0d2ad;
  --muted: #a39268;
  --faint: #746d43;
  --public: #e0ad2c;
  --private: #c35e24;
  --ok: #849e36;
  --warn: #d8882e;
  --bad: #d15b38;
  --public-dim: rgba(224,173,44,.14);
  --private-dim: rgba(195,94,36,.14);
}

html[data-palette="forest"] {
  --bg: #0e130b;
  --bg-raise: #141b10;
  --panel: #1b2414;
  --panel-2: #25301b;
  --line: #344126;
  --line-strong: #4a5a33;
  --text: #d5d7b4;
  --muted: #929b70;
  --faint: #68704d;
  --public: #b6a33a;
  --private: #c36f32;
  --ok: #7fa13a;
  --warn: #d99a35;
  --bad: #b95438;
  --public-dim: rgba(182,163,58,.14);
  --private-dim: rgba(195,111,50,.14);
}

html[data-palette="ember"] {
  --bg: #170d08;
  --bg-raise: #211109;
  --panel: #2b160d;
  --panel-2: #381d10;
  --line: #4b2c1a;
  --line-strong: #694024;
  --text: #e2c6a2;
  --muted: #aa8563;
  --faint: #795d45;
  --public: #e3a12b;
  --private: #db6a24;
  --ok: #8a9b36;
  --warn: #e48829;
  --bad: #d15132;
  --public-dim: rgba(227,161,43,.14);
  --private-dim: rgba(219,106,36,.14);
}

html[data-palette="navy"] {
  --bg: #0a1322;
  --bg-raise: #0e1a2e;
  --panel: #13223a;
  --panel-2: #172a45;
  --line: #22344f;
  --line-strong: #2f4768;
  --text: #dde7f3;
  --muted: #95a8c3;
  --faint: #63779a;
  --public: #53c7e3;
  --private: #8f9bff;
  --ok: #45d49a;
  --warn: #e8b04e;
  --bad: #f0717a;
  --public-dim: rgba(83,199,227,.14);
  --private-dim: rgba(143,155,255,.14);
}

html[data-font="warm-mono"] {
  --sans: "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif;
  --display: "JetBrains Mono", "Archivo", ui-monospace, monospace;
}

html[data-font="archivo"] {
  --sans: "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif;
  --display: "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif;
}

html[data-font="full-mono"] {
  --sans: "JetBrains Mono", ui-monospace, monospace;
  --display: "JetBrains Mono", ui-monospace, monospace;
}

html[data-font="editorial"] {
  --sans: "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif;
  --display: Georgia, "Times New Roman", serif;
}

html[data-font="system"] {
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 7.5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: 1.6;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

p {
  margin: 0;
}

a {
  color: var(--public);
  text-underline-offset: 3px;
}

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

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

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  background: var(--panel);
  padding: 0.5rem 1rem;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
}

/* ============================== NAV ============================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
}

.brand {
  color: var(--text);
  font-family: var(--display);
  text-decoration: none;
  font-weight: 600;
  font-variation-settings: "wdth" 112;
  letter-spacing: -0.01em;
}

.topbar__links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.topbar__links a,
.footer__links a {
  color: var(--muted);
  text-decoration: none;
  font-size: var(--fs-sm);
}
.topbar__links a:hover,
.footer__links a:hover,
.topbar__links a[aria-current] {
  color: var(--text);
}

.jump {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  height: 2.5rem;
  align-items: center;
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.jump::-webkit-scrollbar {
  display: none;
}
.jump a {
  color: var(--faint);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s;
}
.jump a:hover,
.jump a.is-current {
  color: var(--text);
}

/* ============================== SECTIONS ============================== */

.section {
  padding-block: var(--section-gap) 0;
}
.section:last-of-type {
  padding-bottom: var(--section-gap);
}

.section__head {
  max-width: 44rem;
  margin-bottom: 2.25rem;
}
.section__head h2 {
  font-size: var(--fs-xl);
  font-variation-settings: "wdth" 110;
  letter-spacing: -0.025em;
}
.section__head p {
  color: var(--muted);
  margin-top: 0.85rem;
}

.fine {
  color: var(--faint);
  font-size: var(--fs-sm);
  margin-top: 1.25rem;
  max-width: 48rem;
}

.btn {
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--bg);
  background: var(--text);
  border: 0;
  border-radius: 999px;
  padding: 0.6rem 1.15rem;
  cursor: pointer;
  transition: background 0.2s;
}
.btn:hover {
  background: color-mix(in srgb, var(--text) 92%, white);
}
.btn:disabled {
  opacity: 0.55;
  cursor: progress;
}
.btn--quiet {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line-strong);
}
.btn--quiet:hover {
  background: var(--panel);
  color: var(--text);
}

.back {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-size: var(--fs-sm);
  margin-bottom: 2rem;
}
.back::before {
  content: "\2190\00a0";
}
.back:hover {
  color: var(--text);
}

/* ============================== FOOTER ============================== */

.footer {
  border-top: 1px solid var(--line);
  padding: 2.5rem 0 2rem;
  background: var(--bg-raise);
}
.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.footer p {
  color: var(--faint);
  font-size: var(--fs-sm);
  margin-top: 0.25rem;
}
.footer__links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer__copy {
  margin-top: 2rem !important;
}

@media (max-width: 640px) {
  .topbar__links {
    gap: 1rem;
  }
}

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