/* Al-Burhaniya — design tokens */
:root {
  color-scheme: light; /* native controls/scrollbars follow the theme */

  /* Brand */
  --emerald: #0c4a34;
  --emerald-2: #0f5c3f;
  --mid-green: #1f7a4e;
  --gold: #cdae3a;
  --light-gold: #e6cc6b;
  --parchment: #faf9f5;
  --dark-bg: #0e1712;
  --dark-card: #172520;
  --teal: #0f6b6b;
  --teal-2: #14857f;
  --silver: #c9cdd1;
  --silver-gold: #d8c98a;
  --danger: #b3392f;
  --danger-soft: #f8e5e3;
  --success: #1f7a4e;
  --warning: #b98a1c;
  --info: #2b6cb0;

  /* Surfaces (light) */
  --bg: var(--parchment);
  --bg-elevated: #ffffff;
  --card: #ffffff;
  --card-2: #f4f2ec;
  --border: #e5e2d8;
  --border-strong: #d2cec0;
  --text: #14231c;
  --text-2: #4c5b53;
  --text-3: #68756d;
  --header-bg: #ffffffee;
  --sidebar-bg: #0c4a34;
  --sidebar-text: #eaf3ee;
  --sidebar-muted: #a9c4b6;
  --sidebar-active: #ffffff14;
  --shadow-1: 0 1px 2px rgba(14, 23, 18, .06), 0 4px 16px rgba(14, 23, 18, .06);
  --shadow-2: 0 4px 10px rgba(14, 23, 18, .07), 0 16px 40px rgba(14, 23, 18, .12);
  --overlay: rgba(10, 18, 14, .5);


  /* Gradients */
  --grad-emerald: linear-gradient(135deg, #0c4a34 0%, #1f7a4e 100%);
  --grad-gold: linear-gradient(135deg, #cdae3a 0%, #e6cc6b 100%);
  --grad-emerald-gold: linear-gradient(135deg, #0c4a34 0%, #14684a 55%, #cdae3a 130%);
  --grad-hero: radial-gradient(1200px 400px at 10% -10%, #1f7a4e33, transparent 60%),
               radial-gradient(900px 380px at 100% 0%, #cdae3a22, transparent 55%),
               linear-gradient(160deg, #0c4a34, #0e1712 90%);

  /* Role accents */
  --accent: var(--mid-green);
  --accent-soft: #e7f2ec;
  --accent-contrast: #ffffff;

  /* Type */
  --font-ui: 'Segoe UI', system-ui, -apple-system, 'Noto Sans', 'Helvetica Neue', Arial, sans-serif;
  --font-urdu: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', var(--font-ui), serif; /* digits fall through to the English UI font */
  --font-arabic: 'IndoPak Mushaf', 'Amiri', 'Scheherazade New', 'Traditional Arabic', serif; /* Quran Pak style everywhere */
  --font-quran: 'IndoPak Mushaf', 'Amiri Quran', 'Scheherazade New', 'Amiri', serif;
  --fs-xs: .75rem;
  --fs-sm: .8125rem;
  --fs-base: .9rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.35rem;
  --fs-2xl: 1.7rem;
  --fs-3xl: 2.15rem;

  /* Spacing / radius / motion */
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem;
  --sp-5: 1.25rem; --sp-6: 1.5rem; --sp-8: 2rem; --sp-10: 2.5rem;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-full: 999px;
  --speed: .22s;
  --speed-slow: .45s;

  /* Layout */
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 76px;
  --header-h: 64px;
  --bottomnav-h: 64px;
  --content-max: 1280px;
}

/* Role themes */
html[data-role='mureed'] { --accent: var(--mid-green); --accent-soft: #e7f2ec; --sidebar-bg: #0c4a34; }
html[data-role='murshad'] { --accent: var(--teal); --accent-soft: #e2f1f0; --sidebar-bg: #0b3f3f; }
html[data-role='admin']   { --accent: #35624a; --accent-soft: #e9efe9; --sidebar-bg: #101d17; }

/* Dark theme */
[data-theme='dark'] {
  color-scheme: dark; /* date pickers, scrollbars, checkboxes render dark */
  --overlay: rgba(0, 0, 0, .62);
  --bg: var(--dark-bg);
  --bg-elevated: var(--dark-card);
  --card: var(--dark-card);
  --card-2: #1c2e27;
  --border: #27392f;
  --border-strong: #35493e;
  --text: #e9f0ec;
  --text-2: #aebdb5;
  --text-3: #7f918a;
  --header-bg: #172520ee;
  --sidebar-bg: #0a120e;
  --sidebar-text: #e9f0ec;
  --sidebar-muted: #8fa79a;
  --sidebar-active: #ffffff12;
  --danger-soft: #3a1f1c;
  --accent-soft: #17362a;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.35);
  --shadow-2: 0 6px 14px rgba(0,0,0,.45), 0 20px 48px rgba(0,0,0,.5);
  --grad-hero: radial-gradient(1200px 400px at 10% -10%, #1f7a4e2e, transparent 60%),
               radial-gradient(900px 380px at 100% 0%, #cdae3a1c, transparent 55%),
               linear-gradient(160deg, #10241b, #0e1712 90%);
}
[data-theme='dark'][data-role='murshad'] { --accent-soft: #10312f; }
[data-theme='dark'][data-role='admin']   { --accent-soft: #1a2a22; }

/* Large text */
[data-large-text] {
  --fs-xs: .85rem; --fs-sm: .92rem; --fs-base: 1.02rem; --fs-md: 1.12rem;
  --fs-lg: 1.25rem; --fs-xl: 1.5rem; --fs-2xl: 1.9rem; --fs-3xl: 2.4rem;
}

/* High contrast */
[data-high-contrast] {
  --text: #000000;
  --text-2: #1a1a1a;
  --text-3: #333333;
  --border: #000000;
  --border-strong: #000000;
  --card: #ffffff;
  --bg: #ffffff;
}
[data-high-contrast][data-theme='dark'] {
  --text: #ffffff;
  --text-2: #f0f0f0;
  --text-3: #dddddd;
  --border: #ffffff;
  --border-strong: #ffffff;
  --card: #000000;
  --bg: #000000;
  --card-2: #0a0a0a;
}

/* Reduced motion */
[data-reduced-motion] *, @media (prefers-reduced-motion: reduce) {
  animation-duration: .01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
  scroll-behavior: auto !important;
}

/* Language typography */
html[lang='ur'] body { font-family: var(--font-urdu), var(--font-ui); line-height: 2; } /* ALL Urdu UI → Noto Nastaliq (needs room) */
html[lang='ur'] .lang-text, html[lang='ur'] .prose { font-family: var(--font-urdu); line-height: 2.1; }
html[lang='ur'] h1, html[lang='ur'] h2, html[lang='ur'] h3,
html[lang='ur'] h4, html[lang='ur'] h5, html[lang='ur'] h6 { line-height: 1.75; } /* Nastaliq descenders must never collide */
/* Global Nastaliq heading caps: no heading anywhere renders oversized in Urdu
   (the more specific .page-head / .card-title / .dash-hero rules below still win) */
html[lang='ur'] h1 { font-size: 1.4rem; }
html[lang='ur'] h2 { font-size: 1.22rem; }
html[lang='ur'] h3 { font-size: 1.06rem; }
html[lang='ur'] h4 { font-size: .97rem; }
html[lang='ur'] h5, html[lang='ur'] h6 { font-size: .9rem; }
/* Nastaliq display headings: measured sizes, never oversized */
html[lang='ur'] .page-head h1 { font-size: clamp(1.2rem, 2.2vw, 1.5rem); }
html[lang='ur'] .dash-hero .greeting { font-size: clamp(1.15rem, 2.4vw, 1.45rem); }
html[lang='ur'] .card-title h2, html[lang='ur'] .card-title h3 { font-size: .95rem; }
/* Urdu text reflows inside cards and chips instead of spilling out */
html[lang='ur'] .badge { white-space: normal; overflow-wrap: anywhere; }
html[lang='ur'] .card, html[lang='ur'] .list-item, html[lang='ur'] .kpi,
html[lang='ur'] .stat, html[lang='ur'] .notif, html[lang='ur'] .alert,
html[lang='ur'] .kv, html[lang='ur'] .hint, html[lang='ur'] .btn,
html[lang='ur'] .day-card, html[lang='ur'] .page-head .sub { overflow-wrap: anywhere; }
html[lang='ur'] .toast { white-space: normal; }
/* Stray Nastaliq glyphs never paint outside a card */
html[lang='ur'] .card, html[lang='ur'] .day-card { overflow: hidden; }
/* Long title + hint share the row, or wrap cleanly instead of pushing out */
html[lang='ur'] .card-title { flex-wrap: wrap; }
/* Bottom nav labels stay inside the fixed-height bar (2 tight lines max) */
html[lang='ur'] .bottom-nav a { font-size: .66rem; line-height: 1.4; }
html[lang='ur'] .bottom-nav a span {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; max-width: 100%; overflow-wrap: anywhere;
}
/* Nastaliq and Arabic are never letter-spaced: tracking breaks the script look */
html[lang='ur'] *, html[lang='ur'] *::before, html[lang='ur'] *::after,
html[lang='ar'] *, html[lang='ar'] *::before, html[lang='ar'] *::after { letter-spacing: 0 !important; }
html[lang='ar'] body { font-family: var(--font-arabic), var(--font-ui); }
html[lang='ar'] .lang-text { font-family: var(--font-arabic); }

.arabic { font-family: var(--font-arabic); direction: rtl; unicode-bidi: embed; }
.quran-text { font-family: var(--font-quran); direction: rtl; text-align: right; line-height: 2.2; }
.urdu { font-family: var(--font-urdu); direction: rtl; line-height: 2.1; }

/* Tagged content — wherever Urdu/Arabic is written, force the right font,
   even when the surrounding UI language is different */
[lang='ur'], [data-lang='ur'], [data-qlang='ur'], option[value='ur'] {
  font-family: var(--font-urdu), var(--font-ui);
}
[lang='ar'], [data-lang='ar'], [data-qlang='ar'], option[value='ar'] {
  font-family: var(--font-arabic); /* Quran Pak (IndoPak) */
}
