:root {
  --ink: #1B2340;
  --ink-soft: #5B6370;
  --yellow: #F5C400;
  --yellow-deep: #C99A00;
  --paper: #FAF9F6;
  --teal: #0F766E;
  --teal-soft: #E3F3F1;
  --alert: #B3261E;
  --alert-soft: #FBEAE9;
  --card-border: #E4E1D8;
  --radius: 10px;

  --font-display: 'Libre Franklin', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--ink);
  color: var(--paper);
  padding: 20px 24px;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  font-family: var(--font-mono);
  font-weight: 600;
  background: var(--yellow);
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  letter-spacing: 0.05em;
}
.site-header h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  margin: 0;
}
.subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: #C9CEDB;
}
.audience-note {
  font-size: 12px;
  color: #C9CEDB;
  margin: 0;
  font-style: italic;
}

/* ---------- Quick exit ---------- */
.quick-exit-btn {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 200;
  background: var(--alert);
  color: white;
  border: none;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.quick-exit-btn:hover { background: #8f1e18; }

/* ---------- Safe contact section ---------- */
.safe-contact-section {
  background: var(--teal-soft);
  border: 1px solid #BFE0DC;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 4px 0 14px;
}
.safe-contact-section.hidden { display: none; }
.safe-contact-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--teal);
  margin: 0 0 8px;
}

/* ---------- Search panel ---------- */
main { max-width: 1100px; margin: 0 auto; padding: 24px; }

.search-panel {
  background: white;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.filter-row { margin-bottom: 16px; }
.field-label {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.zip-input, .category-filter-input, .text-input {
  font-family: var(--font-mono);
  font-size: 15px;
  padding: 10px 12px;
  border: 1.5px solid var(--card-border);
  border-radius: 6px;
  width: 220px;
  max-width: 100%;
  margin-bottom: 10px;
}
.text-input { width: 100%; font-family: var(--font-body); }

.filter-disclaimer {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 2px 0 8px;
  font-style: italic;
}

.category-chip {
  white-space: normal;
  text-align: center;
  line-height: 1.3;
  max-width: 220px;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip-group-wrap { max-height: 220px; overflow-y: auto; padding: 4px; }

.chip {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--card-border);
  background: white;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}
.chip:hover { border-color: var(--yellow-deep); }
.chip.selected {
  background: var(--yellow);
  border-color: var(--yellow-deep);
  color: var(--ink);
  font-weight: 600;
}

.btn-primary {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 12px 22px;
  border-radius: 6px;
  cursor: pointer;
}
.btn-primary:hover { background: #2a3459; }
.btn-secondary {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  background: white;
  color: var(--ink);
  border: 1.5px solid var(--card-border);
  padding: 12px 22px;
  border-radius: 6px;
  cursor: pointer;
}

.filter-actions-row { display: flex; gap: 10px; align-items: center; }
.active-filters {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  background: #F1EFE7;
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 10px;
  display: inline-block;
}

.search-status { font-size: 13px; color: var(--ink-soft); margin-top: 8px; }

.home-link {
  color: var(--paper);
  text-decoration: none;
  font-size: 20px;
  font-weight: 700;
  margin-right: 4px;
}
.home-link:hover { color: var(--yellow); }

.sort-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

/* ---------- Results ---------- */
.results { display: flex; flex-direction: column; gap: 14px; }

.provider-card {
  background: white;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.provider-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  margin: 0 0 4px;
}

.provider-sub { font-size: 13px; color: var(--ink-soft); margin: 0 0 10px; }

/* Signature element: freshness badge */
.freshness-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.freshness-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.freshness-fresh { background: var(--teal-soft); color: var(--teal); }
.freshness-fresh .freshness-dot { background: var(--teal); }
.freshness-aging { background: #FDF3DE; color: #8A6300; }
.freshness-aging .freshness-dot { background: #C99A00; }
.freshness-stale { background: var(--alert-soft); color: var(--alert); }
.freshness-stale .freshness-dot { background: var(--alert); }

.safety-flag {
  background: var(--alert-soft);
  color: var(--alert);
  border: 1px solid #E8C6C4;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  margin: 10px 0;
}

.provider-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 13px;
  color: var(--ink-soft);
  margin: 10px 0;
}
.provider-meta span strong { color: var(--ink); }

.category-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.category-tag {
  font-size: 11px;
  font-family: var(--font-mono);
  background: #F1EFE7;
  color: var(--ink-soft);
  padding: 3px 8px;
  border-radius: 4px;
}

.card-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.btn-action {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 6px;
  border: 1.5px solid var(--ink);
  background: white;
  color: var(--ink);
  cursor: pointer;
}
.btn-action.primary { background: var(--ink); color: var(--paper); }
.btn-action:hover { opacity: 0.85; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
  font-family: var(--font-body);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(27,35,64,0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: white;
  border-radius: var(--radius);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
}
.modal-close {
  position: absolute; top: 14px; right: 18px;
  background: none; border: none; font-size: 22px; cursor: pointer; color: var(--ink-soft);
}
.modal h2 { font-family: var(--font-display); margin-top: 0; }
.modal-provider-name { color: var(--ink-soft); margin-top: -8px; margin-bottom: 16px; }
.modal-step.hidden { display: none; }

.preview-content {
  background: var(--paper);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 14px;
  font-size: 14px;
  margin-bottom: 12px;
  white-space: pre-wrap;
  font-family: var(--font-mono);
}
.preview-warning { font-size: 13px; color: var(--alert); margin-bottom: 14px; }
.preview-actions { display: flex; gap: 10px; }

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
}
