/* Masjid Al-Haq. Mobile-first; system fonts only (no web-font download). Contrast ratios are checked in tests (WCAG AA). */
:root {
  --ink: #17231d;          /* body text on --paper: 15.2:1 */
  --muted: #4a5a52;        /* secondary text on --paper: 7.0:1 */
  --paper: #fbfaf6;
  --card: #ffffff;
  --line: #dcd8cc;
  --green: #0b5d3b;        /* white on green: 7.6:1 */
  --green-ink: #0b5d3b;
  --green-soft: #e8f1ec;
  --gold: #b07d1a;         /* decoration only, never text */
  --focus: #1a56db;
  --ph-bg: #fff4d6;
  --ph-ink: #6b4a00;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 16px rgb(0 0 0 / .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-ar: "Noto Naskh Arabic", "Geeza Pro", "Arabic Typesetting", "Traditional Arabic", serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e9efe9; --muted: #b5c2ba; --paper: #0f1713; --card: #16211b; --line: #2b3a32;
    --green: #0b5d3b; --green-ink: #7fd3a8; --green-soft: #183326; --focus: #8ab4ff; --ph-bg: #3a2e0c; --ph-ink: #ffe3a1;
    --shadow: none;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.0625rem/1.6 var(--font); }
img, svg, iframe { max-width: 100%; }
a { color: var(--green-ink); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 6vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 4.5vw, 1.8rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.wrap { width: min(100% - 32px, 1080px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 20; }
.skip:focus { left: 8px; }
[lang="ar"] { font-family: var(--font-ar); font-size: 1.15em; line-height: 1.5; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand svg { width: 36px; height: 36px; flex: none; }
.brand b { display: block; font-size: 1.1rem; letter-spacing: .01em; }
.brand [lang="ar"] { display: block; font-size: .95rem; color: var(--muted); line-height: 1.1; }
.nav { display: none; }
.nav a { text-decoration: none; color: var(--ink); padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.nav a[aria-current="page"] { color: var(--green-ink); background: var(--green-soft); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px;
  border-radius: 999px; border: 2px solid var(--green); background: var(--green); color: #fff; font: 600 1rem/1.2 var(--font);
  text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--green-ink); border-color: currentColor; }
.btn[disabled] { opacity: .6; cursor: wait; }
.top .btn { min-height: 44px; padding: 8px 18px; }
.menu { display: inline-flex; }
.menu summary { list-style: none; min-width: 44px; min-height: 44px; display: grid; place-items: center; cursor: pointer; border-radius: 8px; }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] .menu-panel { display: block; }
.menu-panel { display: none; position: absolute; left: 0; right: 0; top: 64px; background: var(--card); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
.menu-panel a { display: block; padding: 12px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 500; }
@media (min-width: 900px) {
  .nav { display: flex; gap: 2px; }
  .menu { display: none; }
}

/* Mobile action bar: the three things a visitor most often wants */
.actionbar { position: fixed; inset: auto 0 0 0; z-index: 10; display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.actionbar a { min-height: 56px; display: grid; place-items: center; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem; }
.actionbar a.give { background: var(--green); color: #fff; }
body { padding-bottom: 60px; }
@media (min-width: 900px) { .actionbar { display: none; } body { padding-bottom: 0; } }

/* Hero with today's prayer times */
.hero { background: var(--green); color: #fff; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; opacity: .09; pointer-events: none;
  background: url("star.svg") 0 0 / 72px 72px repeat; }
.hero .wrap { position: relative; display: grid; gap: 20px; padding: 28px 0 32px; }
.hero h1 { color: #fff; margin-bottom: .2em; }
.hero .lede { font-size: 1.05rem; opacity: .95; max-width: 34em; }
.hero a:not(.btn) { color: #fff; }
.hero .btn { background: #fff; color: var(--green); border-color: #fff; }
.hero .btn.ghost { background: transparent; color: #fff; border-color: #fff; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }
@media (min-width: 900px) { .hero .wrap { grid-template-columns: 1.1fr 1fr; align-items: center; padding: 48px 0; } }

.times { background: var(--card); color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.times h2 { font-size: 1.2rem; margin: 0; }
.times .date { color: var(--muted); font-size: .95rem; margin: 2px 0 8px; }
.times .next { font-weight: 600; color: var(--green-ink); margin: 0 0 8px; min-height: 1.6em; }
table { border-collapse: collapse; width: 100%; }
.times th, .times td { padding: 9px 6px; text-align: left; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.times thead th { font-size: .85rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.times td:last-child, .times th:last-child { text-align: right; font-weight: 700; }
.times tr.is-next { background: var(--green-soft); }
.times tr.is-next th { color: var(--green-ink); }
.times tr.muted th, .times tr.muted td { color: var(--muted); font-weight: 400; }
.jumuah { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--green-soft); }
.jumuah b { color: var(--green-ink); }
.jumuah ul { margin: 4px 0 0; padding-left: 1.1em; }
.times .note { font-size: .85rem; color: var(--muted); margin: 10px 0 0; }

/* Sections and cards */
section { padding: 36px 0; }
section.alt { background: var(--card); border-block: 1px solid var(--line); }
.grid { display: grid; gap: 16px; }
@media (min-width: 640px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid.three { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: .3em; }
.card p:last-child { margin-bottom: 0; }
.meta { color: var(--muted); font-size: .95rem; }
.empty { color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); padding: 20px; background: transparent; }
.kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700; color: var(--green-ink); margin-bottom: .4em; }
.page-head { padding: 28px 0 8px; }
.page-head p { color: var(--muted); max-width: 40em; }
.map { width: 100%; aspect-ratio: 4 / 3; border: 0; border-radius: var(--radius); background: var(--green-soft); }
.events { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.events li { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: start; }
.events .day { text-align: center; border-radius: 10px; background: var(--green-soft); color: var(--green-ink); padding: 6px 0; font-weight: 700; line-height: 1.1; }
.events .day small { display: block; font-size: .75rem; text-transform: uppercase; }

/* Placeholder: a fact only the owner can supply. Visible in preview builds; a public build refuses to render one. */
.ph { background: var(--ph-bg); color: var(--ph-ink); border: 1px dashed currentColor; border-radius: 6px; padding: 0 6px; font-weight: 600; font-size: .92em; }
.preview-banner { background: var(--ph-bg); color: var(--ph-ink); text-align: center; padding: 8px 16px; font-size: .9rem; font-weight: 600; }

/* Donate */
.donate { display: grid; gap: 22px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 700; font-size: 1.05rem; margin-bottom: 10px; padding: 0; }
.choices { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
.choices.three { grid-template-columns: repeat(3, 1fr); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice span { display: block; border: 2px solid var(--line); border-radius: 12px; padding: 12px; min-height: 52px; background: var(--card);
  font-weight: 600; text-align: center; }
.choice small { display: block; font-weight: 400; color: var(--muted); font-size: .85rem; margin-top: 2px; text-align: left; }
.fund .choice span { text-align: left; }
.choice input:checked + span { border-color: var(--green); background: var(--green-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--green); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=number], input[inputmode] { width: 100%; min-height: 48px; padding: 10px 12px; border: 2px solid var(--line);
  border-radius: 10px; font: inherit; background: var(--card); color: var(--ink); }
input:focus-visible { border-color: var(--focus); }
.donate .btn { width: 100%; font-size: 1.1rem; min-height: 56px; }
.status { min-height: 1.6em; font-weight: 600; color: var(--green-ink); margin: 8px 0 0; }
.secure { font-size: .9rem; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Newsletter */
.newsletter { display: grid; gap: 10px; }
@media (min-width: 640px) { .newsletter .row { display: grid; grid-template-columns: 1fr auto; gap: 10px; } }

/* Prayer timetable */
.month { overflow-x: auto; }
.month table { min-width: 560px; font-variant-numeric: tabular-nums; font-size: .95rem; }
.month th, .month td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.month th[scope=row], .month thead th:first-child { text-align: left; }
.month tr.is-today { background: var(--green-soft); font-weight: 700; }

footer { background: #0a2a1d; color: #e6efe9; padding: 32px 0 24px; margin-top: 24px; font-size: .95rem; }
footer a { color: #fff; }
footer .grid { gap: 20px; }
footer .small { color: #b9cbc1; font-size: .85rem; margin-top: 18px; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
@media print {
  .top, .actionbar, footer, .cta, .preview-banner, .no-print { display: none !important; }
  body { padding: 0; background: #fff; color: #000; }
  .month table { min-width: 0; }
}

/* Campaigns */
.goal { margin: 6px 0 14px; }
.tag { display: inline-block; padding: 1px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green-ink); font-weight: 600; font-size: .85rem; }
.card.campaign { display: flex; flex-direction: column; }
.card.campaign .btn { margin-top: auto; align-self: flex-start; }
.card.campaign h3 a { color: inherit; text-decoration: none; }
.card.campaign h3 a:hover { text-decoration: underline; }
