/* ==========================================================================
   Master Pool Decks — site chrome (navbar + footer)
   THE single authority for the header and footer on EVERY page.
   Loaded as the LAST stylesheet so it wins the cascade over each page's
   inline styles. Selectors are anchored on #mainNav / footer to out-rank
   legacy class-only rules.
   ========================================================================== */

:root {
    --chrome-navy-900: #0B2036;
    --chrome-navy-700: #16324F;
    --chrome-sand-500: #C9A66B;
    --chrome-sand-600: #B08F52;
    --chrome-sand-300: #E4D3B0;
    --chrome-sand-100: #F1E9D8;
    --chrome-cream: #F7F3EC;
    --chrome-ink-500: #55606B;
    --chrome-font-display: 'Fraunces', Georgia, serif;
    --chrome-font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Kill horizontal overflow site-wide (the off-canvas mobile menu and any
   over-wide legacy section otherwise widen the page on phones). `clip`
   avoids creating a scroll container, so position:sticky keeps working. */
html { overflow-x: clip; }
@supports not (overflow: clip) {
    html { overflow-x: hidden; }
}

/* --- Bar ---------------------------------------------------------------- */
/* Scope to the SITE header only. A bare `header` selector also caught in-page
   `<header class="section-intro">` blocks (blog posts, 404): they became sticky
   and, at the same z-index but later in the DOM, painted over the open mobile
   menu. Kept as two rules so browsers without :has() still get `body > header`. */
body > header { position: sticky; top: 0; z-index: 1000; }
header:has(> nav#mainNav) { position: sticky; top: 0; z-index: 1000; }
nav#mainNav {
    position: relative;
    background: rgba(247, 243, 236, 0.94);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(11, 32, 54, 0.08);
    box-shadow: none;
    transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
    padding: 0;
}
nav#mainNav.nav-scrolled { box-shadow: 0 6px 24px rgba(11, 32, 54, 0.08); background: rgba(247, 243, 236, 0.98); }
nav#mainNav.nav-hidden { transform: translateY(-100%); }
nav#mainNav .nav-container {
    max-width: 1180px; margin: 0 auto; padding: 10px 24px;
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    background: none;
}

/* --- Logo --------------------------------------------------------------- */
nav#mainNav .logo { display: flex; align-items: center; gap: 13px; text-decoration: none; }
nav#mainNav .logo img { width: 52px; height: 52px; object-fit: contain; }
nav#mainNav .logo-text { display: flex; flex-direction: column; line-height: 1.2; }
nav#mainNav .logo-text .brand {
    font-family: var(--chrome-font-display); font-weight: 600; font-size: 1.18rem;
    color: var(--chrome-navy-900); letter-spacing: -0.01em; text-transform: none;
}
nav#mainNav .logo-text .slogan {
    font-family: var(--chrome-font-primary); font-size: 0.68rem; font-style: italic;
    color: var(--chrome-ink-500); letter-spacing: 0.03em; text-transform: none;
}

/* --- Menu --------------------------------------------------------------- */
nav#mainNav .nav-menu {
    display: flex; align-items: center; gap: 6px;
    list-style: none; margin: 0; padding: 0; position: static;
    background: none; transform: none; box-shadow: none;
}
nav#mainNav .nav-menu > li { margin: 0; position: relative; }
nav#mainNav .nav-menu > li > a {
    display: inline-block; position: relative;
    padding: 10px 13px; border: none; background: none;
    font-family: var(--chrome-font-primary); font-size: 0.94rem; font-weight: 500;
    letter-spacing: 0.01em; text-transform: none; text-decoration: none;
    color: var(--chrome-navy-900);
    transition: color .16s ease;
}
nav#mainNav .nav-menu > li > a::after {
    content: ""; position: absolute; left: 13px; right: 13px; bottom: 5px; height: 2px;
    background: var(--chrome-sand-500); border-radius: 2px;
    transform: scaleX(0); transform-origin: left; transition: transform .18s ease;
}
nav#mainNav .nav-menu > li > a:hover { color: var(--chrome-sand-600); background: none; }
nav#mainNav .nav-menu > li > a:hover::after { transform: scaleX(1); }

/* Dropdown caret uses a real glyph so it inherits color cleanly.
   NOTE: the parent link's ::after is the caret, NOT the hover underline, so
   every property the underline rule sets must be reset here — and the
   selector must out-rank `nav#mainNav .nav-menu > li > a::after` (0,1,1,4),
   hence the explicit `.nav-menu > li.nav-dropdown` chain. */
nav#mainNav .nav-dropdown > a { padding-right: 26px; background-image: none; }
nav#mainNav .nav-dropdown > a .caret,
nav#mainNav .nav-dropdown > a::before { content: none; }
nav#mainNav .nav-dropdown > a:hover { color: var(--chrome-sand-600); }
nav#mainNav .nav-menu > li.nav-dropdown > a::after,
nav#mainNav .nav-menu > li.nav-dropdown > a:hover::after {
    content: "\25BE "; display: block;
    position: absolute; right: 9px; top: 50%; left: auto; bottom: auto;
    width: auto; height: auto;
    background: none; border-radius: 0;
    font-size: 0.78em; line-height: 1;
    color: var(--chrome-sand-600);
    transform: translateY(-50%); transform-origin: center;
    transition: transform .18s ease;
}
nav#mainNav .nav-menu > li.nav-dropdown:hover > a::after,
nav#mainNav .nav-menu > li.nav-dropdown:focus-within > a::after { transform: translateY(-50%) rotate(180deg); }

/* --- Dropdown panel ----------------------------------------------------- */
nav#mainNav .nav-dropdown { position: relative; }
nav#mainNav .dropdown-panel {
    position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%) translateY(4px);
    min-width: 264px; background: #FFFFFF; border-radius: 12px;
    box-shadow: 0 16px 48px rgba(11, 32, 54, 0.16);
    border: 1px solid rgba(11, 32, 54, 0.07);
    padding: 8px; margin: 0; list-style: none;
    opacity: 0; visibility: hidden;
    transition: opacity .16s ease, transform .16s ease;
    z-index: 1200;
}
/* Invisible bridge across the 10px gap between the trigger and the panel.
   Without it the pointer leaves `.nav-dropdown:hover` mid-travel and the panel
   closes before its links can be clicked. It is a child of the panel, so it
   only exists while the panel is open and never blocks anything when closed. */
nav#mainNav .dropdown-panel::after {
    content: ""; position: absolute; left: 0; right: 0;
    top: -14px; height: 14px; background: none;
}
nav#mainNav .dropdown-panel::before {
    content: ""; position: absolute; top: -6px; left: 50%; transform: translateX(-50%) rotate(45deg);
    width: 12px; height: 12px; background: #FFFFFF;
    border-left: 1px solid rgba(11, 32, 54, 0.07); border-top: 1px solid rgba(11, 32, 54, 0.07);
}
nav#mainNav .nav-dropdown:hover .dropdown-panel,
nav#mainNav .nav-dropdown:focus-within .dropdown-panel {
    opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}
nav#mainNav .dropdown-panel li { margin: 0; }
nav#mainNav .dropdown-panel li a {
    display: block; padding: 10px 16px; border-radius: 8px;
    font-family: var(--chrome-font-primary); font-size: 0.92rem; font-weight: 500;
    color: var(--chrome-navy-900); text-decoration: none; text-transform: none;
    transition: background .14s ease, color .14s ease, padding-left .14s ease;
}
nav#mainNav .dropdown-panel li a:hover {
    background: var(--chrome-sand-100); color: var(--chrome-navy-900); padding-left: 20px;
}

/* --- Quote button -------------------------------------------------------- */
nav#mainNav .nav-menu .quote-btn {
    margin-left: 10px;
    background: var(--chrome-navy-900); color: #FFFFFF;
    padding: 12px 24px; border-radius: 999px;
    font-weight: 600; font-size: 0.92rem; letter-spacing: 0.02em;
    box-shadow: 0 4px 14px rgba(11, 32, 54, 0.18);
    transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}
nav#mainNav .nav-menu .quote-btn::after { display: none; }
nav#mainNav .nav-menu .quote-btn:hover {
    background: var(--chrome-sand-500); color: var(--chrome-navy-900);
    transform: translateY(-1px); box-shadow: 0 6px 18px rgba(201, 166, 107, 0.35);
}

/* --- Mobile ------------------------------------------------------------- */
nav#mainNav .mobile-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
nav#mainNav .mobile-toggle span {
    display: block; width: 24px; height: 2.5px; background: var(--chrome-navy-900);
    margin: 5px 0; border-radius: 2px; transition: .2s;
}
@media (max-width: 900px) {
    nav#mainNav .nav-menu {
        position: fixed; top: 72px; left: 0; right: 0; bottom: auto;
        /* nav#mainNav's backdrop-filter makes IT the containing block for this
           fixed panel, so `bottom: 0` resolved against the 72px-tall bar and
           collapsed the menu to a sliver. Size it against the viewport instead. */
        height: calc(100vh - 72px);
        height: calc(100dvh - 72px);
        background: var(--chrome-cream); flex-direction: column; align-items: flex-start;
        /* Legacy pages set `justify-content: center`; with content taller than
           the panel that pushes the first items above the top, out of reach. */
        justify-content: flex-start;
        /* Bottom clearance so the last item clears the fixed cookie banner. */
        padding: 24px 28px 104px; gap: 8px; overflow-y: auto; -webkit-overflow-scrolling: touch;
        transform: translateX(100%); transition: transform .25s ease;
        display: flex; box-shadow: none;
    }
    nav#mainNav .nav-menu.active { transform: translateX(0); }
    nav#mainNav .nav-menu > li { width: 100%; }
    nav#mainNav .nav-menu > li > a { display: block; padding: 12px 4px; font-size: 1.05rem; }
    nav#mainNav .nav-menu > li > a::after { display: none; }
    nav#mainNav .mobile-toggle { display: block; }
    nav#mainNav .dropdown-panel {
        position: static; transform: none; opacity: 1; visibility: visible;
        box-shadow: none; border: none; background: transparent; padding: 0 0 4px 16px;
    }
    nav#mainNav .dropdown-panel::before { display: none; }
    /* The panel is static here, so the desktop hover bridge would anchor to the
       <li> and sit on top of the parent link. No hover gap exists on mobile. */
    nav#mainNav .dropdown-panel::after { content: none; }
    nav#mainNav .nav-menu .quote-btn { margin: 10px 0 0; text-align: center; width: 100%; display: block; }
}

/* --- Legacy-page neutralizers -------------------------------------------- */
/* Old pages compensated a position:fixed nav with body padding — the chrome
   header is sticky (in-flow), so that padding just paints a blank band. */
body { padding-top: 0 !important; }
/* Old hover artifacts: the 4px gold dot under nav links doubles up with the
   chrome underline. */
nav#mainNav .nav-menu a::before { content: none !important; }
/* Legacy `.quote-btn { color: var(--dark-gray) !important }` turns the pill
   text navy-on-navy (invisible). !important vs !important: chrome wins on
   specificity. */
nav#mainNav .nav-menu .quote-btn { color: #FFFFFF !important; }
nav#mainNav .nav-menu .quote-btn:hover { color: var(--chrome-navy-900) !important; }

/* --- Cookie banner: compact on phones so it never buries the quote form --- */
@media (max-width: 700px) {
    #cookieConsent { padding: 8px 12px !important; font-size: 12.5px !important; }
    #cookieConsent p { margin: 0 !important; min-width: 0 !important; line-height: 1.35 !important; }
    #cookieConsent button {
        padding: 8px 16px !important; min-height: 36px !important; font-size: 13px !important;
    }
}

/* --- Footer -------------------------------------------------------------- */
footer {
    background: var(--chrome-navy-900); color: rgba(255, 255, 255, 0.82);
    padding: 64px 0 0; font-family: var(--chrome-font-primary);
}
footer .footer-content {
    max-width: 1180px; margin: 0 auto; padding: 0 24px 44px;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 36px;
}
footer .footer-section h3 {
    font-family: var(--chrome-font-display); color: var(--chrome-sand-300);
    font-size: 1.02rem; margin-bottom: 14px; font-weight: 600; text-transform: none; letter-spacing: 0;
}
footer .footer-section h3::after { display: none; }
footer .footer-section ul { list-style: none; margin: 0; padding: 0; }
footer .footer-section li { margin-bottom: 9px; font-size: 0.9rem; }
footer .footer-section p { font-size: 0.92rem; line-height: 1.65; }
footer .footer-section a { color: rgba(255, 255, 255, 0.82); text-decoration: none; transition: color .15s ease; }
footer .footer-section a:hover { color: var(--chrome-sand-300); }
footer .social-links { display: flex; gap: 12px; margin-top: 14px; }
footer .social-links a {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.08); color: #FFFFFF;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
footer .social-links a:hover { background: var(--chrome-sand-500); color: var(--chrome-navy-900); transform: translateY(-2px); }
footer .footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding: 22px 24px; text-align: center; font-size: 0.82rem; color: rgba(255, 255, 255, 0.6);
    background: none;
}
footer .footer-bottom a { color: var(--chrome-sand-300); text-decoration: none; }
footer .footer-bottom a:hover { text-decoration: underline; }
