/* /css/navigationA.css
 *
 * Styles for navigationA() output.
 *
 * Desktop (>= 768px): horizontal bar, parent items reveal children on hover.
 * Mobile  (< 768px):  hamburger button toggles a slide-in drawer from the
 *                     right. Children are indented within the same list.
 *
 * Entirely CSS-driven — the open/closed state is held by a hidden checkbox
 * (#nav-a-toggle), so no JavaScript is required.
 *
 * This file is a starting point for developers to restyle freely.
 */

/* ─── Shared / base ───────────────────────────────────────────────────────── */

.nav-a {
    position: relative;
}

.nav-a ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* NOTE: namgolf brand override — Oswald for nav text (matching h1/h2), applied
   to every level. Font family is safe on both the blue header and the white
   dropdown, so it isn't scoped. */
.nav-a__link {
    display: block;
    text-decoration: none;
    color: #1d202b;
    font-family: "Oswald", sans-serif;
    font-optical-sizing: auto;
    font-weight: 500;
    font-style: normal;
    font-size: 1em;
    padding: 12px 16px;
    transition: color 0.15s ease, background 0.15s ease;
}

/* NOTE: namgolf brand override — white top-level nav text to sit legibly on
   the blue header. Scoped to the TOP-LEVEL list only — submenu links reuse the
   same .nav-a__link class but render inside the white dropdown panel, so they
   stay the default dark colour set above. */
.nav-a__list--top > .nav-a__item > .nav-a__link {
    color: #ffffff;
}

.nav-a__item.active > .nav-a__link {
    font-weight: 700;
}

/* The checkbox that drives the mobile drawer is never shown itself */
.nav-a__toggle {
    display: none;
}

/* Hamburger + overlay are hidden on desktop, shown on mobile (below) */
.nav-a__hamburger,
.nav-a__overlay {
    display: none;
}

/* ─── Desktop (>= 768px): horizontal bar with hover dropdowns ─────────────── */

@media (min-width: 768px) {

    .nav-a__list--top {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
    }

    .nav-a__list--top > .nav-a__item {
        position: relative;
    }

    /* Top-level hover: keep white, slight fade (the default dark teal hover
       below still applies to submenu links on their white panel). */
    .nav-a__list--top > .nav-a__item > .nav-a__link:hover {
        color: #ffffff;
        opacity: 0.85;
    }

    /* NOTE: namgolf brand override — animated centre-out yellow underline on
       top-level nav hover. Uses ::before (not ::after) because parent items
       already use ::after for the dropdown caret. The bar starts at scaleX(0)
       from the centre and grows outward to both edges on hover. Uses the
       `yellow` keyword to match the hero and h2 brand bars in styles.css. */
    .nav-a__list--top > .nav-a__item > .nav-a__link {
        position: relative;
    }

    .nav-a__list--top > .nav-a__item > .nav-a__link::before {
        content: "";
        position: absolute;
        left: 16px;   /* match the link's horizontal padding */
        right: 16px;  /* so the bar spans the text, not the padding */
        bottom: 8px;
        height: 3px;
        background: yellow;
        transform: scaleX(0);
        transform-origin: center;
        transition: transform 0.25s ease;
    }

    .nav-a__list--top > .nav-a__item > .nav-a__link:hover::before {
        transform: scaleX(1);
    }

    .nav-a__link:hover {
        color: #1b7a8c;
    }

    /* Submenu: hidden by default, revealed on hover of the parent item */
    .nav-a__submenu {
        position: absolute;
        top: 100%;
        left: 0;
        min-width: 200px;
        background: #ffffff;
        border: 1px solid #e2e6e8;
        border-radius: 4px;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
        opacity: 0;
        visibility: hidden;
        transform: translateY(4px);
        transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
        z-index: 100;
    }

    .nav-a__item.has-children:hover > .nav-a__submenu,
    .nav-a__item.has-children:focus-within > .nav-a__submenu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .nav-a__submenu .nav-a__link {
        padding: 10px 16px;
        white-space: nowrap;
    }

    .nav-a__submenu .nav-a__link:hover {
        background: #f3f7f8;
    }

    /* Small caret to indicate a parent has children */
    .nav-a__item.has-children > .nav-a__link::after {
        content: "";
        display: inline-block;
        margin-left: 6px;
        border: 4px solid transparent;
        border-top-color: currentColor;
        vertical-align: middle;
    }
}

/* ─── Mobile (< 768px): hamburger + slide-in drawer ──────────────────────── */

@media (max-width: 767px) {

    /* Hamburger button */
    .nav-a__hamburger {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        padding: 10px;
        cursor: pointer;
        position: relative;
        z-index: 300;
    }

    /* NOTE: namgolf brand override — white hamburger bars to sit on the blue
       header. */
    .nav-a__hamburger span {
        display: block;
        height: 3px;
        width: 100%;
        background: #ffffff;
        border-radius: 2px;
        transition: transform 0.25s ease, opacity 0.25s ease;
    }

    /* Animate hamburger into an "X" when the drawer is open */
    .nav-a__toggle:checked ~ .nav-a__hamburger span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .nav-a__toggle:checked ~ .nav-a__hamburger span:nth-child(2) {
        opacity: 0;
    }
    .nav-a__toggle:checked ~ .nav-a__hamburger span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* The drawer itself — off-screen to the right by default */
    .nav-a__list--top {
        position: fixed;
        top: 0;
        right: 0;
        width: 78%;
        max-width: 320px;
        height: 100vh;
        background: rgb(24, 39, 39); /* namgolf — dark drawer panel */
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
        padding: 80px 0 24px;
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform 0.28s ease;
        z-index: 200;
    }

    .nav-a__toggle:checked ~ .nav-a__list--top {
        transform: translateX(0);
    }

    /* NOTE: namgolf override — dark drawer panel, so top-level links are white
       (previously reverted to dark for the old white drawer). position:relative
       anchors the animated underline ::before below. */
    .nav-a__list--top > .nav-a__item > .nav-a__link {
        color: #ffffff;
        position: relative;
    }

    /* Animated centre-out yellow underline on the drawer's top-level links,
       matching the desktop nav. Touch devices have no true hover, so the
       current page (.active) shows the bar persistently as the touch-friendly
       equivalent; :hover / :active still give feedback on tap where supported. */
    .nav-a__list--top > .nav-a__item > .nav-a__link::before {
        content: "";
        position: absolute;
        left: 24px;   /* match the mobile link's horizontal padding */
        right: 24px;
        bottom: 6px;
        height: 3px;
        background: yellow;
        transform: scaleX(0);
        transform-origin: center;
        transition: transform 0.25s ease;
    }

    .nav-a__list--top > .nav-a__item.active > .nav-a__link::before,
    .nav-a__list--top > .nav-a__item > .nav-a__link:hover::before,
    .nav-a__list--top > .nav-a__item > .nav-a__link:active::before {
        transform: scaleX(1);
    }

    /* Dark overlay behind the drawer */
    .nav-a__overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.28s ease, visibility 0.28s ease;
        z-index: 150;
    }

    .nav-a__toggle:checked ~ .nav-a__overlay {
        display: block;
        opacity: 1;
        visibility: visible;
    }

    /* Links stack full width; white text on the dark drawer, with a subtle
       light divider between rows (the old #f0f0f0 was for the white panel). */
    .nav-a__list--top .nav-a__link {
        padding: 14px 24px;
        color: #ffffff;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }

    /* Children indented within the same list (no flyout on mobile). A subtle
       lighter tint distinguishes nested items on the dark drawer. */
    .nav-a__submenu .nav-a__link {
        padding-left: 44px;
        background: rgba(255, 255, 255, 0.05);
        font-size: 0.95em;
    }
}

/* ─── Header layout: logo + nav ──────────────────────────────────────────── */

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.site-logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.site-logo img {
    display: block;
    max-height: 100px;
    width: auto;
}

/* Mobile: logo centred above the nav */
@media (max-width: 767px) {
    .site-header__inner {
        flex-direction: column;
        gap: 12px;
        position: relative;
    }

    .site-logo {
        margin: 0 auto;
    }
    .site-logo img {
        max-height: 120px; /* namgolf — 50% larger than the default mobile logo */
    }

    /* Hamburger sits top-right while the logo is centred */
    .site-header__inner .nav-a {
        position: static;
    }

    .nav-a__hamburger {
        position: absolute;
        top: 0;
        right: 0;
    }
}