/* =========================================================================
   Poshard Foundation for Abused Children — shared stylesheet
   Design system: "Community Ledger" — a printed-program / hand-tallied
   aesthetic that reflects an all-volunteer foundation where 97%+ of every
   dollar raised goes straight back out to children. The roofline motif
   echoes the house shape in the Foundation's own logo ("a safe place").
   ========================================================================= */

:root {
  /* Color tokens */
  --navy: #16243F;       /* primary — header, footer, headings */
  --navy-deep: #0F1A2E;  /* footer background */
  --slate: #4A6FA0;      /* secondary — links, secondary accents */
  --amber: #C2873B;      /* single warm accent — CTAs, tallies, highlights */
  --amber-deep: #A66F2B;
  --paper: #FAF8F4;      /* warm background, not stark white */
  --paper-dim: #F1ECE1;  /* alternating section background */
  --ink: #20201C;        /* body text */
  --ink-soft: #51524C;   /* secondary text */
  --line: #DAD3C5;       /* hairline rule color */
  --alert: #8C2F2F;      /* Report Abuse — distinct from brand palette on purpose */
  --alert-deep: #6E2424;
  --white: #FFFFFF;

  /* Type */
  --font-display: "Lora", Georgia, serif;
  --font-body: "Karla", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;

  --container: 1140px;
  --radius: 4px;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--slate); text-decoration: none; }
a:hover { color: var(--amber-deep); }
ul { margin: 0; padding: 0; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--navy);
  line-height: 1.2;
  margin: 0 0 0.5em;
  font-weight: 600;
}
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* Visible keyboard focus everywhere */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: var(--amber-deep);
  display: block;
  margin-bottom: 0.6em;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--amber);
  color: var(--navy);
  padding: 10px 16px;
  z-index: 200;
  font-weight: 700;
}
.skip-link:focus { left: 8px; top: 8px; }

/* =========================================================================
   Roofline divider — signature structural device.
   A single shallow gable, echoing the house shape in the Foundation logo.
   Used sparingly: once between major section bands, never as decoration.
   ========================================================================= */
.roofline {
  width: 100%;
  height: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.roofline svg { display: block; }
.roofline--light path { stroke: var(--line); }
.roofline--dark path { stroke: rgba(255,255,255,0.18); }

/* =========================================================================
   Header
   ========================================================================= */
.site-header {
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--amber);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  max-width: var(--container);
  margin: 0 auto;
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.brand img {
  height: 56px;
  width: auto;
}
.brand-text {
  display: none;
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.main-nav ul {
  display: flex;
  gap: 4px;
  list-style: none;
}
.main-nav a {
  display: inline-block;
  color: var(--paper);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 10px 14px;
  border-radius: var(--radius);
}
.main-nav a:hover,
.main-nav a:focus-visible {
  background: rgba(255,255,255,0.08);
  color: var(--white);
}
.main-nav a[aria-current="page"] {
  color: var(--amber);
}
.report-btn {
  background: var(--alert);
  color: var(--white) !important;
  padding: 10px 16px !important;
  border-radius: var(--radius);
  font-weight: 700 !important;
}
.report-btn:hover, .report-btn:focus-visible {
  background: var(--alert-deep) !important;
}

.nav-toggle {
  display: none;
  background: none;
  border: 2px solid var(--paper);
  color: var(--paper);
  font-family: var(--font-body);
  font-weight: 700;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
}

@media (max-width: 880px) {
  .nav-toggle { display: inline-block; }
  .main-nav {
    position: fixed;
    inset: 78px 0 0 0;
    background: var(--navy);
    flex-direction: column;
    align-items: stretch;
    padding: 10px 24px 24px;
    transform: translateY(-110%);
    transition: transform 0.25s ease;
    overflow-y: auto;
  }
  .main-nav.is-open { transform: translateY(0); }
  .main-nav ul { flex-direction: column; gap: 2px; }
  .main-nav a { padding: 14px 10px; font-size: 1.05rem; }
  .report-btn { margin-top: 10px; text-align: center; }
}

/* =========================================================================
   Hero
   ========================================================================= */
.hero {
  background: var(--navy);
  color: var(--paper);
  padding: 64px 0 56px;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}
.hero h1 { color: var(--white); }
.hero p.lede {
  font-size: 1.15rem;
  color: #D8DEE9;
  max-width: 38em;
}
.hero-art {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.15);
}
.hero-art img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 820px) {
  .hero-inner { grid-template-columns: 1fr; }
}

/* Buttons */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 700;
  padding: 13px 26px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 0.98rem;
}
.btn-amber {
  background: var(--amber);
  color: var(--navy);
}
.btn-amber:hover, .btn-amber:focus-visible { background: var(--amber-deep); color: var(--white); }
.btn-outline {
  background: transparent;
  border-color: rgba(255,255,255,0.5);
  color: var(--white);
}
.btn-outline:hover, .btn-outline:focus-visible { border-color: var(--white); background: rgba(255,255,255,0.08); }
.btn-outline-dark {
  background: transparent;
  border-color: var(--navy);
  color: var(--navy);
}
.btn-outline-dark:hover, .btn-outline-dark:focus-visible { background: var(--navy); color: var(--white); }
.btn-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 1.6em; }

/* =========================================================================
   Section bands
   ========================================================================= */
.section { padding: 64px 0; }
.section-dim { background: var(--paper-dim); }
.section-navy { background: var(--navy); color: var(--paper); }
.section-navy h2 { color: var(--white); }
.section-head {
  max-width: 46em;
  margin-bottom: 2.2em;
}

/* =========================================================================
   Community Ledger — signature stat strip
   ========================================================================= */
.ledger {
  display: flex;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
}
.ledger-item {
  flex: 1;
  padding: 26px 20px;
  text-align: center;
  border-right: 1px solid var(--line);
}
.ledger-item:last-child { border-right: none; }
.ledger-figure {
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  color: var(--navy);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.ledger-figure span.unit { font-size: 0.55em; color: var(--amber-deep); margin-left: 2px; }
.ledger-label {
  display: block;
  margin-top: 8px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
@media (max-width: 760px) {
  .ledger { flex-direction: column; }
  .ledger-item { border-right: none; border-bottom: 1px solid var(--line); }
  .ledger-item:last-child { border-bottom: none; }
}

/* =========================================================================
   Cards / grids
   ========================================================================= */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}
@media (max-width: 820px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}
.card .eyebrow { margin-bottom: 0.4em; }
.card h3 { margin-bottom: 0.4em; }

/* Program list (used on programs.html) — ledger-row treatment */
.program-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 28px;
  padding: 30px 0;
  border-top: 1px solid var(--line);
}
.program-row:first-of-type { border-top: none; }
.program-tag {
  font-family: var(--font-mono);
  color: var(--amber-deep);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
@media (max-width: 700px) {
  .program-row { grid-template-columns: 1fr; gap: 8px; }
}

/* =========================================================================
   Agency grid — single unified "table" of all partner agencies.
   Cells are either a logo (grayscale-until-hover) or plain/linked text,
   but share one grid with continuous table-style border lines (no visual
   split between "has a logo" and "doesn't").
   ========================================================================= */
.agency-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
@media (max-width: 900px) { .agency-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .agency-grid { grid-template-columns: repeat(2, 1fr); } }

/* Filler cell — 27 agencies divides evenly into 3 columns (9 rows) but
   leaves one stray empty grid track at 4 columns and at 2 columns. This
   blank white cell fills that gap so it reads as just another tile
   instead of a hole; hidden at the 3-column breakpoint where it isn't
   needed and would itself create a new gap. */
.filler-cell {
  background: var(--white);
}
@media (max-width: 900px) { .filler-cell { display: none; } }
@media (max-width: 600px) { .filler-cell { display: flex; } }

.agency-cell {
  background: var(--white);
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  text-align: center;
}
/* Two-class selector beats .gs-hover's single-class display rule,
   regardless of source order — keeps logo tiles truly centered. */
.agency-cell.gs-hover {
  display: flex;
}
.agency-cell img {
  max-height: 52px;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.agency-cell.text-cell {
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--ink);
}
a.agency-cell.text-cell:hover {
  color: var(--amber-deep);
  background: var(--paper-dim);
}
a.agency-cell.logo-cell:hover {
  background: var(--paper-dim);
}

/* Timeline (about.html) */
.timeline {
  border-left: 2px solid var(--line);
  margin-left: 8px;
  padding-left: 28px;
}
.timeline-item { position: relative; padding-bottom: 28px; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -34px;
  top: 4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid var(--paper);
}
.timeline-year {
  font-family: var(--font-mono);
  color: var(--navy);
  font-weight: 700;
}

/* Quote block */
.quote-block {
  border-left: 3px solid var(--amber);
  padding-left: 22px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--navy);
  font-style: italic;
  margin: 1.6em 0;
}
.quote-cite {
  display: block;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-top: 8px;
}

/* =========================================================================
   Gallery (contact-sheet style)
   ========================================================================= */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
@media (max-width: 900px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }
.gallery-item {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--navy);
  border: none;
  padding: 0;
  cursor: pointer;
  display: block;
}
.gallery-item img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.2s ease;
}
.gallery-item:hover img, .gallery-item:focus-visible img { transform: scale(1.04); }
.gallery-cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(transparent, rgba(15,26,46,0.85));
  color: var(--white);
  font-size: 0.78rem;
  padding: 18px 10px 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.gallery-item:hover .gallery-cap,
.gallery-item:focus-visible .gallery-cap { opacity: 1; }

dialog#lightbox {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: min(90vw, 900px);
  background: var(--navy-deep);
}
dialog#lightbox img { width: 100%; max-height: 75vh; object-fit: contain; }
dialog#lightbox .lightbox-cap {
  color: var(--paper);
  padding: 14px 18px;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
dialog#lightbox button.lightbox-close {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
}
dialog#lightbox::backdrop { background: rgba(10,14,22,0.78); }

/* =========================================================================
   News / press list
   ========================================================================= */
.press-item {
  display: flex;
  gap: 20px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}
.press-item:first-child { border-top: none; }
.press-date {
  font-family: var(--font-mono);
  color: var(--amber-deep);
  font-size: 0.85rem;
  white-space: nowrap;
  padding-top: 3px;
}
.press-source {
  font-size: 0.82rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 820px) { .video-grid { grid-template-columns: 1fr; } }
.video-frame {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}
.video-frame iframe {
  width: 100%; height: 100%; border: 0;
}

/* =========================================================================
   Forms
   ========================================================================= */
.form-grid {
  display: grid;
  gap: 18px;
}
label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--navy);
}
input, textarea, select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
}
textarea { resize: vertical; min-height: 130px; }
.required { color: var(--alert); }
.hp-field { position: absolute; left: -9999px; opacity: 0; }

/* =========================================================================
   Contact / address block
   ========================================================================= */
.info-block {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.info-block .logo-jalc { width: 90px; flex-shrink: 0; margin-top: 4px; }
.contact-line { margin-bottom: 0.4em; }
.contact-line strong { color: var(--navy); }

/* =========================================================================
   Donate panel
   ========================================================================= */
.donate-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
}
.donate-amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 22px;
}
.donate-amounts a {
  border: 1px solid var(--navy);
  color: var(--navy);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 700;
  font-family: var(--font-mono);
}
.donate-amounts a:hover, .donate-amounts a:focus-visible {
  background: var(--navy); color: var(--white);
}

/* =========================================================================
   Footer
   Required behavior:
   - Left half: common info, text wraps naturally
   - Right half: Cloudflare badge, 140px wide, equal/parallel with left
   - Hover effect uses ONLY opacity + transform: scale(), 0.15s ease
   ========================================================================= */
.site-footer {
  background: var(--navy-deep);
  color: #C9CFDA;
  padding: 48px 0 26px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 32px;
}
.footer-left {
  flex: 1 1 420px;
  min-width: 260px;
}
.footer-left h4 {
  color: var(--white);
  font-size: 1rem;
  margin-bottom: 0.6em;
}
.footer-cols {
  display: flex;
  flex-wrap: wrap;
  gap: 36px;
}
.footer-col { flex: 1 1 180px; }
.footer-col a, .footer-col span {
  display: block;
  color: #C9CFDA;
  font-size: 0.92rem;
  margin-bottom: 9px;
  word-wrap: break-word;
}
.footer-col a:hover { color: var(--amber); }
.footer-social {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.footer-social a {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  color: var(--paper);
}
.footer-social a:hover { border-color: var(--amber); color: var(--amber); }
.footer-social svg { width: 16px; height: 16px; fill: currentColor; }

.footer-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================================================================
   Grayscale-until-hover treatment
   Used for: Prevent Child Abuse pinwheel, JALC partner logos, sponsor logos.
   Resting state desaturated; hovering/focusing reveals full color.
   ========================================================================= */
.gs-hover {
  filter: grayscale(100%);
  transition: filter 0.15s ease, transform 0.15s ease;
  display: inline-block;
}
.gs-hover:hover, .gs-hover:focus-visible {
  filter: grayscale(0%);
}
/* Variant that also scales 5% on hover (JALC logos) */
.gs-hover-scale:hover, .gs-hover-scale:focus-visible {
  filter: grayscale(0%);
  transform: scale(1.05);
}

/* Cloudflare badge hover effect — opacity + scale ONLY, per spec */
.cf-badge {
  width: 140px;
  height: auto;
  opacity: 0.65;
  transform: scale(1);
  transition: opacity 0.15s ease, transform 0.15s ease;
  display: block;
}
.cf-badge-link {
  display: inline-block;
  line-height: 0;
}
.cf-badge-link:hover .cf-badge,
.cf-badge-link:focus-visible .cf-badge {
  opacity: 1;
  transform: scale(1.05);
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  margin-top: 32px;
  padding-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.82rem;
  color: #8C93A1;
}
.footer-bottom a { color: #8C93A1; }
.footer-bottom a:hover { color: var(--amber); }

@media (max-width: 700px) {
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .footer-right { align-self: flex-start; }
}

/* =========================================================================
   404 page
   ========================================================================= */
.error-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px;
}
.error-page .code {
  font-family: var(--font-mono);
  color: var(--line);
  font-size: 6rem;
  font-weight: 700;
  line-height: 1;
}

/* Utility */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.small { font-size: 0.88rem; color: var(--ink-soft); }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0);
}
