/* ============================================================
   Rahat Foundation — shared styles
   Palette: logo blue #3A62AE · warm ivory paper · soft gold
   Type: Marcellus (display) · Manrope (body)
   ============================================================ */

:root {
  --brand-50:  #F3F7FC;
  --brand-100: #E6EEF9;
  --brand-200: #C9D9F0;
  --brand-300: #A3BDE3;
  --brand-400: #7297D0;
  --brand-500: #4F77BE;
  --brand-600: #3A62AE;   /* logo blue */
  --brand-700: #30508F;
  --brand-800: #2A4373;
  --brand-900: #21345A;
  --brand-950: #16233D;
  --gold-400:  #D9B36B;
  --gold-500:  #C9973F;
  --gold-600:  #A16207;   /* accessible on white (4.6:1) */
  --paper:     #FAF7F1;
  --paper-2:   #F3EEE4;
  --ink:       #0F172A;
  --muted:     #4B5565;
  --ease-out:  cubic-bezier(.22,.61,.36,1);
}

html { scroll-behavior: smooth; }
[id] { scroll-margin-top: 6.5rem; }
body {
  color: var(--ink);
  background: #fff;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--brand-200); color: var(--brand-950); }

/* ---------- accessibility ---------- */
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--brand-950); color: #fff;
  padding: .65rem 1.1rem; border-radius: .5rem;
  font-weight: 600; font-size: .875rem;
  transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--brand-500);
  outline-offset: 3px;
  border-radius: .25rem;
}

/* ---------- typography helpers ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  font-size: .78rem; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold-600);
}
.eyebrow::before {
  content: ""; width: 2rem; height: 1px;
  background: var(--gold-500); flex: none;
}
.eyebrow--center::after {
  content: ""; width: 2rem; height: 1px;
  background: var(--gold-500); flex: none;
}
.eyebrow--light { color: var(--gold-400); }
.eyebrow--light::before, .eyebrow--light::after { background: var(--gold-400); }

.lede { font-size: 1.125rem; line-height: 1.75; color: var(--muted); }

.urdu-accent {
  font-family: 'Noto Nastaliq Urdu', serif;
  font-weight: 400;
  line-height: 2;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  font-weight: 700; font-size: .95rem; line-height: 1;
  padding: .95rem 1.7rem; border-radius: 999px;
  cursor: pointer; white-space: nowrap;
  transition: background-color .2s var(--ease-out), color .2s var(--ease-out),
              border-color .2s var(--ease-out), box-shadow .2s var(--ease-out),
              transform .15s var(--ease-out);
}
.btn:active { transform: scale(.97); }
.btn svg { width: 1.05rem; height: 1.05rem; flex: none; }

.btn-primary {
  background: var(--brand-600); color: #fff;
  box-shadow: 0 10px 24px -12px rgba(58, 98, 174, .65);
}
.btn-primary:hover { background: var(--brand-700); box-shadow: 0 14px 28px -12px rgba(48, 80, 143, .7); }

.btn-outline {
  background: transparent; color: var(--brand-700);
  border: 1.5px solid var(--brand-200);
}
.btn-outline:hover { background: var(--brand-50); border-color: var(--brand-300); }

.btn-white { background: #fff; color: var(--brand-800); }
.btn-white:hover { background: var(--brand-50); }

.btn-ghost-light { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.35); }
.btn-ghost-light:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.6); }

.btn-lg { padding: 1.15rem 2.1rem; font-size: 1.02rem; }

/* ---------- header ---------- */
#site-header { transition: box-shadow .25s var(--ease-out); }
#site-header.is-scrolled { box-shadow: 0 6px 24px -18px rgba(15, 23, 42, .35); }

.nav-link {
  position: relative;
  font-size: .95rem; font-weight: 600; color: #334155;
  padding: .4rem 0;
  transition: color .2s var(--ease-out);
}
.nav-link:hover { color: var(--brand-700); }
.nav-link::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0;
  height: 2px; background: var(--gold-500);
  transition: right .25s var(--ease-out);
}
.nav-link:hover::after, .nav-link[aria-current="page"]::after { right: 0; }
.nav-link[aria-current="page"] { color: var(--brand-700); }

.mobile-link {
  display: block; padding: .9rem .25rem;
  font-size: 1.05rem; font-weight: 600; color: #1e293b;
  border-bottom: 1px solid #eef2f7;
}
.mobile-link[aria-current="page"] { color: var(--brand-700); }

/* ---------- programs dropdown (desktop) ---------- */
.nav-drop-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  background: none; border: 0; cursor: pointer; font: inherit;
}
.nav-drop-btn svg { width: .85rem; height: .85rem; transition: transform .2s var(--ease-out); }
.nav-dropdown.open .nav-drop-btn svg { transform: rotate(180deg); }
.nav-drop-panel {
  position: absolute; top: calc(100% + .85rem); left: 50%; transform: translateX(-50%);
  min-width: 16rem;
  background: #fff; border: 1px solid #E7E3D8; border-radius: 16px;
  box-shadow: 0 24px 48px -20px rgba(33, 52, 90, .28);
  padding: .55rem; z-index: 70;
}
.drop-link {
  display: block; padding: .55rem .85rem; border-radius: 10px;
  font-size: .92rem; font-weight: 600; color: #334155;
  transition: background-color .15s var(--ease-out), color .15s var(--ease-out);
}
.drop-link:hover { background: var(--brand-50); color: var(--brand-700); }
.drop-link--all { color: var(--brand-700); border-bottom: 1px solid #EEF2F7; border-radius: 10px 10px 0 0; margin-bottom: .4rem; padding-bottom: .75rem; }

/* ---------- programs accordion (mobile drawer) ---------- */
.mobile-drop-btn {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  text-align: left; background: none; border: 0; cursor: pointer; font: inherit;
}
.mobile-drop-btn svg { width: 1rem; height: 1rem; flex: none; transition: transform .2s var(--ease-out); }
.mobile-group.open .mobile-drop-btn svg { transform: rotate(180deg); }
.mobile-sub { padding: .15rem 0 .5rem; }
.mobile-sub-link {
  display: block; padding: .55rem 0 .55rem 1.1rem;
  font-size: .98rem; font-weight: 500; color: #475569;
  border-bottom: 1px solid #F4F6FA;
}

/* ---------- decorative patterns ---------- */
.pattern-jali {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cpath d='M32 6l6.5 19.5L58 32l-19.5 6.5L32 58l-6.5-19.5L6 32l19.5-6.5z' fill='%23ffffff' fill-opacity='0.045'/%3E%3Ccircle cx='32' cy='32' r='2.4' fill='%23ffffff' fill-opacity='0.05'/%3E%3C/svg%3E");
}
.pattern-jali-brand {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cpath d='M32 6l6.5 19.5L58 32l-19.5 6.5L32 58l-6.5-19.5L6 32l19.5-6.5z' fill='%233A62AE' fill-opacity='0.05'/%3E%3Ccircle cx='32' cy='32' r='2.4' fill='%233A62AE' fill-opacity='0.055'/%3E%3C/svg%3E");
}

.divider-gold {
  width: 4.5rem; height: 2px; border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-400));
}

/* ---------- arched media frames ---------- */
.arch {
  border-radius: 999px 999px 22px 22px;
  overflow: hidden;
  position: relative;
}
.arch--soft { border-radius: 340px 340px 26px 26px; }
.arch-outline {
  position: absolute; inset: 0;
  border-radius: inherit;
  border: 1.5px solid rgba(201, 151, 63, .55);
  pointer-events: none;
}

/* resilient imagery: container always carries a gradient; if the photo
   fails to load it is removed and the gradient + glyph remain */
.media {
  position: relative;
  background: linear-gradient(150deg, var(--brand-300), var(--brand-600) 55%, var(--brand-800));
}
.media > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(22,35,61,0) 55%, rgba(22,35,61,.28));
  pointer-events: none;
}
.media--plain::after { display: none; }

/* ---------- cards ---------- */
.card {
  background: #fff;
  border: 1px solid #E7E3D8;
  border-radius: 22px;
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out), border-color .25s var(--ease-out);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 48px -28px rgba(33, 52, 90, .28);
  border-color: var(--brand-200);
}

.icon-tile {
  display: inline-flex; align-items: center; justify-content: center;
  width: 3.25rem; height: 3.25rem; border-radius: 1rem;
  background: var(--brand-50); color: var(--brand-700);
  border: 1px solid var(--brand-100);
  flex: none;
}
.icon-tile svg { width: 1.5rem; height: 1.5rem; }
.icon-tile--gold { background: #FBF5E9; color: var(--gold-600); border-color: #F0E4C8; }

.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 3rem; height: 3rem; border-radius: 999px; flex: none;
  background: var(--brand-600); color: #fff;
  font-family: 'Marcellus', serif; font-size: 1.25rem;
}

/* ---------- stats ---------- */
.stat-value {
  font-family: 'Marcellus', serif;
  font-size: clamp(2.3rem, 4.5vw, 3.4rem);
  line-height: 1.05;
  color: var(--brand-800);
  font-variant-numeric: tabular-nums;
}

/* ---------- social buttons (footer) ---------- */
.social-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .22); color: #B9C4DC;
  transition: color .2s var(--ease-out), background-color .2s var(--ease-out), border-color .2s var(--ease-out);
}
.social-btn:hover { color: #fff; background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .45); }
.social-btn svg { width: 1.15rem; height: 1.15rem; }

/* ---------- footer ---------- */
.footer-link {
  display: block;
  color: #B9C4DC; font-size: .95rem;
  padding: .3rem 0;
  transition: color .2s var(--ease-out);
}
.footer-link:hover { color: #fff; }

/* ---------- link with animated underline ---------- */
.link-more {
  display: inline-flex; align-items: center; gap: .4rem;
  font-weight: 700; color: var(--brand-700);
  transition: color .2s var(--ease-out), gap .2s var(--ease-out);
}
.link-more:hover { color: var(--brand-900); gap: .65rem; }
.link-more svg { width: 1rem; height: 1rem; }

/* ---------- FAQ ---------- */
.faq-item { border-bottom: 1px solid #E7E3D8; }
.faq-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  cursor: pointer; list-style: none;
  padding: 1.25rem 0;
  font-weight: 700; font-size: 1.05rem; color: var(--ink);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .faq-icon {
  flex: none; width: 1.75rem; height: 1.75rem; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-50); color: var(--brand-700);
  transition: transform .25s var(--ease-out), background-color .25s var(--ease-out);
}
.faq-item[open] summary .faq-icon { transform: rotate(45deg); background: var(--brand-100); }
.faq-item .faq-body { padding: 0 0 1.35rem; color: var(--muted); line-height: 1.75; max-width: 62ch; }

/* ---------- scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- collaborations grid ---------- */
.collab-logo {
  position: relative; aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid #E7E3D8; border-radius: 18px;
  padding: 1.1rem;
  transition: box-shadow .25s var(--ease-out), border-color .25s var(--ease-out), transform .25s var(--ease-out);
}
.collab-tile:hover .collab-logo {
  border-color: var(--brand-200);
  box-shadow: 0 18px 36px -22px rgba(33, 52, 90, .28);
  transform: translateY(-3px);
}
.collab-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.collab-initials {
  display: none;
  font-family: 'Marcellus', Georgia, serif;
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  color: var(--brand-700); text-align: center; line-height: 1.25;
  padding: 0 .4rem;
}
.collab-logo.logo-missing img { display: none; }
.collab-logo.logo-missing .collab-initials { display: block; }
.collab-tile figcaption {
  margin-top: .7rem; text-align: center;
  font-size: .8rem; line-height: 1.45; color: var(--muted);
}

/* ---------- misc ---------- */
.notice-strip {
  background: #FBF5E9;
  border: 1px solid #F0E4C8;
  border-radius: 16px;
}

/* ---------- polish: cross-page fade (progressive enhancement) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }

/* ---------- polish: header slims on scroll ---------- */
#site-header > div { transition: height .28s var(--ease-out); }
#site-header.is-scrolled > div { height: 4.25rem; }

/* ---------- polish: primary button sheen ---------- */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -70%; width: 45%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .28), transparent);
  transform: skewX(-18deg);
  transition: left .5s var(--ease-out);
  pointer-events: none;
}
.btn-primary:hover::after { left: 125%; }

/* ---------- polish: card hover lights up its icon ---------- */
.icon-tile { transition: background-color .3s var(--ease-out), color .3s var(--ease-out), border-color .3s var(--ease-out); }
.card:hover > .icon-tile:not(.icon-tile--gold) { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }

/* ---------- polish: gallery image zoom ---------- */
.media--plain img { transition: transform .6s var(--ease-out); }
figure:hover .media--plain img { transform: scale(1.05); }

/* ---------- polish: arch images settle in with a soft scale ---------- */
.reveal .arch img { transform: scale(1.045); transition: transform 1.1s var(--ease-out); }
.reveal.is-visible .arch img { transform: scale(1); }

/* ---------- polish: dropdown panel animates open ---------- */
.nav-drop-panel {
  visibility: hidden; opacity: 0;
  transform: translateX(-50%) translateY(8px);
  pointer-events: none;
  transition: opacity .22s var(--ease-out), transform .22s var(--ease-out), visibility 0s linear .22s;
}
.nav-dropdown.open .nav-drop-panel {
  visibility: visible; opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
  transition-delay: 0s;
}

/* ---------- polish: gold divider draws itself ---------- */
@keyframes growLine { from { width: 0; } to { width: 4.5rem; } }
.reveal.is-visible .divider-gold { animation: growLine .8s .25s var(--ease-out) both; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .card, .nav-link::after, .link-more { transition: none; }
  .btn:active { transform: none; }
  .card:hover { transform: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  #site-header > div { transition: none; }
  .btn-primary::after { display: none; }
  .media--plain img, .reveal .arch img { transition: none; transform: none; }
  .reveal.is-visible .divider-gold { animation: none; }
  .nav-drop-panel { transition: none; }
  .arch { transform: none !important; }
}
