/* ==========================================================================
   Sola Endu - layout overrides (load AFTER every other stylesheet)
   ========================================================================== */

/* --------------------------------------------------------------------------
   B1. Open phone/tablet menu must cover the viewport.
   .se-header has backdrop-filter, which makes it the containing block of the
   position:fixed overlay (overlay collapsed to the 64px header). Drop the
   filter and use a solid background while the menu is open.
   -------------------------------------------------------------------------- */
/* html.has-modal-open is set by the WordPress menu script; it covers older
   phones whose browsers do not support :has(). */
html.has-modal-open .se-header {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: var(--se-bg);
}
html.has-modal-open .se-dock {
  display: none;
}
.se-header:has(.is-menu-open) {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: var(--se-bg);
}

/* Fixed bottom action bar / floating WhatsApp button must not sit on the menu */
body:has(.wp-block-navigation__responsive-container.is-menu-open) .se-dock {
  display: none;
}

.se-header .wp-block-navigation__responsive-container.is-menu-open {
  background: var(--se-bg) !important;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Close button: comfortable tap target, sits in the overlay padding */
.se-header .wp-block-navigation__responsive-container-close {
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  top: 12px;
  right: 12px;
}

/* Links in the open menu: >= 44px tap height */
.se-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 0;
}
/* submenus are always expanded in the overlay, so the chevron toggle is redundant */
.se-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-icon {
  display: none;
}

/* Keep the desktop mega-menu panel from leaking into the open overlay:
   undo the 660px / negative-left / 2-column grid (rules use !important). */
.se-header .wp-block-navigation__responsive-container.is-menu-open .has-child .wp-block-navigation__submenu-container {
  position: static !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  width: 100% !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column;
  grid-template-columns: none;
  gap: 0;
  box-shadow: none !important;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  color: var(--se-text) !important;
}
.se-header .wp-block-navigation__responsive-container.is-menu-open .has-child .wp-block-navigation__submenu-container:before {
  display: none;
}
.se-header .wp-block-navigation__responsive-container.is-menu-open .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-height: 44px;
  padding: 6px 0 !important;
  border-radius: 0;
  color: var(--se-text) !important;
}
/* hide the desktop icon tile, descriptions and feature image in the overlay */
.se-header .wp-block-navigation__responsive-container.is-menu-open .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content:before,
.se-header .wp-block-navigation__responsive-container.is-menu-open .has-child .wp-block-navigation__submenu-container .se-nav-feature>a:after,
.se-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item__description {
  display: none;
}
.se-header .wp-block-navigation__responsive-container.is-menu-open .has-child .wp-block-navigation__submenu-container .se-nav-feature>a {
  background: none !important;
  border: 0;
  min-height: 44px;
}

/* --------------------------------------------------------------------------
   B2. Hamburger + overlay up to 1023px (WordPress switches at 600px).
   Re-hide the inline container and show the open button between 600-1023px.
   -------------------------------------------------------------------------- */
@media (min-width: 600px) and (max-width: 1023.98px) {
  .se-header .wp-block-navigation__responsive-container:not(.is-menu-open) {
    display: none;
  }
  .se-header .wp-block-navigation__responsive-container-open:not(.always-shown) {
    display: flex;
  }
  /* WP only draws the close button for the closed-container variant < 600px */
  .se-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
    display: grid;
  }
}

/* Desktop header: keep it on a single row */
@media (min-width: 1024px) {
  .se-header .wp-block-navigation__container {
    flex-wrap: nowrap;
    white-space: nowrap;
  }
}

/* --------------------------------------------------------------------------
   P1. Ghost words: never clipped, never over text.
   Size so the longest word (~12em wide) fits the content width; the inner-page
   hero (.se-banner) has intro text on top, so drop its ghost entirely.
   -------------------------------------------------------------------------- */
.se-ghost {
  font-size: min(clamp(3rem, 9.2vw, 7rem), calc((100vw - 2 * var(--se-gut, 1rem)) / 13));
  max-width: calc(100vw - 2 * var(--se-gut, 1rem)) !important;
  /* site JS sets an inline scroll-parallax transform that drifts the word
     sideways by up to ~200px (off-screen on phones); pin it centred.
     !important is required to beat the inline style. */
  transform: translate(-50%, 0) !important;
}
.se-banner .se-ghost {
  display: none;
}

/* --------------------------------------------------------------------------
   P3. No first-visit preloader overlay; content is never hidden/offset by it.
   -------------------------------------------------------------------------- */
.preload .se-preloader,
.preload-out .se-preloader {
  display: none;
  transform: none;
}

/* --------------------------------------------------------------------------
   Phones
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  /* P5. Hero paragraph stops short of the right-hand guide line */
  .se-hero .se-lead {
    max-width: calc(100% - 16px);
  }

  /* P6. Reminders card: show bubbles immediately on phone without waiting for tall bento threshold */
  .se-live-ready:not(.is-live) .se-w-remind p {
    opacity: 1;
  }
  .is-live .se-w-remind__msg   { animation-delay: .05s; }
  .is-live .se-w-remind__reply { animation-delay: .35s; }
  .is-live .se-w-remind__ok    { animation-delay: .65s; }

  /* H4. Homepage "The admin that runs by itself": 3 cards on phone */
  .home .se-bento > .se-bento__card:nth-child(n+4) {
    display: none;
  }
  .se-bento__more {
    margin-top: 20px;
    text-align: center;
  }

  /* P7. Footer links: 44px tap height */
  .se-footer ul {
    gap: 0;
  }
  .se-footer li a,
  .se-footer__legal nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}

/* P2. Hero phone shows the first chat message immediately on load */
.se-hero .se-wa.is-playing .se-wa__day + .se-wa__m {
  display: block;
  animation: none;
}

@media (min-width: 600.02px) {
  .se-bento__more {
    display: none;
  }
}
