/* ===================================
   ✅ 基础响应式设置
   =================================== */
html {
    font-size: 16px;
    /* 默认大屏字体基准 */
}

@media (max-width: 1920px) {
    html {
        font-size: 16px;
    }
}

@media (max-width: 1600px) {
    html {
        font-size: 15px;
    }
}

@media (max-width: 1440px) {
    html {
        font-size: 14px;
    }
}

@media (max-width: 1280px) {
    html {
        font-size: 13px;
    }
}

@media (max-width: 1100px) {
    html {
        font-size: 12px;
    }
}

@media (max-width: 992px) {
    html {
        font-size: 10px;
    }
}

/* ===================================
   全局基础样式
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: white;
    min-height: 100vh;
}

@font-face {
    font-family: 'BRLNSR';
    src: url('https://static.igem.wiki/teams/5855/fonts/brlnsr.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ===================================
   导航栏主容器
   =================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #1a3670;
    height: 7.5rem;
    /* 120px */
    display: flex;
    align-items: center;
    padding: 0 2.5rem;
    /* 40px */
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 0.125rem 0.625rem rgba(0, 0, 0, 0.1),
        0 8.25rem 0 -8.06rem #8A9463;
    background: transparent;
}

.nav-bg-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1a3670;
    z-index: 1;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar.collapsed .nav-bg-mask {
    width: 20.6rem;
    /* 330px */
    border-radius: 0 3.125rem 3.125rem 0;
    height: 6.625rem;
    /* 106px */
    margin-top: 0.5rem;
    /* 8px */
    background: linear-gradient(to right, #5DADE2, #1f2ca5, #1A4B8C);
    backdrop-filter: blur(1.25rem);
}

.navbar.collapsed {
    box-shadow: none;
}

/* ===================================
   LOGO
   =================================== */
.logo-container {
    width: 22.5rem;
    /* 360px */
    height: 90%;
    position: absolute;
    left: -0.125rem;
    top: 0.25rem;
    z-index: 2;
}

.logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ===================================
   导航菜单
   =================================== */
.nav-menu {
    display: flex;
    list-style: none;
    gap: 2.5rem;
    /* 40px */
    height: 100%;
    flex-grow: 1;
    position: absolute;
    right: 8%;
    top: auto;
    z-index: 2;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item {
    position: relative;
    padding: 0.9375rem 0;
    /* 15px */
    align-content: center;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nav-link {
    color: white;
    text-decoration: none;
    font-size: 1.75rem;
    /* 28px */
    font-weight: 200;
    font-family: 'BRLNSR', sans-serif;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-item:hover .nav-link {
    color: #ffb347;
}

.nav-item:hover {
    transform: translateY(-0.125rem);
    /* 2px */
}

.nav-link.active {
    color: #ffb347;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -0.3125rem;
    /* 5px */
    left: 0;
    width: 100%;
    height: 0.1875rem;
    /* 3px */
    background-color: #ffb347;
    border-radius: 0.125rem;
}

/* ===================================
   下拉菜单
   =================================== */
.nav-item .dropdown-menu {
    position: absolute;
    left: 0;
    width: 100%;
    background: transparent;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.625rem);
    transition: all 0.3s ease;
    z-index: 999;
    padding: 3.125rem 0;
    /* 50px */
    display: block;
}

.dropdown-content {
    max-width: 75rem;
    /* 1200px */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.3125rem;
    /* 5px */
}

.dropdown-item {
    color: white;
    padding: 0.625rem 0.625rem 0.625rem 0;
    display: block;
    text-decoration: none;
    font-size: 1.5rem;
    /* 24px */
    font-family: 'BRLNSR', sans-serif;
    transition: color 0.3s ease;
    white-space: nowrap;
    min-width: 12.5rem;
    /* 200px */
}

.dropdown-item:hover {
    color: #ffb347;
}

/* ===================================
   背景遮罩
   =================================== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg,
            #1a3670 30%,
            #1a3770db 50%,
            #1a3770af 70%,
            #1a37703f 90%,
            rgba(26, 54, 112, 0) 95%);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}



/* 折叠状态下隐藏菜单（保留 LOGO） */
.navbar.collapsed .nav-menu {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10%);
    transition: all 0.5s ease;
}

/* 展开时正常显示 */
.navbar:not(.collapsed) .nav-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    transition: all 0.5s ease;
}

/* 让背景 mask 动画保持一致（可选） */
.navbar.collapsed .nav-bg-mask {
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar:not(.collapsed) .nav-bg-mask {
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ------------------ mobile-only visual rules ------------------ */
:root {
    --mobile-nav-width: 78vw;
    --mobile-panel-z: 2100;
}


/* screen smaller or equal to breakpoint -> mobile styles */
@media (max-width: 767px) {

    /* hide original logo and the usual horizontal menu by default */
    .logo-container {
        display: none !important;
    }


    /* hide default nav-menu until mobile is opened */
    .nav-menu {
        display: none !important;
    }


    /* mobile toggle button (created by script if missing) */
    .mobile-toggle {
        display: block;
        position: absolute;
        right: 1rem;
        top: 0.875rem;
        /* keep inside navbar */
        width: 3.5rem;
        height: 3.5rem;
        border-radius: 50%;
        background: linear-gradient(135deg, #5DADE2, #1A4B8C);
        border: none;
        z-index: 2200;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        -webkit-tap-highlight-color: transparent;
    }


    .mobile-toggle:focus {
        outline: 2px solid rgba(255, 179, 71, 0.35);
    }


    .mobile-toggle-icon {
        width: 1.25rem;
        height: 1.25rem;
        position: relative;
    }

    .mobile-toggle-icon::before,
    .mobile-toggle-icon::after,
    .mobile-toggle-icon div {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        height: 2px;
        background: white;
        border-radius: 2px;
    }

    .mobile-toggle-icon::before {
        top: 0;
    }

    .mobile-toggle-icon div {
        top: 50%;
        transform: translateY(-50%);
    }

    .mobile-toggle-icon::after {
        bottom: 0;
    }


    /* slide-out primary menu (re-uses .nav-menu markup) */
    .navbar.mobile-open .nav-menu {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;


        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: var(--mobile-nav-width);
        max-width: 420px;
        padding-top: 5.5rem;
        /* leave room for the top bar */
        gap: 0;
    }
}

/* keep a simple screen-reader only helper */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}