/* ==========================================================================
   The Haq Foundation
   Palette drawn from Afghan lapis lazuli and illuminated manuscripts:
   deep ultramarine flecked with pyrite gold, on warm manuscript paper.
   ========================================================================== */

:root {
  --lapis-deep: #141c4d;
  --lapis: #21308f;
  --gold: #c6a14b;
  --gold-bright: #e3c47c;
  --paper: #f7f1e3;
  --paper-deep: #efe6d1;
  --ink: #23222b;
  --ink-soft: #55524e;

  --font-display: "Alegreya", Georgia, serif;
  --font-body: "Alegreya Sans", "Helvetica Neue", sans-serif;
  --font-script: "Noto Nastaliq Urdu", serif;

  --measure: 38rem;
  --pad-x: clamp(1.25rem, 5vw, 4rem);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  overflow-x: clip;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.12;
  font-weight: 800;
}

h2 { font-size: clamp(2rem, 4.5vw, 3rem); margin-bottom: 1.25rem; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.eyebrow {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--lapis);
  margin-bottom: 0.75rem;
}

/* Lapis field: ultramarine ground with faint pyrite flecks,
   the way gold pyrite sits in raw lapis stone. */
.lapis-field {
  background-color: var(--lapis-deep);
  background-image:
    radial-gradient(circle at 12% 28%, rgba(227, 196, 124, 0.20) 0 1px, transparent 1.6px),
    radial-gradient(circle at 67% 11%, rgba(227, 196, 124, 0.14) 0 1px, transparent 1.6px),
    radial-gradient(circle at 41% 63%, rgba(227, 196, 124, 0.17) 0 1px, transparent 1.6px),
    radial-gradient(circle at 88% 79%, rgba(227, 196, 124, 0.12) 0 1px, transparent 1.6px),
    radial-gradient(circle at 24% 88%, rgba(227, 196, 124, 0.15) 0 1px, transparent 1.6px),
    radial-gradient(circle at 79% 44%, rgba(227, 196, 124, 0.11) 0 1.4px, transparent 2px),
    radial-gradient(ellipse at 50% 0%, #2a3a9c 0%, transparent 62%);
  background-size: 190px 190px, 230px 230px, 170px 170px, 260px 260px, 210px 210px, 320px 320px, 100% 100%;
  color: var(--paper);
}

/* ---------- Header ---------- */

.site-header {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem var(--pad-x);
  color: var(--paper);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: 0.01em;
}

.star-mark {
  width: 1.05rem;
  height: 1.05rem;
  fill: var(--gold-bright);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2.5vw, 1.75rem);
  font-weight: 500;
  font-size: 0.9375rem;
}

.site-nav a {
  text-decoration: none;
  opacity: 0.85;
}
.site-nav a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }

.site-nav .nav-donate {
  opacity: 1;
  padding: 0.4rem 1rem;
  border: 1px solid var(--gold);
  border-radius: 2rem;
  color: var(--gold-bright);
}
.site-nav .nav-donate:hover { background: var(--gold); color: var(--lapis-deep); text-decoration: none; }

/* ---------- Hero ---------- */

.hero {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1rem, 4vw, 4rem);
  padding: 7rem var(--pad-x) 4rem;
}

.hero-calligraphy {
  font-family: var(--font-script);
  font-weight: 600;
  font-size: clamp(11rem, 26vw, 24rem);
  line-height: 1;
  text-align: center;
  color: var(--gold);
  text-shadow: 0 0 90px rgba(198, 161, 75, 0.35);
  user-select: none;
  animation: rise 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero-text h1 {
  font-size: clamp(2.5rem, 5.5vw, 4.25rem);
  margin-bottom: 1.5rem;
  animation: rise 0.9s 0.25s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero-text h1 em {
  font-style: italic;
  color: var(--gold-bright);
}

.hero-sub {
  max-width: var(--measure);
  font-size: 1.25rem;
  opacity: 0.92;
  margin-bottom: 2.25rem;
  animation: rise 0.9s 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  animation: rise 0.9s 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(1.25rem); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  padding: 0.85rem 1.9rem;
  border-radius: 2.5rem;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.btn:hover { transform: translateY(-2px); }

.btn-gold {
  background: var(--gold);
  color: var(--lapis-deep);
}
.btn-gold:hover { background: var(--gold-bright); }

.btn-ghost {
  border-color: rgba(247, 241, 227, 0.5);
  color: var(--paper);
}
.btn-ghost:hover { border-color: var(--paper); }

/* ---------- The word (dictionary entry) ---------- */

.word-entry {
  padding: clamp(4rem, 9vw, 7rem) var(--pad-x);
  display: flex;
  justify-content: center;
}

.entry {
  max-width: 44rem;
  border-inline-start: 3px solid var(--gold);
  padding-inline-start: clamp(1.25rem, 4vw, 2.5rem);
}

.entry-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin-bottom: 1rem;
}

.entry-latin {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.5rem, 5vw, 3.5rem);
}

.entry-script {
  font-family: var(--font-script);
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  color: var(--lapis);
}

.entry-phonetic {
  font-style: italic;
  color: var(--ink-soft);
}

.entry-senses {
  list-style-position: inside;
  font-family: var(--font-display);
  font-size: 1.3125rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
}
.entry-senses li::marker { font-weight: 700; color: var(--lapis); }

.entry-note { color: var(--ink-soft); max-width: var(--measure); }

/* ---------- Star divider ---------- */

.star-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0 var(--pad-x);
}
.star-divider::before,
.star-divider::after {
  content: "";
  height: 1px;
  flex: 0 1 7rem;
  background: color-mix(in srgb, var(--ink) 25%, transparent);
}
.star-divider svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: var(--gold);
}

/* ---------- Why ---------- */

.why {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  padding: clamp(4rem, 9vw, 7rem) var(--pad-x);
  max-width: 72rem;
  margin: 0 auto;
}

.why-prose p {
  max-width: var(--measure);
  margin-bottom: 1.15rem;
}
.why-prose p:last-child { margin-bottom: 0; }

.ledger {
  align-self: start;
  background: var(--paper-deep);
  border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent);
  padding: 1.75rem 1.75rem 1.25rem;
}

.ledger-title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 1.25rem;
}

.ledger ul { list-style: none; }

.ledger li {
  padding: 0.85rem 0;
  border-top: 1px solid color-mix(in srgb, var(--ink) 15%, transparent);
}

.ledger strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--lapis);
  line-height: 1.1;
}

.ledger li:last-child strong { color: var(--gold); }

.ledger span { color: var(--ink-soft); font-size: 0.9375rem; }

/* ---------- Interlude ---------- */

.interlude {
  padding: clamp(4.5rem, 10vw, 8rem) var(--pad-x);
  text-align: center;
}

.interlude blockquote {
  max-width: 46rem;
  margin: 0 auto;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.375rem, 2.6vw, 1.75rem);
  line-height: 1.5;
}

.interlude-close {
  margin-top: 1.5rem;
  font-style: normal;
  font-weight: 700;
  color: var(--gold-bright);
}

/* ---------- Programs ---------- */

.programs {
  padding: clamp(4rem, 9vw, 7rem) var(--pad-x);
  max-width: 72rem;
  margin: 0 auto;
}

.program-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.25rem, 3vw, 2.5rem);
  margin-top: 2.5rem;
}

.program {
  border-top: 3px solid var(--lapis);
  padding-top: 1.25rem;
}

.program h3 {
  font-size: 1.4375rem;
  margin-bottom: 0.6rem;
}

.program p { color: var(--ink-soft); }

/* ---------- Founder ---------- */

.founder {
  padding: clamp(4rem, 9vw, 7rem) var(--pad-x);
  display: flex;
  justify-content: center;
}

.founder-inner { max-width: 44rem; }

.founder-inner p {
  max-width: var(--measure);
  margin-bottom: 1.15rem;
}

.founder-line {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--lapis);
}

.founder-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.75rem;
  font-weight: 700;
}

.founder-links a {
  color: var(--lapis);
  text-decoration-color: var(--gold);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
.founder-links a:hover { color: var(--ink); }

/* ---------- Donate ---------- */

.donate {
  padding: clamp(5rem, 11vw, 8.5rem) var(--pad-x);
  text-align: center;
}

.donate-script {
  font-family: var(--font-script);
  font-size: 3rem;
  color: var(--gold);
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.donate-sub {
  max-width: var(--measure);
  margin: 0 auto 2.25rem;
  font-size: 1.1875rem;
  opacity: 0.92;
}

.donate-note {
  margin-top: 1.5rem;
  font-size: 0.875rem;
  opacity: 0.65;
  max-width: 30rem;
  margin-inline: auto;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--paper);
  text-align: center;
  padding: 2.5rem var(--pad-x) 3rem;
  border-top: 1px solid color-mix(in srgb, var(--ink) 15%, transparent);
}

.footer-brand {
  font-family: var(--font-display);
  font-weight: 700;
}
.footer-brand span { color: var(--lapis); }

.footer-contact { margin-top: 0.4rem; }
.footer-contact a { color: var(--lapis); }

.footer-legal {
  margin-top: 0.4rem;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

/* ---------- Scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(1.25rem);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding-top: 8.5rem;
    gap: 0.5rem;
  }
  .hero-calligraphy {
    font-size: clamp(6.5rem, 28vw, 11rem);
    max-width: 100%;
  }
  .hero-actions { justify-content: center; }
  .hero-sub { margin-inline: auto; }

  .why { grid-template-columns: 1fr; }
  .program-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .site-header { flex-direction: column; gap: 0.75rem; }
  .site-nav { flex-wrap: wrap; justify-content: center; }
  .hero { padding-top: 10.5rem; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-calligraphy,
  .hero-text h1,
  .hero-sub,
  .hero-actions { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover { transform: none; }
}
