:root {
  color-scheme: light dark;
  --bg: #f4f6f8;
  --surface: #fff;
  --text: #101828;
  --muted: #5d6b82;
  --line: #e1e6ed;
  --accent: #0f766e;
  --accent-soft: #e3f4f1;
  --land: #e4e9ef;
  --on-accent: #fff;
  --warn-bg: #fef3c7;
  --warn-text: #78350f;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --text: #e6edf3;
    --muted: #9aa7b8;
    --line: #2b3440;
    --accent: #2dd4bf;
    --accent-soft: #11312e;
    --land: #252d38;
    --on-accent: #062a26;
    --warn-bg: #3b2f0b;
    --warn-text: #fde68a;
  }
}

* {
  box-sizing: border-box;
}

/* Text grows a little on large monitors, and everything sized in rem with it. */
html {
  font-size: clamp(100%, 0.875rem + 0.14vw, 112.5%);
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 20px 64px;
}

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

h1 {
  margin: 4px 0 12px;
  font-size: clamp(1.7rem, 5vw, 2.3rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
}

h3 {
  margin: 0;
  font-size: 1rem;
}

p {
  margin: 0 0 12px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow a {
  text-decoration: none;
}

.lede {
  max-width: 60ch;
  color: var(--muted);
  font-size: 1.1rem;
}

.assurance {
  max-width: 60ch;
  margin-top: 16px;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--accent-soft);
  font-size: 0.95rem;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.card {
  margin-top: 20px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.notice {
  margin-top: 20px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-weight: 600;
}

/* --- generator ------------------------------------------------------------ */

.steps {
  counter-reset: step;
}

.steps > .card > h2::before {
  counter-increment: step;
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 1.7em;
  height: 1.7em;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9rem;
}

.filter {
  width: 100%;
  margin: 8px 0 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: inherit;
  font: inherit;
}

.scroll {
  max-height: 340px;
  overflow-y: auto;
  padding: 0 8px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.group h3 {
  margin: 14px 8px 4px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0 12px;
  margin-top: 8px;
}

.option {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.option:hover {
  background: var(--accent-soft);
}

.option:has(input:disabled) {
  color: var(--muted);
  cursor: default;
}

/* The "!" beside an option; its label doubles as the tooltip. */
.info {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--warn-bg);
  color: var(--warn-text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 20px;
  cursor: help;
}

.info::after {
  content: attr(aria-label);
  position: absolute;
  top: 100%;
  right: 8px;
  left: 36px;
  z-index: 1;
  display: none;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--text);
  color: var(--surface);
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
}

.info:hover::after,
.info:focus::after {
  display: block;
}

.option input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  accent-color: var(--accent);
}

.map {
  position: relative;
  margin: 12px 0 8px;
}

.map svg {
  display: block;
  width: 100%;
  height: auto;
}

.towns path {
  fill: var(--land);
  stroke: var(--surface);
  stroke-linejoin: round;
}

.towns path.current {
  fill: color-mix(in srgb, var(--accent) 30%, var(--land));
}

.town-names text {
  fill: var(--muted);
  font-size: 8.5px;
  font-weight: 600;
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--land);
  stroke-width: 2.5px;
  pointer-events: none;
}

.pin {
  r: 5.5px;
  fill: var(--surface);
  stroke: var(--muted);
  stroke-width: 1.5;
  opacity: 0.6;
  outline: none;
}

.pin.offered {
  stroke: var(--accent);
  opacity: 1;
  cursor: pointer;
}

.pin.ticked {
  r: 8px;
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 2;
}

.pin:hover,
.pin:focus-visible {
  stroke: var(--text);
  stroke-width: 2.5;
}

.map-details {
  --shift-x: -50%;
  --shift-y: calc(-100% - 14px);
  position: absolute;
  top: var(--pin-y);
  left: var(--pin-x);
  z-index: 2;
  display: grid;
  gap: 2px;
  width: max-content;
  max-width: min(300px, 78vw);
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--text);
  color: var(--surface);
  font-size: 0.82rem;
  line-height: 1.35;
  pointer-events: none;
  transform: translate(var(--shift-x), var(--shift-y));
}

.map-details.opens-right {
  --shift-x: -16px;
}

.map-details.opens-left {
  --shift-x: calc(-100% + 16px);
}

.map-details.opens-down {
  --shift-y: 14px;
}

.map-details strong {
  font-size: 0.9rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

.chip input {
  position: absolute;
  opacity: 0;
}

.chip:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

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

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

.summary {
  margin: 12px 0 18px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--accent-soft);
}

.bookmark {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
}

.bookmarklet {
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
  cursor: grab;
  box-shadow: 0 6px 16px rgb(15 118 110 / 30%);
}

.bookmarklet:not([href]) {
  background: var(--line);
  color: var(--muted);
  box-shadow: none;
  cursor: not-allowed;
}

.how {
  margin: 20px 0 0;
  padding-left: 1.3em;
}

.how li {
  margin-bottom: 8px;
}

kbd {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  font: inherit;
  font-size: 0.85em;
}

.notes {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.9rem;
}

.notes h2 {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 1rem;
}

.notes ul {
  margin: 0;
  padding-left: 1.2em;
  columns: 2 26rem;
  column-gap: 40px;
}

.notes li {
  margin-bottom: 6px;
  break-inside: avoid;
}

footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

/* --- results -------------------------------------------------------------- */

/* Polyclinics sit side by side where the window has room for them. */
.clinics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 30rem), 1fr));
  column-gap: 32px;
}

.clinic {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.clinic h3 span {
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.day {
  display: grid;
  grid-template-columns: 9.5em 1fr;
  gap: 4px 12px;
  margin-top: 10px;
}

.day time {
  padding-top: 3px;
  font-weight: 600;
}

.times {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.times span {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.rest {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 520px) {
  .town-names {
    display: none;
  }

  .map-details[class] {
    --shift-x: -50%;
    left: 50%;
  }

  .pin {
    r: 8px;
  }

  .pin.ticked {
    r: 12px;
  }

  .card {
    padding: 18px;
  }

  .day {
    grid-template-columns: 1fr;
  }
}

/* --- wide windows --------------------------------------------------------- */

/* The page stays one column of cards, which widen with the window; what is
   inside each card spreads sideways so the cards do not just grow taller. */
@media (min-width: 960px) {
  main {
    max-width: 84rem;
    padding-inline: clamp(24px, 4vw, 64px);
  }

  .assurance {
    max-width: none;
  }

  .filter {
    max-width: 26rem;
  }

  /* Every appointment type on show, in as many columns as fit. */
  .scroll {
    max-height: none;
    padding: 0 12px 12px;
    columns: 15rem;
    column-gap: 16px;
  }

  /* Padding, unlike the heading's margin, survives at the top of a column. */
  .group {
    padding-top: 14px;
  }

  .group h3 {
    margin-top: 0;
    break-after: avoid;
  }

  .option {
    break-inside: avoid;
  }

  .map {
    max-width: 50rem;
    margin-inline: auto;
  }

  .how {
    columns: 2;
    column-gap: 40px;
  }

  .how li {
    break-inside: avoid;
  }
}
