@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300;400;500;600&family=Noto+Naskh+Arabic:wght@400;500;600;700&family=DM+Mono:wght@300;400;500&display=swap');

/* ============================================
   ARAFAH — Design System
   Sacred Minimalism
   ============================================ */

:root {
  /* Typography — shared across all themes */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-arabic:  'Noto Naskh Arabic', serif;
  --font-mono:    'DM Mono', monospace;

  /* Spacing — 8px grid */
  --s1:  4px;
  --s2:  8px;
  --s3:  12px;
  --s4:  16px;
  --s5:  24px;
  --s6:  32px;
  --s7:  48px;
  --s8:  64px;
  --s9:  96px;

  /* Radius */
  --r-sm: 8px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;

  /* Transitions */
  --t-fast:   150ms ease;
  --t-base:   250ms ease;
  --t-slow:   400ms ease;
  --t-reveal: 600ms cubic-bezier(0.16, 1, 0.3, 1);

  /* ── Theme: Pearl — لؤلؤي (default) ── */
  --bg:          #D8E4F2;
  --surface:     #FFFFFF;
  --surface-2:   #EAF0F9;
  --deep:        #1A3A5C;
  --primary:     #2A5FA0;
  --accent:      #4A7CB5;
  --muted:       rgba(74,124,181,0.5);
  --success:     #2A7A5A;
  --border:      rgba(74,124,181,0.18);
  --shadow:      rgba(26,58,92,0.1);
  --glow:        rgba(74,124,181,0.08);
  --card-inner:  #EAF0F9;
  --num-color:   #2A5FA0;
}

/* ============================================
   THEME: NIGHT — ليل الصحراء
   ============================================ */
[data-theme="night"] {
  --bg:          #0D0A05;
  --surface:     #1A1207;
  --surface-2:   #221809;
  --deep:        #F5ECD7;
  --primary:     #C4973A;
  --accent:      #E0B87A;
  --muted:       rgba(196,151,58,0.45);
  --success:     #4A8C5C;
  --border:      rgba(196,151,58,0.15);
  --shadow:      rgba(0,0,0,0.4);
  --glow:        rgba(196,151,58,0.08);
  --card-inner:  #150F05;
  --num-color:   #C4973A;
}

/* ============================================
   THEME: EMERALD — أخضر عميق
   ============================================ */
[data-theme="emerald"] {
  --bg:          #060F0A;
  --surface:     #0D2018;
  --surface-2:   #102818;
  --deep:        #F0E6C8;
  --primary:     #C4973A;
  --accent:      #A8D4B0;
  --muted:       rgba(168,212,176,0.45);
  --success:     #2A7A4A;
  --border:      rgba(26,120,60,0.25);
  --shadow:      rgba(0,0,0,0.5);
  --glow:        rgba(26,80,45,0.2);
  --card-inner:  rgba(26,80,40,0.25);
  --num-color:   #C4973A;
}

/* ============================================
   THEME: PEARL — لؤلؤي
   ============================================ */
[data-theme="pearl"] {
  --bg:          #D8E4F2;
  --surface:     #FFFFFF;
  --surface-2:   #EAF0F9;
  --deep:        #1A3A5C;
  --primary:     #2A5FA0;
  --accent:      #4A7CB5;
  --muted:       rgba(74,124,181,0.5);
  --success:     #2A7A5A;
  --border:      rgba(74,124,181,0.18);
  --shadow:      rgba(26,58,92,0.1);
  --glow:        rgba(74,124,181,0.08);
  --card-inner:  #EAF0F9;
  --num-color:   #2A5FA0;
}

/* ── Theme transition ── */
body, .card, .btn, .choice, .tile, [class*="surface"] {
  transition:
    background var(--t-slow),
    border-color var(--t-slow),
    color var(--t-slow);
}

/* ============================================
   RESET & BASE
   ============================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: var(--font-arabic);
  background: var(--bg);
  color: var(--deep);
  min-height: 100%;
  direction: rtl;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Numbers always LTR */
.num {
  font-family: var(--font-mono);
  direction: ltr;
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* ============================================
   TYPOGRAPHY SCALE
   ============================================ */

.t-display {
  font-family: var(--font-display);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.t-title   { font-size: 2rem;   font-weight: 600; }
.t-heading { font-size: 1.4rem; font-weight: 600; }
.t-body    { font-size: 1rem;   font-weight: 400; }
.t-small   { font-size: 0.85rem; font-weight: 400; }
.t-micro   { font-size: 0.75rem; font-weight: 400; }

.t-muted   { color: var(--muted); }
.t-primary { color: var(--primary); }
.t-accent  { color: var(--accent); }

/* ============================================
   LAYOUT UTILITIES
   ============================================ */

.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  padding: var(--s5);
  padding-bottom: calc(var(--s5) + env(safe-area-inset-bottom));
}

.flex     { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--s2); }
.gap-2 { gap: var(--s4); }
.gap-3 { gap: var(--s5); }
.gap-4 { gap: var(--s6); }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.text-center { text-align: center; }

/* ============================================
   COMPONENTS
   ============================================ */

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s5);
}

.card-lg {
  padding: var(--s6);
}

/* Button — Primary */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: var(--s3) var(--s6);
  border-radius: var(--r-xl);
  font-family: var(--font-arabic);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--t-base);
  width: 100%;
  min-height: 52px;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--primary);
  color: var(--bg);
}

.btn-primary:hover {
  background: #7A5C11;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(139, 105, 20, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface);
  color: var(--deep);
}

/* Choice Button (Onboarding options) */
.choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s4) var(--s5);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: var(--t-base);
  width: 100%;
  text-align: right;
  font-family: var(--font-arabic);
  font-size: 1rem;
  color: var(--deep);
}

.choice:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}

.choice.selected {
  border-color: var(--primary);
  background: rgba(139, 105, 20, 0.06);
}

.choice-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: var(--t-base);
  flex-shrink: 0;
}

.choice.selected .choice-icon {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: inset 0 0 0 3px var(--bg);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  width: 100%;
}

/* ============================================
   PROGRESS INDICATOR (Onboarding)
   ============================================ */

.progress-dots {
  display: flex;
  gap: var(--s2);
  align-items: center;
  justify-content: center;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  transition: var(--t-slow);
}

.dot.active {
  width: 24px;
  background: var(--primary);
}

.dot.done {
  background: var(--accent);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pulse-gold {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

.animate-in {
  animation: fadeUp var(--t-reveal) both;
}

.delay-1 { animation-delay: 100ms; }
.delay-2 { animation-delay: 200ms; }
.delay-3 { animation-delay: 350ms; }
.delay-4 { animation-delay: 500ms; }

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ============================================
   SAFE AREA / PWA
   ============================================ */

.safe-top    { padding-top: env(safe-area-inset-top); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
