/* =========================================================================
   BilalAdhan — Design Tokens & Base Styles
   ========================================================================= */

:root {
  /* Palette (strict brief) */
  --c-bg:        #EEEEEE;
  --c-mint:      #6FCF97;
  --c-teal:      #2FA084;
  --c-forest:    #1F6F5F;

  /* Derived, harmonized in oklch */
  --c-paper:     #F6F5F0;          /* warmer manuscript paper */
  --c-ink:       #14342B;          /* deepest text */
  --c-ink-2:     #2B4A40;          /* secondary text */
  --c-ink-mute:  #5E7670;          /* tertiary */
  --c-line:      rgba(31,111,95,.16);
  --c-line-soft: rgba(31,111,95,.08);
  --c-gold:      #B89860;          /* warm metallic accent for ornament */
  --c-gold-soft: #E6D9B8;

  /* Surfaces */
  --s-surface:   #FBFAF5;
  --s-card:      #FFFFFF;
  --s-elev:      #FFFFFF;
  --s-overlay:   rgba(20, 52, 43, .55);

  /* Shadows */
  --sh-1: 0 1px 2px rgba(20,52,43,.04), 0 4px 14px rgba(20,52,43,.06);
  --sh-2: 0 2px 6px rgba(20,52,43,.06), 0 14px 40px rgba(20,52,43,.10);
  --sh-3: 0 4px 12px rgba(20,52,43,.08), 0 28px 64px rgba(20,52,43,.16);
  --sh-inset: inset 0 0 0 1px rgba(31,111,95,.12);

  /* Radii */
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-arch: 9999px 9999px 24px 24px / 480px 480px 24px 24px;

  /* Type */
  --f-display: "Cormorant Garamond", "Cormorant", "EB Garamond", Georgia, serif;
  --f-arabic:  "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif;
  --f-ui:      "Inter", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --f-mono:    "IBM Plex Mono", ui-monospace, Menlo, monospace;

  /* Motion */
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

[data-theme="dark"] {
  --c-bg:        #0E1A17;
  --c-paper:     #122520;
  --c-ink:       #F1EFE5;
  --c-ink-2:     #C9D6CF;
  --c-ink-mute:  #8AA39B;
  --c-line:      rgba(111,207,151,.18);
  --c-line-soft: rgba(111,207,151,.08);

  --s-surface:   #0E1A17;
  --s-card:      #16302A;
  --s-elev:      #1B3B33;
  --s-overlay:   rgba(0, 0, 0, .60);

  --c-mint:      #7FD6A4;
  --c-teal:      #3DB89A;
  --c-forest:    #B5E8D0;          /* used for headings on dark */

  --sh-1: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
  --sh-2: 0 2px 6px rgba(0,0,0,.4), 0 14px 40px rgba(0,0,0,.45);
  --sh-3: 0 4px 12px rgba(0,0,0,.45), 0 28px 64px rgba(0,0,0,.6);
  --sh-inset: inset 0 0 0 1px rgba(111,207,151,.18);
}

/* ====== Reset / base ====== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  background: var(--s-surface);
  color: var(--c-ink);
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "ss01", "ss02", "kern";
  transition: background-color .3s var(--ease), color .3s var(--ease);
}

[lang="ar"] body, [dir="rtl"] body { font-family: var(--f-arabic); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img, svg { display: block; }
::selection { background: var(--c-mint); color: var(--c-ink); }

/* ====== Type scale ====== */
.h-display  { font-family: var(--f-display); font-weight: 500; letter-spacing: -.01em; line-height: 1.02; font-size: clamp(48px, 7vw, 96px); }
.h-1        { font-family: var(--f-display); font-weight: 500; letter-spacing: -.005em; line-height: 1.05; font-size: clamp(40px, 5vw, 64px); }
.h-2        { font-family: var(--f-display); font-weight: 500; line-height: 1.1;  font-size: clamp(30px, 3.4vw, 44px); }
.h-3        { font-family: var(--f-display); font-weight: 500; line-height: 1.15; font-size: clamp(22px, 2.4vw, 30px); }
.eyebrow    { font-family: var(--f-ui); font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--c-teal); }
.lede       { font-family: var(--f-display); font-weight: 400; font-size: clamp(18px, 1.6vw, 22px); line-height: 1.55; color: var(--c-ink-2); font-style: italic; }
.mono       { font-family: var(--f-mono); font-size: 11px; letter-spacing: .04em; }

[dir="rtl"] .h-display,
[dir="rtl"] .h-1,
[dir="rtl"] .h-2,
[dir="rtl"] .h-3,
[dir="rtl"] .lede { font-family: var(--f-arabic); font-weight: 400; line-height: 1.4; }

.arabic { font-family: var(--f-arabic); font-weight: 400; line-height: 1.5; }

/* ====== Layout ====== */
.container { width: 100%; max-width: 1280px; margin-inline: auto; padding-inline: clamp(20px, 5vw, 64px); }
.container-narrow { max-width: 880px; margin-inline: auto; padding-inline: clamp(20px, 5vw, 64px); }
.section { padding-block: clamp(64px, 9vw, 132px); position: relative; }

/* ====== Buttons ====== */
.btn { 
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-radius: 9999px; 
  font-family: var(--f-ui); font-size: 14px; font-weight: 500; letter-spacing: .02em;
  border: 1px solid transparent;
  transition: all .25s var(--ease);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--c-forest) 0%, var(--c-teal) 100%);
  color: #FBFAF5;
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 8px 24px rgba(31,111,95,.28);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 14px 32px rgba(31,111,95,.36); }
.btn-ghost {
  background: transparent; color: var(--c-ink);
  border-color: var(--c-line);
}
.btn-ghost:hover { background: var(--c-line-soft); border-color: var(--c-teal); }
.btn-gold {
  background: linear-gradient(135deg, #C9A968 0%, #B89860 100%);
  color: #2B1F0A;
}
.btn-sm { padding: 10px 16px; font-size: 13px; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; gap: 0;
  border-radius: 9999px; border: 1px solid var(--c-line);
  background: var(--s-card); color: var(--c-ink);
  font-family: var(--f-ui); font-size: 14px; line-height: 1;
  cursor: pointer;
  transition: all .25s var(--ease);
}
.btn-icon > svg { display: block; }
.btn-icon:hover { border-color: var(--c-teal); color: var(--c-teal); }

/* ====== Cards ====== */
.card {
  background: var(--s-card);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  transition: all .3s var(--ease);
}
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--sh-2); border-color: rgba(47,160,132,.45); }

/* ====== Ornamental rules & divider ====== */
.rule {
  display: flex; align-items: center; gap: 16px;
  color: var(--c-teal); opacity: .85;
}
.rule::before, .rule::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(to right, transparent, var(--c-line) 30%, var(--c-line) 70%, transparent);
}
.rule .rule-glyph { width: 22px; height: 22px; color: var(--c-teal); }

/* ====== Form ====== */
.input, .textarea, .select {
  width: 100%; 
  padding: 14px 16px;
  background: var(--s-card); 
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  font-family: var(--f-ui); font-size: 14px;
  color: var(--c-ink);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--c-teal); box-shadow: 0 0 0 4px rgba(47,160,132,.14); }
.label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--c-ink-mute); margin-bottom: 8px; }

/* ====== Pill / badge ====== */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 9999px;
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  background: rgba(111,207,151,.16); color: var(--c-forest);
  border: 1px solid rgba(47,160,132,.25);
}
[data-theme="dark"] .pill { background: rgba(111,207,151,.12); color: var(--c-mint); }
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c-teal); display: inline-block; }
.pill-gold { background: rgba(184,152,96,.16); color: #8a6c2f; border-color: rgba(184,152,96,.4); }
[data-theme="dark"] .pill-gold { color: #D9B770; }

/* ====== Patterns / Decorative ====== */
.bg-paper {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(111,207,151,.18), transparent 60%),
    radial-gradient(800px 400px at 90% 10%, rgba(47,160,132,.10), transparent 70%),
    var(--s-surface);
}
[data-theme="dark"] .bg-paper {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(47,160,132,.22), transparent 60%),
    radial-gradient(800px 400px at 10% 30%, rgba(31,111,95,.18), transparent 70%),
    var(--s-surface);
}
.bg-tinted { background: linear-gradient(180deg, var(--s-surface) 0%, color-mix(in oklch, var(--c-mint) 10%, var(--s-surface)) 100%); }

/* ====== Mihrab arch (used for hero, cards) ====== */
.mihrab {
  border-radius: 50% 50% 8px 8px / 70% 70% 8px 8px;
}

/* ====== Utility ====== */
.muted { color: var(--c-ink-mute); }
.center { text-align: center; }
.stack > * + * { margin-top: var(--gap, 16px); }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; }
.sr-only { position:absolute; width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0; }

/* ====== App scaffold ====== */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

/* ====== Page transitions ====== */
.page-enter { animation: pageEnter .55s var(--ease-out) both; }
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ====== Decorative pattern background ====== */
.pattern-bg::before {
  content: ""; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'><g fill='none' stroke='%231F6F5F' stroke-width='.6' stroke-opacity='.18'><path d='M40 4l36 36-36 36L4 40z'/><path d='M40 16l24 24-24 24-24-24z'/><circle cx='40' cy='40' r='6'/></g></svg>");
  background-size: 80px 80px;
  opacity: .35; pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
}
[data-theme="dark"] .pattern-bg::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'><g fill='none' stroke='%236FCF97' stroke-width='.6' stroke-opacity='.22'><path d='M40 4l36 36-36 36L4 40z'/><path d='M40 16l24 24-24 24-24-24z'/><circle cx='40' cy='40' r='6'/></g></svg>");
}

/* ====== Scrollbar (subtle) ====== */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-line); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--c-teal); background-clip: padding-box; border: 3px solid transparent; }

/* ====== Range / sliders ====== */
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%;
  height: 4px; background: var(--c-line); border-radius: 999px; outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--c-teal); cursor: pointer; border: 2px solid var(--s-card);
  box-shadow: 0 2px 6px rgba(31,111,95,.4);
}

/* ====== Page-specific helpers ====== */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

/* RTL adjustments */
[dir="rtl"] .row { flex-direction: row-reverse; }
[dir="rtl"] .btn { flex-direction: row-reverse; }

/* Hero arch wrapper */
.arch-clip {
  clip-path: path("M 0 480 L 0 200 C 0 90 90 0 200 0 L 220 0 C 330 0 420 90 420 200 L 420 480 Z");
}
