/* Mobile-first: base styles target phones; min-width queries add desktop layout.
   Palette and fonts follow the school's site (kingphilip.whps.org): royal blue + white,
   Fjalla One headings, Lato body. */
:root {
  --color-primary: #2e318e;
  --color-primary-contrast: #ffffff;
  --color-secondary: #004c79;
  --color-brand: #2e318e; /* fixed school blue for hero/footer in both themes */
  --color-focus: #004c79;
  --color-bg: #ffffff;
  --color-bg-alt: #f1f2f9;
  --color-text: #2c2c2c;
  --color-muted: #5e5e5e;
  --color-border: #d9dae8;
  --font-heading: "Fjalla One", "Arial Narrow", Arial, sans-serif;
  --radius: 10px;
  --gutter: 16px;
  --max-width: 1080px;
  --header-height: 60px;
  --font: Lato, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-primary: #a9adf5;
    --color-primary-contrast: #12133a;
    --color-secondary: #7cc3ec;
    --color-focus: #f2f3ff;
    --color-bg: #10112b;
    --color-bg-alt: #181a3d;
    --color-text: #eceefa;
    --color-muted: #b4b7cf;
    --color-border: #2c2f63;
  }
}

/* Self-hosted latin subsets from Google Fonts (SIL OFL 1.1, licenses in fonts/). */
@font-face {
  font-family: "Fjalla One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/fjalla-one-400.woff2") format("woff2");
}
@font-face {
  font-family: "Lato";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/lato-400.woff2") format("woff2");
}
@font-face {
  font-family: "Lato";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/lato-700.woff2") format("woff2");
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 8px);
  -webkit-text-size-adjust: 100%;
}

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.2;
  margin: 0 0 0.6em;
  color: var(--color-primary);
}
h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

a { color: var(--color-primary); }
a:focus-visible, button:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  border-radius: var(--radius);
}
.skip-link:focus { top: 8px; }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.narrow { max-width: 720px; }

/* Header and nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
  text-decoration: none;
}
/* The logo images have white backgrounds; a white tile keeps them clean on dark and blue. */
.brand-logo {
  display: block;
  width: 60px;
  height: 48px;
  background: #ffffff;
  border-radius: 6px;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  cursor: pointer;
}
.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  position: relative;
}
.nav-toggle-bar::before,
.nav-toggle-bar::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bar::before { top: -6px; }
.nav-toggle-bar::after { top: 6px; }

.site-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}
.site-nav.is-open { display: block; }
.site-nav ul { list-style: none; margin: 0; padding: 4px 0; }
.site-nav a {
  display: block;
  padding: 12px var(--gutter);
  min-height: 44px;
  color: var(--color-text);
  text-decoration: none;
  font-weight: 700;
}
.site-nav a[aria-current="page"] { color: var(--color-primary); box-shadow: inset 0 -3px 0 currentColor; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 700;
  text-decoration: none;
  border: 2px solid var(--color-primary);
}
.btn-primary { background: var(--color-primary); color: var(--color-primary-contrast); }
.btn-secondary { background: transparent; color: var(--color-primary); }

/* Sections. .hero is the home banner; .page-hero is the shorter banner on other pages. */
.hero, .page-hero {
  padding: 48px 0 40px;
  background: var(--color-brand);
  color: #ffffff;
}
.page-hero { padding: 32px 0 28px; }
.page-hero h1 { margin: 0; }
.page-hero .lead { margin: 12px 0 0; }
.hero h1, .page-hero h1 { color: #ffffff; }
.hero .eyebrow, .hero .lead, .page-hero .lead { color: rgba(255, 255, 255, 0.88); }
.hero .btn-primary { background: #ffffff; color: var(--color-brand); border-color: #ffffff; }
.hero .btn-secondary { color: #ffffff; border-color: #ffffff; }
.hero a:focus-visible, .page-hero a:focus-visible, .site-footer a:focus-visible { outline-color: #ffffff; }
address { font-style: normal; }
.eyebrow {
  margin-bottom: 0.4em;
  color: var(--color-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.85rem;
}
.lead { font-size: 1.15rem; color: var(--color-muted); }
.cta-row { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.hero-logo {
  width: min(100%, 320px);
  margin: 0 auto 24px;
  padding: 12px;
  background: #ffffff;
  border-radius: 16px;
}
.hero-logo img { display: block; width: 100%; height: auto; }

.section { padding: 48px 0; }
.section-alt { background: var(--color-bg-alt); }
.section-intro { color: var(--color-muted); }
.empty-note { color: var(--color-muted); font-style: italic; }

/* Home: links to each page */
.link-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.link-card {
  display: block;
  min-height: 44px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  text-decoration: none;
}
.link-card:hover { border-color: var(--color-primary); }
.link-card-title {
  display: block;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--color-primary);
}
.link-card-text { display: block; color: var(--color-muted); }

/* About */
.mission { font-size: 1.15rem; }
.org-details { margin: 0; display: grid; gap: 4px 16px; }
.org-details dt { font-weight: 700; color: var(--color-muted); font-size: 0.9rem; margin-top: 12px; }
.org-details dt:first-child { margin-top: 0; }
.org-details dd { margin: 0; overflow-wrap: anywhere; }

/* Events */
.event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
/* Until main.js fills the list, hold a screen's height so the footer starts
   below the fold and nothing visible moves when events appear (CLS). */
.event-list:empty { min-height: 100vh; }
.event-list[hidden] { display: none; }
.event {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.event-date {
  flex-shrink: 0;
  width: 56px;
  text-align: center;
  line-height: 1.1;
  color: var(--color-primary);
}
.event-month { display: block; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; }
.event-day { display: block; font-size: 1.6rem; font-weight: 700; }
.event-title { margin: 0 0 4px; font-size: 1.05rem; font-family: var(--font); font-weight: 700; color: var(--color-text); }
.event-month-heading h3 { margin: 16px 0 0; font-size: 1.3rem; }
.event-month-heading:first-child h3 { margin-top: 0; }
.event-meta { margin: 0; color: var(--color-muted); font-size: 0.95rem; }
.event-details { margin: 6px 0 0; font-size: 0.95rem; }
.event-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
}

/* Support cards */
.card-grid { display: grid; gap: 20px; }
.card {
  padding: 20px var(--gutter);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}

/* Programs page */
.program + .program { margin-top: 32px; }
.program h2 { font-size: 1.5rem; margin-bottom: 0.4em; }
.funding-more { margin-top: 16px; }

/* Programs list (About, Support) */
.program-list { padding-left: 1.2em; margin: 0 0 1em; }
.program-list li { margin-bottom: 4px; }

/* Volunteer */
.check-list { padding-left: 1.2em; margin: 0 0 24px; }
.check-list li { margin-bottom: 6px; }

/* Board */
.board-grid {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.board-member {
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.role { display: block; font-size: 0.85rem; color: var(--color-muted); font-weight: 700; }
.name { display: block; font-weight: 700; overflow-wrap: anywhere; }
.contact-line a { font-weight: 700; overflow-wrap: anywhere; }
.contact-address { margin-bottom: 1em; }

/* Footer */
.site-footer {
  padding: 28px 0;
  background: var(--color-brand);
  color: #ffffff;
  font-size: 0.95rem;
}
.site-footer a { color: inherit; }
.site-footer p { margin: 0 0 6px; }
.footer-inner { display: grid; gap: 16px; }
.footer-name { font-weight: 700; }
.site-footer address { margin: 0 0 6px; }
.fine-print { opacity: 0.85; font-size: 0.85rem; }

/* Larger screens */
@media (min-width: 768px) {
  h1 { font-size: 2.75rem; }
  h2 { font-size: 2rem; }
  .hero { padding: 88px 0 72px; }
  .hero-inner { display: grid; grid-template-columns: 1fr 320px; gap: 48px; align-items: center; }
  .hero-logo { order: 2; margin: 0; }
  .section { padding: 72px 0; }
  .cta-row { flex-direction: row; }
  .card-grid { grid-template-columns: 1fr 1fr; }
  .link-cards { grid-template-columns: repeat(3, 1fr); }
  .org-details { grid-template-columns: max-content 1fr; }
  .org-details dt, .org-details dt:first-child { margin-top: 0; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .page-hero { padding: 48px 0 40px; }
  .board-grid { grid-template-columns: repeat(4, 1fr); }

  .nav-toggle { display: none; }
  .site-nav {
    display: block;
    position: static;
    border: 0;
    background: none;
  }
  .site-nav ul { display: flex; gap: 4px; padding: 0; }
  .site-nav a { padding: 10px; min-height: 0; }
}
