/* Accent colors match the map legend: blue, white, red, and gray for no data. */
:root {
  --blue: rgb(33, 102, 172);
  --red: rgb(178, 24, 43);
  --gray: rgb(189, 189, 189);
  --ink: #1d2733;
  --muted: #55616f;
  --line: #d9dee4;
  --paper: #ffffff;
  --wash: #f4f6f8;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

.wrap {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */

.page-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  /* A thin band in the legend colors. */
  border-top: 4px solid transparent;
  border-image: linear-gradient(to right, var(--blue), #ffffff, var(--red)) 1;
  padding: 1.75rem 0 1.5rem;
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.contact-link {
  flex: none;
  padding: 0;
  background: none;
  border: 0;
  color: var(--blue);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

.contact-link:hover,
.contact-link:focus-visible {
  color: var(--red);
}

.eyebrow {
  margin: 0;
  color: var(--blue);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 28em;
  font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.25rem);
  line-height: 1.2;
  text-wrap: balance;
}

/* Map: the main element of the page */

.map-section {
  margin: 1.5rem 0 2.5rem;
}

.map-frame {
  /* 85% of clamp(60rem, 200vh - 42rem, 92rem). The frame is taller than a laptop window,
     so the app's time slider is reached by scrolling the page. */
  height: clamp(51rem, calc(170vh - 35.7rem), 78.2rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.map-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.map-fallback {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Color key under the map */

.key {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem 2rem;
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.scale {
  flex: 0 1 26rem;
  min-width: min(100%, 18rem);
}

.scale-bar {
  height: 0.85rem;
  background: linear-gradient(to right, var(--blue), #ffffff, var(--red));
  border: 1px solid #8a94a0;
  border-radius: 3px;
}

.scale-labels {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.scale-labels span:last-child {
  text-align: right;
}

.key-nodata {
  display: flex;
  align-items: center;
  margin: 0;
}

.swatch {
  flex: none;
  width: 0.85rem;
  height: 0.85rem;
  margin-right: 0.45rem;
  background: var(--gray);
  border: 1px solid #8a94a0;
  border-radius: 2px;
}

/* Text sections */

.text {
  max-width: 44rem;
}

.text section + section {
  margin-top: 1.75rem;
}

h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  line-height: 1.3;
}

.text p {
  margin: 0;
}

.text p + p {
  margin-top: 0.75rem;
}

code {
  padding: 0.05em 0.3em;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

a {
  color: var(--blue);
  text-underline-offset: 0.15em;
}

a:hover,
a:focus-visible {
  color: var(--red);
}

/* Footer */

.page-footer {
  margin-top: 2.5rem;
  padding: 1.25rem 0 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

.page-footer p {
  margin: 0;
  max-width: 60em;
}

/* Contact popup */

.contact {
  width: min(24rem, calc(100vw - 2rem));
  padding: 0;
  background: var(--paper);
  border: 0;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  color: var(--ink);
}

.contact::backdrop {
  background: rgba(29, 39, 51, 0.55);
}

.contact-body {
  position: relative;
  padding: 1.5rem 1.75rem 1.6rem;
}

.contact-body h2 {
  margin-bottom: 0.9rem;
  font-size: 1.3rem;
}

.contact-body p {
  margin: 0.5rem 0 0;
}

.contact-body a {
  overflow-wrap: anywhere;
}

.contact-close {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.contact-close:hover,
.contact-close:focus-visible {
  background: var(--wash);
  color: var(--ink);
}

/* Narrow screens */

@media (max-width: 40rem) {
  .wrap {
    padding: 0 1rem;
  }

  .page-header {
    padding: 1.5rem 0 1.25rem;
  }

  .map-frame {
    /* Kept inside one screen so the page can still be scrolled past the map on a phone. */
    height: 72.25vh;
    min-height: 25.5rem;
    border-radius: 4px;
  }

  .key {
    font-size: 0.75rem;
  }
}
