@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

/* =========================
   Design Tokens (Semantic)
   ========================= */
:root {
  /* Brand Palette */
  --color-primary: #184a45;   /* dark green (primary) */
  --color-secondary: #3a5a40; /* lighter green (secondary) */
  --color-tertiary: #334e68;  /* aligned tertiary */
  --color-accent: #c9a227;    /* yellow/gold (accent/pop) */
  --color-surface: #e8efea;   /* light green (surface / white space) */

  /* Neutral / Text */
  --color-bg: #ffffff;
  --color-text: #0f172a;      /* near-black for strong contrast */
  --color-muted: #475569;     /* muted/supplementary text */

  /* Interactive states (derived) */
  --color-link: var(--color-tertiary);
  --color-link-hover: #24364b; /* darker than --color-tertiary */
  --color-brand-cta: var(--color-primary);
  --color-brand-cta-hover: #11342f;

  /* Surfaces/sections */
  --color-header-bg: var(--color-tertiary);
  --color-header-text: #ffffff;
  --color-footer-bg: var(--color-tertiary);
  --color-footer-text: #ffffff;
  --color-card-bg: #ffffff;
  --color-hero-overlay: rgba(0,0,0,0.5); /* higher opacity for legibility */

  /* Borders/lines/shadows */
  --color-border: #d1d5db;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);

  /* Typography scale */
  --font-sans: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --fs-xxl: clamp(2.2rem, 4vw, 3rem);   /* hero headings */
  --fs-xl: clamp(1.75rem, 3vw, 2.25rem);
  --fs-lg: clamp(1.25rem, 2vw, 1.5rem);
  --fs-md: 1rem;
  --fs-xs: 0.85rem;

  /* Spacing & radii */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;

  --radius-sm: .375rem;
  --radius-md: .5rem;
  --radius-lg: .75rem;
  --radius-xl: 1rem;

  /* Max widths / containers */
  --container-narrow: 720px;
  --container: 1100px;

  --hero-pad: clamp(2.5rem, 6vw, 6rem); /* top/bottom padding used by .hero */
}

/* =========================
   Base / Reset-ish
   ========================= */
*,*::before,*::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--color-text);
  background: var(--color-bg);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-link); text-decoration: underline; }
a:hover, a:focus { color: var(--color-link-hover); text-decoration: underline; }
h1, h2, h3 {
  line-height: 1.2;
  margin: var(--space-6) 0 var(--space-3);
  font-weight: 700;
}
h1 { font-size: var(--fs-xxl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }

/* =========================
   Containers & Sections
   ========================= */
.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}
section { padding: var(--space-10) 0; }
.section--alt { background: var(--color-surface); }

/* =========================
   Grid helper
   ========================= */
.grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* =========================
   Card component
   ========================= */
.card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  position: relative;
  display: flex;
  flex-direction: column;
  transition: transform .06s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card h3 { margin-top: var(--space-1); }
.card__icon { width: 56px; height: 56px; margin-bottom: var(--space-3); }
.card__title { margin: 0 0 var(--space-2); font-size: clamp(1.1rem, 2.2vw, 1.3rem); }
.card__body { margin: 0 0 var(--space-4); }
.card__cta { margin-top: auto; }
.card__cta a { font-weight: 600; }

/* =========================
   Buttons
   ========================= */
.btn {
  display: inline-block;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  background: var(--color-brand-cta);
  color: #fff;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform .05s ease, background .2s ease, box-shadow .2s ease;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}
.btn:hover, .btn:focus {
  background: var(--color-brand-cta-hover);
  color: #fff;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn--secondary { background: var(--color-secondary); }
.btn--ghost { background: transparent; color: var(--color-brand-cta); border-color: var(--color-brand-cta); }

/* =========================
   Header — translucent on scroll (no cap, no flicker)
   ========================= */
.header {
  position: sticky;
  top: 0;
  z-index: 10;                      /* above hero overlays */
  color: var(--color-header-text);
  background: transparent;          /* bg comes from ::before plate */
  isolation: isolate;               /* keep ::before compositing inside */
  backface-visibility: hidden;      /* guard against Safari repaint quirks */
}
.header a { color: var(--color-header-text); }

/* Plate lives INSIDE the header, so it never paints over the hero */
.header::before {
  content: "";
  position: absolute;
  inset: 0;                         /* fully covers the header only */
  z-index: 0;                       /* behind header content */
  pointer-events: none;
  background-color: var(--color-header-bg); /* solid at top */
  /* No opacity or blur transitions → prevents flashing */
  transition: none;
}

/* Header content stays above the plate */
.header > * { position: relative; z-index: 1; }

.header__bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); padding-block: var(--space-3);
}

/* After scrolling: switch plate to translucent tone */
.header.is-scrolled::before {
  /* #334e68 at ~72% opacity equivalent */
  background-color: rgba(51, 78, 104, 0.72);
}

/* Optional separation past hero */
.header.is-scrolled { box-shadow: var(--shadow-md); }

.brand { display: inline-flex; align-items: center; gap: var(--space-3); color: var(--color-header-text); font-weight: 700; text-decoration: none; }
.brand:hover, .brand:focus { text-decoration: none; }
.brand__logo { width: 36px; height: 36px; object-fit: contain; }
.brand__text { font-size: 1.125rem; letter-spacing: .2px; }

/* =========================
   Footer
   ========================= */
.footer {
  background: var(--color-footer-bg);
  color: var(--color-footer-text);
  padding: var(--space-8) 0;
}
.footer a { color: var(--color-footer-text); }
.footer .container { display: grid; gap: var(--space-2); padding: var(--space-6) var(--space-4); }

/* Footer compliance disclaimer */
.footer-disclaimer {
  opacity: 0.9;
  line-height: 1.4;
  color: var(--color-footer-text);
}

/* Make footer small text inherit the footer text colour rather than the default muted grey */
.footer .small { color: var(--color-footer-text); }

/* =========================
   Navigation
   ========================= */
.nav-toggle {
  display: none; background: none; border: 0; color: var(--color-header-text);
  font-size: 1.25rem; line-height: 1;
}
.nav { }
.nav__list {
  display: flex; align-items: center; gap: var(--space-4);
  list-style: none; margin: 0; padding: 0;
}
.nav__list a { color: var(--color-header-text); font-weight: 600; padding: .4rem .2rem; text-decoration: none; }
.nav__list a:hover, .nav__list a:focus { text-decoration: underline; }
.nav__list a[aria-current="page"] { text-decoration: underline; text-underline-offset: .2em; font-weight: 700; }

/* Donate CTA in nav */
.nav__cta .btn--donate {
  background: var(--color-accent); color: #111; border-color: transparent;
}
.nav__cta .btn--donate:hover, .nav__cta .btn--donate:focus {
  background: color-mix(in oklab, var(--color-accent), black 12%); color: #111;
}

/* Responsive nav (single source of truth) */
@media (max-width: 900px) {
  .nav-toggle { display: inline-block; }
  .header__bar { position: relative; }
  .nav {
    position: absolute; inset: calc(100% + 2px) 0 auto 0;
    background: rgba(51, 78, 104, 0.72);   /* match translucent header tone */
    transform: translateY(-120%); transition: transform .2s ease;
    box-shadow: var(--shadow-md);
  }
  .nav.is-open { transform: translateY(0); }
  .nav[aria-hidden="true"] { transform: translateY(-120%); }
  .nav__list { flex-direction: column; align-items: flex-start; gap: var(--space-3); padding: var(--space-4); }
  .nav__cta { align-self: stretch; }
  .nav__cta .btn--donate { width: 100%; text-align: center; }
}

/* =========================
   HERO (Video background)
   ========================= */
/*
 * Hero component
 *
 * The hero section anchors the home page. It stretches across the full width of
 * the viewport and vertically fills a healthy portion of the screen on both
 * desktop and mobile. A video (or image) background sits beneath a semi-
 * transparent overlay to ensure text remains legible.  The container that
 * wraps the hero’s content is layered above the overlay.
 */
.hero {
  position: relative;
  display: grid;
  align-items: center;
  /* Grow taller on larger viewports to avoid cropping the call to action */
  min-height: clamp(480px, 80vh, 800px);
  /* Consistent vertical rhythm whether on desktop or mobile */
  padding: var(--hero-pad) 0;
  width: 100%;
  color: #fff;
  /* Fallback colour behind video if video fails to load */
  background: var(--color-primary);
  overflow: hidden; /* clip the video layer */
}

/* Optional legacy support if a page still sets a static image:
   This won’t inject a placeholder by default (no URL). */
.hero--image { background: center / cover no-repeat var(--hero-image, none); }

.hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0; /* below overlay + content */
}

/* Overlay for contrast (over color or video) */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-hero-overlay);
  z-index: 1;
  pointer-events: none;
}

/* Content above overlay/video */
.hero > .container {
  position: relative;
  z-index: 2;
  max-width: var(--container);
}

.hero__eyebrow {
  font-size: var(--fs-xs);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: color-mix(in oklab, white, var(--color-surface) 25%);
  margin-bottom: var(--space-2);
}
.hero__title {
  font-size: var(--fs-xxl);
  line-height: 1.1;
  margin: 0 0 var(--space-3);
  text-wrap: balance;
}
.hero__subtitle {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: color-mix(in oklab, white, black 8%);
  margin: 0 0 var(--space-6);
  max-width: 60ch;
}
.hero__actions {
  display: flex; gap: var(--space-3); flex-wrap: wrap;
}
.hero__actions .btn { box-shadow: var(--shadow-sm); }
.hero__actions .btn--ghost { color: #fff; border-color: #fff; }
.hero__actions .btn--ghost:hover { background: rgba(255, 255, 255, 0.12); }

/* Make the FIRST hero button (Learn More) match the ghost style */
.hero__actions .btn:first-child {
  background: transparent !important;
  color: #fff !important;
  border-color: #fff !important;
}
.hero__actions .btn:first-child:hover,
.hero__actions .btn:first-child:focus {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
}

/* Custom hero CTA colors (kept for any non-ghost buttons) */
.hero__actions .btn:not(.btn--ghost) {
  background: #184a45; color: #fff; border-color: #184a45;
}
.hero__actions .btn:not(.btn--ghost):hover,
.hero__actions .btn:not(.btn--ghost):focus {
  background: #293f54; color: #fff;
}

/* Reduced motion: hide moving background */
@media (prefers-reduced-motion: reduce) {
  .hero__video { display: none; }
}

/* Tighten on small screens */
@media (max-width: 720px) {
  .hero { text-align: left; }
  .hero__title { font-size: clamp(1.8rem, 7vw, 2.4rem); }
  .hero__subtitle { font-size: 1rem; }
}



/* =========================
   Forms
   ========================= */
input, select, textarea {
  width: 100%;
  padding: .7rem .8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid color-mix(in oklab, var(--color-accent), white 35%);
  border-color: var(--color-accent);
}

label { display: block; font-weight: 600; margin-bottom: var(--space-2); }
label .req { color: var(--color-accent); font-weight: 700; margin-left: .25rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}
.form-grid .full { grid-column: 1 / -1; }

.input { width: 100%; padding: .7rem .8rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font: inherit; background: #fff; }
.input::placeholder { color: #9aa2af; }

.form-note.small { color: var(--color-text); margin-bottom: var(--space-4); }

/* Checkboxes: consistent left + vertical alignment */
.checkbox-row {
  display: grid;                     /* more predictable than flex here */
  grid-template-columns: 1.25rem 1fr;/* fixed column for the box, text fills */
  align-items: center;               /* center the box to the first line of text */
  column-gap: var(--space-2);
  row-gap: 0;
  margin-bottom: var(--space-2);
}

.checkbox-row input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;                         /* remove the old top nudge */
  accent-color: var(--color-primary);/* optional: brand color tick */
}

.checkbox-row label {
  margin: 0;
  font-weight: 400;
  line-height: 1.4;                  /* nicer multi-line wrapping */
}

.form-actions { display: flex; gap: var(--space-3); margin-top: var(--space-4); }

/* Anti-spam honeypot (visually hidden but focusable off-screen) */
.hp {
  position: absolute !important;
  left: -9999px; width: 1px; height: 1px; overflow: hidden;
}

/* Responsive form stack */
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* =========================
   Blockquote
   ========================= */
blockquote {
  border-left: 4px solid var(--color-link);
  padding-left: var(--space-3);
  margin-left: 0;
  background: var(--color-surface);
  border-radius: var(--radius-md);
}

/* =========================
   Images / Badges
   ========================= */
.responsive-img {
  width: 100%; height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
}
.badge {
  display: inline-block;
  background: var(--color-accent);
  color: var(--color-primary);
  border-radius: 999px;
  padding: var(--space-1) var(--space-2);
  font-size: var(--fs-xs);
  font-weight: 700;
}

/* =========================
   HR
   ========================= */
hr { border: none; border-top: 1px solid var(--color-border); margin: var(--space-8) 0; }

/* =========================
   Nav spacing (legacy)
   ========================= */
nav a { margin-left: var(--space-4); font-weight: 600; }
@media (max-width: 720px) { nav a { margin-left: var(--space-3); } }

/* =========================
   Focus styles
   ========================= */
:focus-visible { outline: 3px solid var(--color-primary); outline-offset: 2px; }

/* =========================
   Responsive helpers
   ========================= */
@media (max-width: 800px) {
  .container { max-width: var(--container-narrow); }
  section { padding: var(--space-8) 0; }
}

/* =========================
   Screen-reader only
   ========================= */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); border: 0; white-space: nowrap;
}

/* =========================
   Home: Priorities intro
   ========================= */
.section-title { margin: 0 0 var(--space-2); }
.section-intro { margin: 0 0 var(--space-6); color: var(--color-muted); max-width: 70ch; }

/* =========================
   ABOUT section layout
   ========================= */
.about {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(var(--space-6), 4vw, var(--space-10));
  align-items: center;
}
.about__content h2 { margin-top: 0; }
.about__lede {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--color-muted);
  margin: var(--space-3) 0 var(--space-6);
  max-width: 65ch;
}
.about__actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.about__media { max-width: 520px; justify-self: center; }
.media-frame {
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
}
.media-frame img {
  width: 100%; height: auto; display: block;
  aspect-ratio: 4 / 5; object-fit: cover;
}
.figure-note.small { margin-top: var(--space-2); display: block; text-align: center; opacity: 0.9; }

@media (max-width: 900px) {
  .about { grid-template-columns: 1fr; }
  .about__media { order: -1; }
}

/* Chips */
.chips { display: flex; gap: var(--space-2); flex-wrap: wrap; margin: var(--space-4) 0 var(--space-2); }
.chip {
  display: inline-block; padding: .35rem .6rem; border-radius: 999px;
  background: color-mix(in oklab, var(--color-surface), white 35%);
  border: 1px solid var(--color-border); font-size: var(--fs-xs);
}

/* =========================
   Skip link (a11y)
   ========================= */
.skip-link {
  position: absolute; inset-inline-start: -9999px; inset-block-start: auto;
  width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus {
  inset-inline-start: var(--space-4); inset-block-start: var(--space-4);
  width: auto; height: auto; padding: var(--space-2) var(--space-3);
  background: #fff; color: #000;
  border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  z-index: 1001;
}

/* =========================
   EVENTS — Home teaser + cards
   ========================= */
.events-teaser { padding: var(--space-10) 0; }
.events-header { margin-bottom: var(--space-6); }
.events-title { margin: 0 0 var(--space-2); }
.events-intro { margin: 0; color: var(--color-muted); max-width: 70ch; }

/* Event meta row */
.event-meta {
  display: flex; flex-wrap: wrap;
  gap: var(--space-4);
  margin: var(--space-4) 0 var(--space-6);
}
.meta-item { display: inline-flex; align-items: center; gap: .5rem; color: var(--color-text); }
.meta-item img { width: 22px; height: 22px; }

/* Event list / grid */
.event-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px,1fr));
  gap: var(--space-6);
}
.event-card {
  background: #fff; border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .06s ease;
}
.event-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.event-card h3 { margin: 0 0 var(--space-2); }
.event-card p { margin: 0 0 var(--space-3); }

/* =========================
   Open Porch page
   ========================= */
.op-banner {
  position: relative;
  color: #fff;
  --op-banner: -webkit-image-set(url('/assets/open-porch-banner-1600.webp') type('image/webp') 1x, url('/assets/open-porch-banner-2000.webp') type('image/webp') 2x, url('/assets/open-porch-banner-1600.jpg') type('image/jpeg') 1x, url('/assets/open-porch-banner-2000.jpg') type('image/jpeg') 2x);
  --op-banner: image-set(url('/assets/open-porch-banner-1600.webp') type('image/webp') 1x, url('/assets/open-porch-banner-2000.webp') type('image/webp') 2x, url('/assets/open-porch-banner-1600.jpg') type('image/jpeg') 1x, url('/assets/open-porch-banner-2000.jpg') type('image/jpeg') 2x);
  background-image: var(--op-banner, url('/assets/open-porch-placeholder.svg'));
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  padding: clamp(2.5rem, 6vw, 6rem) 0;
}
.op-banner::after {
  content: ""; position: absolute; inset: 0;
  background: var(--color-hero-overlay);
}
.op-banner > .container { position: relative; z-index: 1; }

.op-banner .small {
  /* Ensure tagline text in the Open Porch banner is white for contrast */
  color: var(--color-footer-text);
}

/* =========================
   CTA / Support section
   ========================= */
/* Section wrapper for call-to-action blocks (support forms) */
.cta {
  background: var(--color-surface);
  border-top: 4px solid var(--color-accent);
  padding: var(--space-10) 0;
}
/* Container-aligned CTA header (matches the form grid’s left edge) */
.cta__header {
  /* don’t create a second width context; just use the parent .container */
  max-width: none;
  /* no centering margin — keep it aligned with form fields */
  margin: 0 0 var(--space-6);
  /* remove the extra inner padding that caused the indent */
  padding: 0;
}

.cta__title {
  margin: 0 0 var(--space-2);
}
.cta__intro {
  margin: 0;
  color: var(--color-muted);
  max-width: 70ch;
}
.op-wrap {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: clamp(var(--space-6), 4vw, var(--space-10));
  align-items: start;
}
.op-form .form-grid { grid-template-columns: 1fr; }

@media (max-width: 900px) {
  .op-wrap { grid-template-columns: 1fr; }
}
/* place this at the very end of the last-loaded CSS file (or last @layer) */
footer.footer { color: var(--color-footer-text); }      /* base text → white */
footer.footer .small,
footer.footer .footer-disclaimer { color: inherit; }    /* inherit white */
footer.footer a { color: inherit; }                     /* links white too */
