* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

header {
    background-color: black;
    min-height: 80px;
    width: 100%;
    /* 开启相对定位，给内部绝对定位元素做参考 */
    position: relative;
    /* 小屏幕内容超出允许自动撑开高度，不会挤死 */
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 0 2vw;
}

h1 {
    color: aliceblue;
    /* 大屏幕用绝对定位；小屏幕交给flex布局，防止重叠 */
    position: absolute;
    left: 2vw;
    top: 0;
    line-height: 80px;
    font-size: clamp(1.5rem,3vw,2.2rem);
}

header li {
    display: inline;
    margin-right: 5vw;
}

header a {
    color: aliceblue;
    text-decoration: none;
}

header a:hover {
    text-decoration: underline;
}

header ul {
    position: absolute;
    right: 5vw;
    top: 0;
    line-height: 80px;
    /* 关键：空间不足允许换行，防止挤压重叠 */
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0 2vw;
}

.main {
    background-color: bisque;
    color: aliceblue;
    min-height: 95vh; /* 改成min‑height，内容多的时候自动撑开，不会裁切文字 */
    background-image: url("images/index.png");
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px 16px; /* 左右内边距，手机不会贴边 */
}

/* 字号使用clamp，屏幕变小字号自动缩小，不会溢出 */
.main h2 {
    font-size: clamp(2rem,7vw,70px);
}
.main h3 {
    color: beige;
    font-size: clamp(1.5rem,4vw,40px);
    margin: 30px 0;
}

.main a {
    color: red;
    line-height: 5;
}

footer {
    text-align: center;
    padding:20px;
    background:#000;
    color:#fff;
}

/* ---媒体查询：屏幕宽度小于 768px（手机/窄窗口），关闭绝对定位，彻底解决导航重叠 --- */
@media (max-width:768px) {
    header {
        position: static;
        flex-direction: column;
        padding:16px;
    }
    h1 {
        position: static;
        line-height: normal;
        margin-bottom:12px;
    }
    header ul {
        position: static;
        line-height: normal;
        justify-content: center;
        right: auto;
        top:auto;
    }
    header li {
        margin-right: 0;
    }
}
