:root {
  color-scheme: light;
  --ink: #17342d;
  --muted: #60766f;
  --paper: #f5f1e8;
  --card: #fffdf8;
  --line: #d9ded8;
  --pine: #245c4b;
  --sun: #e5a94f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 4.8rem 1.5rem 4rem;
  color: #f8f3e9;
  background:
    radial-gradient(circle at 78% 16%, rgba(229, 169, 79, .92) 0 5%, transparent 5.2%),
    linear-gradient(154deg, #173f35 0%, #2d6b57 58%, #70917a 100%);
}

.hero::after {
  content: "";
  position: absolute;
  right: -6rem;
  bottom: -7rem;
  width: 34rem;
  height: 18rem;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 50%;
  transform: rotate(-10deg);
  box-shadow: 0 0 0 3rem rgba(255, 255, 255, .035), 0 0 0 7rem rgba(255, 255, 255, .025);
}

.hero__inner, main, footer { width: min(1180px, calc(100% - 2rem)); margin-inline: auto; }
.hero__inner { position: relative; z-index: 1; }

.eyebrow {
  margin: 0 0 .55rem;
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(3.4rem, 10vw, 6.8rem); font-weight: 500; letter-spacing: -.06em; }
.lede { max-width: 32rem; margin: .7rem 0 1.7rem; color: #dce9e2; font-family: Georgia, serif; font-size: clamp(1.15rem, 2.5vw, 1.55rem); }
.freshness { display: flex; align-items: center; gap: .55rem; margin: 0; color: #e6eee9; font-size: .86rem; }
.freshness span { width: .55rem; height: .55rem; border-radius: 50%; background: var(--sun); box-shadow: 0 0 0 .25rem rgba(229, 169, 79, .18); }
.refresh-warning { display: inline-block; margin: .8rem 0 0; padding: .45rem .65rem; border-radius: .35rem; color: #402a16; background: #f4cf91; font-size: .78rem; }

main { padding: 2rem 0 4rem; }

.current-conditions {
  position: relative;
  z-index: 2;
  margin-top: -3.2rem;
  padding: clamp(1.15rem, 3vw, 1.7rem);
  border: 1px solid rgba(23, 52, 45, .1);
  border-radius: 1rem;
  background: rgba(255, 253, 248, .97);
  box-shadow: 0 1.25rem 3rem rgba(34, 66, 55, .13);
}
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.2rem; }
.section-heading > p { max-width: 22rem; margin: 0; color: var(--muted); text-align: right; font-size: .78rem; }
.station-grid { display: grid; gap: 1rem; }
.station-card { overflow: hidden; border: 1px solid var(--line); border-radius: .8rem; background: #fff; }
.station-card header { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .85rem 1rem; color: #fff; background: var(--pine); }
.station-card h3 { margin: 0; font-family: Georgia, serif; font-size: 1.25rem; font-weight: 500; }
.station-status { display: grid; text-align: right; }
.station-card header span { color: #dce9e2; font-size: .68rem; white-space: nowrap; }
.station-status strong { color: #ffe0a8; font-size: .68rem; }
.station-card--stale header { background: #6f5938; }
.reading-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.reading { min-width: 0; padding: .9rem 1rem; border-right: 1px solid #edf0ed; border-bottom: 1px solid #edf0ed; }
.reading dt { color: var(--muted); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.reading dd { margin: .25rem 0 0; font-family: Georgia, serif; font-size: clamp(1.25rem, 3vw, 1.8rem); white-space: nowrap; }
.station-card--home { grid-column: 1 / -1; }

.filters {
  display: grid;
  gap: 1.3rem;
  margin-top: 1.5rem;
  padding: 1.35rem;
  position: relative;
  z-index: 2;
  border: 1px solid rgba(23, 52, 45, .1);
  border-radius: 1rem;
  background: rgba(255, 253, 248, .96);
  box-shadow: 0 1.25rem 3rem rgba(34, 66, 55, .13);
}

.filters__dates { display: flex; gap: 1rem; flex-wrap: wrap; }
.filters__dates label { flex: 1 1 9rem; }
.filters__heading p { margin: 0; }
.filters__heading p:last-child { color: var(--muted); font-size: .74rem; }
.filters label, legend { font-size: .82rem; font-weight: 700; }
input[type="date"] { display: block; width: 100%; margin-top: .35rem; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: .55rem; color: var(--ink); background: white; font: inherit; }
.range-controls { display: grid; gap: .65rem; }
.range-controls label { display: grid; grid-template-columns: 8rem minmax(0, 1fr); align-items: center; gap: .7rem; color: var(--muted); font-size: .72rem; }
.range-controls label span { display: grid; }
.range-controls output { color: var(--ink); font-variant-numeric: tabular-nums; }
input[type="range"] { min-width: 0; width: 100%; margin: 0; padding: .35rem .55rem; accent-color: var(--pine); cursor: pointer; }
input[type="range"]:focus-visible { outline: 3px solid rgba(229, 169, 79, .55); outline-offset: 1px; border-radius: 999px; }
fieldset { margin: 0; padding: 0; border: 0; }
legend { margin-bottom: .55rem; }
.choice-grid { display: flex; flex-wrap: wrap; gap: .45rem; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: block; padding: .48rem .7rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #fff; font-size: .78rem; transition: .15s ease; }
.choice input:checked + span { border-color: var(--pine); color: #fff; background: var(--pine); }
.choice input:focus-visible + span { outline: 3px solid rgba(229, 169, 79, .5); outline-offset: 2px; }
button { justify-self: start; padding: .72rem 1.15rem; border: 0; border-radius: .55rem; color: #fff; background: var(--ink); font: inherit; font-size: .86rem; font-weight: 750; cursor: pointer; }
button:hover { background: var(--pine); }

.chart-grid { display: grid; gap: 1.25rem; margin-top: 1.5rem; }
.chart-card { padding: clamp(1rem, 3vw, 1.6rem); border: 1px solid var(--line); border-radius: 1rem; background: var(--card); box-shadow: 0 .4rem 1.2rem rgba(42, 61, 52, .045); }
.chart-card__header { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(1.65rem, 4vw, 2.25rem); font-weight: 500; letter-spacing: -.025em; }
.latest { display: grid; text-align: right; }
.latest span, .latest small { color: var(--muted); font-size: .72rem; }
.latest strong { margin: .12rem 0; font-size: 1.1rem; }
.summary { display: flex; gap: 1.4rem; margin: 1rem 0 .4rem; color: var(--muted); font-size: .75rem; }
.summary strong { color: var(--ink); }
.plot { overflow: hidden; }
.plot svg { display: block; width: 100%; height: auto; min-height: 160px; }
.axis { stroke: #aab8b2; stroke-width: 1; }
.gridline { stroke: #dfe5e1; stroke-width: 1; stroke-dasharray: 5 6; }
.plot__labels { display: flex; justify-content: space-between; padding-left: 3.2rem; color: var(--muted); font-size: .68rem; }
.legend { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: .75rem; color: var(--muted); font-size: .72rem; }
.legend span { display: flex; align-items: center; gap: .4rem; }
.legend i { width: .6rem; height: .6rem; border-radius: 50%; }

.empty-state { margin: 3rem auto; padding: 4rem 1.5rem; max-width: 650px; text-align: center; border: 1px solid var(--line); border-radius: 1rem; background: var(--card); }
.empty-state p { color: var(--muted); }
.empty-state--small { margin-top: 1.5rem; padding: 2.5rem 1rem; }
code { padding: .15rem .35rem; border-radius: .25rem; background: #e8ebe6; }

footer { padding: 1.5rem 0 2.5rem; color: var(--muted); border-top: 1px solid var(--line); font-size: .72rem; }
.logout { position: fixed; top: .8rem; right: .8rem; z-index: 5; }
.logout button { padding: .45rem .7rem; color: #fff; background: rgba(15, 43, 35, .7); font-size: .72rem; }

.login-page { min-height: 100vh; background: linear-gradient(145deg, #173f35, #70917a); }
.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 1rem; }
.login-card { width: min(100%, 28rem); padding: 2rem; border-radius: 1rem; background: var(--card); box-shadow: 0 1.5rem 4rem rgba(8, 32, 25, .3); }
.login-card h1 { font-size: clamp(3rem, 15vw, 5rem); }
.login-card > p:not(.eyebrow, .login-error) { color: var(--muted); }
.login-form { display: grid; gap: 1rem; margin-top: 1.5rem; }
.login-form label { font-size: .82rem; font-weight: 700; }
.login-form input { display: block; width: 100%; margin-top: .35rem; padding: .8rem; border: 1px solid var(--line); border-radius: .55rem; color: var(--ink); background: #fff; font: inherit; }
.login-form button { width: 100%; margin-top: .25rem; }
.login-error { padding: .6rem .7rem; border-radius: .4rem; color: #742a1f; background: #f9ddd7; font-size: .82rem; }

@media (min-width: 760px) {
  .station-grid { grid-template-columns: repeat(2, 1fr); }
  .station-card--home .reading-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters { grid-template-columns: auto 1fr auto; align-items: end; }
  .filters__heading { grid-column: 1; }
  .filters__dates { grid-column: 2; }
  .range-controls { grid-column: 1 / 4; }
  .filters fieldset:first-of-type { grid-column: 1 / 4; }
  .filters fieldset:last-of-type { grid-column: 1 / 4; }
  .filters button { grid-column: 3; grid-row: 1; align-self: center; }
}

@media (max-width: 560px) {
  .hero { padding-top: 3.5rem; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: .45rem; text-align: left; }
  .station-card--home .reading:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .filters button { width: 100%; }
  .chart-card__header { align-items: end; }
  .summary { justify-content: space-between; gap: .4rem; }
  .plot__labels { padding-left: 0; }
}
