/* Design System Tokens */
/* All colors, spacing, and typography defined as CSS custom properties */

/* ===== SELF-HOSTED FONTS =====
   Replaces the render-blocking Google Fonts round-trip. Montserrat is a variable
   font (one woff2 covers 100–900); Bangers is the display face. font-display: swap
   keeps text visible while they load. Latin subset only (the site is en-GB). */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/montserrat-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Bangers';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/bangers-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ===== COLORS ===== */

  /* Semantic Colors */
  --color-bg: #0E0B1A;
  --color-bg-secondary: #17122B;
  --color-fg: #EDECF6;
  --color-fg-secondary: #F3F2FA;
  --color-accent: #A6FF4D;
  --color-brand: #503E94;
  --color-brand-light: #6A55C0;
  --color-brand-lighter: #B7A7F2;   /* AA-contrast purple for small text on dark bg (>=4.5:1) */
  --color-muted: #B9B5D3;
  --color-link: color-mix(in srgb, var(--color-accent) 72%, #000);   /* default green link — darker, fitting; brightens to --color-accent on hover */
  --color-link-hover: color-mix(in srgb, var(--color-fg) 55%, var(--color-accent));  /* for non-green (fg) text links: text colour + accent tint */

  /* Functional Colors */
  --color-success: #4ADE80;
  --color-warning: #FBBF24;
  --color-error: #F87171;
  --color-info: #60A5FA;

  /* Borders & Dividers */
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-light: rgba(255, 255, 255, 0.04);
  --color-divider: rgba(255, 255, 255, 0.06);

  /* ===== TYPOGRAPHY ===== */

  /* Font Families */
  --font-sans: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Bangers", cursive;
  --font-mono: "Courier New", monospace;

  /* Font Sizes */
  --font-size-xs: 0.75rem;      /* 12px */
  --font-size-sm: 0.875rem;     /* 14px */
  --font-size-base: 1rem;       /* 16px */
  --font-size-lg: 1.125rem;     /* 18px */
  --font-size-xl: 1.25rem;      /* 20px */
  --font-size-2xl: 1.5rem;      /* 24px */
  --font-size-3xl: 1.875rem;    /* 30px */
  --font-size-4xl: 2.25rem;     /* 36px */
  --font-size-5xl: 3rem;        /* 48px */

  /* Font Weights */
  --font-weight-normal: 400;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Line Heights */
  --line-height-tight: 1.2;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.8;

  /* Letter Spacing */
  --letter-spacing-tight: -0.01em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.08em;

  /* ===== SPACING ===== */

  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4rem;     /* 64px */
  --space-4xl: 6rem;     /* 96px */

  /* ===== LAYOUT ===== */

  --container-max: 72rem;  /* 1152px — legacy hub width (kept; some pages reference it) */
  --container-md: 56rem;   /* 896px */
  --container-sm: 42rem;   /* 672px */

  /* Two-axis liquid model: prose stays a readable measure; chrome/grids go wide.
     PROSE = text read line-to-line (capped). CHROME = heroes/hubs/grids (fluid). */
  --measure: 42rem;        /* ~65ch prose measure — text only */
  --measure-wide: 48rem;   /* looser measure for lead-heavy pages */
  --container-wide: 90rem; /* 1440px — page chrome / hubs / card grids */
  --container-full: 110rem;/* 1760px — ultrawide cap so 1920 isn't a lone centered column */
  --gutter: clamp(1.5rem, 5vw, 5rem);  /* fluid page gutter — generous responsive side breathing room */
  --content-col: 68rem;    /* 1088px — THE standard content column (breadcrumb, head, grids all share it) */

  /* Article wide-layout rails (TOC | prose | aside) */
  --toc-col: 15rem;
  --aside-col: 18rem;

  /* Sticky offset = header height + breathing room (single source of truth) */
  --header-h: 4rem;
  --scroll-offset: calc(var(--header-h) + 1rem);

  /* ===== BORDERS & RADIUS ===== */

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* ===== SHADOWS ===== */

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
  --shadow-xl: 0 20px 64px rgba(0, 0, 0, 0.55);

  /* ===== TRANSITIONS ===== */

  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;

  /* ===== Z-INDEX SCALE ===== */

  --z-dropdown: 100;
  --z-sticky: 101;
  --z-fixed: 200;
  --z-modal-backdrop: 300;
  --z-modal: 400;
  --z-tooltip: 500;
  --z-notification: 600;

  /* ===== BREAKPOINTS (standardized; rem-based so they scale with user font-size) ===== */
  /* sm: 40rem (640px) — small cards stack -> 2col; in-prose splits collapse  */
  /* md: 48rem (768px) — hamburger -> full nav; 2 -> 3 col grids              */
  /* lg: 64rem (1024px) — article 3-rail layout engages; sidebar layouts      */
  /* xl: 90rem (1440px) — widest container (--container-full); roomy asides    */

  /* ===== FOCUS STYLES ===== */

  --focus-outline: 3px solid var(--color-accent);
  --focus-offset: 2px;
}

/* ===== DARK MODE (currently default, prepared for light mode future) ===== */

@media (prefers-color-scheme: light) {
  :root {
    /* If we ever add light mode, variables would change here */
  }
}

/* ===== CONTRAST ADJUSTMENT FOR ACCESSIBILITY ===== */

@media (prefers-contrast: more) {
  :root {
    --color-border: rgba(255, 255, 255, 0.20);
    --color-border-light: rgba(255, 255, 255, 0.12);
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 16px 56px rgba(0, 0, 0, 0.55);
  }
}

/* ===== REDUCED MOTION ===== */

@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-fast: 0ms;
    --transition-base: 0ms;
    --transition-slow: 0ms;
  }

  html { scroll-behavior: auto; }

  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
