/* Climate showcase: mobile first, settings below the map; side by side from 900 px. */
.climate {
  margin: 0;
}

.layout {
  display: grid;
  grid-template-areas: "map" "controls";
}

.controls {
  grid-area: controls;
  padding: 12px 16px 24px;
}

.intro {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
}

.note {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-left: 3px solid var(--petrol-dark);
  background: var(--surface);
  font-size: 13px;
}

.map-wrap {
  grid-area: map;
  position: relative;
  height: 62vh;
  min-height: 340px;
}

.map {
  position: absolute;
  inset: 0;
}

.modes {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}

.modes legend {
  width: 100%;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}

/* A segmented control from native radios: keyboard and screen readers keep working. */
.modes input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.modes label {
  flex: 1 1 auto;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--petrol-dark);
  color: var(--petrol-dark);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
}

.modes label + input + label {
  border-left-width: 0;
}

.modes label:first-of-type {
  border-radius: 4px 0 0 4px;
}

.modes label:last-of-type {
  border-radius: 0 4px 4px 0;
}

.modes input:checked + label {
  background: var(--petrol-dark);
  color: var(--on-accent);
}

.modes input:focus-visible + label {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  position: relative;
}

.legend-title {
  margin: 4px 0 4px;
  font-size: 14px;
  font-weight: 600;
}

.hint {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.ramp {
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--line);
}

.ticks {
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin: 4px 0 12px;
  padding: 0;
  font-size: 12px;
  color: var(--muted);
}

.opacity {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 14px;
}

.opacity input {
  width: 100%;
  min-height: 40px;
  accent-color: var(--petrol-dark);
}

.opacity output {
  min-width: 3.5em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  font-size: 14px;
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--petrol-dark);
}

#inspect-center {
  margin: 4px 0 8px;
}

.sites table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.sites th,
.sites td {
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

.sites th:first-child {
  text-align: left;
}

.sites thead th {
  color: var(--muted);
  font-weight: 600;
}

.link {
  min-height: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--petrol-dark);
  font: inherit;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}

.link:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.status {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.source {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.source a {
  color: var(--petrol-dark);
  text-decoration: underline;
}

/* Several credits share one line: links stay underlined, not only colored (WCAG 1.4.1). */
.maplibregl-ctrl-attrib a {
  text-decoration: underline;
}

.card {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 28px;
  max-height: calc(100% - 56px);
  overflow: auto;
  padding: 14px 16px;
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  box-shadow: 0 4px 18px rgb(0 0 40 / 20%);
}

.card h2 {
  margin: 0 32px 2px 0;
  font-size: 18px;
}

.card-where {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0;
  font-size: 14px;
}

.card dt {
  color: var(--muted);
}

.card dd {
  margin: 0;
}

.card-source {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.card-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 36px;
  height: 36px;
  font-size: 22px;
  line-height: 1;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text);
  cursor: pointer;
}

.card-close:focus-visible {
  outline: 2px solid var(--petrol);
}

@media (min-width: 900px) {
  .climate {
    height: 100vh;
    display: flex;
    flex-direction: column;
  }

  .layout {
    flex: 1;
    min-height: 0;
    grid-template-columns: 380px 1fr;
    grid-template-areas: "controls map";
  }

  .controls {
    border-right: 1px solid var(--line);
    overflow-y: auto;
  }

  .map-wrap {
    height: auto;
    min-height: 0;
  }

  .card {
    left: auto;
    right: 16px;
    top: 16px;
    bottom: auto;
    width: 320px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
