/* =========================================================================
   South Foster Volunteer Fire Company — site.css
   Hand-built, no framework. Mobile-first. One stylesheet for every page.
   Palette: fire red, navy, slate, mist, white.
   ========================================================================= */

:root {
  --red:        #b31942;   /* primary brand / fire red */
  --red-dark:   #8f1235;
  --navy:       #0f2033;   /* headers, footer, dark bands */
  --navy-2:     #1c3450;
  --slate:      #46586c;   /* body text on light */
  --ink:        #16202b;   /* headings */
  --mist:       #f1f4f7;   /* section tint */
  --line:       #d9e0e7;   /* hairlines */
  --white:      #ffffff;
  --gold:       #c9a227;   /* small accents (badge, awards) */

  --chart-bar:  #1c3450;   /* single-series data marks */
  --chart-bar-accent: #b31942;

  --maxw: 1140px;
  --pad: clamp(1rem, 4vw, 2.5rem);
  --radius: 6px;
  --shadow: 0 1px 3px rgba(15, 32, 51, .12), 0 8px 24px rgba(15, 32, 51, .08);

  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Barlow Condensed", "Barlow", system-ui, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  line-height: 1.65;
  color: var(--slate);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink);
  margin: 0 0 .5em;
  letter-spacing: .01em;
}
h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem); text-transform: uppercase; }
h2 { font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem); text-transform: uppercase; }
h3 { font-size: clamp(1.2rem, 1rem + 1vw, 1.5rem); }
p { margin: 0 0 1rem; }
a { color: var(--red); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--red-dark); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { padding-left: 1.25rem; }
li { margin: .3rem 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

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

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--navy); color: #fff; padding: .75rem 1rem; z-index: 200;
}
.skip-link:focus { left: 0; }

/* ---------- layout helpers ---------- */
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad); }
.section { padding-block: clamp(2.5rem, 6vw, 5rem); }
.section--mist { background: var(--mist); }
.section--navy { background: var(--navy); color: #cdd7e2; }
.section--navy h2, .section--navy h3 { color: #fff; }
/* A white card sitting on a navy section keeps normal (dark) text. */
.section--navy .card { color: var(--slate); }
.section--navy .card h1, .section--navy .card h2,
.section--navy .card h3, .section--navy .card h4 { color: var(--ink); }
.lede { font-size: 1.15em; color: var(--slate); max-width: 62ch; }
.center { text-align: center; }
.center .lede { margin-inline: auto; }
.stack > * + * { margin-top: 1rem; }

.grid { display: grid; gap: clamp(1rem, 3vw, 2rem); }
@media (min-width: 620px) { .grid.cols-2 { grid-template-columns: repeat(2, 1fr); } }
/* A sidebar card next to a tall text column shouldn't stretch to match its height. */
@media (min-width: 620px) { .grid.cols-2 > .card { align-self: start; } }
@media (min-width: 820px) { .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 820px) { .grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-head); font-weight: 600; font-size: 1.05rem;
  text-transform: uppercase; letter-spacing: .04em;
  padding: .7rem 1.4rem; border-radius: var(--radius);
  background: var(--red); color: #fff; text-decoration: none;
  border: 2px solid var(--red); cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}
.btn:hover { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }
.btn--ghost { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn--ghost:hover { background: var(--navy); color: #fff; }
.section--navy .btn--ghost { color: #fff; border-color: #fff; }
.section--navy .btn--ghost:hover { background: #fff; color: var(--navy); }
/* On the photo hero, a transparent outline button disappears — give it a solid fill. */
.hero .btn--ghost { background: var(--navy); border-color: #fff; color: #fff; }
.hero .btn--ghost:hover { background: #fff; border-color: #fff; color: var(--navy); }

/* ---------- header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--white);
  border-bottom: 3px solid var(--red);
}
.topbar {
  background: var(--navy); color: #b9c6d3;
  font-size: .85rem;
}
.topbar .wrap { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; align-items: center; justify-content: space-between; padding-block: .4rem; }
.topbar a { color: #dbe4ec; text-decoration: none; }
.topbar a:hover { color: #fff; text-decoration: underline; }
.topbar .emergency { font-weight: 600; color: #fff; }
.topbar .emergency strong { color: var(--gold); }

.headbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .75rem; }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--ink); }
.brand img, .brand svg { width: 52px; height: 52px; flex: none; }
.brand .brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand .brand-name {
  font-family: var(--font-head); font-weight: 700; text-transform: uppercase;
  font-size: 1.15rem; color: var(--red); letter-spacing: .02em;
}
.brand .brand-sub { font-size: .78rem; color: var(--slate); text-transform: uppercase; letter-spacing: .12em; }

.nav-toggle {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-head); font-weight: 600; text-transform: uppercase;
  background: var(--navy); color: #fff; border: 0; border-radius: var(--radius);
  padding: .55rem .9rem; cursor: pointer; font-size: 1rem;
}
.nav-toggle .bars { width: 20px; height: 2px; background: #fff; position: relative; }
.nav-toggle .bars::before, .nav-toggle .bars::after { content: ""; position: absolute; left: 0; width: 20px; height: 2px; background: #fff; }
.nav-toggle .bars::before { top: -6px; }
.nav-toggle .bars::after { top: 6px; }

.primary-nav ul { list-style: none; margin: 0; padding: 0; }
.primary-nav > ul { display: flex; flex-direction: column; }
.primary-nav a {
  display: block; padding: .8rem 0; text-decoration: none;
  font-family: var(--font-head); font-weight: 600; font-size: 1.1rem;
  text-transform: uppercase; letter-spacing: .03em; color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.primary-nav a:hover, .primary-nav a[aria-current="page"] { color: var(--red); }
.primary-nav .has-sub > a::after { content: " ›"; color: var(--slate); }
.primary-nav .sub { padding-left: 1rem; }
.primary-nav .sub a { font-size: 1rem; border-bottom: 1px dashed var(--line); }

@media (max-width: 1039px) {
  .primary-nav {
    display: none;
    border-top: 1px solid var(--line);
  }
  .primary-nav.open { display: block; }
}
@media (min-width: 1040px) {
  .nav-toggle { display: none; }
  .primary-nav { display: block !important; }
  .primary-nav > ul { flex-direction: row; align-items: center; gap: 0; flex-wrap: nowrap; }
  .primary-nav > ul > li { position: relative; }
  .primary-nav > ul > li > a { padding: .55rem .55rem; font-size: 1.02rem; border-bottom: 3px solid transparent; white-space: nowrap; }
  .primary-nav > ul > li > a:hover,
  .primary-nav > ul > li > a[aria-current="page"] { border-bottom-color: var(--red); }
  .primary-nav .sub {
    position: absolute; top: 100%; left: 0; min-width: 220px;
    background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--red);
    box-shadow: var(--shadow); padding: .25rem 0; display: none;
  }
  .primary-nav .has-sub:hover .sub,
  .primary-nav .has-sub:focus-within .sub { display: block; }
  .primary-nav .sub a { padding: .55rem 1rem; border: 0; }
  .primary-nav .sub a:hover { background: var(--mist); }
}

/* ---------- hero ---------- */
.hero {
  position: relative; color: #fff;
  background-color: var(--navy);
  background-image: linear-gradient(180deg, rgba(15,32,51,.60), rgba(15,32,51,.88)), url("/assets/img/hero.jpg");
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
}
.hero .wrap { padding-block: clamp(3rem, 10vw, 7rem); }
.hero h1 { color: #fff; max-width: 18ch; }
.hero p { color: #e4eaf0; font-size: 1.2rem; max-width: 50ch; }
.hero .btn-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.hero .eyebrow {
  font-family: var(--font-head); text-transform: uppercase; letter-spacing: .2em;
  color: var(--gold); font-weight: 600; margin-bottom: .5rem;
}

/* ---------- emergency band ---------- */
.emergency-band {
  background: var(--red); color: #fff; text-align: center;
  font-family: var(--font-head); font-size: 1.15rem; letter-spacing: .04em;
  padding: .8rem 1rem; text-transform: uppercase;
}
.emergency-band strong { font-size: 1.35rem; }

/* ---------- cards / tiles ---------- */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; }
.tile {
  display: flex; flex-direction: column; gap: .5rem;
  background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--red);
  border-radius: var(--radius); padding: 1.5rem; text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
}
a.tile:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(15,32,51,.16), 0 16px 40px rgba(15,32,51,.12); }
.tile .tile-title { font-family: var(--font-head); font-weight: 600; text-transform: uppercase; font-size: 1.25rem; color: var(--red); }
.tile p { margin: 0; font-size: .98rem; color: var(--slate); }

/* ---------- contact / info blocks ---------- */
.infobox { display: grid; gap: .35rem; }
.infobox dt { font-family: var(--font-head); text-transform: uppercase; letter-spacing: .06em; color: var(--slate); font-size: .85rem; margin-top: .75rem; }
.infobox dd { margin: 0; color: var(--ink); }

.pagehead {
  background: var(--navy); color: #d7e0e9;
  padding-block: clamp(2rem, 6vw, 3.5rem);
}
.pagehead h1 { color: #fff; margin-bottom: .25rem; }
.pagehead p { color: #aebccb; margin: 0; }
.breadcrumb { font-size: .85rem; color: #8ea0b2; margin-bottom: .75rem; }
.breadcrumb a { color: #cdd9e4; }

/* ---------- placeholder blocks (awaiting Jon's content) ---------- */
.placeholder {
  border: 2px dashed var(--gold);
  background: #fffdf3;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  color: var(--slate);
}
.placeholder::before {
  content: "Coming soon";
  display: inline-block;
  font-family: var(--font-head); font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; font-size: .78rem;
  background: var(--gold); color: #3a2e00;
  padding: .1rem .5rem; border-radius: 3px; margin-bottom: .5rem;
}
.placeholder p:last-child { margin-bottom: 0; }
.placeholder--form { text-align: center; }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%; border-collapse: collapse; font-size: .96rem;
  background: #fff; border: 1px solid var(--line);
}
table.data caption { text-align: left; font-family: var(--font-head); text-transform: uppercase; color: var(--slate); padding: .5rem 0; }
table.data th, table.data td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--line); }
table.data thead th { background: var(--navy); color: #fff; font-family: var(--font-head); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
table.data tbody tr:nth-child(even) { background: var(--mist); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- EMS stats ---------- */
.statgrid { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 820px) { .statgrid { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--red);
  border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow);
}
.stat .stat-num { font-family: var(--font-head); font-weight: 700; font-size: 2.4rem; color: var(--navy); line-height: 1; font-variant-numeric: tabular-nums; }
.stat .stat-label { font-size: .9rem; color: var(--slate); margin-top: .35rem; }

.chart-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.chart-card h3 { margin-bottom: .25rem; }
.chart-card .chart-sub { font-size: .9rem; color: var(--slate); margin-bottom: 1rem; }

.bars { display: grid; gap: .55rem; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; align-items: center; gap: .6rem; font-size: .92rem; }
.bar-row .bar-label { color: var(--ink); }
.bar-track { background: var(--mist); border-radius: 4px; height: 20px; position: relative; overflow: hidden; }
.bar-fill { position: absolute; inset: 0 auto 0 0; background: var(--chart-bar); border-radius: 0 4px 4px 0; min-width: 3px; }
.bar-row .bar-value { font-variant-numeric: tabular-nums; color: var(--slate); }

.col-chart { display: flex; align-items: flex-end; gap: 2%; height: 200px; padding-top: 1rem; }
.col-chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .35rem; height: 100%; justify-content: flex-end; }
.col-chart .col .col-bar { width: 70%; background: var(--chart-bar); border-radius: 4px 4px 0 0; min-height: 2px; }
.col-chart .col .col-cap { font-size: .78rem; color: var(--slate); }
.col-chart .col .col-val { font-size: .78rem; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }

.updated-note { font-size: .88rem; color: var(--slate); font-style: italic; }
.method-note { font-size: .9rem; color: var(--slate); border-left: 3px solid var(--line); padding-left: 1rem; }

/* ---------- media galleries ---------- */
.gallery { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .gallery { grid-template-columns: repeat(3, 1fr); } }
.gallery a { display: block; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.gallery img { aspect-ratio: 4/3; object-fit: cover; width: 100%; transition: transform .2s; }
.gallery a:hover img { transform: scale(1.04); }

/* ---------- footer ---------- */
.site-footer { background: var(--navy); color: #a9b8c6; padding-block: 2.5rem 1.5rem; font-size: .95rem; }
.site-footer a { color: #d6e0e9; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer h4 { color: #fff; font-size: 1rem; letter-spacing: .06em; margin-bottom: .6rem; }
.site-footer .foot-grid { display: grid; gap: 1.5rem; }
@media (min-width: 700px) { .site-footer .foot-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: .25rem 0; }
.site-footer .foot-bottom {
  margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #24405c;
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between;
  font-size: .85rem; color: #8497a8;
}

/* ---------- misc ---------- */
figure { margin: 0; }
figure img { border-radius: var(--radius); border: 1px solid var(--line); width: 100%; }
figure figcaption { font-size: .85rem; color: var(--slate); margin-top: .5rem; }

.map-embed { border: 0; width: 100%; aspect-ratio: 16/9; border-radius: var(--radius); }
.calendar-embed { border: 0; width: 100%; min-height: 600px; border-radius: var(--radius); background: var(--mist); }
.facts { display: grid; gap: .5rem; }
.facts div { display: flex; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.facts dt { font-family: var(--font-head); text-transform: uppercase; letter-spacing: .04em; color: var(--slate); min-width: 8rem; }
.facts dd { margin: 0; color: var(--ink); font-weight: 500; }
.note { background: var(--mist); border-radius: var(--radius); padding: 1rem 1.25rem; font-size: .95rem; }

/* ---------- contact form ---------- */
.contact-form { display: grid; gap: 1rem; max-width: 34rem; }
.contact-form .field { margin: 0; display: grid; gap: .35rem; }
.contact-form label {
  font-family: var(--font-head); font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; font-size: .82rem; color: var(--slate);
}
.contact-form input,
.contact-form textarea {
  font: inherit; color: var(--ink); width: 100%;
  padding: .6rem .75rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff;
}
.contact-form input:focus, .contact-form textarea:focus {
  outline: 3px solid var(--red); outline-offset: 1px; border-color: var(--red);
}
.contact-form textarea { resize: vertical; min-height: 8rem; }
.contact-form .field-row { margin: 0; display: grid; gap: 1rem; }
@media (min-width: 480px) {
  .contact-form .field-row.two  { grid-template-columns: 1fr 1fr; }
  .contact-form .field-row.city { grid-template-columns: 2fr 1fr 1fr; }
}
.contact-form .field-row .field { margin: 0; }
.contact-form button { margin-top: .25rem; }
.contact-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
#form-error { border-left: 4px solid var(--red); }
