/* ============================================================
   شبكة الأنوار الخمسة — Design Tokens
   Art direction: مؤسسة عربية رصينة حديثة
   Palette: أبيض دافئ + أزرق نفطي عميق + ذهبي
   Typography: IBM Plex Arabic (headings) + Cairo (body)
   Density: balanced — spacious sections, dense cards
   ============================================================ */

/* Google Fonts & IBM Plex Arabic */
@import url('https://fonts.googleapis.com/css2?family=Alexandria:wght@500;700;800;900&family=IBM+Plex+Sans+Arabic:wght@400;600;700&family=Cairo:wght@400;600;700&display=swap');

/* ── Fluid Type Scale ── */
:root {
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  /* --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem); */
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.2rem);
  --text-3xl:  clamp(2.5rem,   1rem    + 4vw,    5rem);

  /* ── Fonts ── */
  --font-display: 'Alexandria', 'IBM Plex Sans Arabic', 'Cairo', sans-serif;
  --font-body:    'Cairo', 'IBM Plex Sans Arabic', sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* ── Spacing (4px base) ── */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* ── Border Radius ── */
  --radius-sm:   0.375rem;
  --radius-md:   0.5rem;
  --radius-lg:   0.75rem;
  --radius-xl:   1rem;
  --radius-2xl:  1.5rem;
  --radius-full: 9999px;

  /* ── Content Widths ── */
  --content-narrow:  640px;
  --content-default: 960px;
  --content-wide:    1200px;
  --content-full:    100%;

  /* ── Transitions ── */
  --transition-fast:        150ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-interactive: 220ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth:      400ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow:        600ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Light Mode (Default) ── */
:root, [data-theme="light"] {
  /* Surfaces — Warm White */
  --color-bg:               #F8F7F3;
  --color-surface:          #FFFFFF;
  --color-surface-2:        #FAFAF8;
  --color-surface-offset:   #F2F1EC;
  --color-surface-offset-2: #ECEAE3;
  --color-surface-dynamic:  #E4E2DB;
  --color-divider:          #DDD9D0;
  --color-border:           #D4D0C6;
  --color-border-light:		#f1f5f9;

  /* Text */
  --color-text:         #1A1A2E;
  --color-text-muted:   #5A6070;
  --color-text-faint:   #A0A8B5;
  --color-text-inverse: #F8F7F3;

  /* Primary — Deep Petroleum Blue */
  --color-primary:           #0A4D6B;
  --color-primary-hover:     #083D57;
  --color-primary-active:    #062E42;
  --color-primary-light:     #EBF4F8;
  --color-primary-highlight: #C5DDE8;

  /* Gold — Arabic Heritage Accent */
  --color-gold:           #C8951A;
  --color-gold-hover:     #A87A14;
  --color-gold-active:    #8A620F;
  --color-gold-light:     #FDF6E3;
  --color-gold-highlight: #F0D99A;

  /* Dark sections */
  --color-dark-bg:      #0D1117;
  --color-dark-surface: #161B22;
  --color-dark-border:  #30363D;
  --color-dark-text:    #E6EDF3;
  --color-dark-muted:   #8B949E;
  --color-dark-title:   #005276;

  /* Semantic */
  --color-success:  #2D6A4F;
  --color-warning:  #B45309;
  --color-error:    #991B1B;
  --color-info:     #1D4ED8;

  /* Shadows — warm-toned */
  --shadow-xs: 0 1px 2px oklch(0.15 0.02 240 / 0.05);
  --shadow-sm: 0 1px 3px oklch(0.15 0.02 240 / 0.08), 0 1px 2px oklch(0.15 0.02 240 / 0.05);
  --shadow-md: 0 4px 12px oklch(0.15 0.02 240 / 0.10), 0 2px 4px oklch(0.15 0.02 240 / 0.06);
  --shadow-lg: 0 12px 32px oklch(0.15 0.02 240 / 0.12), 0 4px 8px oklch(0.15 0.02 240 / 0.06);
  --shadow-xl: 0 24px 64px oklch(0.15 0.02 240 / 0.15), 0 8px 16px oklch(0.15 0.02 240 / 0.08);

  /* Gold glow for special elements */
  --shadow-gold: 0 4px 20px oklch(0.65 0.15 70 / 0.25);
  --shadow-primary: 0 4px 20px oklch(0.35 0.10 220 / 0.30);

  /* Info / Apps Accent */
  --color-info-light:	#EFF6FF;
  --color-bg-split:		#F8F8F8;
  --color-border-split:	#F1F1F1;
  
  --stat-card-bg: 			var(--color-surface-2, #fdfdfd);
  --stat-card-border: 		rgba(0, 0, 0, 0.08); /* إطار رصاصي واضح قليلاً */
  --stat-card-shadow: 		rgba(0, 0, 0, 0.03);
  --stat-card-shadow-hover:	rgba(0, 0, 0, 0.07);
}

/* ── Dark Mode ── */
[data-theme="dark"] {
  --color-bg:               #0D1117;
  --color-surface:          #161B22;
  --color-surface-2:        #1C2128;
  --color-surface-offset:   #1A2030;
  --color-surface-offset-2: #21262D;
  --color-surface-dynamic:  #2D333B;
  --color-divider:          #21262D;
  --color-border:           #30363D;
  --color-border-light:		#5d6269;
  --color-text:             #E6EDF3;
  --color-text-muted:       #8B949E;
  --color-text-faint:       #8e959f;
  --color-text-inverse:     #0D1117;
  --color-primary:          #4FA8CC;
  --color-primary-hover:    #6BBDE0;
  --color-primary-active:   #2D8DB5;
  --color-primary-light:    #0D2A38;
  --color-primary-highlight:#1A3D52;
  --color-gold:             #F0BA45;
  --color-gold-hover:       #F5CC6A;
  --color-gold-active:      #D4A030;
  --color-gold-light:       #2A2010;
  --color-gold-highlight:   #3D3010;
  --color-dark-bg:          #010409;
  --color-dark-surface:     #0D1117;
  --color-dark-border:      #21262D;
  --color-dark-text:        #E6EDF3;
  --color-dark-muted:       #8B949E;
  --color-dark-title:   	#005276;
  --shadow-xs: 0 1px 2px oklch(0 0 0 / 0.20);
  --shadow-sm: 0 1px 3px oklch(0 0 0 / 0.30), 0 1px 2px oklch(0 0 0 / 0.20);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.35), 0 2px 4px oklch(0 0 0 / 0.20);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.40), 0 4px 8px oklch(0 0 0 / 0.25);
  --shadow-xl: 0 24px 64px oklch(0 0 0 / 0.50), 0 8px 16px oklch(0 0 0 / 0.30);
  --shadow-gold: 0 4px 20px oklch(0.75 0.15 75 / 0.20);
  --shadow-primary: 0 4px 20px oklch(0.55 0.12 220 / 0.25);
  --color-info-light:		#1E293B;
  --color-bg-split:			#1E1E1E;
  --color-border-split:		#333333;
  --stat-card-bg: 			var(--color-surface-offset-2, #1e293b);
  --stat-card-border: 		rgba(255, 255, 255, 0.05); /* إطار فاتح جداً يندمج مع الداكن */
  --stat-card-shadow:		rgba(0, 0, 0, 0.3);
  --stat-card-shadow-hover:	rgba(0, 0, 0, 0.5);
}

/* ── System Preference Fallback ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:               #0D1117;
    --color-surface:          #161B22;
    --color-surface-2:        #1C2128;
    --color-surface-offset:   #1A2030;
    --color-surface-offset-2: #21262D;
    --color-surface-dynamic:  #2D333B;
    --color-divider:          #21262D;
    --color-border:           #30363D;
    --color-border-light:  	  #5d6269;
    --color-text:             #E6EDF3;
    --color-text-muted:       #8B949E;
    --color-text-faint:       #8e959f;
    --color-text-inverse:     #0D1117;
    --color-primary:          #4FA8CC;
    --color-primary-hover:    #6BBDE0;
    --color-primary-active:   #2D8DB5;
    --color-primary-light:    #0D2A38;
    --color-primary-highlight:#1A3D52;
    --color-gold:             #F0BA45;
    --color-gold-hover:       #F5CC6A;
    --color-gold-active:      #D4A030;
    --color-gold-light:       #2A2010;
    --color-gold-highlight:   #3D3010;
	--color-bg-split:		  #1E1E1E;
	--color-border-split:	  #333333;
  }
}
