nav{
    padding: 1.1em;

    font-family: "Roboto Mono", monospace;

    position: -webkit-sticky;
    position: sticky;
    top: 0; /* required */

    transition: top 1s ease-in-out, border-radius 1s ease-in-out;

   

    z-index: 5;
    padding-left: 2em;
    padding-right: 2em;
    width: max-content;

    background: var(--c-boxes);
    /*background: -moz-linear-gradient(117deg, rgba(34,34,34,1) 0%, rgba(59,54,54,1) 100%);
    background: -webkit-linear-gradient(117deg, rgba(34,34,34,1) 0%, rgba(59,54,54,1) 100%);
    background: linear-gradient(117deg, rgba(34,34,34,1) 0%, rgba(59,54,54,1) 100%);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#222222",endColorstr="#3b3636",GradientType=1);*/

    color: var(--c-text);
    text-align: center;

    margin: auto;
    
    border-radius: 2em;
}
nav.isSticky-nav{
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
nav ul #nav-logo{
    border-right: 0.2em solid var(--c-lines);
}
/* Add class alias for logo used in TSX */
.logo {
    border-right: 0.2em solid var(--c-lines);
}
nav ul #nav-logo span{
    line-height: 0.75;
    font-size: 1.5em;
}
nav a{
    color: #fff;
    transition: color 1s;

    position: relative;
    text-decoration: none;
}
nav a:hover{
    color: var(--c-text);
}
/* Unify link/summary layout to prevent distortion */
nav a,
nav summary {
    color: #fff;
    transition: color 1s;
    position: relative;
    text-decoration: none;
    cursor: pointer;
    display: inline-block;            /* ensure consistent inline sizing */
    vertical-align: middle;           /* align with neighbors */
    padding: 0;                       /* keep padding controlled by li */
}

nav a::before {
    content: "";
    position: absolute;
    display: block;
    width: 100%;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--c-other);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}
nav a:hover::before {
    transform: scaleX(1);
}
nav summary:hover {
    color: var(--c-text);
}

/* underline effect shared for links and summary */
nav a::before,
nav summary::before {
    content: "";
    position: absolute;
    display: block;
    width: 100%;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--c-other);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}
nav a:hover::before,
nav summary:hover::before {
    transform: scaleX(1);
}

/* Submenu support */
.hasSubmenu {
    position: relative;
    vertical-align: middle;           /* align with other inline items */
}

/* Keep details inline to avoid breaking the first row flow */
.hasSubmenu details {
    display: inline-block;
    margin: 0;
    padding: 0;
}

/* Ensure "Services" and caret stay on the same line */
.hasSubmenu details > summary {
    display: inline-flex;       /* horizontal layout */
    align-items: center;        /* vertical alignment */
    gap: 0.5em;                 /* space between text and icon */
    white-space: nowrap;        /* prevent wrapping */
}

/* Hide native disclosure icon/marker on summary */
.hasSubmenu details > summary {
    list-style: none;
    outline: none;
}
.hasSubmenu details > summary::-webkit-details-marker {
    display: none;
}
.hasSubmenu details > summary::marker {
    content: "";
}

/* Reusable caret for submenu triggers */
.caret {
    transition: transform 0.2s ease-in-out;
}

/* Rotate caret when submenu is open */
.hasSubmenu details[open] .caret {
    transform: rotate(180deg);
}

/* Submenu box: place directly under nav with a tiny gap (no overlap) */
.submenu {
    list-style: none;
    margin: 1em 0;
    padding: 0.5em 0;
    position: absolute;
    left: 0;
    top: calc(100% + 0.25em);
    display: none;
    background: var(--c-background-light);
    border: 1px solid var(--c-lines);
    border-radius: 0.75em;
    min-width: max-content;
    text-align: left;
    z-index: 10;
}
.submenu li {
    display: block;
    padding: 0;
}
.submenu a {
    display: inline-block;
    padding: 0;             /* remove padding so underline equals text width */
    margin: 0.35em 0;  /* spacing without affecting underline width */
}

/* Show submenu when open */
.hasSubmenu details[open] .submenu {
    display: flex;
    flex-direction: column;
}

/* Hamburger toggle class (used by TSX) */
.toggle {
    display: none;
    transition: transform 0.5s ease;
}
.toggleRotated {
    transform: rotate(180deg);
}

/* Bridge TSX classnames to existing rules */
.navList {
    list-style: none;
    padding: 0;
}
.navList li {
    display: inline;
    padding: 0 3em;
}
.navList li a {
    text-decoration: none;
}

nav ul {
    list-style: none;
    padding: 0;
}

nav ul li {
    display: inline;
    padding: 0 3em;
}

nav ul li a {
    text-decoration: none;
}
#toggle-nav{
    display: none;

    -webkit-transition: transform 0.5s ease;
    -moz-transition: transform 0.5s ease;
    -o-transition: transform 0.5s ease;
    -ms-transition: transform 0.5s ease;
    transition: transform 0.5s ease;
}
.toggle-nav-rotated {
    transform: rotate(360deg);
}
.nav-open{
    max-height: 20em;
}
@media only screen and (max-width: 990px){
    #toggle-nav{
        margin-top: 0.25em;
        margin-left: 0.75em;
        position: absolute;
        left: 0;
        display: block;
        font-size: 2em;
    }
    nav{
        width: 100%;
        padding: 0;
        border-top-right-radius: 0;
        border-top-left-radius: 0;
        border-bottom-left-radius: 1em;
        border-bottom-right-radius: 1em;
        overflow: hidden;
    }
    nav ul {
        margin-top: 1em;
        gap: 2em;
        display: flex;
        flex-direction: column;

        -webkit-transition: max-height 1s ease;
        -moz-transition: max-height 1s ease;
        -o-transition: max-height 1s ease;
        -ms-transition: max-height 1s ease;
        transition: max-height 1s ease;

        max-height: 2em;
    }
    /* When TSX adds styles.open to the UL, expand it */
    .open {
        max-height: 20em;
    }

    nav ul:last-child{
        padding-bottom: 1em;
    }
    nav ul #nav-logo {
        margin: auto;
        padding-bottom: 0.5em;
        margin-bottom: -1em;
        border-bottom: 0.2em solid var(--c-lines);
        border-right: none;
    }
    /* Show hamburger on mobile */
    .toggle {
        margin-top: 0.25em;
        margin-left: 0.75em;
        position: absolute;
        left: 0;
        display: block;
        font-size: 2em;
    }

    /* Submenu stacks inline under the parent item on mobile */
    .submenu {
        position: static;
        border: none;
        border-radius: 0;
        background: transparent;
        padding: 0 0 0.5em 0.5em;
        min-width: unset;
    }
    .submenu a {
        display: inline-block;
        padding: 0;            /* keep no padding on mobile too */
        margin: 0.25em 0.5em;  /* spacing via margin */
    }
}