/* v1.9.0: weather on trip days (spec §4). The icon, the day strip's line, the details sheet, Home's line. Calm: only today's
   icon moves (the board passes Animated for today). Colours are tokens (tokens.css --tl-wx-*), so dark mode follows. */

/* ---------- The icon ---------- */

.tl-wx .sun,
.tl-wx .ray {
  stroke: var(--tl-wx-sun);
}

.tl-wx .drop {
  stroke: var(--tl-wx-rain);
}

.tl-wx .flake {
  stroke: var(--tl-wx-snow);
  stroke-width: 2.6;
}

.tl-wx .bolt {
  stroke: var(--tl-wx-bolt);
}

.tl-wx .cloud,
.tl-wx .fog-line {
  stroke: currentColor;
}

@keyframes tl-wx-fall {
  0% { transform: translateY(-1.5px); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translateY(3px); opacity: 0; }
}

@keyframes tl-wx-turn {
  to { transform: rotate(360deg); }
}

@keyframes tl-wx-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@keyframes tl-wx-flash {
  0%, 60%, 100% { opacity: 1; }
  64% { opacity: 0.15; }
  68% { opacity: 1; }
  72% { opacity: 0.2; }
  78% { opacity: 1; }
}

@keyframes tl-wx-drift {
  0% { transform: translate(-1px, -1.5px); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translate(1.5px, 3px); opacity: 0; }
}

@keyframes tl-wx-slide {
  0%, 100% { transform: translateX(-1.5px); }
  50% { transform: translateX(1.5px); }
}

@keyframes tl-wx-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.tl-wx.is-animated .drop {
  animation: tl-wx-fall 1.5s ease-in infinite;
}

.tl-wx.is-animated .drop:nth-of-type(3n + 1) {
  animation-delay: 0.5s;
}

.tl-wx.is-animated .drop:nth-of-type(3n + 2) {
  animation-delay: 1s;
}

.tl-wx.is-animated .flake {
  animation: tl-wx-drift 3s ease-in-out infinite;
}

.tl-wx.is-animated .flake:nth-of-type(3n + 1) {
  animation-delay: 1s;
}

.tl-wx.is-animated .flake:nth-of-type(3n + 2) {
  animation-delay: 2s;
}

.tl-wx--clear.is-animated .ray {
  transform-box: view-box;
  transform-origin: 12px 12px;
  animation: tl-wx-turn 20s linear infinite;
}

.tl-wx--mostly-sunny.is-animated .ray,
.tl-wx--partly-cloudy.is-animated .ray,
.tl-wx--showers.is-animated .ray {
  animation: tl-wx-glow 4s ease-in-out infinite;
}

.tl-wx--storm.is-animated .bolt {
  animation: tl-wx-flash 3.5s linear infinite;
}

.tl-wx--fog.is-animated .fog-line {
  animation: tl-wx-slide 5s ease-in-out infinite;
}

.tl-wx--fog.is-animated .fog-line:nth-of-type(3) {
  animation-delay: -2.5s;
}

.tl-wx--cloudy.is-animated .cloud {
  animation: tl-wx-slide 7s ease-in-out infinite;
}

/* Reduced motion: nothing moves; the icon fades slowly instead (UI spec §2.3). The global reduced-motion rule forces 1ms,
   once; this is more specific, so a slow pulse is the one thing that keeps going. */
@media (prefers-reduced-motion: reduce) {
  .tl-wx.is-animated,
  .tl-wx.is-animated * {
    animation: none !important;
  }

  .tl-wx.is-animated {
    animation: tl-wx-pulse 4s ease-in-out infinite !important;
  }
}

/* ---------- The strip in a day's header ---------- */

.tl-wx-strip {
  display: flex;
  flex-direction: column;
  margin: -6px 0 -2px;
}

.tl-wx-line {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% + 20px);
  min-height: 44px;
  margin: 0 -10px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--tl-radius-control);
  background: transparent;
  color: var(--tl-text-subtle);
  font: var(--tl-text-meta);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--tl-fast) ease-out;
}

.tl-wx-line:hover {
  background: var(--tl-surface-muted);
}

.tl-wx-line:focus-visible {
  outline: none;
  box-shadow: var(--tl-focus-shadow);
}

.tl-wx-line.is-second {
  margin-top: -6px;
}

.tl-wx-line.is-typical {
  color: var(--tl-text-muted);
}

.tl-wx-line.is-typical .tl-wx {
  opacity: 0.7;
}

.tl-wx-line__arrow {
  flex: none;
  margin-right: -2px;
  color: var(--tl-text-muted);
}

.tl-wx-line__place {
  flex: none;
  max-width: 60%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--tl-text);
}

.tl-wx-line.is-typical .tl-wx-line__place {
  color: var(--tl-text-muted);
}

/* The numbers give way before the place's name: they wrap between the temperatures and the rain. */
.tl-wx-line__nums {
  flex: 0 1 auto;
  min-width: 0;
  line-height: 16px;
}

.tl-wx-line__temps,
.tl-wx-line__rain {
  white-space: nowrap;
}

.tl-wx-line__rain {
  color: var(--tl-text-muted);
}

.tl-wx-line .tl-wx-line__more {
  margin-left: auto;
  color: var(--tl-text-muted);
}

.tl-wx-line__edited {
  flex: none;
  padding: 0 7px;
  border: 1px solid var(--tl-border-strong);
  border-radius: var(--tl-radius-pill);
  font: var(--tl-text-micro);
  color: var(--tl-text-muted);
  white-space: nowrap;
}

.tl-wx-sea {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  margin: 0;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
}

/* ---------- The day strip's tile icon ---------- */

.tl-daytile__top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.tl-daytile__wx {
  display: inline-flex;
  line-height: 0;
}

.tl-daytile[data-in-view="true"] .tl-wx * {
  stroke: currentColor;
}

@media (min-width: 1024px) {
  .tl-board:not(.tl-board--columns) .tl-daytile__top {
    display: contents;
  }

  .tl-board:not(.tl-board--columns) .tl-daytile__wx {
    order: 3;
    margin-left: auto;
  }

  .tl-board:not(.tl-board--columns) .tl-daytile__dot {
    order: 4;
  }

  .tl-board:not(.tl-board--columns) .tl-daytile:has(.tl-daytile__wx) .tl-daytile__dot {
    margin-left: 8px;
  }
}

/* ---------- The details sheet ---------- */

.tl-wx-sheet__row {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0 16px;
}

.tl-wx-sheet__row + .tl-wx-sheet__row {
  padding-top: 16px;
  border-top: 1px solid var(--tl-border);
}

.tl-wx-sheet__head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tl-wx-sheet__head .tl-wx {
  flex: none;
}

.tl-wx-sheet__headtext {
  min-width: 0;
}

.tl-wx-sheet__place {
  margin: 0;
  font: var(--tl-text-heading);
  overflow-wrap: anywhere;
}

.tl-wx-sheet__role {
  margin-left: 8px;
  font: var(--tl-text-meta);
  font-weight: 500;
  color: var(--tl-text-muted);
}

.tl-wx-sheet__now {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 0;
  font: var(--tl-text-body);
  color: var(--tl-text-subtle);
}

.tl-wx-sheet__temps {
  margin: 0;
  font: var(--tl-text-title);
  letter-spacing: -0.01em;
}

.tl-wx-sheet__note {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--tl-radius-control);
  background: var(--tl-surface-muted);
  color: var(--tl-text-subtle);
  font: var(--tl-text-body);
  overflow-wrap: anywhere;
}

.tl-wx-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  margin: 0;
}

.tl-wx-facts:empty {
  display: none;
}

.tl-wx-fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tl-wx-fact dt {
  display: flex;
  align-items: center;
  gap: 6px;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
}

.tl-wx-fact dd {
  margin: 0;
  font: var(--tl-text-body);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.tl-wx-sheet__source {
  margin: 0;
  font: var(--tl-text-meta);
  color: var(--tl-text-muted);
}

.tl-wx-say {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}

.tl-wx-say__title {
  margin: 0;
  font: var(--tl-text-heading);
}

.tl-wx-say__picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}

.tl-wx-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 60px;
  padding: 6px 4px;
  border: 1px solid var(--tl-border-strong);
  border-radius: var(--tl-radius-control);
  background: var(--tl-surface);
  color: var(--tl-text-subtle);
  font: var(--tl-text-micro);
  text-align: center;
  cursor: pointer;
  transition: background-color var(--tl-fast) ease-out, border-color var(--tl-fast) ease-out;
}

.tl-wx-pick:hover {
  border-color: var(--tl-text-muted);
}

.tl-wx-pick.is-chosen {
  border-color: var(--tl-primary);
  background: var(--tl-primary-soft);
  color: var(--tl-text);
  box-shadow: inset 0 0 0 1px var(--tl-primary);
}

.tl-wx-pick:focus-visible {
  outline: none;
  box-shadow: var(--tl-focus-shadow);
}

.tl-wx-say__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tl-wx-sheet__link {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  min-height: 44px;
  color: var(--tl-primary);
  font: var(--tl-text-body);
  font-weight: 500;
  text-decoration: none;
}

.tl-wx-sheet__link:hover {
  text-decoration: underline;
}

.tl-wx-sheet__link:focus-visible,
.tl-wx-sheet__credit a:focus-visible {
  outline: none;
  border-radius: 6px;
  box-shadow: var(--tl-focus-shadow);
}

.tl-wx-sheet__credit {
  margin: 0;
  padding: 4px 0 8px;
  font-size: 12px;
  line-height: 16px;
  color: var(--tl-text-muted);
}

.tl-wx-sheet__credit a {
  color: inherit;
  text-decoration: underline;
}

/* ---------- Home ---------- */

.tl-home-wx {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: -4px 0;
  color: var(--tl-text-subtle);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  text-decoration: none;
}

.tl-home-wx:hover .tl-home-wx__text {
  text-decoration: underline;
}

.tl-home-wx:focus-visible {
  outline: none;
  border-radius: var(--tl-radius-control);
  box-shadow: var(--tl-focus-shadow);
}

.tl-home-wx__text {
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
