/*
Theme Name: Scottsdale Plastic Surgery Child
Description: Child theme of the Blushark Digital "Scottsdale Plastic Surgery" (sazps) theme. All local customizations (header/menu rework, home banner layout) live here so the parent theme can be updated upstream without losing changes.
Template: sazps
Version: 1.9
*/

/* Child theme overrides load after all parent stylesheets (see functions.php). */

/* ==========================================================================
   Desktop horizontal menu with megamenu (child header.php .desktop-nav-row)

   Below 1200px the row is hidden and the parent theme's slide-out hamburger
   menu still applies; at 1200px+ the hamburger is hidden instead.
   Top-level items are tagged by sazps_child_tag_mega_items():
     .nav-mega     — has grandchildren -> full-width multi-column panel
     .nav-dropdown — children only     -> simple dropdown list
   ========================================================================== */

.desktop-nav-row {
    display: none;
}

@media (min-width: 1200px) {

    .menu-button,
    .menu-wrap {
        display: none;
    }

    .desktop-nav-row {
        display: block;
        position: relative; /* megamenu panel spans this row */
        background: #fff;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }
    /* parent's `.header .container` is flex/space-between; not wanted here */
    .desktop-nav-row .container {
        display: block;
    }

    ul.desktop-menu {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        column-gap: 34px;
    }
    .desktop-menu > li > a {
        display: block;
        padding: 14px 0;
        font-size: 15px;
        font-weight: 500;
        text-transform: uppercase;
        color: #000;
        text-decoration: none;
        white-space: nowrap;
    }
    .desktop-menu > li:hover > a,
    .desktop-menu > li:focus-within > a,
    .desktop-menu > li.current-menu-item > a,
    .desktop-menu > li.current-menu-ancestor > a {
        color: var(--color-one);
    }
    .desktop-menu > li.menu-item-has-children > a:after {
        content: "";
        display: inline-block;
        width: 7px;
        height: 7px;
        margin-left: 8px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg) translateY(-3px);
    }

    /* Submenus: hidden until hover or keyboard focus. pointer-events keeps
       hidden/fading panels from capturing the cursor and (re)opening. */
    .desktop-menu .sub-menu {
        list-style: none;
        margin: 0;
        padding: 0;
        position: absolute;
        top: 100%;
        background: #fff;
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.2s ease, visibility 0.2s ease;
        z-index: 1000;
    }
    .desktop-menu li:hover > .sub-menu,
    .desktop-menu li:focus-within > .sub-menu {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    /* hover intent: the full-width mega panel only opens after a pause, so
       grazing Procedures while heading elsewhere doesn't trigger it */
    .desktop-menu > li.nav-mega:hover > .sub-menu,
    .desktop-menu > li.nav-mega:focus-within > .sub-menu {
        transition-delay: 0.18s;
    }

    /* Simple dropdown (children only) */
    .desktop-menu > li.nav-dropdown {
        position: relative;
    }
    .desktop-menu > li.nav-dropdown > .sub-menu {
        min-width: 260px;
        padding: 10px 0;
    }
    .desktop-menu > li.nav-dropdown > .sub-menu a {
        display: block;
        padding: 9px 24px;
        color: #000;
        font-size: 15px;
        text-decoration: none;
    }
    .desktop-menu > li.nav-dropdown > .sub-menu a:hover,
    .desktop-menu > li.nav-dropdown > .sub-menu a:focus {
        background: var(--color-one);
        color: #fff;
    }

    /* Megamenu panel (has grandchildren, e.g. Procedures): a left rail of
       section headings; the hovered/focused section's links fly out in the
       pane to its right. The first section's links show until another
       section is hovered (the :has() rules below). */
    .desktop-menu > li.nav-mega {
        position: static;
    }
    .desktop-menu > li.nav-mega > .sub-menu {
        left: 0;
        right: 0;
        padding: 18px 0;
        /* safety net: never extend past the viewport; scroll inside instead */
        max-height: calc(100vh - 240px);
        min-height: min(480px, calc(100vh - 240px));
        overflow-y: auto;
    }
    /* left rail: section headings */
    .desktop-menu > li.nav-mega > .sub-menu > li > a {
        display: block;
        width: 300px;
        padding: 12px 48px 12px 40px;
        position: relative;
        font-weight: 600;
        text-transform: uppercase;
        font-size: 14px;
        letter-spacing: 0.04em;
        color: #000;
        text-decoration: none;
    }
    .desktop-menu > li.nav-mega > .sub-menu > li.menu-item-has-children > a:after {
        content: "";
        position: absolute;
        right: 26px;
        top: 50%;
        width: 7px;
        height: 7px;
        border-right: 2px solid currentColor;
        border-top: 2px solid currentColor;
        transform: translateY(-50%) rotate(45deg);
    }
    .desktop-menu > li.nav-mega > .sub-menu > li:hover > a,
    .desktop-menu > li.nav-mega > .sub-menu > li:focus-within > a {
        color: var(--color-one);
        background: rgba(0, 0, 0, 0.04);
    }
    /* right pane: the section's links, contiguous with the rail so the
       cursor never crosses a gap that would close the flyout */
    .desktop-menu .nav-mega .sub-menu .sub-menu {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 300px;
        right: 0;
        box-shadow: none;
        border-left: 1px solid rgba(0, 0, 0, 0.1);
        padding: 18px 40px;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        align-content: start;
        column-gap: 32px;
        overflow-y: auto;
        background: #fff;
    }
    .desktop-menu .nav-mega .sub-menu .sub-menu a {
        display: block;
        padding: 8px 0;
        color: #222;
        font-size: 15px;
        text-decoration: none;
    }
    .desktop-menu .nav-mega .sub-menu .sub-menu a:hover,
    .desktop-menu .nav-mega .sub-menu .sub-menu a:focus {
        color: var(--color-one);
    }
    /* default state: while the panel is open and no section is hovered or
       focused, the first section shows. Must be scoped to the open panel:
       an always-on visibility:visible child of the hidden panel would be
       invisible (opacity) yet still hit-testable below the nav bar. */
    .desktop-menu > li.nav-mega:hover > .sub-menu:not(:has(> li:hover, > li:focus-within)) > li:first-child > a,
    .desktop-menu > li.nav-mega:focus-within > .sub-menu:not(:has(> li:hover, > li:focus-within)) > li:first-child > a {
        color: var(--color-one);
    }
    .desktop-menu > li.nav-mega:hover > .sub-menu:not(:has(> li:hover, > li:focus-within)) > li:first-child > .sub-menu,
    .desktop-menu > li.nav-mega:focus-within > .sub-menu:not(:has(> li:hover, > li:focus-within)) > li:first-child > .sub-menu {
        opacity: 1;
        visibility: visible;
    }
}

/* Nav bar fit: tighter spacing below ~1500px so all nine items stay on one row */
@media (min-width: 1200px) and (max-width: 1499px) {
    ul.desktop-menu {
        column-gap: 18px;
    }
    .desktop-menu > li > a {
        font-size: 14px;
    }
}

/* The logo row is crowded at these widths too (social icons + search + phone
   + two buttons); drop the decorative social icons until there is room */
@media (min-width: 1200px) and (max-width: 1599px) {
    .header-center {
        display: none;
    }
}

/* ==========================================================================
   Home hero: stacked layout (child override of .home-banner)
   Markup: includes/home-sections/home-banner.php
   Intro text + buttons centered on a light bg; contained 16:9 video below.
   ========================================================================== */
.home-banner.home-banner--stacked {
    height: auto;
    min-height: 0;
    display: block;
    padding: 64px 0 80px;
    background: #fff;
    color: #1a1a1a;
    overflow: visible;
}
/* kill the parent's full-bleed dark overlay (.home-banner:before) */
.home-banner.home-banner--stacked:before {
    content: none;
}
.home-banner--stacked .banner-content {
    max-width: 780px;
    margin: 0 auto;
    padding-top: 0;
}
.home-banner--stacked .banner-subtitle {
    color: var(--color-one);
    letter-spacing: 4px;
    text-transform: uppercase;
    font-size: 18px;
    margin-bottom: 12px;
}
.home-banner--stacked .banner-title {
    color: #1a1a1a;
    font-size: 56px;
    line-height: 1.05;
    text-transform: uppercase;
    font-family: var(--font-two);
    margin: 0 0 18px;
}
.home-banner--stacked .banner-description {
    font-size: 18px;
    line-height: 1.6;
    color: #444;
    max-width: 680px;
    margin: 0 auto 30px;
}
.home-banner--stacked .banner-btns {
    display: flex;
    gap: 18px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 50px;
}
/* outline variant of .btn for a light background (button two) */
.home-banner--stacked .banner-btns .btn-stacked-outline {
    background-color: transparent;
    color: var(--color-one);
    border: 1px solid var(--color-one);
}
.home-banner--stacked .banner-btns .btn-stacked-outline:hover {
    background-color: var(--color-one);
    color: #fff;
}
/* contained video panel */
.home-banner--stacked .banner-video-wrap {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
}
.home-banner--stacked .banner-video-el {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.home-banner--stacked .banner-video-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.12);
    transition: background 0.2s ease;
}
.home-banner--stacked .banner-video-play:hover {
    background: rgba(0, 0, 0, 0.28);
}
.home-banner--stacked .banner-video-play .play-icon {
    width: 78px;
    height: 78px;
}
@media (max-width: 991px) {
    .home-banner--stacked .banner-title { font-size: 44px; }
}
@media (max-width: 767px) {
    .home-banner.home-banner--stacked { padding: 40px 0 56px; }
    .home-banner--stacked .banner-title { font-size: 34px; }
    .home-banner--stacked .banner-subtitle { font-size: 15px; letter-spacing: 3px; }
    .home-banner--stacked .banner-description { font-size: 16px; }
}

/* ==========================================================================
   Prevent horizontal overflow / sideways scroll.
   The parent theme's slick carousels (e.g. home blog/reviews) and a couple of
   Bootstrap rows extend a few px past the viewport on small screens, causing a
   sideways scroll. Clip it at the root — the standard, low-risk fix. The fixed
   header and off-canvas (.menu-wrap) menu are position:fixed, so they are not
   affected by this.
   ========================================================================== */
html,
body {
    overflow-x: hidden;
    max-width: 100%;
}

/* ==========================================================================
   Accessibility (replacing the removed UserWay overlay with real a11y)
   ========================================================================== */
/* Visually-hidden utility + skip-to-content link (becomes visible on focus). */
.screen-reader-text {
    position: absolute !important;
    width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 100001;
    background: #fff; color: #000; padding: 12px 18px; font-weight: 600;
    border-radius: 0 0 4px 0;
}
.skip-link:focus { left: 0; outline: 3px solid var(--color-one, #6c5ce7); }

/* Visible keyboard focus (the parent theme suppresses outlines in places). */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--color-one, #6c5ce7);
    outline-offset: 2px;
}

/* In-content text links must be distinguishable without color (axe: link-in-text-block). */
#main p a:not(.btn):not([class*="btn"]) { text-decoration: underline; }

/* Breadcrumb links must be distinguishable without color (axe: link-in-text-block). */
.breadcrumb a, #breadcrumbs a { text-decoration: underline !important; }

/* ==========================================================================
   Static search (Pagefind) overlay
   The parent .search-panel is a fixed 105px-tall white bar built for a single
   WP search input. Pagefind renders a full results LIST, which overflowed below
   that 105px and showed over the page on a transparent background. The panel is
   shown/hidden purely by an inline transform (translateY 0 / -100%) — it does NOT
   get an `.open` class — so style the base element: make it a full-height,
   scrollable, opaque overlay. When closed it's a 100vh box translated fully off
   the top of the viewport, so it stays hidden and non-interactive.
   ========================================================================== */
.search-panel {
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    background-color: #fff;
    display: block;          /* flow results top->bottom (parent had flex centering) */
    padding: 5rem 1.5rem 4rem;
    -webkit-overflow-scrolling: touch;
}
#pagefind-search {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    text-align: left;
}
/* Pagefind UI sits on the opaque panel; keep its own surface transparent. */
#pagefind-search .pagefind-ui__results-area,
#pagefind-search .pagefind-ui__result { background: transparent; }

/* Close button: parent colors it white (invisible on the now-white panel). */
.search-panel .search-close { color: #333; }
.search-panel .search-close:hover { color: #000; }
