/*
 * Lake Belton - site navigation (B-019, navigation Direction 1 "Immersive")
 *
 * One floating glass capsule, centred at the top of every page, home included, in the same place and size:
 * the mark and wordmark (home), then Conditions · Levels · Wind · Dam · [Map 3D] · FAQs. Map and 3D share one
 * tinted pair, so on the maps the capsule is also the Map | 3D switch. Narrow screens get the compact capsule
 * (mark + wordmark + Menu; on the maps mark + the pair + Menu) and a Menu sheet (/js/nav.js) with every link.
 * Where the Menu shows, the links appear only in the sheet: no second row of links under the capsule.
 *
 * Markup: site/_includes/partials/capsule.njk, with hand copies in public/index.html,
 * public/map/index.html and public/contact/index.html. Loaded by every page, after the page's own CSS.
 *
 *   .capsule                 light glass (maps, over paper)
 *   .capsule--dark           smoky glass (over photos)
 *   .capsule--map            maps: the compact form keeps the Map | 3D pair
 */

:root {
    --nav-ink: #13293D;
    --nav-ink-2: #33495C;
    --nav-focus: #1F6FB2;
    --nav-font: 'Montserrat', system-ui, sans-serif;
    --nav-lift: 0 1px 2px rgba(15, 38, 56, 0.06), 0 12px 32px -14px rgba(15, 38, 56, 0.34), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

/* Skip link: the first tab stop on every page */
.skip-link {
    position: absolute;
    z-index: 3000;
    left: 12px;
    top: 12px;
    transform: translateY(-160%);
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--nav-ink);
    color: #fff;
    font: 600 14px/1 var(--nav-font);
    text-decoration: none;
}

.skip-link:focus {
    transform: none;
    outline: 2px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--nav-ink);
}

/* ==========================================================================
   The capsule
   ========================================================================== */

.capsule {
    position: absolute;
    z-index: 1100;
    left: 50%;
    top: 18px;
    transform: translateX(-50%);
    width: max-content;
    display: flex;
    align-items: center;
    gap: 2px;
    max-width: calc(100% - 36px);
    padding: 5px;
    border-radius: 999px;
    background: rgba(248, 250, 251, 0.84);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
    box-shadow: var(--nav-lift);
    font-family: var(--nav-font);
    -webkit-font-smoothing: antialiased;
}

.capsule a,
.capsule button {
    -webkit-tap-highlight-color: transparent;
}

.cap-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: none;
    padding: 0 10px 0 0;
    border-radius: 999px;
    color: var(--nav-ink);
    text-decoration: none;
}

.cap-brand img {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

/* Home link hover and focus: a brief glint of light across the sun in the mark, and the wordmark warms.
   About half a second, no layout change; with reduced motion only the colour changes. */
.cap-brand {
    position: relative;
}

.cap-brand::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 32px;
    height: 32px;
    margin-top: -16px;
    border-radius: 50%;
    background: linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, 0.85) 50%, transparent 68%) no-repeat;
    background-size: 260% 100%;
    background-position: 130% 0;
    opacity: 0;
    pointer-events: none;
}

.cap-wm {
    transition: color 0.25s ease;
}

.cap-brand:hover .cap-wm,
.cap-brand:focus-visible .cap-wm {
    color: #B4561B;
}

.capsule--dark .cap-brand:hover .cap-wm,
.capsule--dark .cap-brand:focus-visible .cap-wm {
    color: #FFD08A;
}

@media (prefers-reduced-motion: no-preference) {
    .cap-brand:hover::before,
    .cap-brand:focus-visible::before {
        animation: cap-glint 0.55s ease-out 1;
    }
}

@keyframes cap-glint {
    0% { opacity: 1; background-position: 130% 0; }
    100% { opacity: 1; background-position: -30% 0; }
}

/* The wordmark as the old header lockup set it (Montserrat 700, tracked capitals), at small size */
.cap-wm {
    font: 700 12px/1 var(--nav-font);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
}

.cap-sep {
    flex: none;
    width: 1px;
    height: 20px;
    margin: 0 4px;
    background: rgba(15, 38, 56, 0.14);
}

.cap-links {
    display: flex;
    align-items: center;
    gap: 2px;
}

.cap-pair {
    display: flex;
    margin: 0 2px;
    border-radius: 999px;
    background: rgba(15, 38, 56, 0.06);
}

.cap-links a,
.capsule .cap-menu {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--nav-ink-2);
    font: 600 13px/1 var(--nav-font);
    letter-spacing: 0.005em;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.cap-links a:hover,
.cap-menu:hover {
    color: var(--nav-ink);
    background: rgba(15, 38, 56, 0.07);
}

.cap-links a[aria-current] {
    color: #fff;
    background: var(--nav-ink);
}

.capsule .cap-menu {
    display: none;
    flex: none;
    color: var(--nav-ink);
}

.cap-menu svg {
    width: 16px;
    height: 16px;
    flex: none;
}

.capsule :focus-visible {
    outline: 2px solid var(--nav-focus);
    outline-offset: 2px;
}

/* Smoky glass over photos. Contrast: white text on this fill over a white sky is 4.7:1 or better. */
.capsule--dark {
    background: rgba(16, 30, 44, 0.62);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 12px 30px -14px rgba(0, 0, 0, 0.5);
}

.capsule--dark .cap-brand,
.capsule--dark .cap-menu {
    color: #fff;
}

.capsule--dark .cap-links a {
    color: rgba(255, 255, 255, 0.94);
}

.capsule--dark .cap-links a:hover,
.capsule--dark .cap-menu:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
}

.capsule--dark .cap-links a[aria-current] {
    color: var(--nav-ink);
    background: #fff;
}

.capsule--dark .cap-pair {
    background: rgba(255, 255, 255, 0.11);
}

.capsule--dark .cap-sep {
    background: rgba(255, 255, 255, 0.24);
}

.capsule--dark :focus-visible {
    outline-color: #fff;
}

/* No backdrop blur, or the visitor asked for less transparency: a solid fill */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .capsule { background: rgba(248, 250, 251, 0.97); }
    .capsule--dark { background: rgba(20, 34, 48, 0.92); }
}

@media (prefers-reduced-transparency: reduce) {
    .capsule { background: rgb(248, 250, 251); -webkit-backdrop-filter: none; backdrop-filter: none; }
    .capsule--dark { background: rgb(20, 34, 48); }
}

/* ==========================================================================
   Compact capsule, still centred. Content pages and home below 761 px: mark + wordmark + Menu.
   Maps below 1200 px: mark + Map | 3D + Menu. The full capsule (about 620 px) would run into the map's
   search box at 1024 px, so both maps take the short form there (one rule for both maps).
   ========================================================================== */

@media (max-width: 760px) {
    .capsule:not(.capsule--map) .cap-links { display: none; }
    .capsule:not(.capsule--map) .cap-menu { display: flex; }
    /* phone tap targets at least 44 px (B-029); the capsule keeps its 48 px height (2 px padding instead of 4) */
    .capsule {
        top: max(12px, env(safe-area-inset-top, 0px));
        max-width: calc(100% - 24px);
        padding: 2px;
    }
    .cap-brand {
        min-height: 44px;
        min-width: 44px;
        padding-left: 6px;
    }
    .cap-brand::before { left: 6px; }
    .cap-links a,
    .capsule .cap-menu {
        min-height: 44px;
    }
    .cap-links a { min-width: 44px; justify-content: center; }
}

@media (max-width: 1199px) {
    .capsule--map .cap-links > a { display: none; }
    .capsule--map .cap-pair { margin: 0; background: none; }
    .capsule--map .cap-menu { display: flex; }
}

@media (max-width: 760px) {
    .capsule--map .cap-wm { display: none; }
    .capsule--map .cap-brand { padding-right: 6px; }
    .capsule--map .cap-sep { display: none; }
    .capsule--map .cap-links a,
    .capsule--map .cap-menu { padding: 0 11px; }
}

/* ==========================================================================
   The Menu sheet (built by /js/nav.js from the capsule's links)
   ========================================================================== */

.navsheet {
    position: fixed;
    inset: 0 0 auto 0;
    width: 100%;
    max-width: none;
    max-height: 100dvh;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0 0 24px 24px;
    background: #F7F9FA;
    color: var(--nav-ink);
    box-shadow: 0 24px 60px -20px rgba(8, 20, 32, 0.55);
    font-family: 'Source Sans 3', system-ui, sans-serif;
    overflow: auto;
    overscroll-behavior: contain;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.18s ease, transform 0.22s ease;
}

.navsheet.is-open {
    opacity: 1;
    transform: none;
}

.navsheet::backdrop {
    background: rgba(8, 20, 32, 0.42);
}

.ns-inner {
    max-width: 560px;
    margin: 0 auto;
    padding: max(12px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 22px max(16px, env(safe-area-inset-left, 0px));
}

.ns-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    margin-bottom: 6px;
}

.ns-home {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding-right: 8px;
    color: var(--nav-ink);
    text-decoration: none;
    border-radius: 999px;
}

.ns-home img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.ns-home span {
    font: 700 13px/1 var(--nav-font);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.ns-close {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 38, 56, 0.07);
    color: var(--nav-ink);
    font: 600 14px/1 var(--nav-font);
    cursor: pointer;
}

.ns-close svg {
    width: 16px;
    height: 16px;
}

.ns-close:hover {
    background: rgba(15, 38, 56, 0.12);
}

.ns-group + .ns-group {
    margin-top: 14px;
}

.ns-label {
    margin: 0 0 6px 4px;
    font: 700 11px/1.2 var(--nav-font);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #5E6E7C;
}

.ns-list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ns-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 54px;
    padding: 0 18px;
    border-radius: 14px;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(15, 38, 56, 0.09);
    color: var(--nav-ink);
    font: 600 17px/1.2 var(--nav-font);
    letter-spacing: -0.005em;
    text-decoration: none;
}

.ns-list a:hover {
    box-shadow: inset 0 0 0 1px rgba(15, 38, 56, 0.24);
}

/* The page you are on: navy fill, a check and the words "This page" (not colour alone) */
.ns-list a[aria-current="page"] {
    background: var(--nav-ink);
    box-shadow: none;
    color: #fff;
}

/* The section you are in (a ramp, marina or park page is under Map): a navy outline, no "This page" */
.ns-list a[aria-current="true"] {
    box-shadow: inset 0 0 0 2px var(--nav-ink);
}

.ns-here {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: 600 12px/1 var(--nav-font);
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.85);
}

.ns-here svg {
    width: 16px;
    height: 16px;
}

.navsheet :focus-visible {
    outline: 2px solid var(--nav-focus);
    outline-offset: 2px;
}

html.navsheet-open {
    overflow: hidden;
}

@media (min-width: 761px) {
    .navsheet {
        inset: 12px 12px auto auto;
        width: min(420px, calc(100% - 24px));
        border-radius: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .navsheet,
    .cap-links a,
    .cap-menu {
        transition: none;
    }
    .navsheet {
        transform: none;
    }
}
