/* ============================================================
   Header account dropdown menu
   Replaces the simple "My Account" link in .hw-header-actions
   with a hoverable / clickable dropdown for logged-in users.
   ============================================================ */

.hw-account-menu {
    position: relative;
    display: inline-block;
    line-height: 1;
}

/* ---- Trigger button ---- */

.hw-account-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.5em 0.75em;
    background: transparent;
    border: 0;
    font: inherit;
    color: inherit;
    line-height: 1;
    cursor: pointer;
}

.hw-account-toggle:hover,
.hw-account-toggle:focus {
    color: #00913A; /* brand green */
}

.hw-account-toggle:focus-visible {
    outline: 2px solid #00913A;
    outline-offset: 2px;
    border-radius: 2px;
}

.hw-account-toggle__caret {
    width: 0.85em;
    height: 0.85em;
    transition: transform 0.18s ease;
    flex-shrink: 0;
}

.hw-account-menu:hover .hw-account-toggle__caret,
.hw-account-menu:focus-within .hw-account-toggle__caret,
.hw-account-menu.is-open .hw-account-toggle__caret {
    transform: rotate(180deg);
}

/* ---- Dropdown panel ---- */

.hw-account-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    margin: 0.25em 0 0;
    padding: 0.4em 0;
    list-style: none;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.10);
    z-index: 1000;

    /* hidden by default; the visibility delay matches the fade-out so the panel
       stays clickable during the transition out but doesn't trap focus when fully hidden */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition:
        opacity    0.15s ease,
        transform  0.15s ease,
        visibility 0s    linear 0.15s;
}

/* Show on hover (desktop), keyboard focus, or JS-toggled open class (mobile) */
.hw-account-menu:hover .hw-account-dropdown,
.hw-account-menu:focus-within .hw-account-dropdown,
.hw-account-menu.is-open .hw-account-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition:
        opacity    0.15s ease,
        transform  0.15s ease,
        visibility 0s    linear 0s;
}

.hw-account-dropdown li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.hw-account-dropdown a {
    display: block;
    padding: 0.55em 1.1em;
    color: #2a2a2a;
    text-decoration: none;
    font-size: 0.95em;
    white-space: nowrap;
    transition:
        background-color 0.12s ease,
        color            0.12s ease;
}

.hw-account-dropdown a:hover,
.hw-account-dropdown a:focus {
    background-color: rgba(0, 145, 58, 0.08); /* brand green @ 8% */
    color: #00913A;
    outline: 0;
}

.hw-account-dropdown__divider {
    height: 1px;
    margin: 0.35em 0;
    background-color: rgba(0, 0, 0, 0.08);
    pointer-events: none;
}

/* ---- Mobile adjustments ---- */

@media (max-width: 768px) {
    .hw-account-dropdown {
        right: 0;
        min-width: 200px;
    }
    .hw-account-toggle__label {
        /* keep label visible at this breakpoint; collapse only on very narrow screens if needed */
    }
}
