/*
  Adam™ Programming Language

  Copyright © 2026-present tinyBigGAMES™ LLC
  All Rights Reserved.

  https://adamlang.org

  SPDX-License-Identifier: MPL-2.0

  This Source Code Form is subject to the terms of the
  Mozilla Public License, v. 2.0. If a copy of the MPL
  was not distributed with this file, You can obtain one
  at https://mozilla.org/MPL/2.0/.

  ---

  Design system: tokens. Every color, font, size, space and effect the site and the docs use,
  read from Adam's logo: a dark silicon die, a crystal cyan faceted A, gold chip pins, chrome
  type and the glowing ouroboros ring of a compiler that builds itself.

  One definition per token. A color token is light-dark(<light>, <dark>): the theme is the root's
  color-scheme, which follows the system until the toggle (ds.js) sets data-theme on <html>.
  Code blocks stay on the dark die in both themes (the editor's look), so the syntax tokens are
  single values. view_check.js fails a page whose stylesheets use a token defined nowhere.
*/

:root {
  color-scheme: light dark;

  /* ---- surfaces: the die, from the deepest layer up ---- */
  --ds-bg: light-dark(#f4f7fb, #05080e);
  --ds-bg-2: light-dark(#e9eff7, #080d16);
  --ds-surface: light-dark(#ffffff, #0c131f);
  --ds-surface-2: light-dark(#f2f6fb, #111b2b);
  --ds-surface-3: light-dark(#e3ebf5, #172438);
  --ds-line: light-dark(rgb(16 44 84 / 0.12), rgb(120 210 255 / 0.11));
  --ds-line-strong: light-dark(rgb(16 44 84 / 0.24), rgb(120 210 255 / 0.24));
  --ds-scrim: light-dark(rgb(10 18 30 / 0.55), rgb(2 4 8 / 0.78));
  --ds-scrim-deep: light-dark(rgb(10 18 30 / 0.9), rgb(2 4 8 / 0.95));

  /* ---- type colors: chrome on the die ---- */
  --ds-text: light-dark(#0b1522, #e4ecf6);
  --ds-text-strong: light-dark(#02070e, #ffffff);
  --ds-muted: light-dark(#3f5068, #9cadc4);
  --ds-muted-2: light-dark(#5f7088, #6c7d96);

  /* ---- the logo's colors ---- */
  --ds-cyan: light-dark(#007fac, #3bd8ff);
  --ds-cyan-soft: light-dark(rgb(0 127 172 / 0.10), rgb(59 216 255 / 0.12));
  --ds-cyan-glow: light-dark(rgb(0 127 172 / 0.28), rgb(59 216 255 / 0.42));
  --ds-gold: light-dark(#9a6a00, #f4c24f);
  --ds-gold-soft: light-dark(rgb(154 106 0 / 0.10), rgb(244 194 79 / 0.12));
  --ds-gold-glow: light-dark(rgb(154 106 0 / 0.28), rgb(244 194 79 / 0.40));
  --ds-ring: light-dark(#5a3fd0, #8f7bff);
  --ds-on-accent: #02121a;

  /* ---- roles ---- */
  --ds-brand: var(--ds-cyan);
  --ds-accent: var(--ds-gold);
  --ds-link: light-dark(#006a92, #6fe2ff);
  --ds-link-hover: light-dark(#003f58, #c2f4ff);
  --ds-focus: light-dark(#9a6a00, #f4c24f);
  --ds-ok: light-dark(#0b7d51, #3fdc98);
  --ds-warn: light-dark(#a04f00, #ffae4a);
  --ds-err: light-dark(#c01f3c, #ff5f78);
  --ds-hint: light-dark(#4b3fc7, #a597ff);
  --ds-ok-soft: light-dark(rgb(11 125 81 / 0.10), rgb(63 220 152 / 0.10));
  --ds-warn-soft: light-dark(rgb(160 79 0 / 0.10), rgb(255 174 74 / 0.10));
  --ds-err-soft: light-dark(rgb(192 31 60 / 0.09), rgb(255 95 120 / 0.10));
  --ds-hint-soft: light-dark(rgb(75 63 199 / 0.09), rgb(165 151 255 / 0.10));

  /* ---- the code die (dark in both themes) ---- */
  --ds-code-bg: #060a11;
  --ds-code-bar: #0b121d;
  --ds-code-line: rgb(120 210 255 / 0.14);
  --ds-code-text: #d8e4f2;
  --ds-code-muted: #6d7f98;
  --ds-inline-code-bg: light-dark(rgb(0 127 172 / 0.08), rgb(59 216 255 / 0.09));
  --ds-inline-code-text: light-dark(#0a3d55, #bdefff);
  --ds-tk-keyword: #59d2ff;
  --ds-tk-type: #f4c24f;
  --ds-tk-string: #9fe38c;
  --ds-tk-number: #ff9f6b;
  --ds-tk-comment: #5f7590;
  --ds-tk-directive: #c9a0ff;
  --ds-out-ok: #3fdc98;
  --ds-out-err: #ff5f78;
  --ds-out-info: #59d2ff;
  --ds-out-note: #ffae4a;
  --ds-out-dim: #6d7f98;

  /* ---- type ---- */
  --ds-sans: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, sans-serif;
  --ds-display: "Segoe UI Variable Display", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --ds-mono: "Cascadia Code", "JetBrains Mono", "SF Mono", Menlo, Consolas, ui-monospace, monospace;
  --ds-fs-xs: 0.75rem;
  --ds-fs-sm: 0.875rem;
  --ds-fs-md: 1rem;
  --ds-fs-lg: 1.125rem;
  --ds-fs-xl: 1.375rem;
  --ds-fs-2xl: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  --ds-fs-3xl: clamp(1.9rem, 1.3rem + 2.4vw, 2.9rem);
  --ds-fs-hero: clamp(2.4rem, 1.4rem + 5vw, 4.6rem);
  --ds-lh: 1.65;
  --ds-lh-tight: 1.15;
  --ds-tracking-caps: 0.14em;

  /* chrome: the wordmark's polished metal, top light to a dark band and back */
  --ds-chrome: linear-gradient(180deg, var(--ds-text-strong) 0%, var(--ds-text) 42%, var(--ds-muted) 54%, var(--ds-text-strong) 100%);
  --ds-crystal: linear-gradient(120deg, var(--ds-cyan) 0%, var(--ds-ring) 55%, var(--ds-gold) 100%);

  /* ---- space (a 4 px grid) ---- */
  --ds-sp-1: 0.25rem;
  --ds-sp-2: 0.5rem;
  --ds-sp-3: 0.75rem;
  --ds-sp-4: 1rem;
  --ds-sp-5: 1.5rem;
  --ds-sp-6: 2rem;
  --ds-sp-7: 3rem;
  --ds-sp-8: 4.5rem;
  --ds-sp-9: 7rem;

  /* ---- layout ---- */
  --ds-max: 1240px;
  --ds-max-text: 74ch;
  --ds-gutter: clamp(1rem, 0.5rem + 2.5vw, 2rem);
  --ds-nav-h: 64px;
  --ds-sidenav-w: 15.5rem;
  --ds-toc-w: 13rem;

  /* ---- shape: chip corners, tight not soft ---- */
  --ds-radius-sm: 4px;
  --ds-radius: 8px;
  --ds-radius-lg: 14px;

  /* ---- depth ---- */
  --ds-shadow: 0 1px 2px rgb(0 0 0 / 0.18), 0 10px 30px -12px rgb(0 0 0 / 0.45);
  --ds-glow: 0 0 0 1px var(--ds-cyan-glow), 0 8px 28px -10px var(--ds-cyan-glow);
  --ds-glow-gold: 0 0 0 1px var(--ds-gold-glow), 0 8px 28px -10px var(--ds-gold-glow);

  /* ---- motion ---- */
  --ds-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ds-fast: 140ms;
  --ds-slow: 420ms;

  /* ---- layers ---- */
  --ds-z-nav: 50;
  --ds-z-backdrop: 90;
  --ds-z-zoomed: 100;
  --ds-z-close: 110;
}

/* The toggle's choice (ds.js, and the pre-paint script in every page's head) */
:root[data-theme="light"] {
  color-scheme: light;
}

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

@media (prefers-reduced-motion: reduce) {
  :root {
    --ds-fast: 1ms;
    --ds-slow: 1ms;
  }
}
