/* ===== الصفحة الرئيسية فقط (يُحمَّل بعد styles.css) ===== */
:root { --font-display: "Aref Ruqaa", "Amiri", serif; }
.hero h1, .section-title, .cta h2 { font-family: var(--font-display); }

/* ===== البطل: ليل أخضر، والشعار وسام تدور حوله نجمة ذهبية ===== */
.hero {
  color: #fff; padding-block: clamp(3.5rem, 9vw, 6.5rem);
  background: radial-gradient(ellipse 70% 90% at 22% 45%, #2c6f54 0%, var(--green) 40%, var(--green-dark) 100%);
}
.hero::before {
  content: ""; position: absolute; inset: 0; background: var(--pattern);
  -webkit-mask-image: radial-gradient(ellipse at 22% 45%, #000, transparent 70%);
  mask-image: radial-gradient(ellipse at 22% 45%, #000, transparent 70%);
}
.hero-inner { position: relative; }
.hero .eyebrow { color: var(--gold); }
.hero h1 { color: #fff8e6; font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 400; line-height: 1.5; margin: 0; }
.hero h1 span {
  display: block; font-size: 1.75em; font-weight: 700; line-height: 1.3; padding-block: .1em; margin-top: -.12em;
  background: linear-gradient(100deg, #c9a227 0%, #f6e3a1 35%, #fffbe8 50%, #f6e3a1 65%, #c9a227 100%) 100% 0 / 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .hadith { color: #f0e3b6; }
.hero .lead { color: rgba(255, 255, 255, .82); }
.hero .lead strong { color: #fff; }
.hero .btn-ghost { border-color: rgba(201, 162, 39, .7); color: #fff; }
.hero .btn-ghost:hover { background: var(--gold); border-color: var(--gold); color: var(--green-dark); }

.medallion { position: relative; width: min(330px, 58vw); margin-block: 14%; }
.medallion .logo-frame {
  width: 100%; padding: 7%;
  box-shadow: 0 0 0 5px rgba(201, 162, 39, .55), 0 0 90px rgba(201, 162, 39, .4), 0 30px 60px rgba(0, 0, 0, .35);
}
/* مربعات متراكبة تختفي أوساطها خلف الشعار فتبقى رؤوسها نجمةً حوله */
.rosette { position: absolute; inset: -22%; width: 144%; height: 144%; overflow: visible; fill: none; stroke: var(--gold); stroke-width: .8; }
.rosette g { transform-origin: 0 0; }
.r-b { opacity: .5; }
.r-dots { stroke-width: 1.4; stroke-linecap: round; stroke-dasharray: .6 5.5; opacity: .7; }

.petals i { position: absolute; top: -20px; width: 13px; height: 13px; border-radius: 80% 0 80% 0; opacity: 0; background: linear-gradient(135deg, #f3dc8a, var(--gold)); }
.petals i:nth-child(3n) { background: linear-gradient(135deg, #ee8a9b, var(--crimson)); }

/* ===== الأرقام ===== */
.stats { background: var(--green-dark); border-top: 1px solid rgba(201, 162, 39, .35); }
.stat strong { font-variant-numeric: tabular-nums; direction: ltr; }

/* ===== البرامج: طريق بمحطات ===== */
.path { list-style: none; margin: 0; padding: 0; position: relative; display: grid; gap: 1.8rem; }
.path::before { content: ""; position: absolute; inset-inline-start: 7px; inset-block: .8rem 0; width: 2px; background: linear-gradient(var(--gold), rgba(201, 162, 39, .15)); transform-origin: top; }
.path li { position: relative; padding-inline-start: 2.4rem; }
/* علامة المحطة: نجمة ثمانية من مربعين */
.path li::before, .path li::after { content: ""; position: absolute; inset-inline-start: 0; top: .5rem; width: 16px; height: 16px; background: var(--gold); }
.path li::after { rotate: 45deg; }
.path li:last-child::before, .path li:last-child::after { background: var(--crimson); }
.path h3 { font-size: 1.45rem; margin-bottom: .25rem; }
.path p { margin: 0; color: var(--muted); font-size: .98rem; }
.path .card-link { margin-top: .6rem; }
@media (min-width: 1000px) {
  .path { grid-template-columns: repeat(5, 1fr); gap: 1.6rem; }
  .path::before { inset: 7px 0 auto; width: auto; height: 2px; background: linear-gradient(to left, var(--gold), rgba(201, 162, 39, .15)); transform-origin: right; }
  .path li { padding: 2.6rem 0 0; }
  .path li::before, .path li::after { top: 0; }
}
.side-programs { display: grid; gap: 1.5rem 3rem; margin-top: 3rem; }
@media (min-width: 768px) { .side-programs { grid-template-columns: 1fr 1fr; } }
.side { border-top: 1px solid rgba(201, 162, 39, .55); padding-top: 1.2rem; }
.side h3 { font-size: 1.35rem; margin-bottom: .25rem; }
.side p { margin: 0; color: var(--muted); }

/* ===== المتابعة ===== */
.follow { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 900px) { .follow { grid-template-columns: 1.15fr 1fr; gap: 4rem; } }
.follow .section-title::after, .lessons-grid .section-title::after { margin-inline: 0; }
.ticks { list-style: none; margin: 1.4rem 0 0; padding: 0; display: grid; gap: .8rem; }
.ticks li { position: relative; padding-inline-start: 1.8rem; }
.ticks li::before { content: "۞"; position: absolute; inset-inline-start: 0; color: var(--gold-dark); }
.follow-card { margin: 0; rotate: -1.5deg; box-shadow: 0 30px 60px rgba(31, 77, 58, .18); }
.follow-card .today-parts { grid-template-columns: 1fr; }
.follow-card .progress-line { margin-top: 1.2rem; }
.follow-card .progress-line span { width: 38%; }
.follow-card > p { margin: 0; }

/* ===== الدروس: قائمة تشغيل تفتح على يوتيوب ===== */
.lessons-grid { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 900px) { .lessons-grid { grid-template-columns: 1fr 1fr; gap: 4rem; } }
.lessons-grid .section-sub { margin-bottom: 1.6rem; }
.playlist { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgba(201, 162, 39, .3); }
.playlist a {
  display: flex; align-items: center; gap: 1rem; padding: 1rem .6rem; color: #fff; text-decoration: none;
  border-bottom: 1px solid rgba(201, 162, 39, .3); transition: background .2s, padding .25s;
}
.playlist a::before {
  content: ""; flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--gold); transition: background-color .2s, border-color .2s;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.5 7v10l8-5z' fill='%23fff'/%3E%3C/svg%3E") center / 22px no-repeat;
}
.playlist a:hover { background: rgba(255, 255, 255, .06); padding-inline-start: 1.1rem; }
.playlist a:hover::before { background-color: var(--crimson); border-color: var(--crimson); }
.playlist strong { flex: 1; font-size: 1.1rem; }
.playlist small { color: rgba(255, 255, 255, .7); white-space: nowrap; }

/* ===== غصن التنقل: يكبر مع التمرير ويُبرعم عند كل قسم (home.js) ===== */
.branch { display: none; position: fixed; z-index: 40; inset-inline-start: 22px; top: 50%; translate: 0 -50%; width: 24px; height: min(56vh, 440px); }
@media (min-width: 1320px) { .branch { display: block; } }
.branch::before, .branch::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 11px; width: 2px; border-radius: 2px; background: rgba(201, 162, 39, .28); }
.branch::after { background: var(--gold); transform: scaleY(var(--bp, 0)); transform-origin: top; }
.branch a { position: absolute; z-index: 1; width: 14px; height: 14px; top: calc(var(--i) / (var(--n) - 1) * 100% - 7px); inset-inline-start: 13px; }
.branch a:nth-child(even) { inset-inline-start: -3px; rotate: 90deg; }
.branch a::after { content: ""; position: absolute; inset: -8px; } /* مساحة نقر أوسع */
.branch a::before {
  content: ""; position: absolute; inset: 0; border-radius: 0 100% 0 100%; background: var(--gold);
  scale: .35; opacity: .5; transition: scale .5s cubic-bezier(.34, 1.56, .64, 1), opacity .3s, background .3s;
}
.branch a.on::before { scale: 1; opacity: 1; }
.branch a[aria-current]::before { scale: 1.4; background: var(--crimson); box-shadow: 0 0 0 2px var(--cream); }
.branch span {
  position: absolute; inset-inline-start: 30px; top: 50%; translate: 0 -50%; white-space: nowrap; pointer-events: none;
  background: var(--green-dark); color: #fff; font-size: .8rem; font-weight: 700; padding: .1rem .7rem; border-radius: 99px;
  border: 1px solid rgba(201, 162, 39, .5); opacity: 0; transition: opacity .2s;
}
.branch a:nth-child(even) span { rotate: -90deg; translate: 0 0; top: -34px; inset-inline-start: auto; left: 50%; transform-origin: left center; }
.branch a:hover span, .branch a:focus-visible span { opacity: 1; }
/* دون الغصن (الشاشات الأضيق): خط تقدّم تحت الترويسة */
.site-header::after { content: ""; position: absolute; inset-inline: 0; bottom: -2px; height: 2px; background: linear-gradient(to left, var(--gold), var(--crimson)); transform: scaleX(var(--p, 0)); transform-origin: right; }
@media (min-width: 1320px) { .site-header::after { display: none; } }

/* ===== الحركة: كلها هنا، ولا شيء منها لمن طلب تقليل الحركة ===== */
@media (prefers-reduced-motion: no-preference) {
  /* لحظة الافتتاح: النص يصعد سطرًا سطرًا، والوسام يتفتّح، ثم لمعة تمرّ على «ربيع قلبك» */
  .hero-text > * { animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; }
  .hero-text > :nth-child(2) { animation-delay: .12s; }
  .hero-text > :nth-child(3) { animation-delay: .3s; }
  .hero-text > :nth-child(4) { animation-delay: .42s; }
  .hero-text > :nth-child(5) { animation-delay: .54s; }
  .hero h1 span { animation: shine 2.4s ease-out .7s both; }
  .medallion .logo-frame { animation: bloom 1.2s cubic-bezier(.2, .8, .2, 1) .15s both; }
  .rosette { animation: bloom 1.6s cubic-bezier(.2, .8, .2, 1) both; }
  .r-a { animation: spin 100s linear infinite; }
  .r-b { animation: spin 150s linear infinite reverse; }
  .petals i { animation: fall 16s linear infinite; }
  .petals i:nth-child(1) { left: 6%; animation-delay: 1s; }
  .petals i:nth-child(2) { left: 19%; animation-duration: 21s; animation-delay: 6s; }
  .petals i:nth-child(3) { left: 33%; animation-duration: 18s; animation-delay: 3s; }
  .petals i:nth-child(4) { left: 47%; animation-duration: 24s; animation-delay: 10s; }
  .petals i:nth-child(5) { left: 61%; animation-duration: 17s; animation-delay: 2s; }
  .petals i:nth-child(6) { left: 74%; animation-duration: 22s; animation-delay: 8s; }
  .petals i:nth-child(7) { left: 86%; animation-duration: 19s; animation-delay: 5s; }
  .petals i:nth-child(8) { left: 95%; animation-duration: 25s; animation-delay: 12s; }

  /* الطريق يُرسم ثم تظهر محطاته واحدة بعد أخرى */
  .js .path.reveal { opacity: 1; transform: none; }
  .js .path::before { scale: 1 0; transition: scale 1.5s ease; }
  .js .path.in::before { scale: 1; }
  .js .path li { opacity: 0; translate: 0 14px; transition: opacity .6s ease, translate .6s ease; }
  .js .path.in li { opacity: 1; translate: 0; }
  .path li:nth-child(2) { transition-delay: .25s; }
  .path li:nth-child(3) { transition-delay: .5s; }
  .path li:nth-child(4) { transition-delay: .75s; }
  .path li:nth-child(5) { transition-delay: 1s; }
  @media (min-width: 1000px) { .js .path::before { scale: 0 1; } }

  .js .follow-card .progress-line span { width: 0; transition: width 1.6s ease .5s; }
  .js .follow-card.in .progress-line span { width: 38%; }

  /* الأسئلة تنفتح بسلاسة حيث يدعم المتصفح */
  @supports (interpolate-size: allow-keywords) {
    .faq details { interpolate-size: allow-keywords; }
    .faq details::details-content { block-size: 0; overflow: hidden; transition: block-size .35s ease, content-visibility .35s allow-discrete; }
    .faq details[open]::details-content { block-size: auto; }
  }
}
@keyframes rise { from { opacity: 0; translate: 0 24px; } }
@keyframes bloom { from { opacity: 0; scale: .8; } }
@keyframes shine { to { background-position: 0 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fall {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0); }
  8% { opacity: .75; }
  85% { opacity: .5; }
  100% { opacity: 0; transform: translate3d(-90px, 95vh, 0) rotate(540deg); }
}
