:root {
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;

  --bg: #ffffff;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #555a61;
  --border: #d9dcdf;
  --rule: #1a1a1a;
  --primary: #172b45;
  --primary-dark: #0e1c2e;
  --primary-soft: #eef2f6;
  --accent: #3f7f74;
  --map-fill: #c8d3dc;
  --map-hover: #6f9c94;
  --map-selected: #172b45;
  --map-dimmed: #e4e8eb;
  --map-stroke: #ffffff;
  --error: #a4262c;
  --disabled-bg: #f4f5f6;
  --disabled-text: #8a9098;
  --radius: 2px;
  --you: #f28c28;   /* outline for the chosen county: orange stands out on every step of the blue ramp */
}

* { box-sizing: border-box; }

/* Elements with the hidden attribute stay hidden even when a rule gives them display: flex/grid */
[hidden] { display: none !important; }

html { font-size: 18px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.55;
}

.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 16px;
}

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

h1, h2 {
  font-family: var(--font-serif);
  font-weight: 300;
  letter-spacing: -0.01em;
}

/* Header */
.site-header {
  background: var(--primary);
  color: #fff;
  padding: 56px 0 48px;
}
.site-header h1 { margin: 0 0 12px; font-size: 3.4rem; line-height: 1.05; }
.eyebrow { margin: 0 0 12px; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; font-weight: 600; opacity: 0.8; }
.lede { margin: 0; max-width: 40rem; font-family: var(--font-serif); font-size: 1.2rem; font-weight: 300; opacity: 0.95; }

/* Steps: separated by a rule, not boxed */
main { padding-top: 8px; padding-bottom: 48px; }

.step {
  border-top: 1px solid var(--rule);
  padding: 28px 0 36px;
  scroll-margin-top: 16px;
  animation: reveal 0.35s ease-out;
}
.step:first-child { border-top: none; }
.step h2 {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 0 0 20px;
  font-size: 2rem;
  line-height: 1.15;
}
/* "Step 1" matches its title: same font and size, set apart by color */
.step-num {
  font-family: var(--font-serif);
  font-size: 1em;
  font-weight: 400;
  color: var(--accent);
  flex: none;
}
.step-num::before { content: "Step "; }

@keyframes reveal {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

label { display: block; font-weight: 600; margin-bottom: 8px; }
.hint { color: var(--muted); margin: 8px 0; }

select, input[type="text"], input[type="email"] {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--text);
  border-radius: var(--radius);
  padding: 11px 12px;
  width: 100%;
  max-width: 22rem;
}
select:focus, input:focus, button:focus-visible, .type-card:focus-visible {
  outline: 3px solid var(--map-hover);
  outline-offset: 2px;
}

.button {
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 11px 20px;
  cursor: pointer;
}
.button:hover { background: var(--primary-dark); }

.link-button {
  font: inherit;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}

/* Steps on the left, sticky map on the right */
.explore {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
.steps .step h2 { font-size: 1.7rem; }

.map-panel { position: sticky; top: 16px; padding-top: 28px; }
.map-frame { position: relative; }
.map svg { width: 100%; height: auto; display: block; }
.map .state-shape {
  fill: var(--map-fill);
  stroke: var(--map-stroke);
  stroke-width: 0.75;
  vector-effect: non-scaling-stroke;   /* borders stay thin when the map zooms in */
  cursor: pointer;
  transition: fill 0.2s ease;
}
.map .state-shape:hover { fill: var(--map-hover); }
.map .state-shape.dimmed { fill: var(--map-dimmed); }
.map .state-shape.dimmed:hover { fill: var(--map-hover); }
.map .state-shape.selected { fill: var(--map-selected); }
.map .county-shape {
  fill: var(--map-fill);
  stroke: var(--map-stroke);
  stroke-width: 0.5;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill 0.2s ease;
}
.map .county-shape:hover { fill: var(--map-hover); }
.map .county-shape.candidate { fill: var(--map-hover); }
.map .county-shape.selected { fill: var(--map-selected); }
.map .county-shape.no-data { cursor: default; }

/* Shaded by number of plans: fill comes from the data, so hover and "your county" use outlines */
.map .shaded .county-shape:hover { stroke: var(--text); stroke-width: 1.5; }
.map .shaded .county-shape.selected { stroke: var(--you); stroke-width: 4; }

.map-caption { margin-top: 12px; min-height: 4.5rem; }
.map-title { margin: 0 0 8px; font-weight: 600; }
.map-note { margin: 8px 0 0; color: var(--muted); }
.map-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.85rem; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 18px; height: 12px; border-radius: 2px; flex: none; }
.legend-you { width: 18px; height: 12px; border: 3px solid var(--you); border-radius: 2px; flex: none; }

/* Sticky trail (mini map + breadcrumb) */
.trail {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(20, 30, 50, 0.08);
  animation: slide-down 0.25s ease-out;
}
@keyframes slide-down {
  from { transform: translateY(-100%); }
  to { transform: none; }
}
.trail-inner { display: flex; align-items: center; gap: 16px; padding-top: 8px; padding-bottom: 8px; }
.mini-map { width: 84px; height: 56px; flex: none; }
.mini-map path { fill: var(--map-fill); stroke: var(--map-stroke); stroke-width: 0.5; vector-effect: non-scaling-stroke; }
.mini-map path.current { fill: var(--map-selected); }
.mini-map path.shaded.current { stroke: var(--you); stroke-width: 2.5; }
.crumbs { flex: 1; min-width: 0; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 2px 8px; margin: 0; padding: 0; list-style: none; }
.crumbs li { display: inline-flex; align-items: center; gap: 8px; }
.crumbs li + li::before { content: "›"; color: var(--muted); }
.crumbs button { font: inherit; font-weight: 600; color: var(--text); background: none; border: none; padding: 0; cursor: pointer; text-align: left; }
.crumbs button:hover { color: var(--accent); text-decoration: underline; }
.button-small { padding: 7px 14px; font-size: 0.9rem; flex: none; }

.results { border-top: 1px solid var(--rule); padding: 28px 0 36px; scroll-margin-top: 90px; animation: reveal 0.35s ease-out; }
.results h2 { margin: 0 0 16px; font-size: 2rem; }
.map-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--text);
  color: #fff;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: var(--radius);
  white-space: nowrap;
  transform: translate(-50%, -130%);
}
.map-reset { position: absolute; top: 0; right: 0; font-size: 0.9rem; }

/* Step 2: county */
.zip-row { display: flex; gap: 10px; flex-wrap: wrap; }
.zip-row input { max-width: 10rem; }
.message { margin: 12px 0; min-height: 1.5em; }
.message.error { color: var(--error); font-weight: 600; }
.message.success { color: var(--accent); font-weight: 600; }
.zip-choices {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 12px 0;
}
.zip-choices legend { font-weight: 600; padding: 0 6px; }
.zip-choice { display: flex; align-items: center; gap: 10px; font-weight: 400; margin: 8px 0; cursor: pointer; }
.zip-choice input { width: 1.1rem; height: 1.1rem; accent-color: var(--primary); }
.zip-choice small { color: var(--muted); }
.county-fallback { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* Steps 3-4: plan group and plan type cards */
.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
/* 2 x 2 and a little more compact, so all four groups fit on one screen */
.category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.category-grid .type-card { padding: 14px 14px 12px; gap: 4px; }
.category-grid .type-name { font-size: 1.2rem; }
.category-grid .type-desc { font-size: 0.85rem; line-height: 1.4; }
.category-grid .type-count { padding-top: 6px; }
/* Three card states:
   available  - white, navy bar on top
   selected   - filled navy with white text and a "Selected" tag
   unavailable - no fill, dashed outline, faded text */
.type-card {
  position: relative;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.type-card:hover:not(:disabled):not([aria-pressed="true"]) {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.type-card[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.type-card[aria-pressed="true"]::after {
  content: "✓ Selected";
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  background: #fff;
  border-radius: 999px;
  padding: 2px 10px;
}
.type-card:disabled {
  cursor: not-allowed;
  background: transparent;
  color: var(--disabled-text);
  border: 1px dashed #b9bec4;
}
.type-name { font-family: var(--font-serif); font-size: 1.45rem; font-weight: 400; line-height: 1.2; }
.type-card[aria-pressed="true"] .type-name { padding-right: 6.5rem; }   /* room for the "Selected" tag */
.type-full { font-size: 0.85rem; color: var(--muted); }
.type-desc { font-size: 0.95rem; margin: 4px 0 0; }
.type-count { margin-top: auto; padding-top: 10px; font-weight: 600; color: var(--accent); }
.type-card[aria-pressed="true"] .type-full,
.type-card[aria-pressed="true"] .type-desc { color: #dfe6ee; }
.type-card[aria-pressed="true"] .type-count { color: #fff; }
.type-card:disabled .type-full,
.type-card:disabled .type-count { color: var(--disabled-text); }
.type-card:disabled .type-count { font-weight: 400; font-style: italic; }

.results-summary { font-size: 1.05rem; color: var(--muted); margin: 0 0 16px; }

/* Summary tiles: each one can color the map */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.stat-tile {
  position: relative;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.stat-tile:hover:not(:disabled):not([aria-pressed="true"]) { background: var(--primary-soft); border-color: var(--primary); }
.stat-tile:disabled { cursor: default; }
.stat-tile[aria-pressed="true"] { border-color: var(--primary); border-top-color: var(--accent); background: var(--primary-soft); }
.stat-tile[aria-pressed="true"]::after {
  content: "On map";
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
}
.stat-value { font-family: var(--font-serif); font-size: 2rem; line-height: 1.1; }
.stat-label { font-size: 0.85rem; font-weight: 600; }
.stat-state { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.stat-notes { font-size: 0.85rem; color: var(--muted); margin: 10px 0 0; }

/* Plan table */
.table-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  margin: 32px 0 12px;
}
.table-count { margin: 0; font-family: var(--font-serif); font-weight: 400; font-size: 1.5rem; }
.sort-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sort-label { font-weight: 600; margin-right: 4px; }
.sort-direction { font-size: 0.85rem; color: var(--muted); margin-left: 4px; }
.sort-bar .chip {
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  cursor: pointer;
}
.sort-bar .chip:hover:not(:disabled) { border-color: var(--primary); }
.sort-bar .chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.sort-bar .chip:disabled { color: var(--disabled-text); border-style: dashed; cursor: not-allowed; }

/* Column groups share a tint: premiums (blue), out-of-pocket (green), stars (amber) */
:root {
  --premium-head: #d6e5f6; --premium-cell: #f0f6fc;
  --oop-head: #d3e8df;     --oop-cell: #eff7f3;
  --stars-head: #f2e3c0;   --stars-cell: #fcf7ec;
}
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.table-scroll:focus-visible { outline: 3px solid var(--map-hover); outline-offset: 2px; }
.plan-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
.plan-table th, .plan-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
  background: var(--surface);
}
.plan-table thead th { font-weight: 600; vertical-align: bottom; white-space: normal; min-width: 5.5rem; }
.plan-table .group-row th { font-family: var(--font-serif); font-size: 0.95rem; font-weight: 400; text-align: center; border-bottom: none; }
.plan-table tbody tr:hover th, .plan-table tbody tr:hover td { filter: brightness(0.97); }
.plan-table .sticky-0, .plan-table .sticky-1 { position: sticky; z-index: 1; text-align: left; }
.plan-table .sticky-0 { left: 0; min-width: 8rem; font-variant-numeric: tabular-nums; }
.plan-table .sticky-1 { left: 8rem; min-width: 16rem; white-space: normal; font-weight: 400; border-right: 1px solid var(--border); }
.plan-table thead .sticky-1 { font-weight: 600; }
.plan-table .sticky-group { position: sticky; left: 0; z-index: 1; }
.plan-table td { font-variant-numeric: tabular-nums; }
.plan-table .col-premium { background: var(--premium-cell); }
.plan-table .col-oop { background: var(--oop-cell); }
.plan-table .col-stars { background: var(--stars-cell); }
.plan-table thead .col-premium { background: var(--premium-head); }
.plan-table thead .col-oop { background: var(--oop-head); }
.plan-table thead .col-stars { background: var(--stars-head); }
.plan-table .cms-label { color: var(--muted); font-style: italic; font-size: 0.8rem; white-space: normal; min-width: 7rem; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--primary-soft);
  color: var(--muted);
  font-size: 0.85rem;
  padding: 24px 0 32px;
}
.site-footer p { margin: 6px 0; }

/* Phones */
@media (max-width: 760px) {
  html { font-size: 17px; }
  .explore { grid-template-columns: 1fr; gap: 0; }
  .category-grid { grid-template-columns: 1fr; }
  .step { scroll-margin-top: 80px; }   /* room for the sticky trail, which shows early on phones */
  .results { scroll-margin-top: 150px; }   /* the trail wraps to several lines on phones */
  .map-panel { order: -1; position: relative; top: auto; }
  .trail-inner { gap: 10px; }
  .mini-map { width: 60px; height: 40px; }
  .site-header { padding: 36px 0 32px; }
  .site-header h1 { font-size: 2.4rem; }
  .step h2 { font-size: 1.6rem; flex-direction: column; gap: 2px; }
  select, input[type="text"], input[type="email"] { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .step, .type-card, .map .state-shape { animation: none; transition: none; }
}

/* Copy of the shaded map inside the results */
.results-map {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 28px;
  align-items: center;
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: reveal 0.35s ease-out;
}
.results-map-frame { position: relative; }
.results-map-svg { width: 100%; height: auto; display: block; }
.results-map-svg .county-shape { stroke: var(--map-stroke); stroke-width: 0.5; vector-effect: non-scaling-stroke; cursor: pointer; }
.results-map-svg .county-shape:hover { stroke: var(--text); stroke-width: 1.5; }
.results-map-svg .county-shape.selected { stroke: var(--you); stroke-width: 4; }
.results-map-svg .county-shape.no-data { cursor: default; }

/* Table column behind the selected summary figure */
.plan-table .col-active { box-shadow: inset 2px 0 0 var(--primary), inset -2px 0 0 var(--primary); }
.plan-table thead .col-active { box-shadow: inset 2px 0 0 var(--primary), inset -2px 0 0 var(--primary), inset 0 3px 0 var(--primary); }
.plan-table tbody tr:last-child .col-active { box-shadow: inset 2px 0 0 var(--primary), inset -2px 0 0 var(--primary), inset 0 -2px 0 var(--primary); }
.col-tag {
  display: block;
  width: fit-content;
  margin: 6px 0 0 auto;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
}

@media (max-width: 760px) {
  .results-map { grid-template-columns: 1fr; padding: 14px; gap: 12px; }
}

/* Notes under the table: what the CMS labels mean */
.table-notes { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 0.9rem; color: var(--muted); max-width: 60rem; }
.table-notes h3 { margin: 0 0 8px; font-family: var(--font-serif); font-weight: 400; font-size: 1.35rem; color: var(--text); }
.table-notes dl { margin: 16px 0; }
.table-notes dt { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); margin-top: 14px; }
.table-notes dd { margin: 4px 0 0 22px; }
.table-notes strong { color: var(--text); }
.note-swatch { width: 14px; height: 14px; border-radius: 2px; flex: none; }
.note-swatch.col-premium { background: var(--premium-head); }
.note-swatch.col-oop { background: var(--oop-head); }
.note-swatch.col-stars { background: var(--stars-head); }

/* Pinned summary row in the header bar */
.trail-stats {
  display: flex;
  flex-wrap: wrap;            /* wraps to a second line on narrower laptops instead of cutting off */
  justify-content: center;
  gap: 8px;
  max-width: none;            /* use the full window width so the larger figures fit */
  padding-top: 0;
  padding-bottom: 10px;
}
.trail-stat {
  flex: none;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
  white-space: nowrap;
}
.trail-stat strong { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 500; }
.trail-stat:hover:not(:disabled):not([aria-pressed="true"]) { border-color: var(--primary); }
.trail-stat[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.trail-stat:disabled { cursor: default; }

/* Phones: pinned figures on one line that scrolls sideways (after the main .trail-stats rule so it wins) */
@media (max-width: 760px) {
  .trail-stats { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: thin; }
}

/* Results heading with the "Copy link" button */
.results-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 20px; margin-bottom: 16px; }
.results-head h2 { margin: 0; }
.button-outline { color: var(--primary); background: var(--surface); border: 1px solid var(--primary); }
.button-outline:hover { color: #fff; }

/* Feedback box */
.feedback { border-top: 1px solid var(--rule); padding: 28px 0 8px; max-width: 46rem; }
.feedback h2 { margin: 0 0 16px; font-size: 1.7rem; }
.feedback textarea {
  font: inherit;
  color: var(--text);
  width: 100%;
  min-height: 7rem;
  padding: 11px 12px;
  border: 1px solid var(--text);
  border-radius: var(--radius);
  resize: vertical;
}
.feedback textarea:focus { outline: 3px solid var(--map-hover); outline-offset: 2px; }
.feedback-email-label { margin-top: 16px; }
.feedback .optional { font-weight: 400; color: var(--muted); }
.feedback-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 16px; }
.feedback-actions .button:disabled { opacity: 0.6; cursor: wait; }
.feedback-status { margin: 0; }
.feedback-status.success { color: var(--accent); font-weight: 600; }
.feedback-status.error { color: var(--error); font-weight: 600; }
.feedback-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Phones: the pinned Plan ID + Plan name columns would fill the whole screen and hide the others
   as they scroll underneath, so on phones nothing is pinned and the whole table scrolls sideways */
@media (max-width: 760px) {
  .plan-table .sticky-0,
  .plan-table .sticky-1,
  .plan-table .sticky-group { position: static; }
  .plan-table .sticky-0 { min-width: 0; }
  .plan-table .sticky-1 { min-width: 11rem; }
  .table-head::after {
    content: "Swipe the table sideways to see all columns →";
    flex-basis: 100%;
    font-size: 0.85rem;
    color: var(--muted);
  }
}
