:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  background: #f4f4f0;
  color: #171717;
  --surface: #ffffff;
  --muted: #454545;
  --border: #777777;
  --accent: #171717;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  background: #f4f4f0;
}

button {
  font: inherit;
}

.dashboard {
  width: min(100% - 2rem, 76rem);
  margin: 0 auto;
  padding-block: 0.5rem;
}

.page-header,
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.page-header {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.eyebrow,
.location,
.date-label,
.page-footer {
  color: var(--muted);
}

.date-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.eyebrow {
  margin: 0;
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: 0.1em;
}

.date-label {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 650;
}

.location {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
}

.summary-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(10rem, 0.65fr) minmax(18rem, 1fr);
  align-items: stretch;
  gap: 0.75rem;
}

.refresh-button {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid var(--accent);
  border-radius: 0.35rem;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
}

.refresh-button img {
  width: 1.25rem;
  height: 1.25rem;
}

.refresh-button:hover,
.refresh-button:focus-visible {
  background: var(--accent);
  color: var(--surface);
}

.refresh-button:hover img,
.refresh-button:focus-visible img {
  filter: invert(1);
}

.refresh-button:focus-visible {
  outline: 3px solid var(--border);
  outline-offset: 3px;
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.summary-bar {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: var(--surface);
}

.bin-panel {
  display: flex;
  min-width: 0;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: var(--surface);
}

.astro-panel {
  min-width: 0;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0.4rem;
  background: var(--surface);
}

.astro-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3rem;
}

.astro-details {
  min-width: 0;
}

.astro-heading {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.astro-status {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.astro-panel[data-state="unavailable"] .astro-status {
  color: var(--muted);
}

.astro-duration,
.astro-sky {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.astro-date {
  flex: 0 0 auto;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: right;
  white-space: pre-line;
}

.astro-sky {
  font-weight: 700;
}

.section-heading {
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 1.55rem);
}

.summary-metric dt {
  color: var(--muted);
  font-size: 0.75rem;
}

.summary-metric dd {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.summary-metric {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1 0 auto;
  min-width: 5rem;
  margin: 0;
  padding: 0 0.8rem;
  border-left: 1px solid #b3b3b3;
}

.summary-metric:first-child {
  padding-left: 0;
  border-left: 0;
}

.summary-max-uv dd {
  font-size: 1.3rem;
  font-weight: 800;
}

.summary-sunset {
  border-left: 3px solid var(--accent);
}

.summary-sunset > dd:not(.sunset-countdown) {
  font-size: 1.4rem;
  font-weight: 800;
}

.sunset-countdown {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.next-bin {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 0.4rem;
  align-content: center;
  flex: 1 1 auto;
  min-width: 8rem;
  line-height: 1.15;
}

.next-bin-label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
}

.next-bin-icon {
  width: 1.5rem;
  height: 1.5rem;
  grid-row: 2 / span 2;
  object-fit: contain;
}

.next-bin-colour {
  font-weight: 750;
}

.next-bin-date {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.hourly-section {
  min-width: 0;
}

.daily-section {
  margin-top: 2rem;
}

.section-header {
  margin-bottom: 1rem;
}

.status-message {
  margin: 0;
  color: var(--muted);
}

.status-message[data-state="error"] {
  padding: 0.8rem 1rem;
  border: 2px solid #7d1b1b;
  border-radius: 0.35rem;
  background: #fff;
  color: #681515;
  font-weight: 650;
}

.hourly-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, 10rem);
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.daily-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.daily-card {
  min-width: 0;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: var(--surface);
}

.daily-date {
  font-size: 1.05rem;
  font-weight: 750;
}

.daily-condition {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.5rem;
  margin-top: 0.4rem;
  font-weight: 600;
}

.daily-weather-icon {
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  object-fit: contain;
}

.daily-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.6rem;
  margin: 0.55rem 0 0;
  padding-top: 0.55rem;
  border-top: 1px solid #b3b3b3;
}

.daily-stat dt {
  color: var(--muted);
  font-size: 0.74rem;
}

.daily-stat dd {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.daily-wind-icon {
  display: block;
  width: 1rem;
  height: 1rem;
}

.hour-card {
  min-width: 0;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: var(--surface);
}

.hour-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid #b3b3b3;
}

.hour-time {
  font-size: 1.05rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.daylight-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

.hour-temperature {
  margin: 0.7rem 0 0.35rem;
  font-size: 2rem;
  font-weight: 750;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hour-condition {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.7em;
  margin: 0;
  font-weight: 600;
}

.condition-icon {
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  object-fit: contain;
}

.hour-details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.2rem;
  margin: 0.65rem 0 0;
  padding-top: 0.55rem;
  border-top: 1px solid #b3b3b3;
  color: var(--muted);
  font-size: 0.82rem;
}

.hour-details > span {
  white-space: nowrap;
}

.wind-detail {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.wind-gusts {
  margin-left: 1.3rem;
}

.hour-metrics {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  margin-top: 0.15rem;
  padding-top: 0.25rem;
  border-top: 1px solid #d0d0d0;
  font-size: 0.78rem;
}

.hour-metrics span {
  white-space: nowrap;
}

.wind-icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

@media (max-width: 36rem) {
  .dashboard {
    width: min(100% - 1.25rem, 76rem);
  }

  .summary-bar {
    padding: 0.75rem;
  }

  .summary-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-footer {
    margin-top: 1.25rem;
  }
}

@media (min-width: 36.01rem) and (max-width: 52rem) {
  .summary-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-bar {
    grid-column: 1 / -1;
  }
}

@media (prefers-contrast: more) {
  :root {
    --muted: #222222;
    --border: #333333;
  }

  .sun-time,
  .hour-card-header,
  .hour-details {
    border-color: #555555;
  }
}

@media (monochrome) {
  .hour-card,
  .refresh-button {
    border-width: 2px;
  }
}
