/*
 * Mesozoic Haven navigation refinements
 * --------------------------------------
 * This file is loaded automatically on every built page.
 *
 * Why it exists:
 * - keeps dropdown behavior separate from the main layout stylesheet
 * - gives dropdowns a short grace period before closing
 * - makes it easier to tune navigation without touching page content
 */

/* The shared header currently uses these simple class names. */
.mh-site-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex-wrap: wrap;
}

.mh-site-nav > a,
.mh-nav-group > a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: var(--mh-radius-sm);
    color: var(--mh-fossil-bone);
    font-weight: 700;
    text-decoration: none;
}

.mh-site-nav > a:hover,
.mh-site-nav > a:focus-visible,
.mh-nav-group > a:hover,
.mh-nav-group > a:focus-visible {
    background: rgba(255, 255, 255, 0.10);
    text-decoration: none;
}

.mh-nav-group {
    position: relative;
}

/*
 * Dropdown timing:
 * - opening: immediate
 * - closing: wait 200ms before fading/sliding away
 *
 * That small grace period makes it much easier to move the pointer from the
 * parent navigation item into the dropdown without accidentally losing it.
 */
.mh-nav-dropdown {
    position: absolute;
    z-index: 50;
    top: calc(100% + 5px);
    left: 0;
    min-width: 200px;
    padding: 6px;
    border: 1px solid var(--mh-border);
    border-radius: var(--mh-radius-sm);
    background: var(--mh-surface);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);

    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);

    transition-property: opacity, transform, visibility;
    transition-duration: 120ms, 120ms, 0ms;
    transition-timing-function: ease, ease, linear;
    transition-delay: 200ms, 200ms, 320ms;
}

.mh-nav-dropdown a {
    display: block;
    padding: 9px 10px;
    border-radius: 6px;
    color: var(--mh-text);
    text-decoration: none;
    white-space: nowrap;
}

.mh-nav-dropdown a:hover,
.mh-nav-dropdown a:focus-visible {
    background: var(--mh-surface-soft);
}

/* Opening cancels the close delay immediately. */
.mh-nav-group:hover .mh-nav-dropdown,
.mh-nav-group:focus-within .mh-nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0ms, 0ms, 0ms;
}

/* Compact search treatment used by the shared header. */
.mh-search-link {
    margin-left: 6px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    font-size: 0.9rem;
}
