/* Tools dropdown menu — desktop hover, mobile/touch tap.
   No transforms (Chrome rule #10). Defensive [hidden] override. */

.nav-dropdown { position: relative; display: inline-flex; align-items: center; gap: 0; }

.nav-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.nav-dropdown-trigger:hover { color: var(--text-primary); }
.nav-dropdown-trigger.active { color: var(--accent); font-weight: 600; }

.nav-caret {
    font-size: 0.65rem;
    line-height: 1;
    margin-left: 0.05rem;
    color: inherit;
    transition: color 0.12s ease;
}

.nav-dropdown-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}
.nav-dropdown-toggle:hover { color: var(--text-primary); }
.nav-dropdown-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.4rem;
    min-width: 260px;
    list-style: none;
    padding: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.55);
    z-index: 1001;
}
.nav-dropdown-menu[hidden] { display: none !important; }

.nav-dropdown-menu li { list-style: none; }
.nav-dropdown-menu a {
    display: block;
    padding: 0.55rem 0.85rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    line-height: 1.3;
}
.nav-dropdown-menu a:hover {
    background: rgba(212,175,55,0.12);
    color: var(--text-primary);
}
.nav-dropdown-menu a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 0;
}

.nav-dropdown-divider {
    height: 1px;
    background: var(--card-border);
    margin: 0.4rem 0.5rem;
    list-style: none;
}

.nav-dropdown-all {
    color: var(--accent) !important;
    font-weight: 600 !important;
}
.nav-dropdown-all:hover {
    background: rgba(212,175,55,0.20) !important;
}

/* Desktop with hover capability: open menu on hover or focus-within */
@media (hover: hover) and (min-width: 769px) {
    .nav-dropdown:hover .nav-dropdown-menu,
    .nav-dropdown:focus-within .nav-dropdown-menu,
    .nav-dropdown[data-open="true"] .nav-dropdown-menu {
        display: block !important;
    }
    /* Trigger gets a subtle hover hint */
    .nav-dropdown:hover .nav-caret { color: var(--accent); }
    /* Invisible bridge spans the 0.4rem gap between trigger and menu so the
       cursor doesn't drop :hover during slow downward travel. Pseudo-element
       of the menu — only exists when the menu is rendered (display:block). */
    .nav-dropdown-menu::before {
        content: '';
        position: absolute;
        top: -0.4rem;
        left: 0;
        right: 0;
        height: 0.4rem;
    }
}

/* Touch-only or narrow viewport: chevron button replaces hover */
@media (hover: none), (max-width: 768px) {
    .nav-caret { display: none; }
    .nav-dropdown-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }
    .nav-dropdown[data-open="true"] .nav-dropdown-menu {
        display: block !important;
    }
}

/* Mobile inline style: dropdown becomes nested list under hamburger */
@media (max-width: 768px) {
    .nav-dropdown {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: stretch;
        width: 100%;
    }
    .nav-dropdown-trigger {
        flex: 1 1 auto;
        padding: 0.75rem 1rem !important;
        border-bottom: 1px solid var(--card-border);
    }
    .nav-dropdown-toggle {
        flex: 0 0 auto;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid var(--card-border);
    }
    .nav-dropdown-menu {
        position: static;
        flex: 1 0 100%;
        margin-top: 0;
        min-width: 0;
        background: rgba(212,175,55,0.04);
        border: none;
        border-bottom: 1px solid var(--card-border);
        box-shadow: none;
        border-radius: 0;
        padding: 0.25rem 0;
    }
    .nav-dropdown-menu a {
        padding: 0.7rem 1rem 0.7rem 2rem !important;
        border-bottom: 1px solid rgba(212,175,55,0.06) !important;
        border-radius: 0 !important;
    }
    .nav-dropdown-menu li:last-child a { border-bottom: none !important; }
    .nav-dropdown-divider { margin: 0.2rem 0; }
}
