/* HUD Scores design system.
   Register: authoritative civic-data record. Chrome is monochrome navy/paper;
   pass/watch/fail color appears ONLY on scores, so the eye lands on signal. */

:root {
  color-scheme: light dark;

  /* color */
  --brand: #173357;        /* oxford navy: header band, solid chips, buttons */
  --brand-hover: #1f4271;
  --on-brand: #ffffff;
  --on-brand-soft: rgba(255, 255, 255, 0.72);
  --ink: #1a2029;
  --ink-soft: #5a6472;
  --page: #f6f7f5;
  --panel: #ffffff;
  --line: #dde3e9;
  --line-strong: #c3ccd6;
  --row-hover: #f0f3f6;
  --accent: #1e5da8;       /* links */
  --pass: #1e7a4a;   --pass-bg: #e6f4ec;
  --watch: #8a5a00;  --watch-bg: #faf0da;
  --fail: #a52a21;   --fail-bg: #f9ebe9;
  --none: #5a6472;   --none-bg: #edf0f3;
  --chip-solid-bg: var(--brand);
  --chip-solid-ink: var(--on-brand);
  /* The one high-chroma call to action (the search button). */
  --cta-bg: #1e5da8; --cta-hover: #174b89; --cta-ink: #ffffff;
  /* Brand-colored emphasis that stays legible in both schemes (hero stat,
     callout edge); plain --brand vanishes against the dark page. */
  --emphasis-ink: #173357;
  --card-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.04);
  --panel-float-shadow: 0 10px 28px rgba(16, 24, 40, 0.18), 0 2px 8px rgba(16, 24, 40, 0.1);

  /* type */
  --font-serif: "Charter", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;

  /* layout */
  --container: 50rem;
  --gutter: 1.25rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #15233c;
    --brand-hover: #1d3053;
    --on-brand: #eef2f8;
    --on-brand-soft: rgba(238, 242, 248, 0.66);
    --ink: #e7ebf1;
    --ink-soft: #98a3b1;
    --page: #10151c;
    --panel: #161c25;
    --line: #2a3341;
    --line-strong: #3a4656;
    --row-hover: #1b2330;
    --accent: #7fa9e8;
    --pass: #5fcf96;   --pass-bg: #12291e;
    --watch: #dfb35e;  --watch-bg: #2a2314;
    --fail: #ef8a82;   --fail-bg: #2e1a18;
    --none: #98a3b1;   --none-bg: #1e2530;
    --chip-solid-bg: #7fa9e8;
    --chip-solid-ink: #0e1726;
    --cta-bg: #7fa9e8; --cta-hover: #a4c2f1; --cta-ink: #0e1726;
    --emphasis-ink: #7fa9e8;
    --card-shadow: none;
    --panel-float-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.6 var(--font-sans);
  /* The full-bleed hero band is sized with 100vw, which includes any classic
     scrollbar; clip the sliver so the page never scrolls sideways. */
  overflow-x: clip;
}

main {
  max-width: var(--container);
  margin: 0 auto;
  padding: 2rem var(--gutter) 4rem;
}

a { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* ---- header band ------------------------------------------------------- */

.site-header {
  background: var(--brand);
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
}
.site-header-inner {
  display: flex; flex-wrap: wrap; gap: 0.75rem 1.75rem;
  align-items: center; justify-content: space-between;
  max-width: var(--container); margin: 0 auto;
  padding: 0.9rem var(--gutter);
}
.wordmark {
  display: inline-flex; align-items: center; gap: 0.45rem;
  text-decoration: none; white-space: nowrap;
}
.wordmark-plate {
  font-family: var(--font-sans); font-size: 0.82rem; font-weight: 800;
  letter-spacing: 0.06em; padding: 0.18em 0.42em; border-radius: 3px;
  background: var(--on-brand); color: var(--brand);
}
.wordmark-word {
  font-family: var(--font-serif); font-size: 1.3rem; font-weight: 600;
  letter-spacing: 0.005em; color: var(--on-brand);
}
.site-header nav { display: flex; flex-wrap: wrap; gap: 0.35rem 1.35rem; font-size: 0.875rem; }
.site-header nav a { color: var(--on-brand-soft); text-decoration: none; }
.site-header nav a:hover { color: var(--on-brand); text-decoration: underline; }
.site-header :focus-visible { outline-color: var(--on-brand); }

/* ---- type -------------------------------------------------------------- */

h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.7rem, 4.5vw, 2.35rem);
  line-height: 1.15; letter-spacing: -0.01em; font-weight: 700;
  margin: 0 0 0.5rem;
}
h2 {
  font-family: var(--font-serif);
  font-size: 1.3rem; line-height: 1.25; font-weight: 700;
  letter-spacing: -0.005em; margin: 2.5rem 0 0.75rem;
}
.lede { font-size: 1.05rem; color: var(--ink-soft); margin-top: 0.25rem; }
.note { font-size: 0.875rem; color: var(--ink-soft); }
.eyebrow {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--ink-soft); margin: 0 0 0.6rem;
}

.hero { padding-top: 0.75rem; }
.hero-compact { padding-top: 0; }

/* Small-caps section labels: wayfinding, not content. They share the
   score-card-label vocabulary so the data under them stays the loud part. */
h2.section-label {
  display: flex; align-items: center; gap: 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--ink-soft);
  margin: 0 0 0.9rem;
}
h2.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---- homepage ---------------------------------------------------------- */

/* Eye order on the homepage: (1) headline on the navy band, (2) the search
   card floating out of the band, (3) the recently-scored strip, (4) the hero
   stat, (5) the callout. Everything below enforces that order. */

/* The navy band continues the header chrome full-bleed; the negative side
   margins break out of main's centered column. */
.hero-band {
  margin: -2rem calc(50% - 50vw) 0;
  background: var(--brand);
  border-bottom: 1px solid rgba(0, 0, 0, 0.25); /* same edge as the header band */
}
.hero-band-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 2.75rem var(--gutter) 0;
}
.hero-band .eyebrow { color: var(--on-brand-soft); }
.hero-band h1 {
  color: var(--on-brand);
  font-size: clamp(1.9rem, 5.5vw, 2.7rem);
  margin-bottom: 0.6rem;
}
.hero-band .lede { color: var(--on-brand-soft); max-width: 38rem; margin: 0; }

/* The search card is the page's action: the brightest surface, floating half
   out of the band so the eye falls from the headline straight into it. */
.search-panel {
  position: relative;
  margin: 2rem 0 -2.25rem;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  box-shadow: var(--panel-float-shadow);
}
.search-panel .property-search { margin: 0; }
.search-panel #search-results:not(:empty) { margin-top: 0.75rem; }
.search-panel .result-list { margin: 0; }
.search-panel .result-list li:last-child { border-bottom: none; }
.search-panel .search-message { margin: 0.85rem 0 0.25rem; font-size: 0.9rem; }

.home-section { margin-top: 3.25rem; }
.hero-band + .home-section { margin-top: 5.5rem; }

/* Recently-scored strip: real rows from the record, one per score band, so
   the color language does the explaining. */
.recent-strip {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
.recent-row {
  display: flex; align-items: center; gap: 0.55rem 1rem; flex-wrap: wrap;
  padding: 0.8rem 1rem;
  text-decoration: none; color: inherit;
}
.recent-row + .recent-row { border-top: 1px solid var(--line); }
.recent-row:hover { background: var(--row-hover); }
.recent-score {
  flex: 0 0 auto; min-width: 3.5rem; text-align: center;
  font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1;
  font-variant-numeric: tabular-nums;
  padding: 0.5rem 0.45rem; border-radius: 8px;
}
.recent-score-pass { background: var(--pass-bg); color: var(--pass); }
.recent-score-watch { background: var(--watch-bg); color: var(--watch); }
.recent-score-fail { background: var(--fail-bg); color: var(--fail); }
.recent-what { flex: 1 1 12rem; min-width: 0; }
.recent-name { display: block; font-weight: 650; }
.recent-row:hover .recent-name { text-decoration: underline; }
.recent-meta { display: block; font-size: 0.8rem; color: var(--ink-soft); }
.recent-band { flex: 0 0 auto; text-align: right; margin-left: auto; }
.recent-band-word {
  display: block; font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
}
.band-pass { color: var(--pass); }
.band-watch { color: var(--watch); }
.band-fail { color: var(--fail); }

/* One hero stat; the rest are supporting tiles. */
.stat-hero { margin: 0 0 1rem; }
.stat-hero-number {
  display: block;
  font-size: clamp(2.4rem, 7vw, 3.2rem); font-weight: 800; line-height: 1.05;
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
  color: var(--emphasis-ink);
}
.stat-hero-label { display: block; margin-top: 0.3rem; color: var(--ink-soft); font-size: 0.95rem; }

/* Why-this-exists callout: anchored aside, not a prose wall. */
.callout {
  max-width: 44rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--emphasis-ink);
  border-radius: 0 8px 8px 0;
  padding: 1.15rem 1.4rem 1.3rem;
}
.callout h2 { font-size: 1.15rem; margin: 0 0 0.35rem; }
.callout p { margin: 0.6rem 0 0; font-size: 0.95rem; }

/* ---- search ------------------------------------------------------------ */

.property-search { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.5rem 0; }
.property-search input {
  flex: 1 1 16rem; min-width: 0; padding: 0.85rem 1rem; font-size: 1.05rem;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--panel); color: var(--ink);
}
.property-search input:focus-visible { outline-offset: 0; border-color: var(--accent); }
/* The one high-chroma call to action on the page. */
.property-search button {
  padding: 0.85rem 1.4rem; font-size: 1rem; font-weight: 700; cursor: pointer;
  border: 1px solid transparent; border-radius: 6px;
  background: var(--cta-bg); color: var(--cta-ink);
}
.property-search button:hover { background: var(--cta-hover); }
.htmx-indicator { opacity: 0; font-size: 0.85rem; color: var(--ink-soft); align-self: center; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---- result lists ------------------------------------------------------ */

.result-list { list-style: none; padding: 0; margin: 1rem 0; }
.result-list li {
  display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem; align-items: baseline;
  justify-content: space-between; padding: 0.65rem 0.35rem;
  border-bottom: 1px solid var(--line);
}
.result-list li:hover { background: var(--row-hover); }
.result-list a { text-decoration: none; min-width: 0; }
.result-name { display: block; font-weight: 600; color: var(--ink); }
.result-list a:hover .result-name { text-decoration: underline; }
.result-meta { display: block; font-size: 0.82rem; color: var(--ink-soft); }
.search-message { color: var(--ink-soft); }

/* Latest-score chip on list rows. Quiet when there is no score. */
.pill {
  font-size: 0.82rem; font-weight: 700; padding: 0.22rem 0.5rem;
  border-radius: 5px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pill-pass { background: var(--pass-bg); color: var(--pass); }
.pill-watch { background: var(--watch-bg); color: var(--watch); }
.pill-fail { background: var(--fail-bg); color: var(--fail); }
.pill-none { background: none; color: var(--none); font-weight: 500; }

/* ---- property page ----------------------------------------------------- */

.property-identity { color: var(--ink-soft); font-size: 0.9rem; margin: 0 0 0.35rem; }

/* The property name is the h1's focal point; the standing suffix reads as
   context, not title. */
.h1-context { color: var(--ink-soft); font-weight: 400; font-size: 0.62em; white-space: nowrap; }

/* Section rhythm: the score card is the focal point; history and provenance
   follow at a steady beat under quiet wayfinding labels. */
.property .history, .property .provenance { margin-top: 2.75rem; }
.property .provenance p { max-width: 44rem; font-size: 0.95rem; color: var(--ink-soft); }

/* The score card: the site's signature. Big tabular number, era chip, and a
   0–100 meter ticked at NSPIRE's own thresholds (60 fails, 80 ends the
   more-frequent cycle). Color appears only in the number and the fill. */
.score-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 1.1rem 1.25rem 1.3rem; margin: 1.5rem 0 0.75rem;
}
.score-card-top {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.75rem; margin-bottom: 0.7rem;
}
.score-card-label {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--ink-soft);
}
.score-card-main { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.score-number {
  font-size: clamp(2.7rem, 9vw, 3.5rem); font-weight: 800; line-height: 1;
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.score-suffix { font-size: 0.45em; font-weight: 700; letter-spacing: 0; }
.score-detail { display: flex; flex-direction: column; gap: 0.1rem; font-size: 0.9rem; color: var(--ink-soft); }

.score-pass { color: var(--pass); }
.score-watch { color: var(--watch); }
.score-fail { color: var(--fail); }

.score-scale { margin-top: 1.15rem; }
.score-scale-track {
  position: relative; height: 0.5rem; border-radius: 999px;
  background: var(--none-bg);
}
.score-scale-fill {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: calc(var(--score, 0) * 1%); max-width: 100%; border-radius: 999px;
}
.score-fill-pass { background: var(--pass); }
.score-fill-watch { background: var(--watch); }
.score-fill-fail { background: var(--fail); }
.score-scale-tick {
  position: absolute; top: -2px; bottom: -2px; width: 3px;
  background: var(--panel);
}
.score-scale-labels {
  position: relative; height: 1rem; margin-top: 0.35rem;
  font-size: 0.7rem; color: var(--ink-soft); font-variant-numeric: tabular-nums;
}
.score-scale-labels span { position: absolute; top: 0; line-height: 1; }
.sl-0 { left: 0; }
.sl-60 { left: 60%; transform: translateX(-50%); }
.sl-80 { left: 80%; transform: translateX(-50%); }
.sl-100 { right: 0; }

/* Era chips: NSPIRE is the current standard (solid); REAC is historical
   (outlined). Distinguished by weight, not by pass/fail color. */
.era {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; padding: 0.22rem 0.5rem; border-radius: 4px;
  white-space: nowrap;
}
.era-nspire { background: var(--chip-solid-bg); color: var(--chip-solid-ink); }
.era-reac { background: none; color: var(--ink-soft); border: 1px solid var(--line-strong); }

/* ---- data tables ------------------------------------------------------- */

table.data {
  width: 100%; border-collapse: collapse; margin: 1rem 0;
  font-size: 0.92rem; font-variant-numeric: tabular-nums;
}
table.data caption { text-align: left; font-size: 0.85rem; color: var(--ink-soft); padding-bottom: 0.6rem; }
table.data th, table.data td { text-align: left; padding: 0.55rem 0.65rem; border-bottom: 1px solid var(--line); }
table.data thead th {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-soft);
  border-bottom: 2px solid var(--line-strong);
}
table.data tbody tr:hover { background: var(--row-hover); }
table.data .col-score { text-align: right; }
.score-cell { font-weight: 700; white-space: nowrap; }
.score-cell-fail { color: var(--fail); }
.score-cell-watch { color: var(--watch); }
.score-cell-pass { color: var(--pass); }
/* A wide table must scroll inside its own box; the page body never scrolls
   horizontally. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- stats and indexes ------------------------------------------------- */

.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem; margin: 1rem 0;
}
/* Supporting tiles: quiet on purpose, so the hero stat above them stays the
   loudest number in the section. */
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 0.85rem 0.95rem;
}
.stat dt {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-soft); margin: 0 0 0.3rem;
}
.stat dd {
  margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.state-grid {
  list-style: none; padding: 0; margin: 1.25rem 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: 0.5rem;
}
.state-grid a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem;
  padding: 0.5rem 0.65rem; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); text-decoration: none; font-weight: 650; color: var(--ink);
}
.state-grid a:hover { border-color: var(--line-strong); background: var(--row-hover); }
.state-grid span { color: var(--ink-soft); font-weight: 400; font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.prose h2 { margin-top: 2rem; }
.prose { max-width: 44rem; }

/* ---- footer ------------------------------------------------------------ */

.site-footer { background: var(--panel); border-top: 1px solid var(--line); margin-top: 3rem; }
.site-footer-inner {
  max-width: var(--container); margin: 0 auto;
  padding: 1.75rem var(--gutter) 2.5rem;
  font-size: 0.85rem; color: var(--ink-soft);
}
.footer-brand { margin: 0 0 0.9rem; }
.footer-brand a { display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none; }
.footer-brand .wordmark-plate { background: var(--brand); color: var(--on-brand); font-size: 0.72rem; }
.footer-brand .wordmark-word { color: var(--ink); font-size: 1.05rem; }
@media (prefers-color-scheme: dark) {
  .footer-brand .wordmark-plate { background: var(--accent); color: var(--chip-solid-ink); }
}
