:root {
  --rh-bg: #ffffff;
  --rh-ink: #000000;
  --rh-muted: #444444;
  --rh-rule: #000000;
  --rh-hover: #cccccc;
}

.weather-page .wrapper {
  max-width: 1180px;
  padding: 0 18px 32px;
}

.weather-page .title h1 {
  font-size: 60px;
}

.rh-app {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rh-controls,
.rh-current-conditions,
.rh-panel,
.rh-summary {
  background: var(--rh-bg);
  border: 2px solid var(--rh-rule);
}

.rh-controls {
  display: grid;
  align-items: start;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px;
}

.rh-search,
.rh-timeframe {
  min-width: 0;
}

.rh-timeframe {
  display: flex;
  flex-direction: column;
}

.rh-search label,
.rh-field-label,
.rh-custom-range label {
  display: block;
  color: var(--rh-muted);
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.rh-search-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 6px;
}

.rh-search input,
.rh-custom-range input {
  background: var(--rh-bg);
  border: 2px solid var(--rh-rule);
  box-sizing: border-box;
  color: var(--rh-ink);
  font: inherit;
  min-width: 0;
  padding: 8px 10px;
  width: 100%;
}

.rh-custom-range input {
  display: block;
  margin-top: 4px;
}

.rh-search button,
.rh-timeframe button {
  background: var(--rh-bg);
  border: 2px solid var(--rh-rule);
  color: var(--rh-ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 8px 10px;
}

.rh-search button:hover,
.rh-timeframe button:hover,
.rh-search button:focus-visible,
.rh-timeframe button:focus-visible {
  background: var(--rh-hover);
}

.rh-search button:disabled,
.rh-timeframe button:disabled {
  cursor: wait;
  opacity: 0.66;
}

.rh-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 10px;
}

.rh-presets button {
  padding-left: 7px;
  padding-right: 7px;
}

.rh-presets button[aria-pressed="true"] {
  background: var(--rh-ink);
  border-color: var(--rh-ink);
  color: #ffffff;
}

.rh-custom-range {
  align-items: end;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
}

#rh-apply-dates {
  align-self: end;
  height: 40px;
  margin-bottom: 6px;
}

.rh-results {
  display: grid;
  gap: 6px;
  list-style: none;
  margin-top: 8px;
  max-height: 170px;
  overflow: auto;
}

.rh-results:empty {
  display: none;
}

.rh-result-button {
  background: var(--rh-bg);
  border: 2px solid var(--rh-rule);
  color: var(--rh-ink);
  cursor: pointer;
  display: block;
  font: inherit;
  padding: 8px 9px;
  text-align: left;
  width: 100%;
}

.rh-result-button:hover,
.rh-result-button:focus-visible {
  background: var(--rh-hover);
}

.rh-current-conditions {
  padding: 14px;
}

.rh-current-conditions-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.rh-current-conditions-heading h2 {
  font-size: 1.32rem;
  line-height: 1.25;
  margin: 0 0 6px;
}

.rh-current-conditions-heading p {
  color: var(--rh-muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  margin: 0;
  text-align: right;
}

.rh-current-conditions .rh-search {
  border-top: 1px solid var(--rh-rule);
  margin-bottom: 12px;
  padding-top: 12px;
}

.rh-current-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.rh-current-grid:empty::before {
  color: var(--rh-muted);
  content: "Loading current conditions...";
}

.rh-current-item {
  background: var(--rh-bg);
  border: 1px solid var(--rh-rule);
  padding: 8px;
}

.rh-current-item-action {
  cursor: pointer;
}

.rh-current-item-action:hover,
.rh-current-item-action:focus-visible,
.rh-current-item-action.is-active {
  background: var(--rh-hover);
  outline: none;
}

.rh-current-item-action.is-active {
  border-width: 2px;
  padding: 7px;
}

.rh-current-label {
  color: var(--rh-muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.rh-current-value {
  display: block;
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.rh-main-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.08fr) minmax(300px, 0.92fr);
  gap: 14px;
}

.rh-panel {
  overflow: hidden;
  position: relative;
}

#rh-map {
  height: 390px;
  min-height: 360px;
  width: 100%;
}

.rh-chart-panel {
  padding: 10px;
}

.rh-chart-wrap {
  height: 520px;
  min-height: 340px;
  position: relative;
}

.rh-summary {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  padding: 10px;
}

.rh-summary:empty {
  display: none;
}

.rh-summary-item {
  background: var(--rh-bg);
  border: 1px solid var(--rh-rule);
  padding: 8px;
}

.rh-summary-label {
  color: var(--rh-muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.rh-summary-value {
  display: block;
  font-size: 1.04rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.rh-status,
.rh-error,
.rh-attribution,
.rh-map-fallback,
.rh-chart-fallback {
  margin: 0;
}

.rh-status {
  color: var(--rh-muted);
  min-height: 1.35em;
  text-align: center;
}

.rh-error {
  border: 2px solid var(--rh-rule);
  color: var(--rh-ink);
  padding: 8px 10px;
  text-align: center;
}

.rh-attribution {
  color: var(--rh-muted);
  font-size: 0.82rem;
  line-height: 1.45;
  text-align: center;
}

.rh-attribution a {
  color: var(--rh-ink);
}

.rh-map-fallback,
.rh-chart-fallback {
  color: var(--rh-muted);
  padding: 14px;
  text-align: center;
}

.leaflet-container {
  background: var(--rh-bg);
  color: var(--rh-ink);
  font-family: "Lora", serif;
}

.leaflet-bar a,
.leaflet-control-attribution {
  border-radius: 0;
}

.leaflet-tile {
  filter: grayscale(1) contrast(1.05);
}

.rh-map-overlay-control {
  background: var(--rh-bg);
  border: 2px solid var(--rh-rule);
  color: var(--rh-ink);
  font: 700 0.82rem "Lora", serif;
  line-height: 1.25;
  max-width: 210px;
  padding: 6px 8px;
}

.rh-map-overlay-control[hidden] {
  display: none;
}

.rh-map-overlay-title,
.rh-map-overlay-detail {
  display: block;
}

.rh-map-overlay-detail {
  color: var(--rh-muted);
  font-weight: 400;
  margin-top: 2px;
}

@media (max-width: 1040px) {
  .rh-controls {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 860px) {
  .weather-page .title h1 {
    font-size: 40px;
  }

  .rh-main-grid {
    display: contents;
  }

  .rh-summary {
    grid-template-columns: 1fr;
  }

  .rh-current-conditions {
    order: 1;
  }

  .rh-graph-controls {
    order: 2;
  }

  .rh-chart-panel {
    order: 3;
  }

  .rh-map-panel {
    order: 4;
  }

  .rh-summary {
    order: 5;
  }

  .rh-status {
    order: 6;
  }

  .rh-error {
    order: 7;
  }

  .rh-attribution {
    order: 8;
  }

  .rh-current-conditions-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .rh-current-conditions-heading p {
    text-align: left;
  }

  #rh-map {
    height: 360px;
  }

  .rh-chart-wrap {
    height: clamp(420px, 58vh, 520px);
  }
}

@media (max-width: 720px) {
  .rh-controls {
    grid-template-columns: 1fr;
  }

  .rh-search-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .rh-custom-range {
    grid-template-columns: 1fr 1fr;
  }

  #rh-apply-dates {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }
}

@media (max-width: 560px) {
  .weather-page .wrapper {
    padding: 0 10px 28px;
  }

  .rh-controls {
    padding: 10px;
  }

  .rh-search-row,
  .rh-custom-range {
    grid-template-columns: 1fr;
  }

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

  .rh-presets button:last-child {
    grid-column: 1 / -1;
  }

  #rh-location-input,
  #rh-apply-dates {
    grid-column: auto;
  }

  .rh-chart-panel {
    padding: 6px;
  }

  .rh-chart-wrap {
    height: clamp(460px, 58vh, 520px);
    min-height: 0;
  }
}
