/* ==========================================================================
   bitesized.me — Design System Tokens
   Baseline: 4px / 8px spatial grid
   ========================================================================== */

:root {
  /* --- Typography: Families --- */
  --font-heading: 'Geist Pixel', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --weight-heading: 400;  /* Single-weight bitmap grid; avoid faux-bold */

  /* --- Typography: Scale (Desktop) --- */
  --text-h1: 3rem;        /* 48px */
  --text-h2: 2.25rem;     /* 36px */
  --text-h3: 1.75rem;     /* 28px */
  --text-h4: 1.375rem;    /* 22px */
  --text-h5: 1.125rem;    /* 18px */
  --text-h6: 0.875rem;    /* 14px */

  --text-lead: 1.125rem;  /* 18px */
  --text-body: 1rem;      /* 16px */
  --text-sm: 0.875rem;    /* 14px */
  --text-xs: 0.75rem;     /* 12px */

  /* --- Typography: Line Heights --- */
  --leading-h1: 1.1;
  --leading-h2: 1.15;
  --leading-h3: 1.25;
  --leading-h4: 1.3;
  --leading-h5: 1.4;
  --leading-h6: 1.4;
  --leading-body: 1.65;
  --leading-tight: 1.35;

  /* --- Typography: Letter Spacing --- */
  --tracking-h1: 0em;
  --tracking-h2: 0em;
  --tracking-h3: 0em;
  --tracking-h4: 0em;
  --tracking-h5: 0em;
  --tracking-h6: 0.06em;
  --tracking-body: 0em;

  /* --- Core Brand Pastel Palette --- */
  --baby-pink: #ff99c8ff;
  --lemon-chiffon: #fcf6bdff;
  --frosted-mint: #d0f4deff;
  --icy-blue: #a9def9ff;
  --mauve: #e4c1f9ff;

  /* --- Colours: Surfaces & Backgrounds --- */
  --bg-page: #FAFAF8;
  --bg-surface: #FFFFFF;
  --bg-muted: #F4F3EF;
  --bg-inverse: #18181B;

  /* --- Colours: Text Hierarchy --- */
  --text-primary: #18181B;
  --text-secondary: #52525B;
  --text-muted: #71717A;
  --text-inverse: #FAFAF8;

  /* --- Colours: Borders --- */
  --border-subtle: #E4E4E7;
  --border-strong: #18181B;

  /* --- Colours: Semantic Brand Mapping --- */
  --brand-primary: var(--baby-pink);
  --brand-hover: #F47AB3;
  --brand-tint: rgba(255, 153, 200, 0.24);
  --brand-on: #18181B;            /* Dark ink ensures >7:1 contrast on pastel pink */
  --brand-ink: #9D174D;           /* Accessible dark pink for small text/labels */

  --accent-secondary: var(--icy-blue);
  --accent-ink: #075985;          /* Accessible deep blue for inline links */

  --accent-highlight: var(--lemon-chiffon);
  --accent-highlight-ink: #713F12;

  --accent-creative: var(--mauve);
  --accent-creative-ink: #5B21B6;

  /* --- Colours: Status (Pastel Surface + High-Contrast Ink) --- */
  --status-success: #166534;
  --status-success-tint: var(--frosted-mint);
  --status-warning: #854D0E;
  --status-warning-tint: var(--lemon-chiffon);
  --status-error: #B91C1C;
  --status-error-tint: #FEE2E2;
  --status-info: #075985;
  --status-info-tint: var(--icy-blue);

  /* --- Spacing & Paddings (4px / 8px grid) --- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-28: 112px;

  /* --- Semantic Layout & Component Paddings --- */
  --container-max: 1120px;
  --prose-max: 68ch;
  --gutter-x: 32px;
  --section-py: 80px;
  --hero-py: 112px;

  --card-pad-sm: 16px;
  --card-pad-md: 24px;
  --card-pad-lg: 32px;

  /* --- Border Radius --- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  /* --- Elevation & Shadows --- */
  --shadow-xs: 0 1px 2px rgba(24, 24, 27, 0.05);
  --shadow-sm: 0 3px 10px rgba(24, 24, 27, 0.07);
  --shadow-md: 0 10px 26px rgba(24, 24, 27, 0.10);

  /* --- Interactive & Motion --- */
  --focus-ring: 0 0 0 3px rgba(255, 153, 200, 0.55);
  --transition-fast: 150ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Tablet Adjustments */
@media (max-width: 1023px) {
  :root {
    --gutter-x: 24px;
  }
}

/* Mobile Adjustments */
@media (max-width: 639px) {
  :root {
    --text-h1: 2.25rem;   /* 36px */
    --text-h2: 1.75rem;   /* 28px */
    --text-h3: 1.5rem;    /* 24px */
    --text-h4: 1.25rem;   /* 20px */
    --gutter-x: 16px;
    --section-py: 48px;
    --hero-py: 64px;
  }
}

/* Dark Theme Adaptation */
[data-theme="dark"] {
  --bg-page: #111114;
  --bg-surface: #18181D;
  --bg-muted: #222229;
  --bg-inverse: #FAFAF8;

  --text-primary: #F4F4F6;
  --text-secondary: #A1A1AA;
  --text-muted: #71717A;
  --text-inverse: #18181B;

  --border-subtle: #2A2A32;
  --border-strong: #52525B;

  --brand-primary: var(--baby-pink);
  --brand-hover: #FFB3D6;
  --brand-tint: rgba(255, 153, 200, 0.18);
  --brand-on: #18181B;
  --brand-ink: var(--baby-pink);

  --accent-ink: var(--icy-blue);
  --accent-highlight-ink: var(--lemon-chiffon);
  --accent-creative-ink: var(--mauve);

  --status-success: var(--frosted-mint);
  --status-success-tint: rgba(208, 244, 222, 0.14);
  --status-warning: var(--lemon-chiffon);
  --status-warning-tint: rgba(252, 246, 189, 0.14);
  --status-error: #FCA5A5;
  --status-error-tint: rgba(220, 38, 38, 0.18);
  --status-info: var(--icy-blue);
  --status-info-tint: rgba(169, 222, 249, 0.14);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-sm: 0 3px 10px rgba(0, 0, 0, 0.40);
  --shadow-md: 0 10px 26px rgba(0, 0, 0, 0.52);
}

input[type="range"],
input[type="range"]:focus,
input[type="range"]:focus-visible {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  height: 18px;
  border: none;
  outline: none;
  box-shadow: none;
}

input[type="range"].range {
  --range-fill: var(--baby-pink);
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  border: none;
  outline: none;
  background: linear-gradient(
    to right,
    var(--range-fill, var(--icy-blue)) var(--range-pct, 50%),
    var(--border-subtle) var(--range-pct, 50%)
  );
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -4px;
  border-radius: 999px;
  border: none;
  outline: none;
  box-shadow: none;
  background: var(--range-fill, var(--icy-blue));
  cursor: pointer;
  transition: transform 120ms ease;
}

input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.12);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  border: none;
  outline: none;
  background: var(--border-subtle);
}

input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--range-fill, var(--icy-blue));
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: none;
  outline: none;
  box-shadow: none;
  background: var(--range-fill, var(--icy-blue));
  cursor: pointer;
}
