/*
 * RWDS semantic tokens — shared by the website, the design microsite and the
 * RWDS Storybook.
 *
 * The scales follow the systems in Practical UI and Refactoring UI:
 * a constrained spacing scale, a hand-built type scale, semantic colour roles
 * and shadows with both a contact and an ambient layer. Components read roles,
 * never raw values; themes supply the values.
 */

/* ── Palette accents ─────────────────────────────────────────────────────── */
:root {
  --teal: #2f8f6f;
  --amber: #8a5c24; /* 5.2:1 on --background, safe for small label text */
  --purple: #3f6b56;
  --accent-blue: #28694c;
}
:root[data-theme='dark'] {
  --teal: #5fc79f;
  --amber: #e0b878;
  --purple: #8fd0b4;
  --accent-blue: #6cc79b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --teal: #5fc79f;
    --amber: #e0b878;
    --purple: #8fd0b4;
    --accent-blue: #6cc79b;
  }
}

/* ── Semantic colour roles ───────────────────────────────────────────────── */
:root {
  color-scheme: light;

  --background: #e8ece7;
  --surface: #f8faf7;
  --surface-glass: rgba(248, 250, 247, 0.8);
  --foreground: #18201c;
  --foreground-muted: #5f6a62; /* 4.7:1 on --background, 5.4:1 on --surface */
  --border: #d3dbd1;
  --accent: #28694c;
  --accent-secondary: #3f8a68;
  --accent-hover: #1f5a41;
  --accent-contrast: #ffffff;
  --blue: #28694c;
  --cyan: #a6dcc3;
  --violet: #1f4a37;
  --navy: #0f1c16;
  --white: #fff;

  --shadow: 0 1px 2px rgba(15, 28, 22, 0.06), 0 20px 48px -28px rgba(15, 28, 22, 0.32);
  --radius: 40px;
  --blur: 22px;

  --hero-base: #123528;
  --hero-light: #8fd6b6;
  --hero-bottom: #2f6f52;
  --hero-purple: #1c4a37;
  --on-dark: #dcefe6;
  --deep-base: #0f1c16;
  --deep-muted: #a9c4b6;
}
:root[data-theme='dark'] {
  color-scheme: dark;

  --background: #0f1512;
  --surface: #161f1a;
  --surface-glass: rgba(20, 28, 23, 0.84);
  --foreground: #eef4f0;
  --foreground-muted: #a9bab0;
  --border: #30443a;
  --accent: #6cc79b;
  --accent-secondary: #8ad6b3;
  --accent-hover: #86d9b0;
  --accent-contrast: #0f1512;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.32), 0 24px 56px -30px rgba(0, 0, 0, 0.7);
  --hero-base: #0a1f17;
  --hero-light: #4f9d7c;
  --hero-bottom: #1d4636;
  --hero-purple: #123329;
  --deep-muted: #a9c4b6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;

    --background: #0f1512;
    --surface: #161f1a;
    --surface-glass: rgba(20, 28, 23, 0.84);
    --foreground: #eef4f0;
    --foreground-muted: #a9bab0;
    --border: #30443a;
    --accent: #6cc79b;
    --accent-secondary: #8ad6b3;
    --accent-hover: #86d9b0;
    --accent-contrast: #0f1512;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.32), 0 24px 56px -30px rgba(0, 0, 0, 0.7);
    --hero-base: #0a1f17;
    --hero-light: #4f9d7c;
    --hero-bottom: #1d4636;
    --hero-purple: #123329;
    --deep-muted: #a9c4b6;
  }
}

/* ── Spacing scale ─────────────────────────────────────────────────────────
   Adjacent steps stay at least ~25% apart, so choosing a step is fast. */
:root {
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;
}

/* ── Type scale ────────────────────────────────────────────────────────────
   Hand-built rather than modular: 12 / 14 / 16 / 18 / 22 / 28 / 36 / 48 / 64. */
:root {
  --text-xs: 12px;
  --text-sm: 14px;
  --text-body: 16px;
  --text-lead: 18px;
  --text-h4: 20px;
  --text-h3: 24px;
  --text-h2: clamp(30px, 3.4vw, 44px);
  --text-h1: clamp(40px, 5vw, 64px);
  --text-display: clamp(44px, 6vw, 80px);

  --leading-tight: 1.08;
  --leading-body: 1.65;
  --tracking-display: -0.035em;
  --tracking-heading: -0.025em;
  --tracking-label: 0.1em;

  /* em keeps the character count stable when the font size changes. */
  --measure: 34em;      /* ~68 characters at body size */
  --measure-wide: 36em; /* ~72 characters for wide prose */
}

/* ── Shape and motion ────────────────────────────────────────────────────── */
:root {
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-2xl: 40px;
  --radius-pill: 999px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-fast: 0.16s;
  --duration-base: 0.24s;
  --duration-slow: 0.4s;
}
