
:root {
  /* Spacing scale */
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem;
  --sp-5: 1.5rem; --sp-6: 2rem; --sp-7: 3rem; --sp-8: 4.5rem;

  /* Palette: calm, hopeful, trustworthy. Never alarm-red-everywhere */
  --bg: #faf8f4;
  --bg-raised: #ffffff;
  --ink: #24312c;
  --ink-muted: #5f6d66;
  --border: #e3ded2;
  --brand: #2f5d50;
  --brand-dark: #223f37;
  --accent: #c17817;

  --code-red: #a8452f;
  --code-red-bg: #fbebe6;
  --urgent: #8f5410;
  --urgent-bg: #fdf1de;
  --at-risk: #3f6b4f;
  --at-risk-bg: #e9f1eb;
  --capacity: #6a5590;
  --capacity-bg: #f0ecf7;
  --unknown-grey: #5c5c57;
  --unknown-bg: #ececE7;

  --radius-sm: 8px;
  --radius-md: 14px;
  --shadow-card: 0 1px 2px rgba(36,49,44,.04), 0 4px 16px rgba(36,49,44,.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, .wordmark { font-family: "Fraunces", Georgia, serif; }

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

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(250, 248, 244, .92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 72rem; margin: 0 auto; padding: var(--sp-3) var(--sp-4);
  display: flex; align-items: center; justify-content: space-between;
}
.wordmark { font-weight: 600; font-size: 1.15rem; color: var(--brand-dark); }
.header-link {
  font-size: .9rem; font-weight: 600; text-decoration: none; color: var(--brand);
  padding: .4rem .8rem; border: 1px solid var(--brand); border-radius: 999px;
}
.header-link:hover { background: var(--brand); color: #fff; }

/* Hero */
.hero { background: linear-gradient(180deg, #f1ede2 0%, var(--bg) 100%); border-bottom: 1px solid var(--border); }
.hero-inner { max-width: 52rem; margin: 0 auto; padding: var(--sp-7) var(--sp-4) var(--sp-6); }
.hero h1 {
  margin: 0 0 var(--sp-3); font-weight: 600; font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  line-height: 1.2; color: var(--brand-dark);
}
.hero-sub { margin: 0 0 var(--sp-5); color: var(--ink-muted); font-size: 1.02rem; max-width: 42rem; }

.location-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-4);
}
.or-divider { color: var(--ink-muted); font-size: .85rem; }
.location-status { font-size: .85rem; color: var(--ink-muted); }

.control-row {
  display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; margin-bottom: var(--sp-3);
}
.control-row label { font-size: .8rem; color: var(--ink-muted); font-weight: 600; }
select, input[type=text], input[type=email] {
  padding: .55rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .95rem; background: #fff; color: var(--ink); font-family: inherit;
}
select:focus, input:focus { border-color: var(--brand); }

.btn-primary, .btn-secondary {
  padding: .55rem 1.1rem; border-radius: var(--radius-sm); font-size: .95rem; font-weight: 600;
  cursor: pointer; font-family: inherit; border: 1px solid transparent;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #fff; color: var(--brand); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--brand); }

.chip {
  padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; color: var(--ink-muted); font-size: .85rem; cursor: pointer; font-family: inherit;
}
.chip.active { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }

/* Legend */
.legend { background: transparent; border-bottom: none; }
.legend-inner { max-width: 40rem; margin: var(--sp-4) auto; padding: var(--sp-3); background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-md); }
.legend-intro { margin: 0 0 var(--sp-2); font-size: .8rem; color: var(--ink-muted); }
.legend-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-2) var(--sp-4); }
@media (min-width: 640px) { .legend-grid { grid-template-columns: repeat(2, 1fr); } }
.legend-row { display: flex; flex-direction: column; align-items: flex-start; gap: .45rem; }
.legend-row .badge { flex: 0 0 auto; }
.legend-row p { margin: 0; font-size: .8rem; line-height: 1.5; color: var(--ink-muted); }

/* Carousel */
.carousel-section { border-bottom: 1px solid var(--border); }
.carousel-inner { max-width: 72rem; margin: 0 auto; padding: var(--sp-6) var(--sp-4) var(--sp-5); }
.carousel-inner h2 { margin: 0 0 var(--sp-4); font-size: 1.3rem; font-weight: 600; color: var(--brand-dark); }
.carousel-inner { overflow: hidden; }
.carousel-track { display: flex; width: max-content; animation: carousel-scroll 240s linear infinite; will-change: transform; }
.carousel-track:hover { animation-play-state: paused; }
.carousel-card { width: 150px; flex: 0 0 auto; margin-right: var(--sp-4); }
.carousel-card h3 { font-size: .95rem; }
@keyframes carousel-scroll { from { transform: translateX(-50%); } to { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .carousel-track { animation: none; } }
@media (min-width: 640px) { .carousel-card { width: 168px; } }

/* Filters (search + urgency) */
.filters-section { background: var(--bg); border-bottom: 1px solid var(--border); }
.filters-inner { max-width: 52rem; margin: 0 auto; padding: var(--sp-5) var(--sp-4); }

/* About */
.about-section { background: #fff; border-bottom: 1px solid var(--border); }
.transparency-strip { background: #24523f; color: #f7f3e8; text-align: center; font-size: .85rem; padding: .5rem 1rem; }
.help-section { background: #fff; border-bottom: 1px solid var(--border); }
.help-review-head { margin-top: 2rem; }
.page-share-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .6rem; }
.review-form { display: flex; flex-direction: column; gap: .6rem; max-width: 28rem; margin-top: .6rem; }
.review-form input, .review-form textarea { padding: .55rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; }
.review-form button { align-self: flex-start; }
.review-status { font-size: .85rem; color: var(--ink-muted); margin: 0; }
.search-row { justify-content: center; margin-top: 1rem; }
.search-btn { padding: .75rem 3rem; font-size: 1.05rem; font-weight: 700; letter-spacing: .02em; }
.search-row { flex-direction: column; align-items: center; gap: .5rem; }
.search-feedback { margin: 0; font-size: .95rem; font-weight: 600; color: var(--brand-dark); }
.about-inner { max-width: 42rem; margin: 0 auto; padding: var(--sp-7) var(--sp-4); }
.about-inner h2 { margin: 0 0 var(--sp-3); font-size: 1.3rem; font-weight: 600; color: var(--brand-dark); }
.about-inner p { margin: 0 0 var(--sp-4); color: var(--ink-muted); }
.about-inner p:last-child { margin-bottom: 0; }

/* Main content */
.content { max-width: 72rem; margin: 0 auto; padding: var(--sp-5) var(--sp-4) var(--sp-4); }
.clear-filters-wrap { margin: 0 0 var(--sp-4); }
.result-count { margin: 0 0 var(--sp-3); color: var(--ink-muted); font-size: .9rem; }
.loading-state { color: var(--ink-muted); padding: var(--sp-6) 0; text-align: center; }

.cards { display: grid; grid-template-columns: 1fr; gap: var(--sp-4); }
.cards[hidden] { display: none; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .cards { grid-template-columns: repeat(3, 1fr); } }

.empty-fallback { padding: 0 0 var(--sp-4); text-align: center; }
.empty-fallback-intro { color: var(--ink-muted); margin: 0 0 var(--sp-4); }

.card {
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-card);
  transition: transform .12s ease, box-shadow .12s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(36,49,44,.06), 0 10px 24px rgba(36,49,44,.08); }
.card.status-unknown { opacity: .6; filter: grayscale(70%); }
.card img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #eee; display: block; }
.card .body { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; }
.card h3 { margin: 0; font-size: 1.1rem; font-weight: 600; font-family: inherit; }

.badge {
  display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .72rem;
  font-weight: 700; letter-spacing: .02em; text-transform: uppercase; align-self: flex-start;
}
.badge.CODE_RED { background: var(--code-red-bg); color: var(--code-red); }
.badge.URGENT { background: var(--urgent-bg); color: var(--urgent); }
.badge.AT_RISK { background: var(--at-risk-bg); color: var(--at-risk); }
.badge.CAPACITY_ALERT { background: var(--capacity-bg); color: var(--capacity); }
.badge.STATUS_UNKNOWN { background: var(--unknown-bg); color: var(--unknown-grey); }

.deadline-text { font-size: .92rem; color: var(--ink); }
.meta { font-size: .8rem; color: var(--ink-muted); }
.card a.contact-btn {
  margin-top: auto; text-align: center; padding: .6rem; border-radius: var(--radius-sm);
  background: var(--brand); color: #fff; text-decoration: none; font-size: .92rem; font-weight: 600;
}
.card a.contact-btn:hover { background: var(--brand-dark); }
.unconfirmed-note { font-size: .8rem; color: var(--ink-muted); font-style: italic; }

.share-row { display: flex; gap: var(--sp-2); margin-top: var(--sp-1); }
.share-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: #fff; color: var(--ink-muted);
  cursor: pointer; position: relative; flex: 0 0 auto;
}
.share-btn svg { width: 18px; height: 18px; }
.share-btn:hover { border-color: var(--brand); color: var(--brand); }
.share-btn.copied { border-color: var(--brand); color: var(--brand); }
.share-btn.copied::after {
  content: "Copied"; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  margin-bottom: .3rem; background: var(--brand-dark); color: #fff; font-size: .7rem;
  padding: .2rem .5rem; border-radius: 4px; white-space: nowrap;
}

.card.highlight { outline: 3px solid var(--accent); outline-offset: 2px; transition: outline-color 2s ease; }
.card.highlight.highlight-fade { outline-color: transparent; }

.deep-link-note { background: var(--unknown-bg); color: var(--ink); padding: var(--sp-3); border-radius: var(--radius-sm); font-size: .9rem; margin: 0 0 var(--sp-3); }

.empty-state { padding: var(--sp-7) var(--sp-4); text-align: center; color: var(--ink-muted); }

/* Subscribe */
.subscribe { border-top: 1px solid var(--border); background: #fff; margin-top: var(--sp-6); }
.subscribe-inner { max-width: 40rem; margin: 0 auto; padding: var(--sp-7) var(--sp-4); text-align: center; }
.subscribe h2 { font-size: 1.3rem; margin: 0 0 var(--sp-2); color: var(--brand-dark); }
.subscribe-sub { color: var(--ink-muted); margin: 0 0 var(--sp-4); }
#subscribe-form { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; }
#subscribe-form input, #subscribe-form select { flex: 1 1 12rem; }
.subscribe-status { min-height: 1.2rem; color: var(--brand-dark); font-weight: 600; }
.fine-print { font-size: .78rem; color: var(--ink-muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); }
.footer-inner { max-width: 72rem; margin: 0 auto; padding: var(--sp-5) var(--sp-4); color: var(--ink-muted); font-size: .82rem; }
.footer-inner p { margin: 0 0 var(--sp-2); }
.site-footer a { color: var(--brand); }

/* Mobile pass (hero, filters, legend, cards). Comfortable tap targets, no overflow */
@media (max-width: 480px) {
  .hero-inner { padding-top: var(--sp-6); padding-bottom: var(--sp-5); }
  .location-row, .control-row { gap: var(--sp-3); }
  #zip-input { flex: 1 1 100%; }
  .btn-primary, .btn-secondary, .header-link { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .chip { min-height: 44px; padding: .5rem 1rem; display: inline-flex; align-items: center; }
  select, input[type=text], input[type=email] { min-height: 44px; }
  .legend-intro { font-size: .88rem; }
  .legend-row p { font-size: .88rem; }
  .card .body { padding: var(--sp-3); }
  .card a.contact-btn { min-height: 44px; display: flex; align-items: center; justify-content: center; }
}
