/* =========================================================
   DeenExplained — design tokens + shadcn/ui-style components
   Plain CSS (no build step). Tailwind utilities come from the
   Play CDN; this file adds tokens, components and Islamic motifs.
   ========================================================= */

:root {
  --background: 40 33% 98%;
  --foreground: 165 30% 10%;
  --card: 0 0% 100%;
  --card-foreground: 165 30% 10%;
  --primary: 162 78% 23%;
  --primary-foreground: 40 33% 98%;
  --secondary: 40 30% 94%;
  --secondary-foreground: 165 30% 14%;
  --muted: 40 22% 94%;
  --muted-foreground: 165 9% 38%;
  --accent: 155 35% 92%;
  --accent-foreground: 162 78% 18%;
  --gold: 40 72% 46%;
  --gold-foreground: 40 33% 98%;
  --border: 40 16% 87%;
  --input: 40 16% 84%;
  --ring: 162 78% 23%;
  --radius: 0.75rem;
  --pattern-color: %230b6b4f;
  --pattern-opacity: 0.07;
}

.dark {
  --background: 165 32% 6%;
  --foreground: 40 25% 92%;
  --card: 165 28% 9%;
  --card-foreground: 40 25% 92%;
  --primary: 154 52% 46%;
  --primary-foreground: 165 32% 6%;
  --secondary: 165 22% 13%;
  --secondary-foreground: 40 25% 92%;
  --muted: 165 20% 13%;
  --muted-foreground: 160 10% 66%;
  --accent: 162 30% 15%;
  --accent-foreground: 154 52% 70%;
  --gold: 42 70% 58%;
  --gold-foreground: 165 32% 6%;
  --border: 165 18% 17%;
  --input: 165 18% 20%;
  --ring: 154 52% 46%;
  --pattern-opacity: 0.06;
}

* { border-color: hsl(var(--border)); }
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-feature-settings: "cv11", "ss01";
  text-rendering: optimizeLegibility;
}
::selection { background: hsl(var(--gold) / 0.3); }
[x-cloak] { display: none !important; }
:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; border-radius: 4px; }

/* ---------- Islamic geometric pattern (8-point star / khatam) ---------- */
.bg-pattern { position: relative; isolation: isolate; }
.bg-pattern::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%230b6b4f' stroke-width='1'%3E%3Crect x='20' y='20' width='40' height='40'/%3E%3Crect x='20' y='20' width='40' height='40' transform='rotate(45 40 40)'/%3E%3Ccircle cx='40' cy='40' r='9'/%3E%3Cpath d='M0 0L11.7 11.7M80 0L68.3 11.7M0 80L11.7 68.3M80 80L68.3 68.3M40 0v11.7M40 80V68.3M0 40h11.7M80 40H68.3'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 80px 80px;
  opacity: var(--pattern-opacity);
  pointer-events: none;
}
.dark .bg-pattern::before { filter: invert(1) hue-rotate(180deg) brightness(1.4); }
.bg-pattern-fade::before {
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 100%);
          mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 100%);
}

/* Ornamental divider */
.ornament {
  display: flex; align-items: center; gap: .75rem;
  color: hsl(var(--gold));
}
.ornament::before, .ornament::after {
  content: ""; height: 1px; flex: 1;
  background: linear-gradient(90deg, transparent, hsl(var(--gold) / .6), transparent);
}

/* Mihrab arch frame */
.arch, .card.arch { border-radius: 999px 999px var(--radius) var(--radius); }
.arch-sm, .card.arch-sm { border-radius: 60px 60px 12px 12px; }

/* Star badge (8-point) */
.star8 {
  position: relative; display: inline-grid; place-items: center;
  width: 3rem; height: 3rem;
}
.star8::before, .star8::after {
  content: ""; position: absolute; inset: 6px;
  background: hsl(var(--accent));
  border: 1px solid hsl(var(--primary) / .15);
  border-radius: 6px;
}
.star8::after { transform: rotate(45deg); }
.star8 > * { position: relative; z-index: 1; color: hsl(var(--primary)); }

/* ---------- shadcn/ui-style components ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  white-space: nowrap; border-radius: calc(var(--radius) - 2px);
  font-size: .875rem; font-weight: 500; line-height: 1;
  height: 2.5rem; padding: 0 1rem;
  transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s, transform .15s;
  cursor: pointer; user-select: none; border: 1px solid transparent;
}
.btn:disabled { opacity: .5; pointer-events: none; }
.btn:active { transform: translateY(1px); }
.btn-lg { height: 2.875rem; padding: 0 1.5rem; font-size: .95rem; }
.btn-sm { height: 2.125rem; padding: 0 .75rem; font-size: .8125rem; }
.btn-icon { height: 2.5rem; width: 2.5rem; padding: 0; }
.btn-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); box-shadow: 0 1px 2px hsl(var(--primary) / .25); }
.btn-primary:hover { background: hsl(var(--primary) / .9); }
.btn-gold { background: hsl(var(--gold)); color: hsl(var(--gold-foreground)); }
.btn-gold:hover { background: hsl(var(--gold) / .9); }
.btn-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.btn-secondary:hover { background: hsl(var(--secondary) / .8); }
.btn-outline { background: hsl(var(--background)); border-color: hsl(var(--input)); color: hsl(var(--foreground)); }
.btn-outline:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.btn-ghost { background: transparent; color: hsl(var(--foreground)); }
.btn-ghost:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }

.card {
  background: hsl(var(--card)); color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgb(0 0 0 / .04);
}
.card-hover { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.card-hover:hover {
  transform: translateY(-3px);
  border-color: hsl(var(--primary) / .35);
  box-shadow: 0 12px 30px -12px hsl(var(--primary) / .25);
}

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  border-radius: 999px; padding: .2rem .65rem;
  font-size: .75rem; font-weight: 600; line-height: 1.2;
  border: 1px solid transparent;
}
.badge-default { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.badge-secondary { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.badge-outline { border-color: hsl(var(--border)); color: hsl(var(--foreground)); }
.badge-gold { background: hsl(var(--gold) / .14); color: hsl(var(--gold)); border-color: hsl(var(--gold) / .3); }

.input, .textarea, .select {
  display: flex; width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  padding: .5rem .75rem; font-size: .875rem;
  color: hsl(var(--foreground));
  transition: border-color .15s, box-shadow .15s;
}
.input, .select { height: 2.5rem; }
.textarea { min-height: 8rem; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: hsl(var(--muted-foreground)); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / .18);
}
.label { font-size: .875rem; font-weight: 500; line-height: 1; }

.separator { height: 1px; width: 100%; background: hsl(var(--border)); }

/* Accordion */
.accordion-item { border-bottom: 1px solid hsl(var(--border)); }
.accordion-trigger {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 0; text-align: left; font-weight: 500;
}
.accordion-trigger:hover { text-decoration: underline; text-underline-offset: 4px; }
.accordion-trigger .chev { transition: transform .2s; color: hsl(var(--muted-foreground)); }
.accordion-trigger[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* Header */
.site-header {
  background: hsl(var(--background) / .8);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
          backdrop-filter: saturate(180%) blur(12px);
}
.nav-link {
  font-size: .875rem; font-weight: 500; color: hsl(var(--muted-foreground));
  padding: .5rem .75rem; border-radius: calc(var(--radius) - 4px);
  transition: color .15s, background-color .15s;
}
.nav-link:hover { color: hsl(var(--foreground)); background: hsl(var(--accent)); }
.nav-link[aria-current="page"] { color: hsl(var(--primary)); }

/* Sheet (mobile menu) */
.sheet-overlay { background: rgb(0 0 0 / .45); }
.sheet-panel { background: hsl(var(--background)); border-left: 1px solid hsl(var(--border)); }

/* Arabic text */
.arabic {
  font-family: Amiri, "Traditional Arabic", serif;
  direction: rtl; line-height: 2.1;
}

/* Quran / hadith callout */
.callout {
  position: relative; border-radius: var(--radius);
  border: 1px solid hsl(var(--gold) / .35);
  background: linear-gradient(180deg, hsl(var(--gold) / .07), hsl(var(--gold) / .02));
  padding: 1.5rem 1.5rem 1.25rem;
}
.callout .arabic { font-size: 1.65rem; color: hsl(var(--foreground)); }
.callout cite { display: block; margin-top: .5rem; font-style: normal; font-size: .8rem; font-weight: 600; color: hsl(var(--gold)); letter-spacing: .02em; }

/* Table of contents */
.toc a { display: block; padding: .3rem 0 .3rem .85rem; border-left: 2px solid hsl(var(--border)); font-size: .875rem; color: hsl(var(--muted-foreground)); transition: color .15s, border-color .15s; }
.toc a:hover, .toc a.active { color: hsl(var(--primary)); border-color: hsl(var(--primary)); }

/* Steps */
.step-num {
  flex: none; display: grid; place-items: center;
  width: 2rem; height: 2rem; border-radius: 999px;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  font-weight: 700; font-size: .85rem;
}

/* ---------- Google AdSense slots ----------
   Reserved min-height prevents layout shift (CLS) — a Core Web Vitals
   factor that affects both SEO and ad revenue. */
.ad-slot {
  position: relative; margin: 2rem auto; width: 100%;
  text-align: center; min-height: 100px;
}
.ad-slot .ad-label {
  display: block; margin-bottom: .35rem;
  font-size: .65rem; letter-spacing: .14em; text-transform: uppercase;
  color: hsl(var(--muted-foreground) / .8);
}
.ad-slot.ad-leaderboard { min-height: 120px; max-width: 970px; }
.ad-slot.ad-inarticle { min-height: 250px; }
.ad-slot.ad-sidebar { min-height: 600px; margin: 0; }
.ad-slot .adsbygoogle { display: block; }
/* Placeholder shown until AdSense is configured */
.ad-slot.ad-placeholder .adsbygoogle {
  min-height: inherit; height: 100%;
  border: 1px dashed hsl(var(--border)); border-radius: var(--radius);
  background: repeating-linear-gradient(45deg, hsl(var(--muted) / .5) 0 10px, transparent 10px 20px);
}
.ad-slot.ad-leaderboard.ad-placeholder .adsbygoogle { min-height: 100px; }
.ad-slot.ad-inarticle.ad-placeholder .adsbygoogle { min-height: 230px; }
.ad-slot.ad-sidebar.ad-placeholder .adsbygoogle { min-height: 580px; }

/* ---------- Daily quiz ---------- */
.quiz-option {
  display: flex; width: 100%; align-items: center; gap: .9rem; text-align: left;
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  background: hsl(var(--card)); padding: .9rem 1rem; font-weight: 500;
  transition: border-color .15s, background-color .15s, transform .15s, opacity .15s;
}
.quiz-option .quiz-letter {
  flex: none; display: grid; place-items: center; width: 2rem; height: 2rem;
  border-radius: 999px; border: 1px solid hsl(var(--border));
  font-size: .8rem; font-weight: 700; color: hsl(var(--muted-foreground));
  transition: all .15s;
}
.quiz-option .quiz-mark { margin-left: auto; flex: none; }
.quiz-option-idle { cursor: pointer; }
.quiz-option-idle:hover { border-color: hsl(var(--primary) / .5); background: hsl(var(--accent) / .6); transform: translateX(2px); }
.quiz-option-idle:hover .quiz-letter { border-color: hsl(var(--primary)); color: hsl(var(--primary)); }
.quiz-option-correct { border-color: hsl(152 60% 38%); background: hsl(152 60% 38% / .1); cursor: default; }
.quiz-option-correct .quiz-letter { background: hsl(152 60% 38%); border-color: hsl(152 60% 38%); color: #fff; }
.quiz-option-wrong { border-color: hsl(0 70% 52%); background: hsl(0 70% 52% / .08); cursor: default; }
.quiz-option-wrong .quiz-letter { background: hsl(0 70% 52%); border-color: hsl(0 70% 52%); color: #fff; }
.quiz-option-dim { opacity: .55; cursor: default; }
.quiz-dot { width: .6rem; height: .6rem; border-radius: 999px; background: hsl(var(--border)); transition: all .2s; }
.quiz-dot.is-current { background: hsl(var(--gold)); transform: scale(1.35); }
.quiz-dot.is-right { background: hsl(152 60% 38%); }
.quiz-dot.is-wrong { background: hsl(0 70% 52%); }
@keyframes quiz-pop { 0% { transform: scale(.96); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.quiz-pop { animation: quiz-pop .25s ease-out; }

/* Cookie banner */
.cookie-banner { box-shadow: 0 20px 50px -12px rgb(0 0 0 / .3); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Print */
@media print {
  .site-header, footer, .ad-slot, .cookie-banner, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
}
