/* ==========================================================================
   UKIM Handsworth Islamic Centre — Core Stylesheet (8px Grid System)
   ========================================================================== */

:root {
  /* Brand Palette (Derived from UKIM Handsworth Identity) */
  --green-deep: #063f0d;
  --green-mid: #38653d;
  --green-sage: #628c67;
  --green-mint: #f5fff7;
  --gold: #9e7833;
  --gold-warm: #d6b578;
  --cream: #f7efdf;
  --ink: #1a241c;
  --muted: #4b5c4e;
  --white: #ffffff;
  --border: #dbe5dd;
  --notice-bg: #fdf5e6;
  --notice-border: #d6b578;

  /* 8-Point Grid Spacing Tokens */
  --space-4: 0.25rem;   /* 4px */
  --space-8: 0.5rem;    /* 8px */
  --space-12: 0.75rem;  /* 12px */
  --space-16: 1rem;     /* 16px */
  --space-20: 1.25rem;  /* 20px */
  --space-24: 1.5rem;   /* 24px */
  --space-32: 2rem;     /* 32px */
  --space-40: 2.5rem;   /* 40px */
  --space-48: 3rem;     /* 48px — Minimum Accessible Touch Target */
  --space-64: 4rem;     /* 64px */
  --space-80: 5rem;     /* 80px */
  --space-96: 6rem;     /* 96px */

  --touch-target-min: var(--space-48);
  --container-max: 75rem; /* 1200px */
  --radius-sm: var(--space-8);
  --radius-md: var(--space-12);
  --radius-lg: var(--space-16);
  --shadow-sm: 0 2px 8px rgba(6, 63, 13, 0.06);
  --shadow-md: 0 8px 24px rgba(6, 63, 13, 0.1);

  --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--space-16);
  line-height: 1.5; /* 24px */
  color: var(--ink);
  background-color: var(--white);
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

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

/* Screen-reader-only utility */
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

/* Skip Link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--space-8);
  z-index: 1000;
  background: var(--green-deep);
  color: var(--white);
  padding: var(--space-12) var(--space-24);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus {
  left: var(--space-16);
}

/* Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-24);
}

/* Typography */
h1,
h2,
h3 {
  font-family: var(--font-serif);
  color: var(--green-deep);
  margin: 0 0 var(--space-16);
  font-weight: 700;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem); /* 32px -> 48px */
  line-height: 1.16; /* ~56px at 48px */
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem); /* 24px -> 32px */
  line-height: 1.25; /* 40px at 32px */
}

h3 {
  font-size: 1.25rem; /* 20px */
  line-height: 1.4;   /* 28px (multiple of 4) */
}

p {
  margin: 0 0 var(--space-16);
  color: var(--muted);
}

.section-kicker {
  display: inline-block;
  font-size: 0.75rem; /* 12px */
  line-height: 1.33;  /* 16px */
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--cream);
  padding: var(--space-4) var(--space-12);
  border-radius: var(--space-48);
  margin-bottom: var(--space-12);
}

/* Top Announcement Bar */
.top-notice {
  background: var(--green-deep);
  color: var(--white);
  font-size: 0.875rem; /* 14px */
  line-height: 1.43;   /* 20px */
  padding: var(--space-8) 0;
  border-bottom: 2px solid var(--gold);
}

.top-notice-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
}

.top-notice strong {
  color: var(--gold-warm);
}

.top-notice a {
  color: var(--gold-warm);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: var(--space-4);
}

/* Sticky Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  min-height: var(--space-80);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-12);
  text-decoration: none;
  min-height: var(--touch-target-min);
}

.brand img {
  width: var(--space-48);
  height: var(--space-48);
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 1.125rem; /* 18px */
  line-height: 1.33;   /* 24px */
  font-weight: 700;
  color: var(--green-deep);
}

.brand-sub {
  font-size: 0.75rem; /* 12px */
  line-height: 1.33;  /* 16px */
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  padding: var(--space-8);
  background: var(--green-mint);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--green-deep);
  cursor: pointer;
  font-weight: 600;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target-min);
  padding: var(--space-8) var(--space-16);
  text-decoration: none;
  font-size: 0.875rem; /* 14px */
  line-height: 1.43;   /* 20px */
  font-weight: 600;
  color: var(--ink);
  border-radius: var(--radius-sm);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: var(--green-mint);
  color: var(--green-deep);
}

.site-nav a.nav-donate {
  background: var(--gold);
  color: var(--white);
  padding: var(--space-8) var(--space-24);
  margin-left: var(--space-8);
}

.site-nav a.nav-donate:hover,
.site-nav a.nav-donate[aria-current="page"] {
  background: var(--green-deep);
  color: var(--white);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-target-min);
  padding: var(--space-12) var(--space-24);
  gap: var(--space-8);
  border-radius: var(--radius-sm);
  font-size: var(--space-16);
  line-height: 1.5; /* 24px */
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--green-deep);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--green-mid);
}

.btn-gold {
  background: var(--gold);
  color: var(--white);
}

.btn-gold:hover {
  background: #846328;
}

.btn-outline {
  background: transparent;
  color: var(--green-deep);
  border-color: var(--green-deep);
}

.btn-outline:hover {
  background: var(--green-mint);
}

.btn-outline-light {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  border-color: var(--gold-warm);
}

.btn-outline-light:hover {
  background: var(--white);
  color: var(--green-deep);
}

/* Hero Section */
.hero {
  position: relative;
  color: var(--white);
  background: var(--green-deep);
  padding: var(--space-80) 0;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.28;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 48rem;
}

.hero h1 {
  color: var(--white);
}

.hero p {
  color: var(--green-mint);
  font-size: 1.125rem; /* 18px */
  line-height: 1.56;   /* 28px */
  margin-bottom: var(--space-24);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-16);
}

/* Page Header (Subpages) */
.page-hero {
  background: linear-gradient(135deg, var(--green-deep) 0%, var(--green-mid) 100%);
  color: var(--white);
  padding: var(--space-64) 0;
  border-bottom: 4px solid var(--gold);
}

.page-hero h1 {
  color: var(--white);
  margin-bottom: var(--space-12);
}

.page-hero p {
  color: var(--cream);
  max-width: 44rem;
  margin-bottom: 0;
}

/* Sections */
.section {
  padding: var(--space-64) 0;
}

.section-mint {
  background: var(--green-mint);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-cream {
  background: var(--cream);
  border-top: 1px solid var(--gold-warm);
  border-bottom: 1px solid var(--gold-warm);
}

.section-header {
  max-width: 44rem;
  margin-bottom: var(--space-32);
}

.section-header-center {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

/* Grids */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-32);
  align-items: center;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-24);
}

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-24);
}

/* Cards */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-24);
  box-shadow: var(--shadow-sm);
}

.card-img-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--space-16);
  aspect-ratio: 16 / 10;
  background: var(--green-mint);
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-frame {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.photo-frame img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.photo-frame video {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* Defer rendering of strictly offscreen sections */
.section-deferred {
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 600px;
}

/* Prayer Times Grid */
.prayer-banner {
  background: var(--white);
  border: 2px solid var(--gold-warm);
  border-radius: var(--radius-lg);
  padding: var(--space-32);
  box-shadow: var(--shadow-md);
}

.prayer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  margin-bottom: var(--space-24);
}

.jummah-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  background: var(--green-deep);
  color: var(--white);
  padding: var(--space-12) var(--space-20);
  border-radius: var(--space-48);
  font-weight: 700;
  font-size: 0.875rem;
  line-height: 1.43;
}

.prayer-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-16);
  margin-bottom: var(--space-24);
}

.prayer-card {
  background: var(--green-mint);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-16);
  text-align: center;
}

.prayer-card h3 {
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: var(--space-4);
}

.prayer-card span {
  display: block;
  font-size: 0.875rem;
  line-height: 1.43;
  color: var(--muted);
}

.prayer-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  padding-top: var(--space-16);
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  line-height: 1.43;
  color: var(--muted);
}

/* Bank Details & Copy Control */
.bank-card {
  background: var(--green-deep);
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-32);
  border: 2px solid var(--gold);
}

.bank-card h2,
.bank-card h3 {
  color: var(--gold-warm);
}

.bank-card p {
  color: var(--green-mint);
}

.bank-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: var(--space-16);
  margin: var(--space-24) 0;
}

.bank-field {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(214, 181, 120, 0.4);
  border-radius: var(--radius-sm);
  padding: var(--space-16);
}

.bank-field-label {
  display: block;
  font-size: 0.75rem;
  line-height: 1.33;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold-warm);
  margin-bottom: var(--space-4);
}

.bank-field-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  font-size: 1.125rem;
  line-height: 1.33;
  font-weight: 700;
  color: var(--white);
}

.copy-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: var(--touch-target-min);
  min-block-size: var(--touch-target-min);
  padding: var(--space-8) var(--space-16);
  background: var(--gold);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.43;
  font-weight: 600;
  cursor: pointer;
}

.copy-btn:hover {
  background: #846328;
}

.copy-tip {
  position: absolute;
  inset-block-end: calc(100% + 6px);
  inset-inline-end: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
  background: var(--ink);
  color: var(--white);
  padding: var(--space-4) var(--space-12);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  line-height: 1.33;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.copy-btn[data-copied] + .copy-tip,
.copy-btn[data-failed] + .copy-tip {
  opacity: 1;
}

.copy-btn[data-failed] + .copy-tip {
  background: #b91c1c;
}

/* Alert Banner */
.notice-banner {
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: var(--space-20) var(--space-24);
  margin-bottom: var(--space-32);
}

.notice-banner strong {
  display: block;
  color: var(--green-deep);
  margin-bottom: var(--space-4);
}

.notice-banner p {
  margin: 0;
  color: var(--ink);
}

/* Food Hub Checklist Chips */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-12);
  margin: var(--space-24) 0;
  padding: 0;
  list-style: none;
}

.chip-grid li {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--space-48);
  padding: var(--space-8) var(--space-16);
  font-size: 0.875rem;
  line-height: 1.43;
  font-weight: 600;
  color: var(--green-deep);
}

/* Forms */
.form-stack {
  display: grid;
  gap: var(--space-16);
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  line-height: 1.43;
  font-weight: 600;
  color: var(--green-deep);
  margin-bottom: var(--space-8);
}

.form-group input,
.form-group textarea {
  width: 100%;
  min-height: var(--touch-target-min);
  padding: var(--space-12) var(--space-16);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--space-16);
  line-height: 1.5;
  color: var(--ink);
  background: var(--white);
}

.form-group textarea {
  min-height: 8rem;
  resize: vertical;
}

.form-group input:focus-visible,
.form-group textarea:focus-visible {
  outline: 2px solid var(--green-deep);
  border-color: var(--green-deep);
}

.form-hint {
  display: block;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--muted);
  margin-bottom: var(--space-4);
}

.form-error {
  display: none;
  color: #b91c1c;
  font-size: 0.875rem;
  line-height: 1.43;
  margin-top: var(--space-4);
  font-weight: 500;
}

.form-group :is(input, textarea):is(:user-invalid, .user-invalid-fallback) {
  border-color: #b91c1c;
  background-color: #fef2f2;
}

.form-group :is(input, textarea):is(:user-invalid, .user-invalid-fallback) + .form-error {
  display: block;
}

.form-group :is(input, textarea):is(:user-valid, .user-valid-fallback) {
  border-color: var(--green-mid);
}

.form-status {
  padding: var(--space-16);
  border-radius: var(--radius-sm);
  background: var(--green-mint);
  border: 1px solid var(--green-sage);
  color: var(--green-deep);
  font-weight: 600;
}

/* Extension Vision Strip */
.vision-section {
  background: var(--green-mint);
  border-top: 2px solid var(--gold-warm);
}

/* Footer */
.site-footer {
  background: var(--green-deep);
  color: var(--white);
  padding: var(--space-64) 0 var(--space-32);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-32);
  padding-bottom: var(--space-32);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.footer-grid h3 {
  color: var(--gold-warm);
  margin-bottom: var(--space-12);
}

.footer-grid p,
.footer-grid li {
  color: var(--green-mint);
  font-size: 0.875rem;
  line-height: 1.43;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-4);
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target-min);
  text-decoration: none;
  color: var(--green-mint);
}

.footer-links a:hover {
  color: var(--gold-warm);
  text-decoration: underline;
}

.footer-bottom {
  padding-top: var(--space-24);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-16);
  font-size: 0.875rem;
  line-height: 1.43;
  color: var(--gold-warm);
}

/* Quote Block */
.hadith-quote {
  background: var(--cream);
  border-left: 4px solid var(--gold);
  padding: var(--space-24);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 0 0 var(--space-24);
}

.hadith-quote blockquote {
  margin: 0 0 var(--space-8);
  font-family: var(--font-serif);
  font-size: 1.25rem;
  line-height: 1.4;
  color: var(--green-deep);
}

.hadith-quote cite {
  font-style: normal;
  font-weight: 600;
  color: var(--gold);
  font-size: 0.875rem;
}

/* Responsive Breakpoints */
@media (max-width: 960px) {
  .prayer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid-2,
  .grid-3,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 2px solid var(--gold);
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-16) var(--space-24);
    box-shadow: var(--shadow-md);
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a.nav-donate {
    margin-left: 0;
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .prayer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    padding: var(--space-64) 0;
  }

  .section {
    padding: var(--space-48) 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .btn:hover {
    transform: none;
  }
}
