/* Porchlight Weather. Colours and type come from tokens.css (the house theme). */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font-family: var(--font-sans); font-size: var(--text-body); line-height: var(--leading-body); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; }
a { color: var(--accent); }
button, input { font: inherit; color: inherit; }
button { min-height: var(--hit-touch); min-width: var(--hit-touch); padding: 0 var(--space-md); border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); cursor: pointer; transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
button:hover { border-color: var(--accent); }
.linklike { display: inline-flex; align-items: center; min-height: var(--hit-touch); min-width: var(--hit-touch); padding: 0 var(--space-2xs); border: 0; background: none; color: var(--accent); text-decoration: underline; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--space-md); top: -100px; background: var(--surface); color: var(--ink); padding: var(--space-sm) var(--space-md); border-radius: var(--radius-md); z-index: 10; }
.skip:focus { top: var(--space-md); }

.top { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--border); background: var(--surface); }
.wordmark { font-size: var(--text-title2); text-decoration: none; color: var(--ink); letter-spacing: 0.02em; margin-right: var(--space-sm); }
.search { display: flex; flex: 1 1 260px; gap: var(--space-xs); align-items: center; min-width: 0; }
.search label { font-size: var(--text-footnote); color: var(--ink-muted); white-space: nowrap; }
.search input { flex: 1 1 120px; min-width: 0; min-height: var(--hit-touch); padding: 0 var(--space-sm); border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg); }
.search input::placeholder { color: var(--ink-muted); }
.theme { margin-left: auto; }
@media (max-width: 519.98px) {
  .search { order: 3; flex-basis: 100%; }
}

.stage { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 1120px; margin: 0 auto; padding: var(--space-md); gap: var(--space-md); }
.band { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-xs) var(--space-md); border-bottom: 2px solid var(--ink); padding-bottom: var(--space-xs); }
.place { margin: 0; font-size: var(--text-title1); font-weight: var(--weight-title1); }
.clock { margin: 0; font-variant-numeric: tabular-nums; color: var(--ink-muted); font-size: var(--text-callout); }
.updated { margin-left: var(--space-sm); font-size: var(--text-footnote); }
.status { min-height: 1.6em; color: var(--ink-muted); }
.status.error { color: var(--danger); }

/* Phones: the panels share one grid cell, so the box is as tall as the tallest panel and nothing clips. Desktop: a centred 4:3 stage. */
.panels { position: relative; display: grid; }
.panel { grid-area: 1 / 1; margin: 0; padding: var(--space-lg); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); opacity: 0; visibility: hidden; transition: opacity var(--dur-enter) var(--ease), visibility 0s linear var(--dur-enter); }
.panel.active { opacity: 1; visibility: visible; transition: opacity var(--dur-enter) var(--ease), visibility 0s; }
.panel h2 { margin: 0 0 var(--space-sm); font-size: var(--text-headline); font-weight: var(--weight-headline); text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-muted); }
.big { margin: 0; line-height: 1; font-variant-numeric: tabular-nums; }
.temp { font-size: clamp(72px, 20vw, 176px); font-weight: 300; letter-spacing: -0.03em; }
.unit { font-size: clamp(28px, 6vw, 56px); vertical-align: top; color: var(--ink-muted); }
.sky { margin: var(--space-xs) 0 0; font-size: var(--text-title2); }
.porch { margin: var(--space-md) 0 0; font-size: var(--text-title3); color: var(--ink); max-width: 36ch; border-left: 3px solid var(--accent); padding-left: var(--space-sm); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--space-sm) var(--space-md); margin: var(--space-lg) 0 0; }
.facts div { border-top: 1px solid var(--border); padding-top: var(--space-xs); }
.facts dt { font-size: var(--text-footnote); color: var(--ink-muted); }
.facts dd { margin: 0; font-size: var(--text-headline); font-variant-numeric: tabular-nums; }

.next, .week, .alerts { list-style: none; margin: 0; padding: 0; }
.next li { display: grid; grid-template-columns: minmax(9ch, 1fr) auto; gap: var(--space-xs) var(--space-md); padding: var(--space-sm) 0; border-bottom: 1px solid var(--border); }
.next .when { font-weight: var(--weight-headline); }
.next .detail { grid-column: 1 / -1; color: var(--ink-muted); font-size: var(--text-subheadline); max-width: 68ch; }
.next .t { font-variant-numeric: tabular-nums; font-size: var(--text-title3); }
.week { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: var(--space-sm); }
.week li { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-sm); display: flex; flex-direction: column; gap: var(--space-2xs); min-height: 120px; }
.week .day { font-weight: var(--weight-headline); }
.week .hi { font-size: var(--text-title1); font-variant-numeric: tabular-nums; line-height: 1; }
.week .lo { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.week .sky2 { font-size: var(--text-footnote); color: var(--ink-muted); }
.week .pop { font-size: var(--text-footnote); color: var(--accent); font-variant-numeric: tabular-nums; }
.alerts li { border-left: 4px solid var(--warning); padding: var(--space-xs) var(--space-sm); margin-bottom: var(--space-sm); background: var(--bg); border-radius: var(--radius-sm); }
.alerts .ev { font-weight: var(--weight-headline); }
.alerts p { margin: var(--space-2xs) 0 0; font-size: var(--text-subheadline); white-space: pre-line; max-width: 68ch; }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); }
.dots { display: flex; gap: var(--space-2xs); list-style: none; margin: 0 0 0 var(--space-xs); padding: 0; }
.dots button { min-width: var(--hit-touch); padding: 0; font-size: var(--text-footnote); }
.progress { flex-basis: 100%; height: 3px; background: var(--border); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.25s linear; }

.ticker { border-top: 2px solid var(--ink); border-bottom: 1px solid var(--border); padding: var(--space-xs) 0; overflow: hidden; }
.ticker-text { margin: 0; white-space: nowrap; font-variant-numeric: tabular-nums; display: inline-block; padding-left: 100%; animation: ticker 60s linear infinite; }
.ticker:hover .ticker-text, .ticker:focus-within .ticker-text { animation-play-state: paused; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-100%); } }

.foot { padding: var(--space-md); border-top: 1px solid var(--border); color: var(--ink-muted); font-size: var(--text-footnote); }
.foot p { margin: 0 0 var(--space-xs); max-width: 72ch; }

@media (min-width: 900px) {
  .stage { padding: var(--space-lg); }
  .panels { display: block; flex: 0 0 auto; align-self: center; width: min(100%, calc(70vh * 4 / 3)); aspect-ratio: 4 / 3; max-height: 70vh; min-height: 420px; }
  .panel { position: absolute; inset: 0; overflow: auto; }
}

/* Reduced motion: no rotation, no scroll, panels stacked and all visible. */
@media (prefers-reduced-motion: reduce) {
  .panel, .panel.active { transition: none; }
  .progress-bar { transition: none; }
  .ticker-text { animation: none; white-space: normal; padding-left: 0; display: block; }
  .panels { display: grid; gap: var(--space-md); aspect-ratio: auto; max-height: none; width: auto; align-self: stretch; }
  .panel { grid-area: auto; position: static; opacity: 1; visibility: visible; }
}
.panels.stacked { display: grid; gap: var(--space-md); aspect-ratio: auto; max-height: none; width: auto; align-self: stretch; }
.panels.stacked .panel { grid-area: auto; position: static; opacity: 1; visibility: visible; }
