/* ==========================================================================
   Discount Hunter: design tokens  (v1.0)
   Source of truth: site/brand/BRAND.md
   Light mode is the default. Dark mode applies when the OS prefers dark,
   unless <html data-theme="light">. Force dark with <html data-theme="dark">.
   Contrast ratios in comments are WCAG 2.x, measured against --color-bg / --color-surface.
   ========================================================================== */

/* Google Fonts (full Cyrillic + Latin):
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700&family=Unbounded:wght@500;600;700&display=swap" rel="stylesheet">
*/

:root {
  color-scheme: light;

  /* ---------- Typography ---------- */
  --font-display: "Unbounded", "Onest", system-ui, sans-serif;     /* headlines, wordmark, big numbers */
  --font-body: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; /* UI + copy */
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
  --font-feature-price: "tnum" 1, "lnum" 1;  /* use with font-variant-numeric: tabular-nums */

  --text-xs: 0.75rem;     /* 12 */
  --text-sm: 0.875rem;    /* 14 */
  --text-base: 1rem;      /* 16 */
  --text-md: 1.125rem;    /* 18 */
  --text-lg: 1.25rem;     /* 20 */
  --text-xl: 1.5rem;      /* 24 */
  --text-2xl: 1.875rem;   /* 30 */
  --text-3xl: 2.25rem;    /* 36 */
  --text-4xl: clamp(2.25rem, 1.6rem + 3vw, 3.5rem);   /* hero H1: 36 -> 56 */
  --text-5xl: clamp(2.75rem, 1.8rem + 4.5vw, 4.5rem); /* campaign display: 44 -> 72 */

  --leading-tight: 1.1;   /* display */
  --leading-snug: 1.25;   /* headings */
  --leading-normal: 1.5;  /* body */
  --tracking-display: -0.02em;
  --tracking-caps: 0.06em; /* small uppercase labels */

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* ---------- Brand ---------- */
  --brand-violet: #5B3DF5;       /* primary. White text on it = 6.12:1 */
  --brand-violet-600: #4A2CE0;   /* hover / pressed; text on light = 7.14:1 */
  --brand-violet-700: #3A1FC2;
  --brand-violet-300: #9A8CFF;   /* brand text on dark */
  --brand-violet-100: #ECE9FF;   /* tint backgrounds */
  --brand-midnight: #0A0E1A;     /* the "ink": hero backgrounds, dark mode bg */
  --brand-mint: #3DD68C;         /* the "found it" accent inside the mark; decorative only on light */
  --brand-gradient: linear-gradient(135deg, #7259FF 0%, #5B3DF5 45%, #4524E0 100%);
  --brand-glow: radial-gradient(60% 60% at 70% 40%, rgba(91, 61, 245, 0.45) 0%, rgba(91, 61, 245, 0) 70%);

  /* ---------- Neutrals / surfaces (light) ---------- */
  --color-bg: #F6F6FA;          /* page */
  --color-surface: #FFFFFF;     /* cards, sheets */
  --color-surface-2: #EFEFF6;   /* inset, hover rows, skeletons */
  --color-surface-inverse: #0A0E1A;
  --color-ink: #0A0E1A;         /* primary text 17.9:1 on bg */
  --color-ink-2: #2A3045;       /* secondary headings */
  --color-muted: #555B6E;       /* secondary text 6.27:1 on bg */
  --color-subtle: #8A90A3;      /* placeholders, disabled (non-essential only) */
  --color-line: #E3E4EE;        /* hairlines, card borders */
  --color-line-strong: #C9CBDA; /* input borders (3:1 not required for decorative) */
  --color-focus: #5B3DF5;       /* focus ring */
  --color-overlay: rgba(10, 14, 26, 0.56);
  --color-photo-bg: #FFFFFF;    /* tile behind shop product photos (white in light, soft off-white in dark) */
  --color-on-inverse: #F3F4FA;  /* text on midnight panels (hero, feature bands) in both themes */
  --color-on-inverse-muted: #C9CCDA;
  --bf-ink: #05070D;            /* Black Friday campaign black */
  --festive-ink: #120E30;       /* neutral campaign variant */
  --tier-scale: #2A3045;        /* filled segments of the 5-step tier scale */
  --tier-scale-off: #DADCE8;
  --tier-scale-top: #D49B00;    /* tier 1 accent (gold, darkened for 3:1 on white) */

  /* ---------- Interactive ---------- */
  --color-primary: var(--brand-violet);
  --color-primary-hover: var(--brand-violet-600);
  --color-on-primary: #FFFFFF;
  --color-link: var(--brand-violet-600);   /* 7.14:1 on bg */
  --color-accent-soft: var(--brand-violet-100);
  --color-on-accent-soft: #3A1FC2;

  /* ---------- Semantic verdicts ----------
     base   = icon / bar / chart / fill (with --*-on text)
     ink    = text on --color-bg or --color-surface (>= 4.5:1)
     soft   = badge / banner background (ink on soft >= 4.5:1)             */
  --color-deal: #079455;          /* REAL DEAL green. white on it 3.9:1 -> use for large text/icons; badge fill uses --color-deal-strong */
  --color-deal-strong: #067647;   /* white on it 5.69:1 */
  --color-deal-ink: #067647;      /* 5.28:1 on bg */
  --color-deal-soft: #E6F7EE;     /* deal-ink on it 5.12:1 */
  --color-on-deal: #FFFFFF;

  --color-trap: #F97316;          /* PRICE TRAP orange. use ink text on it (6.87:1) */
  --color-trap-ink: #B54708;      /* 5.03:1 on bg */
  --color-trap-soft: #FFF1E5;     /* trap-ink on it 4.9:1 */
  --color-on-trap: #0A0E1A;

  --color-fake: #D92D35;          /* FAKE DISCOUNT red. white on it 4.8:1 */
  --color-fake-ink: #C4262E;      /* 5.32:1 on bg */
  --color-fake-soft: #FDECEC;     /* fake-ink on it 5.02:1 */
  --color-on-fake: #FFFFFF;

  --color-info: #0369A1;
  --color-info-soft: #E5F5FD;

  /* ---------- Deal tiers (1 = best) ----------
     tier-N       = badge fill        tier-N-on   = text on the fill
     tier-N-ink   = text on bg        tier-N-soft = soft badge bg            */
  /* 1  Once in a lifetime: gold */
  --tier-1: #F5B400;  --tier-1-on: #0A0E1A;  --tier-1-ink: #8A5700;  --tier-1-soft: #FFF6DB;
  --tier-1-gradient: linear-gradient(135deg, #FFE08A 0%, #F5B400 50%, #E08A00 100%);
  /* 2  Diamond: ice cyan */
  --tier-2: #0EA5E9;  --tier-2-on: #0A0E1A;  --tier-2-ink: #0369A1;  --tier-2-soft: #E5F5FD;
  --tier-2-gradient: linear-gradient(135deg, #BAF0FF 0%, #38BDF8 50%, #0EA5E9 100%);
  /* 3  Terrific: brand violet */
  --tier-3: #5B3DF5;  --tier-3-on: #FFFFFF;  --tier-3-ink: #4A2CE0;  --tier-3-soft: #ECE9FF;
  /* 4  Good: green */
  --tier-4: #067647;  --tier-4-on: #FFFFFF;  --tier-4-ink: #067647;  --tier-4-soft: #E6F7EE;
  /* 5  Ok: slate */
  --tier-5: #E3E6EE;  --tier-5-on: #2A3045;  --tier-5-ink: #475569;  --tier-5-soft: #EEF0F4;

  /* ---------- Radius ---------- */
  --radius-xs: 4px;
  --radius-sm: 8px;     /* inputs, small chips */
  --radius-md: 12px;    /* buttons */
  --radius-lg: 16px;    /* cards */
  --radius-xl: 24px;    /* hero panels, sheets */
  --radius-2xl: 32px;
  --radius-pill: 999px; /* badges, toggles */

  /* ---------- Shadows (cool, low-spread; built on midnight) ---------- */
  --shadow-xs: 0 1px 2px rgba(10, 14, 26, 0.06);
  --shadow-sm: 0 1px 2px rgba(10, 14, 26, 0.06), 0 2px 6px rgba(10, 14, 26, 0.05);
  --shadow-md: 0 2px 4px rgba(10, 14, 26, 0.05), 0 8px 24px rgba(10, 14, 26, 0.08);
  --shadow-lg: 0 4px 8px rgba(10, 14, 26, 0.05), 0 20px 48px rgba(10, 14, 26, 0.12);
  --shadow-brand: 0 8px 24px rgba(91, 61, 245, 0.32);
  --shadow-focus: 0 0 0 3px rgba(91, 61, 245, 0.35);

  /* ---------- Spacing (4px base) ---------- */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;   /* mobile gutter */
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;

  /* ---------- Layout ---------- */
  --container-max: 1240px;
  --container-narrow: 760px;
  --gutter: var(--space-4);
  --header-h: 64px;

  /* ---------- Motion ---------- */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 360ms;

  /* ---------- Z ---------- */
  --z-header: 50;
  --z-overlay: 90;
  --z-modal: 100;
  --z-toast: 110;
}

@media (min-width: 768px) {
  :root { --gutter: var(--space-6); --header-h: 72px; }
}
@media (min-width: 1200px) {
  :root { --gutter: var(--space-8); }
}

/* ---------- Dark mode values (shared block, used twice below) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-bg: #0A0E1A;
    --color-surface: #131A2B;
    --color-surface-2: #1A2236;
    --color-surface-inverse: #F6F6FA;
    --color-ink: #F3F4FA;        /* 17.5:1 on bg, 15.8:1 on surface */
    --color-ink-2: #D5D8E5;
    --color-muted: #A1A7BC;      /* 8.0:1 on bg, 7.25:1 on surface */
    --color-subtle: #6B7189;
    --color-line: #242C42;
    --color-line-strong: #343D57;
    --color-focus: #9A8CFF;
    --color-overlay: rgba(0, 0, 0, 0.64);
    --color-photo-bg: #F4F4F8;
    --tier-scale: #D5D8E5;
    --tier-scale-off: #343D57;
    --tier-scale-top: #F5C451;

    --color-primary: #6E55FF;    /* white on it 4.77:1 */
    --color-primary-hover: #8572FF;
    --color-on-primary: #FFFFFF;
    --color-link: #B3A8FF;       /* 9.1:1 on bg */
    --color-accent-soft: #1E1A45;
    --color-on-accent-soft: #B3A8FF;

    --color-deal: #3DD68C;   --color-deal-strong: #067647;  --color-deal-ink: #3DD68C;  --color-deal-soft: #0F2A20;
    --color-trap: #FF9F5A;   --color-trap-ink: #FF9F5A;     --color-trap-soft: #2E1D10;
    --color-fake: #FF7076;   --color-fake-ink: #FF7076;     --color-fake-soft: #2E1416;  --color-on-fake: #0A0E1A;
    --color-info: #5CC8F5;   --color-info-soft: #0F2433;

    --tier-1-ink: #F5C451;  --tier-1-soft: #2B2210;
    --tier-2-ink: #5CC8F5;  --tier-2-soft: #0F2433;
    --tier-3: #6E55FF;      --tier-3-ink: #B3A8FF;  --tier-3-soft: #1E1A45;
    --tier-4-ink: #3DD68C;  --tier-4-soft: #0F2A20;
    --tier-5: #2A3247;      --tier-5-on: #D5D8E5;   --tier-5-ink: #A1A7BC;  --tier-5-soft: #1E2436;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 20px 48px rgba(0, 0, 0, 0.55);
    --shadow-brand: 0 8px 28px rgba(110, 85, 255, 0.45);
    --shadow-focus: 0 0 0 3px rgba(154, 140, 255, 0.45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #0A0E1A;
  --color-surface: #131A2B;
  --color-surface-2: #1A2236;
  --color-surface-inverse: #F6F6FA;
  --color-ink: #F3F4FA;
  --color-ink-2: #D5D8E5;
  --color-muted: #A1A7BC;
  --color-subtle: #6B7189;
  --color-line: #242C42;
  --color-line-strong: #343D57;
  --color-focus: #9A8CFF;
  --color-overlay: rgba(0, 0, 0, 0.64);
  --color-photo-bg: #F4F4F8;
  --tier-scale: #D5D8E5;
  --tier-scale-off: #343D57;
  --tier-scale-top: #F5C451;

  --color-primary: #6E55FF;
  --color-primary-hover: #8572FF;
  --color-on-primary: #FFFFFF;
  --color-link: #B3A8FF;
  --color-accent-soft: #1E1A45;
  --color-on-accent-soft: #B3A8FF;

  --color-deal: #3DD68C;   --color-deal-strong: #067647;  --color-deal-ink: #3DD68C;  --color-deal-soft: #0F2A20;
  --color-trap: #FF9F5A;   --color-trap-ink: #FF9F5A;     --color-trap-soft: #2E1D10;
  --color-fake: #FF7076;   --color-fake-ink: #FF7076;     --color-fake-soft: #2E1416;  --color-on-fake: #0A0E1A;
  --color-info: #5CC8F5;   --color-info-soft: #0F2433;

  --tier-1-ink: #F5C451;  --tier-1-soft: #2B2210;
  --tier-2-ink: #5CC8F5;  --tier-2-soft: #0F2433;
  --tier-3: #6E55FF;      --tier-3-ink: #B3A8FF;  --tier-3-soft: #1E1A45;
  --tier-4-ink: #3DD68C;  --tier-4-soft: #0F2A20;
  --tier-5: #2A3247;      --tier-5-on: #D5D8E5;   --tier-5-ink: #A1A7BC;  --tier-5-soft: #1E2436;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 20px 48px rgba(0, 0, 0, 0.55);
  --shadow-brand: 0 8px 28px rgba(110, 85, 255, 0.45);
  --shadow-focus: 0 0 0 3px rgba(154, 140, 255, 0.45);
}

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