﻿/* ============================================
   TWISTED MAC - DESKTOP DROPDOWN NAV
   ============================================ */

/* Nav stretches to header height so drops can anchor to top: 100%.
   This is what removes the --header-h / .smaller top hacks entirely. */
.mainnav {
    display: flex;
    align-self: stretch;
}

#menu {
    display: flex;
    align-items: stretch;
    margin: 0;
    padding: 0;
    list-style: none;
}

#menu .level1nav {
    position: relative;
    display: flex;
}

#menu .socialmedia-links {
    position: relative;
    display: flex;
}

#menu .socialmedia-links > a {
    display: flex;
    align-items: center;
    padding: 0 16px;
    color: var(--cream);
    font-size: 24px;
    line-height: 1;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .18s ease, color .18s ease;
}

#menu .socialmedia-links > a.selected,
#menu .socialmedia-links > a:hover,
#menu .socialmedia-links:focus-within > a {
    background-color: var(--blue);
    color: var(--yellow);
}


/* Direct-child selector: this is why the drop links no longer need !important */
#menu .level1nav > a {
    display: flex;
    align-items: center;
    padding: 0 16px;
    color: var(--cream);
    font-size: 16px;
    line-height: 1;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .18s ease, color .18s ease;
}

#menu .level1nav > a.selected,
#menu .level1nav > a:hover,
#menu .level1nav:focus-within > a {
    background-color: var(--blue);
    color: var(--yellow);
}

#menu .level1nav > a:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: -2px;
}

#menu .level1nav a i {
    display: inline-flex;
    align-self: center;
    font-size: .8em;
    margin-left: 6px;
    margin-top: 0;
    opacity: .4;
}

#menu .level1nav a:hover i {
    opacity: 1;
}

/* ---- Dropdown panel ---- */
.drop {
    position: absolute;
    top: 100%;          /* bottom of the nav item = bottom of the header */
    right: 0;           /* nav is right-aligned, so all drops right-align */
    z-index: 2000;
    width: 250px;
    background-color: #fff;
    border-top: 1px solid rgba(var(--blue-hue), .3);
    border-bottom: 6px solid rgba(var(--stone-hue), 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .18s ease,
                transform .18s ease,
                visibility 0s linear .18s;
}

.level1nav:hover > .drop,
.level1nav:focus-within > .drop {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity .18s ease,
                transform .18s ease,
                visibility 0s;
}

/* ---- Dropdown links ---- */
.drop a {
    position: relative;
    display: block;
    padding: 9px 20px 8px 12px;
    color: var(--blue);
    font-size: 18px;
    line-height: 1.2;
    font-weight: 400;
    text-transform: none;
    text-decoration: none;
    letter-spacing: .05em;
    border-bottom: 1px solid rgba(var(--blue-shade-hue), .2);
    transition: padding-left .2s ease, background-color .2s ease, color .2s ease;
}

.drop a:last-child {
    border-bottom: none;
}

.drop a:hover,
.drop a:focus-visible,
.drop a.dropselected {
    padding-left: 26px;
    background-color: rgba(var(--stone-hue), .28);
    color: var(--sage-shade);
}

.drop a:focus-visible {
    outline: 2px solid var(--sage);
    outline-offset: -2px;
}

/* ---- Hover arrow ---- */
.drop a::after {
    content: "\f061";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: .7em;
    line-height: 1;
    position: absolute;
    top: 50%;
    right: 30px;
    transform: translateY(-50%);
    color: var(--sage);
    opacity: 0;
    transition: opacity .3s ease, right .3s ease;
}

.drop a:hover::after,
.drop a:focus-visible::after {
    opacity: 1;
    right: 14px;
}

@media (prefers-reduced-motion: reduce) {
    #menu .level1nav > a,
    .drop,
    .drop a,
    .drop a::after {
        transition: none;
    }
}