/* Pigeon Lake Regional Emergency Management Agency — site styles
   Palette follows the REMP: navy #1F3864, blue #2F5496, accent #4472C4, gold #E8A02B */

:root {
  --navy: #1F3864;
  --navy-deep: #152745;
  --blue: #2F5496;
  --accent: #4472C4;
  --gold: #E8A02B;
  --gold-soft: #FBF1DF;
  --tint: #EEF3FA;
  --red: #B42318;
  --red-soft: #FDECEA;
  --amber: #8A5A00;
  --amber-soft: #FFF4DB;
  --green: #1E6B3A;
  --green-soft: #E7F4EC;

  --bg: #FFFFFF;
  --surface: #F6F8FC;
  --text: #1B2433;
  --muted: #4A5568;
  --line: #D5DEEC;
  --link: #2F5496;

  --radius: 6px;
  --wrap: 1120px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1726;
    --surface: #16213A;
    --text: #E6EBF4;
    --muted: #A9B4C8;
    --line: #2A3A5C;
    --link: #9DB8EE;
    --tint: #1A2A4A;
    --gold-soft: #3A2D12;
    --red-soft: #3D1714;
    --amber-soft: #3A2C0E;
    --green-soft: #12301F;
    --amber: #F2C26B;
    --green: #7FD19C;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}
img { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; color: var(--text); }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); margin: 0 0 .5rem; }
h2 { font-size: 1.5rem; margin: 2.25rem 0 .75rem; padding-bottom: .35rem; border-bottom: 3px solid var(--gold); display: inline-block; }
h3 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
p, ul, ol { margin: 0 0 1rem; }
li { margin-bottom: .35rem; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 100; background: #fff; color: var(--navy); padding: .5rem 1rem; border-radius: var(--radius); }

/* 911 strip */
.strip { background: var(--red); color: #fff; font-size: .95rem; }
.strip .wrap { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; justify-content: space-between; padding-top: .4rem; padding-bottom: .4rem; }
.strip a { color: #fff; font-weight: 700; }

/* Header */
.site-header { background: var(--navy); color: #fff; border-bottom: 4px solid var(--gold); }
.site-header .wrap { display: flex; align-items: center; gap: 1rem; padding-top: .75rem; padding-bottom: .75rem; }
.brand { display: flex; align-items: center; gap: .75rem; color: #fff; text-decoration: none; margin-right: auto; }
.brand img { width: 52px; height: auto; }
.brand-name { display: block; font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.brand-sub { display: block; font-size: .8rem; color: #C9D6EE; letter-spacing: .02em; }
.nav-toggle { display: none; align-items: center; gap: .5rem; background: transparent; color: #fff; border: 2px solid #8EA6D4; border-radius: var(--radius); padding: .4rem .75rem; font: inherit; font-weight: 600; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.site-nav > ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .15rem; }
.site-nav li { margin: 0; position: relative; }
.site-nav a { display: block; color: #fff; text-decoration: none; padding: .5rem .7rem; border-radius: var(--radius); font-weight: 600; font-size: .95rem; white-space: nowrap; }
.site-nav a:hover { background: var(--blue); }
.site-nav > ul > li > a[aria-current="page"] { background: var(--blue); box-shadow: inset 0 -3px 0 var(--gold); }
.has-sub { display: flex; align-items: center; }
.has-sub > a { padding-right: .2rem; }
.sub-toggle { background: transparent; border: 0; color: #fff; cursor: pointer; padding: .5rem .45rem .5rem .1rem; border-radius: var(--radius); line-height: 1; }
.sub-toggle::after { content: ""; display: inline-block; width: .45rem; height: .45rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-.15rem) rotate(45deg); transition: transform .15s; }
.sub-toggle[aria-expanded="true"]::after { transform: translateY(.1rem) rotate(-135deg); }
.sub-toggle:hover { background: var(--blue); }
.sub { list-style: none; margin: 0; padding: .35rem; display: none; position: absolute; top: 100%; left: 0; z-index: 50; min-width: 15rem; background: var(--navy-deep); border: 1px solid #2E4A7E; border-top: 3px solid var(--gold); border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 10px 24px rgba(0,0,0,.3); }
.sub a { font-weight: 500; font-size: .93rem; padding: .5rem .7rem; }
.sub .sub-anchor a { padding: .32rem .7rem .32rem 1.7rem; font-size: .87rem; font-weight: 400; color: #C9D6EE; position: relative; }
.sub .sub-anchor a::before { content: ""; position: absolute; left: .95rem; top: 50%; width: .4rem; border-top: 1px solid #7F96C2; }
.sub .sub-anchor a:hover { color: #fff; }
.sub li:not(.sub-anchor) + li:not(.sub-anchor) , .sub .sub-anchor + li:not(.sub-anchor) { border-top: 1px solid #2E4A7E; margin-top: .2rem; padding-top: .2rem; }
.crumbs span { margin: 0 .3rem; }
@media (hover: hover) and (min-width: 901px) {
  .has-sub:hover > .sub { display: block; }
}
.has-sub:focus-within > .sub, .sub.open { display: block; }
.has-sub:last-child > .sub { left: auto; right: 0; }
/* Desktop: the label and its arrow highlight together as one block */
@media (min-width: 901px) {
  .has-sub { border-radius: var(--radius); }
  .has-sub > a:hover, .has-sub .sub-toggle:hover { background: transparent; }
  .has-sub:hover, .has-sub:focus-within, .has-sub.current { background: var(--blue); }
  .site-nav > ul > li.has-sub > a[aria-current="page"] { background: transparent; box-shadow: none; }
  .has-sub.current { box-shadow: inset 0 -3px 0 var(--gold); }
  .has-sub > .sub-toggle:focus-visible { outline-offset: -3px; }
}

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; padding: .45rem .7rem; }
  .site-header .wrap { flex-wrap: wrap; }
  .site-nav { display: none; width: 100%; }
  .site-nav.open { display: block; }
  .site-nav > ul { flex-direction: column; padding: .5rem 0; gap: 0; }
  .site-nav > ul > li { border-top: 1px solid #2E4A7E; }
  .has-sub { flex-wrap: wrap; }
  .has-sub > a { flex: 1; }
  .site-nav a { padding: .7rem .5rem; border-radius: 0; }
  .sub-toggle { padding: .7rem 1rem; }
  .sub { position: static; width: 100%; min-width: 0; box-shadow: none; border: 0; border-left: 3px solid var(--gold); border-radius: 0; margin: 0 0 .5rem .5rem; padding: 0; background: transparent; }
  .has-sub:focus-within > .sub { display: none; }
  .sub.open, .has-sub:focus-within > .sub.open { display: block; }
}

/* Hero */
.hero { background: linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 55%, var(--blue) 100%); color: #fff; }
.hero .wrap { display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: center; padding-top: 2.5rem; padding-bottom: 2.5rem; }
.hero h1 { color: #fff; }
.hero p { color: #DCE5F5; font-size: 1.15rem; max-width: 46rem; }
.hero img { width: 200px; filter: drop-shadow(0 6px 16px rgba(0,0,0,.35)); }
@media (max-width: 700px) { .hero .wrap { grid-template-columns: 1fr; } .hero img { width: 120px; order: -1; } }

.page-head { background: var(--navy); color: #fff; }
.page-head .wrap { padding-top: 1.75rem; padding-bottom: 1.75rem; }
.page-head h1 { color: #fff; margin: 0; }
.page-head p { color: #DCE5F5; margin: .4rem 0 0; max-width: 48rem; }
.crumbs { font-size: .85rem; color: #B8C7E4; margin-bottom: .25rem; }
.crumbs a { color: #DCE5F5; }

.main-body { padding: 1.5rem 0 3rem; }
body[data-page="index"] .main-body { padding-top: 0; }
.prose { max-width: 48rem; }

/* Two-column layout with an "On this page" sidebar */
.page-grid { display: block; }
@media (min-width: 1000px) {
  .page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 3rem; align-items: start; }
  .page-main .prose { max-width: none; }
}
.page-aside { display: none; }
@media (min-width: 1000px) {
  .page-aside { display: block; position: sticky; top: 1rem; margin-top: 2.25rem; }
}
.aside-box { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: 1rem; font-size: .93rem; }
.aside-alert { border-top-color: var(--red); }
.aside-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 0; display: block; margin: 0 0 .5rem; padding: 0; }
.toc { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0; }
.toc a { display: block; padding: .3rem .5rem; border-left: 3px solid transparent; text-decoration: none; color: var(--text); border-radius: 0 4px 4px 0; }
.toc a:hover { background: var(--tint); }
.toc a.active { border-left-color: var(--gold); background: var(--tint); font-weight: 600; }
.aside-alert ul { list-style: none; padding: 0; margin: 0; }
.aside-alert li { margin: .3rem 0; }
.page-main h2[id], .page-main [id] { scroll-margin-top: 1rem; }

/* Buttons */
.btn { display: inline-block; padding: .65rem 1.1rem; border-radius: var(--radius); font-weight: 700; text-decoration: none; border: 2px solid transparent; cursor: pointer; font: inherit; font-weight: 700; }
.btn-gold { background: var(--gold); color: #1B1306; }
.btn-gold:hover { background: #F2B44D; }
.btn-ghost { border-color: #9DB2DA; color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.08); }
.btn-outline { border-color: var(--blue); color: var(--link); background: transparent; }
.btns { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }

/* Cards */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.card h3 { margin-top: 0; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }
a.card { display: block; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
a.card:hover { border-top-color: var(--gold); transform: translateY(-2px); }
a.card h3 { color: var(--link); }
.card .icon { width: 36px; height: 36px; color: var(--accent); margin-bottom: .4rem; }

/* Callouts */
.note { border-left: 5px solid var(--gold); background: var(--tint); padding: .9rem 1.1rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1.25rem 0; }
.note p:last-child, .note ul:last-child { margin-bottom: 0; }
.note.danger { border-color: var(--red); background: var(--red-soft); }
.note.ok { border-color: var(--green); background: var(--green-soft); }
.note strong:first-child { display: block; margin-bottom: .2rem; }

/* Alert stages */
.stages { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 1rem 0 1.5rem; }
.stage { border-radius: var(--radius); padding: 1rem 1.15rem; border: 2px solid; }
.stage h3 { margin: 0 0 .35rem; font-size: 1.2rem; }
.stage .tag { display: inline-block; font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: .1rem .5rem; border-radius: 3px; margin-bottom: .4rem; color: #fff; }
.stage.alert { border-color: var(--gold); background: var(--amber-soft); }
.stage.alert .tag { background: var(--amber); }
@media (prefers-color-scheme: dark) { .stage.alert .tag { color: #1B1306; } }
.stage.order { border-color: var(--red); background: var(--red-soft); }
.stage.order .tag { background: var(--red); }
.stage.rescind { border-color: var(--green); background: var(--green-soft); }
.stage.rescind .tag { background: #1E6B3A; }
.stage ul { margin-bottom: 0; padding-left: 1.2rem; }

/* Numbers table */
.numbers { width: 100%; border-collapse: collapse; margin: .5rem 0 1.25rem; }
.numbers th, .numbers td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.numbers th { background: var(--navy); color: #fff; font-size: .9rem; }
.numbers tr:nth-child(even) td { background: var(--surface); }
.numbers td:first-child { font-weight: 700; white-space: nowrap; }
@media (max-width: 600px) { .numbers th, .numbers td { padding: .45rem .35rem; font-size: .92rem; } .numbers td:first-child { white-space: normal; } .numbers td { overflow-wrap: anywhere; } }

/* Checklists */
.checklist { list-style: none; padding: 0; margin: 0 0 1rem; }
.checklist li { margin: 0; border-bottom: 1px solid var(--line); }
.checklist label { display: flex; gap: .7rem; align-items: flex-start; padding: .5rem .25rem; cursor: pointer; }
.checklist input { width: 1.2rem; height: 1.2rem; margin-top: .25rem; accent-color: var(--blue); flex: none; }
.checklist input:checked + span { color: var(--muted); text-decoration: line-through; }
.kit-progress { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); padding: .6rem 0; display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.bar { flex: 1 1 200px; height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--gold); transition: width .2s; }

/* Worksheet */
.sheet { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.field { display: grid; grid-template-columns: minmax(150px, 30%) 1fr; gap: .5rem 1rem; align-items: end; padding: .45rem 0; border-bottom: 1px dotted var(--line); }
.field label { font-weight: 600; font-size: .95rem; }
.field input { width: 100%; border: 0; border-bottom: 1px solid var(--muted); background: transparent; color: var(--text); font: inherit; padding: .15rem 0; }
@media (max-width: 560px) { .field { grid-template-columns: 1fr; } }

/* Village list */
.villages { columns: 2 220px; padding-left: 1.2rem; }
.map-frame { width: 100%; height: 600px; border: 1px solid var(--line); border-radius: var(--radius); z-index: 0; }
@media (max-width: 700px) { .map-frame { height: 440px; } }
.map-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.leaflet-container { font: inherit; font-size: .9rem; }
.leaflet-control-layers-expanded { line-height: 1.7; }
.leaflet-popup-content a { color: #2F5496; }
@media print { .map-frame { height: 420px; } .leaflet-control-container { display: none; } }

/* Footer */
.site-footer { background: var(--navy-deep); color: #C9D6EE; border-top: 4px solid var(--gold); font-size: .95rem; }
.site-footer .wrap { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); padding-top: 2rem; padding-bottom: 1.5rem; }
.site-footer h2 { color: #fff; font-size: 1rem; border: 0; margin: 0 0 .5rem; padding: 0; }
.site-footer a { color: #fff; }
.site-footer ul { list-style: none; padding: 0; }
.site-footer address { font-style: normal; }
.legal { border-top: 1px solid #2A3E66; }
.legal .wrap { display: block; padding-top: .9rem; padding-bottom: 1rem; font-size: .85rem; color: #9FB2D6; }

/* Print */
.print-only { display: none; }
@media print {
  .strip, .site-header, .site-footer, .no-print, .nav-toggle, .kit-progress .btn { display: none !important; }
  .print-only { display: block; }
  body { font-size: 11pt; color: #000; background: #fff; }
  .page-head, .hero { background: none !important; color: #000; }
  .page-head h1, .hero h1 { color: #000; }
  .page-head p { color: #000; }
  a { color: #000; text-decoration: none; }
  .card, .stage, .note, .sheet { break-inside: avoid; background: none !important; }
  .checklist input { appearance: none; -webkit-appearance: none; border: 1.5px solid #000; border-radius: 2px; }
  .checklist input:checked + span { text-decoration: none; color: #000; }
  h2 { border-bottom-color: #000; }
}

/* Phone numbers never break across lines */
a[href^="tel:"] { white-space: nowrap; }

/* Hamburger icon in the menu button */
.burger, .burger::before, .burger::after { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 1px; position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -6px; }
.burger::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .burger { background: transparent; }
.nav-toggle[aria-expanded="true"] .burger::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .burger::after { top: 0; transform: rotate(-45deg); }

/* Phones: keep the crest, name and menu button on one row */
@media (max-width: 480px) {
  .site-header .wrap { gap: .6rem; }
  .brand { gap: .55rem; }
  .brand img { width: 42px; }
  .brand-name { font-size: .98rem; }
  .brand-sub { font-size: .74rem; }
  .strip .wrap { font-size: .88rem; }
}

/* Keep the menu button on the same row as the crest on every phone */
@media (max-width: 900px) {
  .site-header .wrap { flex-wrap: wrap; }
  .brand { flex: 1 1 0; min-width: 0; margin-right: 0; }
  .nav-toggle { flex: none; }
}
@media (max-width: 400px) {
  .menu-label { display: none; }
  .nav-toggle { padding: .6rem .65rem; }
}

/* Long email address: breaks after the @ (see site.js); slightly smaller on small phones */
.eml { overflow-wrap: break-word; }
@media (max-width: 400px) { .eml { font-size: .92em; } }
