/* ===== Live weather panel ===== */
.tp-wx-lead { margin-top: 10px; max-width: 560px; color: var(--muted); }

.tp-wx {
  --wx-text: #f8fafc;
  --wx-muted: rgba(248, 250, 252, 0.7);
  --wx-faint: rgba(248, 250, 252, 0.48);
  --wx-glass: rgba(255, 255, 255, 0.08);
  --wx-edge: rgba(255, 255, 255, 0.14);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 28px;
  padding: 22px;
  color: var(--wx-text);
  background: #0d1117;
  box-shadow: var(--shadow);
}
.tp-wx > * { min-width: 0; }

/* photo background, softly darkened so text always reads */
.tp-wx-bg, .tp-wx-bg img { position: absolute; inset: 0; }
.tp-wx-bg { z-index: -1; }
.tp-wx-bg img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.05);
  transition: opacity 0.9s ease, transform 5s ease;
  filter: saturate(0.8) brightness(0.8);
}
.tp-wx-bg img.is-on { opacity: 1; transform: scale(1); }
.tp-wx-bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(100deg, rgba(10, 13, 18, 0.92) 0%, rgba(10, 13, 18, 0.7) 50%, rgba(10, 13, 18, 0.55) 100%),
    linear-gradient(180deg, rgba(10, 13, 18, 0) 55%, rgba(10, 13, 18, 0.75) 100%);
}

/* city tabs */
.tp-wx-tabs {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: -2px -22px 0; padding: 2px 22px 4px;
}
.tp-wx-tabs::-webkit-scrollbar { display: none; }
.tp-wx-tab {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 16px; border-radius: 999px;
  background: var(--wx-glass); border: 1px solid var(--wx-edge); color: var(--wx-text);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-size: 14px; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.tp-wx-tab b { font-weight: 500; color: var(--wx-muted); }
.tp-wx-tab:hover { border-color: rgba(255, 255, 255, 0.32); }
.tp-wx-tab:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.tp-wx-tab[aria-selected="true"] { background: #fff; color: #0d1117; border-color: #fff; }
.tp-wx-tab[aria-selected="true"] b { color: #0d1117; }

/* body: now (left) + forecast (right) */
.tp-wx-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 22px; margin-top: 22px; align-items: stretch; }

.tp-wx-now { display: flex; flex-direction: column; padding: 6px 4px; }
.tp-wx-place { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 14px; color: var(--wx-muted); }
.tp-wx-place strong { font-size: 22px; font-weight: 600; color: var(--wx-text); letter-spacing: -0.02em; }
.tp-wx-hero { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.tp-wx-hero-ic { width: 92px; height: 92px; flex: 0 0 auto; filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.35)); }
.tp-wx-hero-ic svg, .tp-wx-row-ic svg { width: 100%; height: 100%; display: block; }
.tp-wx-temp { display: flex; font-size: clamp(76px, 8vw, 108px); font-weight: 300; line-height: 1; letter-spacing: -0.05em; }
.tp-wx-temp sup { font-size: 0.45em; line-height: 1.2; margin-left: 2px; }
.tp-wx-cond { margin-top: 10px; font-size: 30px; font-weight: 500; letter-spacing: -0.02em; }
.tp-wx-sub { margin-top: 4px; font-size: 15px; color: var(--wx-muted); }

.tp-wx-stats { list-style: none; margin: auto 0 0; padding: 22px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tp-wx-stats li {
  display: grid; grid-template-columns: 22px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  padding: 12px 14px; border-radius: 18px;
  background: var(--wx-glass); border: 1px solid var(--wx-edge);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.tp-wx-stats svg { grid-row: span 2; width: 22px; height: 22px; fill: none; stroke: var(--wx-muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tp-wx-stats span { font-size: 12px; color: var(--wx-faint); }
.tp-wx-stats b { font-size: 17px; font-weight: 600; }

/* forecast card */
.tp-wx-fc {
  display: flex; flex-direction: column;
  padding: 16px 18px 8px; border-radius: 22px;
  background: rgba(10, 13, 18, 0.5); border: 1px solid var(--wx-edge);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.tp-wx-fc-h { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--wx-faint); padding-bottom: 6px; }
.tp-wx-list { list-style: none; margin: 0; padding: 0; flex: 1; display: flex; flex-direction: column; justify-content: space-around; }
.tp-wx-row {
  display: grid; grid-template-columns: 58px 30px 40px minmax(40px, 1fr) 40px; align-items: center; gap: 10px;
  padding: 9px 0; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 15px;
}
.tp-wx-row:first-child { border-top: 0; }
.tp-wx-row:first-child .tp-wx-row-d, .tp-wx-row:first-child .tp-wx-row-hi { font-weight: 600; }
.tp-wx-row-ic { width: 30px; height: 30px; }
.tp-wx-row-lo { color: var(--wx-faint); text-align: right; }
.tp-wx-row-hi { text-align: right; }
.tp-wx-row-bar { position: relative; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); }
.tp-wx-row-bar i {
  position: absolute; top: 0; bottom: 0; left: 0; right: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #38bdf8, #a3e635 55%, #fbbf24);
}
/* animate only when switching cities, not on first paint */
.tp-wx.is-ready .tp-wx-row-bar i { transition: left 0.5s ease, right 0.5s ease; }

/* footer */
.tp-wx-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 16px; font-size: 12px; color: var(--wx-faint); }
.tp-wx-credit { margin-left: auto; }
.tp-wx-credit a { text-decoration: underline; text-underline-offset: 2px; }
.tp-wx-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; animation: tp-wx-pulse 2.4s infinite; }
.tp-wx.is-loading .tp-wx-dot, .tp-wx.is-stale .tp-wx-dot { background: #fbbf24; }
.tp-wx.is-error .tp-wx-dot { background: #f87171; animation: none; }
@keyframes tp-wx-pulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); }
}
.tp-wx:not(.is-ready) .tp-wx-hero { opacity: 0.25; }
.tp-wx.is-loading #tp-wx-temp, .tp-wx.is-loading #tp-wx-cond,
.tp-wx.is-loading .tp-wx-row, .tp-wx.is-loading .tp-wx-tab-t { animation: tp-wx-shimmer 1.4s ease-in-out infinite; }
@keyframes tp-wx-shimmer { 50% { opacity: 0.4; } }

/* tools grid lost a card: 3 across */
.tp-tools { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 960px) {
  .tp-wx-body { grid-template-columns: minmax(0, 1fr); }
  .tp-tools { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .tp-wx { padding: 16px; border-radius: 22px; }
  .tp-wx-bg::after { background: linear-gradient(180deg, rgba(10, 13, 18, 0.72) 0%, rgba(10, 13, 18, 0.84) 40%, rgba(10, 13, 18, 0.9) 100%); }
  .tp-wx-tabs { margin: 0 -16px; padding: 2px 16px 4px; }
  .tp-wx-body { margin-top: 16px; gap: 16px; }
  .tp-wx-hero-ic { width: 68px; height: 68px; }
  .tp-wx-temp { font-size: 76px; }
  .tp-wx-cond { font-size: 24px; }
  .tp-wx-stats { gap: 8px; }
  .tp-wx-stats li { grid-template-columns: 1fr; padding: 10px 12px; }
  .tp-wx-stats svg { grid-row: auto; margin-bottom: 4px; }
  .tp-wx-fc { padding: 12px 14px 4px; }
  .tp-wx-row { grid-template-columns: 50px 28px 36px minmax(30px, 1fr) 36px; gap: 8px; font-size: 14px; }
  .tp-wx-credit { margin-left: 0; }
  .tp-tools { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .tp-wx-dot, .tp-wx.is-loading * { animation: none !important; }
  .tp-wx-bg img, .tp-wx-row-bar i { transition: none; }
}
