/* ==========================================================================
   Sarh Al-Wajaha Design System — Tokens (Light & Dark)
   Derived strictly from brand logo: Navy #18254F & Gold #CDA861
   WCAG AA verified across all surface / text pairings.
   ========================================================================== */

:root {
  color-scheme: light dark;

  /* Brand Navy Ramp (step 800 = logo navy) */
  --navy-50: #F6F7F9;
  --navy-100: #E9EBF1;
  --navy-200: #D3D7E3;
  --navy-300: #A9B2D1;
  --navy-400: #7C88B0;
  --navy-500: #4A5A8C;
  --navy-600: #2F4075;
  --navy-700: #1F2F63;
  --navy-800: #18254F;
  --navy-900: #101937;
  --navy-950: #0B1228;

  /* Brand Gold Ramp (step 500 = logo gold, flat only) */
  --gold-50: #FAF6F0;
  --gold-100: #F4ECDD;
  --gold-200: #E8D8BA;
  --gold-300: #DBC394;
  --gold-400: #D6B371;
  --gold-500: #CDA861;
  --gold-600: #B48B3C;
  --gold-700: #8E6D2F;
  --gold-800: #6B5324;

  /* Light Mode Semantic Tokens */
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #EEF0F4;
  --surface-3: #E4E7EE;
  --hairline: #DDE1E9;
  --hairline-strong: rgba(169, 178, 209, 0.6);

  --text: #1B2236;
  --text-muted: #5B6478;
  --brand: var(--navy-800);
  --brand-ink: #0E1730;

  --accent: var(--gold-500);
  --accent-hover: var(--gold-400);
  --accent-pressed: var(--gold-600);
  --on-accent: var(--navy-800);
  --accent-text: #82641F;
  --link: var(--navy-600);

  --success: #2F7D5B;
  --success-text: #256649;
  --success-bg: rgba(47, 125, 91, 0.10);
  --danger: #B23A48;
  --danger-bg: rgba(178, 58, 72, 0.10);
  --warning: #82641F;
  --warning-bg: rgba(142, 109, 47, 0.12);

  /* Neutral Shadows (navy-black low alpha, never pure black, never colored) */
  --shadow-sm: 0 1px 3px rgba(16, 25, 55, 0.06), 0 1px 2px rgba(16, 25, 55, 0.04);
  --shadow-md: 0 10px 26px -10px rgba(16, 25, 55, 0.12), 0 2px 6px -2px rgba(16, 25, 55, 0.05);
  --shadow-lg: 0 24px 54px -18px rgba(14, 23, 48, 0.22), 0 4px 14px -4px rgba(14, 23, 48, 0.08);

  /* Liquid Glass (floating surfaces ONLY) */
  --glass-bar-bg: rgba(246, 247, 249, 0.88);
  --glass-bar-blur: blur(10px) saturate(140%);
  --glass-bar-shadow:
    0 0 0 0.5px rgba(27, 34, 54, 0.09),
    0 12px 34px -12px rgba(27, 34, 54, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);

  --glass-popover-bg: rgba(255, 255, 255, 0.94);
  --glass-popover-blur: blur(12px) saturate(145%);
  --glass-popover-shadow:
    0 0 0 0.5px rgba(27, 34, 54, 0.10),
    0 22px 52px -14px rgba(27, 34, 54, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.90);

  /* Typography */
  --font-display: 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Tajawal', 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Fluid Type Scale */
  --text-display: clamp(2rem, 2.6vw + 1.15rem, 3.35rem);
  --text-h2: clamp(1.5rem, 1.4vw + 1rem, 2.25rem);
  --text-h3: clamp(1.125rem, 0.6vw + 0.95rem, 1.375rem);
  --text-body: 1rem;
  --text-sm: 0.875rem;
  --text-xs: 0.8125rem;

  /* Concentric Radius System (inner = outer - gap) */
  --radius-card: 20px;
  --radius-card-inner: 12px;
  --radius-sheet: 24px;
  --radius-btn: 12px;
  --radius-input: 12px;
  --radius-pill: 9999px;

  /* Spacing & Layout */
  --header-height: 76px;
  --container-max: 1280px;
  --space-section: clamp(4rem, 5vw, 6.25rem);

  /* Focus Ring */
  --focus-ring: 2px solid var(--navy-800);
  --focus-offset: 2px;

  /* Motion Curves (Apple HIG) */
  --ease-press: cubic-bezier(0.2, 0, 0, 1);
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0E1730;
  --surface: #15213F;
  --surface-2: #1B2950;
  --surface-3: #22305D;
  --hairline: rgba(255, 255, 255, 0.09);
  --hairline-strong: rgba(255, 255, 255, 0.18);

  --text: #E9EBF2;
  --text-muted: #A3ACC2;
  --brand: #E9EBF2;
  --brand-ink: #0E1730;

  --accent: #CDA861;
  --accent-hover: #D6B371;
  --accent-pressed: #B48B3C;
  --on-accent: #18254F;
  --accent-text: #CDA861;
  --link: #A9B2D1;

  --success: #5FBF98;
  --success-text: #5FBF98;
  --success-bg: rgba(95, 191, 152, 0.14);
  --danger: #E27C88;
  --danger-bg: rgba(226, 124, 136, 0.14);
  --warning: #D6B371;
  --warning-bg: rgba(214, 179, 113, 0.14);

  /* Dark mode depth relies on surface luminance stepping rather than heavy shadow */
  --shadow-sm: 0 1px 2px rgba(11, 18, 40, 0.25);
  --shadow-md: 0 8px 24px -10px rgba(11, 18, 40, 0.45);
  --shadow-lg: 0 24px 54px -18px rgba(11, 18, 40, 0.65);

  --glass-bar-bg: rgba(21, 33, 63, 0.78);
  --glass-bar-blur: blur(14px) saturate(150%);
  --glass-bar-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 14px 36px -12px rgba(11, 18, 40, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);

  --glass-popover-bg: rgba(21, 33, 63, 0.90);
  --glass-popover-blur: blur(14px) saturate(150%);
  --glass-popover-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.09),
    0 22px 54px -14px rgba(11, 18, 40, 0.72),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);

  --focus-ring: 2px solid #CDA861;
}

/* Text Selection */
::selection {
  background: var(--gold-200);
  color: var(--navy-900);
}

[data-theme="dark"] ::selection {
  background: rgba(205, 168, 97, 0.35);
  color: var(--text);
}

/* Thin Custom Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-strong) transparent;
}

*::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--hairline-strong);
  border-radius: 9999px;
}
