/* Tafsir site — light, calm, book-like. Dark green + gold accents. RTL. */
:root {
  --green: #14532d;
  --green-deep: #0b3d20;
  --green-soft: #e8f3ec;
  --gold: #b8860b;
  --gold-soft: #f7f0d8;
  --ink: #1f2937;
  --muted: #6b7280;
  --bg: #fdfcf8;
  --card: #ffffff;
  --border: #e5e0d0;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Cairo", "Segoe UI", Tahoma, sans-serif;
  font-size: 18px; line-height: 1.9;
}
a { color: var(--green); }
h1, h2, h3 { color: var(--green-deep); line-height: 1.5; margin: 0 0 .5em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; margin-top: 1.6em; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
.container { max-width: 880px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { background: var(--green-deep); color: #fff; padding: 14px 0; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-weight: 800; font-size: 1.25rem; }
.brand small { display: block; font-size: .8rem; font-weight: 400; color: #d4e8d9; }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a { color: #e8f3ec; text-decoration: none; padding: 6px 12px; border-radius: 8px; font-size: 1rem; }
.main-nav a:hover, .main-nav a.active { background: rgba(255,255,255,.14); color: #fff; }

/* Hero */
.hero { background: linear-gradient(180deg, var(--green-deep), var(--green)); color: #fff; padding: 48px 0 40px; text-align: center; }
.hero h1 { color: #fff; font-size: 2.2rem; margin-bottom: .3em; }
.hero p { color: #d4e8d9; max-width: 640px; margin: 0 auto 1.2em; }
.hero .btn { margin: 4px; }
.hero-img { width: 100%; max-height: 280px; object-fit: cover; border-radius: var(--radius); margin-bottom: 20px; border: 3px solid rgba(255,255,255,.25); }

/* Buttons */
.btn { display: inline-block; background: var(--gold); color: #fff; text-decoration: none; font-weight: 700; padding: 10px 26px; border-radius: 999px; border: none; cursor: pointer; font-size: 1.05rem; font-family: inherit; }
.btn:hover { background: #9a7209; }
.btn--ghost { background: transparent; border: 2px solid #fff; }
.btn--ghost:hover { background: rgba(255,255,255,.12); }
.btn--green { background: var(--green); }
.btn--green:hover { background: var(--green-deep); }

/* Cards / content */
.page { padding: 36px 0 56px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin: 18px 0; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.lead { font-size: 1.15rem; color: #374151; }
.figure-img { width: 100%; border-radius: var(--radius); margin: 10px 0; border: 1px solid var(--border); }
.source-note { background: var(--gold-soft); border-right: 4px solid var(--gold); border-radius: 8px; padding: 12px 16px; font-size: .95rem; margin: 20px 0; }
.faq-item { margin-bottom: 8px; }
.faq-item summary { cursor: pointer; font-weight: 700; color: var(--green-deep); padding: 10px 0; }
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps li { counter-increment: step; position: relative; padding: 0 52px 18px 0; }
.steps li::before { content: counter(step); position: absolute; right: 0; top: 0; width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }

/* Surah browser */
.search-box { width: 100%; padding: 12px 16px; font-size: 1.05rem; font-family: inherit; border: 2px solid var(--border); border-radius: 999px; margin: 16px 0; background: #fff; }
.search-box:focus { outline: none; border-color: var(--green); }
.surah-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 12px 0 30px; }
.surah-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.surah-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); border-color: var(--green); }
.surah-card .num { font-size: .85rem; color: var(--muted); }
.surah-card .ar-name { font-family: "Amiri", serif; font-size: 1.5rem; color: var(--green-deep); line-height: 1.6; }
.surah-card .meta { font-size: .82rem; color: var(--muted); }
.ayah-block { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 16px 0; }
.ayah-text { font-family: "Amiri", serif; font-size: 1.7rem; line-height: 2.1; color: var(--green-deep); text-align: center; margin-bottom: 12px; }
.ayah-num { display: inline-block; background: var(--green-soft); color: var(--green-deep); border-radius: 999px; padding: 0 12px; font-size: .9rem; font-weight: 700; margin-bottom: 8px; }
.tafsir-text { font-size: 1.05rem; line-height: 2; }
.tafsir-label { font-size: .85rem; font-weight: 700; color: var(--gold); margin-bottom: 4px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 16px 0; }
.toolbar select { padding: 10px 14px; font-size: 1rem; font-family: inherit; border: 2px solid var(--border); border-radius: 10px; background: #fff; }
.status { text-align: center; color: var(--muted); padding: 30px 0; }
.error-box { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: var(--radius); padding: 18px; margin: 18px 0; }
.back-link { display: inline-block; margin-bottom: 10px; }

/* Footer */
.site-footer { background: var(--green-deep); color: #cbd5e1; padding: 28px 0; margin-top: 20px; }
.site-footer .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.site-footer a { color: #e8f3ec; }
.site-footer .credit { font-size: .9rem; color: #94a3b8; }
.site-footer .credit a { color: #cbd5e1; text-decoration: none; }
.site-footer nav { display: flex; gap: 14px; flex-wrap: wrap; }
.site-footer nav a { text-decoration: none; font-size: .95rem; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  h1 { font-size: 1.7rem; }
  .hero h1 { font-size: 1.8rem; }
  .ayah-text { font-size: 1.45rem; }
  .surah-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* Mobile header: compact bar + hamburger (never eat half the mobile screen; scrolls away) */
.nav-toggle { display: none; }
@media(max-width:768px){
  .site-header { position: static; padding: .6rem 0; }
  .site-header .container { flex-wrap: wrap; gap: .5rem; }
  .brand { font-size: 1.15rem; }
  .brand small { display: none; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 2.6rem; height: 2.6rem; font-size: 1.4rem; line-height: 1; color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.4); border-radius: 10px; cursor: pointer; flex: none; }
  .main-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; gap: .15rem; padding-top: .5rem; }
  .main-nav.open { display: flex; }
  .main-nav a { display: block; padding: .55rem .7rem; font-size: 1rem; }
}
