/* 全局重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* 包含内边距和边框在元素宽度内 */
    font-family: 'Segoe UI', system-ui, sans-serif; /* 字体栈 */
}

/* 主体样式 */
body {
    min-height: 100vh; /* 最小高度为视口高度 */
    display: flex;
    flex-direction: column; /* 垂直排列 */
    background-color: #f8f9fa; /* 背景色 */
    color: #333; /* 文字颜色 */
    line-height: 1.6; /* 行高 */
}

/* 顶部导航样式 */
.top-header {
    background-color: rgba(255, 255, 255, 0.95); /* 半透明白色背景 */
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08); /* 阴影效果 */
    position: sticky; /* 粘性定位 */
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000; /* 确保在最上层 */
    transition: all 0.3s ease; /* 过渡动画 */
    backdrop-filter: blur(10px); /* 背景模糊效果 */
}

/* 头部容器 */
.header-container {
    max-width: 1200px; /* 最大宽度 */
    margin: 0 auto; /* 水平居中 */
    display: flex;
    align-items: center;
    justify-content: space-between; /* 两端对齐 */
    padding: 1rem 1.5rem; /* 内边距 */
}

/* Logo样式 */
.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #2c3e50;
    font-weight: 700;
    font-size: 1.5rem;
    transition: transform 0.3s ease; /* 缩放过渡 */
}

.logo:hover {
    transform: scale(1.05); /* 悬停放大 */
}

/* Logo图标 */
.logo-icon {
    width: 32px;
    height: 32px;
    margin-right: 0.5rem;
    background: linear-gradient(135deg, #3498db, #2c3e50); /* 渐变背景 */
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

/* 导航菜单 */
.nav-menu {
    display: flex;
    list-style: none;
}

.nav-menu > li {
    position: relative; /* 为下拉菜单定位 */
    margin: 0 0.3rem;
}

/* 导航链接 */
.nav-menu > li > a {
    text-decoration: none;
    color: #2c3e50;
    font-weight: 500;
    padding: 0.7rem 1.2rem;
    border-radius: 6px;
    transition: all 0.3s ease; /* 所有属性过渡 */
    display: flex;
    align-items: center;
}

.nav-menu > li > a:hover {
    color: #3498db;
    background-color: #f8f9fa;
}

.nav-menu > li > a.active {
    color: #3498db;
    background-color: #f0f7ff; /* 激活状态背景 */
}

/* 二级下拉菜单样式 */
.dropdown-menu {
    position: absolute;
    top: 100%; /* 在父元素下方 */
    left: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); /* 阴影 */
    border-radius: 8px;
    opacity: 0; /* 初始隐藏 */
    visibility: hidden;
    transform: translateY(10px); /* 下移10px */
    transition: all 0.3s ease;
    z-index: 1001; /* 在导航之上 */
    padding: 0.5rem 0;
}

/* 悬停显示下拉菜单 */
.nav-menu > li:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0); /* 恢复原位 */
}

.dropdown-menu li {
    list-style: none;
}

.dropdown-menu a {
    display: block;
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    color: #2c3e50;
    transition: all 0.2s ease;
    border-left: 3px solid transparent; /* 左边框 */
}

.dropdown-menu a:hover {
    background-color: #f8f9fa;
    color: #3498db;
    border-left-color: #3498db; /* 悬停时显示左边框 */
}

/* 下拉图标 */
.dropdown-icon {
    margin-left: 0.5rem;
    transition: transform 0.3s ease; /* 旋转过渡 */
    font-size: 0.7rem;
}

.nav-menu > li:hover .dropdown-icon {
    transform: rotate(180deg); /* 悬停旋转 */
}

/* 汉堡菜单（移动端） */
.hamburger {
    display: none; /* 默认隐藏 */
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
    padding: 5px;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: #2c3e50;
    transition: all 0.3s ease;
    border-radius: 2px;
}


/* 视觉隐藏类（用于无障碍） */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* 默认显示所有法律条款 */
p[class^='item'] {
    display: block;
}

/* 确保visually-hidden类能正确隐藏元素 */
p[class^='item'].visually-hidden {
    display: none !important;
}

/* 底部样式 */
/* 去掉所有链接的下划线 */
a {
    text-decoration: none;
}

footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 2rem 1rem;
    text-align: center;
    margin-top: auto; /* 推到页面底部 */
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

/* 底部链接 */
.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap; /* 允许换行 */
    gap: 1.5rem; /* 间距 */
    margin-bottom: 1.5rem;
}

.footer-links a {
    color: #bdc3c7;
    transition: color 0.2s ease;
    font-size: 0.95rem;
    text-decoration: none;
}

.footer-links a:hover {
    color: #3498db;
}



/* 版权信息 */
.copyright {
    color: #95a5a6;
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1); /* 上边框 */
    padding-top: 1.5rem;
}

.copyright a {
    color: #3498db;
}

/* 响应式设计 */
/* 中等屏幕（平板） */
@media (max-width: 992px) {
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%; /* 隐藏在左侧 */
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: left;
        transition: 0.3s;
        box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
        padding: 1rem 0;
        max-height: calc(100vh - 70px); /* 最大高度 */
        overflow-y: auto; /* 允许垂直滚动 */
    }
    
    .nav-menu.active {
        left: 0; /* 显示菜单 */
    }
    
    .nav-menu > li {
        margin: 0;
    }
    
    .nav-menu > li > a {
        display: block;
        padding: 1rem 1.5rem;
        border-bottom: 1px solid #f0f0f0;
    }
    
    /* 移动端下拉菜单样式 */
    .dropdown-menu {
        position: static; /* 取消绝对定位 */
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background-color: #f8f9fa;
        border-radius: 0;
        padding: 0;
        display: none; /* 默认隐藏 */
    }
    
    .dropdown-menu.active {
        display: block; /* 激活时显示 */
    }
    
    .dropdown-menu a {
        padding-left: 2.5rem; /* 增加左内边距 */
        border-left: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .hamburger {
        display: flex; /* 显示汉堡菜单 */
    }
    
    /* 汉堡菜单动画 */
    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .hamburger.active span:nth-child(2) {
        opacity: 0; /* 隐藏中间线 */
    }
    
    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
   

/* 小屏幕（大手机） */
@media (max-width: 768px) {
    .header-container {
        padding: 1rem;
    }
    
    .portfolio #portfolio-filter li {
        padding: 6px 12px;
        font-size: 13px;
        margin: 1px;
    }
    
    .footer-links {
        flex-direction: column; /* 垂直排列 */
        gap: 0.8rem;
    }
    
    .portfolio-container {
        grid-template-columns: 1fr; /* 单列布局 */
    }
}

/* 超小屏幕（手机） */
@media (max-width: 576px) {
    .logo span {
        font-size: 1.3rem;
    }
    
    .portfolio-item .card-body {
        padding: 1rem;
    }
}

/* 滚动时顶部导航样式变化 */
.top-header.scrolled {
    padding: 0.3rem 0;
    background-color: rgba(255, 255, 255, 0.98); /* 更不透明 */
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1); /* 加深阴影 */
}