/* =========================================================
   Jamaat-e-Suffah — shared styles (all pages)
   ========================================================= */

:root {
  --green: #03512A;
  --green-deep: #023118;
  --gold: #B37C46;
  --gold-dark: #966437;
  --gold-light: #e1bd82;
  --cream: #F7F3EC;
}

/* ---------- Smooth scrolling ---------- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 110px; /* keeps anchored sections clear of the fixed navbar */
}
html.menu-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- Typography ---------- */
body { font-family: 'Inter', system-ui, sans-serif; }

[dir="rtl"], .urdu {
  font-family: 'Noto Nastaliq Urdu', 'Inter', serif;
  line-height: 2.1;
}
.font-archivo {
  font-family: 'Archivo Black', 'Noto Nastaliq Urdu', sans-serif;
  letter-spacing: -0.02em;
}
.latin { font-family: 'Inter', system-ui, sans-serif; line-height: 1.3; }

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; z-index: 70;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transform: scaleX(0); transform-origin: 0 50%;
  pointer-events: none;
}

/* ---------- Header / navbar ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 60;
  padding: 16px 16px 0;
  pointer-events: none;
}
.site-header > * { pointer-events: auto; }

.nav-bar {
  max-width: 80rem; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 10px 8px 16px;
  background: rgba(3, 81, 42, .95);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 9999px;
  box-shadow: 0 8px 30px rgba(3, 81, 42, .35);
  transition: padding .35s ease, box-shadow .35s ease;
}
.site-header.is-scrolled .nav-bar {
  padding-block: 4px;
  box-shadow: 0 10px 34px rgba(3, 81, 42, .5);
}

.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; text-decoration: none; }
.brand img {
  height: 48px; width: 60px; object-fit: cover;
  border-radius: 9999px; border: 2px solid var(--gold);
  transition: height .35s ease, width .35s ease;
}
.site-header.is-scrolled .brand img { height: 42px; width: 52px; }
.brand-text { display: none; color: var(--cream); font-size: 12px; text-transform: uppercase; }
@media (min-width: 640px) { .brand-text { display: block; } }

/* Desktop links */
.nav-links { display: none; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; }
@media (min-width: 1024px) { .nav-links { display: flex; } }

.nav-item { position: relative; }
.nav-link {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px;
  background: none; border: 0; cursor: pointer;
  font: 600 11px/1 'Inter', sans-serif;
  letter-spacing: .06em; text-transform: uppercase;
  color: rgba(247, 243, 236, .85); text-decoration: none;
  transition: color .3s ease;
}
.nav-link::after {
  content: ""; position: absolute; left: 16px; right: 16px; bottom: 4px; height: 1px;
  background: var(--gold);
  transform: scaleX(0); transform-origin: left; transition: transform .3s ease;
}
.nav-link:hover, .nav-item.open > .nav-link, .nav-link[aria-current="page"] { color: var(--gold); }
.nav-link:hover::after, .nav-item.open > .nav-link::after, .nav-link[aria-current="page"]::after { transform: scaleX(1); }
.nav-link:focus-visible, .burger:focus-visible, .join-btn:focus-visible,
.dropdown a:focus-visible, .m-link:focus-visible, .m-acc-btn:focus-visible {
  outline: 2px solid var(--gold-light); outline-offset: 2px;
}

.chev { width: 12px; height: 12px; transition: transform .3s ease; flex-shrink: 0; }
.nav-item.open > .nav-link .chev { transform: rotate(180deg); }

/* Desktop dropdown */
.dropdown {
  position: absolute; top: 100%; left: 50%;
  padding-top: 14px; min-width: 230px;
  opacity: 0; visibility: hidden;
  transform: translate(-50%, 8px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
}
.dropdown-inner {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px;
  background: rgba(3, 81, 42, .98);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(2, 49, 24, .4);
}
.dropdown a {
  display: block; padding: 11px 14px; border-radius: 12px;
  font: 500 13px/1.3 'Inter', sans-serif; color: rgba(247, 243, 236, .9);
  text-decoration: none; white-space: nowrap;
  transition: background .2s ease, color .2s ease;
}
.dropdown a:hover { background: rgba(255, 255, 255, .08); color: var(--gold-light); }
.nav-item:hover > .dropdown,
.nav-item:focus-within > .dropdown,
.nav-item.open > .dropdown {
  opacity: 1; visibility: visible; transform: translate(-50%, 0);
}

/* Right-hand actions */
.nav-actions { display: flex; align-items: center; gap: 8px; }
.join-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px;
  background: var(--gold); color: var(--cream);
  border-radius: 9999px; text-decoration: none;
  font: 700 11px/1 'Inter', sans-serif; letter-spacing: .05em; text-transform: uppercase;
  white-space: nowrap;
  transition: background .3s ease, gap .3s ease;
}
.join-btn:hover { background: var(--gold-dark); gap: 12px; }
.join-btn svg { width: 14px; height: 14px; }
@media (min-width: 640px) { .join-btn { padding: 12px 22px; font-size: 12px; } }

/* ---------- Burger button ---------- */
.burger {
  position: relative; width: 44px; height: 44px; flex-shrink: 0;
  border: 0; border-radius: 9999px; cursor: pointer;
  background: rgba(255, 255, 255, .08);
  transition: background .3s ease;
}
.burger:hover { background: rgba(255, 255, 255, .16); }
.burger span {
  position: absolute; left: 12px; right: 12px; height: 2px;
  background: var(--cream); border-radius: 2px;
  transition: transform .4s cubic-bezier(.65, 0, .35, 1), opacity .25s ease, top .4s cubic-bezier(.65, 0, .35, 1), background .3s ease;
}
.burger span:nth-child(1) { top: 15px; }
.burger span:nth-child(2) { top: 21px; right: 18px; }
.burger span:nth-child(3) { top: 27px; }
.burger:hover span:nth-child(2) { right: 12px; }
.burger.is-open { background: var(--gold); }
.burger.is-open span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.burger.is-open span:nth-child(2) { opacity: 0; transform: translateX(10px); }
.burger.is-open span:nth-child(3) { top: 21px; transform: rotate(-45deg); }
@media (min-width: 1024px) { .burger { display: none; } }

/* ---------- Mobile panel ---------- */
.menu-backdrop {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(2, 49, 24, .55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden;
  transition: opacity .35s ease, visibility .35s;
}
.menu-backdrop.is-open { opacity: 1; visibility: visible; }

.mobile-panel {
  max-width: 80rem; margin: 12px auto 0; padding: 10px;
  max-height: calc(100dvh - 110px); overflow-y: auto;
  background: rgba(3, 81, 42, .98);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 28px;
  box-shadow: 0 24px 50px rgba(2, 49, 24, .45);
  opacity: 0; visibility: hidden;
  transform: translateY(-14px) scale(.98); transform-origin: top center;
  transition: opacity .35s ease, transform .45s cubic-bezier(.22, 1, .36, 1), visibility .35s;
}
.mobile-panel.is-open { opacity: 1; visibility: visible; transform: none; }
@media (min-width: 1024px) { .mobile-panel, .menu-backdrop { display: none; } }

.m-item {
  list-style: none;
  opacity: 0; transform: translateY(10px);
  transition: opacity .4s ease, transform .4s ease;
}
.mobile-panel.is-open .m-item {
  opacity: 1; transform: none;
  transition-delay: calc(var(--i) * 55ms + 90ms);
}
.m-list { margin: 0; padding: 0; }

.m-link, .m-acc-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 15px 16px; border: 0; border-radius: 16px; cursor: pointer;
  background: none; text-align: left; text-decoration: none;
  font: 600 14px/1.2 'Inter', sans-serif; letter-spacing: .05em; text-transform: uppercase;
  color: rgba(247, 243, 236, .92);
  transition: background .25s ease, color .25s ease;
}
.m-link:hover, .m-acc-btn:hover, .m-acc.open > .m-acc-btn { background: rgba(255, 255, 255, .07); color: var(--gold-light); }
.m-link[aria-current="page"] { color: var(--gold-light); }
.m-acc.open > .m-acc-btn .chev { transform: rotate(180deg); }
.m-acc-btn .chev { width: 16px; height: 16px; }

.m-sub {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .4s cubic-bezier(.22, 1, .36, 1);
}
.m-acc.open > .m-sub { grid-template-rows: 1fr; }
.m-sub-inner {
  overflow: hidden; min-height: 0;
  margin: 0 0 0 22px; padding: 0 0 0 14px;
  border-left: 1px solid rgba(179, 124, 70, .45);
}
.m-sub a {
  display: block; padding: 12px 14px; border-radius: 12px;
  font: 500 14px/1.3 'Inter', sans-serif; color: rgba(247, 243, 236, .85);
  text-decoration: none; transition: background .2s ease, color .2s ease;
}
.m-sub a:first-child { margin-top: 4px; }
.m-sub a:last-child { margin-bottom: 8px; }
.m-sub a:hover { background: rgba(255, 255, 255, .07); color: var(--gold-light); }
.m-sub a:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }

/* ---------- Print ---------- */
@media print {
  .site-header, .scroll-progress, .menu-backdrop { display: none !important; }
}

/* ---------- Join popup (Home) ---------- */
html.modal-open { overflow: hidden; }
.join-modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: stretch; justify-content: flex-start;
  background: rgba(0, 0, 0, .6);
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility .3s;
}
.join-modal.is-open { opacity: 1; visibility: visible; }

.join-modal-card {
  position: relative; width: 100%; height: 100dvh;
  background: #fff;
  transform: translateX(-28px);
  transition: transform .45s cubic-bezier(.22, 1, .36, 1);
}
.join-modal.is-open .join-modal-card { transform: none; }
@media (min-width: 1024px) { .join-modal-card { width: 76vw; max-width: 1150px; } }

.join-modal-close {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  width: 48px; height: 48px; border-radius: 9999px; cursor: pointer;
  background: #fff; color: #03512A; border: 3px solid #03512A;
  font: 700 22px/1 'Inter', sans-serif;
  display: flex; align-items: center; justify-content: center;
  transition: background .25s ease, color .25s ease;
}
.join-modal-close:hover { background: #03512A; color: #fff; }
.join-modal-close:focus-visible { outline: 3px solid #B37C46; outline-offset: 2px; }
@media (min-width: 1024px) { .join-modal-close { right: -26px; top: 0; width: 52px; height: 52px; } }

.jm-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 36px 20px 48px; }
@media (min-width: 640px) { .jm-scroll { padding: 40px 36px 56px; } }
@media (min-width: 1024px) { .jm-scroll { padding: 40px 36px 56px 32px; } }

.jm-heading {
  margin: 0; padding-right: 56px;
  font: 500 clamp(28px, 4vw, 42px)/1.2 Georgia, 'Times New Roman', serif;
  color: #03512A;
}
.jm-sub { margin: 4px 0 0; font-size: 15px; color: #B37C46; font-weight: 600; }

.jm-form { margin-top: 28px; color: #1e293b; }
@media (min-width: 1024px) { .jm-form { padding: 0 44px 0 48px; } }

.jm-submit {
  display: block; width: 100%; margin-top: 36px; border: 0; cursor: pointer; padding: 18px;
  background: #B37C46; color: #F7F3EC;
  font: 700 13px/1 'Inter', sans-serif; letter-spacing: .08em; text-transform: uppercase;
  transition: background .3s ease;
}
.jm-submit:hover { background: #966437; }

/* boxed fields, like the reference popup */
.join-modal .field-input {
  width: 100%; background: #fff; outline: none;
  border: 1px solid #e3e6e4; border-radius: 2px;
  padding: 16px 20px; color: #173d2c; font: 500 15px Inter, sans-serif;
}
.join-modal .field-input:focus { border-color: #B37C46; box-shadow: 0 0 0 3px rgba(179,124,70,.15); }
.join-modal .field-input::placeholder { color: #8a948d; }
.join-modal .question-input {
  width: 100%; min-height: 90px; resize: vertical; background: #fff; outline: none;
  border: 1px solid #e3e6e4; border-radius: 2px; padding: 16px 20px; color: #173d2c; font: 15px Inter, sans-serif;
}
.join-modal .question-input:focus { border-color: #B37C46; box-shadow: 0 0 0 3px rgba(179,124,70,.15); }
.join-modal label { font-size: 14px; }