/* CMS-065 · Clima animado (componente WeatherArt, src/clima.tsx).
   Solo transform y opacity: el compositor lo mueve sin repintar la página.
   Ciclos largos y suaves para que no canse. Se detiene con movimiento
   reducido, con «Pausar animaciones» (html.vida-quieto) y fuera de pantalla
   (.vida-fuera, lo pone vida.js). */
.clima-arte {
  --cl-sol: #f5b33b;
  --cl-sol-halo: #ffd36e;
  --cl-luna: #f1d27a;
  --cl-luna-borde: #c9a443;
  --cl-estrella: #e3b23c;
  --cl-nube: #ffffff;
  --cl-nube-borde: #b9c8d6;
  --cl-gris: #dbe3ea;
  --cl-gris-borde: #9fb0c0;
  --cl-oscura: #8e9aa8;
  --cl-oscura-borde: #67727f;
  --cl-fondo: #e7edf3;
  --cl-lluvia: #2f7fc1;
  --cl-hielo: #69bde3;
  --cl-nieve: #ffffff;
  --cl-nieve-borde: #8fb0ca;
  --cl-rayo: #ffd21f;
  --cl-rayo-borde: #d39a00;
  --cl-niebla: #a3b2c1;
  display: block;
  overflow: visible;
}
/* Solo lo que se anima gira o escala sobre su propio centro: las piezas con
   atributo transform (rayos, estrellas) conservan su posición. */
.clima-arte :is(.cl-sol-rayos, .cl-sol-halo, .cl-sol-destello, .cl-luna,
  .cl-luna-halo, .cl-estrella, .cl-nube, .cl-p, .cl-banda, .cl-relampago) {
  transform-box: fill-box;
  transform-origin: center;
}

/* Sol */
.cl-sol-halo { fill: var(--cl-sol-halo); opacity: 0.35; }
.cl-sol-disco { fill: var(--cl-sol); }
.cl-sol-destello { fill: none; stroke: var(--cl-sol-halo); stroke-width: 2; opacity: 0; }
.cl-rayo { stroke: var(--cl-sol); stroke-width: 3.4; stroke-linecap: round; }
.cl-rayo-corto { stroke-width: 2.6; opacity: 0.8; }
/* Luna y estrellas */
.cl-luna-halo { fill: var(--cl-luna); opacity: 0.18; }
.cl-luna-disco { fill: var(--cl-luna); stroke: var(--cl-luna-borde); stroke-width: 1.4; stroke-linejoin: round; }
.cl-estrella { fill: var(--cl-estrella); }
/* Nubes */
.cl-nube { stroke-width: 2.2; stroke-linejoin: round; }
.cl-nube-clara, .cl-nube-chica { fill: var(--cl-nube); stroke: var(--cl-nube-borde); }
.cl-nube-fondo { fill: var(--cl-fondo); stroke: var(--cl-nube-borde); opacity: 0.9; }
.cl-nube-gris { fill: var(--cl-gris); stroke: var(--cl-gris-borde); }
.cl-nube-oscura { fill: var(--cl-oscura); stroke: var(--cl-oscura-borde); }
/* Lo que cae */
.cl-caida-gota .cl-p { stroke: var(--cl-lluvia); stroke-width: 3; stroke-linecap: round; }
.cl-caida-hielo .cl-p { stroke: var(--cl-hielo); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 3 3; }
.cl-caida-llovizna .cl-p { fill: var(--cl-lluvia); }
.cl-copo { fill: none; stroke: var(--cl-nieve-borde); stroke-width: 2; stroke-linecap: round; }
.cl-caida-grano .cl-p { fill: var(--cl-nieve); stroke: var(--cl-nieve-borde); stroke-width: 1.2; }
.cl-caida-granizo .cl-p { fill: #eef5fa; stroke: var(--cl-nieve-borde); stroke-width: 1.4; }
.cl-relampago { fill: var(--cl-rayo); stroke: var(--cl-rayo-borde); stroke-width: 1.4; stroke-linejoin: round; }
.cl-banda { stroke: var(--cl-niebla); stroke-width: 5; stroke-linecap: round; }

@media (prefers-reduced-motion: no-preference) {
  .cl-sol-rayos { animation: cl-gira 48s linear infinite; }
  .cl-sol-halo { animation: cl-respira 5.5s ease-in-out infinite alternate; }
  .cl-sol-destello { animation: cl-destello 11s ease-out infinite 2s; }
  .cl-luna { animation: cl-mece 14s ease-in-out infinite alternate; }
  .cl-luna-halo { animation: cl-respira 7s ease-in-out infinite alternate; }
  .cl-estrella { animation: cl-titila 3.2s ease-in-out infinite alternate; }
  .cl-estrellas > g:nth-child(2) .cl-estrella { animation-delay: -1.1s; animation-duration: 4.1s; }
  .cl-estrellas > g:nth-child(3) .cl-estrella { animation-delay: -2.3s; animation-duration: 2.7s; }
  .cl-estrellas > g:nth-child(4) .cl-estrella { animation-delay: -0.6s; animation-duration: 3.7s; }
  .cl-estrellas > g:nth-child(5) .cl-estrella { animation-delay: -1.8s; }
  .cl-deriva { animation: cl-deriva 9s ease-in-out infinite alternate; }
  .cl-deriva-lenta { animation: cl-deriva 14s ease-in-out infinite alternate-reverse; }
  .cl-pasa { animation: cl-pasa 26s linear infinite; }
  .cl-caida .cl-p { animation: cl-cae 1.15s linear infinite; }
  .cl-caida-llovizna .cl-p { animation-duration: 1.9s; }
  .cl-caida-copo .cl-p, .cl-caida-grano .cl-p { animation: cl-copo 3.8s linear infinite; }
  .cl-caida-granizo .cl-p { animation: cl-granizo 0.95s cubic-bezier(0.5, 0, 1, 1) infinite; }
  .cl-caida .cl-p:nth-child(2) { animation-delay: -0.45s; }
  .cl-caida .cl-p:nth-child(3) { animation-delay: -0.8s; }
  .cl-caida .cl-p:nth-child(4) { animation-delay: -0.25s; }
  .cl-caida .cl-p:nth-child(5) { animation-delay: -0.65s; }
  .cl-caida .cl-p:nth-child(6) { animation-delay: -1s; }
  .cl-caida .cl-p:nth-child(7) { animation-delay: -0.1s; }
  .cl-caida-copo .cl-p:nth-child(2n), .cl-caida-grano .cl-p:nth-child(2n) { animation-delay: -1.9s; animation-duration: 4.6s; }
  .cl-caida-copo .cl-p:nth-child(3n), .cl-caida-grano .cl-p:nth-child(3n) { animation-delay: -2.8s; }
  .cl-relampago { animation: cl-relampago 6.5s linear infinite 1s; }
  .cl-banda { animation: cl-niebla 8s ease-in-out infinite alternate; }
  .cl-banda:nth-child(2) { animation-duration: 11s; animation-direction: alternate-reverse; }
  .cl-banda:nth-child(3) { animation-duration: 9.5s; animation-delay: -3s; }
}
/* En pausa o fuera de la pantalla: quieto donde está. */
.vida-quieto .clima-arte *,
.vida-fuera .clima-arte *,
.clima-arte.vida-fuera * {
  animation-play-state: paused !important;
}

@keyframes cl-gira { to { transform: rotate(360deg); } }
@keyframes cl-respira {
  from { transform: scale(0.88); opacity: 0.22; }
  to { transform: scale(1.1); opacity: 0.5; }
}
@keyframes cl-destello {
  0%, 84% { transform: scale(1); opacity: 0; }
  86% { opacity: 0.85; }
  100% { transform: scale(2.3); opacity: 0; }
}
@keyframes cl-mece {
  from { transform: rotate(-6deg); }
  to { transform: rotate(5deg); }
}
@keyframes cl-titila {
  from { transform: scale(0.55); opacity: 0.35; }
  to { transform: scale(1.05); opacity: 1; }
}
@keyframes cl-deriva {
  from { transform: translateX(-4px); }
  to { transform: translateX(5px); }
}
@keyframes cl-pasa {
  0% { transform: translateX(-26px); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translateX(30px); opacity: 0; }
}
@keyframes cl-cae {
  0% { transform: translateY(-6px); opacity: 0; }
  15% { opacity: 1; }
  75% { opacity: 1; }
  100% { transform: translateY(18px); opacity: 0; }
}
@keyframes cl-copo {
  0% { transform: translate(0, -6px) rotate(0deg); opacity: 0; }
  15% { opacity: 1; }
  50% { transform: translate(4px, 6px) rotate(90deg); }
  80% { opacity: 1; }
  100% { transform: translate(-3px, 18px) rotate(180deg); opacity: 0; }
}
@keyframes cl-granizo {
  0% { transform: translateY(-8px); opacity: 0; }
  20% { opacity: 1; }
  85% { transform: translateY(16px); opacity: 1; }
  100% { transform: translateY(13px); opacity: 0; }
}
@keyframes cl-relampago {
  0%, 82% { opacity: 0; }
  83% { opacity: 1; }
  85% { opacity: 0.25; }
  87% { opacity: 1; }
  92%, 100% { opacity: 0; }
}
@keyframes cl-niebla {
  from { transform: translateX(-6px); opacity: 0.55; }
  to { transform: translateX(7px); opacity: 0.95; }
}
/* Sin movimiento: el rayo se ve quieto (si no, quedaría invisible). */
@media (prefers-reduced-motion: reduce) {
  .cl-relampago { opacity: 1; }
}

/* Tarjeta del clima con la pieza encendida. */
.weather-now .clima-arte {
  width: 76px;
  height: 76px;
  flex: none;
  margin: -8px -4px -8px -8px;
}

/* Página de demostración /clima/estados/. */
.clima-demo { padding-block: 32px 56px; }
.clima-demo h1 { margin: 0 0 8px; }
.clima-demo-nota { max-width: 62ch; color: var(--muted, #4b5d63); }
.clima-demo-grupo { margin-top: 28px; }
.clima-demo-lista {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.clima-demo-item {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 14px 10px 12px;
  border: 2px solid #cfe0ee;
  border-radius: 14px;
  background: #f3f8fc;
  text-align: center;
}
.clima-demo-item[data-noche] { background: #e9eef6; border-color: #c6d2e3; }
.clima-demo-item .clima-arte { width: 96px; height: 96px; }
.clima-demo-item strong { font-size: 15px; line-height: 1.2; }
.clima-demo-item span { color: var(--muted, #4b5d63); font-size: 12px; }

/* Costado de las páginas internas (ronda 2): el mismo ícono animado. */
.rail-weather .clima-arte {
  width: 52px;
  height: 52px;
  margin: -8px -4px -8px -6px;
  color: inherit;
}
