/* Modern navigation styles */
.main-nav {
    background-color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
}
.nav-container {
    max-width: none;
    margin: 0;
    padding-left: 1.5rem;
    /* Reserve space for the appointment link even when hidden */
    padding-right: 12rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: var(--nav-height);
}

/* Ensure the logo anchors to the left side */
.logo-link {
    margin-right: auto;
    display: flex;
    align-items: center;
}
.logo {
    height: 80px;
    width: auto;
}
.cmp-navigation__group {
    list-style: none;
    display: flex;
    margin: 0;
    margin-left: auto;
    padding: 0;
    gap: 1rem;
    align-items: center;
}

#nav-links {
    margin-left: auto;
    justify-content: flex-end;
    align-self: flex-end;
    margin-bottom: 0.5rem;
}
.cmp-navigation__item-link {
    position: relative;
    text-decoration: none;
    color: #2b2b2b;
    font-family: var(--font-family, 'Segoe UI', sans-serif);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0;
    transition: color 0.25s ease;
}
/* Animated green underline that grows on hover / for the current page. */
.cmp-navigation__item-link::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.2rem;
    height: 2px;
    background: #2f6b3a;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.25s ease;
}
.cmp-navigation__item-link:hover {
    color: var(--primary-color);
}
.cmp-navigation__item-link:hover::before,
.cmp-navigation__item-link.is-active::before {
    transform: scaleX(1);
}
.cmp-navigation__item-link.is-active {
    color: var(--primary-color);
    font-weight: 600;
}

.dropdown {
    position: relative;
}

/* Caret indicating the Services item expands (the markup uses BEM classes,
   so the old .nav-link caret never applied). */
.dropdown > .cmp-navigation__item-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
}
.dropdown > .cmp-navigation__item-link::after {
    content: '';
    width: 0.42em;
    height: 0.42em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-0.15em) rotate(45deg);
    transition: transform 0.25s ease;
}
.dropdown.open > .cmp-navigation__item-link::after {
    transform: translateY(0.05em) rotate(-135deg);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    list-style: none;
    padding: 0.35rem 0;
    box-shadow: 0 10px 24px rgba(0,0,0,0.14);
    border-radius: 0 0 8px 8px;
    border-top: 3px solid #2f6b3a;
    min-width: 230px;
    overflow: hidden;
}
.dropdown.open .dropdown-menu {
    display: block;
    /* The legacy styles.css hides .dropdown-menu with opacity/visibility and
       only un-hides on :hover — the tap-toggled .open state (mobile drawer)
       must reset those too or the open submenu renders as blank space. */
    opacity: 1;
    visibility: visible;
    transform: none;
}
/* Hover-driven dropdowns ONLY for real mice: on touch screens a tap sets a
   STICKY :hover that fights the tap-toggled .open state — the submenu gets
   held open by the stuck hover and taps appear to stop responding. */
@media (hover: hover) and (pointer: fine) {
    .dropdown:hover > .cmp-navigation__item-link::after {
        transform: translateY(0.05em) rotate(-135deg);
    }
    .dropdown:hover .dropdown-menu {
        display: block;
        opacity: 1;
        visibility: visible;
        transform: none;
        animation: nav-dropdown-in 0.2s ease;
    }
}
@keyframes nav-dropdown-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Submenu items read as a menu, not shouty nav links. */
.dropdown-menu .cmp-navigation__item { width: 100%; }
.dropdown-menu .cmp-navigation__item-link {
    display: block;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    font-size: 0.9rem;
    padding: 0.55rem 1.1rem;
    white-space: nowrap;
    color: #333;
}
.dropdown-menu .cmp-navigation__item-link::before { display: none; }
.dropdown-menu .cmp-navigation__item-link:hover,
.dropdown-menu .cmp-navigation__item-link.is-active {
    background: #f1f6f2;
    color: var(--primary-color);
}
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}
.menu-icon,
.menu-icon::before,
.menu-icon::after {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #333;
    position: relative;
    transition: transform 0.3s;
}
.menu-icon::before,
.menu-icon::after {
    content: '';
    position: absolute;
    left: 0;
}
.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }
.mobile-menu-btn.active .menu-icon { background-color: transparent; }
.mobile-menu-btn.active .menu-icon::before { transform: rotate(45deg); top: 0; }
.mobile-menu-btn.active .menu-icon::after { transform: rotate(-45deg); top: 0; }
/* Switch to the drawer menu on tablets too — the full horizontal nav does not
   fit until ~1024px, so between 769–1024px it used to overflow and clip links. */
@media (max-width: 1024px) {
    .nav-container {
        padding-left: 1rem;
        padding-right: 1rem;
        /* Even white space around the compact logo: 52px logo + 14px above
           and below = the 80px mobile nav height, nothing overflowing. */
        padding-top: 14px;
        padding-bottom: 14px;
    }
    .logo { height: 52px; }
    .mobile-menu-btn { display: block; }
    #nav-links {
        position: fixed;
        top: var(--nav-height);
        right: -100%;
        width: min(80vw, 320px);
        height: calc(100vh - var(--nav-height));
        background: #fff;
        flex-direction: column;
        padding: 0.5rem 0 1rem;
        margin-left: 0;
        align-self: flex-start;
        margin-bottom: 0;
        padding-top: 0;
        box-shadow: -4px 0 16px rgba(0,0,0,0.18);
        justify-content: flex-start;
        transition: right 0.3s ease;
        overflow-y: auto;
    }
    #nav-links.show-mobile { right: 0; }

    /* The desktop group's gap/centering is horizontal spacing between
       top-level links; in the vertical drawer it splits every row (and the
       submenu) apart by 1rem of dead space. */
    #nav-links,
    #nav-links .dropdown-menu {
        gap: 0;
        align-items: stretch;
    }

    /* Full-width, evenly spaced, divided rows — reads as a real mobile menu. */
    #nav-links .cmp-navigation__item {
        width: 100%;
        border-top: 1px solid #eee;
    }
    #nav-links .cmp-navigation__item:first-child { border-top: none; }
    #nav-links .cmp-navigation__item-link {
        display: block;
        padding: 0.95rem 1.25rem;
        font-size: 1rem;
        box-shadow: inset 0 0 0 0 #2f6b3a;
        transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    }
    /* No sliding underline in the drawer — use a left accent bar instead. */
    #nav-links .cmp-navigation__item-link::before { display: none; }
    #nav-links .cmp-navigation__item-link:hover,
    #nav-links .cmp-navigation__item-link.is-active {
        background: #f1f6f2;
        color: var(--primary-color);
        box-shadow: inset 3px 0 0 0 #2f6b3a;
    }

    /* Services caret sits at the right edge of the row in the drawer.
       Must re-assert flex: the drawer's `#nav-links .cmp-navigation__item-link
       { display:block }` (ID selector) outranks the desktop `.dropdown > …
       { display:inline-flex }`, and a transform never applies to an inline
       pseudo-element — leaving the chevron's un-rotated 2px right border
       rendering as a stray "|" after the label. */
    #nav-links .dropdown > .cmp-navigation__item-link {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    /* Submenu as an indented accordion panel. */
    .dropdown-menu {
        position: static;
        box-shadow: none;
        border-top: none;
        border-radius: 0;
        background: #f7f9f7;
        min-width: 0;
        padding: 0;
    }
    .dropdown-menu .cmp-navigation__item-link { padding: 0.75rem 1.25rem 0.75rem 2rem; }
    .appointment-link { display: none; }

    /* Dim the page behind the open drawer (JS toggles body.no-scroll). */
    body.no-scroll::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 999;
        animation: nav-backdrop-in 0.3s ease;
    }
}

@keyframes nav-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.appointment-link {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 0.5rem 1.2rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    color: #dfdfd8;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    z-index: 1101;
    animation: gentle-bounce 2.5s ease-in-out infinite;
    transition: background 0.3s ease;
}

.appointment-link:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}


@keyframes gentle-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}
