:root {
  color-scheme: light;
  --ink: #17211b;
  --muted: #627069;
  --paper: #f5f4ed;
  --card: #fffefa;
  --line: #d8ddd8;
  --forest: #176342;
  --forest-dark: #10462f;
  --error: #9d2e27;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.site-header {
  padding: 1rem max(1.25rem, calc((100vw - 1100px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 254, 250, 0.9);
}

.site-header a {
  color: var(--forest-dark);
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.page-shell {
  width: min(1100px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 4rem 0 6rem;
}

.hero { max-width: 760px; margin-bottom: 2.5rem; }
.eyebrow { color: var(--forest); font-size: 0.78rem; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase; }
h1 { margin: 0.2rem 0 1rem; font-family: Georgia, serif; font-size: clamp(2.4rem, 7vw, 5.2rem); font-weight: 500; letter-spacing: -0.045em; line-height: 0.98; }
h2 { margin-top: 0; font-family: Georgia, serif; font-size: 1.75rem; font-weight: 500; }
.lede { color: var(--muted); font-size: 1.15rem; line-height: 1.65; }

.card, .map-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 12px 35px rgba(27, 47, 36, 0.07);
}

.form-card { max-width: 680px; padding: clamp(1.4rem, 4vw, 2.5rem); }
form { display: grid; gap: 0.75rem; }
label { margin-top: 0.7rem; font-weight: 700; }
input { width: 100%; padding: 0.8rem; border: 1px solid #bbc5be; border-radius: 9px; background: white; font: inherit; }
.distance-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.8rem; }
.distance-field span, .privacy-note { color: var(--muted); }

button, .secondary-button {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.85rem 1.2rem;
  border: 0;
  border-radius: 9px;
  background: var(--forest);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
}
button:hover { background: var(--forest-dark); }
.secondary-button { margin: 0; background: transparent; color: var(--forest-dark); border: 1px solid var(--forest); }
.privacy-note { margin: 1.25rem 0 0; font-size: 0.85rem; }
.error { padding: 0.9rem 1rem; border-left: 4px solid var(--error); border-radius: 6px; background: #fff0ee; color: #7c211c; }

.results-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.results-heading h1 { font-size: clamp(2rem, 5vw, 3.8rem); }
.results-controls { margin-bottom: 1rem; padding: 1rem 1.25rem; }
.results-settings { display: flex; align-items: end; gap: 1rem; }
.setting-field { display: grid; gap: 0.45rem; }
.setting-field label { margin: 0; font-size: 0.82rem; }
.distance-setting { width: min(310px, 100%); }
.color-setting input[type="color"] {
  width: 3.25rem;
  height: 2.75rem;
  padding: 0.2rem;
  cursor: pointer;
}
.update-results-button { margin: 0; }
.results-privacy-note { margin: 0.75rem 0 0; color: var(--muted); font-size: 0.78rem; }
.map-card { overflow: hidden; }
.map-card iframe { display: block; width: 100% !important; min-height: 560px; border: 0 !important; }
.results-card { margin-top: 2rem; padding: 2rem; }
.results-card-heading { display: flex; justify-content: space-between; gap: 1rem; }
.results-card-heading h2 { margin-bottom: 0.25rem; }
.results-card-heading p { margin: 0 0 1.25rem; color: var(--muted); font-size: 0.9rem; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
.results-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.results-table th,
.results-table td { padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.results-table thead th { background: #f1f2ed; color: var(--muted); font-size: 0.76rem; letter-spacing: 0.04em; text-transform: uppercase; }
.results-table tbody tr:last-child > * { border-bottom: 0; }
.results-table tbody tr:nth-child(even) > * { background: #fafaf6; }
.results-table tbody tr:hover > * { background: #eef5f0; }
.results-table .numeric { text-align: right; }
.results-table .row-number {
  width: 1%;
  border-right: 1px solid var(--line);
  background: #f1f2ed;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: right;
}
.sort-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  width: auto;
  margin: -0.4rem;
  padding: 0.4rem;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
.numeric .sort-button { justify-content: flex-end; }
.sort-button:hover { background: #e2e8e3; color: var(--ink); }
.sort-button:focus-visible { outline: 2px solid var(--forest); outline-offset: 1px; }
.sort-indicator { width: 0.75rem; color: #929e97; text-align: center; }
.sort-indicator::before { content: "\2195"; }
[aria-sort="ascending"] .sort-indicator,
[aria-sort="descending"] .sort-indicator { color: var(--forest-dark); }
[aria-sort="ascending"] .sort-indicator::before { content: "\2191"; }
[aria-sort="descending"] .sort-indicator::before { content: "\2193"; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 650px) {
  .page-shell { padding-top: 2.5rem; }
  .results-heading { align-items: stretch; flex-direction: column; }
  .results-settings { align-items: stretch; flex-direction: column; }
  .distance-setting { width: 100%; }
  .color-setting { display: flex; align-items: center; justify-content: space-between; }
  .map-card iframe { min-height: 460px; }
}
