:root {
  --ink: #17343b;
  --paper: #f5f1e8;
  --surface: #fffdf8;
  --line: #b9b09f;
  --placeholder: #696e69;
  --focus: #1d716f;
  --focus-ring: rgb(29 113 111 / 14%);
  --shadow: rgb(43 55 51 / 7%);
  --glass-surface: rgb(255 255 255 / 48%);
  --glass-highlight: rgb(255 255 255 / 86%);
  --glass-edge: rgb(29 113 111 / 58%);
  --glass-glow: rgb(29 113 111 / 18%);

  color: var(--ink);
  background: var(--paper);
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root[data-theme="dark"] {
  --ink: #edf4f1;
  --paper: #081b20;
  --surface: #10282e;
  --line: #40575b;
  --placeholder: #a9b7b3;
  --focus: #77c9c1;
  --focus-ring: rgb(119 201 193 / 20%);
  --shadow: rgb(0 0 0 / 26%);
  --glass-surface: rgb(255 255 255 / 5%);
  --glass-highlight: rgb(255 255 255 / 17%);
  --glass-edge: rgb(119 201 193 / 68%);
  --glass-glow: rgb(119 201 193 / 22%);

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

html,
body {
  min-height: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--paper);
  transition:
    color 180ms ease,
    background-color 180ms ease;
}

.theme-toggle {
  position: fixed;
  z-index: 1;
  top: clamp(16px, 3vw, 28px);
  right: clamp(16px, 3vw, 28px);
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--focus);
  font: inherit;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color 180ms ease,
    opacity 180ms ease;
}

.theme-toggle:hover {
  color: var(--ink);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.theme-toggle-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--glass-edge);
  border-radius: 50%;
  background: var(--glass-surface);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 5px 18px var(--shadow);
  font-size: 0.9rem;
  line-height: 1;
  backdrop-filter: blur(10px);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
  -webkit-backdrop-filter: blur(10px);
}

.theme-icon {
  display: block;
  width: 14px;
  height: 14px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.theme-icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-icon-sun {
  display: block;
}

.theme-toggle:hover .theme-toggle-icon {
  border-color: var(--focus);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 0 0 5px var(--focus-ring),
    0 8px 24px var(--shadow);
  transform: scale(1.05);
}

.change-market {
  position: fixed;
  z-index: 1;
  top: clamp(16px, 3vw, 28px);
  left: clamp(16px, 3vw, 28px);
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  color: var(--focus);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color 180ms ease,
    opacity 180ms ease;
}

.change-market:hover {
  color: var(--ink);
}

.change-market:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

main {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: clamp(24px, 6vw, 72px);
}

.market-entry {
  width: min(760px, 100%);
}

.coverage-context {
  min-inline-size: 0;
  margin-bottom: clamp(30px, 5vw, 48px);
  padding: 0;
  border: 0;
}

.coverage-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 20px;
}

.coverage-heading {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0;
  color: var(--focus);
  font-size: clamp(0.66rem, 1.5vw, 0.76rem);
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.4;
  text-transform: uppercase;
}

.coverage-heading::before {
  width: 24px;
  height: 1px;
  background: currentColor;
  content: "";
}

.coverage-route {
  letter-spacing: 0.09em;
}

.coverage-arrow {
  display: inline-block;
  margin: 0 0.28em;
  font-size: 1.08em;
}

.all-counties-control {
  display: inline-flex;
  min-height: 32px;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  margin-top: -6px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--focus);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color 180ms ease,
    opacity 180ms ease;
}

.all-counties-control:hover {
  color: var(--ink);
}

.all-counties-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.all-counties-marker {
  position: relative;
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--glass-edge);
  border-radius: 50%;
  background: var(--glass-surface);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 5px 18px var(--shadow);
  backdrop-filter: blur(10px);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
  -webkit-backdrop-filter: blur(10px);
}

.all-counties-marker::after {
  width: 4px;
  height: 7px;
  border-right: 2px solid var(--paper);
  border-bottom: 2px solid var(--paper);
  content: "";
  opacity: 0;
  transform: translateY(-1px) rotate(45deg);
  transition: opacity 140ms ease;
}

.all-counties-control:hover .all-counties-marker {
  border-color: var(--focus);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 0 0 5px var(--focus-ring),
    0 8px 24px var(--shadow);
  transform: scale(1.06);
}

.all-counties-checkbox:checked + .all-counties-marker {
  border-color: var(--focus);
  background: var(--focus);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 0 18px var(--glass-glow);
}

.all-counties-checkbox:checked + .all-counties-marker::after {
  opacity: 1;
}

.all-counties-checkbox:indeterminate + .all-counties-marker {
  border-color: var(--focus);
  background: var(--glass-surface);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 0 18px var(--glass-glow);
}

.all-counties-checkbox:indeterminate + .all-counties-marker::after {
  width: 7px;
  height: 1px;
  border: 0;
  background: var(--focus);
  opacity: 1;
  transform: none;
}

.all-counties-checkbox:checked ~ .all-counties-label,
.all-counties-checkbox:indeterminate ~ .all-counties-label {
  color: var(--ink);
}

.all-counties-checkbox:focus-visible + .all-counties-marker {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.county-ribbon {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 18px 0 0;
  padding: 0;
  color: var(--ink);
  font-size: clamp(0.66rem, 1.35vw, 0.76rem);
  font-weight: 700;
  letter-spacing: 0.025em;
  list-style: none;
}

.county-ribbon::before {
  position: absolute;
  top: 8px;
  right: 10%;
  left: 10%;
  height: 1px;
  background: linear-gradient(
    90deg,
    var(--glass-edge),
    var(--focus) 50%,
    var(--glass-edge)
  );
  box-shadow: 0 0 16px var(--glass-glow);
  content: "";
  opacity: 0.72;
}

.county-ribbon li {
  position: relative;
  text-align: center;
}

.county-option {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 44px;
  align-items: center;
  flex-direction: column;
  gap: 7px;
  color: var(--ink);
  cursor: pointer;
}

.county-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.county-marker {
  position: relative;
  display: grid;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--glass-edge);
  border-radius: 50%;
  background: var(--glass-surface);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 5px 18px var(--shadow);
  backdrop-filter: blur(10px);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
  -webkit-backdrop-filter: blur(10px);
}

.county-marker::after {
  width: 4px;
  height: 7px;
  border-right: 2px solid var(--paper);
  border-bottom: 2px solid var(--paper);
  content: "";
  opacity: 0;
  transform: translateY(-1px) rotate(45deg) scale(0.75);
  transition: opacity 140ms ease;
}

.county-name {
  transition: color 180ms ease;
}

.county-option:hover .county-marker {
  border-color: var(--focus);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 0 0 5px var(--focus-ring),
    0 8px 24px var(--shadow);
  transform: scale(1.08);
}

.county-checkbox:checked + .county-marker {
  border-color: var(--focus);
  background: var(--focus);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 0 18px var(--glass-glow);
}

.county-checkbox:checked + .county-marker::after {
  opacity: 1;
}

.county-checkbox:checked ~ .county-name {
  color: var(--focus);
}

.county-checkbox:focus-visible + .county-marker {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.market-question {
  display: block;
  max-width: 14ch;
  margin-bottom: clamp(28px, 5vw, 48px);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 7vw, 5.25rem);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.market-action {
  min-height: 68px;
}

.market-input {
  width: 100%;
  min-height: 68px;
  padding: 17px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: 0;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  box-shadow: 0 14px 40px var(--shadow);
  transition:
    color 180ms ease,
    background-color 180ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.market-input::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

.market-input:focus-visible {
  border-color: var(--focus);
  box-shadow:
    0 0 0 4px var(--focus-ring),
    0 14px 40px var(--shadow);
}

.county-submit {
  display: flex;
  width: 100%;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: 17px 20px;
  border: 1px solid var(--glass-edge);
  border-radius: 10px;
  background: linear-gradient(
    135deg,
    var(--focus-ring),
    var(--glass-surface)
  );
  color: var(--ink);
  font: inherit;
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  font-weight: 750;
  letter-spacing: 0.01em;
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 14px 40px var(--shadow),
    0 0 24px var(--glass-glow);
  backdrop-filter: blur(16px);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
  -webkit-backdrop-filter: blur(16px);
}

.county-submit:hover {
  border-color: var(--focus);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 0 0 4px var(--focus-ring),
    0 16px 44px var(--shadow),
    0 0 30px var(--glass-glow);
  transform: translateY(-1px);
}

.county-submit:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.county-submit:active {
  transform: translateY(0);
}

.county-submit-arrow {
  font-size: 1.25em;
  line-height: 1;
  transition: transform 160ms ease;
}

.county-submit:hover .county-submit-arrow {
  transform: translateX(3px);
}

.market-question[hidden],
.market-input[hidden],
.county-submit[hidden] {
  display: none;
}

.plan-entry {
  width: min(780px, 100%);
}

.plan-context {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0 0 clamp(22px, 4vw, 34px);
  color: var(--focus);
  font-size: clamp(0.65rem, 1.4vw, 0.75rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.4;
  text-transform: uppercase;
}

.plan-context::before {
  width: 24px;
  height: 1px;
  background: currentColor;
  content: "";
}

.plan-context strong {
  color: var(--ink);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.plan-fieldset {
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.plan-question {
  display: block;
  width: 100%;
  max-width: 13ch;
  margin: 0 0 clamp(28px, 5vw, 42px);
  padding: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 6.2vw, 4.75rem);
  font-weight: 400;
  letter-spacing: -0.05em;
  line-height: 0.98;
}

.plan-options {
  border-bottom: 1px solid var(--line);
}

.plan-option {
  position: relative;
  display: grid;
  min-height: 76px;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
}

.plan-radio {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.plan-marker {
  position: relative;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid var(--glass-edge);
  border-radius: 50%;
  background: var(--glass-surface);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 5px 18px var(--shadow);
  backdrop-filter: blur(10px);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
  -webkit-backdrop-filter: blur(10px);
}

.plan-marker::after {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--paper);
  content: "";
  opacity: 0;
  transform: scale(0.5);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.plan-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.plan-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.12rem, 2.4vw, 1.35rem);
  line-height: 1.15;
  transition: color 180ms ease;
}

.plan-description {
  color: var(--placeholder);
  font-size: clamp(0.78rem, 1.6vw, 0.9rem);
  line-height: 1.45;
}

.plan-option:hover .plan-marker {
  border-color: var(--focus);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 0 0 5px var(--focus-ring),
    0 8px 24px var(--shadow);
  transform: scale(1.06);
}

.plan-radio:checked + .plan-marker {
  border-color: var(--focus);
  background: var(--focus);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 0 18px var(--glass-glow);
}

.plan-radio:checked + .plan-marker::after {
  opacity: 1;
  transform: scale(1);
}

.plan-radio:checked ~ .plan-copy .plan-title {
  color: var(--focus);
}

.plan-radio:focus-visible + .plan-marker {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

@media (max-width: 560px) {
  main {
    place-items: start center;
    padding-top: clamp(84px, 10vh, 104px);
  }

  .coverage-toolbar {
    flex-wrap: wrap;
  }

  .coverage-heading {
    max-width: 100%;
    flex-basis: 100%;
  }

  .coverage-route {
    flex-basis: 100%;
    margin-left: 38px;
  }

  .county-ribbon {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    font-size: 0.62rem;
  }

  .county-ribbon::before {
    display: none;
  }

  .county-ribbon li {
    min-width: 0;
  }

  .county-ribbon li:last-child {
    grid-column: 1 / -1;
  }

  .county-option {
    min-height: 46px;
    align-items: center;
    flex-direction: row;
    justify-content: flex-start;
    padding: 10px 12px;
    border: 1px solid var(--glass-edge);
    border-radius: 8px;
    background: var(--glass-surface);
    box-shadow:
      inset 0 1px 0 var(--glass-highlight),
      0 6px 18px var(--shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .county-option:has(.county-checkbox:checked) {
    border-color: var(--focus);
    background: var(--focus-ring);
  }

  .market-question {
    margin-bottom: 22px;
    font-size: clamp(2.15rem, 11vw, 3rem);
  }

  .plan-page main {
    padding-top: clamp(96px, 14vh, 124px);
  }

  .plan-context {
    align-items: flex-start;
  }

  .plan-context strong {
    flex-basis: calc(100% - 36px);
    margin-left: 36px;
  }

  .plan-question {
    font-size: clamp(2.25rem, 11vw, 3.2rem);
  }

  .plan-option {
    min-height: 82px;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 12px;
    padding: 15px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .change-market,
  .market-input,
  .county-submit,
  .county-submit-arrow,
  .theme-toggle,
  .theme-toggle-icon,
  .all-counties-control,
  .all-counties-marker,
  .all-counties-marker::after,
  .county-marker,
  .county-marker::after,
  .county-name,
  .plan-marker,
  .plan-marker::after,
  .plan-title {
    transition: none;
  }
}
