/* City Site Motion Pack v1.0.0
   Lightweight motion only. No flashing. Reduced-motion users get a static site. */

:root {
  --csmp-lift: 2px;
  --csmp-focus: #073763;
}

/* ---------------------------------------------------------
   1) Navigation / button polish
   --------------------------------------------------------- */
#masthead a,
.site-header a,
header a,
#cwna-widget .cwna-forecast-link,
#cwna-widget .cwna-alert-link {
  transition: transform .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease;
}

@media (hover: hover) and (pointer: fine) {
  #masthead nav a:hover,
  .site-header nav a:hover,
  header nav a:hover,
  #cwna-widget .cwna-forecast-link:hover,
  #cwna-widget .cwna-alert-link:hover {
    transform: translateY(calc(var(--csmp-lift) * -1));
  }
}

#masthead a:focus-visible,
.site-header a:focus-visible,
header a:focus-visible,
#cwna-widget a:focus-visible {
  outline: 3px solid var(--csmp-focus);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------------------------------------------------------
   2) Weather icon micro-animation
   --------------------------------------------------------- */
#cwna-widget .cwna-weather-icon {
  display: inline-block;
  transform-origin: 50% 55%;
  animation: csmpWeatherFloat 4.8s ease-in-out infinite;
  will-change: transform;
}

#cwna-widget .cwna-weather-icon.csmp-sun {
  animation-name: csmpSunGlow;
  animation-duration: 7s;
}

#cwna-widget .cwna-weather-icon.csmp-cloud,
#cwna-widget .cwna-weather-icon.csmp-fog {
  animation-name: csmpCloudDrift;
  animation-duration: 6.5s;
}

#cwna-widget .cwna-weather-icon.csmp-rain,
#cwna-widget .cwna-weather-icon.csmp-storm,
#cwna-widget .cwna-weather-icon.csmp-snow {
  animation-name: csmpWeatherNudge;
  animation-duration: 3.8s;
}

@keyframes csmpWeatherFloat {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes csmpSunGlow {
  0%,100% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(6deg) scale(1.04); }
}

@keyframes csmpCloudDrift {
  0%,100% { transform: translateX(0); }
  50% { transform: translateX(3px); }
}

@keyframes csmpWeatherNudge {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(2px); }
}

/* ---------------------------------------------------------
   3) Scroll reveal for content blocks only.
   Department-logo strips/images are intentionally excluded.
   Content stays visible unless JavaScript confirms it can animate.
   --------------------------------------------------------- */
html.csmp-ready .csmp-reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .5s ease, transform .5s cubic-bezier(.2,.7,.2,1);
}

html.csmp-ready .csmp-reveal.csmp-in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Slightly quicker for small utility cards. */
html.csmp-ready .csmp-reveal.csmp-reveal-quick {
  transition-duration: .38s;
}

/* ---------------------------------------------------------
   4) NWS alert emphasis: brief entrance only, no continuous flash.
   --------------------------------------------------------- */
#cwna-widget .cwna-alert:not([hidden]) {
  animation: csmpAlertEnter .42s ease-out both;
}

#cwna-widget .cwna-alert.is-warning:not([hidden]) {
  box-shadow: 0 0 0 0 rgba(155,16,24,.18), 0 10px 28px rgba(120,0,0,.18);
  animation: csmpAlertEnter .42s ease-out both, csmpAlertEmphasis .9s ease-out .15s 1;
}

@keyframes csmpAlertEnter {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes csmpAlertEmphasis {
  0%   { box-shadow: 0 0 0 0 rgba(155,16,24,.28), 0 10px 28px rgba(120,0,0,.18); }
  100% { box-shadow: 0 0 0 12px rgba(155,16,24,0), 0 10px 28px rgba(120,0,0,.18); }
}

/* ---------------------------------------------------------
   5) Existing home slideshow: keep transitions calm.
   These rules do not alter layout or timing; they only smooth fades.
   --------------------------------------------------------- */
.slider .slide,
.slides .slide,
.home .wp-block-cover,
.home .wp-block-image img {
  transition-timing-function: ease-in-out;
}

/* ---------------------------------------------------------
   Reduced motion: fully static.
   --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  #cwna-widget .cwna-weather-icon,
  #cwna-widget .cwna-alert,
  #cwna-widget .cwna-alert.is-warning {
    animation: none !important;
  }

  html.csmp-ready .csmp-reveal,
  html.csmp-ready .csmp-reveal.csmp-in-view,
  #masthead a,
  .site-header a,
  header a,
  #cwna-widget a {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
