:root {
  color-scheme: dark;
  font: 16px/1.4 system-ui, sans-serif;
  background: #0d1522;
  color: #f0f5fc;
  --muted: #aabbd0;
  --surface: #151f30;
  --border: #344860;
  --accent: #ade9f6;
  --gutter: clamp(1rem, 3.5vw, 2.75rem);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: radial-gradient(ellipse at 18% 0, #213751 0, transparent 62%),
    linear-gradient(155deg, #111e2d, #0d1522 65%);
}
.top, .overview, .weather, .release-notes, .footer { width: min(100%, 92rem); margin-inline: auto; padding-inline: var(--gutter); }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem 1.2rem;
  padding-block: .95rem .8rem;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.25rem, 3vw, 2.15rem); letter-spacing: -.035em; line-height: 1.17; }
h2 { font-size: 1.12rem; letter-spacing: -.015em; }
h3 { font-size: 1rem; font-weight: 650; overflow-wrap: anywhere; }
button, input { font: inherit; }
button {
  min-height: 2.75rem;
  padding: .55rem .9rem;
  border-radius: .55rem;
  border: 1px solid transparent;
  background: var(--accent);
  color: #112636;
  cursor: pointer;
  font-weight: 680;
}
button:disabled { opacity: .55; cursor: progress; }
button.quiet { border-color: var(--border); background: transparent; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.main-nav {
  display: flex;
  flex: none;
  align-items: center;
  gap: .2rem;
  border: 1px solid var(--border);
  border-radius: .65rem;
  background: #112035;
  padding: .2rem;
}
.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  padding: .35rem .75rem;
  border-radius: .45rem;
  color: var(--muted);
  text-decoration: none;
  font-size: .925rem;
  font-weight: 670;
}
.main-nav a:hover { color: #fff; }
.main-nav a[aria-current="page"] { background: #25415a; color: var(--accent); }

.overview { padding-block: .1rem .5rem; }
.climate-summary {
  border: 1px solid #39546d;
  border-radius: .8rem;
  padding: .6rem .8rem .65rem;
  background: linear-gradient(106deg, #263e57, #192b40 69%, #183145);
}
.summary-heading, .station-heading, .weather-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .22rem 1rem;
}
.summary-heading h2 { font-size: .95rem; font-weight: 680; }
.summary-heading p, .weather-heading p, .weather-muted { color: var(--muted); font-size: .875rem; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: .4rem 0 0; gap: .35rem; }
.summary-metric { border-left: 1px solid #4b6680; padding: .12rem .57rem; }
.summary-metric dt { color: #c3d3e5; font-size: .875rem; }
.summary-metric dd { margin: 0; font-size: clamp(1.09rem, 2.15vw, 1.55rem); font-weight: 720; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.summary-metric dd[data-stale] { color: #ffdbac; }

.dashboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(.85rem, 2vw, 1.45rem);
  padding-top: .65rem;
}
.camera-group { margin-bottom: .35rem; color: #e1edf9; }
.camera-grid { display: grid; gap: .55rem; }
.camera {
  border: 1px solid var(--border);
  border-radius: .7rem;
  background: var(--surface);
}
.camera header {
  min-height: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  padding: .25rem .58rem;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--muted);
  font-size: .875rem;
  text-align: right;
}
.status[data-live] { color: #b4f2d1; }
.status[data-live]::before { content: ""; width: .43rem; height: .43rem; border-radius: 50%; background: #71e5ad; }
.camera-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: clamp(104px, calc((100vh - 21rem) / 2), 41vh);
  border-radius: 0 0 calc(.7rem - 1px) calc(.7rem - 1px);
  background: #080e19;
}
.camera-stage { position: absolute; inset: 0; border-radius: inherit; }
.camera-stage video { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.camera-open {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: .45rem;
  min-height: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
}
.camera-open:focus-visible { outline-offset: -3px; }
.expand-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: .4rem;
  border: 1px solid #c7def1a3;
  background: #0c1825e0;
}
.expand-icon::before, .expand-icon::after { content: ""; position: absolute; width: .65rem; height: .65rem; border: solid #e8f5ff; }
.expand-icon::before { top: .48rem; left: .48rem; border-width: 2px 0 0 2px; }
.expand-icon::after { bottom: .48rem; right: .48rem; border-width: 0 2px 2px 0; }
.camera-open:hover .expand-icon { background: #25415a; }
.camera-modal-open { overflow: hidden; }
.camera-backdrop { position: fixed; inset: 0; z-index: 20; background: #040914e8; }
.camera-expanded .camera-stage {
  position: fixed;
  inset: 49% auto auto 50%;
  z-index: 21;
  transform: translate(-50%, -50%);
  width: min(94vw, 76rem, max(15rem, calc((100vh - 5rem) * 16 / 9)));
  display: flex;
  flex-direction: column;
  background: #0d1725;
  border: 1px solid var(--border);
  border-radius: .8rem;
  overflow: hidden;
  box-shadow: 0 1rem 3rem #01040b;
}
.camera-expanded video { height: auto; aspect-ratio: 16 / 9; max-height: calc(100vh - 5rem); border-radius: 0; cursor: zoom-out; }
.camera-modal-bar {
  order: -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .42rem .65rem;
  background: #19283b;
  font-weight: 680;
}
.camera-close { min-height: 2.6rem; }

.footer { margin-top: auto; padding-block: .4rem .55rem; }
.footer a { color: var(--muted); font-size: .875rem; text-underline-offset: .18em; }
.footer a:hover { color: var(--accent); }
.release-notes { max-width: 54rem; padding-block: 1.25rem 2rem; }
.release-notes h2, .weather-heading h2 { font-size: 1.5rem; }
.release {
  margin-top: .8rem;
  padding: .95rem 1rem;
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: var(--surface);
}
.release:first-of-type { border-color: #577794; }
.release h3 { color: var(--accent); }
.release ul { padding-left: 1.3rem; margin: .5rem 0 0; }
.release li + li { margin-top: .35rem; }

.weather { padding-block: .9rem 2rem; }
.weather-heading { margin-bottom: 1rem; }
.weather-warning, .metric-stale { color: #ffdbac; font-size: .875rem; }
.stations { display: grid; gap: 1.4rem; }
.station-heading { margin-bottom: .55rem; }
.station-heading h3 { font-size: 1.15rem; }
.weather-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.weather-panel { background: var(--surface); border: 1px solid var(--border); border-radius: .75rem; padding: .9rem; }
.weather-panel h4 { margin: 0 0 .65rem; font-size: 1.02rem; color: var(--accent); }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin: 0; }
.metric { background: #0f192a; border-radius: .4rem; padding: .5rem .65rem; min-width: 0; }
.metric dt { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.metric dd { font-size: clamp(1.02rem, 2.3vw, 1.45rem); font-weight: 650; margin: .15rem 0 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-stale { display: block; margin-top: .2rem; font-weight: 400; }

.login { width: min(100% - 2rem, 28rem); margin: clamp(1.75rem, 8vh, 5rem) auto; display: grid; gap: 1rem; }
.sign-in, .phone { padding: 1.25rem; border: 1px solid var(--border); border-radius: .8rem; background: var(--surface); }
.sign-in { display: grid; gap: .9rem; }
.sign-in button { width: 100%; }
.phone { display: flex; align-items: center; gap: 1rem; }
.phone img { max-width: 43%; height: auto; border-radius: .38rem; background: #fff; }
.phone h2 { font-size: 1.05rem; }
.phone p, #message { color: var(--muted); }
#message:empty { display: none; }
summary { cursor: pointer; padding: .3rem 0; }
form { display: grid; margin-top: .55rem; gap: .55rem; }
input { min-width: 0; padding: .55rem .7rem; color: inherit; background: #0f192a; border: 1px solid var(--border); border-radius: .4rem; }

@media (max-width: 680px) {
  .top { align-items: flex-start; flex-direction: column; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard, .weather-panels { grid-template-columns: minmax(0, 1fr); }
  .camera-viewport { max-height: none; }
}
