/*
 * Rebuild-only styles. Everything else comes from the vendored Elementor /
 * hello-elementor stylesheets, which are loaded in the source site's order.
 *
 * Two jobs:
 *   1. reinstate behaviour the original got from plugin JS (submenu display)
 *   2. keep animated content visible when JS is unavailable
 */

/* --- entrance animations -------------------------------------------------
 * Elementor ships .elementor-invisible { opacity: 0 } unconditionally, which
 * hides content from crawlers and no-JS visitors. Gate it on the .js class
 * that the inline head script adds.
 */
html:not(.js) .elementor-invisible {
  opacity: 1 !important;
  visibility: visible !important;
  animation: none !important;
}

/* --- nav submenus --------------------------------------------------------
 * SmartMenus toggled these inline in the original; our JS toggles .is-open.
 */
.elementor-nav-menu--main .menu-item-has-children > ul.sub-menu {
  display: none;
}
.elementor-nav-menu--main .menu-item-has-children.is-open > ul.sub-menu {
  display: block;
}
.elementor-nav-menu--dropdown .menu-item-has-children > ul.sub-menu {
  display: none;
}
.elementor-nav-menu--dropdown .menu-item-has-children.is-open > ul.sub-menu {
  display: block;
}

/* SmartMenus' shrink-to-fit class: labels must not wrap while the submenu
 * sizes itself to the longest one. */
.elementor-nav-menu--main ul.sub-menu.sm-nowrap > li > a {
  white-space: nowrap;
}

/* Submenu arrow flips when open, matching the original's behaviour. */
.menu-item-has-children.is-open > a > .sub-arrow i {
  transform: rotate(180deg);
  transition: transform 0.2s ease;
}
.menu-item-has-children > a > .sub-arrow i {
  transition: transform 0.2s ease;
}

/* --- sticky header -------------------------------------------------------
 * No z-index here on purpose: sticky.min.css already sets 99 on
 * .elementor-sticky--active, which is what the live site renders with.
 * The spacer holds the header's space while the header itself is fixed.
 */
.dr-sticky-spacer {
  width: 100%;
  pointer-events: none;
}

/* --- accessibility ------------------------------------------------------- */
.skip-link.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link.screen-reader-text:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100000;
  width: auto;
  height: auto;
  margin: 0;
  padding: 12px 20px;
  clip: auto;
  background: #fff;
  color: #191a1b;
  font-size: 14px;
  border-radius: 3px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

/* --- form messages ------------------------------------------------------- */
.elementor-message {
  margin-top: 10px;
  font-size: 0.95em;
  line-height: 1.5;
}
.elementor-message-success {
  color: #46b450;
}
.elementor-message-danger {
  color: #d9534f;
}

/* --- reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .animated {
    animation: none !important;
  }
  .elementor-invisible {
    opacity: 1 !important;
  }
}

/* --- post cards ----------------------------------------------------------
 * Elementor's posts widget gives the thumbnail link its aspect ratio from JS.
 * The ratio (0.66, Elementor's default) was measured on the live site; the
 * cover/crop behaviour itself comes from widget-posts.min.css once
 * .elementor-has-item-ratio is present, which src/scripts/site.js adds.
 */
.elementor-posts-container.elementor-has-item-ratio .elementor-post__thumbnail__link {
  aspect-ratio: 1 / var(--e-posts-item-ratio, 0.66);
  height: auto;
  overflow: hidden;
}

/* --- gallery lightbox ----------------------------------------------------
 * Stands in for Elementor's lightbox so gallery images open in an overlay
 * instead of navigating to the raw file.
 */
.dr-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  background: rgba(0, 0, 0, 0.9);
}
.dr-lightbox[hidden] {
  display: none;
}
.dr-lightbox__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 0;
  max-width: 100%;
  max-height: 100%;
}
.dr-lightbox__img {
  max-width: min(1200px, 88vw);
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.dr-lightbox__caption {
  color: #fff;
  font-size: 14px;
  text-align: center;
  opacity: 0.85;
}
.dr-lightbox__counter {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  color: #fff;
  font-size: 13px;
  opacity: 0.7;
}
.dr-lightbox button {
  background: none;
  border: 0;
  color: #fff;
  cursor: pointer;
  line-height: 1;
  padding: 12px;
  opacity: 0.75;
  transition: opacity 0.2s;
}
.dr-lightbox button:hover,
.dr-lightbox button:focus-visible {
  opacity: 1;
}
.dr-lightbox__close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 40px;
}
.dr-lightbox__prev,
.dr-lightbox__next {
  font-size: 56px;
  flex: 0 0 auto;
}
.dr-lightbox__prev[hidden],
.dr-lightbox__next[hidden] {
  display: none;
}
@media (max-width: 767px) {
  .dr-lightbox__prev,
  .dr-lightbox__next {
    font-size: 36px;
    padding: 8px;
  }
  .dr-lightbox__img {
    max-width: 92vw;
  }
}
