/* Surau — single stylesheet. Mobile-first; tokens on :root; dark mode via prefers-color-scheme.
   Look: corporate navy (royal blue on white) with restrained Islamic cues —
   8-point star, arch-framed photos, a thin gold accent. */

:root {
  --navy-950: #041634;
  --navy-900: #06214f;
  --navy-800: #0a2d6e;
  --navy-700: #0b3d91;
  --navy-600: #1a4fae;
  --navy-100: #dfe8f7;
  --navy-50: #f1f5fc;
  --gold-500: #c9a24a;
  --gold-300: #e3c983;
  --danger: #b42318;

  --bg: #ffffff;
  --bg-tint: var(--navy-50);
  --surface: #ffffff;
  --text: #0f1a2e;
  --muted: #56627a;
  --border: #e1e7f0;
  --link: var(--navy-700);
  --primary: var(--navy-700);
  --primary-hover: var(--navy-800);
  --primary-ink: #ffffff;
  --danger-bg: #fdf1f0;
  --shadow-sm: 0 1px 2px rgb(6 33 79 / 0.06);
  --shadow: 0 1px 2px rgb(6 33 79 / 0.05), 0 8px 24px rgb(6 33 79 / 0.07);
  --radius: 10px;
  --arch: 999px 999px var(--radius) var(--radius);
  --focus: #f0b429;
  --header-h: 76px;

  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-ar: 'Amiri', 'Traditional Arabic', serif;

  /* 8-point star tile used as a faint texture. */
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%230b3d91' stroke-width='1'%3E%3Crect x='20' y='20' width='32' height='32'/%3E%3Crect x='20' y='20' width='32' height='32' transform='rotate(45 36 36)'/%3E%3C/g%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070d1a;
    --bg-tint: #0b1426;
    --surface: #0f1a2f;
    --text: #e7ecf5;
    --muted: #9eabc2;
    --border: #1f2c45;
    --link: #8fb3ff;
    --primary: #2f63d0;
    --primary-hover: #3d72e0;
    --navy-100: #1a2a4a;
    --navy-50: #0b1426;
    --danger: #f07167;
    --danger-bg: #2a1417;
    --shadow-sm: none;
    --shadow: 0 8px 24px rgb(0 0 0 / 0.35);
    --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%238fb3ff' stroke-width='1'%3E%3Crect x='20' y='20' width='32' height='32'/%3E%3Crect x='20' y='20' width='32' height='32' transform='rotate(45 36 36)'/%3E%3C/g%3E%3C/svg%3E");
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 8px); }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.015em; }
h2 { font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 800; }
h3 { font-size: 1.12rem; font-weight: 700; }
p { margin: 0 0 16px; }
a { color: var(--link); }
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .container { padding: 0 32px; } }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.pre-line { white-space: pre-line; }
.empty { color: var(--muted); padding: 16px 0; margin: 0; }
.icon { width: 20px; height: 20px; flex: none; }

.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--surface); color: var(--text); padding: 8px 16px; }
.skip-link:focus { left: 8px; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 24px;
  border: 2px solid transparent; border-radius: 6px;
  font: inherit; font-size: 0.95rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-light { background: #fff; color: var(--navy-800); border-color: #fff; }
.btn-light:hover { background: var(--navy-100); border-color: var(--navy-100); }
.btn-outline-light { background: transparent; color: #fff; border-color: rgb(255 255 255 / 0.7); }
.btn-outline-light:hover { background: rgb(255 255 255 / 0.12); }
.btn-outline { background: transparent; color: var(--link); border-color: currentColor; }
.btn-outline:hover { background: var(--navy-50); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
@media (prefers-color-scheme: dark) { .btn-danger { color: #1b0706; } }
.btn-small { min-height: 44px; padding: 6px 16px; font-size: 0.82rem; }
.btn-block { width: 100%; }
.icon-btn { min-width: 44px; min-height: 44px; border: 0; background: transparent; color: inherit; font-size: 1.8rem; cursor: pointer; border-radius: 8px; }

/* ---- Header (white bar + navy block, like a corporate portal) ---------- */

.site-header {
  position: sticky; top: 0; z-index: 30; background: var(--surface);
  border-top: 4px solid var(--navy-900); transition: box-shadow 0.2s;
}
.site-header.is-scrolled { box-shadow: 0 2px 16px rgb(6 33 79 / 0.12); }
.header-inner { display: flex; align-items: stretch; flex-wrap: wrap; min-height: var(--header-h); padding-left: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; margin-right: auto; padding: 12px 0; color: var(--text); text-decoration: none; }
.brand-logo { width: 40px; height: 40px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 800; font-size: 1.1rem; color: var(--navy-700); letter-spacing: -0.01em; }
.brand-sub { font-size: 0.78rem; color: var(--muted); }
@media (prefers-color-scheme: dark) { .brand-name { color: #fff; } }

.nav-toggle {
  display: inline-flex; align-items: center; gap: 10px; align-self: center; margin-right: 12px;
  min-height: 44px; padding: 0 14px; border: 2px solid var(--border); border-radius: 6px;
  background: transparent; color: var(--text); font: inherit; font-weight: 700; font-size: 0.85rem;
  text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer;
}
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { display: block; width: 18px; height: 2px; background: currentColor; position: relative; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ''; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }

.site-nav { display: none; order: 3; width: 100%; flex-direction: column; padding: 0 16px 12px 0; }
.site-nav.open { display: flex; }
.site-nav a {
  display: flex; align-items: center; min-height: 48px; padding: 0 4px; border-top: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-weight: 700; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.04em;
}
.site-nav a:hover { color: var(--link); }

.header-block { display: flex; order: 2; background: var(--navy-700); }
.header-block-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; min-height: 44px; position: relative;
  color: #fff; text-decoration: none; font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.header-block-link:hover { background: var(--navy-800); }
.header-block-link .dot { width: 9px; height: 9px; border-radius: 50%; background: #ef4444; position: absolute; top: 18px; left: 26px; box-shadow: 0 0 0 2px var(--navy-700); }
.header-block-cta { background: var(--gold-500); color: var(--navy-950); }
.header-block-cta:hover { background: var(--gold-300); }
@media (max-width: 559px) {
  .header-block { order: 4; width: calc(100% + 16px); margin-left: -16px; }
  .header-block-link { flex: 1; justify-content: center; min-height: 48px; }
}

@media (min-width: 1080px) {
  .nav-toggle { display: none; }
  .header-inner { flex-wrap: nowrap; padding-left: 32px; }
  .brand { margin-right: 24px; }
  .site-nav { display: flex; order: 0; flex-direction: row; width: auto; padding: 0; margin-right: auto; }
  .site-nav a { border: 0; padding: 0 14px; position: relative; }
  .site-nav a::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 18px; height: 2px; background: var(--gold-500); transform: scaleX(0); transition: transform 0.2s; }
  .site-nav a:hover::after { transform: scaleX(1); }
  .header-block-link { padding: 0 24px; }
}

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

.hero { position: relative; overflow: hidden; background: var(--navy-900); color: #fff; min-height: min(86vh, 760px); display: flex; }
.hero-slides, .hero-slide, .hero-shade { position: absolute; inset: 0; margin: 0; }
.hero-slide { opacity: 0; transition: opacity 1s ease; }
.hero-slide.is-active { opacity: 1; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; }
/* Navy wash so white text always passes contrast, heavier on the text side. */
.hero-shade {
  background:
    linear-gradient(90deg, rgb(6 33 79 / 0.92) 0%, rgb(6 33 79 / 0.72) 45%, rgb(11 61 145 / 0.35) 100%),
    linear-gradient(0deg, rgb(4 22 52 / 0.7) 0%, rgb(4 22 52 / 0) 45%);
}
.hero-shade::after { content: ''; position: absolute; inset: 0; background-image: var(--pattern); opacity: 0.08; filter: invert(1); }

.hero-inner { position: relative; z-index: 1; display: grid; gap: 32px; align-content: end; padding-top: 56px; padding-bottom: 96px; }
.bismillah { font-family: var(--font-ar); font-size: 1.7rem; color: var(--gold-300); margin: 0 0 12px; text-align: left; }
.hero h1 { font-size: clamp(2.4rem, 7vw, 4.2rem); font-weight: 800; letter-spacing: -0.03em; max-width: 14ch; }
.hero-date { font-weight: 600; font-size: 1.05rem; color: #dbe5f7; margin-bottom: 28px; }
.hero-date .sep { margin: 0 6px; color: var(--gold-300); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }

.next-card {
  align-self: end; background: rgb(255 255 255 / 0.96); color: var(--navy-900);
  border-radius: var(--arch); padding: 44px 28px 24px; text-align: center; box-shadow: 0 24px 60px rgb(4 22 52 / 0.35);
  border-bottom: 4px solid var(--gold-500); max-width: 380px; width: 100%; justify-self: start;
}
.next-eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.78rem; font-weight: 700; color: var(--navy-600); margin: 0; }
.next-name { font-size: 2.3rem; font-weight: 800; margin: 4px 0 0; letter-spacing: -0.02em; }
.next-time { font-size: 1.1rem; margin: 0 0 8px; color: #44516b; }
.next-countdown { font-size: clamp(2.4rem, 10vw, 3.2rem); font-weight: 800; font-variant-numeric: tabular-nums; margin: 0; color: var(--navy-700); }
.next-note { margin: 12px 0 0; font-size: 0.9rem; color: #7a5b00; }
.next-link { display: inline-flex; min-height: 44px; align-items: center; margin-top: 8px; font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--navy-700); }

@media (min-width: 900px) {
  .hero-inner { grid-template-columns: 1.5fr 1fr; align-items: end; padding-bottom: 120px; }
  .next-card { justify-self: end; }
}

.hero-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 48px; height: 48px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: rgb(255 255 255 / 0.12); color: #fff; cursor: pointer;
}
.hero-arrow:hover { background: rgb(255 255 255 / 0.25); }
.hero-arrow svg { width: 28px; height: 28px; }
.hero-prev { left: 8px; }
.hero-next { right: 8px; }
@media (max-width: 899px) { .hero-controls .hero-arrow { top: auto; bottom: 16px; transform: none; } .hero-prev { left: auto; right: 64px; } }
.hero-bottom { position: absolute; z-index: 2; left: 16px; bottom: 16px; display: flex; align-items: center; gap: 12px; }
@media (min-width: 700px) { .hero-bottom { left: 32px; bottom: 32px; } }
.hero-dots { display: flex; gap: 2px; }
.hero-dot { width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; padding: 0; }
.hero-dot::before { content: ''; width: 28px; height: 3px; background: rgb(255 255 255 / 0.45); border-radius: 2px; transition: background 0.2s; }
.hero-dot[aria-pressed="true"]::before { background: var(--gold-500); }
.hero-pause { min-height: 44px; padding: 0 12px; border: 1px solid rgb(255 255 255 / 0.5); border-radius: 6px; background: transparent; color: #fff; font: inherit; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer; }

/* ---- Sections ----------------------------------------------------------- */

.section { padding: 64px 0; }
@media (min-width: 900px) { .section { padding: 88px 0; } }
.section-tint { background: var(--bg-tint); }
.section-head { margin-bottom: 32px; }
.section-head-row { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; }
.section-head h2 { margin: 0; }
.section-head .muted { margin: 8px 0 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 10px;
  font-size: 0.8rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--link);
}
/* Small 8-point star before every eyebrow. */
.eyebrow::before {
  content: ''; width: 12px; height: 12px; background: var(--gold-500);
  clip-path: polygon(50% 0, 64% 21%, 85% 15%, 79% 36%, 100% 50%, 79% 64%, 85% 85%, 64% 79%, 50% 100%, 36% 79%, 15% 85%, 21% 64%, 0 50%, 21% 36%, 15% 15%, 36% 21%);
}

.section-navy { background: var(--navy-900); color: #fff; position: relative; }
.section-navy::before { content: ''; position: absolute; inset: 0; background-image: var(--pattern); opacity: 0.06; filter: invert(1); pointer-events: none; }
.section-navy .container { position: relative; }
.section-navy .eyebrow { color: var(--gold-300); }
.section-navy .card { color: var(--text); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 24px; }
.card-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.card-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.card-danger { border-color: var(--danger); background: var(--danger-bg); }
.arch { border-radius: var(--arch); overflow: hidden; }

.tag {
  display: inline-block; padding: 3px 10px; border-radius: 4px;
  font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--navy-100); color: var(--navy-800);
}
@media (prefers-color-scheme: dark) { .tag { color: #cfe0ff; } }
.tag-danger { background: var(--danger); color: #fff; }
.tag-in { background: #dcfce7; color: #14532d; }
@media (prefers-color-scheme: dark) { .tag-danger { color: #1b0706; } .tag-in { background: #123524; color: #bbf7d0; } }
.pin { font-size: 0.8rem; font-weight: 700; color: var(--muted); }

/* ---- Prayer grid -------------------------------------------------------- */

.prayer-section { background: var(--bg-tint); position: relative; }
.prayer-section::before { content: ''; position: absolute; inset: 0; background-image: var(--pattern); opacity: 0.05; pointer-events: none; }
.prayer-section .container { position: relative; }
.prayer-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 600px) { .prayer-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1000px) { .prayer-grid { grid-template-columns: repeat(7, 1fr); } }
.prayer {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--arch);
  padding: 28px 12px 18px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  box-shadow: var(--shadow-sm);
}
.prayer-name { font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.prayer-time { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.prayer-tag { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--link); }
.prayer.is-next { border: 2px solid var(--primary); }
.prayer.is-current { background: var(--navy-700); border-color: var(--navy-700); color: #fff; box-shadow: var(--shadow); }
.prayer.is-current .prayer-name { color: #cfdcf5; }
.prayer.is-current .prayer-tag { color: var(--gold-300); }

/* ---- Filters ------------------------------------------------------------ */

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 6px 18px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.85rem; font-weight: 700; cursor: pointer;
}
.chip:hover { border-color: var(--link); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }

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

.program-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
@media (min-width: 900px) { .program-list { grid-template-columns: 1fr 1fr; } }
.program {
  display: flex; align-items: center; gap: 16px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--navy-700);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.program-body { display: flex; gap: 16px; flex: 1; min-width: 0; }
.program-media { order: 2; flex: none; width: 92px; height: 112px; background: var(--navy-100); }
.program-media img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 420px) { .program-media { width: 72px; height: 90px; } }
.program-date {
  flex: none; width: 60px; height: 68px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--navy-700); color: #fff; border-radius: 30px 30px 6px 6px; line-height: 1.1;
}
.program-day { font-size: 1.5rem; font-weight: 800; }
.program-month { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold-300); }
.program-what { min-width: 0; }
.program-what h3 { margin: 8px 0 4px; }
.program-what p { margin: 0; }
.program-when { font-weight: 600; font-size: 0.92rem; color: var(--link); }

/* ---- Announcements ------------------------------------------------------ */

.announcement { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.card-media { aspect-ratio: 16 / 9; background: var(--navy-100); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 24px; }
.announcement.is-death { border: 2px solid var(--danger); }
.announcement.is-death .card-body { background: var(--danger-bg); flex: 1; }

/* ---- Services ----------------------------------------------------------- */

.service { display: flex; flex-direction: column; border-top: 3px solid var(--navy-700); }
.service p { flex: 1; color: var(--muted); }
.service-urgent { border-top-color: var(--danger); }
.service-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--navy-50); color: var(--link); margin-bottom: 16px; }
.service-urgent .service-icon { background: var(--danger-bg); color: var(--danger); }
.service-icon svg { width: 24px; height: 24px; }

/* ---- Infaq -------------------------------------------------------------- */

.infaq-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); margin-bottom: 20px; }
.bank { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 16px; }
.bank dt { color: var(--muted); }
.bank dd { margin: 0; font-weight: 700; }
.account-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.account-no { font-size: 1.2rem; font-variant-numeric: tabular-nums; letter-spacing: 0.03em; word-break: break-all; }
.qr-card { text-align: center; }
.qr-box { display: flex; justify-content: center; align-items: center; min-height: 140px; }
.qr-box img { background: #fff; padding: 8px; border-radius: 8px; }

.progress { height: 12px; background: var(--navy-100); border-radius: 999px; overflow: hidden; margin: 16px 0 12px; }
.progress-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--navy-700), var(--navy-600)); border-radius: 999px; transition: width 0.6s ease; }

.statement-grid { display: grid; gap: 20px; }
@media (min-width: 700px) { .statement-grid { grid-template-columns: 1fr 1fr; } }
.statement-table { width: 100%; border-collapse: collapse; }
.statement-table caption { text-align: left; font-weight: 800; padding-bottom: 8px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--link); }
.statement-table th, .statement-table td { padding: 10px 4px; border-bottom: 1px solid var(--border); text-align: left; font-weight: 400; }
.statement-table td { text-align: right; font-variant-numeric: tabular-nums; }
.statement-table tfoot th, .statement-table tfoot td { font-weight: 800; border-bottom: 0; }
.statement-net { margin: 16px 0 0; font-size: 1.1rem; }

/* ---- Gallery & lightbox ------------------------------------------------- */

.gallery { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .gallery { grid-template-columns: repeat(4, 1fr); } }
.gallery-btn {
  display: block; width: 100%; padding: 0; border: 0; cursor: pointer; position: relative;
  aspect-ratio: 4 / 5; border-radius: var(--arch); overflow: hidden; background: var(--navy-100);
}
.gallery-btn img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.gallery-btn:hover img { transform: scale(1.04); }
.gallery-caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 32px 12px 12px; text-align: left;
  background: linear-gradient(0deg, rgb(4 22 52 / 0.85), transparent); color: #fff; font: inherit; font-size: 0.85rem; font-weight: 700;
}

.lightbox { border: 0; padding: 0; background: transparent; color: #fff; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox::backdrop { background: rgb(4 12 28 / 0.92); }
.lightbox figure { margin: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 16px 24px; gap: 12px; }
.lightbox-img { display: flex; justify-content: center; max-height: calc(100vh - 140px); }
.lightbox-img img { max-height: calc(100vh - 140px); width: auto; border-radius: 8px; }
.lightbox figcaption { font-weight: 600; text-align: center; }
.lightbox .modal-close-form { position: fixed; top: 8px; right: 8px; z-index: 3; }
.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }

/* ---- About -------------------------------------------------------------- */

.about { display: grid; gap: 40px; align-items: center; }
@media (min-width: 860px) { .about { grid-template-columns: 0.9fr 1.1fr; gap: 64px; } }
.about-figure { margin: 0; aspect-ratio: 4 / 5; max-width: 460px; width: 100%; justify-self: center; box-shadow: var(--shadow); border: 6px solid var(--surface); outline: 1px solid var(--gold-500); outline-offset: 6px; }
.about-figure img { width: 100%; height: 100%; object-fit: cover; }
.about-text h3 { margin-top: 24px; }
.facility-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.facility-list li { display: flex; gap: 10px; align-items: baseline; }
.facility-list li::before { content: ''; flex: none; width: 8px; height: 8px; transform: rotate(45deg) translateY(-2px); background: var(--gold-500); }

/* ---- AJK organisation chart --------------------------------------------- */

.org-section { background: var(--bg); }
.org-chart { overflow-x: auto; padding-bottom: 8px; }
.org-tree { width: max-content; min-width: 100%; }
.org-tier { position: relative; padding-top: 60px; text-align: center; }
.org-tier:first-child { padding-top: 0; }
.org-tier:first-child .org-tier-label { display: none; }
/* Vertical line from the tier above down to this tier's branch bar. */
.org-tier + .org-tier::before { content: ''; position: absolute; top: 0; left: 50%; height: 60px; border-left: 2px solid var(--navy-100); }
.org-tier-label {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 1; margin: 0; white-space: nowrap;
  padding: 2px 12px; background: var(--bg); color: var(--link); border: 1px solid var(--navy-100); border-radius: 999px;
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
}
.org-row { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; gap: 16px; }
.org-node { position: relative; padding-top: 18px; }
.org-tier:first-child .org-node { padding-top: 0; }
/* Branch bar across siblings, trimmed to the centres of the first and last child. */
.org-tier + .org-tier .org-node::before { content: ''; position: absolute; top: 0; left: -8px; right: -8px; border-top: 2px solid var(--navy-100); }
.org-tier + .org-tier .org-node:first-child::before { left: 50%; }
.org-tier + .org-tier .org-node:last-child::before { right: 50%; }
.org-tier + .org-tier .org-node:only-child::before { display: none; }
.org-tier + .org-tier .org-node::after { content: ''; position: absolute; top: 0; left: 50%; height: 18px; border-left: 2px solid var(--navy-100); }

.org-card {
  width: 172px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--navy-700); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.org-avatar {
  width: 72px; height: 72px; border-radius: 50%; overflow: hidden; margin-bottom: 8px; flex: none;
  display: grid; place-items: center; background: var(--navy-100); color: var(--navy-800); font-weight: 800; font-size: 1.2rem;
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--gold-500);
}
@media (prefers-color-scheme: dark) { .org-avatar { color: #cfe0ff; } }
.org-avatar img { width: 100%; height: 100%; object-fit: cover; }
.org-meta { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.org-name { font-weight: 700; line-height: 1.3; font-size: 0.95rem; display: block; }
.org-role { font-size: 0.78rem; font-weight: 700; color: var(--link); text-transform: uppercase; letter-spacing: 0.06em; display: block; }
.is-lead .org-card { width: 220px; background: var(--navy-700); border-color: var(--navy-700); border-top-color: var(--gold-500); color: #fff; box-shadow: var(--shadow); }
.is-lead .org-role { color: var(--gold-300); }
.is-lead .org-avatar { width: 88px; height: 88px; box-shadow: 0 0 0 3px var(--navy-700), 0 0 0 4px var(--gold-500); }

/* Phones: the chart becomes a vertical tree with a spine on the left. */
@media (max-width: 759px) {
  .org-chart { overflow: visible; }
  .org-meta { align-items: flex-start; }
  .org-tree { width: auto; min-width: 0; border-left: 2px solid var(--navy-100); margin-left: 12px; padding-left: 20px; }
  .org-tier, .org-tier:first-child { padding-top: 0; text-align: left; margin-bottom: 24px; }
  .org-tier + .org-tier::before, .org-tier + .org-tier .org-node::before, .org-tier + .org-tier .org-node::after { display: none; }
  .org-tier-label, .org-tier:first-child .org-tier-label { display: inline-block; position: relative; left: -34px; top: 0; transform: none; margin-bottom: 12px; }
  .org-row { flex-direction: column; gap: 10px; }
  .org-node, .org-tier:first-child .org-node { padding-top: 0; }
  .org-card, .is-lead .org-card { width: 100%; flex-direction: row; text-align: left; gap: 14px; padding: 12px 14px; }
  .org-avatar, .is-lead .org-avatar { width: 52px; height: 52px; margin: 0; font-size: 1rem; }
}

.org-list { display: grid; gap: 24px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.org-list-group h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--link); padding-bottom: 8px; border-bottom: 2px solid var(--gold-500); }
.org-list-group ul { list-style: none; margin: 0; padding: 0; }
.org-list-group li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.org-list-group .org-avatar { width: 44px; height: 44px; margin: 0; font-size: 0.9rem; }

/* ---- Contact / footer --------------------------------------------------- */

address { font-style: normal; margin-bottom: 16px; white-space: pre-line; color: var(--muted); }
.big-link { font-size: 1.4rem; font-weight: 800; display: inline-flex; min-height: 44px; align-items: center; text-decoration: none; }
.card-danger .big-link { color: var(--danger); }

.site-footer { background: var(--navy-950); color: #b9c6de; padding: 32px 0; border-top: 4px solid var(--gold-500); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-inner p { margin: 0; }
.footer-admin { color: #dbe5f7; font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; min-height: 44px; display: inline-flex; align-items: center; }

/* ---- Forms -------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 0.95rem; }
.field input, .field select, .field textarea, .data-table select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid #c3cddd; border-radius: 6px; padding: 8px 12px; min-height: 48px; width: 100%;
}
@media (prefers-color-scheme: dark) { .field input, .field select, .field textarea, .data-table select { border-color: #33425f; } }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { resize: vertical; }
.field input[type="file"] { padding: 10px; }
.field [aria-invalid="true"] { border-color: var(--danger); border-width: 2px; }
.field-error { color: var(--danger); font-size: 0.9rem; font-weight: 600; margin: 0; }
.field-error:empty { display: none; }
.field-check { flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; }
.field-check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--primary); }
.field-check .field-error { flex-basis: 100%; }

/* ---- Modal -------------------------------------------------------------- */

.modal {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  border: 0; border-top: 4px solid var(--navy-700); border-radius: var(--radius); padding: 28px; background: var(--surface); color: var(--text);
  box-shadow: 0 24px 64px rgb(4 22 52 / 0.4);
}
.modal::backdrop { background: rgb(4 22 52 / 0.6); }
.modal-close-form { position: absolute; top: 8px; right: 8px; margin: 0; }
.modal h2 { padding-right: 44px; margin-bottom: 16px; font-size: 1.5rem; }
.done-msg { font-size: 1.05rem; }

/* ---- Toast -------------------------------------------------------------- */

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--navy-900); color: #fff; padding: 12px 20px; border-radius: 8px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 200;
  max-width: calc(100vw - 32px); box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- Admin -------------------------------------------------------------- */

.admin { background: var(--bg-tint); }
.admin-main { padding-top: 32px; padding-bottom: 64px; }
.login-card { max-width: 440px; margin: 48px auto; border-top: 4px solid var(--navy-700); }
.notice { background: #fff8e6; color: #5c4400; border: 1px solid var(--gold-500); border-left-width: 4px; border-radius: 6px; padding: 12px 16px; margin-bottom: 20px; }
@media (prefers-color-scheme: dark) { .notice { background: #2a220d; color: #f3e3a8; } }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 24px; -webkit-overflow-scrolling: touch; }
.tab {
  flex: 0 0 auto; min-height: 48px; padding: 8px 16px; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 0.85rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--link); border-bottom-color: var(--navy-700); }

.tab-body { display: grid; gap: 24px; }
.admin-form h2, .list-title { font-size: 1.2rem; }
.list-title { margin: 8px 0 -8px; }
.form-grid { display: grid; gap: 0 20px; }
@media (min-width: 700px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .field:has(textarea), .form-grid .field-wide { grid-column: 1 / -1; } }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }

.media-preview { width: 120px; aspect-ratio: 4 / 5; border-radius: 60px 60px 6px 6px; overflow: hidden; background: var(--navy-100); }
.media-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-preview:empty { display: none; }

.media-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.media-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.media-thumb { aspect-ratio: 4 / 3; background: var(--navy-100); }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-info { padding: 12px 14px; display: grid; gap: 6px; flex: 1; }
.media-info strong { line-height: 1.3; }
.media-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.media-actions { display: flex; gap: 6px; padding: 0 14px 14px; flex-wrap: wrap; }

.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--navy-700); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; }
.stat-label { color: var(--muted); font-size: 0.85rem; }
.stat-value { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table th { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.data-table .actions { white-space: nowrap; }
.data-table .actions > * + * { margin-left: 6px; }
.data-table .cell-thumb { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; }

/* Stack table rows as cards on phones so nothing scrolls sideways. */
@media (max-width: 699px) {
  .data-table thead { position: absolute; left: -9999px; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 12px; background: var(--surface); }
  .data-table td { border: 0; padding: 4px 0; }
  .data-table td[data-label]::before { content: attr(data-label); display: block; font-size: 0.75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.header-actions { display: flex; align-items: center; gap: 8px; }
.admin .header-inner { padding-right: 16px; }
@media (min-width: 700px) { .admin .header-inner { padding-right: 32px; } }
