:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #eef5ed;
  background: #101916;
  font-synthesis: none;
  --muted: #b9cabe;
  --border: #34483f;
  --accent: #cbef9d;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(ellipse at 82% 0%, #233e32 0%, transparent 48rem);
}

main {
  width: min(100% - 4rem, 80rem);
  margin-inline: auto;
  padding-block: clamp(2rem, 5vw, 4.25rem) 2rem;
}

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .9rem 1.5rem;
  margin-bottom: clamp(1.25rem, 3vw, 2rem);
}

h1, h2, p, dl, dd { margin: 0; }

h1 {
  font-size: clamp(2.5rem, 6.15vw, 5.5rem);
  font-weight: 730;
  line-height: .98;
  letter-spacing: -.075em;
}

h1 span { color: var(--accent); }

h2 { font-size: 1rem; }

.status, .camera-status {
  color: var(--muted);
  font-size: .875rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: .1rem;
  padding: .55rem .8rem;
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  background: #172720;
}

.status::before {
  width: .48rem;
  height: .48rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  content: '';
}

.status[data-live]::before { background: var(--accent); }
.status[data-warning], .camera-status[data-warning] { color: #ffcc9e; }
.status[data-warning] {
  border-color: #945e37;
  background: #38271e;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(20rem, .46fr);
  align-items: start;
  gap: 1rem;
}

.dashboard:has(.measurements[hidden]) {
  grid-template-columns: minmax(0, 54rem);
  justify-content: center;
}

.panel {
  background: #1a2923;
  border: 1px solid var(--border);
  border-radius: 1.15rem;
}

.camera { padding: .7rem; }

.camera-header {
  padding: .5rem .6rem 1rem;
}

.camera-button {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: .72rem;
  background: #24382f;
  color: #fff;
  cursor: zoom-in;
}

.camera-button img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
}

.camera-button:disabled { cursor: default; }
.camera-button:disabled > * { visibility: hidden; }

.expand {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  inset: auto .85rem .85rem auto;
  padding: .55rem .8rem;
  border: 1px solid #c4e89e80;
  border-radius: 2rem;
  background: #15251fee;
  color: #f4faed;
  font: 650 .875rem system-ui, sans-serif;
}

.expand::before {
  width: .72rem;
  height: .72rem;
  border: 2px solid var(--accent);
  border-radius: .12rem;
  content: '';
}

.camera-button:hover .expand { background: #324b39; }
.camera-status { margin: .75rem .4rem .1rem; }

.measurements { display: grid; gap: .75rem; }
.measurements[hidden] { display: none; }

.temperature, .readings { padding: 1.1rem 1.2rem; }

.temperature {
  background:
    repeating-radial-gradient(ellipse at 108% 114%, transparent 0 17px, #cbef9d18 18px 19px) right bottom / 63% 100% no-repeat,
    linear-gradient(145deg, #344e32, #263c2e);
  border-color: #526d49;
  --border: #6f8864;
}

.temperature h2, .readings h2 {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.temperature h2::before, .readings h2::before {
  width: .23rem;
  height: .95rem;
  border-radius: 1rem;
  background: var(--accent);
  content: '';
}

.wind { --accent: #a4dce9; }
.rain { --accent: #c8bef7; }

.temperature-reading {
  margin-block: .25rem .65rem;
  color: var(--accent);
  font-size: clamp(3.4rem, 6vw, 5.15rem);
  font-weight: 690;
  line-height: 1.08;
  letter-spacing: -.07em;
}

.readings dl { margin-top: .55rem; }

dl > div {
  display: flex;
  justify-content: space-between;
  gap: .7rem;
  padding-top: .55rem;
  border-top: 1px solid var(--border);
}

dl > div + div { margin-top: .55rem; }
dt { color: var(--muted); font-size: .9rem; }
dd { text-align: right; white-space: nowrap; font-weight: 650; }
dd, .temperature-reading, .status { font-variant-numeric: tabular-nums; }
dialog {
  max-width: calc(100% - 1.5rem);
  max-height: calc(100% - 1.5rem);
  padding: .65rem;
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: #14221c;
  color: white;
}

dialog::backdrop { background: #08110ef0; }
dialog form { display: flex; justify-content: end; margin-bottom: .5rem; }

dialog button {
  padding: .45rem .8rem;
  border: 1px solid #a1b6a9;
  border-radius: .35rem;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

dialog img {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 6rem);
  margin-inline: auto;
  border-radius: .35rem;
}

button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.camera-button:focus-visible { outline-offset: -4px; }

@media (max-width: 50rem) {
  main { width: min(100% - 1.5rem, 36rem); }
  .dashboard { grid-template-columns: minmax(0, 1fr); }
}
