/**
 * Global open / enter motion — plain CSS keyframes only.
 * Utilities: hz-pop-in, hz-cal-pop, hz-overlay-in, hz-modal-in, hz-cal-next, hz-cal-prev
 * Sections: .hz-reveal → .is-visible
 */

@keyframes hz-pop-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes hz-cal-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes hz-overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes hz-modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes hz-cal-next {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes hz-cal-prev {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes hz-section-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* —— Utility classes —— */
.hz-pop-in {
  animation: hz-pop-in 180ms ease-out both;
}

.hz-cal-pop {
  animation: hz-cal-pop 180ms ease-out both;
}

.hz-overlay-in {
  animation: hz-overlay-in 200ms ease-out both;
}

.hz-modal-in {
  animation: hz-modal-in 220ms ease-out both;
}

.hz-cal-next {
  animation: hz-cal-next 200ms ease-out both;
}

.hz-cal-prev {
  animation: hz-cal-prev 200ms ease-out both;
}

/* —— Section / page enter —— */
.hz-reveal {
  opacity: 0;
  transform: translateY(10px);
  will-change: opacity, transform;
}

.hz-reveal.is-visible {
  opacity: 1;
  transform: none;
  animation: hz-section-in 220ms ease-out both;
  will-change: auto;
}

/* Stagger children when parent has data-hz-stagger */
.hz-reveal.is-visible[data-hz-stagger] > *:nth-child(1) { animation: hz-section-in 220ms ease-out both; animation-delay: 0ms; }
.hz-reveal.is-visible[data-hz-stagger] > *:nth-child(2) { animation: hz-section-in 220ms ease-out both; animation-delay: 40ms; }
.hz-reveal.is-visible[data-hz-stagger] > *:nth-child(3) { animation: hz-section-in 220ms ease-out both; animation-delay: 80ms; }
.hz-reveal.is-visible[data-hz-stagger] > *:nth-child(4) { animation: hz-section-in 220ms ease-out both; animation-delay: 120ms; }
.hz-reveal.is-visible[data-hz-stagger] > *:nth-child(5) { animation: hz-section-in 220ms ease-out both; animation-delay: 160ms; }
.hz-reveal.is-visible[data-hz-stagger] > *:nth-child(6) { animation: hz-section-in 220ms ease-out both; animation-delay: 200ms; }

/* —— Wire site chrome —— */

/* Mobile nav backdrop */
@media (max-width: 1024px) {
  .rc-header__overlay {
    opacity: 0;
    transition: opacity 200ms ease-out, visibility 200ms ease-out;
  }

  .rc-header__overlay[hidden] {
    display: block !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .rc-header.is-open .rc-header__overlay,
  .rc-header__overlay.hz-overlay-in:not([hidden]) {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .rc-header.is-open .rc-header__overlay.hz-overlay-in {
    animation: hz-overlay-in 200ms ease-out both;
  }

  .rc-header__nav {
    transition: transform 300ms ease-out, visibility 300ms ease-out !important;
  }
}

/* Account dropdown */
.rc-topbar__account-menu:not([hidden]) {
  animation: hz-pop-in 180ms ease-out both;
}

/* Desktop nav submenu */
.rc-header__item--has-children.is-open > .rc-header__sub,
.rc-header__item--has-children:hover > .rc-header__sub,
.rc-header__item--has-children:focus-within > .rc-header__sub {
  animation: hz-pop-in 180ms ease-out both;
}

/* Search custom dropdown + submenu */
.csd-options.is-open,
.csd-options[style*="display: block"],
.csd-options[style*="display:block"] {
  animation: hz-pop-in 180ms ease-out both;
}

.csd-submenu[style*="display: block"],
.csd-submenu[style*="display:block"] {
  animation: hz-cal-pop 180ms ease-out both;
}

/* Select2 dropdowns (auth / dashboard) */
.select2-container--open .select2-dropdown {
  animation: hz-pop-in 180ms ease-out both;
}

/* Fluent Forms success / modal-like panels */
.ff-message-success,
.ff_form_status.ff_status_success,
.fluentform .ff-el-is-success {
  animation: hz-modal-in 220ms ease-out both;
}

/* Generic dialog / modal hooks used by plugins */
.um-modal,
.um-popup,
.dialog-lightbox-widget,
.elementor-popup-modal .dialog-widget-content {
  animation: hz-modal-in 220ms ease-out both;
}

.um-overlay,
.dialog-lightbox-widget .dialog-lightbox-close-button + .dialog-message::before,
.elementor-popup-modal .dialog-lightbox-close-button {
  /* no-op placeholder — overlay handled by plugin */
}

.um-overlay {
  animation: hz-overlay-in 200ms ease-out both;
}

/* FAQ details open body */
.fmp-home-faq__item[open] .fmp-home-faq__body {
  animation: hz-cal-pop 180ms ease-out both;
}

@media (prefers-reduced-motion: reduce) {
  .hz-pop-in,
  .hz-cal-pop,
  .hz-overlay-in,
  .hz-modal-in,
  .hz-cal-next,
  .hz-cal-prev,
  .hz-reveal,
  .hz-reveal.is-visible,
  .hz-reveal.is-visible[data-hz-stagger] > *,
  .rc-topbar__account-menu:not([hidden]),
  .rc-header__item--has-children.is-open > .rc-header__sub,
  .rc-header__item--has-children:hover > .rc-header__sub,
  .rc-header__item--has-children:focus-within > .rc-header__sub,
  .csd-options.is-open,
  .csd-options[style*="display: block"],
  .csd-options[style*="display:block"],
  .csd-submenu[style*="display: block"],
  .csd-submenu[style*="display:block"],
  .select2-container--open .select2-dropdown,
  .ff-message-success,
  .um-modal,
  .um-popup,
  .um-overlay,
  .dialog-lightbox-widget,
  .elementor-popup-modal .dialog-widget-content,
  .fmp-home-faq__item[open] .fmp-home-faq__body,
  .rc-header.is-open .rc-header__overlay.hz-overlay-in {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .hz-reveal {
    opacity: 1;
    transform: none;
  }

  @media (max-width: 1024px) {
    .rc-header__nav {
      transition: none !important;
    }
  }
}
