/* ==========================================================================
   /css/tokens.css
   Responsibility: Single source of truth for Swamed bright architectural
   palette, self-hosted IBM Plex Sans Arabic & IBM Plex Sans fonts, spacing
   scale, radius scale, motion timing, and Liquid Glass web approximation.
   Rule: No raw color hex/rgb values outside this file.
   ========================================================================== */

/* Size-adjusted fallback fonts to eliminate layout shift (CLS) before swap */
@font-face {
  font-family: "IBM Plex Arabic Fallback";
  src: local("Tahoma"), local("Arial"), local("Segoe UI");
  size-adjust: 102%;
  ascent-override: 98%;
  descent-override: 32%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "IBM Plex Latin Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Segoe UI");
  size-adjust: 100%;
  ascent-override: 96%;
  descent-override: 24%;
  line-gap-override: 0%;
}

/* Self-hosted IBM Plex Sans Arabic (weights 400, 500, 700 only) */
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../assets/fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

/* Self-hosted IBM Plex Sans for Latin & Western digits (weights 400, 500, 700 only) */
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../assets/fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;

  /* Swamed White-First Architectural Palette with Restrained Color Hunt Blue Accents
     Core Primary: #FFFFFF (Pure White)
     Restrained Accents: #1B365D (Deep Navy) · #005A9C (Royal Azure) · #60C1E5 (Sky Blue) · #A0E0EF (Ice Cyan) */
  --navy-900: #1B365D;       /* Deep ink, grounded footer & primary dark accents */
  --navy-800: #005A9C;       /* Restrained royal azure for primary CTAs, active step & icons */
  --navy-700: #0A6BB3;       /* Hover azure */

  --accent-primary: #005A9C; /* High-contrast brand accent on current canvas */
  --cta-bg: #005A9C;
  --cta-hover: #1B365D;
  --cta-navy-bg: #1B365D;
  --cta-navy-hover: #005A9C;
  --control-active-bg: #1B365D;
  --control-active-border: #1B365D;
  --control-active-ink: #FFFFFF;
  --avatar-bg: #1B365D;
  --avatar-ink: #60C1E5;
  --footer-bg: #1B365D;
  --footer-border: transparent;
  --compare-handle-bg: #FFFFFF;
  --compare-handle-ink: #1B365D;
  --photo-badge-bg: #FFFFFF;
  --photo-badge-ink: #1B365D;
  --fab-top-ink: #1B365D;
  --fab-top-hover-bg: #1B365D;
  --fab-top-hover-ink: #60C1E5;

  --gold-500: #60C1E5;       /* Sky blue subtle accent (arrows, active borders, highlights) */
  --gold-500-hover: #A0E0EF; /* Soft ice cyan hover tint */
  --accent-ice: #A0E0EF;     /* Soft ice cyan whisper highlight */
  --gold-600: #005A9C;       /* Accessible azure text/icons on white (7.14:1 WCAG AAA) */
  --gold-700: #005A9C;       /* Accessible azure on light snow surfaces */
  --gold-tint-dark: rgba(96, 193, 229, 0.14);
  --gold-tint-border: rgba(96, 193, 229, 0.45);
  --gold-tint-light: rgba(160, 224, 239, 0.22);
  --gold-halo: rgba(160, 224, 239, 0.5);

  /* Dominant Pure White & Crisp Architectural Neutrals */
  --paper: #FFFFFF;
  --paper-soft: #F7FAFC;
  --surface-white: #FFFFFF;
  --surface-input: #F7FAFC;
  --ink: #1B365D;
  --mute: #516378;

  /* Text on Dark Elements (Photo Tile & Grounded Footer, >= 7:1 WCAG AAA) */
  --text-light: #FFFFFF;
  --text-light-muted: #E3EFF7;
  --text-light-subtle: #A0E0EF;

  /* Hairlines & Borders */
  --border-dark: rgba(255, 255, 255, 0.18);
  --border-dark-strong: rgba(255, 255, 255, 0.34);
  --border-light: rgba(27, 54, 93, 0.1);
  --border-light-strong: rgba(27, 54, 93, 0.18);
  --timeline-track-light: rgba(27, 54, 93, 0.12);

  /* WhatsApp & Semantic Feedback */
  --whatsapp-bg: #16A34A;
  --whatsapp-btn-bg: #15803D;  /* 5.02:1 with white label */
  --whatsapp-hover: #166534;
  --whatsapp-ink: #FFFFFF;
  --success: #166534;
  --success-bg: #ECFDF3;
  --success-border: rgba(22, 101, 52, 0.28);
  --error: #B42318;
  --error-bg: #FEF3F2;
  --error-border: rgba(180, 35, 24, 0.35);

  /* Floating Pure-White Translucent Liquid Glass Pill Nav (Web Approximation) */
  --glass-nav-bg: rgba(255, 255, 255, 0.88);
  --glass-nav-solid: #FFFFFF;
  --glass-card-bg: rgba(255, 255, 255, 0.9);
  --glass-card-solid: #FFFFFF;
  --glass-border: rgba(27, 54, 93, 0.12);
  --glass-highlight: rgba(255, 255, 255, 0.95);

  /* Media Scrims (only used over photographic tiles for readable text) */
  --hero-scrim-top: rgba(27, 54, 93, 0.45);
  --hero-scrim-bottom: rgba(27, 54, 93, 0.86);
  --scrim-dark-start: rgba(27, 54, 93, 0.86);
  --scrim-dark-mid: rgba(27, 54, 93, 0.44);
  --scrim-dark-end: rgba(27, 54, 93, 0.08);
  --scrim-quote: rgba(247, 250, 252, 0.92);
  --backdrop-overlay: rgba(27, 54, 93, 0.36);

  /* Soft Architectural Shadows */
  --shadow-nav: 0 10px 30px rgba(27, 54, 93, 0.08);
  --shadow-navy-sm: 0 8px 22px rgba(27, 54, 93, 0.12);
  --shadow-navy-md: 0 18px 40px rgba(27, 54, 93, 0.12);
  --shadow-paper-sm: 0 4px 18px rgba(27, 54, 93, 0.05);
  --shadow-paper-md: 0 12px 30px rgba(27, 54, 93, 0.09);
  --shadow-fab: 0 10px 28px rgba(21, 128, 61, 0.32);

  /* Focus Rings */
  --focus-ring-dark: #A0E0EF;
  --focus-ring-light: #005A9C;

  /* Strict Spacing Scale: 4 / 8 / 12 / 16 / 24 / 32 / 48 / 64 / 96 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 96px;

  /* Strict Radius System: Pill for buttons/chips/circles, 24px for cards, 14px for inputs */
  --radius-pill: 9999px;
  --radius-card: 24px;
  --radius-shell: 32px;
  --radius-input: 14px;

  /* Typography */
  --font-ar: "IBM Plex Sans Arabic", "IBM Plex Sans", "IBM Plex Arabic Fallback", system-ui, sans-serif;
  --font-en: "IBM Plex Sans", "IBM Plex Sans Arabic", "IBM Plex Latin Fallback", system-ui, sans-serif;
  --font-body: var(--font-ar);

  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: clamp(1.625rem, 2.7vw, 2.375rem);
  --text-3xl: clamp(2.125rem, 4vw, 3.35rem);

  --lh-body: 1.8;
  --lh-heading: 1.24;
  --tracking-heading: 0;

  /* Layout */
  --container-max: 1220px;
  --nav-height: 74px;

  /* Motion */
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 200ms;
  --dur-med: 380ms;
  --dur-slow: 620ms;

  /* Z-index Scale */
  --z-base: 1;
  --z-sticky: 40;
  --z-progress: 50;
  --z-floating: 60;
  --z-drawer-backdrop: 80;
  --z-drawer: 90;
  --z-skip: 100;
}

/* ==========================================================================
   Night Mode (النظام الليلي): Refined Neutral Obsidian Canvas with Restrained
   Sky/Azure Accents — keeps blue subtle and preserves WCAG 2.2 AA/AAA contrast.
   ========================================================================== */
html[data-theme="dark"] {
  color-scheme: dark;

  --paper: #0E1116;
  --paper-soft: #151A22;
  --surface-white: #1B212B;
  --surface-input: #11161D;
  --ink: #F2F5F9;
  --mute: #A1B0C2;

  --accent-primary: #60C1E5;
  --cta-bg: #005A9C;
  --cta-hover: #0A6BB3;
  --cta-navy-bg: #005A9C;
  --cta-navy-hover: #0A6BB3;
  --control-active-bg: #005A9C;
  --control-active-border: #60C1E5;
  --control-active-ink: #FFFFFF;
  --avatar-bg: #232B38;
  --avatar-ink: #A0E0EF;
  --footer-bg: #090C10;
  --footer-border: rgba(255, 255, 255, 0.08);
  --fab-top-ink: #F2F5F9;
  --fab-top-hover-bg: #005A9C;
  --fab-top-hover-ink: #FFFFFF;

  --gold-600: #60C1E5;
  --gold-700: #60C1E5;
  --gold-tint-border: rgba(96, 193, 229, 0.36);
  --gold-halo: rgba(96, 193, 229, 0.22);

  --border-light: rgba(255, 255, 255, 0.09);
  --border-light-strong: rgba(255, 255, 255, 0.16);
  --timeline-track-light: rgba(255, 255, 255, 0.14);

  --glass-nav-bg: rgba(18, 22, 29, 0.86);
  --glass-nav-solid: #151A22;
  --glass-card-bg: rgba(27, 33, 43, 0.9);
  --glass-card-solid: #1B212B;
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-highlight: rgba(255, 255, 255, 0.06);

  --scrim-dark-start: rgba(9, 12, 16, 0.88);
  --scrim-dark-mid: rgba(9, 12, 16, 0.48);
  --scrim-dark-end: rgba(9, 12, 16, 0.1);
  --backdrop-overlay: rgba(0, 0, 0, 0.62);

  --shadow-nav: 0 12px 32px rgba(0, 0, 0, 0.42);
  --shadow-navy-sm: 0 8px 22px rgba(0, 0, 0, 0.36);
  --shadow-navy-md: 0 18px 40px rgba(0, 0, 0, 0.46);
  --shadow-paper-sm: 0 4px 18px rgba(0, 0, 0, 0.28);
  --shadow-paper-md: 0 14px 32px rgba(0, 0, 0, 0.4);

  --success: #86EFAC;
  --success-bg: rgba(22, 101, 52, 0.22);
  --success-border: rgba(134, 239, 172, 0.38);
  --error: #FCA5A5;
  --error-bg: rgba(180, 35, 24, 0.2);
  --error-border: rgba(252, 165, 165, 0.42);

  --focus-ring-light: #60C1E5;
}

html[lang="en"] {
  --font-body: var(--font-en);
  --lh-body: 1.6;
  --lh-heading: 1.14;
  --tracking-heading: -0.02em;
}
