/* ==========================================================================
   Pine Hill Falls: base.css
   Design tokens, local fonts, reset, and the municipal "chrome"
   (utility bar, header, navigation, breadcrumb, footer).
   ========================================================================== */

/* ---------- Local fonts (SIL Open Font License) ---------- */
@font-face {
  font-family: "Literata";
  src: url("../assets/fonts/Literata-Variable.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("../assets/fonts/Literata-Italic-Variable.woff2") format("woff2");
  font-weight: 400 700; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Bebas Neue";
  src: url("../assets/fonts/BebasNeue-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Courier Prime";
  src: url("../assets/fonts/CourierPrime-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Courier Prime";
  src: url("../assets/fonts/CourierPrime-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Patrick Hand";
  src: url("../assets/fonts/PatrickHand-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  /* Daylight: the 2000s town website */
  --navy: #1d2c47;
  --navy-2: #2b3f63;
  --cream: #f4ecd8;
  --paper: #ebe0c3;
  --paper-edge: #d8c9a2;
  --pine: #2d4a37;
  --maple: #a3311d;
  --gold: #b48a35;
  --ink: #26221c;
  --ink-soft: #5b5347;

  /* Underneath: fog, neon, wool, the red edition */
  --fog: #b9bfbd;
  --neon: #ff4fa0;
  --wool: #1f5230;
  --blood: #b3121b;
  --night: #0d1210;

  --font-body: "Literata", Georgia, "Times New Roman", serif;
  --font-sign: "Bebas Neue", "Arial Narrow", Impact, sans-serif;
  --font-doc: "Courier Prime", "Courier New", monospace;
  --font-hand: "Patrick Hand", "Comic Sans MS", cursive;

  /* Type scale (1.25 ratio from 18px) */
  --fs-sm: 0.875rem;
  --fs-base: 1.0625rem;
  --fs-md: 1.25rem;
  --fs-lg: 1.5625rem;
  --fs-xl: 1.953rem;
  --fs-2xl: 2.441rem;
  --fs-3xl: clamp(2.6rem, 7vw, 4.8rem);

  --wrap: 72rem;
  --gap: clamp(1rem, 3vw, 2rem);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, figure, blockquote, ul, ol { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
img, picture, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.65;
  color: var(--ink);
  background: var(--cream);
  /* faint paper grain, pure CSS */
  background-image:
    radial-gradient(rgba(120, 100, 60, 0.05) 1px, transparent 1px);
  background-size: 3px 3px;
  min-height: 100vh;
}

/* While the age gate is up, nothing behind it can scroll */
html.gate-open body { overflow: hidden; }

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

.wrap { width: min(100% - 2 * var(--gap), var(--wrap)); margin-inline: auto; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 200;
  background: var(--navy); color: var(--cream);
  padding: 0.6rem 1rem; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: 2.75rem; padding: 0.55rem 1.25rem;
  font-family: var(--font-body); font-weight: 600; font-size: var(--fs-base);
  line-height: 1.2; text-align: center; text-decoration: none;
  border: 2px solid transparent; border-radius: 3px; cursor: pointer;
  background: var(--navy); color: var(--cream);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}
.btn:hover { background: var(--navy-2); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn--pine { background: var(--pine); }
.btn--pine:hover { background: #3a5e46; }
.btn--ghost { background: transparent; color: var(--navy); border-color: var(--navy); box-shadow: none; }
.btn--ghost:hover { background: rgba(29, 44, 71, 0.08); }

/* ---------- Utility bar ---------- */
.utility {
  background: var(--navy);
  color: #d9d3c2;
  font-size: var(--fs-sm);
}
.utility__inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.25rem;
  padding-block: 0.35rem;
}
.utility__weather { margin-right: auto; }
@media (max-width: 30rem) { .utility__counter { display: none; } }
.utility__counter { font-family: var(--font-doc); letter-spacing: 0.02em; }
.utility__counter output {
  display: inline-block; margin-left: 0.3em; padding: 0 0.3em;
  background: #0f1a2c; color: #9fe39f; border: 1px inset #4a5a78;
}

.lang-switch { display: flex; gap: 0.1rem; }
.lang-switch a {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; color: #d9d3c2; text-decoration: none;
  padding: 0.1rem 0.45rem; font-size: var(--fs-sm);
}
.lang-switch a:hover { text-decoration: underline; }
.lang-switch a[aria-current="true"] {
  color: var(--navy); background: var(--cream); font-weight: 700;
}
.sound-toggle {
  background: none; border: 1px solid #5d6f92; color: #d9d3c2;
  padding: 0.1rem 0.6rem; cursor: pointer; font-size: var(--fs-sm);
}
.sound-toggle[aria-pressed="true"] { border-color: var(--neon); color: #ffd1e6; }

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(#f8f2e3, var(--cream));
  border-bottom: 4px double var(--navy);
}
.site-header__inner {
  display: flex; align-items: center; gap: 1rem;
  padding-block: 1rem;
}
.site-header__brand {
  display: flex; align-items: center; gap: 0.9rem;
  text-decoration: none; color: var(--navy);
}
.seal { width: 4.5rem; height: 4.5rem; flex: none; }
.site-header__names { display: grid; line-height: 1.05; }
.site-header__town {
  font-family: var(--font-sign); font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: 0.03em; color: var(--navy);
}
.site-header__state { font-size: var(--fs-sm); color: var(--ink-soft); }
.site-header__tagline {
  margin-left: auto; font-style: italic; color: var(--pine);
  font-size: var(--fs-md); text-align: right; max-width: 16rem;
}
/* Two little flags, the way every town site had them */
.flags { display: flex; gap: 0.25rem; margin-left: 1rem; }
.flags span { width: 1.4rem; height: 0.9rem; display: block; border: 1px solid rgba(0,0,0,.2); }
.flags .flag-town { background: var(--pine); position: relative; }
.flags .flag-town::after {
  content: ""; position: absolute; inset: 0.2rem 0.5rem;
  background: var(--cream); clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.flags .flag-stripes {
  background: repeating-linear-gradient(var(--maple) 0 0.13rem, var(--cream) 0.13rem 0.26rem);
}

/* ---------- Navigation ---------- */
.site-nav { background: var(--pine); color: var(--cream); position: relative; }
.site-nav__toggle {
  display: none; width: 100%; background: none; border: 0; color: var(--cream);
  padding: 0.75rem var(--gap); text-align: left; font-weight: 600; cursor: pointer;
}
.site-nav__list { display: flex; flex-wrap: wrap; }
.site-nav__list a {
  display: block; padding: 0.7rem 1rem; text-decoration: none;
  font-weight: 600; font-size: 0.95rem; border-right: 1px solid rgba(255,255,255,.12);
}
.site-nav__list li:first-child a { border-left: 1px solid rgba(255,255,255,.12); }
.site-nav__list a:hover { background: rgba(255, 255, 255, 0.1); }
.site-nav__list a[aria-current="page"] { background: var(--cream); color: var(--pine); }

@media (max-width: 52rem) {
  .site-header__tagline, .flags { display: none; }
  .site-nav__toggle { display: flex; justify-content: space-between; }
  .site-nav__toggle::after { content: "☰"; }
  .site-nav__toggle[aria-expanded="true"]::after { content: "✕"; }
  .site-nav__list { display: none; flex-direction: column; }
  .site-nav__list.is-open { display: flex; }
  .site-nav__list a { border: 0; border-top: 1px solid rgba(255,255,255,.12); }
  .site-nav__list li:first-child a { border-left: 0; }
}

/* ---------- Breadcrumb ---------- */
.breadcrumb { font-size: var(--fs-sm); color: var(--ink-soft); padding-block: 0.7rem; }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0; list-style: none; }
.breadcrumb li + li::before { content: "›"; margin-right: 0.4rem; }

/* ---------- Section headings: the municipal "bar" heading ---------- */
.bar-heading {
  font-family: var(--font-sign); font-weight: 400;
  font-size: var(--fs-lg); letter-spacing: 0.04em; line-height: 1;
  color: var(--cream); background: var(--navy);
  padding: 0.45rem 0.8rem 0.3rem;
  border-bottom: 3px solid var(--gold);
}

/* ---------- Photos and their placeholders ---------- */
.photo { position: relative; overflow: hidden; background: #cfc6ad; }
.photo picture { display: block; width: 100%; height: 100%; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
/* When an image file is not there yet, JS adds .is-missing:
   a sepia card with the expected filename, useful while the site is built. */
.photo.is-missing {
  background:
    repeating-linear-gradient(45deg, rgba(0,0,0,.035) 0 10px, transparent 10px 20px),
    linear-gradient(160deg, #d9ceb0, #b9ad8c);
}
.photo.is-missing img { opacity: 0; }
.photo.is-missing::after {
  content: attr(data-missing-label) "\A" attr(data-file);
  white-space: pre; position: absolute; inset: 0 0 auto auto; max-width: 100%;
  padding: 0.5rem 0.7rem; font-family: var(--font-doc); font-size: 0.75rem;
  color: #3b3528; background: rgba(244, 236, 216, 0.85);
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 4rem;
  background: var(--navy); color: #d9d3c2;
  border-top: 6px solid var(--pine);
  font-size: var(--fs-sm);
}
.site-footer__grid {
  display: grid; gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  padding-block: 2.5rem 1.5rem;
}
.site-footer h2 {
  font-family: var(--font-sign); font-weight: 400; font-size: var(--fs-md);
  letter-spacing: 0.05em; color: var(--cream); margin-bottom: 0.5rem;
}
.site-footer a { color: #f1e6c8; }
.site-footer ul { padding: 0; list-style: none; display: grid; gap: 0.3rem; }
.site-footer__decree { font-family: var(--font-doc); margin-top: 0.8rem; color: #aeb5c4; }
.site-footer__archives { color: #7f8aa0 !important; text-decoration-color: #3f4d6a; }
.site-footer__bottom {
  border-top: 1px solid #34466a; padding-block: 1.2rem 1.6rem;
  display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: end; justify-content: space-between;
}
.site-footer__disclaimer { max-width: 44rem; color: #aeb5c4; }
.barcode { display: grid; justify-items: center; gap: 0.15rem; color: #aeb5c4; }
.barcode svg { width: 9rem; height: 2.2rem; }
.barcode span { font-family: var(--font-doc); font-size: 0.7rem; letter-spacing: 0.18em; }

/* Discreet, but still readable (WCAG AA 4.5:1 on the navy footer) */
.site-footer__archives { color: #9aa5bb !important; }
