/**
 * navbar.css
 * ================================================
 * 导航栏样式定义文件
 * ------------------------------------------------
 * 功能说明：
 * 1. 定义网站顶部导航栏的视觉样式
 * 2. 实现响应式布局适配不同设备屏幕
 * 3. 定义导航元素的交互动画效果
 * 4. 实现导航栏在页面滚动时固定在原位置
 * 
 * 样式组织：
 * - 导航栏容器 (.site-header)
 * - 导航内容容器 (.nav-container)
 * - 网站Logo区域 (.nav-logo, .nav-logo-text)
 * - 导航菜单 (.nav-menu, .nav-links, .nav-item, .nav-link)
 * - 动画效果定义 (@keyframes)
 * 
 * 响应式断点：
 * - 移动设备：默认样式
 * - 平板设备：min-width: 640px
 * - 桌面设备：min-width: 1024px
 * 
 * 配色方案：
 * - 背景色：rgba(31, 41, 55, 0.8)（半透明深灰）
 * - 文字颜色：#ffffff（白色）
 * - 强调色：通过SVG内部定义
 * 
 * 版本: 1.0.4
 * 最后更新: 2023-05-22
 */

/* 导航栏容器包装
 * ------------------------------------------------
 * 创建一个固定高度的容器来承载导航栏
 * 确保滚动时页面布局不会跳动
 */
.header-wrapper {
    height: calc(0.75rem + 40px + 0.75rem); /* 导航栏总高度：上边距 + 导航栏高度 + 下边距 */
    margin: 0 1rem;
    position: relative;
    margin-bottom: 1.5rem; /* 与游戏区和more games区域间距一致，等于gap-6 */
}

@media (min-width: 640px) {
    .header-wrapper {
        margin: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .header-wrapper {
        margin: 0 2rem;
    }
}

/* 导航栏主容器样式
 * ------------------------------------------------
 * 创建一个半透明的导航栏，带有背景模糊效果
 * 应用圆角和阴影增强视觉层次感
 * 固定在原来的位置
 */
.site-header {
    background-color: rgba(31, 41, 55, 0.8); /* 设置为80%不透明，与内容区域原样式一致 */
    backdrop-filter: blur(8px); /* 添加模糊效果，与内容区域原样式一致 */
    margin: 0.75rem 1rem 0 1rem; /* 上右下左，将底部间距设为0，通过外部容器控制 */
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem; /* 添加圆角，与how-to-play区域一致 */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* 响应式边距，与其他区域保持一致 */
@media (min-width: 640px) {
    .site-header {
        margin-left: 1.5rem;
        margin-right: 1.5rem;
        margin-bottom: 0; /* 确保底部边距在各种屏幕尺寸下保持一致为0 */
    }
}

@media (min-width: 1024px) {
    .site-header {
        margin-left: 2rem;
        margin-right: 2rem;
        margin-bottom: 0; /* 确保底部边距在各种屏幕尺寸下保持一致为0 */
    }
}

/* 导航内容容器
 * ------------------------------------------------
 * 创建一个水平布局的容器，用于放置导航元素
 * 设置最大宽度确保在大屏幕上内容不会过宽
 */
.nav-container {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* 改为靠左对齐，让菜单紧跟logo */
    max-width: 88rem;
    margin: 0 auto;
}

/* Logo链接容器
 * ------------------------------------------------
 * 定义Logo区域的布局，包含SVG图标和文字
 */
.nav-logo {
    display: flex;
    align-items: center;
    color: #ffffff;
    text-decoration: none;
    margin-right: 6.5rem; /* 再次增加logo与菜单之间的间距 */
}

/* Logo SVG图标
 * ------------------------------------------------
 * 设置SVG图标的尺寸和间距
 */
.nav-logo svg {
    width: 40px;
    height: 40px;
    margin-right: 0.75rem;
}

/* Logo文字样式
 * ------------------------------------------------
 * 定义网站名称文字的字体、大小和其他样式
  * #d6fe51, #c63513
 */
 .nav-logo-text {
    font-family: 'Permanent Marker', cursive;
    font-size: 1.6rem;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #d30303, #df901f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    font-weight: 00;
}

/* 导航菜单
 * ------------------------------------------------
 * 定义导航菜单的整体布局
 */
.nav-menu {
    display: flex;
    align-items: center;
}

/* 导航链接列表
 * ------------------------------------------------
 * 定义导航链接的列表布局
 */
.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* 导航项
 * ------------------------------------------------
 * 定义每个导航项的样式
 */
.nav-item {
    margin-left: 0; /* 移除左侧间距 */
}

/* 为除第一个之外的所有导航项添加左侧间距 */
.nav-item + .nav-item {
    margin-left: 1.5rem; /* 增加菜单项之间的间距 */
}

/* 导航链接
 * ------------------------------------------------
 * 定义导航链接的样式
 */
.nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

/* Home链接特殊样式
 * ------------------------------------------------
 * 定义Home菜单按钮的特殊样式，包括线框边框
 */
.nav-link.home-link {
    color: #a0aec0; /* 默认时使用与正文一致的颜色 */
    border: none; /* 默认时无边框 */
    border-radius: 0.4rem;
    padding: 0.25rem 0.50rem; /* 与random-game-link保持一致的内边距 */
    font-family: 'Nunito', sans-serif; /* 使用Nunito字体 */
    font-weight: 600;
    font-size: 1.1rem;
    min-width: 80px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer; /* 添加与random-game-link一致的鼠标指针样式 */
}

/* Home链接悬停效果
 * ------------------------------------------------
 */
.nav-link.home-link:hover {
    color: #ffffff; /* 悬停时文字变为白色 */
    border: 1px solid #ffffff; /* 悬停时显示白色边框 */
    background-color: transparent; /* 覆盖通用的nav-link:hover样式的背景色 */
}

/* 导航链接hover效果
 * ------------------------------------------------
 */
.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* 激活状态的导航链接
 * ------------------------------------------------
 */
.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* 导航链接图标
 * ------------------------------------------------
 */
.nav-link i {
    margin-right: 0.5rem;
}

/* 创建动画效果 */
@keyframes carPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.car-pulse-anim {
    animation: carPulse 2s ease-in-out infinite;
    transform-origin: center;
}

/* Random Game链接特殊样式
 * 让Random Game菜单按钮和Home一致，包括线框边框和字体
 */
.nav-link.random-game-link {
    color: #a0aec0;
    border: none;
    border-radius: 0.4rem;
    padding: 0.25rem 0.50rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    min-width: 80px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-link.random-game-link:hover {
    color: #ffffff;
    border: 1px solid #ffffff;
    background-color: transparent;
}

/* 只保留ready类的样式，用于显示初始化状态 */
.nav-link.random-game-link.ready {
    position: relative;
}

.nav-link.random-game-link.ready:before {
    content: "";  /* 移除🎲图标 */
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
    opacity: 0.8;
} 