/* ============================================================
   TankCheck — "Hazard File" design system
   Palette: concrete off-white / graphite ink / steel blue.
   Safety orange #E8590C is reserved STRICTLY for leaks & grades D–F.
   Green #2F7D4F only for grades A–B.
   ============================================================ */

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-900.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jbmono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jbmono-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --canvas: #f5f4f1;
  --panel: #ffffff;
  --ink: #1a1c1e;
  --ink-soft: #4a4e52;
  --ink-faint: #82878c;
  --line: #d9d7d2;
  --steel: #3d5a73;
  --steel-deep: #2c4257;
  --orange: #e8590c;
  --green: #2f7d4f;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --disp: "Archivo", "Inter", system-ui, sans-serif;
  --hatch: repeating-linear-gradient(
    -45deg,
    rgba(26, 28, 30, 0.04) 0 8px,
    transparent 8px 16px
  );
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #141618;
    --panel: #1c1f22;
    --ink: #ecebe8;
    --ink-soft: #b3b6b9;
    --ink-faint: #7c8085;
    --line: #33373b;
    --steel: #6e93b3;
    --steel-deep: #8fb2cf;
    --hatch: repeating-linear-gradient(
      -45deg,
      rgba(236, 235, 232, 0.04) 0 8px,
      transparent 8px 16px
    );
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--steel); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--steel-deep); }

code, .mono { font-family: var(--mono); }

/* ---------- header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--canvas);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--disp);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand svg { display: block; }
.brand .tld { color: var(--steel); font-weight: 700; }
.site-nav { display: flex; gap: 18px; font-size: 14px; }
.site-nav a { color: var(--ink-soft); text-decoration: none; font-weight: 600; }
.site-nav a:hover { color: var(--ink); }

/* ---------- generic page shell (guides, county pages) ---------- */
.page-wrap { max-width: 880px; margin: 0 auto; padding: 32px 20px 64px; }
.page-wrap h1 {
  font-family: var(--disp);
  font-weight: 900;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}
.page-wrap h2 {
  font-family: var(--disp);
  font-weight: 700;
  font-size: 22px;
  margin: 36px 0 10px;
  letter-spacing: -0.01em;
}
.page-wrap h3 { font-family: var(--disp); font-weight: 700; font-size: 17px; margin: 24px 0 8px; }
.kicker {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--steel);
  margin: 0 0 8px;
}
.lede { font-size: 18px; color: var(--ink-soft); margin: 0 0 24px; }
.breadcrumbs { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); margin-bottom: 18px; }
.breadcrumbs a { color: var(--ink-faint); }

/* stat strip on data pages */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 22px 0;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px 14px 10px;
}
.stat b {
  display: block;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.02em;
}
.stat.orange b { color: var(--orange); }
.stat span {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 14px 0 22px;
}
table.data th {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--line);
}
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data td.num { font-family: var(--mono); text-align: right; }

.cta-band {
  margin: 30px 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--steel);
  border-radius: 4px;
  background: var(--panel);
}
.cta-band h2, .cta-band h3 { margin-top: 0; }
.btn {
  display: inline-block;
  background: var(--steel);
  color: #fff;
  font-family: var(--disp);
  font-weight: 700;
  font-size: 15px;
  padding: 11px 22px;
  border-radius: 4px;
  border: 0;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--steel-deep); color: #fff; }

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px 20px;
  padding: 0;
  margin: 14px 0 24px;
  list-style: none;
  font-size: 14px;
}
.link-grid .n { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 48px;
  padding: 26px 20px 40px;
  font-size: 13px;
  color: var(--ink-faint);
}
.site-footer .cols {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  justify-content: space-between;
}
.site-footer a { color: var(--ink-soft); }
.disclaimer {
  max-width: 880px;
  margin: 14px auto 0;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-faint);
}

/* ============================================================
   THE APP  (index)
   ============================================================ */
.app-hero {
  position: relative;
  padding: 56px 20px 40px;
  text-align: center;
  overflow: hidden;
}
.app-hero h1 {
  font-family: var(--disp);
  font-weight: 900;
  font-size: clamp(30px, 6vw, 52px);
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0 0 12px;
}
.app-hero .sub { color: var(--ink-soft); font-size: 17px; max-width: 620px; margin: 0 auto 28px; }

.search-bar {
  display: flex;
  gap: 8px;
  max-width: 680px;
  margin: 0 auto;
  flex-wrap: wrap;
}
.search-bar input[type="text"] {
  flex: 1 1 320px;
  font-family: var(--mono);
  font-size: 15px;
  padding: 13px 14px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
}
.search-bar input[type="text"]:focus { border-color: var(--steel); }
.search-bar select {
  font-family: var(--mono);
  font-size: 14px;
  padding: 12px 10px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--panel);
  color: var(--ink);
}
.search-bar .btn { font-size: 16px; padding: 12px 26px; }
.search-hint { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); margin-top: 10px; }
.search-error {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--orange);
  margin-top: 10px;
  font-weight: 600;
}

.trust-strip {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  text-align: center;
  padding: 10px 20px 26px;
}

/* ---------- results layout ---------- */
.results {
  display: grid;
  grid-template-columns: 380px 1fr;
  align-items: start;   /* keep the map from stretching to the list's height */
  gap: 0;
  border-top: 1px solid var(--line);
  min-height: 640px;
}
@media (max-width: 900px) {
  .results { grid-template-columns: 1fr; }
}
.rail { padding: 22px 20px 30px; border-right: 1px solid var(--line); }
@media (max-width: 900px) { .rail { border-right: 0; border-bottom: 1px solid var(--line); } }

/* ---------- grade plate ---------- */
.grade-plate {
  position: relative;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--panel);
  padding: 22px 22px 18px;
  display: flex;
  gap: 20px;
  align-items: center;
}
.grade-plate::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 6px;
  background: var(--hatch);
  pointer-events: none;
}
.grade-letter {
  font-family: var(--disp);
  font-weight: 900;
  font-size: 120px;
  line-height: 0.9;
  letter-spacing: -0.04em;
  min-width: 96px;
  text-align: center;
  color: var(--steel);
}
.grade-letter.g-a, .grade-letter.g-b { color: var(--green); }
.grade-letter.g-c { color: var(--steel); }
.grade-letter.g-d, .grade-letter.g-f { color: var(--orange); }
.grade-meta { position: relative; z-index: 1; }
.grade-meta .g-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.grade-verdict { font-size: 15.5px; font-weight: 600; line-height: 1.45; }
.grade-counts { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); margin-top: 8px; }
.grade-plate.skeleton .grade-letter { color: var(--line); }

.vintage {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
  color: var(--ink-faint);
  margin: 12px 2px 0;
}
.vintage a { color: var(--ink-soft); }

.share-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.share-row button {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  color: var(--ink-soft);
  cursor: pointer;
}
.share-row button:hover { border-color: var(--steel); color: var(--steel); }

/* ---------- facility list ---------- */
.list-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 26px 0 8px;
}
.list-head h2 {
  font-family: var(--disp);
  font-weight: 700;
  font-size: 16px;
  margin: 0;
  letter-spacing: 0.01em;
}
.list-head .count { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); }

.fac-list { list-style: none; margin: 0; padding: 0; }
.fac-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  border-left: 3px solid transparent;
}
.fac-row:hover { background: var(--panel); }
.fac-row.active { background: var(--panel); border-left-color: var(--steel); }
.fac-row .f-name { font-weight: 600; font-size: 14px; line-height: 1.35; }
.fac-row .f-addr { grid-column: 1; font-size: 12.5px; color: var(--ink-faint); }
.fac-row .f-dist {
  grid-row: 1 / span 2;
  grid-column: 2;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  color: var(--ink-soft);
  align-self: center;
  white-space: nowrap;
}
.chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.chip {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 2px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background: transparent;
}
.chip.steel { border-color: var(--steel); color: var(--steel); }
.chip.orange { border-color: var(--orange); color: var(--orange); }
.chip.orange-solid { background: var(--orange); border-color: var(--orange); color: #fff; }
.chip.green { border-color: var(--green); color: var(--green); }

/* skeleton rows */
.skel-row { padding: 14px 10px; border-bottom: 1px solid var(--line); }
.skel-bar {
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--line) 25%, var(--panel) 50%, var(--line) 75%);
  background-size: 200% 100%;
  animation: skel 1.2s linear infinite;
  margin-bottom: 8px;
}
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- map ---------- */
/* Bounded + sticky: the map stays in view while the facility list scrolls.
   Unbounded height made the pane grow to the full list height (>4000px). */
.map-pane {
  position: sticky;
  top: 12px;
  height: min(calc(100vh - 96px), 720px);
  min-height: 420px;
  background: #0d0f11;
  overflow: hidden;
}
@media (max-width: 900px) {
  /* map first on mobile: map (300px) + grade plate both fit the first viewport */
  .map-pane {
    position: relative;   /* must stay a positioning context for the canvases */
    top: auto;
    order: -1;
    height: 300px;
    min-height: 0;
    border-bottom: 1px solid var(--line);
  }
}
#map-tiles, #map-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#map-tiles { filter: brightness(0.75) saturate(0.85); }
#map-overlay { cursor: grab; }
#map-overlay.dragging { cursor: grabbing; }
.map-attrib {
  position: absolute;
  right: 0;
  bottom: 0;
  font-family: var(--mono);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(13, 15, 17, 0.65);
  padding: 3px 8px;
  z-index: 3;
}
.map-legend {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 3;
  background: rgba(13, 15, 17, 0.78);
  color: #ecebe8;
  font-family: var(--mono);
  font-size: 11px;
  padding: 8px 12px;
  border-radius: 4px;
  display: grid;
  gap: 4px;
}
.map-legend span { display: flex; align-items: center; gap: 7px; }
.zoom-ctl {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 3;
  display: grid;
  gap: 4px;
}
.zoom-ctl button {
  width: 34px;
  height: 34px;
  font-size: 18px;
  font-family: var(--mono);
  border: 0;
  border-radius: 4px;
  background: rgba(13, 15, 17, 0.78);
  color: #ecebe8;
  cursor: pointer;
}

/* ---------- detail drawer ---------- */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(440px, 100vw);
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.18);
  z-index: 50;
  transform: translateX(102%);
  transition: transform 0.22s ease;
  overflow-y: auto;
  padding: 20px 22px 40px;
}
.drawer.open { transform: translateX(0); }
.drawer.has-release { border-top: 4px solid var(--orange); }
.drawer-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 13px;
  width: 30px;
  height: 30px;
  border-radius: 2px;
  cursor: pointer;
}
.drawer h3 {
  font-family: var(--disp);
  font-weight: 700;
  font-size: 19px;
  margin: 4px 40px 2px 0;
  letter-spacing: -0.01em;
}
.drawer .d-addr { font-size: 13px; color: var(--ink-faint); margin-bottom: 4px; }
.drawer .d-id { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }
.d-section {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--steel);
  margin: 22px 0 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 5px;
}
.tank-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tank-table th {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  text-align: left;
  padding: 4px 6px 4px 0;
}
.tank-table td { padding: 5px 6px 5px 0; border-top: 1px solid var(--line); vertical-align: top; }
.tank-table .mono { font-size: 12px; }
.release-item {
  border: 1px solid var(--line);
  border-left: 3px solid var(--orange);
  border-radius: 2px;
  padding: 9px 11px;
  margin-bottom: 8px;
  font-size: 12.5px;
}
.release-item .mono { font-size: 11.5px; color: var(--ink-soft); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 12.5px; }
.kv dt { color: var(--ink-faint); font-family: var(--mono); font-size: 11px; padding-top: 2px; }
.kv dd { margin: 0; font-weight: 600; }
.verify-line {
  margin-top: 20px;
  font-size: 12.5px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  color: var(--ink-soft);
}

/* ---------- below-fold marketing ---------- */
.below-fold { max-width: 880px; margin: 0 auto; padding: 48px 20px 20px; }
.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 20px 0 40px;
}
.how-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px;
}
.how-card b { font-family: var(--disp); font-size: 16px; display: block; margin-bottom: 6px; }
.how-card .step-n { font-family: var(--mono); font-size: 11px; color: var(--steel); letter-spacing: 0.12em; }
.how-card p { font-size: 14px; color: var(--ink-soft); margin: 6px 0 0; }

/* ---------- ad slots: invisible until framework marks them ready ---------- */
.ad-slot { display: none; }
.ad-slot[data-ready] {
  display: block;
  margin: 26px auto;
  text-align: center;
  min-height: 50px;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--canvas);
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 4px;
  z-index: 90;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ---------- print: clean screening memo ---------- */
@media print {
  .site-header, .site-nav, .search-bar, .search-hint, .share-row, .map-pane,
  .zoom-ctl, .ad-slot, .below-fold, .site-footer .cols, .drawer, .app-hero .sub,
  .trust-strip, .toast, .search-error { display: none !important; }
  body { background: #fff; color: #000; }
  .results { display: block; border: 0; min-height: 0; }
  .rail { border: 0; padding: 0; }
  .grade-plate { break-inside: avoid; }
  .fac-row { cursor: default; break-inside: avoid; }
  .disclaimer { display: block; }
  .print-stamp { display: block !important; font-family: var(--mono); font-size: 11px; margin: 8px 0 16px; }
}
.print-stamp { display: none; }
