/* WS-2000 personal weather station dashboard.
 *
 * Layout intent: dense at-a-glance current-conditions panel grouped by
 * sensor category (Temperature / Wind / Humidity / Pressure / Sun / Rain /
 * Lightning). Each tile binds to data-metric so the JS can patch values
 * in place without re-rendering the whole grid (avoids the visual flicker
 * a full innerHTML swap would cause every poll cycle).
 *
 * Hero tiles (the "primary" reading per group, e.g. outdoor temp under
 * Temperature) get a larger value font so the eye lands on them first. */

.wx-now-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.9rem;
  align-items: start;
}

.wx-now-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  padding: 0.7rem 0.8rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(61, 103, 132, 0.22);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.6), rgba(2, 6, 23, 0.7));
}
.wx-now-group h3 {
  grid-column: 1 / -1;
  margin: 0 0 0.2rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent, #38bdf8);
  border-bottom: 1px solid rgba(56, 189, 248, 0.18);
  padding-bottom: 0.3rem;
}

.wx-now-tile {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.4rem 0.55rem;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(61, 103, 132, 0.18);
  min-width: 0;
  /* Locked floor so labels / values that wrap to a second line don't
     break grid alignment with neighboring single-line tiles. Sized
     for two lines of value text + one line of label + padding. */
  min-height: 3.6rem;
}
.wx-now-tile .lbl {
  font-size: 0.65rem;
  line-height: 1.15;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
  /* Labels like "Lightning Potential" were getting clipped to
     "LIGHTNING POTE…". Allow wrap to 2 lines instead. */
  white-space: normal;
  overflow-wrap: break-word;
}
.wx-now-tile .val {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  /* Values like "Waning Crescent" + composed conditions
     ("Light Rain / Partly Cloudy") wrap to a second line instead of
     clipping with an ellipsis. tabular-nums kept for numeric tiles
     so column alignment of digits still works. */
  white-space: normal;
  overflow-wrap: break-word;
  font-variant-numeric: tabular-nums;
}
.wx-now-tile--hero {
  grid-column: 1 / -1;
  background: rgba(56, 189, 248, 0.06);
  border-color: rgba(56, 189, 248, 0.35);
}
.wx-now-tile--hero .val {
  font-size: 1.6rem;
  letter-spacing: 0.01em;
}
.wx-now-tile--stale .val {
  color: var(--muted);
}

/* Records grid — three columns of "metric : max @ ts / min @ ts" cards */
.wx-records-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 0.7rem;
}
.wx-record-card {
  padding: 0.6rem 0.8rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(61, 103, 132, 0.22);
  background: rgba(15, 23, 42, 0.6);
}
.wx-record-card h4 {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent, #38bdf8);
}
.wx-record-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.78rem;
  padding: 0.18rem 0;
}
.wx-record-row .rk {
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.68rem;
}
.wx-record-row .rv {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.wx-record-row .rt {
  font-size: 0.7rem;
  color: var(--muted);
  margin-left: 0.5rem;
  font-variant-numeric: tabular-nums;
}

/* ─── Climate panel (1.30.0) ─────────────────────────────────────────── */

.wx-climate-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0.9rem;
  align-items: start;
}
@media (max-width: 56rem) {
  .wx-climate-grid { grid-template-columns: 1fr; }
}

.wx-climate-card {
  padding: 0.8rem 1rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(61, 103, 132, 0.22);
  background: rgba(15, 23, 42, 0.6);
}
.wx-climate-card h3 {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent, #38bdf8);
}
.wx-climate-card h4 {
  margin: 0.9rem 0 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* On-this-day card */
.wx-otd-normals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(56, 189, 248, 0.12);
}
.wx-otd-normals span {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.wx-otd-normals strong {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.wx-otd-normals small {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wx-otd-records {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.4rem;
}
.wx-otd-rec {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(61, 103, 132, 0.2);
  font-size: 0.78rem;
}
.wx-otd-rec .rk { color: var(--muted); text-transform: uppercase; font-size: 0.65rem; letter-spacing: 0.04em; }
.wx-otd-rec .rv { font-weight: 700; font-variant-numeric: tabular-nums; }
.wx-otd-rec .rt { color: var(--accent, #38bdf8); font-size: 0.7rem; font-variant-numeric: tabular-nums; }

.wx-otd-history {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.2rem;
  font-variant-numeric: tabular-nums;
}
.wx-otd-yr {
  display: grid;
  grid-template-columns: 3.5rem repeat(3, 1fr);
  gap: 0.4rem;
  font-size: 0.78rem;
  padding: 0.18rem 0.4rem;
  border-radius: 3px;
}
.wx-otd-yr:nth-child(odd) { background: rgba(56, 189, 248, 0.04); }
.wx-otd-yr .yr { font-weight: 700; color: var(--accent, #38bdf8); }

/* Streaks card */
.wx-streaks-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}
.wx-streak-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.1rem 0.5rem;
  padding: 0.4rem 0.55rem;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(61, 103, 132, 0.2);
}
.wx-streak-lbl {
  font-size: 0.75rem;
  color: var(--text);
}
.wx-streak-vals {
  display: flex;
  gap: 0.7rem;
  font-variant-numeric: tabular-nums;
}
.wx-streak-vals span {
  font-size: 1rem;
  font-weight: 700;
}
.wx-streak-vals small {
  font-size: 0.6rem;
  color: var(--muted);
  margin-left: 0.2rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.wx-streak-cur { color: var(--accent, #38bdf8); }
.wx-streak-lng { color: var(--text); }
.wx-streak-window {
  grid-column: 1 / -1;
  font-size: 0.65rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Monthly normals table-grid */
.wx-monthly-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border: 1px solid rgba(61, 103, 132, 0.22);
  border-radius: 0.5rem;
  overflow: hidden;
}
.wx-month-row {
  display: grid;
  grid-template-columns: 4rem repeat(6, 1fr) 4rem;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid rgba(61, 103, 132, 0.12);
}
.wx-month-row:last-child { border-bottom: none; }
.wx-month-row:nth-child(odd):not(.wx-month-head) { background: rgba(56, 189, 248, 0.03); }
.wx-month-row .m { font-weight: 700; color: var(--accent, #38bdf8); }
.wx-month-row .yrs { color: var(--muted); text-align: right; }
.wx-month-head {
  background: rgba(2, 6, 23, 0.7);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}
@media (max-width: 56rem) {
  .wx-month-row {
    grid-template-columns: 3rem repeat(3, 1fr);
    grid-auto-rows: auto;
  }
  .wx-month-row > span:nth-child(n+5) { display: none; }
}
