:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  color: #181818;
  background: #f4f4f4;
  --rule: #c6c6c6;
  --muted: #565656;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

h1, h2, p, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
input, button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #555; outline-offset: 2px; }

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

.page {
  width: min(calc(100% - 2rem), 56rem);
  margin-inline: auto;
  padding-block: 1.5rem;
}

@media (scripting: none) {
  #startup-status { display: none; }
}

.brand {
  margin-bottom: 1rem;
  text-align: center;
}

.brand h1 {
  font: italic 400 clamp(2.125rem, 6.5vw, 3.625rem)/1.05 "Times New Roman", Times, serif;
}

.panel {
  border: 1px solid #777;
  background: white;
}

.search {
  position: relative;
  z-index: 1;
  padding: .625rem .75rem;
  border-bottom: 1px solid #777;
  background: #eaeaea;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.search-bar label { font-size: .875rem; font-weight: 700; }

.search input {
  flex: 1;
  min-width: 0;
  max-width: 22rem;
  min-height: 2rem;
  padding: .25rem .4375rem;
  appearance: none;
  border: 1px solid #7a7a7a;
  border-radius: 0;
  background: white;
}

.search input::placeholder { color: var(--muted); }

.search-bar button {
  min-height: 2rem;
  padding: .25rem .875rem;
  border: 1px solid;
  border-color: #aaa #666 #666 #aaa;
  border-radius: 0;
  background: #f7f7f7;
  font-size: .875rem;
  font-weight: 700;
}

.search-bar button:hover { background: #ddd; }
.search-bar button:active { border-color: #666 #aaa #aaa #666; }

.search-results {
  position: absolute;
  inset: calc(100% + 1px) .75rem auto;
  width: min(calc(100% - 1.5rem), 26rem);
  max-height: 18rem;
  overflow: auto;
  border: 1px solid #777;
  background: white;
}

.search-results li + li { border-top: 1px solid var(--rule); }

.search-results button, .empty-result {
  display: block;
  width: 100%;
  padding: .5rem .625rem;
  border: 0;
  background: white;
  text-align: start;
}

.search-results button:hover, .search-results button:focus-visible { background: #eee; }
.search-results button:focus-visible { outline-offset: -2px; }
.result-country { display: block; margin-top: .125rem; font-size: .875rem; color: var(--muted); }
.empty-result { color: var(--muted); }

.location {
  display: flex;
  min-height: 2.75rem;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem 1rem;
  flex-wrap: wrap;
  padding: .625rem .75rem;
  background: #292929;
  color: white;
}

.location > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: .125rem .75rem; }
.location h2 { font-size: 1.25rem; overflow-wrap: anywhere; }
.location :focus-visible { outline-color: white; }
.location p { color: #e0e0e0; font-size: .875rem; }

.current-weather {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  align-items: center;
  gap: .875rem 1.25rem;
  padding: .875rem .75rem;
  border-bottom: 1px solid var(--rule);
}

.now { color: var(--muted); font-size: .875rem; }

.temperature {
  font-size: 3.25rem;
  font-weight: 700;
  line-height: 1.05;
  white-space: nowrap;
}

#temperature-unit {
  vertical-align: top;
  font-size: 1.375rem;
  font-weight: 400;
  line-height: 1.6;
}

.condition { margin-top: .1875rem; }

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  background: var(--rule);
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}

.metrics div {
  display: flex;
  justify-content: space-between;
  gap: .1875rem .625rem;
  padding: .45rem .5rem;
  background: #fafafa;
}

.metrics dd { font-weight: 700; }

.forecasts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.13fr);
  align-items: start;
  gap: .75rem;
  padding: .75rem;
}

.forecasts table, .table-scroll table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}

.forecasts caption {
  padding: .4375rem .5rem;
  border: 1px solid var(--rule);
  border-bottom: 0;
  background: #dfdfdf;
  text-align: start;
  font-size: 1rem;
  font-weight: 700;
}

.forecasts th, .forecasts td, .table-scroll th, .table-scroll td {
  padding: .375rem .5rem;
  border: 1px solid var(--rule);
  text-align: start;
}

.forecasts thead, .table-scroll thead { background: #f0f0f0; }
.forecasts tbody tr:nth-child(even), .table-scroll tbody tr:nth-child(even) { background: #f7f7f7; }
.forecasts tbody th, .table-scroll tbody th { font-weight: 400; }
.forecasts tbody th::first-letter, .table-scroll tbody th::first-letter { text-transform: uppercase; }
.forecasts .reading, .table-scroll .reading { text-align: end; white-space: nowrap; }
.day-date { display: block; color: var(--muted); font-size: .8125rem; white-space: nowrap; }

.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .375rem .75rem;
  padding: .625rem .75rem;
  border-bottom: 1px solid var(--rule);
  background: #f7f7f7;
  font-size: .875rem;
}

.text-button {
  padding: .125rem .25rem;
  border: 0;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: .125em;
}

.extra { padding: 0 .75rem .75rem; }
.extra details { border: 1px solid var(--rule); }
#air-detail[open] { min-height: var(--air-loading-height, 0px); }
.extra details + details { margin-top: .375rem; }
.extra summary { padding: .5rem; background: #efefef; font-size: .875rem; font-weight: 700; cursor: pointer; }
.extra summary:hover { background: #e6e6e6; }
.extra details[open] summary { border-bottom: 1px solid var(--rule); }
.detail-control { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .5rem; font-size: .875rem; }
.detail-control select { max-width: 100%; border: 1px solid #777; border-radius: 0; padding: .25rem; background: white; }
.table-scroll { max-height: 23rem; overflow: auto; padding: 0 .5rem .5rem; }
.table-scroll thead { position: sticky; top: 0; }
.table-scroll tbody th { min-width: 6.25rem; }
.table-scroll thead th { white-space: normal; }
.air-metrics { margin: .5rem; }
.air-metrics:empty { display: none; }
.air-note { margin: .5rem; color: var(--muted); font-size: .875rem; }

.preferences {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 1rem;
  margin-top: .375rem;
  color: var(--muted);
  font-size: .875rem;
}

.preferences > div { display: flex; align-items: center; }
.preferences > div span { margin-inline-end: .25rem; }

.preferences button {
  min-width: 2.25rem;
  min-height: 2.125rem;
  padding: .25rem;
  border: 0;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: .125em;
}

.preferences button:hover { background: #e7e7e7; }
.preferences button[aria-pressed="true"] { color: #181818; font-weight: 700; text-decoration: none; }

.credits { margin-top: .375rem; color: var(--muted); text-align: center; font-size: .75rem; line-height: 1.5; }
.credits a { color: inherit; text-underline-offset: .125em; }
.credit-links a { white-space: nowrap; }
.credit-details { max-width: 40rem; margin: .25rem auto 0; }
.credit-details summary { width: fit-content; margin-inline: auto; cursor: pointer; }
.credit-details p { margin-top: .375rem; text-align: start; }

@media (min-width: 52rem) {
  .day-date { display: inline; margin-inline-start: .35rem; }
}

@media (max-width: 48rem) {
  .forecasts { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 43rem) {
  .current-weather { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 27rem) {
  .page { width: calc(100% - 1rem); }
  .search, .location, .current-weather, .forecasts, .extra { padding-inline: .5rem; }
  .metrics div { flex-direction: column; }
  .forecasts th, .forecasts td { padding-inline: .3125rem; }
  .search input, .search-bar button, .preferences button { min-height: 2.5rem; }
}

@media (max-width: 22rem) {
  .forecasts th, .forecasts td { padding-inline: .1875rem; }
  .forecasts tbody td:nth-child(2) { overflow-wrap: anywhere; }
}
