/* HAIBO Weather Widget — premium single-slide glass card */
.weather-widget {
  --wx-gold: #d98b2b;
  --wx-gold-soft: #ffb347;
  --wx-brown: #8b5a2b;
  --wx-glow: rgba(217, 139, 43, 0.4);
  --wx-card-h: 156px;
  --wx-transition: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 20;
  width: min(100%, 360px);
}

@media (min-width: 1024px) {
  .weather-widget {
    position: absolute;
    right: 5rem;
    top: 11rem;
    width: 340px;
  }
}

@media (max-width: 1023px) {
  .weather-widget {
    position: relative;
    margin: 1.5rem auto 0;
    padding: 0 1rem;
    width: min(100%, 320px);
  }
}

.weather-widget-shell {
  position: relative;
  border-radius: 1.65rem;
  padding: 1px;
  background: linear-gradient(
    145deg,
    rgba(217, 139, 43, 0.65) 0%,
    rgba(255, 255, 255, 0.12) 42%,
    rgba(139, 90, 43, 0.45) 100%
  );
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.38),
    0 0 48px rgba(217, 139, 43, 0.1);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.weather-widget-shell::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(217, 139, 43, 0.25), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.weather-widget-shell:hover {
  transform: translateY(-3px);
}

.weather-widget-card {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-radius: 1.6rem;
  background: linear-gradient(
    165deg,
    rgba(28, 22, 16, 0.72) 0%,
    rgba(12, 10, 8, 0.55) 100%
  );
  backdrop-filter: blur(28px) saturate(1.35);
  -webkit-backdrop-filter: blur(28px) saturate(1.35);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

/* Fixed stage — no layout shift between slides */
.weather-widget-viewport {
  position: relative;
  height: var(--wx-card-h);
  min-height: var(--wx-card-h);
  max-height: var(--wx-card-h);
  overflow: hidden;
  isolation: isolate;
}

/* Exactly one slide node — fills the stage */
.weather-slide {
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
  padding: 0;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity var(--wx-transition);
  will-change: opacity;
}

.weather-slide.is-inactive,
.weather-slide.is-exiting {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
}

.weather-slide.is-entering {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.weather-slide.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 2;
}

.weather-slide-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.1rem 1.25rem 0.95rem;
  box-sizing: border-box;
  overflow: hidden;
}

.weather-slide-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  min-width: 0;
  flex-shrink: 0;
}

.weather-slide-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.weather-slide-label {
  margin: 0 0 0.15rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--wx-gold-soft);
  line-height: 1.2;
}

.weather-slide-park {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.28;
  color: rgba(255, 255, 255, 0.96);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 11.5rem;
}

.weather-temp-block {
  flex: 0 0 auto;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
}

.weather-temp {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  background: linear-gradient(160deg, #ffffff 0%, #ffe4b8 55%, var(--wx-gold-soft) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.weather-icon {
  display: block;
  font-size: 1.2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}

.weather-facts {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
  overflow: hidden;
  flex-shrink: 0;
}

.weather-fact {
  flex: 0 1 auto;
  max-width: 100%;
  font-size: 0.64rem;
  font-weight: 500;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(139, 90, 43, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.28rem 0.5rem;
  border-radius: 9999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weather-widget-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.12);
}

.weather-dots {
  display: flex;
  gap: 0.32rem;
  align-items: center;
}

.weather-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.22);
  border: none;
  padding: 0;
  cursor: pointer;
  transition:
    width 0.35s ease,
    background 0.35s ease,
    box-shadow 0.35s ease;
}

.weather-dot.is-active {
  width: 18px;
  background: linear-gradient(90deg, var(--wx-gold), var(--wx-gold-soft));
  box-shadow: 0 0 10px var(--wx-glow);
}

.weather-live {
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.weather-live-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.75);
  animation: weatherPulse 2.2s ease-in-out infinite;
}

@keyframes weatherPulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.88);
  }
}

/* Loading shimmer — single slide only */
.weather-widget.is-loading .weather-slide-park,
.weather-widget.is-loading .weather-temp {
  color: transparent;
  -webkit-text-fill-color: transparent;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.16) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: weatherShimmer 1.15s ease-in-out infinite;
  border-radius: 0.3rem;
}

.weather-widget.is-loading .weather-temp {
  min-width: 2.75rem;
  min-height: 1.5rem;
}

.weather-widget.is-loading .weather-fact {
  color: transparent;
  background: rgba(255, 255, 255, 0.06);
  animation: weatherShimmer 1.15s ease-in-out infinite;
}

@keyframes weatherShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .weather-widget {
    --wx-card-h: 142px;
    width: 100%;
    max-width: none;
    padding: 0 0.5rem;
  }

  .weather-widget-shell {
    border-radius: 1.35rem;
  }

  .weather-widget-card {
    border-radius: 1.3rem;
  }

  .weather-slide-inner {
    padding: 0.95rem 1rem 0.85rem;
  }

  .weather-slide-park {
    font-size: 0.86rem;
    max-width: 9.5rem;
  }

  .weather-temp {
    font-size: 1.45rem;
  }

  .weather-icon {
    font-size: 1.05rem;
  }

  .weather-fact {
    font-size: 0.58rem;
    padding: 0.22rem 0.42rem;
  }

  .weather-facts {
    gap: 0.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .weather-slide {
    transition: none;
  }

  .weather-live-pulse {
    animation: none;
  }

  .weather-widget-shell:hover {
    transform: none;
  }
}
