/* =========================================================
   مشكاة القرآن — shadcn/ui design tokens (CSS خالص)
   ألوان الهوية مأخوذة من الشعار:
   الذهبي  #BE9069  ≈ hsl(27 40% 58%)
   الرمادي #4B4F5A  ≈ hsl(224 9% 32%)
   ========================================================= */
:root {
  --background: 36 33% 99%;
  --foreground: 224 12% 18%;
  --card: 0 0% 100%;
  --card-foreground: 224 12% 18%;
  --primary: 224 10% 28%;              /* رمادي الشعار */
  --primary-foreground: 36 33% 98%;
  --secondary: 30 30% 95%;
  --secondary-foreground: 224 12% 22%;
  --muted: 30 25% 96%;
  --muted-foreground: 224 6% 46%;
  --accent: 30 35% 94%;
  --accent-foreground: 224 12% 18%;
  --border: 30 18% 89%;
  --input: 30 18% 86%;
  --ring: 27 40% 52%;
  --brand: 27 40% 52%;                 /* ذهبي الشعار (أغمق قليلًا للنص) */
  --brand-soft: 27 45% 92%;
  --radius: 0.75rem;
  --font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --font-quran: "Amiri", "Traditional Arabic", serif;
}

.dark {
  --background: 224 14% 8%;
  --foreground: 30 20% 95%;
  --card: 224 13% 11%;
  --card-foreground: 30 20% 95%;
  --primary: 27 42% 62%;               /* ذهبي في الوضع الداكن */
  --primary-foreground: 224 14% 10%;
  --secondary: 224 10% 17%;
  --secondary-foreground: 30 20% 95%;
  --muted: 224 10% 15%;
  --muted-foreground: 224 6% 65%;
  --accent: 224 10% 17%;
  --accent-foreground: 30 20% 95%;
  --border: 224 10% 18%;
  --input: 224 10% 22%;
  --ring: 27 42% 62%;
  --brand: 27 45% 66%;
  --brand-soft: 27 25% 18%;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; border-color: hsl(var(--border)); }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font);
  background: hsl(var(--background)); color: hsl(var(--foreground));
  line-height: 1.7; -webkit-font-smoothing: antialiased;
  transition: background-color .2s, color .2s;
  overflow-x: hidden;
}
h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 600; }
p { margin: 0 0 1rem; }
a { color: inherit; text-decoration: none; }
svg { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; border-radius: 6px; }

.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 1rem; }
@media (min-width: 640px) { .container { padding-inline: 1.5rem; } }
.muted { color: hsl(var(--muted-foreground)); }
.text-brand { color: hsl(var(--brand)); }
.small { font-size: .875rem; }
.center { text-align: center; }
.skip-link {
  position: absolute; inset-inline-start: 1rem; top: -3rem; z-index: 100;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  padding: .5rem 1rem; border-radius: var(--radius);
}
.skip-link:focus { top: 1rem; }

/* ---------- Button ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  height: 2.5rem; padding: 0 1rem; font: inherit; font-size: .875rem; font-weight: 500;
  white-space: nowrap; border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent; cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s, opacity .15s;
}
.btn:disabled { opacity: .5; pointer-events: none; }
.btn svg { width: 1.1rem; height: 1.1rem; }
.btn-sm { height: 2.25rem; padding: 0 .85rem; }
.btn-lg { height: 2.85rem; padding: 0 1.75rem; font-size: 1rem; }
.btn-icon { width: 2.5rem; padding: 0; }
.btn-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.btn-primary:hover { background: hsl(var(--primary) / .88); }
.btn-outline { background: hsl(var(--background)); border-color: hsl(var(--input)); color: hsl(var(--foreground)); }
.btn-outline:hover, .btn-ghost:hover { background: hsl(var(--accent)); }
.btn-ghost { background: transparent; color: hsl(var(--foreground)); }
.btn-invert { background: #fff; color: hsl(224 12% 18%); }
.btn-invert:hover { opacity: .9; }
.btn-outline-invert { background: transparent; color: #fff; border-color: rgb(255 255 255 / .35); }
.btn-outline-invert:hover { background: rgb(255 255 255 / .1); }

/* ---------- Badge / Card ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .4rem; border-radius: 999px;
  padding: .2rem .75rem; font-size: .78rem; font-weight: 600; border: 1px solid transparent;
}
.badge-brand { background: hsl(var(--brand-soft)); color: hsl(var(--brand)); border-color: hsl(var(--brand) / .25); }
.dot { width: .45rem; height: .45rem; border-radius: 50%; background: hsl(var(--brand)); }
.card {
  background: hsl(var(--card)); color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / .04);
}
.icon-box {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; flex-shrink: 0;
  border-radius: var(--radius); background: hsl(var(--brand-soft)); color: hsl(var(--brand));
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background) / .85);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; height: 4.25rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; }
.logo-tile {
  display: grid; place-items: center; width: 2.9rem; height: 2.9rem; border-radius: var(--radius);
  background: #fff; border: 1px solid hsl(var(--border)); overflow: hidden;
}
.logo-tile img { width: 135%; height: 135%; object-fit: cover; object-position: 50% 32%; max-width: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 1.05rem; }
.brand-text small { font-size: .62rem; letter-spacing: .14em; color: hsl(var(--brand)); font-weight: 600; direction: ltr; text-align: end; }
.main-nav { display: flex; gap: 1.4rem; font-size: .9rem; }
.main-nav a { color: hsl(var(--muted-foreground)); transition: color .15s; }
.main-nav a:hover, .main-nav a.active { color: hsl(var(--foreground)); }
.header-actions { margin-inline-start: auto; display: flex; align-items: center; gap: .4rem; }
.menu-btn { display: none; }
.icon-moon { display: none; }
.dark .icon-sun { display: none; }
.dark .icon-moon { display: block; }

@media (max-width: 960px) {
  .menu-btn { display: inline-flex; }
  .main-nav {
    position: absolute; top: 4.25rem; inset-inline: 0; display: none;
    flex-direction: column; gap: 0; padding: .5rem 1rem 1rem;
    background: hsl(var(--background)); border-bottom: 1px solid hsl(var(--border));
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: .75rem .5rem; border-radius: calc(var(--radius) - 2px); }
  .main-nav a:hover { background: hsl(var(--accent)); }
}
@media (max-width: 520px) { .hide-sm { display: none; } .brand-text small { display: none; } }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; padding: 4rem 0 2rem;
  background: radial-gradient(ellipse 80% 70% at 15% 40%, hsl(var(--brand) / .12), transparent 70%);
}
.hero-pattern {
  position: absolute; inset: 0; pointer-events: none; opacity: .5;
  /* نقش هندسي إسلامي خفيف */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23be9069' stroke-opacity='.22' stroke-width='1'%3E%3Cpath d='M32 4l8 20 20 8-20 8-8 20-8-20-20-8 20-8z'/%3E%3Crect x='20' y='20' width='24' height='24' transform='rotate(45 32 32)'/%3E%3C/g%3E%3C/svg%3E");
  mask-image: linear-gradient(to bottom, #000, transparent 90%);
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 90%);
}
.hero-inner { position: relative; display: grid; gap: 2rem; align-items: center; }
@media (min-width: 900px) { .hero-inner { grid-template-columns: 1.3fr 1fr; min-height: 26rem; } }
.slides { display: grid; }
.slide {
  grid-area: 1 / 1; opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .5s, transform .5s, visibility .5s;
}
.slide.active { opacity: 1; visibility: visible; transform: none; }
.slide .badge { margin-bottom: 1.25rem; }
.lead { font-size: clamp(1rem, 2vw, 1.2rem); color: hsl(var(--muted-foreground)); max-width: 560px; margin: 1rem 0 2rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .75rem; }
.hero-emblem {
  justify-self: center; width: min(320px, 70vw); aspect-ratio: 1; border-radius: 50%;
  background: #fff; border: 1px solid hsl(var(--border)); overflow: hidden;
  box-shadow: 0 30px 60px -30px hsl(var(--brand) / .5), 0 0 0 12px hsl(var(--brand) / .06);
  display: grid; place-items: center;
}
.hero-emblem img { width: 92%; height: 92%; object-fit: contain; }
@media (max-width: 899px) { .hero-emblem { display: none; } }
.slider-controls { position: relative; display: flex; align-items: center; gap: .75rem; margin-top: 2rem; }
.dots { display: flex; gap: .4rem; }
.dots button {
  width: .55rem; height: .55rem; padding: 0; border: 0; border-radius: 999px; cursor: pointer;
  background: hsl(var(--border)); transition: width .25s, background-color .25s;
}
.dots button[aria-selected="true"] { width: 1.6rem; background: hsl(var(--brand)); }

/* ---------- Sections ---------- */
.section { padding: 4.5rem 0; }
.section-tight { padding: 2rem 0; }
.section-muted { background: hsl(var(--muted) / .6); border-block: 1px solid hsl(var(--border)); }
.section-head { max-width: 640px; margin-bottom: 2.25rem; }
.section-head.center { margin-inline: auto; }
.section-head.row { max-width: none; display: flex; align-items: end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.eyebrow { display: inline-block; font-size: .8rem; font-weight: 600; color: hsl(var(--brand)); margin-bottom: .4rem; }

/* Portals */
.portals { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .portals { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .portals { grid-template-columns: repeat(5, 1fr); } }
.portal {
  display: flex; align-items: center; gap: .75rem; padding: 1rem;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.portal:hover { border-color: hsl(var(--brand) / .5); transform: translateY(-2px); box-shadow: 0 10px 24px -14px hsl(var(--brand) / .6); }
.portal .icon-box { width: 2.5rem; height: 2.5rem; }
.portal strong { display: block; font-size: .95rem; }
.portal small { display: block; font-size: .78rem; color: hsl(var(--muted-foreground)); }

/* Features */
.features { display: grid; gap: 1rem; }
@media (min-width: 768px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature { padding: 1.5rem; display: flex; flex-direction: column; gap: .25rem; }
.feature .icon-box { margin-bottom: .75rem; }
.feature p { flex: 1; font-size: .93rem; }
.feature-wide {
  grid-column: 1 / -1; display: grid; gap: 2rem; align-items: center; padding: 2rem;
  background: linear-gradient(135deg, hsl(var(--brand-soft)), hsl(var(--card)) 70%);
}
@media (min-width: 768px) { .feature-wide { grid-template-columns: 1.2fr 1fr; } }
.feature-wide .badge { margin-bottom: .75rem; }
.feature-wide h3 { font-size: 1.4rem; }
.mini-progress { display: grid; gap: 1rem; padding: 1.25rem; border-radius: var(--radius); background: hsl(var(--card)); border: 1px solid hsl(var(--border)); }
.mp-row { display: grid; gap: .35rem; font-size: .85rem; font-weight: 500; }
.progress { height: .5rem; border-radius: 999px; background: hsl(var(--secondary)); overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: inherit; background: hsl(var(--brand)); transition: width 1.2s cubic-bezier(.2,.8,.2,1); }
.in-view .progress-bar { width: var(--v); }
.link-arrow { display: inline-flex; align-items: center; gap: .25rem; font-size: .875rem; font-weight: 600; color: hsl(var(--brand)); }
.link-arrow svg { width: 1rem; height: 1rem; transition: transform .15s; }
.link-arrow:hover svg { transform: translateX(-3px); }

/* Verses */
.verses {
  padding: 4rem 0 0; color: #fff; overflow: hidden;
  background: linear-gradient(160deg, hsl(224 12% 22%), hsl(224 14% 14%));
  position: relative;
}
.verses::before {
  content: ""; position: absolute; inset: 0; opacity: .35; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23be9069' stroke-opacity='.35' stroke-width='1'%3E%3Cpath d='M32 4l8 20 20 8-20 8-8 20-8-20-20-8 20-8z'/%3E%3C/g%3E%3C/svg%3E");
}
.verses .container { position: relative; }
.verses-title { color: hsl(27 45% 70%); font-size: 1.2rem; font-weight: 600; }
.ayah { font-family: var(--font-quran); font-size: clamp(1.5rem, 4vw, 2.4rem); line-height: 2; margin: .5rem auto .25rem; max-width: 900px; }
.ayah-ref { font-size: .85rem; opacity: .65; }
.marquee { position: relative; margin-top: 2.5rem; border-top: 1px solid rgb(255 255 255 / .1); padding: 1.1rem 0; overflow: hidden; direction: ltr; }
.marquee-track { display: flex; gap: 2rem; width: max-content; animation: marquee 40s linear infinite; direction: rtl; }
.marquee-track span { font-size: 1.1rem; white-space: nowrap; color: rgb(255 255 255 / .85); }
.marquee-track span:nth-child(even) { color: hsl(27 45% 65%); }
@keyframes marquee { from { transform: translateX(-50%); } to { transform: translateX(0); } }

/* Halaqat */
.filters { display: flex; gap: .75rem; flex-wrap: wrap; }
.field-inline { display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: hsl(var(--muted-foreground)); }
.field-inline .input { width: auto; min-width: 9rem; }
.halaqat { display: grid; gap: 1rem; }
@media (min-width: 640px) { .halaqat { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .halaqat { grid-template-columns: repeat(3, 1fr); } }
.halaqa { padding: 1.25rem; display: grid; gap: .75rem; }
.halaqa-top { display: flex; justify-content: space-between; align-items: start; gap: .5rem; }
.halaqa h3 { margin: 0; font-size: 1.05rem; }
.halaqa-org { font-size: .85rem; color: hsl(var(--muted-foreground)); }
.halaqa-meta { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; padding: .2rem .6rem;
  border-radius: 999px; background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground));
}
.chip svg { width: .85rem; height: .85rem; }
.seats { font-size: .78rem; font-weight: 600; color: hsl(var(--brand)); white-space: nowrap; }
.empty { padding: 2rem 0; }

/* Stats */
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(5, 1fr); } }
.stats .stat:last-child { grid-column: 1 / -1; }
@media (min-width: 900px) { .stats .stat:last-child { grid-column: auto; } }
.stat { padding: 1.5rem 1rem; text-align: center; display: grid; gap: .25rem; }
.stat-value { font-size: clamp(1.8rem, 3.5vw, 2.4rem); font-weight: 700; color: hsl(var(--brand)); font-variant-numeric: tabular-nums; }
.stat-label { font-size: .85rem; color: hsl(var(--muted-foreground)); }

/* Reviews */
.carousel-nav { display: flex; gap: .5rem; }
.reviews {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 1fr); gap: 1rem;
  overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: .75rem; scrollbar-width: thin;
}
@media (min-width: 900px) { .reviews { grid-auto-columns: calc((100% - 2rem) / 3); } }
.review { scroll-snap-align: start; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.review blockquote { margin: 0; flex: 1; font-size: .95rem; }
.review footer { display: flex; align-items: center; gap: .75rem; line-height: 1.35; }
.avatar {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; flex-shrink: 0;
  background: hsl(var(--brand-soft)); color: hsl(var(--brand)); font-weight: 700;
}
.stars { color: hsl(38 92% 50%); letter-spacing: .1em; font-size: .9rem; }
.stars .off { color: hsl(var(--border)); }
.review-form-wrap { max-width: 720px; margin: 2.5rem auto 0; }
.form { padding: 1.5rem; display: grid; gap: 1rem; }
@media (min-width: 640px) { .form { padding: 2rem; } }
.form h3 { margin-bottom: .2rem; }
.form p { margin: 0; }
.field-row { display: grid; gap: 1rem; }
@media (min-width: 640px) { .field-row { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: .45rem; }
.field label, .field .label { font-size: .875rem; font-weight: 500; }
.input {
  width: 100%; font: inherit; font-size: .925rem; min-height: 2.5rem; padding: .5rem .75rem;
  color: hsl(var(--foreground)); background: hsl(var(--background));
  border: 1px solid hsl(var(--input)); border-radius: calc(var(--radius) - 2px);
  transition: box-shadow .15s, border-color .15s;
}
.input:focus { outline: none; border-color: hsl(var(--ring)); box-shadow: 0 0 0 3px hsl(var(--ring) / .18); }
.input[aria-invalid="true"] { border-color: hsl(0 72% 51%); }
textarea.input { resize: vertical; }
.stars-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: .15rem; }
.stars-input input { position: absolute; opacity: 0; pointer-events: none; }
.stars-input label { font-size: 1.6rem; line-height: 1; cursor: pointer; color: hsl(var(--border)); transition: color .1s; }
/* RTL + row-reverse: النجوم بترتيب ٥..١ في DOM، فالتلوين يشمل المختار وما بعده */
.stars-input input:checked ~ label,
.stars-input label:hover, .stars-input label:hover ~ label { color: hsl(38 92% 50%); }
.stars-input input:focus-visible + label { outline: 2px solid hsl(var(--ring)); border-radius: 4px; }
.form-note { min-height: 1.2rem; }

/* CTA */
.cta-card {
  position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem 2rem;
  padding: 2.5rem; border-radius: calc(var(--radius) + 8px); color: #fff;
  background: linear-gradient(135deg, hsl(27 40% 50%), hsl(27 38% 40%));
}
.cta-card > div:first-of-type { flex: 1; min-width: 240px; position: relative; }
.cta-card h2 { margin-bottom: .25rem; }
.cta-card p { margin: 0; opacity: .9; }
.cta-actions { display: flex; flex-wrap: wrap; gap: .75rem; position: relative; }
.cta-emblem {
  position: absolute; inset-inline-end: -40px; bottom: -60px; width: 240px; opacity: .12;
  mix-blend-mode: luminosity; filter: grayscale(1) brightness(3); pointer-events: none;
}

/* Footer */
.site-footer { border-top: 1px solid hsl(var(--border)); padding-top: 3rem; margin-top: 2.5rem; background: hsl(var(--muted) / .4); }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: repeat(2, 1fr); }
.footer-grid > div:first-child { grid-column: 1 / -1; }
@media (min-width: 900px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } .footer-grid > div:first-child { grid-column: auto; } }
.footer-grid h4 { font-size: .9rem; margin-bottom: .75rem; }
.footer-grid > div > a:not(.brand) { display: block; font-size: .875rem; color: hsl(var(--muted-foreground)); padding: .2rem 0; }
.footer-grid > div > a:not(.brand):hover { color: hsl(var(--brand)); }
.ltr-start { text-align: right; }
.footer-line { display: block; padding: .2rem 0; }
.footer-about { margin-top: .9rem; max-width: 360px; }
.footer-bottom { border-top: 1px solid hsl(var(--border)); margin-top: 2.5rem; padding-block: 1.5rem; }

/* Toast */
.toast {
  position: fixed; bottom: 1.5rem; inset-inline-start: 50%; transform: translate(50%, 150%); z-index: 100;
  max-width: calc(100% - 2rem); padding: .875rem 1.25rem; font-size: .9rem; font-weight: 500;
  background: hsl(var(--card)); color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  box-shadow: 0 10px 30px -10px rgb(0 0 0 / .3); opacity: 0; transition: transform .3s, opacity .3s; pointer-events: none;
}
.toast.show { transform: translate(50%, 0); opacity: 1; }

/* Reveal */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s, transform .6s; }
.reveal.in-view { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
