/* Forecast page. Laid out for a ~390px phone first; wider screens just get more room.
   Palette, reset, page frame, buttons and the search sheet live in base.css, which every
   page loads first; this file is only what is specific to the forecast. */
.status-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
}

#edit-toggle[aria-pressed="true"] {
  color: var(--bg-deep);
  background: var(--accent);
  font-weight: 600;
}

/* Location cards */
.location {
  background: var(--card);
  border-radius: 0.9rem;
  padding: 0.85rem 0.9rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.location-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.location-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-meta {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Reorder and remove live here, and only edit mode reveals them. display:none also takes
   them out of the tab order, so they are genuinely absent until asked for. */
.location-tools {
  display: none;
  align-items: center;
  gap: 0.1rem;
  /* The head aligns on the baseline; these buttons are taller than the text they sit
     beside, so centre them instead of hanging them off a baseline. */
  align-self: center;
}

body.editing .location-tools {
  display: flex;
}

/* Unmistakably a different mode, without shifting any layout. */
body.editing .location {
  outline: 1px dashed var(--line);
  outline-offset: 2px;
}

.btn-remove,
.btn-move {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.35rem 0.4rem;
  cursor: pointer;
  /* Comfortable thumb target even though the glyphs are tiny. */
  min-width: 36px;
  min-height: 36px;
}

.btn-move {
  font-size: 0.8rem;
}

.btn-move:hover:not(:disabled) {
  color: var(--accent);
}

.btn-move:disabled {
  opacity: 0.3;
  cursor: default;
}

.btn-remove:hover {
  color: var(--danger);
}

/* One row per day, readable without tapping anything */
.day {
  border-top: 1px solid var(--line);
}

.day:first-of-type {
  border-top: none;
}

.day-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "label chev"
    "temps chev"
    "precip chev";
  align-items: center;
  gap: 0.15rem 0.5rem;
  width: 100%;
  background: none;
  border: none;
  color: inherit;
  text-align: left;
  padding: 0.7rem 0.1rem;
  cursor: pointer;
  /* Comfortable thumb target. */
  min-height: 44px;
}

.day-label {
  grid-area: label;
  font-size: 0.9rem;
  font-weight: 600;
}

.day-temps {
  grid-area: temps;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Low-to-high bar, positioned within a scale shared by every area on the page so two
   locations can be compared at a glance. */
.temp-track {
  position: relative;
  flex: 1;
  height: 6px;
  min-width: 60px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.temp-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: linear-gradient(to right, var(--cool), var(--warm));
}

.temp-value {
  color: var(--text);
}

.day-precip {
  grid-area: precip;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.chip {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Chips read by their label colour. "Dry" is recessed instead of tinted: a light
   tint under --muted lands at 3.95:1 on this palette, a darker pill at 5.79:1. */
.chip-dry {
  background: rgba(15, 23, 13, 0.45);
  color: var(--muted);
}

.chip-rain {
  background: rgba(127, 179, 201, 0.15);
  color: var(--rain);
}

.chip-snow {
  background: rgba(205, 216, 220, 0.15);
  color: var(--snow);
}

.day-chevron {
  grid-area: chev;
  color: var(--accent);
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.day.open .day-chevron {
  transform: rotate(180deg);
}

.day-detail {
  display: none;
  padding: 0.25rem 0 0.9rem;
}

.day.open .day-detail {
  display: block;
}

.chart {
  width: 100%;
  /* uPlot sets an explicit pixel width; never let a rounding error push the page sideways. */
  overflow: hidden;
}

.chart + .chart {
  margin-top: 0.4rem;
}

.chart-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

/* Cloud cover as a slim band rather than a third chart. */
.cloud-band {
  height: 22px;
  border-radius: 4px;
  margin-top: 0.15rem;
}

.detail-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.5rem;
}


/* Add-area sheet */
.fab {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  padding: 0.8rem 1.2rem;
}

/* Confirm dialog. Centred rather than bottom-sheeted so it reads as a question that
   interrupts, not another panel to skim past. */
.sheet-backdrop.centered {
  align-items: center;
}

.confirm-sheet {
  border-radius: 1rem;
  max-width: 380px;
  margin: 0 1rem;
}

.confirm-sheet h2 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.confirm-sheet p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.confirm-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* uPlot overrides so charts read as part of the dark page */
.u-legend {
  font-size: 0.72rem;
  color: var(--muted);
}

.u-legend .u-marker {
  border-radius: 2px;
}

@media (min-width: 640px) {
  .location {
    padding: 1.1rem 1.25rem;
  }

  .day-summary {
    grid-template-columns: 8.5rem 1fr auto;
    grid-template-areas: "label temps chev" "label precip chev";
    column-gap: 1rem;
  }
}
