/* PillNav CSS - Ported to Vanilla JS */

.pill-nav-container {
    position: absolute;
    /* Absolute to stay at top */
    top: 1em;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    width: max-content;
}

@media (max-width: 768px) {
    .pill-nav-container {
        width: 100%;
        left: 0;
        transform: none;
        padding: 0 1rem;
    }
}

.pill-nav {
    --nav-h: 48px;
    /* Slightly larger for better touch */
    --logo-size: 40px;
    --pill-pad-x: 20px;
    --pill-gap: 4px;

    /* Theme Colors */
    --base: #ffffff;
    /* White container */
    --pill-bg: #080808;
    /* Black pills */
    --pill-text: #ffffff;
    /* White text */
    --hover-text: #000000;
    /* Black text on hover */

    display: flex;
    align-items: center;
    box-sizing: border-box;
    gap: 1rem;
}

@media (max-width: 768px) {
    .pill-nav {
        width: 100%;
        justify-content: space-between;
        gap: 0;
    }
}

.pill-nav-items {
    position: relative;
    display: flex;
    align-items: center;
    height: var(--nav-h);
    background: var(--base);
    border-radius: 9999px;
    padding: 4px;
    /* Add padding for the container look */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    /* Subtle shadow */
}

.pill-logo {
    width: var(--nav-h);
    height: var(--nav-h);
    border-radius: 50%;
    background: var(--base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--pill-bg);
    font-weight: 900;
    font-size: 1.2rem;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.pill-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pill-list {
    list-style: none;
    display: flex;
    align-items: stretch;
    gap: var(--pill-gap);
    margin: 0;
    padding: 0;
    height: 100%;
}

.pill-list>li {
    display: flex;
    height: 100%;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 0 var(--pill-pad-x);
    background: var(--pill-bg);
    color: var(--pill-text);
    text-decoration: none;
    border-radius: 9999px;
    box-sizing: border-box;
    font-weight: 600;
    font-size: 14px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: color 0.3s ease;
}

.pill.is-active {
    background: var(--base);
    /* Invert for active */
    color: var(--pill-bg);
}

.pill .hover-circle {
    position: absolute;
    left: 50%;
    bottom: 0;
    border-radius: 50%;
    background: var(--base);
    /* White circle on hover */
    z-index: 1;
    display: block;
    pointer-events: none;
    will-change: transform;
    width: 100%;
    /* Initial setup for JS */
    height: 100%;
}

.pill .label-stack {
    position: relative;
    display: inline-block;
    z-index: 2;
}

.pill .pill-label {
    position: relative;
    z-index: 2;
    display: inline-block;
    will-change: transform;
}

.pill .pill-label-hover {
    position: absolute;
    left: 0;
    top: 0;
    color: var(--hover-text);
    z-index: 3;
    display: inline-block;
    will-change: transform, opacity;
    opacity: 0;
}

.desktop-only {
    display: flex;
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: flex;
    }
}

.mobile-menu-button {
    width: var(--nav-h);
    height: var(--nav-h);
    border-radius: 50%;
    background: var(--base);
    border: none;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    padding: 0;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.hamburger-line {
    width: 16px;
    height: 2px;
    background: var(--pill-bg);
    border-radius: 1px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.mobile-menu-popover {
    position: absolute;
    top: 4em;
    left: 1rem;
    right: 1rem;
    background: var(--base);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 998;
    opacity: 0;
    transform-origin: top center;
    visibility: hidden;
    padding: 0.5rem;
}

.mobile-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-menu-popover .mobile-menu-link {
    display: block;
    padding: 1rem;
    color: var(--pill-bg);
    background-color: transparent;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    border-radius: 12px;
    transition: background-color 0.2s ease;
    text-transform: uppercase;
}

.mobile-menu-popover .mobile-menu-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
}