/* weather.css — the Weather tab (WeatherDetail).
   Reference layout (current summary left; hourly, daily+tiles, precip trend
   right) in the app's frosted-glass-over-sky styling. Uses dashboard.css tokens. */

.weather-screen {
  position: absolute; inset: 0;
  display: grid; grid-template-rows: auto auto 1fr auto;
  gap: clamp(6px, 1vh, 12px);
  padding: clamp(10px, 1.6vw, 18px) clamp(14px, 2vw, 22px) clamp(10px, 1.2vw, 14px);
  font-family: var(--sans); color: var(--text-primary);
}

/* In light (daytime) scenes the default glass is very translucent, so a bright,
   busy sky bleeds through the cards and the dark on-card text loses contrast.
   Boost the glass opacity for the Weather screen's cards in light scenes only
   (scoped var override cascades to .glass, .wx-tile, .wx-loc, and the nav). */
html[data-scene="light"] .weather-screen { --glass-bg: rgba(253, 247, 236, 0.78); }

/* ---- location switcher (primary + up to 3 saved; selected shows in full) ---- */
.wx-switch { flex: none; display: flex; align-items: stretch; gap: clamp(8px, 1vw, 14px); overflow-x: auto; padding-bottom: 4px; }
.wx-switch::-webkit-scrollbar { height: 6px; }
.wx-switch::-webkit-scrollbar-thumb { background: var(--track); border-radius: 999px; }
.wx-loc {
  flex: 0 0 auto; position: relative; display: flex; align-items: center; gap: clamp(8px, 1vw, 12px);
  min-width: clamp(150px, 15vw, 200px); text-align: left; cursor: pointer;
  padding: clamp(8px, 1vh, 12px) clamp(12px, 1.4vw, 16px); border-radius: 16px;
  font-family: var(--sans); color: var(--text-primary);
  background: var(--glass-specular), var(--glass-sheen), var(--glass-bg);
  border: 1px solid var(--glass-border);
}
.wx-loc.is-active { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.wx-loc-ic { flex: none; }
.wx-loc-ic .wx { width: clamp(30px, 3.4vw, 42px); height: auto; display: block; }
.wx-loc-info { min-width: 0; display: flex; flex-direction: column; }
.wx-loc-name { font-weight: 700; font-size: clamp(12px, 1.3vw, 15px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx-loc-star { color: var(--text-accent); margin-right: 4px; font-size: 0.85em; }
.wx-loc-cond { font-size: clamp(10px, 1.1vw, 12px); color: var(--text-secondary); white-space: nowrap; }
.wx-loc-temp { margin-left: auto; font-family: var(--serif); font-weight: 600; font-size: clamp(20px, 2.4vw, 30px); line-height: 1; }
.wx-loc-remove {
  position: absolute; top: 4px; right: 6px; width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1;
  color: var(--text-secondary); opacity: 0; transition: opacity 0.12s ease;
}
.wx-loc:hover .wx-loc-remove { opacity: 1; }
.wx-loc-remove:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.12); }

.wx-loc-add {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 0 clamp(14px, 1.6vw, 20px); border-radius: 16px;
  border: 1px dashed var(--glass-border); background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary); font-family: var(--sans); font-weight: 700; font-size: clamp(11px, 1.2vw, 14px);
}
.wx-loc-add:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.08); }
.wx-loc-add-plus { font-size: 1.4em; line-height: 1; }

.wx-loc-addform {
  flex: 0 0 auto; position: relative; display: flex; align-items: center; gap: 8px;
  padding: clamp(8px, 1vh, 12px) clamp(12px, 1.4vw, 16px); border-radius: 16px;
  border: 1px solid var(--glass-border); background: var(--glass-bg);
}
.wx-loc-input {
  width: clamp(120px, 13vw, 170px); padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--glass-border); background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary); font-family: var(--sans); font-size: clamp(12px, 1.3vw, 15px);
}
.wx-loc-input:focus { outline: none; border-color: var(--teal); }
.wx-loc-addbtn { padding: 8px 14px; border-radius: 999px; border: none; cursor: pointer; background: var(--teal); color: #fff; font-family: var(--sans); font-weight: 700; font-size: clamp(11px, 1.2vw, 14px); }
.wx-loc-addbtn[disabled] { opacity: 0.6; cursor: default; }
.wx-loc-addcancel { background: none; border: none; cursor: pointer; color: var(--text-secondary); font-size: 18px; line-height: 1; padding: 2px 4px; }
.wx-loc-addcancel:hover { color: var(--text-primary); }
.wx-loc-err {
  position: absolute; top: calc(100% + 4px); left: 0; white-space: nowrap;
  font-size: clamp(10px, 1.1vw, 12px); font-weight: 600; color: #ffb4a2;
}

.wx-main {
  min-height: 0; overflow-y: auto;
  display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  gap: clamp(14px, 2vw, 28px);
  padding-right: 4px;
}
.wx-main::-webkit-scrollbar { width: 6px; }
.wx-main::-webkit-scrollbar-thumb { background: var(--track); border-radius: 999px; }

/* ---- left: current conditions (card-less, directly over the sky) ----
   Uses fixed light text + a strong shadow so it stays legible over bright
   daytime skies (the scene-adaptive tokens go dark in light scenes and wash
   out). Bolder/larger than the on-card text for the same reason. */
.wx-left {
  display: flex; flex-direction: column; align-items: flex-start;
  padding-top: clamp(4px, 1vh, 12px);
  --sky-shadow: 0 1px 3px rgba(0, 0, 0, 0.55), 0 2px 14px rgba(0, 0, 0, 0.4);
}
.wx-cur-icon .wx { width: clamp(84px, 9vw, 128px); height: auto; display: block; filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.3)); }
.wx-cur-temp { font-family: var(--serif); font-weight: 600; font-size: clamp(58px, 8vw, 108px); line-height: 0.95; letter-spacing: -0.02em; color: #fff; text-shadow: var(--sky-shadow); }
.wx-cur-temp .wx-deg { font-weight: 400; }
.wx-cur-cond { font-family: var(--serif); font-weight: 600; font-size: clamp(19px, 2.3vw, 30px); color: #fff; margin-top: 2px; text-shadow: var(--sky-shadow); }
.wx-cur-hilo { display: flex; gap: 8px; margin-top: clamp(10px, 1.6vh, 18px); font-weight: 800; font-size: clamp(13px, 1.5vw, 17px); color: #fff; text-shadow: var(--sky-shadow); }
.wx-cur-hilo .wx-sep { color: rgba(255, 255, 255, 0.7); }
.wx-cur-loc {
  margin-top: clamp(10px, 1.6vh, 18px); padding-top: clamp(10px, 1.6vh, 18px);
  border-top: 1px solid rgba(255, 255, 255, 0.35); width: 100%;
  font-weight: 800; font-size: clamp(14px, 1.5vw, 18px); color: #fff; text-shadow: var(--sky-shadow);
}
.wx-cur-feels { margin-top: 8px; font-weight: 700; font-size: clamp(12px, 1.3vw, 15px); color: rgba(255, 255, 255, 0.9); text-shadow: var(--sky-shadow); }

/* ---- right column ---- */
.wx-right { min-width: 0; display: flex; flex-direction: column; gap: clamp(12px, 1.6vh, 20px); }
.wx-card { border-radius: var(--radius); padding: clamp(14px, 1.6vw, 22px) clamp(16px, 1.8vw, 24px); }
.wx-card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: clamp(10px, 1.4vh, 16px); }
.wx-card-title { font-family: var(--serif); font-weight: 600; font-size: clamp(16px, 1.9vw, 22px); color: var(--text-primary); }

.wx-empty { font-family: var(--serif); font-style: italic; color: var(--text-secondary); font-size: clamp(12px, 1.3vw, 15px); padding: 8px 2px; }

/* hourly strip */
.wx-hourly-strip { display: flex; gap: clamp(6px, 1vw, 14px); overflow-x: auto; padding-bottom: 4px; }
.wx-hourly-strip::-webkit-scrollbar { height: 6px; }
.wx-hourly-strip::-webkit-scrollbar-thumb { background: var(--track); border-radius: 999px; }
.wx-hour {
  flex: 0 0 auto; min-width: clamp(56px, 6.4vw, 82px);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: clamp(6px, 0.9vh, 10px) 4px; border-radius: 14px;
}
.wx-hour:first-child { background: rgba(255, 255, 255, 0.07); }
.wx-hour-lbl { font-weight: 700; font-size: clamp(10px, 1.1vw, 12px); color: var(--text-secondary); }
.wx-hour-ic .wx { width: clamp(26px, 3vw, 38px); height: auto; display: block; }
.wx-hour-temp { font-family: var(--serif); font-weight: 600; font-size: clamp(15px, 1.7vw, 20px); }
.wx-hour-pop { display: flex; align-items: center; gap: 3px; font-weight: 700; font-size: clamp(9px, 1vw, 11px); color: #5b9bd5; }
.wx-hour-pop .wx-glyph { width: 10px; height: 10px; }

/* mid row: daily forecast + stat tiles */
.wx-mid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(12px, 1.6vh, 20px); align-items: stretch; }
.wx-daily-row { display: flex; justify-content: space-between; gap: clamp(4px, 0.8vw, 10px); }
.wx-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.wx-day-name { font-weight: 700; font-size: clamp(9px, 1vw, 11px); letter-spacing: 0.06em; color: var(--text-secondary); }
.wx-day-ic .wx { width: clamp(26px, 3vw, 40px); height: auto; display: block; }
.wx-day-hi { font-family: var(--serif); font-weight: 600; font-size: clamp(14px, 1.6vw, 19px); }
.wx-day-lo { font-weight: 600; font-size: clamp(11px, 1.2vw, 13px); color: var(--text-secondary); }

.wx-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(8px, 1.1vw, 14px); }
.wx-tile {
  display: flex; align-items: flex-start; gap: 10px;
  padding: clamp(10px, 1.3vw, 16px); border-radius: 18px;
  background: var(--glass-specular), var(--glass-sheen), var(--glass-bg);
  border: 1px solid var(--glass-border);
}
.wx-tile-ic {
  flex: none; width: clamp(30px, 3.4vw, 40px); height: clamp(30px, 3.4vw, 40px);
  display: flex; align-items: center; justify-content: center; border-radius: 12px;
  background: rgba(91, 155, 213, 0.16); color: #5b9bd5;
}
.wx-tile-ic .wx-glyph { width: 60%; height: 60%; }
.wx-tile-body { min-width: 0; }
.wx-tile-label { font-weight: 700; font-size: clamp(9px, 1vw, 12px); letter-spacing: 0.04em; color: var(--text-secondary); }
.wx-tile-value { font-family: var(--serif); font-weight: 600; font-size: clamp(18px, 2.2vw, 26px); line-height: 1.1; margin-top: 2px; }
.wx-tile-value .wx-unit { font-size: 0.6em; font-weight: 600; color: var(--text-secondary); }
.wx-tile-sub { font-size: clamp(9px, 1vw, 12px); color: var(--text-secondary); margin-top: 1px; }

/* shared glyph outline */
.wx-glyph { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }

/* precipitation trend */
.wx-precip-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 200px); gap: clamp(14px, 2vw, 26px); align-items: stretch; }
.wx-chart { display: flex; align-items: flex-end; gap: clamp(6px, 1.2vw, 16px); min-height: clamp(110px, 16vh, 170px); }
.wx-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.wx-bar-val { font-weight: 700; font-size: clamp(9px, 1vw, 12px); color: var(--text-secondary); }
.wx-bar-track { width: clamp(14px, 1.8vw, 26px); flex: 1; display: flex; align-items: flex-end; }
.wx-bar { width: 100%; min-height: 3px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, #6fade0, #4a86c5); }
.wx-bar-lbl { font-weight: 700; font-size: clamp(9px, 1vw, 11px); color: var(--text-secondary); white-space: nowrap; }
.wx-trend-note { align-self: center; border-left: 1px solid var(--glass-border); padding-left: clamp(12px, 1.6vw, 20px); }
.wx-trend-note-h { font-family: var(--serif); font-weight: 600; font-size: clamp(14px, 1.6vw, 19px); margin-bottom: 6px; }
.wx-trend-note-b { font-size: clamp(11px, 1.2vw, 14px); color: var(--text-secondary); line-height: 1.5; }

@media (max-width: 900px) {
  .wx-mid { grid-template-columns: 1fr; }
  .wx-precip-body { grid-template-columns: 1fr; }
  .wx-trend-note { border-left: none; border-top: 1px solid var(--glass-border); padding-left: 0; padding-top: 12px; }
}
