/*
  ThemeVault (site.web.tr) — Tasarım Token'ları (Tek Kaynak)
  sohbetbox.com tasarım dili ile birebir değerler.
*/

@layer tv.tokens, tv.base, tv.components, tv.layout, tv.pages, tv.theme;

@layer tv.tokens {
  :root {
    /* ---- marka ---- */
    --brand: #2563eb;
    --brand-strong: #1d4ed8;
    --brand-deep: #1e3a8a;
    --brand-tint: #eaf1ff;
    --brand-tint-2: #d9e6ff;
    --brand-line: #bcd0fb;
    --brand-text: #1d4ed8;
    --on-brand: #ffffff;
    --brand-rgb: 37 99 235;

    /* ---- mürekkep (koyu bölümler ve altbilgi) ---- */
    --ink-0: #050812;
    --ink-1: #080d1a;
    --ink-2: #0d1426;
    --ink-3: #141c31;
    --ink-line: rgb(148 170 220 / 0.13);
    --ink-line-strong: rgb(148 170 220 / 0.22);
    --ink-text: #eef2fa;
    --ink-text-2: #b3bdd0;
    --ink-text-3: #8591a8;
    --ink-brand: #7ea6ff;

    /* ---- nötrler (açık tema varsayılan) ---- */
    --bg: #fbfcfe;
    --bg-tint: #f3f6fb;
    --bg-tint-2: #edf1f8;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --surface-3: #eff3f9;
    --line: #e2e8f1;
    --line-2: #d3dbe7;
    --line-strong: #b9c4d4;
    --text: #0a1222;
    --text-2: #3b475c;
    --text-3: #627089;
    --text-4: #627089; /* WCAG AA uyumu için okunur etiketler en az --text-3 */
    --grid-line: rgb(15 30 60 / 0.055);
    --dot: rgb(15 30 60 / 0.12);

    /* ---- durum ---- */
    --ok: #0f9d58;
    --ok-text: #0b7a44;
    --ok-tint: #e6f6ee;
    --warn: #b45309;
    --warn-tint: #fdf3e2;
    --err: #d92d20;
    --err-tint: #fdecea;

    /* ---- arayüz etkileşim yüzeyi ve maket renkleri ---- */
    --hover-brand-soft: rgb(37 99 235 / 0.06);
    --hover-brand-med: rgb(37 99 235 / 0.09);
    --btn-sheen-top: linear-gradient(180deg, rgb(255 255 255 / 0.14), rgb(255 255 255 / 0) 55%);
    --btn-sheen-sweep: linear-gradient(105deg, transparent 30%, rgb(255 255 255 / 0.28) 50%, transparent 70%);
    --btn-light-bg: #ffffff;
    --btn-light-fg: #0a1222;
    --btn-light-sh: 0 1px 1px rgb(0 0 0 / 0.2), 0 8px 24px -8px rgb(0 0 0 / 0.5);
    --btn-glass-bg: rgb(255 255 255 / 0.06);
    --btn-glass-bg-hover: rgb(255 255 255 / 0.11);
    --btn-glass-fg: #ffffff;
    --btn-glass-line: rgb(255 255 255 / 0.18);
    --btn-glass-line-hover: rgb(255 255 255 / 0.34);
    --hdr-bg: rgb(251 252 254 / 0.72);
    --hdr-line: rgb(15 30 60 / 0.08);
    --hdr-sh: 0 8px 30px -22px rgb(10 18 34 / 0.35);
    --mega-bg: rgb(255 255 255 / 0.96);
    --dim-bg: rgb(5 8 18 / 0.28);
    --glow-brand: rgb(37 99 235 / 0.2);
    --glow-brand-soft: rgb(37 99 235 / 0.12);
    --card-glow: rgb(37 99 235 / 0.24);
    --ftr-mark-grad: linear-gradient(180deg, rgb(126 166 255 / 0.14), rgb(126 166 255 / 0));
    --ftr-on-ink: #ffffff;
    --ftr-chip-bg: rgb(255 255 255 / 0.04);
    --ftr-chip-bg-hover: rgb(255 255 255 / 0.09);
    --code-bg: #0a0f1c;
    --code-bar: rgb(255 255 255 / 0.03);
    --code-dot-r: #ff5f57;
    --code-dot-y: #febc2e;
    --code-dot-g: #28c840;
    --code-text: #e2e8f5;
    --code-muted: #93a1bc;
    --toast-bg: #0d1426;
    --toast-fg: #eef2fa;
    --mock-bg: #ffffff;
    --mock-bar: #f7f9fc;
    --mock-panel: #f3f6fb;
    --mock-line: #e2e8f1;
    --mock-ink: #0a1222;
    --mock-muted: #627089;
    --mock-accent-soft: #eaf1ff;
    --mask-solid: #000000;

    /* ---- yazı tipleri ---- */
    --f-display: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
    --f-text: "Geist", ui-sans-serif, system-ui, sans-serif;
    --f-code: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --f-brand: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;

    --fs-display: clamp(2.5rem, 1.5rem + 3.4vw, 4.6rem);
    --fs-h1: clamp(2.2rem, 1.45rem + 2.9vw, 3.9rem);
    --fs-h2: clamp(1.85rem, 1.3rem + 2vw, 3rem);
    --fs-h3: clamp(1.2rem, 1.08rem + 0.45vw, 1.45rem);
    --fs-h4: 1.0625rem;
    --fs-lead: clamp(1.06rem, 0.98rem + 0.36vw, 1.25rem);
    --fs-body: 1rem;
    --fs-sm: 0.9375rem;
    --fs-xs: 0.84375rem;
    --fs-2xs: 0.75rem;
    --fs-3xs: 0.6875rem;
    --fs-brand: 1.1875rem;
    --fs-badge: 0.6875rem;
    --fs-watermark: clamp(4.5rem, 17vw, 16rem);

    --lh-tight: 1.02;
    --lh-h1: 1.05;
    --lh-h2: 1.07;
    --lh-head: 1.1;
    --lh-snug: 1.3;
    --lh-body: 1.6;
    --lh-long: 1.75;

    --tr-display: -0.038em;
    --tr-head: -0.028em;
    --tr-brand: -0.02em;
    --tr-tight: -0.012em;
    --tr-btn: -0.005em;
    --tr-caps: 0.09em;

    --w-reg: 400;
    --w-med: 500;
    --w-semi: 600;
    --w-bold: 700;
    --w-xbold: 800;

    /* ---- boşluk (4px tabanı) ---- */
    --s-0: 0px;
    --s-px: 1px;
    --s-half: 2px;
    --s-1: 4px;
    --s-1h: 6px;
    --s-2: 8px;
    --s-2h: 10px;
    --s-3: 12px;
    --s-3h: 14px;
    --s-4: 16px;
    --s-4h: 18px;
    --s-5: 20px;
    --s-6: 24px;
    --s-7: 32px;
    --s-8: 40px;
    --s-9: 48px;
    --s-10: 64px;
    --s-11: 80px;
    --s-12: 96px;
    --s-13: 128px;

    --sec-y: clamp(72px, 6vw + 40px, 136px);
    --sec-y-tight: clamp(48px, 4vw + 28px, 88px);
    --hero-pt: clamp(32px, 4vw + 12px, 68px);
    --hero-pb: clamp(56px, 5vw + 28px, 104px);
    --inner-hero-pt: clamp(32px, 3vw + 16px, 56px);
    --head-mb: clamp(36px, 3vw + 20px, 64px);
    --ftr-pt: clamp(64px, 6vw + 32px, 112px);
    --ftr-pb: clamp(56px, 5vw + 28px, 92px);
    --ftr-mt: clamp(48px, 5vw + 16px, 88px);
    --gutter: clamp(16px, 3.4vw, 32px);
    --container: 1200px;
    --container-wide: 1320px;
    --container-narrow: 860px;
    --head-max: 760px;
    --hdr-h: 72px;
    --hdr-h-small: 60px;
    --card-glow-r: 280px;
    --mock-mob-min: 148px;
    --filter-search-min: 260px;
    --device-tab-w: 768px;
    --device-mob-w: 390px;

    /* ---- bileşen ölçüleri ---- */
    --btn-h-sm: 36px;
    --btn-px-sm: 13px;
    --btn-h-md: 44px;
    --btn-px-md: 18px;
    --btn-h-lg: 52px;
    --btn-px-lg: 24px;
    --nav-item-h: 38px;
    --nav-item-px: 13px;
    --chip-h: 28px;
    --chip-px: 11px;
    --badge-h: 22px;
    --badge-px: 8px;
    --ico-xs: 13px;
    --ico-sm: 15px;
    --ico-md: 16px;
    --ico-lg: 20px;
    --ico-box: 36px;
    --ico-box-lg: 44px;
    --logo-mark: 32px;
    --acc-btn: 30px;
    --code-bar-h: 46px;
    --dot-sm: 6px;
    --dot-md: 10px;
    --grid-cell: 56px;
    --dots-cell: 22px;
    --glow-size: 620px;
    --glow-size-sm: 440px;
    --mega-w: 680px;
    --mega-w-sm: 460px;
    --docs-side-w: 240px;
    --docs-toc-w: 210px;
    --blur-hdr: 16px;
    --blur-mega: 20px;
    --blur-dim: 1.5px;

    /* ---- köşe ailesi ---- */
    --r-xs: 6px;
    --r-sm: 8px;
    --r-md: 12px;
    --r-btn-lg: 14px;
    --r-lg: 16px;
    --r-xl: 22px;
    --r-2xl: 28px;
    --r-pill: 999px;

    /* ---- gölgeler ---- */
    --sh-0: 0 1px 0 rgb(16 24 40 / 0.04);
    --sh-1: 0 1px 1px rgb(16 24 40 / 0.04), 0 1px 3px rgb(16 24 40 / 0.06);
    --sh-2: 0 1px 2px rgb(16 24 40 / 0.04), 0 4px 10px -2px rgb(16 24 40 / 0.07), 0 10px 24px -12px rgb(16 24 40 / 0.1);
    --sh-3: 0 1px 2px rgb(16 24 40 / 0.04), 0 8px 18px -6px rgb(16 24 40 / 0.09), 0 24px 48px -20px rgb(16 24 40 / 0.16);
    --sh-4: 0 2px 4px rgb(16 24 40 / 0.04), 0 16px 32px -10px rgb(16 24 40 / 0.12), 0 48px 96px -32px rgb(16 24 40 / 0.24);
    --sh-brand: 0 1px 1px rgb(var(--brand-rgb) / 0.3), 0 6px 16px -6px rgb(var(--brand-rgb) / 0.55);
    --sh-brand-lg: 0 2px 4px rgb(var(--brand-rgb) / 0.2), 0 18px 40px -14px rgb(var(--brand-rgb) / 0.55);
    --hl-top: inset 0 1px 0 rgb(255 255 255 / 0.7);
    --ring: 0 0 0 3px rgb(var(--brand-rgb) / 0.28);
    --ring-strong: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand);

    /* ---- hareket ---- */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
    --ease-soft: cubic-bezier(0.25, 0.8, 0.25, 1);
    --d-press: 80ms;
    --d-1: 120ms;
    --d-2: 200ms;
    --d-3: 320ms;
    --d-theme: 420ms;
    --d-4: 520ms;
    --d-sheen: 720ms;
    --d-5: 800ms;
    --d-6: 1200ms;
    --d-drift: 22s;
    --stagger: 60ms;
    --lift: -2px;
    --lift-sm: -1px;
    --shift-x: 3px;
    --reveal-y: 18px;

    /* ---- katmanlar ---- */
    --z-dim: 55;
    --z-hdr: 60;
    --z-mega: 61;
    --z-mnav: 70;
    --z-toast: 80;

    /* ---- yüzey kısayolları ---- */
    --sec-bg: var(--bg);
    --card-bg: var(--surface);
    --card-line: var(--line);
    --card-sh: var(--sh-1);
    --card-sh-hover: var(--sh-3);
    --muted-bg: var(--surface-2);
    --focus: var(--brand);
    --selection: rgb(var(--brand-rgb) / 0.18);
    color-scheme: light;
  }

  /* ---- mürekkep bölümü (.tv-ink) ---- */
  .tv-ink {
    --bg: var(--ink-1);
    --bg-tint: var(--ink-2);
    --bg-tint-2: var(--ink-3);
    --surface: var(--ink-2);
    --surface-2: #111a2e;
    --surface-3: var(--ink-3);
    --line: var(--ink-line);
    --line-2: var(--ink-line-strong);
    --line-strong: rgb(148 170 220 / 0.32);
    --text: var(--ink-text);
    --text-2: var(--ink-text-2);
    --text-3: var(--ink-text-3);
    --text-4: var(--ink-text-3);
    --brand-text: var(--ink-brand);
    --brand-tint: rgb(var(--brand-rgb) / 0.14);
    --brand-tint-2: rgb(var(--brand-rgb) / 0.22);
    --brand-line: rgb(126 166 255 / 0.35);
    --grid-line: rgb(160 185 240 / 0.055);
    --dot: rgb(160 185 240 / 0.14);
    --sec-bg: var(--ink-1);
    --card-bg: rgb(17 26 46 / 0.72);
    --card-line: var(--ink-line);
    --card-sh: inset 0 1px 0 rgb(255 255 255 / 0.04), 0 1px 2px rgb(0 0 0 / 0.3);
    --card-sh-hover: inset 0 1px 0 rgb(255 255 255 / 0.07), 0 20px 50px -24px rgb(0 0 0 / 0.7), 0 0 0 1px rgb(126 166 255 / 0.18);
    --muted-bg: rgb(255 255 255 / 0.03);
    --hl-top: inset 0 1px 0 rgb(255 255 255 / 0.06);
    --ring-strong: 0 0 0 2px var(--ink-1), 0 0 0 4px var(--ink-brand);
    --focus: var(--ink-brand);
    --selection: rgb(126 166 255 / 0.3);
    --ok: #34c77b;
    --ok-text: #4ad88d;
    --ok-tint: rgb(15 157 88 / 0.16);
    --warn-tint: rgb(245 185 58 / 0.14);
    --err-tint: rgb(217 45 32 / 0.18);
    --card-glow: rgb(126 166 255 / 0.32);
    --mock-bg: #0b111d;
    --mock-bar: #0e1523;
    --mock-panel: #121a2b;
    --mock-line: rgb(148 170 220 / 0.16);
    --mock-ink: #eef2fa;
    --mock-muted: #9aa7bf;
    --mock-accent-soft: rgb(37 99 235 / 0.18);
    color-scheme: dark;
  }
}

@layer tv.theme {
  :root[data-theme="dark"] {
    --bg: #080b13;
    --bg-tint: #0b0f1a;
    --bg-tint-2: #0f1421;
    --surface: #0e131e;
    --surface-2: #121927;
    --surface-3: #171f2f;
    --line: rgb(150 170 210 / 0.12);
    --line-2: rgb(150 170 210 / 0.18);
    --line-strong: rgb(150 170 210 / 0.3);
    --text: #e9edf5;
    --text-2: #a9b3c5;
    --text-3: #838fa6;
    --text-4: #838fa6;
    --brand-text: #8fb0ff;
    --brand-tint: rgb(var(--brand-rgb) / 0.13);
    --brand-tint-2: rgb(var(--brand-rgb) / 0.2);
    --brand-line: rgb(143 176 255 / 0.32);
    --grid-line: rgb(150 175 230 / 0.05);
    --dot: rgb(150 175 230 / 0.12);
    --ok: #34c77b;
    --ok-text: #4ad88d;
    --ok-tint: rgb(52 199 123 / 0.13);
    --warn: #f0b44c;
    --warn-tint: rgb(240 180 76 / 0.12);
    --err: #ff6b5e;
    --err-tint: rgb(255 107 94 / 0.13);

    --hover-brand-soft: rgb(143 176 255 / 0.08);
    --hover-brand-med: rgb(143 176 255 / 0.14);
    --hdr-bg: rgb(8 11 19 / 0.62);
    --hdr-line: rgb(150 170 210 / 0.12);
    --hdr-sh: 0 12px 32px -18px rgb(0 0 0 / 0.65);
    --mega-bg: rgb(13 18 29 / 0.94);
    --dim-bg: rgb(2 4 10 / 0.56);
    --glow-brand: rgb(37 99 235 / 0.16);
    --glow-brand-soft: rgb(37 99 235 / 0.1);
    --card-glow: rgb(143 176 255 / 0.3);

    --mock-bg: #0b111d;
    --mock-bar: #0e1523;
    --mock-panel: #121a2b;
    --mock-line: rgb(150 170 210 / 0.14);
    --mock-ink: #e9edf5;
    --mock-muted: #98a4ba;
    --mock-accent-soft: rgb(37 99 235 / 0.18);

    --sh-0: 0 1px 0 rgb(0 0 0 / 0.3);
    --sh-1: inset 0 1px 0 rgb(255 255 255 / 0.035), 0 1px 2px rgb(0 0 0 / 0.4);
    --sh-2: inset 0 1px 0 rgb(255 255 255 / 0.04), 0 8px 20px -8px rgb(0 0 0 / 0.6);
    --sh-3: inset 0 1px 0 rgb(255 255 255 / 0.05), 0 18px 40px -16px rgb(0 0 0 / 0.75);
    --sh-4: inset 0 1px 0 rgb(255 255 255 / 0.06), 0 40px 90px -30px rgb(0 0 0 / 0.85);
    --sh-brand: 0 1px 1px rgb(var(--brand-rgb) / 0.4), 0 8px 22px -6px rgb(var(--brand-rgb) / 0.6);
    --sh-brand-lg: 0 0 0 1px rgb(143 176 255 / 0.2), 0 20px 50px -14px rgb(var(--brand-rgb) / 0.65);
    --hl-top: inset 0 1px 0 rgb(255 255 255 / 0.05);
    --ring: 0 0 0 3px rgb(143 176 255 / 0.3);
    --ring-strong: 0 0 0 2px var(--bg), 0 0 0 4px #8fb0ff;
    --focus: #8fb0ff;
    --selection: rgb(143 176 255 / 0.28);

    --sec-bg: var(--bg);
    --card-bg: var(--surface);
    --card-line: var(--line);
    --card-sh: var(--sh-1);
    --card-sh-hover: inset 0 1px 0 rgb(255 255 255 / 0.06), 0 22px 50px -24px rgb(0 0 0 / 0.8), 0 0 0 1px rgb(143 176 255 / 0.2);
    --muted-bg: var(--surface-2);
    color-scheme: dark;
  }

  :root[data-theme="dark"] .tv-ink {
    --bg: #04060c;
    --sec-bg: #04060c;
    --surface: #0a0f1b;
    --surface-2: #0e1422;
    --card-bg: rgb(12 18 32 / 0.8);
    --line: rgb(143 176 255 / 0.1);
    --card-line: rgb(143 176 255 / 0.11);
    --grid-line: rgb(143 176 255 / 0.06);
  }

  :root[data-theme="dark"] .tv-sec--tint {
    --sec-bg: #0a0e19;
  }

  :root[data-theme="dark"] .tv-btn--secondary {
    --btn-bg: rgb(255 255 255 / 0.04);
    --btn-bg-hover: rgb(255 255 255 / 0.08);
  }

  :root.tv-theme-anim,
  :root.tv-theme-anim *,
  :root.tv-theme-anim *::before,
  :root.tv-theme-anim *::after {
    transition:
      background-color var(--d-theme) var(--ease-soft),
      color var(--d-theme) var(--ease-soft),
      border-color var(--d-theme) var(--ease-soft),
      fill var(--d-theme) var(--ease-soft),
      stroke var(--d-theme) var(--ease-soft) !important;
  }

  [data-reveal].is-anim {
    transition:
      opacity var(--d-5) var(--ease-out) calc(var(--i, 0) * var(--stagger) + var(--delay, 0ms)),
      transform var(--d-5) var(--ease-out) calc(var(--i, 0) * var(--stagger) + var(--delay, 0ms));
  }
}
