/* =====================================================================
   tokens.css — {{BRAND_NAME}} private video library
   Design tokens. Names are the contract with engineering.
   Light theme on :root; dark under prefers-color-scheme and [data-theme="dark"].
   Accent options: default "oasis" (teal); alternates data-accent="clay" | "ink".
   ===================================================================== */

/* ---------- Light (default) ---------- */
:root,
[data-theme="light"] {
  color-scheme: light;

  /* Labels */
  --label-primary: #1D1D1F;
  --label-secondary: #6E6E73;      /* 5.07:1 on bg-primary, 4.54:1 on bg-secondary */
  --label-tertiary: #8A8A8E;       /* 3:1 role only: large text, icons, disabled */
  --label-quaternary: rgba(60, 60, 67, 0.18);

  /* Backgrounds */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F2F2F7;
  --bg-tertiary: #FFFFFF;
  --bg-grouped-primary: #F2F2F7;
  --bg-grouped-secondary: #FFFFFF;
  --bg-grouped-tertiary: #F2F2F7;

  /* Fills (controls, tracks) */
  --fill-primary: rgba(120, 120, 128, 0.20);
  --fill-secondary: rgba(120, 120, 128, 0.16);
  --fill-tertiary: rgba(118, 118, 128, 0.12);
  --fill-quaternary: rgba(116, 116, 128, 0.08);

  /* Separators */
  --separator: rgba(60, 60, 67, 0.29);
  --separator-opaque: #C6C6C8;

  /* Accent — Oasis (teal) */
  --tint: #0B7A70;
  --tint-hover: #096B62;
  --tint-pressed: #075A53;
  --tint-text: #096A61;            /* 6.47:1 on bg-primary */
  --tint-subtle: rgba(11, 122, 112, 0.10);
  --on-tint: #FFFFFF;              /* 5.21:1 on tint */

  /* Status */
  --success: #1A6E2E;  --success-subtle: rgba(26, 110, 46, 0.10);
  --warning: #875000;  --warning-subtle: rgba(135, 80, 0, 0.10);
  --danger:  #B22A25;  --danger-subtle:  rgba(178, 42, 37, 0.10);
  --info:    #2957B5;  --info-subtle:    rgba(41, 87, 181, 0.10);


  /* Component-level semantic additions */
  --on-danger: #FFFFFF;
  --bg-sheet: #F2F2F7;
  --control-thumb: #FFFFFF;
  --thumb-hairline: rgba(0, 0, 0, 0.08);
  --tooltip-bg: #1D1D1F;
  --tooltip-label: #FFFFFF;

  /* Media */
  --player-bg: #000000;
  --scrim: rgba(0, 0, 0, 0.40);
  --scrim-top: linear-gradient(to bottom, rgba(0,0,0,0.55), rgba(0,0,0,0));
  --watermark: rgba(255, 255, 255, 0.18);
  --watermark-outline: rgba(0, 0, 0, 0.28);
  --watermark-pattern: rgba(255, 255, 255, 0.05);

  /* Focus */
  --focus-ring: #0B7A70;

  /* Thumbnail title-card tones (placeholder art until real thumbnails) */
  --thumb-1: #1F2A2E;  --thumb-2: #2B2620;  --thumb-3: #232533;  --thumb-4: #2A2230;  --thumb-5: #1E2B24;

  /* Materials */
  --material-thin-bg: rgba(255, 255, 255, 0.55);
  --material-regular-bg: rgba(255, 255, 255, 0.72);
  --material-thick-bg: rgba(255, 255, 255, 0.86);
  --material-thin-filter: blur(16px) saturate(180%);
  --material-regular-filter: blur(24px) saturate(180%);
  --material-thick-filter: blur(32px) saturate(180%);
  --material-highlight: rgba(255, 255, 255, 0.60);
  --material-edge: rgba(0, 0, 0, 0.06);
  --material-thin-fallback: #F7F7F9;
  --material-regular-fallback: #F9F9FB;
  --material-thick-fallback: #FFFFFF;

  /* Glass for player controls (always over video → same in both themes) */
  --material-glass-bg: rgba(22, 22, 24, 0.62);
  --material-glass-filter: blur(28px) saturate(160%);
  --material-glass-highlight: rgba(255, 255, 255, 0.16);
  --material-glass-fallback: #1D1D20;

  /* Elevation */
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-popover: 0 2px 6px rgba(0, 0, 0, 0.08), 0 12px 32px rgba(0, 0, 0, 0.12);
  --shadow-sheet: 0 8px 20px rgba(0, 0, 0, 0.10), 0 28px 64px rgba(0, 0, 0, 0.18);
  --elevation-border: rgba(0, 0, 0, 0);
}

/* ---------- Dark ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --label-primary: #FFFFFF;
    --label-secondary: #AEAEB2;
    --label-tertiary: #8E8E93;
    --label-quaternary: rgba(235, 235, 245, 0.18);
    --bg-primary: #000000;
    --bg-secondary: #1C1C1E;
    --bg-tertiary: #2C2C2E;
    --bg-grouped-primary: #000000;
    --bg-grouped-secondary: #1C1C1E;
    --bg-grouped-tertiary: #2C2C2E;
    --fill-primary: rgba(120, 120, 128, 0.36);
    --fill-secondary: rgba(120, 120, 128, 0.32);
    --fill-tertiary: rgba(118, 118, 128, 0.24);
    --fill-quaternary: rgba(118, 118, 128, 0.18);
    --separator: rgba(84, 84, 88, 0.65);
    --separator-opaque: #38383A;
    --tint: #3DD0BE; --tint-hover: #5BDACA; --tint-pressed: #2FB8A8; --tint-text: #3DD0BE;
    --tint-subtle: rgba(61, 208, 190, 0.16); --on-tint: #04211E;
    --success: #30D158; --success-subtle: rgba(48, 209, 88, 0.16);
    --warning: #FFB340; --warning-subtle: rgba(255, 179, 64, 0.16);
    --danger: #FF6961;  --danger-subtle: rgba(255, 105, 97, 0.16);
    --info: #6EA8FF;    --info-subtle: rgba(110, 168, 255, 0.16);
    --focus-ring: #3DD0BE;
    --material-thin-bg: rgba(30, 30, 32, 0.55);
    --material-regular-bg: rgba(30, 30, 32, 0.72);
    --material-thick-bg: rgba(30, 30, 32, 0.86);
    --material-highlight: rgba(255, 255, 255, 0.10);
    --material-edge: rgba(255, 255, 255, 0.06);
    --material-thin-fallback: #1C1C1E;
    --material-regular-fallback: #232325;
    --material-thick-fallback: #2C2C2E;
    --shadow-card: none;
    --shadow-popover: 0 12px 32px rgba(0, 0, 0, 0.50);
    --shadow-sheet: 0 28px 64px rgba(0, 0, 0, 0.60);
    --elevation-border: rgba(255, 255, 255, 0.08);
    --on-danger: #2B0705;
    --bg-sheet: #1C1C1E;
    --control-thumb: #636366;
    --thumb-hairline: rgba(255, 255, 255, 0.10);
    --tooltip-bg: #3A3A3C;
    --tooltip-label: #FFFFFF;
  }
}

[data-theme="dark"] {
  color-scheme: dark;
  --label-primary: #FFFFFF;
  --label-secondary: #AEAEB2;       /* 6.3:1 on bg-tertiary */
  --label-tertiary: #8E8E93;
  --label-quaternary: rgba(235, 235, 245, 0.18);
  --bg-primary: #000000;
  --bg-secondary: #1C1C1E;
  --bg-tertiary: #2C2C2E;
  --bg-grouped-primary: #000000;
  --bg-grouped-secondary: #1C1C1E;
  --bg-grouped-tertiary: #2C2C2E;
  --fill-primary: rgba(120, 120, 128, 0.36);
  --fill-secondary: rgba(120, 120, 128, 0.32);
  --fill-tertiary: rgba(118, 118, 128, 0.24);
  --fill-quaternary: rgba(118, 118, 128, 0.18);
  --separator: rgba(84, 84, 88, 0.65);
  --separator-opaque: #38383A;
  --tint: #3DD0BE;
  --tint-hover: #5BDACA;
  --tint-pressed: #2FB8A8;
  --tint-text: #3DD0BE;             /* 10.96:1 on bg-primary */
  --tint-subtle: rgba(61, 208, 190, 0.16);
  --on-tint: #04211E;               /* 8.83:1 on tint */
  --success: #30D158; --success-subtle: rgba(48, 209, 88, 0.16);
  --warning: #FFB340; --warning-subtle: rgba(255, 179, 64, 0.16);
  --danger: #FF6961;  --danger-subtle: rgba(255, 105, 97, 0.16);
  --info: #6EA8FF;    --info-subtle: rgba(110, 168, 255, 0.16);
  --focus-ring: #3DD0BE;
  --material-thin-bg: rgba(30, 30, 32, 0.55);
  --material-regular-bg: rgba(30, 30, 32, 0.72);
  --material-thick-bg: rgba(30, 30, 32, 0.86);
  --material-highlight: rgba(255, 255, 255, 0.10);
  --material-edge: rgba(255, 255, 255, 0.06);
  --material-thin-fallback: #1C1C1E;
  --material-regular-fallback: #232325;
  --material-thick-fallback: #2C2C2E;
  --shadow-card: none;
  --shadow-popover: 0 12px 32px rgba(0, 0, 0, 0.50);
  --shadow-sheet: 0 28px 64px rgba(0, 0, 0, 0.60);
  --elevation-border: rgba(255, 255, 255, 0.08);
  --on-danger: #2B0705;
  --bg-sheet: #1C1C1E;
  --control-thumb: #636366;
  --thumb-hairline: rgba(255, 255, 255, 0.10);
  --tooltip-bg: #3A3A3C;
  --tooltip-label: #FFFFFF;
}

/* ---------- Accent alternates (proposal; pick one, then delete the others) ---------- */
[data-accent="clay"], [data-accent="clay"] [data-theme="light"] {
  --tint: #AE4419; --tint-hover: #993B15; --tint-pressed: #823211; --tint-text: #AE4419;
  --tint-subtle: rgba(174, 68, 25, 0.10); --on-tint: #FFFFFF; --focus-ring: #AE4419;
}
[data-accent="clay"][data-theme="dark"], [data-accent="clay"] [data-theme="dark"] {
  --tint: #FF8A57; --tint-hover: #FF9D71; --tint-pressed: #F07A45; --tint-text: #FF8A57;
  --tint-subtle: rgba(255, 138, 87, 0.16); --on-tint: #2A0E02; --focus-ring: #FF8A57;
}
[data-accent="ink"], [data-accent="ink"] [data-theme="light"] {
  --tint: #4A3FD1; --tint-hover: #4136BD; --tint-pressed: #372DA6; --tint-text: #4A3FD1;
  --tint-subtle: rgba(74, 63, 209, 0.10); --on-tint: #FFFFFF; --focus-ring: #4A3FD1;
}
[data-accent="ink"][data-theme="dark"], [data-accent="ink"] [data-theme="dark"] {
  --tint: #A49BFF; --tint-hover: #B5AEFF; --tint-pressed: #9288F5; --tint-text: #A49BFF;
  --tint-subtle: rgba(164, 155, 255, 0.16); --on-tint: #140F3D; --focus-ring: #A49BFF;
}


/* ---------- Media tokens (theme-invariant: the player is always dark) ---------- */
:root, [data-theme] {
  --on-media: #FFFFFF;
  --on-media-secondary: rgba(255, 255, 255, 0.78);
  --media-track: rgba(255, 255, 255, 0.24);
  --media-buffer: rgba(255, 255, 255, 0.44);
  --media-fill-hover: rgba(255, 255, 255, 0.14);
  --player-surface: #1C1C1E;
  --scrim-strong: rgba(0, 0, 0, 0.72);
  --switch-thumb: #FFFFFF;
}

/* ---------- Non-color tokens ---------- */
:root, [data-theme] {
  /* Type */
  --font-sans: "Inter", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;

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

  /* Layout */
  --content-max: 1280px;
  --margin-compact: 16px; --margin-regular: 28px; --margin-wide: 40px;
  --gutter-compact: 16px; --gutter-regular: 20px; --gutter-wide: 24px;
  --tap-min: 44px;

  /* Shape */
  --radius-xs: 6px; --radius-sm: 10px; --radius-md: 14px; --radius-lg: 20px; --radius-xl: 28px; --radius-full: 999px;

  /* Motion */
  --duration-fast: 150ms; --duration-base: 250ms; --duration-slow: 400ms; --duration-press: 120ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-exit: cubic-bezier(0.3, 0, 1, 1);
  --ease-emphasized: cubic-bezier(0.32, 0.72, 0, 1);
  --press-scale: 0.97;

  /* Icon sizes */
  --icon-16: 16px; --icon-20: 20px; --icon-24: 24px; --icon-28: 28px;
}

/* ---------- Base ---------- */
.ds-root {
  font-family: var(--font-sans);
  color: var(--label-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
  box-sizing: border-box;
}
.ds-root *, .ds-root *::before, .ds-root *::after { box-sizing: border-box; }
.ds-root :focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- Text styles (Latin line-height by default; Arabic via :lang(ar)) ---------- */
.t-display     { font-size: 48px; font-weight: 700; line-height: 52px; letter-spacing: -0.02em; }
.t-large-title { font-size: 34px; font-weight: 700; line-height: 41px; letter-spacing: -0.02em; }
.t-title-1     { font-size: 28px; font-weight: 700; line-height: 34px; letter-spacing: -0.02em; }
.t-title-2     { font-size: 22px; font-weight: 700; line-height: 28px; letter-spacing: -0.01em; }
.t-title-3     { font-size: 20px; font-weight: 600; line-height: 25px; letter-spacing: -0.01em; }
.t-headline    { font-size: 17px; font-weight: 600; line-height: 22px; letter-spacing: 0; }
.t-body        { font-size: 17px; font-weight: 400; line-height: 24px; letter-spacing: 0; }
.t-callout     { font-size: 16px; font-weight: 400; line-height: 22px; letter-spacing: 0; }
.t-subheadline { font-size: 15px; font-weight: 400; line-height: 20px; letter-spacing: 0; }
.t-footnote    { font-size: 13px; font-weight: 400; line-height: 18px; letter-spacing: 0; }
.t-caption-1   { font-size: 12px; font-weight: 400; line-height: 16px; letter-spacing: 0; }
.t-caption-2   { font-size: 11px; font-weight: 500; line-height: 13px; letter-spacing: 0.01em; }

.t-display:lang(ar)     { line-height: 68px; letter-spacing: 0; }
.t-large-title:lang(ar) { line-height: 52px; letter-spacing: 0; }
.t-title-1:lang(ar)     { line-height: 44px; letter-spacing: 0; }
.t-title-2:lang(ar)     { line-height: 36px; letter-spacing: 0; }
.t-title-3:lang(ar)     { line-height: 32px; letter-spacing: 0; }
.t-headline:lang(ar)    { line-height: 28px; }
.t-body:lang(ar)        { line-height: 30px; }
.t-callout:lang(ar)     { line-height: 28px; }
.t-subheadline:lang(ar) { line-height: 26px; }
.t-footnote:lang(ar)    { line-height: 22px; }
.t-caption-1:lang(ar)   { line-height: 20px; }
.t-caption-2:lang(ar)   { font-size: 12px; line-height: 20px; letter-spacing: 0; }

.w-400 { font-weight: 400; } .w-500 { font-weight: 500; } .w-600 { font-weight: 600; } .w-700 { font-weight: 700; }
.c-primary { color: var(--label-primary); } .c-secondary { color: var(--label-secondary); }
.c-tertiary { color: var(--label-tertiary); } .c-tint { color: var(--tint-text); }
.tnum { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pretty { text-wrap: pretty; }

/* Directional glyphs flip in RTL; never flip checkmarks, clocks, logos */
[dir="rtl"] .flip-rtl { transform: scaleX(-1); transform-box: view-box; transform-origin: 50% 50%; }
