/* =====================================================================
   موقع العلامة الشيخ عبد الرزاق عفيفي رحمه الله
   نظام تصميم حديث — Modern Islamic design system
   ===================================================================== */

:root {
  /* Palette */
  --green-900: #0a3d31;
  --green-800: #0d4d3e;
  --green-700: #0f5d4a;
  --green-600: #137a5f;
  --green-500: #1a9173;
  --gold-600: #b8922f;
  --gold-500: #c9a227;
  --gold-400: #d9bb55;
  --gold-100: #f3ead0;
  --cream: #f7f4ec;
  --cream-2: #fbf9f3;
  --paper: #ffffff;
  --ink: #1d2924;
  --ink-soft: #45554e;
  --muted: #7b8a83;
  --line: #e7e1d2;
  --shadow-sm: 0 2px 8px rgba(13, 77, 62, .06);
  --shadow-md: 0 8px 28px rgba(13, 77, 62, .10);
  --shadow-lg: 0 18px 50px rgba(10, 61, 49, .16);
  --radius: 16px;
  --radius-lg: 24px;
  --maxw: 1180px;
  --header-h: 76px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.9;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .display {
  font-family: "Amiri", "Tajawal", serif;
  line-height: 1.4;
  color: var(--green-800);
  font-weight: 700;
}

a { color: var(--green-700); text-decoration: none; transition: color .2s; }
a:hover { color: var(--gold-600); }

img { max-width: 100%; display: block; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 22px; }

/* ============ Arabesque top ribbon ============ */
.ribbon {
  height: 6px;
  background: linear-gradient(90deg, var(--gold-500), var(--green-600), var(--gold-500));
}

/* ===================== Header / Nav ===================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(247, 244, 236, .88);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand .seal {
  width: 48px; height: 48px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--green-600), var(--green-800));
  color: var(--gold-400);
  font-family: "Amiri", serif; font-weight: 700; font-size: 22px;
  box-shadow: inset 0 0 0 2px var(--gold-500), var(--shadow-sm);
}
.brand > span { display: block; }
.brand b { font-family: "Amiri", serif; font-size: 20px; color: var(--green-800); display: block; line-height: 1.2; white-space: nowrap; }
.brand > span > span { font-size: 12px; color: var(--muted); white-space: nowrap; }

.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: inline-block; padding: 9px 14px; border-radius: 10px;
  color: var(--ink-soft); font-weight: 500; font-size: 15.5px;
}
.nav-links a:hover { background: var(--gold-100); color: var(--green-800); }
.nav-links a.active { color: #fff; background: var(--green-700); box-shadow: var(--shadow-sm); }

.nav-toggle {
  display: none; border: 0; background: var(--green-700); color: #fff;
  width: 46px; height: 42px; border-radius: 10px; font-size: 20px; cursor: pointer;
}

/* ===================== Hero ===================== */
.hero {
  position: relative; overflow: hidden;
  color: #f3efe2;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(201,162,39,.22), transparent 60%),
    linear-gradient(135deg, var(--green-900), var(--green-700) 70%);
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.05' stroke-width='1.5'%3E%3Cpath d='M30 0l30 30-30 30L0 30z'/%3E%3Cpath d='M30 12l18 18-18 18-18-18z'/%3E%3C/g%3E%3C/svg%3E");
  opacity: .9;
}
.hero-inner { position: relative; padding: 84px 0 96px; text-align: center; }
.hero .kicker {
  display: inline-block; letter-spacing: 1px; font-size: 14px;
  color: var(--gold-400); border: 1px solid rgba(217,187,85,.4);
  padding: 6px 18px; border-radius: 999px; margin-bottom: 22px;
  background: rgba(0,0,0,.12);
}
.hero h1 { color: #fff; font-size: clamp(34px, 6vw, 62px); margin: 0 0 8px; }
.hero .sub { font-size: clamp(17px, 2.4vw, 22px); color: var(--gold-100); margin: 0 0 10px; }
.hero .verse {
  font-family: "Amiri", serif; font-size: clamp(18px, 2.6vw, 24px);
  color: #e9ecdf; max-width: 720px; margin: 26px auto 0; opacity: .92;
}
.hero-cta { margin-top: 36px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 26px; border-radius: 12px; font-weight: 700; font-size: 16px;
  border: 1px solid transparent; cursor: pointer; transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-gold { background: linear-gradient(180deg, var(--gold-400), var(--gold-600)); color: #3a2e08; box-shadow: var(--shadow-md); }
.btn-gold:hover { color: #3a2e08; }
.btn-ghost { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.35); }
.btn-ghost:hover { background: rgba(255,255,255,.16); color: #fff; }
.btn-green { background: var(--green-700); color: #fff; box-shadow: var(--shadow-sm); }
.btn-green:hover { background: var(--green-800); color: #fff; }

/* wave divider */
.hero-wave { display: block; width: 100%; height: 40px; margin-top: -1px; color: var(--cream); }

/* ===================== Sections ===================== */
.section { padding: 64px 0; }
.section.alt { background: var(--cream-2); }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 42px; }
.section-head .eyebrow { color: var(--gold-600); font-weight: 700; letter-spacing: .5px; font-size: 14px; }
.section-head h2 { font-size: clamp(26px, 4vw, 38px); margin: 8px 0 12px; position: relative; display: inline-block; }
.section-head h2::after {
  content: ""; display: block; width: 70px; height: 3px; margin: 14px auto 0;
  background: linear-gradient(90deg, var(--gold-500), var(--green-600));
  border-radius: 3px;
}
.section-head p { color: var(--ink-soft); margin: 0; }

/* ===================== Feature cards (home) ===================== */
.grid { display: grid; gap: 24px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.fcard {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 26px; text-align: center; box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s, border-color .2s;
  position: relative; overflow: hidden;
}
.fcard::before {
  content: ""; position: absolute; top: 0; right: 0; left: 0; height: 4px;
  background: linear-gradient(90deg, var(--green-600), var(--gold-500)); transform: scaleX(0);
  transform-origin: right; transition: transform .25s;
}
.fcard:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--gold-400); }
.fcard:hover::before { transform: scaleX(1); }
.fcard .ic {
  width: 70px; height: 70px; margin: 0 auto 18px; border-radius: 20px;
  display: grid; place-items: center; font-size: 32px;
  background: linear-gradient(180deg, var(--gold-100), #fff);
  color: var(--green-700); box-shadow: inset 0 0 0 1px var(--line);
}
.fcard h3 { margin: 0 0 8px; font-size: 22px; }
.fcard p { margin: 0 0 16px; color: var(--ink-soft); font-size: 15.5px; }
.fcard .more { font-weight: 700; color: var(--gold-600); }

/* ===================== Media list (sound/video) ===================== */
.media-list { display: grid; gap: 14px; }
.media-item {
  display: flex; align-items: center; gap: 16px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px;
  box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .2s, border-color .2s;
}
.media-item:hover { transform: translateX(-4px); box-shadow: var(--shadow-md); border-color: var(--gold-400); }
.media-item .num {
  flex: none; width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  font-family: "Amiri", serif; font-weight: 700; color: var(--green-800);
  background: var(--gold-100);
}
.media-item .title { flex: 1; font-weight: 600; color: var(--ink); font-size: 16.5px; }
.media-item .title small { display: block; color: var(--muted); font-weight: 500; font-size: 13px; }
.media-actions { display: flex; gap: 8px; flex: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px;
  font-size: 14px; font-weight: 700; border: 1px solid var(--line); background: var(--cream-2); color: var(--green-700);
}
.chip:hover { background: var(--green-700); color: #fff; border-color: var(--green-700); }
.chip.play { background: var(--green-700); color: #fff; border-color: var(--green-700); }
.chip.play:hover { background: var(--green-800); color: #fff; }

/* ===================== Book cards ===================== */
.book-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 14px;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.book-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--gold-400); }
.book-card .spine {
  height: 92px; border-radius: 10px; display: grid; place-items: center; color: var(--gold-100);
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.10) 0 2px, transparent 2px 9px),
    linear-gradient(135deg, var(--green-700), var(--green-900));
  font-size: 34px; box-shadow: inset 0 0 0 1px rgba(217,187,85,.3);
}
.book-card h3 { font-size: 18px; margin: 0; flex: 1; }
.book-card .dl { display: flex; gap: 8px; }

/* ===================== Article / bio pages ===================== */
.page-hero {
  background: linear-gradient(135deg, var(--green-800), var(--green-600));
  color: #fff; padding: 54px 0 60px; position: relative; overflow: hidden; text-align: center;
}
.page-hero::after {
  content: ""; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='48' height='48' viewBox='0 0 48 48' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M24 0l24 24-24 24L0 24z' fill='none' stroke='%23fff' stroke-opacity='.05'/%3E%3C/svg%3E");
}
.page-hero .container { position: relative; }
.page-hero h1 { color: #fff; font-size: clamp(28px, 5vw, 44px); margin: 0; }
.page-hero p { color: var(--gold-100); margin: 10px 0 0; }
.breadcrumb { font-size: 14px; color: rgba(255,255,255,.8); margin-bottom: 14px; }
.breadcrumb a { color: var(--gold-100); }

.layout { display: grid; grid-template-columns: 1fr 300px; gap: 36px; align-items: start; }
.article {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 40px 44px; box-shadow: var(--shadow-sm);
}
.article p { margin: 0 0 18px; text-align: justify; color: #25322c; }
.article h2 {
  font-size: 25px; margin: 36px 0 14px; padding-right: 16px; position: relative;
}
.article h2::before {
  content: ""; position: absolute; right: 0; top: 6px; bottom: 6px; width: 5px; border-radius: 4px;
  background: linear-gradient(var(--gold-500), var(--green-600));
}
.article .lead {
  font-family: "Amiri", serif; font-size: 21px; color: var(--green-800);
  border-right: 4px solid var(--gold-500); padding: 6px 18px 6px 0; background: var(--gold-100);
  border-radius: 0 12px 12px 0; margin-bottom: 26px;
}
.article blockquote {
  margin: 22px 0; padding: 18px 22px; background: var(--cream-2);
  border-radius: 12px; border-right: 4px solid var(--green-600); color: var(--ink-soft); font-style: normal;
}

/* sidebar */
.sidebar { position: sticky; top: calc(var(--header-h) + 18px); display: grid; gap: 20px; }
.s-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.s-card h4 { margin: 0 0 14px; font-size: 18px; padding-bottom: 10px; border-bottom: 2px solid var(--gold-100); }
.s-card ul { margin: 0; padding: 0; list-style: none; }
.s-card li { margin: 0 0 4px; }
.s-card li a { display: block; padding: 9px 12px; border-radius: 9px; color: var(--ink-soft); font-weight: 500; }
.s-card li a:hover { background: var(--gold-100); color: var(--green-800); }
.s-card.dark { background: linear-gradient(135deg, var(--green-800), var(--green-600)); color: #fff; border: 0; }
.s-card.dark h4 { color: #fff; border-color: rgba(255,255,255,.2); }
.s-card.dark p { color: var(--gold-100); margin: 0 0 8px; font-size: 14.5px; }

/* quick facts */
.facts { display: grid; gap: 10px; }
.fact { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.fact:last-child { border-bottom: 0; }
.fact b { color: var(--green-800); }
.fact span { color: var(--ink-soft); }

/* stats strip */
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; }
.stat { text-align: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 14px; box-shadow: var(--shadow-sm); }
.stat .n { font-family: "Amiri", serif; font-size: 40px; color: var(--gold-600); font-weight: 700; }
.stat .l { color: var(--ink-soft); font-size: 15px; }

/* note banner */
.note {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--gold-100); border: 1px solid var(--gold-400); border-radius: 14px;
  padding: 18px 22px; color: #5a4a16; margin-bottom: 26px;
}
.note .i { font-size: 22px; }

/* ===================== Footer ===================== */
.site-footer {
  background: linear-gradient(180deg, var(--green-900), #06281f);
  color: #c9d6cf; padding: 56px 0 26px; margin-top: 60px;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 36px; }
.site-footer h4 { color: #fff; font-size: 18px; margin: 0 0 16px; }
.site-footer a { color: #b9cabf; }
.site-footer a:hover { color: var(--gold-400); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 0 0 9px; }
.site-footer .brand-f { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.site-footer .brand-f .seal { width: 44px; height: 44px; }
.site-footer p { color: #9fb3a8; font-size: 15px; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1); margin-top: 38px; padding-top: 20px;
  text-align: center; color: #8aa093; font-size: 14px;
}

/* ===================== Modal player ===================== */
.modal {
  position: fixed; inset: 0; background: rgba(8, 30, 24, .72); display: none;
  align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal.open { display: flex; }
.modal-box {
  background: var(--paper); border-radius: var(--radius-lg); max-width: 560px; width: 100%;
  padding: 28px; box-shadow: var(--shadow-lg); text-align: center;
}
.modal-box h3 { margin: 0 0 6px; }
.modal-box p { color: var(--ink-soft); }
.modal-box .x { float: left; border: 0; background: var(--cream-2); width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 18px; color: var(--ink); }
.modal-box audio, .modal-box video { width: 100%; margin: 14px 0; }

/* back to top */
.totop {
  position: fixed; bottom: 24px; left: 24px; width: 50px; height: 50px; border-radius: 14px;
  background: var(--green-700); color: #fff; border: 0; cursor: pointer; font-size: 20px;
  box-shadow: var(--shadow-md); opacity: 0; pointer-events: none; transition: opacity .3s, transform .2s; z-index: 90;
}
.totop.show { opacity: 1; pointer-events: auto; }
.totop:hover { transform: translateY(-3px); background: var(--green-800); }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ===================== Responsive ===================== */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) {
  .nav-links {
    position: fixed; inset: var(--header-h) 0 auto 0; flex-direction: column; align-items: stretch;
    background: var(--cream-2); padding: 12px; gap: 4px; border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md); transform: translateY(-130%); transition: transform .3s; height: auto;
  }
  .nav-links.open { transform: none; }
  .nav-links a { padding: 13px 16px; }
  .nav-toggle { display: block; }
}
@media (max-width: 760px) {
  .grid-3, .grid-4, .grid-2, .stats { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2,1fr); }
  .article { padding: 26px 20px; }
  .media-item { flex-wrap: wrap; }
  .media-actions { width: 100%; }
  .media-actions .chip { flex: 1; justify-content: center; }
}
