/* ==========================================================================
   ÜrünKontrol "Piyasa Pusulası & Fiyat Endeksi" Tokens — Single Source of Truth
   Mineral Travertine (#F4F3EE) + Bosphorus Petrol (#0B5675) + Deep Obsidian
   WCAG AA/AAA verified foregrounds; light + dark (explicit & prefers-color-scheme)
   ========================================================================== */

:root {
  color-scheme: light;

  /* Surfaces (Mineral Travertine) */
  --bg-canvas: #F4F3EE;
  --bg-surface: #FFFFFF;
  --bg-subtle: #EAE7DF;
  --bg-band: #0E1720;
  --border-hairline: #D7D3C8;
  --border-strong: #787D82;
  --overlay-bg: rgba(14, 23, 32, 0.58);

  /* Typography Ink */
  --ink-primary: #10171D;
  --ink-secondary: #3D464E;
  --ink-muted: #525B63;
  --ink-on-band: #F3F2ED;
  --ink-band-muted: #B6C2CE;
  --ink-on-accent: #FFFFFF;

  /* Brand Action Accent — Bosphorus Petrol (8.07:1 white contrast) */
  --accent-bg: #0B5675;
  --accent-bg-hover: #084159;
  --accent-ink: #084963;
  --accent-wash: #E5F0F5;

  /* Editorial Commerce Accent — Burnished Anadolu Copper */
  --editorial-ink: #8A460E;
  --editorial-bg: #F6EDE2;
  --editorial-border: #D9A97E;

  /* State Colors (Strictly separated hues) */
  --state-ok-ink: #0C633F;
  --state-ok-bg: #E5F4EC;
  --state-ok-border: #209964;

  --state-warn-ink: #7B4F05;
  --state-warn-bg: #FBF0DC;
  --state-warn-border: #C68314;

  --state-bad-ink: #A81D2A;
  --state-bad-bg: #FDECEB;
  --state-bad-border: #D43B48;

  --state-neutral-ink: #2F3C47;
  --state-neutral-bg: #E6EAEE;
  --state-neutral-border: #C5CDD5;

  /* Focus Ring */
  --focus-ring: #0F171E;

  /* Typography Stack (Loaded in templates: Newsreader + Schibsted Grotesk + IBM Plex Mono) */
  --font-editorial: "Newsreader", Georgia, "Times New Roman", serif;
  --font-display: "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-sans: "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --text-xs: 0.75rem;
  --text-label: 0.8125rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.0625rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-display: 1.75rem;
  --text-hero: clamp(2.125rem, 4.1vw, 3.25rem);
  --lh-tight: 1.22;
  --lh-base: 1.5;

  /* Spacing Scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Radii (8px-10px controls; 12px-16px panels; 999px non-interactive status pills) */
  --radius-sm: 8px;
  --radius-control: 10px;
  --radius-panel: 14px;
  --radius-pill: 999px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(14, 23, 32, 0.05);
  --shadow-md: 0 10px 28px rgba(14, 23, 32, 0.08);

  /* Control & Hit Targets */
  --touch-min: 44px;

  /* Motion */
  --dur-fast: 140ms;
  --ease-std: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Z-index Scale */
  --z-base: 1;
  --z-sticky: 20;
  --z-modal: 50;
}

/* Explicit dark theme via cookie/localStorage data-theme */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg-canvas: #0B1015;
  --bg-surface: #121A22;
  --bg-subtle: #1A232C;
  --bg-band: #151F29;
  --border-hairline: #2C3844;
  --border-strong: #5E7183;
  --overlay-bg: rgba(0, 0, 0, 0.74);

  --ink-primary: #F2F1EC;
  --ink-secondary: #C2CCD6;
  --ink-muted: #93A2B0;
  --ink-on-band: #F2F1EC;
  --ink-band-muted: #A9B8C6;
  --ink-on-accent: #FFFFFF;

  --accent-bg: #147297;
  --accent-bg-hover: #0F5B79;
  --accent-ink: #6CC0E8;
  --accent-wash: #102835;

  --editorial-ink: #E8A85A;
  --editorial-bg: #291F12;
  --editorial-border: #785326;

  --state-ok-ink: #5BD29B;
  --state-ok-bg: #0E291D;
  --state-ok-border: #29A66E;

  --state-warn-ink: #EEB958;
  --state-warn-bg: #2C200B;
  --state-warn-border: #D99C30;

  --state-bad-ink: #F49593;
  --state-bad-bg: #331514;
  --state-bad-border: #DF5863;

  --state-neutral-ink: #C3CDD7;
  --state-neutral-bg: #1A232C;
  --state-neutral-border: #2C3844;

  --focus-ring: #6CC0E8;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45);
}

/* System-preference mirror when user hasn't explicitly toggled theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;

    --bg-canvas: #0B1015;
    --bg-surface: #121A22;
    --bg-subtle: #1A232C;
    --bg-band: #151F29;
    --border-hairline: #2C3844;
    --border-strong: #5E7183;
    --overlay-bg: rgba(0, 0, 0, 0.74);

    --ink-primary: #F2F1EC;
    --ink-secondary: #C2CCD6;
    --ink-muted: #93A2B0;
    --ink-on-band: #F2F1EC;
    --ink-band-muted: #A9B8C6;
    --ink-on-accent: #FFFFFF;

    --accent-bg: #147297;
    --accent-bg-hover: #0F5B79;
    --accent-ink: #6CC0E8;
    --accent-wash: #102835;

    --editorial-ink: #E8A85A;
    --editorial-bg: #291F12;
    --editorial-border: #785326;

    --state-ok-ink: #5BD29B;
    --state-ok-bg: #0E291D;
    --state-ok-border: #29A66E;

    --state-warn-ink: #EEB958;
    --state-warn-bg: #2C200B;
    --state-warn-border: #D99C30;

    --state-bad-ink: #F49593;
    --state-bad-bg: #331514;
    --state-bad-border: #DF5863;

    --state-neutral-ink: #C3CDD7;
    --state-neutral-bg: #1A232C;
    --state-neutral-border: #2C3844;

    --focus-ring: #6CC0E8;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45);
  }
}
