/* MVZ Roth — Site chrome: header, navigation, footer, breadcrumb hero, quick nav, cookie banner.
   Part of the MVZ Roth theme. Cascade layer: layout (order declared in style.css). */
@layer layout {
    /* =========================================================================
       HEADER
       ========================================================================= */
    .site-header {
        position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
        background: rgba(250, 247, 242, 0.85);
        backdrop-filter: saturate(180%) blur(20px);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        border-bottom: 1px solid transparent;
        transition: all var(--t-base) var(--ease);
    }
    .site-header.scrolled {
        background: rgba(250, 247, 242, 0.95);
        border-bottom-color: var(--line);
    }
    .admin-bar .site-header { top: 32px; }
    @media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }
    
    .header-inner {
        display: flex; align-items: center; justify-content: space-between;
        max-width: var(--container-wide); margin: 0 auto;
        padding: var(--space-4) var(--gutter);
    }
    .logo { display: inline-flex; align-items: center; }
    .logo img { height: 38px; width: auto; filter: brightness(0) saturate(100%) invert(18%) sepia(31%) saturate(1462%) hue-rotate(155deg) brightness(94%) contrast(91%); transition: opacity var(--t-fast); }
    .logo:hover img { opacity: 0.7; }
    
    /* Main nav */
    .main-nav {
        display: flex; align-items: center; gap: var(--space-1);
        background: rgba(255, 255, 255, 0.6);
        border: 1px solid var(--line);
        border-radius: var(--r-pill);
        padding: var(--space-1);
    }
    .main-nav > li { position: relative; }
    .main-nav > li > a {
        display: block;
        padding: var(--space-2) var(--space-4);
        font-size: var(--text-sm); font-weight: 500;
        color: var(--ink); border-radius: var(--r-pill);
        transition: all var(--t-fast) var(--ease);
        letter-spacing: -0.01em;
    }
    .main-nav > li > a:hover,
    .main-nav > li.current-menu-item > a,
    .main-nav > li.current-menu-ancestor > a {
        color: var(--ink-deep); background: var(--pure-white);
        box-shadow: var(--shadow-xs);
    }
    /*
     * No ::after chevron on the parent link.
     *
     * Version 2 drew the dropdown indicator here, as decoration on the <a>.
     * Version 3 added a real .submenu-toggle button that carries its own
     * chevron, owns `aria-expanded` and rotates when the menu opens — so
     * keeping this rule produced two arrows per menu item, one of them inert.
     * The button's icon is the only indicator now: it is the thing that
     * actually responds to the pointer and the keyboard.
     */
    
    .dropdown,
    .main-nav .sub-menu {
        position: absolute; top: calc(100% + 8px); left: 0;
        min-width: 240px;
        background: var(--pure-white);
        border-radius: var(--r-lg);
        box-shadow: var(--shadow-lg);
        padding: var(--space-3);
        opacity: 0; visibility: hidden;
        transform: translateY(8px) scale(0.96);
        transform-origin: top left;
        transition: all var(--t-base) var(--ease);
        list-style: none;
        border: 1px solid var(--line);
    }
    .has-dropdown:hover .dropdown,
    .has-dropdown:focus-within .dropdown,
    .main-nav > li.menu-item-has-children:hover > .sub-menu,
    .main-nav > li.menu-item-has-children:focus-within > .sub-menu {
        opacity: 1; visibility: visible; transform: translateY(0) scale(1);
    }
    .dropdown a,
    .main-nav .sub-menu a {
        display: block; padding: var(--space-3) var(--space-4);
        border-radius: var(--r-sm);
        font-size: var(--text-sm); color: var(--ink-soft);
        transition: all var(--t-fast) var(--ease);
    }
    .dropdown a:hover,
    .main-nav .sub-menu a:hover,
    .main-nav .sub-menu .current-menu-item > a {
        background: var(--paper); color: var(--teal);
        transform: translateX(2px);
    }
    
    .nav-cta a,
    .main-nav > li.nav-cta > a {
        background: var(--ink-deep) !important; color: var(--paper) !important;
        padding: var(--space-2) var(--space-5) !important;
        border-radius: var(--r-pill) !important;
        font-weight: 500 !important;
    }
    .nav-cta a:hover,
    .main-nav > li.nav-cta > a:hover {
        background: var(--teal) !important; box-shadow: var(--shadow-sm) !important;
    }
    
    /* Hamburger */
    .hamburger {
        display: none; background: none; border: none;
        width: 44px; height: 44px; position: relative; z-index: 1001;
        border-radius: var(--r-pill);
        transition: background var(--t-fast);
    }
    .hamburger:hover { background: var(--line); }
    .hamburger span {
        display: block; width: 22px; height: 1.5px; background: var(--ink-deep);
        position: absolute; left: 11px; transition: all var(--t-base) var(--ease);
        border-radius: 2px;
    }
    .hamburger span:nth-child(1) { top: 14px; }
    .hamburger span:nth-child(2) { top: 21px; }
    .hamburger span:nth-child(3) { top: 28px; }
    .hamburger.open span:nth-child(1) { transform: rotate(45deg); top: 21px; }
    .hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
    .hamburger.open span:nth-child(3) { transform: rotate(-45deg); top: 21px; }
    
    .mobile-nav {
        /*
         * Parked with a transform, not `right: -110%`.
         * An element pushed off-screen with a positional offset still counts
         * toward the document's scroll width, which added ~55px of phantom
         * horizontal scrolling at 320px — a WCAG 1.4.10 (Reflow) failure that
         * the old `body { overflow-x: hidden }` merely hid, at the cost of
         * breaking position:sticky everywhere. A transform never affects
         * layout, and it animates on the compositor instead of forcing a
         * relayout on every frame.
         */
        position: fixed; top: 0; right: 0; width: min(380px, 88vw); height: 100dvh;
        background: var(--paper); z-index: 999;
        padding: 100px var(--space-6) var(--space-10);
        overflow-y: auto;
        overscroll-behavior: contain;
        transform: translateX(105%);
        visibility: hidden;
        transition: transform var(--t-slow) var(--ease), visibility 0s linear var(--t-slow);
        box-shadow: -20px 0 80px rgba(0, 0, 0, 0.15);
    }
    .mobile-nav.open {
        transform: none;
        visibility: visible;
        transition: transform var(--t-slow) var(--ease), visibility 0s;
    }
    .mobile-overlay {
        position: fixed; inset: 0;
        background: rgba(10, 21, 24, 0.4);
        backdrop-filter: blur(4px);
        z-index: 998;
        opacity: 0; visibility: hidden;
        transition: all var(--t-base) var(--ease);
    }
    .mobile-overlay.open { opacity: 1; visibility: visible; }
    .mobile-nav a {
        display: block; padding: var(--space-4) 0;
        font-size: var(--text-lg); font-weight: 500;
        color: var(--ink); border-bottom: 1px solid var(--line);
        transition: color var(--t-fast), padding-left var(--t-fast);
    }
    .mobile-nav a:hover { color: var(--teal); padding-left: var(--space-2); }
    .mobile-nav .sub-label {
        display: block; font-size: var(--text-xs); text-transform: uppercase;
        letter-spacing: 0.16em; color: var(--ink-mute);
        margin-top: var(--space-6); padding-bottom: var(--space-2); border: none;
        font-family: var(--font-body);
    }
    .mobile-nav .sub-link { padding-left: var(--space-4); font-size: var(--text-base); }
    

    /* =========================================================================
       SUBPAGE HERO
       ========================================================================= */
    .page-hero {
        position: relative;
        padding: clamp(8rem, 14vw, 11rem) 0 var(--space-16);
        background: var(--paper);
        overflow: hidden;
    }
    .page-hero::before {
        content: ''; position: absolute;
        top: -10%; right: -15%; width: 50%; height: 70%;
        background: radial-gradient(circle, var(--clay-pale) 0%, transparent 60%);
        opacity: 0.5; pointer-events: none;
    }
    .page-hero::after {
        content: ''; position: absolute;
        bottom: -30%; left: -10%; width: 40%; height: 70%;
        background: radial-gradient(circle, var(--teal-pale) 0%, transparent 60%);
        opacity: 0.6; pointer-events: none;
    }
    .page-hero .container { position: relative; z-index: 2; }
    .page-hero h1 {
        font-size: var(--text-5xl);
        color: var(--ink-deep);
        margin-bottom: var(--space-4);
        line-height: 1.0;
        letter-spacing: -0.03em;
    }
    .page-hero h1 em { font-style: italic; color: var(--teal); }
    .page-hero-desc {
        font-size: var(--text-lg);
        color: var(--ink-soft);
        max-width: 640px;
        line-height: 1.5;
    }
    
    .breadcrumb {
        display: inline-flex; align-items: center; gap: var(--space-2);
        margin-bottom: var(--space-6);
        font-size: var(--text-xs); font-weight: 500;
        color: var(--ink-mute); text-transform: uppercase;
        letter-spacing: 0.12em;
        padding: var(--space-2) var(--space-4);
        background: var(--paper-warm);
        border-radius: var(--r-pill);
        border: 1px solid var(--line);
    }
    .breadcrumb a { color: var(--ink-soft); }
    .breadcrumb a:hover { color: var(--teal); }
    .breadcrumb span { color: var(--ink-mute); }
    .breadcrumb span[aria-hidden] { opacity: 0.4; }
    .breadcrumb span[aria-current] { color: var(--ink); }
    

    /* =========================================================================
       QUICK NAV (subpage)
       ========================================================================= */
    .quick-nav {
        background: var(--paper);
        border-bottom: 1px solid var(--line);
        padding: var(--space-4) 0;
        position: sticky; top: var(--header-h); z-index: 50;
        backdrop-filter: blur(20px);
        background: rgba(250, 247, 242, 0.9);
    }
    .admin-bar .quick-nav { top: calc(var(--header-h) + 32px); }
    .quick-nav .container {
        display: flex; align-items: center; gap: var(--space-2);
        flex-wrap: wrap;
    }
    .quick-nav-label {
        font-family: var(--font-display); font-style: italic;
        font-size: var(--text-base); color: var(--teal);
        margin-right: var(--space-3); white-space: nowrap;
    }
    .quick-nav a {
        font-size: var(--text-sm); font-weight: 500;
        color: var(--ink-soft);
        padding: var(--space-2) var(--space-4);
        border-radius: var(--r-pill);
        border: 1px solid var(--line);
        transition: all var(--t-fast) var(--ease);
        white-space: nowrap;
        background: var(--paper);
    }
    .quick-nav a:hover,
    .quick-nav a.active {
        background: var(--ink-deep); color: var(--paper); border-color: var(--ink-deep);
    }
    

    /* =========================================================================
       FOOTER
       ========================================================================= */
    .site-footer {
        background: var(--ink-deep);
        color: rgba(250, 247, 242, 0.7);
        padding: var(--space-24) 0 var(--space-8);
        position: relative;
        overflow: hidden;
    }
    .site-footer::before {
        content: ''; position: absolute;
        top: -50%; right: -10%; width: 600px; height: 600px;
        background: radial-gradient(circle, var(--teal) 0%, transparent 70%);
        opacity: 0.15; filter: blur(80px); pointer-events: none;
    }
    .footer-grid {
        display: grid; grid-template-columns: 2.2fr 1fr 1fr 1.2fr;
        gap: var(--space-16);
        padding-bottom: var(--space-16);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        position: relative;
    }
    .footer-brand img,
    .footer-brand .custom-logo-link img {
        height: 32px; width: auto;
        filter: brightness(0) invert(1);
        margin-bottom: var(--space-5);
    }
    .footer-brand p {
        font-size: var(--text-sm); line-height: 1.7;
        color: rgba(250, 247, 242, 0.65);
        max-width: 380px;
    }
    .footer-col h4 {
        font-family: var(--font-body);
        font-size: var(--text-xs); font-weight: 500;
        color: var(--paper); text-transform: uppercase;
        letter-spacing: 0.16em;
        margin-bottom: var(--space-5);
    }
    .footer-col a {
        display: block;
        font-size: var(--text-sm);
        color: rgba(250, 247, 242, 0.6);
        padding: var(--space-2) 0;
        transition: all var(--t-fast) var(--ease);
    }
    .footer-col a:hover {
        color: var(--clay-soft); padding-left: var(--space-2);
    }
    .footer-bottom {
        display: flex; justify-content: space-between; align-items: center;
        padding-top: var(--space-8);
        font-size: var(--text-xs);
        flex-wrap: wrap; gap: var(--space-4);
        color: rgba(250, 247, 242, 0.5);
    }
    .footer-legal { display: flex; gap: var(--space-6); }
    .footer-legal a {
        color: rgba(250, 247, 242, 0.5);
        transition: color var(--t-fast);
    }
    .footer-legal a:hover { color: var(--clay-soft); }
    

    /* =========================================================================
       SCROLL TO TOP
       ========================================================================= */
    .scroll-top {
        position: fixed; bottom: var(--space-8); right: var(--space-8);
        width: 48px; height: 48px;
        background: var(--ink-deep); color: var(--paper);
        border: none; border-radius: 50%;
        display: flex; align-items: center; justify-content: center;
        font-size: var(--text-base);
        box-shadow: var(--shadow);
        opacity: 0; visibility: hidden;
        transition: all var(--t-base) var(--ease);
        z-index: 900;
    }
    .scroll-top.visible { opacity: 1; visibility: visible; }
    .scroll-top:hover {
        background: var(--teal);
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
    }
    

    /* =========================================================================
       COOKIE BANNER
       ========================================================================= */
    .cookie-banner {
        position: fixed; bottom: var(--space-6); left: var(--space-6); right: var(--space-6);
        max-width: 720px; margin: 0 auto;
        background: var(--ink-deep);
        color: var(--paper);
        border-radius: var(--r-lg);
        padding: var(--space-6) var(--space-8);
        z-index: 10000;
        box-shadow: var(--shadow-lg);
        display: none;
    }
    .cookie-banner.active { display: block; animation: cookieIn 600ms var(--ease) both; }
    @keyframes cookieIn {
        from { opacity: 0; transform: translateY(20px); }
        to { opacity: 1; transform: translateY(0); }
    }
    .cookie-inner {
        display: flex; align-items: center; gap: var(--space-6);
        flex-wrap: wrap;
    }
    .cookie-inner p {
        flex: 1; min-width: 280px;
        font-size: var(--text-sm); line-height: 1.6;
        color: rgba(250, 247, 242, 0.85); margin: 0;
    }
    .cookie-inner a {
        color: var(--clay-soft); text-decoration: underline;
        text-underline-offset: 3px;
    }
    .cookie-btns { display: flex; gap: var(--space-3); flex-shrink: 0; }
    .cookie-btns button {
        padding: var(--space-3) var(--space-5);
        border: none; border-radius: var(--r-pill);
        font-family: var(--font-body);
        font-size: var(--text-sm); font-weight: 500;
        cursor: pointer; transition: all var(--t-base) var(--ease);
    }
    .btn-accept { background: var(--paper); color: var(--ink-deep); }
    .btn-accept:hover { background: var(--clay-soft); transform: translateY(-2px); }
    .btn-decline {
        background: transparent; color: rgba(250, 247, 242, 0.7);
        border: 1px solid rgba(250, 247, 242, 0.2) !important;
    }
    .btn-decline:hover { border-color: var(--paper) !important; color: var(--paper); }
    

    /* =========================================================================
       RESPONSIVE — layout
       ========================================================================= */
    @media (max-width: 1100px) {
        .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; }
        .footer-grid > :nth-child(4) { grid-column: span 3; padding-top: var(--space-4); border-top: 1px solid rgba(255,255,255,0.08); margin-top: var(--space-4); }
        /* Tighten the nav pill so seven top-level items never overflow on mid-size laptops */
        .main-nav { gap: 0; padding: 4px; }
        .main-nav > li > a { padding: var(--space-2) var(--space-3); }
        .main-nav > li.nav-cta > a { padding: var(--space-2) var(--space-4); }
    }
    
    @media (max-width: 980px) {
        .main-nav { display: none; }
        .hamburger { display: block; }
    }
    
    @media (max-width: 720px) {
        .footer-grid { grid-template-columns: 1fr; gap: var(--space-10); }
        .footer-grid > :nth-child(4) { grid-column: span 1; border-top: none; padding-top: 0; margin-top: 0; }
        .footer-bottom { flex-direction: column; text-align: center; }
        .quick-nav .container {
            overflow-x: auto; flex-wrap: nowrap;
            scrollbar-width: none; -ms-overflow-style: none;
        }
        .quick-nav .container::-webkit-scrollbar { display: none; }
        .cookie-banner { left: var(--space-3); right: var(--space-3); bottom: var(--space-3); padding: var(--space-5); }
        .cookie-btns { width: 100%; }
        .cookie-btns button { flex: 1; }
    }


/* -------------------------------------------------------------------------
   Markup refinements (v3)
   ---------------------------------------------------------------------- */

/* Breadcrumb is now an ordered list. Separators are generated, so assistive
   tech never reads them, and the list conveys depth. */
.breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    list-style: none;
    margin: 0;
    padding: 0;
}
.breadcrumb li { display: flex; align-items: center; gap: var(--space-2); }
.breadcrumb li + li::before {
    content: '/';
    color: var(--ink-mute);
    opacity: 0.4;
}
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb a:hover { color: var(--teal); }
.breadcrumb [aria-current] { color: var(--ink); }

/* Submenu toggle button. The parent link still navigates; this owns the open
   state. Sized to a 24px target without disturbing the nav pill's height. */
/* The toggle sits beside its label, not under it: the list item becomes a
   flex row so the chevron stays on the same line as the menu text. */
.main-nav > li,
.main-nav > li.has-dropdown,
.main-nav > li.menu-item-has-children {
    display: flex;
    align-items: center;
    position: relative;
}

.submenu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-inline-start: -4px;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 50%;
    color: inherit;
    vertical-align: middle;
}
.submenu-toggle-icon {
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    /* A rotated square's visual centre sits below its box centre; nudge it up
       so the chevron lines up with the menu label's cap height. */
    margin-block-start: -3px;
    transform: rotate(45deg);
    transition: transform var(--t-fast) var(--ease);
}
.has-dropdown.is-open > .submenu-toggle .submenu-toggle-icon,
.menu-item-has-children.is-open > .submenu-toggle .submenu-toggle-icon {
    transform: translateY(1px) rotate(-135deg);
}
.has-dropdown.is-open > .dropdown,
.has-dropdown.is-open > .sub-menu,
.menu-item-has-children.is-open > .sub-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
}

/* The mobile panel renders either a wp_nav_menu list or the theme fallback's
   flat links; both need the same look. */
.mobile-nav .mobile-menu { list-style: none; margin: 0; padding: 0; }
.mobile-nav .mobile-menu .sub-menu { list-style: none; margin: 0; padding: 0; }
.mobile-nav .mobile-menu > li > a { font-size: var(--text-xl); }
.mobile-nav .mobile-menu .sub-menu a { font-size: var(--text-base); opacity: 0.8; }
.mobile-nav h2.sub-label {
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--teal-pale);
    opacity: 0.6;
}

/* Footer column headings are real headings now, styled to match the old h4. */
.footer-col-title {
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--paper);
    opacity: 0.55;
    margin-bottom: var(--space-4);
}
.footer-widgets {
    margin-top: var(--space-10);
    padding-top: var(--space-8);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.footer-legal ul { display: flex; gap: var(--space-6); list-style: none; margin: 0; padding: 0; }

/* The scroll-to-top button now carries an SVG rather than an arrow glyph. */
.scroll-top svg { transform: rotate(-90deg); }

}
