/* All global navigation styling */
/* Navigation styling */
.nrd-nav {
    display: flex; 
    align-items: center; 
    gap: 28px; 
    margin-right: 0.5rem;
}

.nrd-nav ul {
    list-style: none;
    display: flex;
    gap: 26px;
    margin: 0; 
    padding: 0;
}

.nrd-nav a {
    color: var(--nrd-black);
    border-bottom: 2px solid transparent;
    font-family: var(--nrd-font-head);
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: .06em;
    padding: 6px 0;
    text-decoration: none;
    text-transform: uppercase;
    white-space: nowrap;
}

.nrd-nav ul a:hover,
.nrd-nav .current_page_item > a,
.nrd-nav .current-menu-item > a { 
    color: var(--nrd-red); 
    border-bottom: 2px solid var(--nrd-red); 
    font-weight: bolder
}

.nrd-nav .nrd-btn { 
    padding: 10px 22px; 
    font-size: 1.0rem;
    border-bottom: 2px solid var(--nrd-orange); 
}

.nrd-nav .nrd-nav__login { opacity: .85; }

/* Mobile toggle (CSS-only; replace with JS later if desired) */
.nrd-nav-toggle { display: none; }
.nrd-nav-toggle-label {
    display: none;
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--nrd-orange);
    cursor: pointer;
    position: relative;
}
.nrd-nav-toggle-label span,
.nrd-nav-toggle-label span::before,
.nrd-nav-toggle-label span::after {
    position: absolute;
    left: 13px;
    width: 22px; height: 2px;
    background: var(--nrd-white);
    content: "";
    transition: transform .25s, top .25s, opacity .25s;
}
.nrd-nav-toggle-label span { top: 23px; }
.nrd-nav-toggle-label span::before { left: 0; top: -7px; }
.nrd-nav-toggle-label span::after  { left: 0; top: 7px; }

/* .current_page_item a,
.current-menu-item a {
    color: var(--primary-color);
    font-weight: bold; 
    font-style: italic; 
    text-decoration: underline; 
    border-bottom: 2px solid #f00; 
} */

/* Top-level items line up on one center line, with or without a submenu toggle */
.nrd-nav > ul {
    align-items: center;
}

.nrd-nav > ul > li {
    align-items: center;
    display: flex;
}

/* ==========================================================================
   Dropdown submenus (primary menu)
   Wide screens: a panel below the item, opened by hover, keyboard focus or
   the chevron toggle (inc/navigation.php adds it; assets/js/script.js sets
   .submenu-open). Deeper levels fly out to the side. Phones: see screens.css.
   .children / .page_item_has_children cover the page-list fallback menu.
   ========================================================================== */
.nrd-nav .menu-item-has-children,
.nrd-nav .page_item_has_children {
    align-items: center;
    display: flex;
    gap: 2px;
    position: relative;
}

.nrd-nav .submenu-toggle {
    background: none;
    border: 0;
    border-radius: 4px;
    color: inherit;
    cursor: pointer;
    display: inline-grid;
    height: 28px;
    padding: 0;
    place-items: center;
    width: 24px;
}

.nrd-nav .submenu-toggle:hover,
.nrd-nav .submenu-toggle:focus-visible {
    color: var(--nrd-primary);
}

.nrd-nav .submenu-toggle:focus-visible {
    outline: 2px solid var(--nrd-primary);
    outline-offset: 1px;
}

.nrd-nav .submenu-toggle svg {
    height: 16px;
    transition: transform .2s ease;
    width: 16px;
}

/* The panel */
.nrd-nav :is(.sub-menu, .children) {
    background: var(--nrd-light);
    border-top: 3px solid var(--nrd-primary);
    box-shadow: 0 14px 30px rgba(0, 0, 0, .14);
    display: block;
    left: -18px;
    min-width: 230px;
    opacity: 0;
    padding: 8px 0;
    position: absolute;
    top: calc(100% + 12px);
    transform: translateY(8px);
    transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
    visibility: hidden;
    z-index: 1000;
}

/* Bridges the gap between the item and its panel so moving the pointer down
   doesn't close it */
.nrd-nav :is(.sub-menu, .children)::before {
    content: "";
    height: 15px;
    left: 0;
    position: absolute;
    right: 0;
    top: -15px;
}

.nrd-nav li:hover > :is(.sub-menu, .children),
.nrd-nav li:focus-within > :is(.sub-menu, .children),
.nrd-nav li.submenu-open > :is(.sub-menu, .children) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0s;
    visibility: visible;
}

.nrd-nav li:hover > .submenu-toggle svg,
.nrd-nav li.submenu-open > .submenu-toggle svg {
    transform: rotate(180deg);
}

/* Items in the panel */
.nrd-nav :is(.sub-menu, .children) li {
    display: flex;
    margin: 0;
}

.nrd-nav :is(.sub-menu, .children) a {
    border-bottom: 0;
    border-left: 3px solid transparent;
    color: var(--nrd-dark);
    display: block;
    flex: 1;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: .04em;
    padding: 10px 20px 10px 17px;
}

/* The highlight covers the whole row, including a flyout's chevron */
.nrd-nav :is(.sub-menu, .children) li:hover,
.nrd-nav :is(.sub-menu, .children) li:focus-within,
.nrd-nav :is(.sub-menu, .children) li:is(.current-menu-item, .current_page_item) {
    background: var(--nrd-surface-alt);
}

.nrd-nav :is(.sub-menu, .children) a:hover,
.nrd-nav :is(.sub-menu, .children) a:focus-visible,
.nrd-nav :is(.sub-menu, .children) :is(.current-menu-item, .current_page_item) > a {
    border-bottom: 0;
    border-left-color: var(--nrd-primary);
    color: var(--nrd-primary);
}

/* A nested panel's own rows don't inherit the parent row's highlight */
.nrd-nav :is(.sub-menu, .children) :is(.sub-menu, .children) {
    background: var(--nrd-light);
}

.nrd-nav :is(.sub-menu, .children) .submenu-toggle {
    height: auto;
    margin-right: 6px;
    width: 28px;
}

/* Third level and deeper: fly out to the right, chevron points right */
.nrd-nav :is(.sub-menu, .children) :is(.sub-menu, .children) {
    left: 100%;
    top: -11px;
}

.nrd-nav :is(.sub-menu, .children) :is(.sub-menu, .children)::before {
    height: auto;
    left: -12px;
    right: auto;
    top: 0;
    bottom: 0;
    width: 12px;
}

.nrd-nav :is(.sub-menu, .children) .submenu-toggle svg {
    transform: rotate(-90deg);
}

.nrd-nav :is(.sub-menu, .children) li:hover > .submenu-toggle svg,
.nrd-nav :is(.sub-menu, .children) li.submenu-open > .submenu-toggle svg {
    transform: rotate(-90deg);
}

/* Escape closed it (script.js adds .submenu-dismissed): stay closed while the
   pointer or focus is still on the item, until it moves away */
.nrd-nav li.submenu-dismissed > :is(.sub-menu, .children) {
    opacity: 0;
    transform: translateY(8px);
    transition-delay: 0s;
    visibility: hidden;
}

.nrd-nav li.submenu-dismissed > .submenu-toggle svg {
    transform: none;
}

.nrd-nav :is(.sub-menu, .children) li.submenu-dismissed > .submenu-toggle svg {
    transform: rotate(-90deg);
}

/* Panels that would run off the right edge open leftward (script.js adds .opens-left) */
.nrd-nav li.opens-left > :is(.sub-menu, .children) {
    left: auto;
    right: -18px;
}

.nrd-nav :is(.sub-menu, .children) li.opens-left > :is(.sub-menu, .children) {
    left: auto;
    right: 100%;
}

/* A top-level item whose submenu holds the current page */
.nrd-nav > ul > :is(.current-menu-ancestor, .current_page_ancestor) > a {
    color: var(--nrd-primary);
}

@media (prefers-reduced-motion: reduce) {
    .nrd-nav :is(.sub-menu, .children),
    .nrd-nav .submenu-toggle svg {
        transition: none;
    }
}
