/* Top navigation bar */
.topnav {
    background-color: #ffffff;
    position: fixed;
    z-index: 999;
    width: 100%;
    box-shadow: 0 2px 16px rgba(0,0,0,0.22);
}

.topnav::after {
    content: '';
    display: block;
    clear: both;
}

.topnav #myLinks {
    display: inline;
}

.topnav a.icon {
    display: none;
}

/* Logo — align left edge with the page wrapper */
.topnav .brand-link {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-left: calc(50% - 423px);
    color: #BF5700;
    font-size: 18px;
    font-weight: 700;
    line-height: 44px;
    text-decoration: none;
}

.topnav img.affiliation-logo {
    width: 76px;
    height: 34px;
    object-fit: contain;
    margin: 5px 0;
}

/* Style the links inside the navigation bar */
.topnav a.normal {
    float: right;
    color: #BF5700;
    text-align: center;
    padding: 11px 10px;
    text-decoration: none;
    font-size: 16px;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    letter-spacing: 0.03em;
    position: relative;
    transition: color 0.2s ease;
}

.topnav a.normal::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 10px;
    right: 10px;
    height: 2px;
    background: #BF5700;
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

.topnav a.normal:hover {
    background-color: transparent;
    color: #8f4100;
}

.topnav a.normal:hover::after {
    transform: scaleX(1);
}

/* First nav item — align right edge with the page wrapper */
.topnav a.right {
    margin-right: calc(50% - 480px);
}

.topnav .dropdown.right {
    margin-right: calc(50% - 480px);
}

/* ─── Dropdown ─── */
.topnav .dropdown {
    float: right;
    position: relative;
}

.topnav .dropdown .dropbtn {
    display: block;
    float: none;
    cursor: pointer;
    user-select: none;
}

.topnav .dropdown .dropdown-arrow {
    font-size: 11px;
    vertical-align: middle;
    margin-left: 1px;
}

.topnav .dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: #ffffff;
    min-width: 130px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
    border-top: 2px solid #BF5700;
    z-index: 1000;
}

.topnav .dropdown-content a {
    color: #BF5700;
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    font-size: 15px;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    text-align: left;
    white-space: nowrap;
    transition: color 0.2s ease, background 0.2s ease;
}

.topnav .dropdown-content a:hover {
    color: #8f4100;
    background-color: rgba(191,87,0,0.08);
}

.topnav .dropdown:hover .dropdown-content {
    display: block;
}

/* ─── Responsive: tablet / small desktop ─── */
@media print, screen and (max-width: 1000px) {
    .topnav .brand-link     { margin-left: 16px; }
    .topnav a.right         { margin-right: 16px; }
    .topnav .dropdown.right { margin-right: 16px; }
    .topnav a.normal        { padding: 11px 7px; }
}

/* ─── Responsive: mobile (hamburger menu) ─── */
@media print, screen and (max-width: 960px) {

    .topnav .brand-link { margin-left: 24px; }

    .topnav a.normal::after { display: none; }

    .topnav #myLinks {
        display: flex;
        flex-direction: column-reverse;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s ease-in-out;
    }

    .topnav #myLinks.open {
        max-height: 600px;
    }

    .topnav a.normal {
        color: #BF5700;
        float: none;
        padding: 14px 16px;
        text-decoration: none;
        font-size: 16px;
        display: block;
    }

    .topnav a.icon {
        color: #BF5700;
        display: block;
        padding: 10px 16px;
        font-size: 17px;
        position: absolute;
        float: right;
        right: 0;
        top: 0;
        margin-right: 5%;
    }

    .topnav a.icon .icon-wrap {
        position: relative;
        display: inline-block;
        width: 1em;
        height: 1em;
    }

    .topnav a.icon .icon-bars,
    .topnav a.icon .icon-xmark {
        position: absolute;
        top: 0;
        left: 0;
        transition: opacity 0.25s ease, transform 0.25s ease;
    }

    .topnav a.icon .icon-bars  { opacity: 1; transform: rotate(0deg); }
    .topnav a.icon .icon-xmark { opacity: 0; transform: rotate(-90deg); }

    .topnav a.icon.active .icon-bars  { opacity: 0; transform: rotate(90deg); }
    .topnav a.icon.active .icon-xmark { opacity: 1; transform: rotate(0deg); }

    .topnav a.right {
        color: #BF5700;
        float: none;
        padding: 14px 16px;
        text-decoration: none;
        font-size: 16px;
        display: block;
        margin-right: 0;
    }

    .topnav .dropdown {
        float: none;
        width: 100%;
    }

    .topnav .dropdown .dropbtn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        width: 100%;
        box-sizing: border-box;
        padding: 14px 16px;
    }

    .topnav .dropdown .dropdown-arrow {
        font-size: 13px;
        transition: transform 0.25s ease;
    }

    .topnav .dropdown.open .dropdown-arrow {
        transform: rotate(180deg);
    }

    .topnav .dropdown-content {
        display: block;
        position: static;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        box-shadow: none;
        border-top: none;
        background-color: transparent;
        min-width: unset;
    }

    .topnav .dropdown.open .dropdown-content {
        max-height: 200px;
    }

    .topnav .dropdown-content a {
        padding: 10px 16px;
        font-size: 15px;
        color: #BF5700;
        text-align: center;
    }

    .topnav .dropdown-content a:hover {
        color: #8f4100;
        background-color: transparent;
    }
}
