/* الحديقة القرآنية - shared styles. Each plant page sets --primary, --accent and --bg. */
:root {
  --primary: #2f5d3a;
  --accent: #c9a227;
  --bg: #f7f3e8;
  --ink: #1f2a22;
  --muted: #5f6b62;
  --card: #fffdf8;
  --line: color-mix(in srgb, var(--primary) 14%, transparent);
  --radius: 22px;
  --shadow: 0 1px 2px rgba(31, 42, 34, 0.04), 0 8px 28px rgba(31, 42, 34, 0.08);
  --font-ar: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  --font-en: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --font-quran: 'Amiri Quran', 'Amiri', 'Traditional Arabic', serif;
  --font-naskh: 'Amiri', 'Traditional Arabic', serif;
}

/* ---------- language switching ---------- */
html[data-lang='ar'] body [lang='en'] { display: none !important; }
html[data-lang='en'] body [lang='ar']:not(.arabic-text) { display: none !important; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-ar);
  font-size: 1.125rem;
  line-height: 1.85;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 50% -200px, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  background-color: var(--bg);
}
html[data-lang='en'] body { font-family: var(--font-en); line-height: 1.7; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 0.5em; }
.icon { width: 1.4em; height: 1.4em; display: block; }

.skip { position: absolute; inset-inline-start: -999px; }
.skip:focus { inset-inline-start: 1rem; top: 1rem; background: #fff; padding: 0.5rem 1rem; z-index: 10; }

/* ---------- header and footer ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.55rem max(1rem, calc((100% - 960px) / 2));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 800; text-decoration: none; color: var(--primary); font-size: 1.15rem; }
.lang-switch {
  font: inherit; font-weight: 700; font-size: 0.95rem; cursor: pointer;
  padding: 0.3rem 1.05rem; border-radius: 999px;
  border: 2px solid var(--primary); background: transparent; color: var(--primary);
  transition: background 0.15s, color 0.15s;
}
.lang-switch:hover, .lang-switch:focus-visible { background: var(--primary); color: #fff; }
.lang-switch span[lang='en'] { font-family: var(--font-ar); }
.lang-switch span[lang='ar'] { font-family: var(--font-en); }

.footer { margin-top: 3rem; background: color-mix(in srgb, var(--primary) 92%, black); color: #f3efe2; }
.footer-inner { max-width: 960px; margin: 0 auto; padding: 2rem 1.25rem 2.5rem; text-align: center; font-size: 0.95rem; }
.footer p { margin: 0.3rem 0; }
.footer-name { font-weight: 800; font-size: 1.2rem; }
.footer .small { opacity: 0.8; }
.small { font-size: 0.85rem; }

main { max-width: 960px; margin: 0 auto; padding: 0 1rem; }
.center-title { text-align: center; color: var(--primary); font-size: clamp(1.5rem, 5vw, 2rem); margin-top: 2.5rem; }
.center-title::after {
  content: ''; display: block; width: 64px; height: 4px; border-radius: 4px; margin: 0.6rem auto 0;
  background: var(--accent);
}

/* ---------- home ---------- */
.home-hero { position: relative; margin-top: 1rem; }
.home-hero-art img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }
.home-hero-text {
  position: relative; margin: -3.5rem 1rem 0; padding: 1.4rem 1.25rem 1.2rem; text-align: center;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
}
.home-hero:not(:has(img)) .home-hero-text { margin-top: 2rem; }
.home-hero h1 { font-size: clamp(2.1rem, 8vw, 3.4rem); color: var(--primary); margin: 0; font-weight: 800; }
.tagline { font-size: clamp(1.05rem, 3.6vw, 1.3rem); font-weight: 700; margin: 0.4rem 0 0; color: var(--ink); }

.home-verse { text-align: center; margin: 2rem auto 0; max-width: 720px; }
.home-verse .quran { font-size: clamp(1.8rem, 6vw, 2.3rem); }
.home-verse-text { color: var(--muted); }

.cards {
  list-style: none; margin: 1.25rem 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.9rem;
}
@media (min-width: 720px) { .cards { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; } }
.card {
  display: flex; flex-direction: column; height: 100%; text-decoration: none; color: var(--ink);
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover, .card:focus-visible { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(31, 42, 34, 0.16); }
.card-art { aspect-ratio: 3 / 2; background: var(--bg); overflow: hidden; }
.card-art img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.card:hover .card-art img { transform: scale(1.05); }
.card-body { padding: 0.7rem 0.8rem 0.95rem; text-align: center; border-top: 4px solid var(--primary); flex: 1; }
.card-body h3 { margin: 0; color: var(--primary); font-size: 1.35rem; }
.sci { font-style: italic; color: var(--muted); font-size: 0.85rem; margin: 0; }
.badge {
  display: inline-block; margin: 0.45rem 0 0; padding: 0.1rem 0.7rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 700; line-height: 1.7;
  background: color-mix(in srgb, var(--accent) 24%, white); color: var(--primary);
}

.steps { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: 0.9rem; }
.steps { max-width: 420px; margin-inline: auto; }
.steps li {
  position: relative; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.1rem 1.1rem 0.9rem; text-align: center;
}
.step-icon {
  display: inline-grid; place-items: center; width: 3.2rem; height: 3.2rem; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 22%, white); color: var(--primary); font-size: 1.2rem;
}
.steps h3 { margin: 0.5rem 0 0.2rem; color: var(--primary); }
.steps p { margin: 0; color: var(--muted); font-size: 1rem; }
.intro { color: var(--muted); max-width: 680px; margin: 1.25rem auto 0; text-align: center; }

/* ---------- plant page ---------- */
.plant-hero { margin-top: 1rem; }
.plant-hero-art img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }
.plant-hero-card {
  position: relative; margin: -3rem 0.75rem 0; padding: 1.2rem 1.25rem 0.6rem; text-align: center;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border-top: 5px solid var(--primary);
}
.plant-hero:not(:has(img)) .plant-hero-card { margin-top: 1.5rem; }
@media (min-width: 720px) {
  .plant-hero-art { max-width: 760px; margin: 0 auto; }
  .plant-hero-card { max-width: 700px; margin-inline: auto; }
}
.plant-hero .badge { margin: 0 0 0.3rem; }
.plant-hero h1 { font-size: clamp(2.4rem, 9vw, 3.6rem); color: var(--primary); margin: 0; font-weight: 800; }
.plant-hero .sci { font-style: normal; }
.plant-hero .sci i { unicode-bidi: isolate; }
.summary { max-width: 680px; margin: 0.4rem auto 0; }

.toc { position: sticky; top: 3.4rem; z-index: 4; margin: 1rem -1rem 0; padding: 0.5rem 1rem; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.toc ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 0.45rem; overflow-x: auto; scrollbar-width: none; }
.toc ul::-webkit-scrollbar { display: none; }
@media (min-width: 720px) { .toc ul { flex-wrap: wrap; justify-content: center; } }
.toc a {
  display: inline-block; white-space: nowrap; padding: 0.25rem 0.9rem; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: 0.92rem;
  background: var(--card); color: var(--primary); border: 1px solid var(--line);
}
.toc a:hover { background: var(--primary); color: #fff; }

.block {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.25rem 1.25rem 0.75rem; margin: 1.1rem 0; scroll-margin-top: 7rem;
}
.section-title { display: flex; align-items: center; gap: 0.6rem; color: var(--primary); font-size: 1.45rem; }
.section-icon {
  display: inline-grid; place-items: center; flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 22%, white); font-size: 0.9rem;
}
.soon { color: var(--muted); font-style: italic; }

.text-card {
  border: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 55%, white);
  border-radius: 16px; padding: 1rem 1.1rem 0.4rem; margin: 1rem 0;
}
.arabic-text { font-size: 1.35rem; line-height: 2.1; margin: 0 0 0.5rem; text-align: right; }
.quran {
  font-family: var(--font-quran); font-size: 1.7rem; line-height: 2.4; color: var(--primary); text-align: center;
  padding: 0.6rem 0.4rem; margin: 0 0 0.25rem;
}
.verse .quran { border-bottom: 1px dashed var(--line); }
.hadith-text { font-family: var(--font-naskh); font-size: 1.35rem; line-height: 2.1; color: var(--ink); }
.narrator { font-weight: 700; color: var(--primary); margin: 0 0 0.25rem; }
.translation { font-family: var(--font-en); font-style: italic; color: var(--muted); line-height: 1.6; }
html[data-lang='ar'] .translation { display: none; }
.ref { font-size: 0.92rem; color: var(--muted); margin: 0.25rem 0 0.5rem; }
.verse .ref, .home-verse .ref { text-align: center; }
.grade { color: var(--primary); font-weight: 700; }
.excerpt { color: var(--muted); font-size: 0.85rem; }
details { margin: 0.5rem 0; }
summary { cursor: pointer; font-weight: 700; color: var(--primary); }
.info ul, .text-card ul { padding-inline-start: 1.25rem; }
.info li { margin-bottom: 0.3rem; }
.note {
  background: color-mix(in srgb, var(--accent) 14%, white);
  border-radius: 12px; padding: 0.55rem 1rem; margin: 0.75rem 0;
}
.note p { margin: 0.25rem 0; }
.refs ul { padding-inline-start: 1.25rem; font-size: 0.95rem; color: var(--muted); }

.pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.6rem; align-items: stretch; margin: 2rem 0 0; }
.pager a {
  text-decoration: none; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); font-weight: 700; color: var(--primary);
}
.pager-link { display: flex; align-items: center; gap: 0.55rem; padding: 0.45rem; }
.pager-link[rel='next'] { flex-direction: row-reverse; text-align: end; }
.pager-thumb { flex: none; width: 3.2rem; height: 3.2rem; border-radius: 12px; overflow: hidden; background: var(--bg); }
.pager-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pager-text { display: flex; flex-direction: column; line-height: 1.4; }
.pager small { color: var(--muted); font-weight: 400; font-size: 0.8rem; }
.pager-home { display: grid; place-items: center; padding: 0 0.9rem; }
@media (max-width: 420px) { .pager-thumb { display: none; } }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .pager, .toc, .lang-switch, .footer { display: none; }
  .block { box-shadow: none; border: 1px solid #ddd; }
  body { background: #fff; }
}

/* ---------- recitation player ---------- */
.listen { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.4rem 0.75rem; margin: 0.1rem 0 0.35rem; }
.play-btn {
  display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 0.95rem; line-height: 1;
  padding: 0.4rem 1rem 0.4rem 0.45rem; border-radius: 999px;
  border: 0; background: var(--primary); color: #fff;
  box-shadow: 0 3px 10px color-mix(in srgb, var(--primary) 35%, transparent);
  transition: transform 0.12s ease, filter 0.12s ease;
}
html[dir='rtl'] .play-btn { padding: 0.4rem 0.45rem 0.4rem 1rem; }
.play-btn:hover { filter: brightness(1.1); }
.play-btn:active { transform: scale(0.96); }
.play-icon { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: rgba(255, 255, 255, 0.22); }
.play-icon .icon { width: 1.05rem; height: 1.05rem; }
.play-btn .i-pause, .play-btn .pause-label { display: none; }
.play-btn.is-playing .i-pause, .play-btn.is-playing .pause-label { display: inline; }
.play-btn.is-playing .i-play, .play-btn.is-playing .play-label { display: none; }
.play-btn.is-playing .play-icon { animation: pulse 1.4s ease-in-out infinite; }
.play-btn.is-loading { opacity: 0.75; }
.reciter { font-size: 0.8rem; color: var(--muted); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.18); } }
