/* ==========================================================
   navbar.css - top header, social icons, sticky navbar,
   mega menus, dropdowns and mobile navigation.
   Colours come from the variables in style.css.
   Desktop layout starts at 992px; below that the hamburger menu is used.
   ========================================================== */

/* ---------- Top strip: motto (left corner) + contact details (desktop only) ---------- */
.topbar {
    background: var(--primary-dark);
    color: #dfe9e3;
    font-size: .8rem;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: 6px; }
.topbar-motto {
    font-family: var(--font-heading);
    font-weight: 500;
    font-style: italic;
    letter-spacing: .01em;
    color: var(--secondary-color);
}
.topbar-contact { display: none; gap: 24px; }
.topbar a { color: inherit; text-decoration: none; }
.topbar a:hover { text-decoration: underline; }
.topbar i { color: var(--secondary-color); margin-right: 6px; }

/* ---------- Header: brand + social ---------- */
.site-header { background: var(--white); }

.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding-block: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-color);
    min-width: 0;
}
.brand-logo { height: 56px; width: auto; max-width: 100%; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name { font-family: var(--font-heading); font-size: 1.05rem; font-weight: 700; color: var(--primary-color); }
.brand-motto {
    font-size: .8rem; font-style: italic; color: var(--muted-color);
    border-left: 3px solid var(--secondary-color); padding-left: 8px; margin-top: 3px;
}

/* Social icons: compact row on mobile (full width, centred under the brand) */
.social-list {
    display: flex;
    justify-content: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 8px 0 0;
    width: 100%;
    border-top: 1px solid var(--border-color);
}
.social-list a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;               /* comfortable touch target */
    height: 40px;
    border-radius: 50%;
    color: var(--primary-color);
    background: var(--primary-light);
    text-decoration: none;
    font-size: 1rem;
    transition: background var(--transition), color var(--transition), transform var(--transition);
}
.social-list a:hover { background: var(--primary-color); color: var(--white); transform: translateY(-2px); }

/* ---------- Sticky navigation bar ---------- */
.main-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--primary-color);
    color: var(--white);
    transition: box-shadow var(--transition);
}
.main-nav.is-stuck { box-shadow: 0 4px 14px rgba(0, 0, 0, .22); }

.nav-inner {
    position: relative;        /* anchor for the mega menus */
    display: flex;
    align-items: stretch;
    min-height: 56px;
}

/* Hamburger */
.nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 0 4px;
    background: none;
    border: 0;
    color: var(--white);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.nav-toggle-bars { position: relative; width: 24px; height: 18px; }
.nav-toggle-bars span {
    position: absolute; left: 0; width: 100%; height: 2px; background: currentColor; border-radius: 2px;
    transition: transform .25s ease, opacity .2s ease, top .25s ease;
}
.nav-toggle-bars span:nth-child(1) { top: 0; }
.nav-toggle-bars span:nth-child(2) { top: 8px; }
.nav-toggle-bars span:nth-child(3) { top: 16px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(1) { top: 8px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(3) { top: 8px; transform: rotate(-45deg); }

/* ---------- Mobile menu panel (default) ---------- */
.nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - 120px);
    max-height: calc(100dvh - 120px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--white);
    color: var(--text-color);
    box-shadow: 0 12px 24px rgba(0, 0, 0, .18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s;
}
.nav-menu.open {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity .25s ease, transform .25s ease;
}

.nav-list { list-style: none; margin: 0; padding: 8px 16px 20px; }
.nav-item { border-bottom: 1px solid var(--border-color); }

.nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 48px;          /* touch target */
    padding: 10px 4px;
    background: none;
    border: 0;
    font-family: var(--font-heading);
    font-size: .95rem;
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
    text-align: left;
    cursor: pointer;
}
.nav-link.active { color: var(--primary-color); box-shadow: inset 4px 0 0 var(--secondary-color); padding-left: 12px; }

.chevron { font-size: .75rem; transition: transform var(--transition); }
.has-dropdown.open > .dropdown-toggle .chevron { transform: rotate(180deg); }

/* Accordion animation using grid rows */
.dropdown {
    display: grid;
    grid-template-rows: 0fr;
    visibility: hidden;
    transition: grid-template-rows .3s ease, visibility 0s linear .3s;
}
.has-dropdown.open > .dropdown {
    grid-template-rows: 1fr;
    visibility: visible;
    transition: grid-template-rows .3s ease;
}
.dropdown-inner { min-height: 0; overflow: hidden; }

.mega-grid { display: grid; grid-template-columns: 1fr; }
.mega-title {
    margin: 12px 0 4px;
    padding-left: 4px;
    font-size: .75rem;
    font-family: var(--font-heading);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--primary-color);
}
.dropdown ul { list-style: none; margin: 0; padding: 0 0 8px; }

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;          /* touch target */
    padding: 8px 8px;
    border-radius: 6px;
    color: var(--text-color);
    text-decoration: none;
    font-size: .95rem;
    transition: background var(--transition), color var(--transition);
}
.dropdown-link i { width: 20px; text-align: center; color: var(--primary-color); }
.dropdown-link:hover { background: var(--primary-light); color: var(--primary-dark); }
.dropdown-link.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }

/* CTA button */
.nav-cta-item { border-bottom: 0; padding-top: 16px; }
.btn-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 10px 22px;
    border-radius: var(--radius);
    background: var(--secondary-color);
    color: #1f2937;
    font-family: var(--font-heading);
    font-size: .9rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn-cta:hover { background: var(--secondary-dark); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0, 0, 0, .18); }

/* ---------- Focus states ---------- */
.nav-toggle:focus-visible,
.nav-link:focus-visible,
.dropdown-link:focus-visible,
.btn-cta:focus-visible,
.social-list a:focus-visible,
.brand:focus-visible {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}
.nav-menu .nav-link:focus-visible,
.nav-menu .dropdown-link:focus-visible { outline-color: var(--primary-color); }

/* ==========================================================
   Small phones
   ========================================================== */
@media (max-width: 380px) {
    .brand-logo { height: 48px; }
    .brand-name { font-size: .95rem; }
    .social-list a { width: 36px; height: 36px; }
}

/* ==========================================================
   Tablet and up: social icons move to the right of the brand
   ========================================================== */
@media (min-width: 640px) {
    .brand-logo { height: 64px; }
    .brand-name { font-size: 1.25rem; }
    .brand-motto { font-size: .85rem; }
    .social-list { width: auto; border-top: 0; padding: 0; justify-content: flex-end; }
}

/* ==========================================================
   Desktop / laptop navigation (992px and up)
   ========================================================== */
@media (min-width: 992px) {
    .topbar { font-size: .85rem; }
    .topbar-contact { display: flex; }
    .header-inner { padding-block: 16px; }
    .brand-logo { height: 76px; }
    .brand-name { font-size: 1.5rem; }
    .brand-motto { font-size: .9rem; }
    .social-list a { width: 36px; height: 36px; font-size: .95rem; }

    .nav-toggle { display: none; }

    .nav-menu {
        position: static;
        flex: 1;
        max-height: none;
        overflow: visible;
        background: transparent;
        color: inherit;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;
    }

    .nav-list { display: flex; align-items: stretch; padding: 0; height: 100%; }
    .nav-item { border-bottom: 0; display: flex; align-items: stretch; }
    .has-dropdown:not(.is-mega) { position: relative; }

    .nav-link {
        position: relative;
        width: auto;
        min-height: 60px;
        padding: 0 16px;
        gap: 8px;
        justify-content: center;
        color: var(--white);
        font-size: .95rem;
        transition: background var(--transition);
    }
    .nav-link:hover,
    .has-dropdown.open > .dropdown-toggle { background: rgba(255, 255, 255, .12); }

    /* Active page / open menu indicator: gold bar */
    .nav-link::after {
        content: "";
        position: absolute;
        left: 16px; right: 16px; bottom: 0;
        height: 4px;
        border-radius: 4px 4px 0 0;
        background: var(--secondary-color);
        transform: scaleX(0);
        transition: transform var(--transition);
    }
    .nav-link:hover::after,
    .nav-link.active::after,
    .has-dropdown.open > .dropdown-toggle::after { transform: scaleX(1); }
    .nav-link.active { color: var(--white); box-shadow: none; padding-left: 16px; }
    .nav-link:focus-visible,
    .nav-menu .nav-link:focus-visible { outline: 3px solid var(--secondary-color); outline-offset: -3px; }

    /* CTA sits on the far right */
    .nav-cta-item { margin-left: auto; padding: 8px 0 8px 16px; align-items: center; }
    .btn-cta { min-height: 44px; }

    /* Dropdown panels */
    .dropdown {
        display: block;
        position: absolute;
        top: 100%;
        background: var(--white);
        color: var(--text-color);
        border-top: 3px solid var(--secondary-color);
        border-radius: 0 0 var(--radius) var(--radius);
        box-shadow: 0 16px 32px rgba(0, 0, 0, .18);
        opacity: 0;
        visibility: hidden;
        transform: translateY(8px);
        transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
    }
    .has-dropdown.open > .dropdown {
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: opacity .2s ease, transform .2s ease;
    }
    .dropdown-inner { overflow: visible; }

    .simple-dropdown { left: 0; min-width: 270px; padding: 12px; }
    .dropdown ul { padding: 0; }

    .mega-dropdown { left: 0; right: 0; padding: 28px 32px 32px; }
    .mega-grid { grid-template-columns: repeat(var(--cols), 1fr); gap: 32px; }
    .mega-title {
        margin: 0 0 12px;
        padding: 0 0 8px;
        border-bottom: 2px solid var(--primary-light);
        font-size: .8rem;
    }
    .dropdown-link { padding: 9px 10px; }
}

/* ---------- Respect reduced-motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
