/* Layout: the page frame, the seven-day grid, and the loading/error panels.
   Responsive refinement lands in US3. */

.frame {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
}

/* The page body must never scroll sideways, whatever a card contains. */
html,
body {
  overflow-x: hidden;
}

/* Sprites scale with the viewport but never exceed their design size. */
.sprite {
  width: clamp(2.5rem, 9vw, 3rem);
  height: clamp(2.5rem, 9vw, 3rem);
}

/* --- Masthead ------------------------------------------------------------ */

.masthead {
  text-align: center;
  margin-bottom: 1.75rem;
}

.masthead__title {
  /* The pixel font is very wide; scale fluidly so the title never forces the
     page wider than 320px. */
  font-size: clamp(0.8rem, 4.5vw, 1.25rem);
  line-height: 1.6;
  margin-bottom: 0.85rem;
}

.masthead__location {
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.masthead__subtitle {
  font-size: 0.8rem;
  margin-top: 0.3rem;
}

/* --- Forecast grid ------------------------------------------------------- */

/* Narrow screens: one card per row, laid out horizontally so a day reads
   left-to-right like a list entry. */
.forecast {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

/* The grid item is the <li>; the button inside it is the card. A single-cell
   grid here makes the button fill the slot, so cards in a row stay equal
   height now that the card is a control rather than the list item itself. */
.day-slot {
  display: grid;
}

.day {
  display: grid;
  grid-template-columns: auto auto 1fr;
  grid-template-areas:
    'header art temps'
    'condition condition temps';
  align-items: center;
  gap: 0.25rem 0.75rem;
  padding: 0.75rem 1rem;
}

.day__header {
  grid-area: header;
  min-width: 5rem;
}

.day__art {
  grid-area: art;
  justify-self: start;
}

.day__condition {
  grid-area: condition;
  font-size: 0.75rem;
}

.day__temps {
  grid-area: temps;
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  justify-content: flex-end;
}

/* Wider screens: the week becomes a row of vertical cards. auto-fit means the
   column count follows the available width on its own — 2 up on a large phone,
   7 across on a desktop — without a breakpoint for every step. */
@media (min-width: 34rem) {
  .forecast {
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  }

  .day {
    grid-template-columns: 1fr;
    grid-template-areas:
      'header'
      'art'
      'condition'
      'temps';
    justify-items: center;
    text-align: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
  }

  .day__header {
    min-width: 0;
  }

  .day__art {
    justify-self: center;
  }

  .day__temps {
    justify-content: center;
  }
}

.day__temp {
  /* Reserve room for four characters so "-12°" never reflows the card. */
  min-width: 3.25ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.day__temp--max {
  font-size: 1.05rem;
}

.day__temp--min {
  font-size: 0.85rem;
}

.day__weekday {
  font-size: 0.8rem;
}

.day__date {
  font-size: 0.7rem;
  margin-top: 0.2rem;
}

/* --- Loading and error panels -------------------------------------------- */

.panel {
  text-align: center;
  padding: 3rem 1rem;
}

.panel__art {
  font-size: 1.5rem;
  letter-spacing: 0.3em;
  margin-bottom: 1rem;
}

.panel__message {
  font-size: 0.85rem;
  line-height: 1.7;
}

.panel__hint {
  font-size: 0.75rem;
  margin-top: 0.75rem;
}

/* --- Notices and colophon ------------------------------------------------ */

.notice {
  font-size: 0.7rem;
  line-height: 1.7;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  text-align: center;
}

.freshness {
  font-size: 0.7rem;
  text-align: center;
  margin-top: 1.25rem;
}

.colophon {
  font-size: 0.65rem;
  text-align: center;
  margin-top: 2rem;
  line-height: 1.8;
}

/* --- Utilities ----------------------------------------------------------- */

.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;
}

/* --- Selected-day detail -------------------------------------------------- */
/* Sits directly below the bar (FR-002); the freshness stamp stays after it. */

.detail {
  margin-top: 1.25rem;
  padding: 1rem;
}

.detail__heading {
  font-size: 0.75rem;
  line-height: 1.6;
  margin-bottom: 0.9rem;
  text-align: center;
}

/* Narrow screens: one label/value pair per row, label left, value right. The
   pair stays on one line so nine rows do not become eighteen at 320px. */
.detail__list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.15rem;
}

.detail__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0.25rem;
}

.detail__label {
  font-size: 0.7rem;
}

.detail__value {
  font-size: 0.8rem;
  text-align: right;
  /* Values line up column-wise as the visitor switches days. */
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.detail__empty {
  font-size: 0.75rem;
  line-height: 1.7;
  text-align: center;
  padding: 1.5rem 0.5rem;
}

@media (min-width: 34rem) {
  .detail {
    padding: 1.25rem 1.5rem;
  }

  .detail__heading {
    font-size: 0.85rem;
  }
}

/* Wider screens: exactly three columns of three, so nine rows stop being a
   long scroll. The count is pinned rather than auto-fit because the row
   separators in theme.css key off nth-child(3n+1) — a variable column count
   would put the rules in the wrong places. */
@media (min-width: 48rem) {
  .detail__list {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.15rem 1.5rem;
  }
}

/* At the narrowest widths the label and value can collide; let the pair wrap
   rather than force the page to scroll sideways (FR-016). */
@media (max-width: 22rem) {
  .detail {
    padding: 0.85rem 0.6rem;
  }

  .detail__row {
    flex-wrap: wrap;
    gap: 0 0.5rem;
  }

  .detail__value {
    white-space: normal;
  }
}
