/* Dar Elsalam platform styles, following the USAB2BHub WMS UI reference.
   Rules: every colour is a token (never a raw hex in components), sizes are rem,
   light is the default, dark redefines the same tokens under :root[data-theme="dark"].
   --primary, --accent and --bg are set per site in layout.php from the admin settings. */

:root {
  --hero-a: var(--primary);
  --hero-b: color-mix(in srgb, var(--primary) 62%, #000);
  --surface: #ffffff;
  --surface-2: #f1f4ef;
  --bg: var(--bg-light, #f8f7f2);
  --block-bg: var(--block-light, #ffffff);
  --header-bg: var(--header-light, #ffffff);
  --header-text: var(--header-text-light, #172820);
  --border: #d9b44a;
  --text: #172820;
  --muted: #4f5b55;
  --brand: var(--primary);
  --brand-ink: #ffffff;
  --accent-ink: #1d1804;
  --focus: #986000;
  --ok: #18793f;   --ok-bg: #d9efe2;
  --warn: #a86b14; --warn-bg: #f8e8cb;
  --bad: #b92828;  --bad-bg: #f8dada;
  --info-bg: #dae6fb;
  --shadow-a: .4;
  --shadow: 0 1px 2px rgba(184,134,11,calc(var(--shadow-a) * .22)), 0 4px 12px rgba(184,134,11,calc(var(--shadow-a) * .18));
  --radius-card: 12px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  /* Deep green base with cream text and light gold accents. */
  --bg: #0a2219;
  --surface: #123326;
  --surface-2: #184033;
  --block-bg: var(--surface);
  --header-bg: var(--surface);
  --header-text: #f4efe0;
  --border: #2b5a48;
  --text: #f4efe0;
  --muted: #b8c9bf;
  --brand: #e2c066;
  --brand-ink: #1a1405;
  --accent: #d9b44a;
  --accent-ink: #1a1405;
  --focus: #e2c066;
  --hero-a: #0f4a36;
  --hero-b: #0a2f23;
  --ok: #6fd69a;   --ok-bg: #123a28;
  --warn: #e9c46a; --warn-bg: #3a2f12;
  --bad: #f08a8a;  --bad-bg: #3d1a1a;
  --info-bg: #17324a;
  --shadow: 0 1px 2px rgba(0,0,0,calc(var(--shadow-a) * .6)), 0 6px 18px rgba(0,0,0,calc(var(--shadow-a) * .5));
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: 100%; }
body { margin: 0; font: .9375rem/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text); background: var(--bg); transition: background-color .2s, color .2s; }
a { color: var(--brand); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }
h1, h2, h3 { line-height: 1.2; color: var(--text); margin: 0; }
h1 { font-size: 1.6rem; font-weight: 700; margin: 1.25rem 0 .5rem; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 .5rem; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: .4rem 0; }
.muted, .small { color: var(--muted); }
.small { font-size: .9rem; }
.lead { font-size: 1.05rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.inline-form { display: inline; margin: 0; }
[hidden] { display: none !important; }

/* ---- Header ---- */
.site-header { position: sticky; top: 0; z-index: 30; background: var(--header-bg); color: var(--header-text);
  border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; min-height: 3.75rem; padding: .5rem 1.25rem; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; color: var(--header-text); text-decoration: none; font-size: 1.05rem; }
.brand::before { content: ""; width: .9rem; height: .9rem; border-radius: .25rem; background: var(--brand); }
nav { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center; }
nav > a:not(.btn), .submenu summary { color: var(--header-text); font-weight: 600; text-decoration: none; padding: .35rem .15rem; }
nav > a:not(.btn):hover, .submenu summary:hover { color: var(--brand); }
.theme-toggle { min-width: 2.75rem; min-height: 2.75rem; padding: 0 .625rem; border-radius: .5rem; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: .95rem; font-weight: 700; cursor: pointer; display: inline-grid; place-items: center; }
.theme-switch { display: inline-grid; grid-template-columns: auto auto; width: auto; padding: .1875rem; }
.theme-switch .seg-btn { min-height: 2.25rem; padding: .375rem .75rem; font-weight: 600; white-space: nowrap; }
.display-menu { position: relative; }
.display-menu > summary.theme-toggle::after { content: none; }
.display-panel { right: 0; left: auto; min-width: 16rem; padding: .875rem; gap: .5rem; }
.display-panel p { margin: .25rem 0 0; }
.display-label { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.display-panel .seg { margin-top: .125rem; }
.size-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .375rem; }
.size-grid .seg-btn { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.size-grid .seg-btn.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }

.submenu { position: relative; }
.submenu summary { list-style: none; cursor: pointer; }
.submenu summary::-webkit-details-marker { display: none; }
.submenu summary::after { content: " ▾"; font-size: .8em; }
.submenu-list { position: absolute; top: 100%; left: 0; min-width: 14rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: .375rem; display: grid; z-index: 40; box-shadow: var(--shadow); }
.submenu-list a { padding: .5rem .625rem; border-radius: .5rem; text-decoration: none; color: var(--text); }
.submenu-list a:hover { background: var(--surface-2); }

/* ---- Buttons ----
   .btn is the one primary action on a block. .btn-outline / .btn-secondary are secondary,
   .btn-gold is the call-to-action (Donate), .btn-danger is for destructive confirms. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.75rem; padding: .6rem 1rem; border-radius: 8px; box-shadow: var(--shadow);
  border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap; transition: filter .15s, background-color .15s; }
.btn:hover { filter: brightness(1.08); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.btn-small { padding: .3125rem .625rem; font-size: .85rem; }
.btn-outline, .btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover, .btn-secondary:hover { border-color: var(--brand); filter: none; }
.btn-gold { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn-danger, .btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn[disabled], .btn.is-busy { opacity: .55; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: .625rem; margin-top: .75rem; align-items: center; }

/* ---- Cards and layout ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); gap: 1rem; margin: 1rem 0; }
.cards.cards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards.cards-2 .card { min-width: 0; }
.cards.cards-2 .card .big { overflow-wrap: anywhere; }

/* Keep hidden form fields hidden even inside grid layouts. */
[hidden] { display: none !important; }

/* ---- Hadith of the day box ---- */
.hadith-box { margin: 1rem 0; padding: 1rem 1.25rem; background: var(--block-bg); border: 1px solid var(--border);
  border-inline-start: 4px solid var(--accent); border-radius: var(--radius-card); box-shadow: var(--shadow); }
.hadith-label { margin: 0 0 .25rem; font-size: .8rem; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .04em; }
.hadith-ar { margin: .25rem 0; font-size: 1.35rem; line-height: 1.9; font-family: "Amiri", "Noto Naskh Arabic", serif; }
.hadith-en { margin: .25rem 0; }
.hadith-ref { margin: .25rem 0 0; font-size: .9rem; }

/* ---- Book PDFs shown in the browser (learning resources) ---- */
.pdf-embed { display: block; width: 100%; height: 480px; border: 1px solid var(--border); border-radius: 8px; margin: .5rem 0; background: var(--surface-2); }
@media (max-width: 640px) { .pdf-embed { height: 360px; } }

/* ---- Video embeds (learning resources) ---- */
.video-embed { position: relative; aspect-ratio: 16 / 9; margin: .5rem 0 .75rem; border-radius: var(--radius-card); overflow: hidden; background: #000; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---- Scrolling dates and announcements strip ---- */
.islamic-ticker {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: var(--ticker-height, 45px);
    background: var(--ticker-bg, #14284b);
    color: var(--ticker-color, #ffffff);
    font-size: var(--ticker-font, 16px);
    font-weight: var(--ticker-weight, 500);
    overflow: hidden;
    box-sizing: border-box;
}

.ticker-window {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

.ticker-track {
    display: block;
    width: max-content;
    min-width: 100%;
    white-space: nowrap;
    box-sizing: border-box;
    padding-inline-start: 100%;
    animation-duration: var(--ticker-duration, 35s);
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.ticker-track.rtl {
    animation-name: ticker-right-to-left;
}

.ticker-track.ltr {
    animation-name: ticker-right-to-left;
    animation-direction: reverse;
}

@keyframes ticker-right-to-left {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-100%);
    }
}

.islamic-ticker.pause-hover:hover .ticker-track,
.islamic-ticker.paused .ticker-track,
.islamic-ticker:focus-within .ticker-track {
    animation-play-state: paused;
}

.ticker-pause {
    background: transparent;
    color: inherit;
    border: 1px solid currentColor;
    border-radius: 5px;
    margin: 6px;
    padding: 6px 10px;
    cursor: pointer;
}

.static-text .ticker-track {
    animation: none;
    width: auto;
    padding: 10px;
    white-space: normal;
    text-align: center;
}

@media (max-width: 768px) {
    .islamic-ticker {
        font-size: 14px;
    }

    .islamic-ticker.hide-mobile {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ticker-track {
        animation: none;
        width: auto;
        padding: 10px;
        white-space: normal;
    }

    .ticker-pause {
        display: none;
    }
}

/* ---- Admin submenu (Assistance: applications and Food Assistance Program) ---- */
.tabs.subtabs { margin-top: .25rem; padding-left: 1rem; }
.tabs.subtabs a { font-size: .92rem; }

/* ---- Floating logout: last item in the stack ---- */
.float-form { margin: 0; display: contents; }
.float-logout { font-weight: 700; }
.card { background: var(--block-bg); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 1.125rem;
  box-shadow: var(--shadow); color: var(--text); text-decoration: none; }
a.card:hover { border-color: var(--brand); }
.card h3 { margin: 0 0 .375rem; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(17.5rem, 100%), 1fr)); gap: 1rem; }
.section { margin-top: 2.125rem; }
.section > h2 { margin-bottom: .625rem; }

.hero { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem; align-items: stretch;
  background: linear-gradient(135deg, var(--hero-a), var(--hero-b));
  color: #fff; border-radius: 14px; padding: 2rem; margin-top: 1.125rem; box-shadow: var(--shadow); }
.hero h1, .hero .lead, .hero .eyebrow, .hero p { color: #fff; }
.hero h1 { font-size: 1.9rem; }
.hero .eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; color: var(--accent); margin: 0 0 .25rem; font-weight: 700; }
.hero .btn-outline { color: #fff; border-color: rgba(255,255,255,.7); background: transparent; }
.hero .btn-outline:hover { background: #fff; color: var(--brand); border-color: #fff; }
.prayer-box { background: rgba(255,255,255,.14); border-radius: var(--radius-card); padding: .875rem 1rem; }
.prayer-box h2 { color: #fff; margin: 0 0 .5rem; font-size: 1.05rem; }
.prayer-box a { color: var(--accent); font-weight: 700; }
.prayer-item { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .25rem .75rem; padding: .5rem 0; border-bottom: 1px solid rgba(255,255,255,.2); }
.pt-name { font-weight: 700; min-width: 5.5rem; }
.pt-times { display: flex; gap: 1.1rem; align-items: flex-end; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.pt-times small { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; opacity: .8; }
/* Adhan (call to prayer): the large, bold time. */
.pt-adhan { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.pt-adhan strong { font-size: 1.45rem; font-weight: 800; color: #fff; }
/* Iqamah (start in the mosque): a smaller, lighter time below its own label. */
.pt-iqamah { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.pt-iqamah span { font-size: 1rem; font-weight: 600; color: var(--accent); }
.pt-legend { font-size: .85rem; opacity: .85; margin: 0 0 .5rem; color: #fff; }
.about { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.125rem; align-items: start; }
.give-box { background: var(--block-bg); border: 1px solid var(--accent); border-radius: var(--radius-card); padding: 1.125rem; box-shadow: var(--shadow); }
.give-box h2 { margin-top: 0; }
.notice { border-left: 4px solid var(--accent); }
.chip { display: inline-block; border: 1px solid var(--accent); border-radius: 999px; padding: .125rem .625rem; margin: .125rem; font-weight: 700; }

.footer-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; padding-bottom: .625rem; }
.footer-col { min-width: 0; display: flex; flex-direction: column; gap: .25rem; }
.footer-col > p { margin: 0; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.footer-links a { color: var(--text); text-decoration: none; }
.footer-links a:hover { color: var(--brand); text-decoration: underline; }
.footer-title { font-weight: 800; color: var(--text); margin: 0 0 .375rem; }
.site-footer { margin-top: 2.5rem; padding: 1.25rem 0; background: var(--surface); border-top: 1px solid var(--border); font-size: .9rem; }
.site-footer a { color: var(--brand); }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; border-top: 1px solid var(--border); padding-top: .75rem; }

/* ---- Alerts and badges ---- */
.alert { padding: .625rem .875rem; border-radius: 8px; margin: .75rem 0; border: 1px solid transparent; box-shadow: var(--shadow); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-bad { background: var(--bad-bg); color: var(--bad); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.badge { display: inline-block; background: var(--surface-2); color: var(--text); border-radius: 999px; padding: .125rem .5625rem;
  font-size: .78rem; font-weight: 600; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--brand); }
.reply { background: var(--surface-2); padding: .5rem .625rem; border-radius: 8px; }
.empty-state { padding: 1rem; border: 1px dashed var(--border); border-radius: var(--radius-card); color: var(--muted); text-align: center; }

/* ---- Forms ---- */
.form { display: grid; gap: .875rem; max-width: 40rem; }
.form label, label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .25rem; }
.form label { display: grid; gap: .25rem; }
.form label.inline { display: flex; align-items: center; gap: .5rem; font-weight: 400; font-size: .95rem; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: .5625rem .6875rem; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
input[type=color] { padding: .25rem; height: 2.5rem; }
input[aria-invalid=true], .has-error input, .has-error select, .has-error textarea { border-color: var(--bad); }
.form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: .375rem; }
.field-error { display: block; color: var(--bad); font-size: .8rem; font-weight: 600; margin-top: .25rem; }
.help { color: var(--muted); font-size: .85rem; margin: .125rem 0 0; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--surface); }
th, td { text-align: left; padding: .625rem .875rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child > td { border-bottom: 0; }
th { background: var(--surface-2); color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table-wrap table td:first-child a { color: var(--brand); font-weight: 600; }

/* ---- Tabs ---- */
.tabs { display: flex; flex-wrap: wrap; gap: .375rem; margin: .875rem 0; border-bottom: 1px solid var(--border); }
.tabs a { padding: .5rem .75rem; text-decoration: none; color: var(--text); border-bottom: 3px solid transparent; font-weight: 600; }
.tabs a.active { color: var(--brand); border-color: var(--accent); }

/* ---- Gift popup (donation) ---- */
.gift-modal { border: 0; padding: 0; width: min(56rem, 96vw); background: transparent; color: var(--text); overflow: visible; }
.gift-modal::backdrop { background: rgba(10, 16, 30, .45); }
.gift-grid { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden; box-shadow: 0 1.25rem 3.75rem rgba(0,0,0,.35); }
.gift-art { display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); }
.gift-banner { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); min-height: 14rem; padding: 20px; display: flex; flex-direction: column; justify-content: center; }
.gift-line1 { font-size: 3.2rem; font-weight: 800; line-height: 1; color: color-mix(in srgb, var(--accent) 70%, var(--text)); letter-spacing: -.01em; }
.gift-line2 { font-size: 2.25rem; font-weight: 800; line-height: 1.1; color: var(--accent); margin-top: .375rem; overflow-wrap: anywhere; }
.gift-info { padding: 20px; border-top: 1px solid var(--border); }
.gift-info h2 { margin: 0 0 .25rem; font-size: 1.25rem; color: var(--text); }
.gift-info p { margin: 0 0 .375rem; }
.gift-form { padding: 20px; border-left: 1px solid var(--border); display: grid; gap: .75rem; align-content: start; background: var(--surface-2); }
.gift-head { font-weight: 700; font-size: 1.05rem; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: .25rem; }
.seg-btn { border: 0; background: transparent; padding: .5625rem; border-radius: 8px; font: inherit; cursor: pointer; color: var(--muted); }
.seg-btn.on { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: var(--shadow); }
.label { font-weight: 600; margin: .25rem 0 0; color: var(--muted); }
.amt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .625rem; }
.amt-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: .875rem; font: inherit; font-size: 1.05rem; cursor: pointer; color: var(--text); }
.amt-btn:hover { border-color: var(--accent); }
.amt-btn.on { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); font-weight: 700; }
.custom-amt { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--border); border-radius: 10px; padding: .625rem .75rem; background: var(--surface); }
.custom-amt input { border: 0; flex: 1; padding: 0; min-width: 0; background: transparent; }
.gift-form select { padding: .75rem; border-radius: 10px; }
.gift-next { margin-top: .5rem; background: var(--accent); color: var(--accent-ink); border: 0; padding: .875rem; border-radius: 12px; font: inherit; font-weight: 800; cursor: pointer; font-size: 1.05rem; }
.gift-next:hover { filter: brightness(1.05); }
.gift-close-form { position: absolute; top: .625rem; right: .625rem; margin: 0; z-index: 2; }
.gift-close { width: 2.375rem; height: 2.375rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--text); }

/* ---- Events, donations report, progress ---- */
.month { margin-top: 1.625rem; }
.event { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; background: var(--block-bg); border: 1px solid var(--border); border-radius: var(--radius-card); padding: .875rem; margin-bottom: .75rem; box-shadow: var(--shadow); }
.event-date { background: var(--brand); color: var(--brand-ink); border-radius: 10px; text-align: center; padding: .625rem .375rem; font-weight: 700; }
.event-date span { display: block; font-size: 1.7rem; line-height: 1; }
.event h3 { margin: 0 0 .25rem; }
.event p { margin: .25rem 0; }
.progress { height: .625rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: .5rem 0 .25rem; }
.progress span { display: block; height: 100%; background: var(--accent); }
.report-stats { display: flex; gap: 1.75rem; flex-wrap: wrap; margin: .625rem 0 1rem; }
.report-stats strong { display: block; font-size: 1.7rem; color: var(--brand); font-variant-numeric: tabular-nums; }
.tile { text-decoration: none; color: inherit; display: grid; gap: .25rem; }
.tile strong { font-size: 1.6rem; color: var(--brand); }

/* ---- Banners ---- */
.banner { display: block; margin: 0 0 1.125rem; border-radius: var(--radius-card); overflow: hidden; position: relative; background: var(--surface); border: 1px solid var(--border); aspect-ratio: 1460 / 700; }
.banner img { display: block; width: 100%; height: 100%; object-fit: cover; }
.banner-title { position: absolute; left: 0; bottom: 0; background: rgba(0,0,0,.6); color: #fff; padding: .5rem .875rem; font-weight: 700; width: 100%; }
.banner-thumb { width: 100%; height: 7.5rem; object-fit: cover; border-radius: 8px; }

/* ---- Phones (under 800px and 700px) ---- */
@media (max-width: 800px) {
  .hero, .about { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  input, select, textarea { font-size: 1rem; min-height: 2.75rem; }
  .btn { width: 100%; }
  .bar { flex-direction: column; align-items: flex-start; }
  .hero { padding: 1.25rem; }
  .hero h1 { font-size: 1.5rem; }
  .gift-grid { grid-template-columns: 1fr; max-height: 92vh; overflow-y: auto; }
  .gift-banner { min-height: 8.75rem; padding: 20px; }
  .gift-line1 { font-size: 2.2rem; }
  .gift-line2 { font-size: 1.6rem; }
  .gift-art, .gift-form { border-left: 0; border-right: 0; }
  .gift-form { padding: 20px; }
  .event { grid-template-columns: 1fr; }
  th, td { padding: .5rem .625rem; }
}
@media print {
  .site-header, .site-footer, .submenu-list, .gift-modal, .theme-toggle { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ---- Navigation: top bar (default) and sidebar ---- */
.site-nav { display: flex; flex-wrap: wrap; gap: .25rem .9rem; align-items: center; }
.nav-donate { color: var(--brand) !important; font-weight: 700; box-shadow: inset 0 -3px 0 var(--accent); }
.app-shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }
.side-nav { position: sticky; top: 0; height: 100vh; overflow-y: auto; border-bottom: 0; border-right: 1px solid var(--border); box-shadow: none; padding: 1rem .75rem; }
.side-brand { padding: .25rem .5rem 1rem; }
.side-nav .site-nav { flex-direction: column; align-items: stretch; gap: .125rem; }
.side-nav .site-nav > a, .side-nav .submenu summary { display: block; padding: .5rem .625rem; border-radius: 8px; }
.side-nav .site-nav > a:hover, .side-nav .submenu summary:hover { background: var(--surface-2); }
.side-nav .submenu-list { position: static; box-shadow: none; border: 0; padding: 0 0 0 .75rem; }
.side-nav .nav-donate { box-shadow: none; background: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 8px; }
.page-col { min-width: 0; }
.has-topbar .page-col { min-width: 0; }

/* ---- Floating controls: Light / Dark, text size and Staff ---- */
.float-controls { position: fixed; right: 1rem; bottom: 1rem; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; }
.float-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; min-width: 2.75rem; padding: .5rem .9rem;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  font-size: .9rem; text-decoration: none; cursor: pointer; box-shadow: var(--shadow); list-style: none; }
.float-btn:hover { border-color: var(--brand); }
.float-btn::-webkit-details-marker { display: none; }
.float-theme { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.float-staff { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.float-menu { position: relative; }
.float-menu > summary.float-btn { user-select: none; }
.float-panel { position: absolute; right: 0; bottom: calc(100% + .5rem); width: 15rem; padding: .875rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow); display: grid; gap: .5rem; }
.float-panel .display-label { margin: 0; }
.float-panel .size-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .375rem; }
.float-panel .seg-btn { background: var(--surface); border: 1px solid var(--border); color: var(--text); min-height: 2.5rem; padding: .375rem .5rem; }
.float-panel .seg-btn.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
body.has-topbar, body.has-sidebar { padding-bottom: 0; }

/* ---- Page banners (rotating, three photos per page) ---- */
.pbanner { position: relative; display: grid; overflow: hidden; margin: 1rem 0 1.125rem; border-radius: var(--radius-card); background: var(--surface-2); box-shadow: var(--shadow);
  transition: height .4s ease; }
.pb-slide { grid-area: 1 / 1; height: 100%; margin: 0; opacity: 0; transition: opacity var(--trms, 800ms) ease, transform var(--trms, 800ms) ease; }
.pb-slide img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pb-slide.pb-auto { height: auto; }
.pb-slide.pb-auto img { height: auto; }
.pb-slide[data-tr="slide_left"] { transform: translateX(100%); }
.pb-slide[data-tr="slide_right"] { transform: translateX(-100%); }
.pb-slide[data-tr="zoom_in"] { transform: scale(.85); }
.pb-slide[data-tr="zoom_out"] { transform: scale(1.15); }
.pb-slide.is-on { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .pb-slide, .pbanner { transition: none; } }

/* ---- Banners screen and settings screen ---- */
.banner-page { margin-top: 1rem; }
.banner-slot { border: 1px solid var(--border); border-radius: 10px; padding: 1rem; margin: 0 0 .875rem; display: grid; gap: .625rem; min-width: 0; }
.banner-slot legend { font-weight: 700; padding: 0 .375rem; }
.banner-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(12rem, 100%), 1fr)); gap: .75rem; }
.banner-slot .banner-thumb { width: 100%; max-width: 24rem; height: auto; aspect-ratio: 1460 / 700; object-fit: cover; }
.preset-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.preset-chip { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid var(--border); border-radius: 999px; padding: .4rem .75rem; cursor: pointer; font-weight: 600; margin: 0; }
.preset-chip input { width: auto; }
.preset-chip:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.swatch-pair { display: inline-block; width: 2.5rem; height: 1.25rem; border-radius: 999px;
  background: linear-gradient(90deg, var(--a) 0 45%, var(--b) 45% 70%, var(--c) 70%); border: 1px solid var(--border); }
.colour-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr)); gap: .75rem; }
.colour-card { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "text pick" "hex hex"; gap: .5rem .75rem; align-items: center;
  border: 1px solid var(--border); border-radius: 10px; padding: .75rem; }
.colour-text { grid-area: text; display: grid; gap: .125rem; }
.colour-text strong { font-size: .95rem; }
.colour-pick { grid-area: pick; width: 2.75rem; height: 2.75rem; padding: .125rem; cursor: pointer; }
.colour-hex { grid-area: hex; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.settings-actions { margin-top: .25rem; }
.settings-form { max-width: none; }

@media (max-width: 800px) {
  .app-shell { grid-template-columns: 1fr; }
  .side-nav { position: sticky; height: auto; max-height: 40vh; border-right: 0; border-bottom: 1px solid var(--border); padding: .5rem .75rem; }
  .side-nav .site-nav { flex-direction: row; flex-wrap: wrap; }
  .side-nav .submenu-list { position: absolute; }
}
@media (max-width: 700px) {
  body { padding-bottom: 5.5rem; }
  .float-controls { right: .75rem; bottom: .75rem; }
  .float-panel { width: min(15rem, calc(100vw - 2rem)); }
  .float-btn { min-height: 2.75rem; }
  .float-theme, .float-staff, .float-menu > summary.float-btn { width: auto; }
  .site-nav { gap: .25rem .75rem; }
}

.range-out { font-weight: 700; color: var(--brand); margin-left: .5rem; }
.staff-tools { justify-content: flex-end; margin-bottom: .5rem; }
input[type=range] { width: 100%; accent-color: var(--brand); padding: 0; }

/* New Muslims and seekers page */
.big { font-size: 1.6rem; font-weight: 800; margin: .25rem 0 0; }
.footer-logo { margin: .5rem 0 .75rem; }
.footer-logo img { display: block; height: 48px; width: auto; max-width: 100%; }
.welcome-hero { display: grid; gap: 20px; align-items: center; margin-bottom: 24px; }
.welcome-banner { display: block; width: 100%; height: auto; aspect-ratio: 1600 / 700; border-radius: var(--radius, 12px); box-shadow: var(--shadow); }
.welcome-text h1 { margin: 4px 0 10px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 600; color: var(--brand); margin: 0; }
.path-steps { padding-left: 1.25rem; margin: 0; display: grid; gap: 10px; }
.path-steps li { line-height: 1.5; }
.res-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.res-card { display: flex; flex-direction: column; gap: 8px; }
.res-card h3 { margin: 0; }

/* Logo in the header */
.brand-logo { padding: 0; }
.brand-logo::before { display: none; }
.brand-logo img { display: block; width: auto; max-width: 100%; }
.logo-preview { max-height: 4rem; width: auto; background: var(--surface-2); border-radius: 8px; padding: .5rem; }

/* Phone layout: compact header, floating controls as one row along the bottom, shorter banners */
@media (max-width: 700px) {
  .wrap { padding: 0 1rem; }
  .bar { padding: .5rem 1rem; }
  .site-nav { font-size: .95rem; gap: .2rem .8rem; }
  .site-nav a { padding: .3rem 0; }
  .brand-logo img { max-height: 2.75rem; }
  .section { margin-top: 1.5rem; }
  .card { padding: .9rem; }
  .hero { gap: .875rem; }
  .pbanner { max-height: 55vh; }
  body { padding-bottom: 4.5rem; }
  .float-controls { left: .5rem; right: .5rem; bottom: .5rem; flex-direction: row; flex-wrap: wrap;
    justify-content: center; align-items: flex-end; gap: .375rem; pointer-events: none; }
  .float-controls > * { pointer-events: auto; }
  .float-btn { min-height: 2.5rem; min-width: 0; padding: .4rem .75rem; font-size: .85rem; }
  .float-panel { right: 50%; transform: translateX(50%); }
  .prayer-item { gap: .25rem .5rem; }
  .pt-times { gap: .75rem; }
}
