/* IT Space design system, from direction 1 (Linear Editorial).
   Tokens only: colour, type, spacing, radius, shadow, motion, z-index.
   Light is the default. Dark follows the system unless the theme toggle has
   set data-theme on <html>, exactly as assets/site.js does today.
   Names are roles, never colours. */

/* ---------- Fonts (local files, relative to this file) ---------- */
@font-face {
  font-family: "Alexandria";
  src: url("fonts/Alexandria-arabic.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: "Alexandria";
  src: url("fonts/Alexandria-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}
@font-face {
  font-family: "Cairo";
  src: url("fonts/Cairo-arabic.woff2") format("woff2");
  font-weight: 600 700;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: "Cairo";
  src: url("fonts/Cairo-latin.woff2") format("woff2");
  font-weight: 600 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/IBMPlexSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/IBMPlexSans-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/IBMPlexSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens that do not change with the theme ---------- */
:root {
  color-scheme: light dark;
  --step-dim: 0.15;

  /* Type families. Arabic heading Cairo, Arabic body Alexandria, Latin IBM Plex Sans. */
  --font-heading-ar: "Cairo", "Alexandria", system-ui, sans-serif;
  --font-body-ar: "Alexandria", "Cairo", system-ui, sans-serif;
  --font-heading-en: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body-en: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; /* code only */

  /* Type scale. Nothing is below 14px (0.875rem). Present mode moves the whole scale. */
  --text-xs: 0.875rem;   /* 14: chips, meta, captions, diagram minimum */
  --text-sm: 0.9375rem;  /* 15: secondary UI */
  --text-md: 1.0625rem;  /* 17: UI and compact body */
  --text-body: 1.125rem; /* 18: lesson body */
  --text-lg: 1.25rem;    /* 20: lead, card titles */
  --text-xl: 1.5rem;     /* 24: h3 */
  --text-2xl: clamp(1.625rem, 1.3rem + 1.4vw, 2rem);      /* h2 */
  --text-3xl: clamp(1.875rem, 1.4rem + 2.2vw, 2.75rem);   /* h1 */
  --text-display: clamp(2.125rem, 1.5rem + 3.4vw, 3.75rem); /* hero */
  --leading-tight: 1.25;
  --leading-snug: 1.45;
  --leading-body: 1.75;
  --leading-body-ar: 1.95;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --measure: 66ch; /* reading column */

  /* Spacing (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;
  --page-pad: clamp(1rem, 0.5rem + 2.2vw, 2rem);
  --page-max: 1200px;
  --column-max: 760px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Motion */
  --dur-fast: 120ms;
  --dur-base: 220ms;
  --dur-slow: 480ms;
  --dur-draw: 700ms;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --reveal-distance: 14px;
  --lift-distance: -3px;

  /* z-index */
  --z-base: 0;
  --z-raised: 10;
  --z-sticky: 90;
  --z-popover: 200;
  --z-dialog: 300;
  --z-skip: 1000;

  /* Focus */
  --focus-width: 2px;
  --focus-offset: 3px;
}

/* ---------- Light (default) ---------- */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eceff5;      /* elevated: popovers, stripes, chips */
  --border: #d9dee8;
  --border-strong: #b9c1d0;

  --text: #0f172a;
  --text-muted: #44505f;
  --text-subtle: #586274;

  --accent: #7a3ee0;         /* fills, icons, rules (not text) */
  --accent-text: #6628c8;    /* accent as text and link colour */
  --accent-bg: #f3ebff;      /* tint behind accent text */
  --accent-solid: #6628c8;   /* primary button fill */
  --on-accent: #ffffff;      /* text on accent-solid */
  --accent-solid-hover: #5520ab;

  --success-text: #12703a;
  --success-bg: #e4f5ea;
  --danger-text: #b3261e;
  --danger-bg: #fdeceb;

  /* Dark bands (hero, path headers) are dark in both themes */
  --band-bg: linear-gradient(135deg, #0f172a 0%, #1e1b4b 60%, #0b0f19 100%);
  --band-text: #f8fafc;
  --band-text-muted: #b6c2d4;
  --band-border: rgba(255, 255, 255, 0.16);
  --band-chip-bg: rgba(255, 255, 255, 0.1);
  --band-focus: #67e8f9;

  --focus-ring: #6628c8;

  /* Paths: fill (icons, rules, bars) / ink (text) / tint (background of chips) */
  --path-it: #0e9b8a;        --path-it-ink: #0a6558;        --path-it-bg: #e1f5f1;
  --path-github: #c2307f;    --path-github-ink: #9a1f63;    --path-github-bg: #fce8f2;
  --path-ai: #1e7be0;        --path-ai-ink: #0f5fb8;        --path-ai-bg: #e5f0fc;
  --path-ux: #e0432f;        --path-ux-ink: #b32d1b;        --path-ux-bg: #fdeae6;
  --path-cyber: #5aa812;     --path-cyber-ink: #3c6e0a;     --path-cyber-bg: #eef6df;
  --path-chain: #d98a06;     --path-chain-ink: #8a5200;     --path-chain-bg: #fdf1da;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 10px -2px rgba(15, 23, 42, 0.1), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 16px 28px -8px rgba(15, 23, 42, 0.16), 0 6px 10px -6px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 0 28px -6px rgba(122, 62, 224, 0.4);

  --scrim: rgba(15, 23, 42, 0.5);
}

/* ---------- Dark: follows the system unless the toggle chose light ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0e17;
    --surface: #121826;
    --surface-2: #1b2335;
    --border: #28324a;
    --border-strong: #3a4766;

    --text: #f1f5f9;
    --text-muted: #a3afc2;
    --text-subtle: #94a3b8;

    --accent: #a07bff;
    --accent-text: #c4a9ff;
    --accent-bg: #2a1c4d;
    --accent-solid: #a07bff;
    --on-accent: #0a0e17;
    --accent-solid-hover: #b69aff;

    --success-text: #6ee7a0;
    --success-bg: #12301f;
    --danger-text: #ff9b93;
    --danger-bg: #3a1614;

    --band-bg: linear-gradient(135deg, #060911 0%, #111427 60%, #080c18 100%);
    --band-border: rgba(255, 255, 255, 0.12);

    --focus-ring: #67e8f9;

    --path-it: #2cc9b4;        --path-it-ink: #6fe3d2;        --path-it-bg: #0e2f2b;
    --path-github: #ec6aa9;    --path-github-ink: #f7a3cc;    --path-github-bg: #38142a;
    --path-ai: #4aa3ff;        --path-ai-ink: #8ec6ff;        --path-ai-bg: #102a44;
    --path-ux: #ff6a52;        --path-ux-ink: #ffa090;        --path-ux-bg: #3a1812;
    --path-cyber: #8ad02a;     --path-cyber-ink: #b4e66a;     --path-cyber-bg: #22300a;
    --path-chain: #f5a524;     --path-chain-ink: #ffc766;     --path-chain-bg: #33240a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 10px -2px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 28px -8px rgba(0, 0, 0, 0.6), 0 6px 10px -6px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 28px -6px rgba(160, 123, 255, 0.45);

    --scrim: rgba(0, 0, 0, 0.65);
  }
}

/* A theme chosen by hand also sets the native colour scheme (form controls,
   scrollbars), which otherwise follows the system setting. */
:root[data-theme="light"] {
  color-scheme: light;
}

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

:root[data-theme="dark"] {
  --bg: #0a0e17;
  --surface: #121826;
  --surface-2: #1b2335;
  --border: #28324a;
  --border-strong: #3a4766;

  --text: #f1f5f9;
  --text-muted: #a3afc2;
  --text-subtle: #94a3b8;

  --accent: #a07bff;
  --accent-text: #c4a9ff;
  --accent-bg: #2a1c4d;
  --accent-solid: #a07bff;
  --on-accent: #0a0e17;
  --accent-solid-hover: #b69aff;

  --success-text: #6ee7a0;
  --success-bg: #12301f;
  --danger-text: #ff9b93;
  --danger-bg: #3a1614;

  --band-bg: linear-gradient(135deg, #060911 0%, #111427 60%, #080c18 100%);
  --band-border: rgba(255, 255, 255, 0.12);

  --focus-ring: #67e8f9;

  --path-it: #2cc9b4;        --path-it-ink: #6fe3d2;        --path-it-bg: #0e2f2b;
  --path-github: #ec6aa9;    --path-github-ink: #f7a3cc;    --path-github-bg: #38142a;
  --path-ai: #4aa3ff;        --path-ai-ink: #8ec6ff;        --path-ai-bg: #102a44;
  --path-ux: #ff6a52;        --path-ux-ink: #ffa090;        --path-ux-bg: #3a1812;
  --path-cyber: #8ad02a;     --path-cyber-ink: #b4e66a;     --path-cyber-bg: #22300a;
  --path-chain: #f5a524;     --path-chain-ink: #ffc766;     --path-chain-bg: #33240a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 10px -2px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 28px -8px rgba(0, 0, 0, 0.6), 0 6px 10px -6px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 28px -6px rgba(160, 123, 255, 0.45);

  --scrim: rgba(0, 0, 0, 0.65);
}

/* ---------- Present mode: the whole scale grows for a projector ---------- */
:root[data-present],
[data-present-scope] {
  --text-xs: 1.0625rem;
  --text-sm: 1.1875rem;
  --text-md: 1.3125rem;
  --text-body: 1.5rem;
  --text-lg: 1.75rem;
  --text-xl: 2rem;
  --text-2xl: clamp(2rem, 1.5rem + 1.8vw, 2.75rem);
  --text-3xl: clamp(2.25rem, 1.6rem + 2.6vw, 3.5rem);
  --measure: 56ch;
  --column-max: 960px;
}
