:root {
  color-scheme: light;
  --ink: #132f37;
  --paper: #f4f8f7;
  --white: #ffffff;
  --line: #d6e1dd;
  --muted: #476162;
  --green: #176151;
  --green-dark: #104a3f;
  --night: #102e35;
  --mint: #afe3c9;
  --heading: 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  font-family: 'Avenir Next', Avenir, system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
  text-underline-offset: 4px;
}

.icon-label {
  display: flex;
  align-items: center;
  gap: .4em;
}

.lucide-icon {
  display: inline-block;
  flex: none;
  color: var(--green);
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #2d8c71;
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

.wrap {
  width: min(1180px, calc(100% - 64px));
  margin-inline: auto;
}

.skip {
  position: absolute;
  top: .5rem;
  left: .5rem;
  padding: .7rem 1rem;
  background: var(--white);
  z-index: 2;
  transform: translateY(-160%);
}

.skip:focus {
  transform: translateY(0);
}

.site-header {
  position: relative;
  z-index: 1;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.header-row, .footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-row {
  min-height: 70px;
}

.brand {
  display: inline-flex;
  gap: .65rem;
  align-items: center;
  font-weight: 700;
  font-size: 1.09rem;
  letter-spacing: -.025em;
  text-decoration: none;
}

.brand svg {
  color: var(--green);
}

.header-row nav a {
  text-decoration: none;
  font-weight: 600;
  color: var(--green-dark);
}

.header-row nav a:hover {
  text-decoration: underline;
}

.header-row:has(.header-search) nav {
  margin-inline-start: auto;
}

.header-search {
  flex: 0 1 23rem;
  min-width: 0;
}

.header-search-field {
  display: flex;
  align-items: center;
  background: var(--surface, var(--white));
  border: 1px solid var(--control-border, var(--line));
  border-radius: 8px;
}

.header-search-field:has(> input:focus) {
  border-color: var(--green-dark);
  outline: 2px solid var(--green-dark);
  outline-offset: 2px;
}

.header-search-field input {
  flex: 1;
  min-height: 42px;
  padding: .45rem 0 .45rem .75rem;
  background: transparent;
  border: 0;
}

.header-search-field input:focus {
  outline: none;
}

.header-search-field button {
  display: grid;
  min-width: 44px;
  height: 42px;
  place-items: center;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.header-search-field button:focus-visible {
  outline: 2px solid var(--green-dark);
  outline-offset: -3px;
}

.header-search-field button:hover {
  background: var(--soft-plum, var(--paper));
}

.place-search {
  position: relative;
  min-width: 0;
}

.hero-grid:has(.place-suggestions:not([hidden])) {
  position: relative;
  z-index: 1;
}

.place-suggestions {
  position: absolute;
  z-index: 1;
  inset: calc(100% + .4rem) 0 auto;
  max-height: min(23rem, 55vh);
  overflow-y: auto;
  color: var(--ink);
  background: var(--surface, var(--white));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgb(0 0 0 / .16);
}

.place-suggestions ul {
  margin: 0;
  padding: .2rem;
  list-style: none;
}

.place-suggestions a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .1rem .5rem;
  padding: .5rem .7rem;
  border-radius: 5px;
  text-decoration: none;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.place-suggestions a .lucide-icon {
  grid-row: span 2;
  margin-block-start: .12rem;
}

.place-suggestions a:hover,
.place-suggestions a[aria-selected="true"] {
  background: var(--soft-plum, var(--paper));
}

.place-suggestions a span,
.place-suggestions-message {
  color: var(--muted);
  font-size: .85rem;
}

.place-suggestions-message {
  margin: 0;
  padding: .7rem .85rem;
}

.place-search-status {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

h1, h2, h3, p {
  margin-top: 0;
}

.hero {
  background: var(--night);
  color: #f5fcf8;
}

.hero-grid {
  min-height: 490px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .96fr);
  align-items: center;
  gap: 4rem;
  padding-block: 3.7rem;
}

.hero-count {
  color: var(--mint);
  margin-bottom: .55rem;
  font-size: .96rem;
  font-weight: 650;
}

h1 {
  font-family: var(--heading);
  font-size: clamp(3rem, 6.8vw, 6.55rem);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.055em;
  margin-bottom: 1.3rem;
}

.hero-intro {
  max-width: 31rem;
  color: #c9dcd8;
  font-size: clamp(1.02rem, 1.8vw, 1.22rem);
  margin-bottom: 1.65rem;
}

.hero-link {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  padding: 0 1rem;
  color: var(--night);
  background: var(--mint);
  text-decoration: none;
  border-radius: 6px;
  font-weight: 650;
}

.hero-link:hover {
  background: #d2f2e2;
}

.overview {
  margin: 0;
  min-width: 0;
  padding: .5rem 0 0;
}

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

.overview path {
  fill: #244f54;
  stroke: #84bcb4;
  stroke-width: .65;
}

.overview figcaption {
  text-align: center;
  margin-top: .35rem;
  color: #b6d3d0;
  font-size: .9rem;
}

.search-area {
  padding: 3rem 0 4.5rem;
  scroll-margin: 2rem;
}

h2 {
  font-family: var(--heading);
  font-weight: 500;
  font-size: clamp(1.65rem, 4vw, 2.55rem);
  line-height: 1.1;
  letter-spacing: -.035em;
  margin-bottom: 1.2rem;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(10rem, 1.3fr) minmax(10rem, 1fr) minmax(10rem, 1fr) auto;
  align-items: end;
  gap: 1rem;
  padding: 1.2rem;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 10px;
}

.field {
  display: grid;
  gap: .35rem;
  min-width: 0;
}

label {
  font-size: .9rem;
  font-weight: 650;
}

input, select, button {
  font: inherit;
  color: inherit;
}

input, select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 1px solid #aabdb7;
  border-radius: 6px;
  padding: .65rem .75rem;
  background: var(--white);
}

select {
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m4 7 5 5 5-5' fill='none' stroke='%23132f37' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right .58rem center;
  background-repeat: no-repeat;
  text-overflow: ellipsis;
}

input::placeholder {
  color: #5d7373;
}

.primary, .load-more {
  min-height: 46px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 650;
  padding: .65rem 1rem;
}

.primary {
  color: var(--white);
  background: var(--green);
  border: 1px solid var(--green);
}

.primary:hover {
  background: var(--green-dark);
}

.results-heading {
  padding: 1.8rem 0 .6rem;
}

.results-heading h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
}

.results {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--line);
}

.results li {
  border-bottom: 1px solid var(--line);
}

.results a {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) minmax(7rem, .95fr) auto;
  align-items: center;
  gap: .5rem 1rem;
  padding: .9rem .6rem;
  text-decoration: none;
}

.results a:hover {
  background: #e7f2ec;
}

.results a:hover strong {
  text-decoration: underline;
}

.results span {
  color: var(--muted);
  font-size: .91rem;
}

.result-population {
  font-variant-numeric: tabular-nums;
}

.message {
  padding-block: 1rem;
  color: var(--muted);
}

.results-actions {
  text-align: center;
  font-size: .92rem;
}

.load-more {
  margin-top: 1.5rem;
  background: var(--white);
  border: 1px solid #aabdb7;
}

.load-more:hover:not([aria-disabled="true"]) {
  background: #e7f2ec;
}

.load-more[aria-disabled="true"] {
  opacity: .75;
  cursor: wait;
}

.load-more-error {
  margin: 0;
  color: var(--muted);
}

.load-more-error:not(:empty) {
  margin-top: .6rem;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: center;
  margin-bottom: 2.1rem;
  color: var(--muted);
  font-size: .94rem;
}

.breadcrumb a {
  color: var(--green-dark);
}

.site-footer {
  background: var(--white);
  border-top: 1px solid var(--line);
  padding-block: 1.7rem;
}

.footer-row a:not(.brand) {
  color: var(--green-dark);
  font-size: .9rem;
}

@media (max-width: 900px) {
  .hero-grid {
    gap: 1.8rem;
    min-height: 430px;
  }

  .search-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .wrap {
    width: calc(100% - 36px);
  }

  .header-row {
    min-height: 58px;
  }

  .header-row:has(.header-search) {
    flex-wrap: wrap;
    row-gap: .35rem;
    padding-block: .45rem .75rem;
  }

  .header-search {
    flex-basis: 100%;
  }

  .hero-grid {
    display: block;
    padding-block: 2.4rem 1.5rem;
  }

  .overview {
    margin: 1.65rem auto 0;
    max-width: 24rem;
  }

  .search-area {
    padding-block: 2rem 3rem;
  }

  .search-form {
    grid-template-columns: 1fr;
    gap: .8rem;
    padding: 1rem;
  }

  .search-form .primary {
    width: 100%;
  }

  .results a {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .results a strong {
    grid-column: 1;
    grid-row: 1;
  }

  .results a span:not(.result-population) {
    grid-column: 1;
    grid-row: 2;
  }

  .results a .result-population {
    grid-column: 2;
    grid-row: 1 / span 2;
    text-align: right;
    max-width: 7rem;
  }

  .breadcrumb {
    margin-bottom: 1.2rem;
  }

  .footer-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
