/* ABLAQ
   A masjid with history, built in stone rather than gradients.

   Nav behaviour: absent on arrival so the full-screen hero owns the viewport,
   then slides in once you are past it and reverses on scroll-up.

   Instrument Serif for display gives an editorial, printed feel that Fraunces
   (Meridian) does not, so the two never read as the same site recoloured.
   Warm limestone and oxide red, sourced from ablaq masonry. Deliberately not
   green and gold, which is the category reflex every masjid template reaches
   for. */

:root {
  --cream: #F5F1EA;
  --raised: #FBF9F5;
  --stone: #221F1C;
  --ink: #1A1714;      /* 15.4 on cream */
  --body: #4C443D;     /* 8.1 */
  --muted: #6E645A;    /* 4.9 */
  --line: #E0D8CB;
  --rust: #A8442F;     /* 5.4 on cream */
  --rust-dk: #8C3625;
  --rust-lt: #F6EAE6;
  --sand: #C9A227;

  --sh-sm: 0 1px 2px rgba(26,23,20,.06);
  --sh-md: 0 12px 34px -14px rgba(26,23,20,.22);
  --sh-lg: 0 30px 74px -26px rgba(26,23,20,.36);
  --ease: cubic-bezier(.22,1,.36,1);
  --wrap: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body { margin: 0; background: var(--cream); color: var(--body); font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: 17px; line-height: 1.7; -webkit-font-smoothing: antialiased; }

h1, h2, h3 { color: var(--ink); margin: 0; font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; text-wrap: balance; }
h1 { font-size: clamp(44px, 6.4vw, 92px); line-height: 1.02; letter-spacing: -.02em; }
h2 { font-size: clamp(30px, 3.8vw, 54px); line-height: 1.08; letter-spacing: -.015em; }
h3 { font-family: Inter, sans-serif; font-size: 20px; font-weight: 600; line-height: 1.35; }
p { margin: 0; }
a { color: var(--rust-dk); }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--rust); outline-offset: 3px; }
.band--stone :focus-visible, .band--rust :focus-visible, .hero :focus-visible { outline-color: var(--cream); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 300; background: var(--ink); color: var(--cream); padding: 12px 18px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(20px, 4vw, 40px); }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: rgba(245,241,234,.65); margin-bottom: 16px; }
.eyebrow--dark { color: var(--rust); }

.preview-flag { position: fixed; bottom: 14px; right: 14px; z-index: 200; background: rgba(26,23,20,.9); color: var(--cream); backdrop-filter: blur(8px); font-size: 11.5px; padding: 7px 13px; }

/* ---------------- Nav: absent, then reveals ---------------- */

.nav { position: fixed; inset: 0 0 auto 0; z-index: 100; background: rgba(245,241,234,.94); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); transform: translateY(-100%); transition: transform .42s var(--ease); }
.nav.is-on { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .nav { transition: none; } }

.nav-in { max-width: var(--wrap); margin: 0 auto; height: 74px; display: flex; align-items: center; gap: 30px; padding: 0 clamp(20px, 4vw, 40px); }
.wordmark { display: flex; flex-direction: column; line-height: 1.12; text-decoration: none; }
.wm-en { font-family: 'Instrument Serif', serif; font-size: 22px; color: var(--ink); }
.wm-ar { font-family: Amiri, serif; font-size: 13px; color: var(--muted); }
.nav-links { display: flex; gap: 26px; margin-left: 12px; }
.nav-links a { color: var(--body); text-decoration: none; font-size: 15px; font-weight: 500; }
.nav-links a:hover { color: var(--rust-dk); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.nav-prayer { display: flex; align-items: baseline; gap: 8px; font-size: 14px; color: var(--muted); }
.nav-prayer b { color: var(--rust); font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; height: 46px; padding: 0 24px; border-radius: 2px; font-size: 15px; font-weight: 600; text-decoration: none; border: 0; cursor: pointer; font-family: inherit; transition: background .2s, color .2s, transform .18s var(--ease); }
.btn:hover { transform: translateY(-1px); }
.btn--lg { height: 56px; padding: 0 30px; font-size: 16px; }
.btn--rust { background: var(--rust); color: var(--cream); }
.btn--rust:hover { background: var(--rust-dk); }
.btn--ghost { background: transparent; color: var(--cream); box-shadow: inset 0 0 0 1px rgba(245,241,234,.5); }
.btn--ghost:hover { background: rgba(245,241,234,.12); }

.burger { display: none; width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; flex-direction: column; justify-content: center; gap: 6px; padding: 0 10px; }
.burger span { height: 2px; background: var(--ink); }
.drawer { position: fixed; inset: 74px 0 0 0; z-index: 99; background: var(--cream); padding: 26px clamp(20px,4vw,40px); display: flex; flex-direction: column; gap: 2px; }
.drawer[hidden] { display: none; }
@media (min-width: 861px) { .drawer { display: none !important; } }
.drawer a { font-family: 'Instrument Serif', serif; font-size: 30px; color: var(--ink); text-decoration: none; padding: 13px 0; border-bottom: 1px solid var(--line); }
.drawer .btn { margin-top: 22px; align-self: flex-start; border-bottom: 0; font-family: Inter, sans-serif; font-size: 15px; color: var(--cream); }

/* ---------------- Full-screen hero ---------------- */

.hero { position: relative; min-height: 100svh; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(26,23,20,.58) 0%, rgba(26,23,20,.40) 42%, rgba(26,23,20,.88) 100%); }
.hero-center { position: relative; text-align: center; padding-bottom: 120px; }
.hero-since { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: rgba(245,241,234,.7); margin-bottom: 24px; }
.hero h1 { color: var(--cream); }
.hero-center p { margin: 26px auto 0; max-width: 56ch; font-size: 19px; color: rgba(245,241,234,.85); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 36px; }

.hero-bar { position: absolute; inset: auto 0 0 0; background: rgba(26,23,20,.55); backdrop-filter: blur(14px); border-top: 1px solid rgba(245,241,234,.16); }
.hero-bar-in { display: flex; align-items: center; gap: 28px; height: 84px; }
.hb-next { display: flex; align-items: baseline; gap: 12px; }
.hb-label { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: rgba(245,241,234,.55); }
.hb-name { font-family: 'Instrument Serif', serif; font-size: 24px; color: var(--cream); }
.hb-time { font-size: 22px; font-weight: 600; color: var(--cream); }
.hb-count { font-size: 14px; color: rgba(245,241,234,.6); }
.hb-meta { margin-left: auto; display: flex; gap: 24px; font-size: 13.5px; color: rgba(245,241,234,.6); }
.hb-scroll { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(245,241,234,.3); display: grid; place-items: center; }
.hb-scroll span { width: 8px; height: 8px; border-right: 1.5px solid var(--cream); border-bottom: 1.5px solid var(--cream); transform: rotate(45deg) translate(-2px,-2px); }
.hb-scroll:hover { background: rgba(245,241,234,.12); }

/* ---------------- Bands ---------------- */

.band { padding: clamp(84px, 10vw, 148px) 0; }
.band--cream { background: var(--cream); }
.band--raised { background: var(--raised); }
.band--stone { background: var(--stone); color: rgba(245,241,234,.78); }
.band--stone h2 { color: var(--cream); }
.band--rust { background: var(--rust); color: rgba(245,241,234,.88); }
.band--rust h2 { color: var(--cream); }

.sec-head { max-width: 640px; margin-bottom: 52px; }
.sec-head--row { max-width: none; display: flex; align-items: end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.link-arrow { font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; }
.link-arrow::after { content: ' →'; }
.band--stone .link-arrow { color: #E0A98F; }

[data-reveal] { opacity: 0; transform: translateY(20px); transition: opacity .75s var(--ease), transform .75s var(--ease); }
[data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { [data-reveal] { opacity: 1; transform: none; transition: none; } }

/* Prayer table */
.prayer-wrap { border-top: 1px solid rgba(245,241,234,.16); }
.pt-table { width: 100%; border-collapse: collapse; }
.pt-table thead { display: none; }
.pt-table tbody th { text-align: left; font-weight: 400; padding: 22px 0; border-bottom: 1px solid rgba(245,241,234,.12); }
.pt-table tbody td { text-align: right; padding: 22px 0 22px 28px; border-bottom: 1px solid rgba(245,241,234,.12); font-size: 19px; color: rgba(245,241,234,.6); font-variant-numeric: tabular-nums; }
.pt-table tbody td:last-child { color: var(--cream); font-size: 24px; }
.pt-name { font-family: 'Instrument Serif', serif; font-size: 30px; color: var(--cream); }
.pt-ar { display: inline-block; font-family: Amiri, serif; font-size: 15px; color: rgba(245,241,234,.4); margin-left: 12px; }
.pt-table tr.is-next th, .pt-table tr.is-next td { background: rgba(245,241,234,.06); }
.pt-table tr.is-next .pt-name { color: #E8A88C; }
.prayer-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding-top: 26px; font-size: 15px; color: rgba(245,241,234,.6); }

/* Story */
.story-grid { display: grid; grid-template-columns: minmax(0,5fr) minmax(0,7fr); gap: 64px; align-items: start; }
.story-media img { width: 100%; aspect-ratio: 4/5; object-fit: cover; }
.story-copy p { margin-top: 18px; font-size: 17.5px; }
.sig { margin-top: 28px; }
.sig-name { display: block; font-family: 'Instrument Serif', serif; font-size: 22px; color: var(--ink); }
.sig-role { font-size: 14px; color: var(--muted); }
.facts { display: flex; flex-wrap: wrap; gap: 0; margin: 36px 0 0; border-top: 1px solid var(--line); }
.facts > div { padding: 20px 32px 0 0; }
.facts dt { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 6px 0 0; font-family: 'Instrument Serif', serif; font-size: 28px; color: var(--ink); }

/* Programs widget */
.pg-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 26px; }
.pg-card { background: var(--raised); border: 1px solid var(--line); padding: 26px; display: flex; flex-direction: column; }
.pg-status { display: inline-flex; padding: 4px 10px; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.pg-status--open { background: var(--rust-lt); color: var(--rust-dk); }
.pg-status--waitlist { background: #F0E7D2; color: #7A6210; }
.pg-title { font-family: 'Instrument Serif', serif; font-size: 26px; font-weight: 400; color: var(--ink); margin-top: 14px; }
.pg-desc { margin-top: 8px; font-size: 15.5px; color: var(--muted); flex: 1; }
.pg-meta { margin: 18px 0 0; display: grid; gap: 8px; }
.pg-meta div { display: flex; gap: 12px; font-size: 14.5px; border-top: 1px solid var(--line); padding-top: 8px; }
.pg-meta dt { color: var(--muted); width: 44px; flex-shrink: 0; }
.pg-meta dd { margin: 0; color: var(--ink); }
.pg-btn { margin-top: 18px; display: inline-flex; align-items: center; justify-content: center; height: 44px; background: var(--rust); color: var(--cream); font-size: 14.5px; font-weight: 600; text-decoration: none; transition: background .2s; }
.pg-btn:hover { background: var(--rust-dk); }

/* Services list */
.svc-list { border-top: 1px solid var(--line); }
.svc-row { display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 28px; padding: 26px 0; border-bottom: 1px solid var(--line); }
.svc-row h3 { font-family: 'Instrument Serif', serif; font-size: 26px; font-weight: 400; }
.svc-row p { font-size: 16px; color: var(--muted); max-width: 62ch; align-self: center; }

/* Gallery */
.gal { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.gal-item { margin: 0; overflow: hidden; }
.gal-item img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4/3; transition: transform .6s var(--ease); }
.gal-item:hover img { transform: scale(1.04); }
.gal-item:nth-child(1) { grid-column: span 2; }
.gal-item:nth-child(1) img { aspect-ratio: 8/3.9; }
.gal-item:nth-child(6) { grid-column: span 2; }
.gal-item:nth-child(6) img { aspect-ratio: 8/3.9; }

/* Events */
.ev-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 26px; }
.ev-card { background: var(--cream); border: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.ev-card:hover { transform: translateY(-3px); box-shadow: var(--sh-md); }
.ev-media { position: relative; aspect-ratio: 16/10; overflow: hidden; }
.ev-media img { width: 100%; height: 100%; object-fit: cover; }
.ev-date { position: absolute; left: 0; top: 0; background: var(--rust); color: var(--cream); padding: 10px 14px; text-align: center; line-height: 1; }
.ev-date b { display: block; font-family: 'Instrument Serif', serif; font-size: 22px; }
.ev-date i { font-style: normal; font-size: 10.5px; letter-spacing: .1em; opacity: .8; }
.ev-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.ev-tag { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--rust); }
.ev-title { margin: 8px 0 6px; font-family: 'Instrument Serif', serif; font-size: 23px; font-weight: 400; color: var(--ink); }
.ev-meta { font-size: 14.5px; color: var(--muted); }
.ev-foot { margin-top: auto; padding-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ev-price { font-size: 15px; font-weight: 600; color: var(--ink); }
.ev-btn { height: 40px; padding: 0 18px; border-radius: 2px; border: 1px solid var(--line); background: var(--raised); color: var(--ink); font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; transition: background .2s, color .2s, border-color .2s; }
.ev-btn:hover { background: var(--rust); color: var(--cream); border-color: var(--rust); }
.ev-btn.is-done { background: var(--rust-lt); color: var(--rust-dk); border-color: transparent; cursor: default; }

/* Give */
.give-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,450px); gap: 64px; align-items: center; }
.give-copy p { margin-top: 18px; max-width: 46ch; font-size: 17.5px; }
.give-points { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.give-points li { position: relative; padding-left: 24px; font-size: 15.5px; }
.give-points li::before { content: ''; position: absolute; left: 0; top: 10px; width: 9px; height: 1.5px; background: rgba(245,241,234,.7); }

.give-card { background: var(--raised); padding: 30px; color: var(--body); box-shadow: var(--sh-lg); }
.dn-progress { margin-bottom: 24px; }
.dn-bar { height: 6px; background: var(--line); overflow: hidden; }
.dn-bar i { display: block; height: 100%; background: var(--rust); transition: width 1.1s var(--ease); }
.dn-figures { display: flex; align-items: baseline; gap: 8px; margin-top: 12px; }
.dn-raised { font-family: 'Instrument Serif', serif; font-size: 30px; color: var(--ink); }
.dn-goal { font-size: 14.5px; color: var(--muted); }
.dn-form { display: flex; flex-direction: column; gap: 14px; }
.dn-freq { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; background: var(--cream); }
.dn-freq button { height: 40px; border: 0; background: transparent; font: inherit; font-size: 14.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.dn-freq button.is-on { background: var(--raised); color: var(--ink); box-shadow: var(--sh-sm); }
.dn-amounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dn-amounts button { height: 48px; border: 1.5px solid var(--line); background: var(--raised); font: inherit; font-size: 15.5px; font-weight: 600; color: var(--ink); cursor: pointer; transition: border-color .2s, background .2s, color .2s; }
.dn-amounts button:hover { border-color: var(--rust); }
.dn-amounts button.is-on { border-color: var(--rust); background: var(--rust-lt); color: var(--rust-dk); }
.dn-other { grid-column: 1 / -1; }
.dn-other input { width: 100%; height: 48px; border: 1.5px solid var(--line); padding: 0 16px; font: inherit; font-size: 15.5px; color: var(--ink); background: var(--raised); }
.dn-other input:focus { outline: none; border-color: var(--rust); }
.dn-fund { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.dn-fund select { height: 48px; border: 1.5px solid var(--line); padding: 0 14px; font: inherit; font-size: 15.5px; color: var(--ink); background: var(--raised); }
.dn-fund select:focus { outline: none; border-color: var(--rust); }
.dn-submit { height: 54px; border: 0; background: var(--rust); color: var(--cream); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; transition: background .2s; }
.dn-submit:hover { background: var(--rust-dk); }
.dn-fine { font-size: 12.5px; color: var(--muted); text-align: center; }

/* Visit */
.visit-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 64px; align-items: start; }
.dl { margin: 34px 0 0; }
.dl > div { display: grid; grid-template-columns: 140px minmax(0,1fr); gap: 20px; padding: 15px 0; border-top: 1px solid var(--line); }
.dl dt { color: var(--muted); font-size: 14.5px; }
.dl dd { margin: 0; color: var(--ink); font-size: 16px; }
.visit-media img { width: 100%; aspect-ratio: 3/4; object-fit: cover; }

/* Footer */
.foot { background: var(--stone); color: rgba(245,241,234,.68); padding: 76px 0 32px; }
.foot-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; padding-bottom: 44px; border-bottom: 1px solid rgba(245,241,234,.14); }
.foot-name { font-family: 'Instrument Serif', serif; font-size: 24px; color: var(--cream); }
.foot-ar { font-family: Amiri, serif; font-size: 17px; color: rgba(245,241,234,.5); margin-top: 4px; }
.foot-since { font-size: 14px; color: rgba(245,241,234,.45); margin-top: 12px; }
.foot h4 { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: rgba(245,241,234,.45); font-weight: 600; margin: 0 0 14px; }
.foot p, .foot-grid a { font-size: 15px; color: rgba(245,241,234,.7); text-decoration: none; display: block; margin-bottom: 7px; }
.foot-grid a:hover { color: var(--cream); }
.foot-base { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding-top: 26px; font-size: 13.5px; color: rgba(245,241,234,.42); }
/* Credit is cream, never rust: rust on stone measures 2.7 and fails. */
.credit a { color: rgba(245,241,234,.7); text-decoration: underline; text-underline-offset: 3px; }
.credit a:hover { color: var(--cream); }

.uw-toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); z-index: 250; max-width: min(520px, calc(100vw - 32px)); background: var(--stone); color: var(--cream); padding: 15px 22px; font-size: 14.5px; line-height: 1.5; box-shadow: var(--sh-lg); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease), transform .3s var(--ease); }
.uw-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Monthly page */
.page-head { padding: 150px 0 60px; background: var(--stone); color: rgba(245,241,234,.78); }
.page-head h1 { color: var(--cream); font-size: clamp(38px, 5vw, 68px); }
.page-head p { margin-top: 18px; max-width: 56ch; font-size: 18px; }
.month { width: 100%; border-collapse: collapse; }
.month th { text-align: right; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 0 12px 14px; }
.month th:first-child { text-align: left; }
.month td { padding: 18px 12px; text-align: right; border-top: 1px solid var(--line); font-size: 17px; font-variant-numeric: tabular-nums; }
.month td:first-child { text-align: left; color: var(--ink); font-family: 'Instrument Serif', serif; font-size: 22px; }
.month tr.is-next td { background: var(--rust-lt); }

@media (max-width: 1024px) {
  .story-grid, .give-grid, .visit-grid { grid-template-columns: minmax(0,1fr); gap: 40px; }
  .ev-grid, .pg-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .foot-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .gal { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .gal-item, .gal-item:nth-child(1), .gal-item:nth-child(6) { grid-column: auto; }
  .gal-item img, .gal-item:nth-child(1) img, .gal-item:nth-child(6) img { aspect-ratio: 4/3; }
}
@media (max-width: 860px) {
  .nav-links, .nav-prayer { display: none; }
  .burger { display: flex; }
  .hero-bar-in { height: auto; padding-top: 16px; padding-bottom: 16px; flex-wrap: wrap; gap: 10px 20px; }
  .hb-meta { margin-left: 0; width: 100%; }
  .hb-scroll { display: none; }
  .hero-center { padding-bottom: 180px; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .ev-grid, .pg-grid, .foot-grid, .gal { grid-template-columns: minmax(0,1fr); }
  .svc-row { grid-template-columns: minmax(0,1fr); gap: 6px; }
  .dn-amounts { grid-template-columns: repeat(2, 1fr); }
  .prog { grid-template-columns: 52px minmax(0,1fr); gap: 18px; }
  .prog-link { grid-column: 2; justify-self: start; }
  .dl > div { grid-template-columns: minmax(0,1fr); gap: 3px; }
  .pt-name { font-size: 24px; }
  .pt-table tbody td { font-size: 16px; padding-left: 12px; }
  .pt-table tbody td:last-child { font-size: 20px; }
}
