/* =========================================================
   NAVBAR FLEXBOX FIX  (loaded last on every page)
   ---------------------------------------------------------
   Root cause: .logo was given a fixed width (300px / 365px)
   while the brand title is white-space:nowrap and wider than
   that box, so it spilled into the "Home" link. Several older
   rules also pushed the nav/button with translateX() and
   margins.

   Fix: logo = natural width (never overflows), nav = takes the
   remaining space, Book Appointment = far right. No transforms,
   no fixed widths, no negative margins.
   Font sizes, colours and the mobile (<=991px) menu are untouched.
========================================================= */

@media (min-width: 992px) {

    header .navbar,
    body.inner-page > header .navbar {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: min(94%, 1400px) !important;
        max-width: none !important;
        margin-left: auto !important;
        margin-right: auto !important;
        gap: clamp(14px, 1.6vw, 28px) !important;
        overflow: visible !important;
    }

    /* Logo: only as wide as its content, never shrinks, never overlaps */
    header .navbar > .logo,
    body.inner-page > header .navbar > .logo {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        transform: none !important;
    }

    header .navbar > .logo .brand-link {
        flex-wrap: nowrap !important;
    }

    header .navbar > .logo .brand-title {
        white-space: nowrap !important;
    }

    /* Navigation: fills the remaining space, items packed to the right
       with one equal gap between every item */
    header .navbar > nav,
    body.inner-page > header .navbar > nav {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        margin: 0 !important;
        transform: none !important;
        display: flex !important;
        justify-content: flex-end !important;
    }

    header .navbar > nav .nav-links,
    body.inner-page > header .navbar > nav .nav-links {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-end !important;
        width: auto !important;
        margin: 0 !important;
        padding-left: 0 !important;
        gap: clamp(8px, 1.3vw, 26px) !important;
    }

    header .navbar > nav .nav-links > li {
        flex: 0 0 auto !important;
        margin: 0 !important;
    }

    header .navbar > nav .nav-links > li > a {
        white-space: nowrap !important;
    }

    /* Book Appointment: always the last flex item, far right */
    header .navbar > .contact-btn,
    body.inner-page > header .navbar > .contact-btn {
        flex: 0 0 auto !important;
        margin: 0 !important;
        transform: none !important;
        white-space: nowrap !important;
    }

    header .navbar > .contact-btn:hover,
    body.inner-page > header .navbar > .contact-btn:hover {
        transform: translateY(-2px) !important; /* original hover lift only */
    }
}

/* Narrow laptop / tablet landscape (992px - 1279px):
   logo + 7 links + button cannot sit on one row without shrinking
   text, so the menu drops to its own centred row under the logo.
   Nothing is shrunk and nothing can overlap. */
@media (min-width: 992px) and (max-width: 1279px) {

    header .navbar,
    body.inner-page > header .navbar {
        flex-wrap: wrap !important;
        row-gap: 0 !important;
        padding-top: 10px !important;
    }

    header .navbar > .logo {
        order: 1 !important;
    }

    header .navbar > .contact-btn,
    body.inner-page > header .navbar > .contact-btn {
        order: 2 !important;
        margin-left: auto !important;
    }

    header .navbar > nav,
    body.inner-page > header .navbar > nav {
        order: 3 !important;
        flex: 0 0 100% !important;
        justify-content: center !important;
        padding-bottom: 6px !important;
    }

    header .navbar > nav .nav-links,
    body.inner-page > header .navbar > nav .nav-links {
        justify-content: center !important;
        gap: clamp(14px, 2vw, 26px) !important;
    }
}
