/* ==========================================================================
   Design tokens — single source for every visual value on the site.
   Sources: DESIGN.md (colors, typography, rounded, spacing) + animation-inspo.md §2 (motion).

   Three layers:
   1. Primitives  — raw values with neutral names (--gray-950, --blue-500). Never used by components.
   2. Semantic    — what a value means (--canvas, --ink, --surface-1). Components use only these.
                    Dark is the default theme; light overrides only the semantic color layer.
   3. Components  — styles.css reads semantic tokens; nothing in it should hold a raw color.

   Theme switch: <html data-theme="dark|light">, set in <head> from the saved choice or the system theme.
   No attribute (JS off) = dark.
   ========================================================================== */

/* 1 · Primitives ---------------------------------------------------------- */
:root {
  /* neutrals */
  --white: #ffffff;
  --black: #000000;
  --gray-50: #f6f6f6;
  --gray-100: #efefef;
  --gray-150: #e6e6e6;
  --gray-200: #dedede;
  --gray-300: #3d3d3d;
  --gray-700: #2b2b2b;
  --gray-500: #808080;
  --gray-550: #707070;
  --gray-600: #6b6b6b;
  --gray-400: #999999;
  --gray-800: #262626;
  --gray-850: #1c1c1c;
  --gray-875: #1a1a1a;
  --gray-900: #141414;
  --gray-950: #090909;

  /* chroma */
  --blue-500: #0099ff;
  --blue-600: #0071c2;
  --green-500: #22c55e;
  --green-600: #15803d;
  --magenta-500: #d44df0;
  --violet-500: #6a4cf5;

  /* channels for translucent colors: rgb(var(--x-rgb) / alpha) */
  --black-rgb: 0 0 0;
  --white-rgb: 255 255 255;
  --gray-950-rgb: 9 9 9;
  --blue-500-rgb: 0 153 255;
  --blue-600-rgb: 0 113 194;
}

/* 2 · Semantic — non-color (same in both themes) -------------------------- */
:root {
  /* type — GT Walsheim substitute per DESIGN.md "Note on Font Substitutes" */
  --font-display: "Geist", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --inter-features: "cv01", "cv05", "cv09", "cv11", "ss03", "ss07";

  /* rounded */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 15px;
  --r-xl: 20px;
  --r-xxl: 30px;
  --r-pill: 100px;
  --r-full: 9999px;

  /* spacing */
  --s-xxs: 4px;
  --s-xs: 8px;
  --s-sm: 12px;
  --s-md: 15px;
  --s-lg: 20px;
  --s-xl: 30px;
  --s-xxl: 40px;
  --s-section: 96px;

  /* layout */
  --container: 1199px;
  --gutter: var(--s-xl);
  --nav-h: 56px;

  /* motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-ed: cubic-bezier(.65, .05, 0, 1);
  --ease-hover: ease;
  --d-press: .14s;
  --d-hover: .2s;
  --d-ui: .3s;
  --d-enter: .6s;
  --press: .97;
  --lift: -2px;
  --rise: 24px;
}

@media (prefers-reduced-motion: reduce) {
  :root { --rise: 0px; --lift: 0px; --press: 1; }
}

/* 2 · Semantic — color, dark theme (default) ------------------------------ */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;

  /* brand & accent */
  --primary: var(--white);                 /* primary CTA fill, display type */
  --primary-hover: var(--gray-150);
  --on-primary: var(--black);              /* text on --primary */
  --accent-blue: var(--blue-500);          /* links, focus, active states */
  --on-accent: var(--black);               /* text on --accent-blue: black is 7:1, white 3:1 */
  --accent-glow: rgb(var(--blue-500-rgb) / .18);

  /* text */
  --ink: var(--white);
  --ink-muted: var(--gray-400);
  --ink-faded: var(--gray-500);            /* floor for faded skills pills, 4.6:1 on surface-1 */

  /* surfaces */
  --canvas: var(--gray-950);
  --surface-1: var(--gray-900);
  --surface-2: var(--gray-850);
  --hairline: var(--gray-800);
  --hairline-soft: var(--gray-875);
  --overlay: rgb(var(--gray-950-rgb) / .96);   /* lightbox */
  --backdrop: rgb(var(--black-rgb) / .6);
  --tag-on-color: rgb(var(--black-rgb) / .22);

  /* semantic */
  --semantic-success: var(--green-500);

  /* brand gradient */
  --gradient-magenta: var(--magenta-500);
  --gradient-violet: var(--violet-500);

  /* elevation */
  --shadow-menu: inset 0 0.5px 0 rgb(var(--white-rgb) / .10), 0 10px 30px rgb(var(--black-rgb) / .25);   /* level 2 */
  --shadow-float: 0 8px 24px rgb(var(--black-rgb) / .4);                                                /* toast, consent */
  --shadow-card-hover: 0 18px 40px -20px rgb(var(--black-rgb) / .75), 0 8px 28px -14px rgb(var(--blue-500-rgb) / .18);

  /* meta theme-color for the browser chrome (read by js/main.js) */
  --theme-color: var(--gray-950);
}

/* 2 · Semantic — color, light theme --------------------------------------- */
:root[data-theme="light"] {
  color-scheme: light;

  --primary: var(--gray-700);              /* soft black #2b2b2b: calmer than #090909 on white, still 14:1 */
  --primary-hover: var(--gray-300);
  --on-primary: var(--white);
  --accent-blue: var(--blue-600);          /* #0071c2: 4.9:1 on white, #0099ff is only 3:1 */
  --on-accent: var(--white);
  --accent-glow: rgb(var(--blue-600-rgb) / .16);

  --ink: var(--gray-700);
  --ink-muted: var(--gray-600);            /* 5.3:1 on canvas, 4.9:1 on surface-1 */
  --ink-faded: var(--gray-550);

  --canvas: var(--white);
  --surface-1: var(--gray-50);
  --surface-2: var(--gray-100);
  --hairline: var(--gray-200);
  --hairline-soft: var(--gray-100);
  --overlay: rgb(var(--white-rgb) / .96);
  --backdrop: rgb(var(--black-rgb) / .3);
  --tag-on-color: rgb(var(--white-rgb) / .3);

  --semantic-success: var(--green-600);

  --shadow-menu: 0 0 0 1px var(--gray-200), 0 10px 30px rgb(var(--black-rgb) / .08);
  --shadow-float: 0 0 0 1px var(--gray-200), 0 8px 24px rgb(var(--black-rgb) / .08);
  --shadow-card-hover: 0 18px 40px -20px rgb(var(--black-rgb) / .22), 0 8px 28px -14px rgb(var(--blue-600-rgb) / .14);

  --theme-color: var(--white);
}
