/* styles.css - 完整版公共样式表 */
:root {
    /* 基础配色 */
    --primary: #7AC142;
    --secondary: #2A5C45;
    --text: #333;
    --bg: #F8F9FA;
    
    /* 设计令牌 */
    --radius-sm: 8px;
    --radius-md: 15px;
    --shadow-sm: 0 2px 5px rgba(0,0,0,0.05);
    --transition: all 0.3s ease;
    --anim-speed: 0.3s;
    
    /* 暗黑模式变量 */
    --dark-primary: #6A994E;
    --dark-secondary: #1A3C3D;
    --dark-text: #EEE;
    --dark-bg: #1A1A1A;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    
    font-family: 'Microsoft YaHei', 'SimSun', 'Segoe UI', Arial, 'PingFang SC', 'WenQuanYi Zen Hei', sans-serif;
    
    
    line-height: 1.7;
    background: var(--bg);
    color: var(--text);
    transition: background var(--anim-speed), color var(--anim-speed);
}

/* 导航栏 */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: white;
    box-shadow: var(--shadow-sm);
    position: fixed; /* 设置为 fixed 定位 */
    top: 0;
    width: 100%;
    z-index: 1000;
    animation: fadeSlide var(--anim-speed) ease-out;
    transition: var(--transition);
}

/* 移除重复的 navbar 样式 */
/*
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}
*/
.logo img { height: 40px; }
.nav-links {
    display: flex;
    list-style: none;
}
.nav-links a {
    text-decoration: none;
    color: var(--text);
    padding: 0.5rem 0;
    transition: color 0.3s;
    position: relative;
    font-weight: bold; /* 添加这一行，使导航栏菜单文字加粗 */
}
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s;
}
.nav-links a:hover::after { width: 100%; }

/* 行动按钮 */
.cta-btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background: var(--primary);
    color: white !important;
    border-radius: 25px;
    text-decoration: none;
    transition: opacity 0.3s;
}
.cta-btn:hover { opacity: 0.9; }

/* 头部海报 */
.hero {
    display: flex;
    align-items: center;
    gap: 3rem;
    padding: 4rem 5%;
    background: linear-gradient(135deg, #7AC14220 0%, #FFFFFF 100%);
}
.hero-text h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}
.hero-img {
    width: 100%;
    max-width: 500px;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

/* 菜品网格（响应式） */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 3rem 5%;
    max-width: 1200px;
    margin: 0 auto;
}
.menu-item {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    transition: transform 0.3s;
}
.menu-item:hover { transform: translateY(-5px); }
.menu-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}
.menu-info {
    padding: 1.5rem;
    text-align: center;
}
.menu-info h3 { margin-bottom: 0.5rem; }
.menu-info .price {
    display: block;
    margin-top: 1rem;
    color: var(--primary);
    font-weight: bold;
    font-size: 1.1rem;
}

/* 品牌故事 */


.story-banner {
    height: 60vh;
    position: relative;
    overflow: hidden;
    margin-bottom: 4rem;
}
.story-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: bannerZoom 20s infinite alternate;
}
.banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.3) 30%, transparent);
    display: flex;
    align-items: flex-end;
    padding: 0 5% 3rem;
}
.banner-title {
    color: white;
    font-size: clamp(2rem, 5vw, 3.5rem);
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}


.story-section {
    padding: 4rem 5%;
    background: linear-gradient(135deg, #7AC14220 0%, #FFFFFF 100%);
   /* background: var(--primary);*/
    color: black;
}
.story-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}
.story-text {
    background: rgba(255,255,255,0.1);
    padding: 2rem;
    border-radius: 15px;
}

/* 联系板块 */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding: 3rem 5%;
    max-width: 1200px;
    margin: 0 auto;
}
.contact-item {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}
.contact-item img {
    width: 60px;
    margin-bottom: 1rem;
}

/* 页脚 */
footer {
    padding: 2rem 5%;
    background: #222;
    color: #999;
    text-align: center;
}
.social-links img {
    width: 30px;
    margin: 0 0.5rem;
    opacity: 0.7;
    transition: opacity 0.3s;
}
.social-links img:hover { opacity: 1; }


.navbar.scroll-hidden {
    transform: translateY(-100%);
}

.logo img { 
    height: 40px;
 }


/* 主题切换按钮 */
.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg);
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    z-index: 1001;
    transition: var(--transition);
}

.theme-toggle .sun {
    animation: rotate 1.5s infinite linear;
    display: none;
    color: var(--primary);
}

.theme-toggle .moon {
    display: block;
    color: var(--secondary);
}

/* 关键帧动画 */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pageFade {
    from { opacity: 0.9; }
    to { opacity: 1; }
}

/* 暗黑模式样式 */
[data-theme="dark"] {
    --bg: var(--dark-bg);
    --text: var(--dark-text);
    --primary: var(--dark-primary);
    --secondary: var(--dark-secondary);
}

[data-theme="dark"] .navbar {
    background: #222;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

[data-theme="dark"] .bar {
    background: var(--dark-text);
}

[data-theme="dark"] .theme-toggle {
    background: var(--dark-bg);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}


/* 响应式适配 */
@media (max-width: 992px) {
    .hero { flex-direction: column; text-align: center; }
    .hero-img { max-width: 400px; }
    .story-content { grid-template-columns: 1fr; }
}

/* 新增/修改的CSS样式 */
.mobile-menu-btn {
    /* 移动端基础样式 */
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    z-index: 1001;
    color: var(--primary);
}
 
/* 移动端显示规则 */
@media screen and (max-width: 768px) {
    .mobile-menu-btn {
        display: block !important;
    }
 
    /* 隐藏桌面端菜单项 */
    .nav-links li:not(:first-child) {
        display: block;
    }
}
 
/* 桌面端隐藏规则 */
@media screen and (min-width: 769px) {
    .mobile-menu-btn {
        display: none !important;
    }
 
    .nav-links {
        display: flex !important;
        gap: 2rem;
        margin-left: auto;
    }
}
 
/* 适配高分辨率屏幕 */
@media 
(-webkit-min-device-pixel-ratio: 2), 
(min-resolution: 192dpi) {
    .mobile-menu-btn svg {
        width: 1.5rem;
        height: 1.5rem;
    }
}

@media (max-width: 768px) {
    /* 汉堡按钮显隐控制 */
    .mobile-menu-btn {
      display: block !important;
      position: absolute;
      right: 20px;
      top: 20px;
      z-index: 1001;
    }
  
    /* 导航菜单容器 */
    .nav-links {
      display: none;
      position: fixed;
      top: 70px; /* 匹配导航栏高度 */
      left: 0;
      right: 0;
      background: #fff;
      flex-direction: column;
      padding: 10px 15px;
      box-shadow: 0 8px 20px rgba(0,0,0,0.1);
      max-height: calc(100vh - 70px);
      overflow-y: auto;
      z-index: 1000;
    }
  
    /* 激活状态 */
    .nav-links.active {
      display: flex;
      animation: menuSlide 0.3s ease;
    }
  
    /* 菜单项样式 */
    .nav-links li {
      width: 100%;
      margin: 8px 0;
      display: block !important; /* 强制显示所有菜单项 */
    }
  
    .nav-links a {
      display: block;
      padding:10px 12px;
      border-radius: 6px;
      margin: 2px 0; /* 增加微调间距 */
    }
  
    .nav-links a:hover {
      background: #f5f5f5;
    }

     /* 优化行动按钮样式 */
     .nav-links .cta-btn {
        margin-top: 8px; /* 单独设置行动按钮间距 */
        padding: 10px 16px !important;
    }

    /* 微调汉堡菜单按钮位置 */
    .mobile-menu-btn {
        top: 16px;
        right: 16px;
    }
  
    /* 入场动画 */
    @keyframes menuSlide {
      from {
        opacity: 0;
        transform: translateY(-10px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }
  }
  /* 确保锚点目标元素的定位 */
section[id],
header[id] {
    scroll-margin-top: 80px; /* 匹配导航栏高度 */
}

:target {
    scroll-margin-top: 80px; /* 匹配导航栏高度 */
}

/* 修复Safari的弹性滚动问题 */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* 防止滚动时布局偏移 */
.navbar {
    position: sticky;
    top: 0;
    will-change: transform;
}

/* 修复Safari的滚动定位 */
@supports (-webkit-overflow-scrolling: touch) {
    section[id],
    header[id] {
        scroll-snap-margin-top: 80px;
    }
}

html, body {
    height: auto !important;
    overflow: auto !important;
}

/* 优化菜单网格样式 */
.menu-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); /* 缩小最小列宽 */
    gap: 1.5rem; /* 缩小网格间距 */
    padding: 2rem 3%; /* 减少上下内边距，调整左右内边距 */
}

/* 优化菜单项样式 */
/* 合并后的菜单项样式 */
.menu-item {
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.menu-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.menu-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.menu-info {
    padding: 1rem;
    text-align: center;
}

.menu-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.menu-info p {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.8rem;
}

.menu-info .price {
    display: block;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary);
    margin-top: 1rem;
}

/* 优化菜单项图片样式 */
.menu-item img {
    width: 100%;
    height: 150px; /* 固定图片高度 */
    object-fit: cover; /* 保持图片比例并覆盖容器 */
}

/* 优化菜单项信息区域样式 */
.menu-info {
    padding: 1rem; /* 调整内边距 */
}

.menu-info h3 {
    font-size: 1.2rem; /* 缩小标题字体大小 */
    margin-bottom: 0.5rem; /* 减少标题底部间距 */
}

.menu-info p {
    font-size: 0.9rem; /* 缩小描述文字大小 */
    color: #666; /* 调整描述文字颜色 */
    margin-bottom: 0.8rem; /* 减少描述文字底部间距 */
}

.menu-info .price {
    font-size: 1.1rem; /* 调整价格字体大小 */
    font-weight: bold; /* 加粗价格字体 */
    color: var(--primary); /* 使用主题主色 */
}
.story-content img {
    max-width: 100%; /* 限制图片最大宽度为容器宽度 */
    height: auto; /* 保持图片的宽高比 */
    object-fit: cover; /* 可选，根据需求调整图片填充方式 */
}
.visually-hidden {
    position: absolute !important;
    clip: rect(1px 1px 1px 1px);
    clip: rect(1px, 1px, 1px, 1px);
    padding: 0 !important;
    border: 0 !important;
    height: 1px !important;
    width: 1px !important;
    overflow: hidden;
  }

.hero-text p {
    margin-bottom: 0.5rem; /* 可根据需要调整间距值 */
}

.hero-text .cta-btn {
    margin-top: 0.5rem; /* 可根据需要调整按钮与上方元素的间距 */
}
.story-content img {
    max-width: 100%; /* 限制图片最大宽度为容器宽度 */
    height: auto; /* 保持图片的宽高比 */
    object-fit: cover; /* 可选，根据需求调整图片填充方式 */
}
.visually-hidden {
    position: absolute !important;
    clip: rect(1px 1px 1px 1px);
    clip: rect(1px, 1px, 1px, 1px);
    padding: 0 !important;
    border: 0 !important;
    height: 1px !important;
    width: 1px !important;
    overflow: hidden;
  }

/* 确保在电脑端让 .contact-item 排成一行 */
@media (min-width: 768px) { /* 这里的 768px 可以根据实际情况调整，一般作为电脑端的最小宽度 */
    .contact-grid {
        display: flex;
        justify-content: space-between; /* 让元素在容器内均匀分布 */
        gap: 1rem; /* 可以根据需要调整元素之间的间距 */
    }

    .contact-item {
        flex: 1; /* 让每个 .contact-item 元素平均分配容器的宽度 */
        text-align: center; /* 让内容居中显示 */
    }
}
.story-content img {
    max-width: 100%; /* 限制图片最大宽度为容器宽度 */
    height: auto; /* 保持图片的宽高比 */
    object-fit: cover; /* 可选，根据需求调整图片填充方式 */
}
.visually-hidden {
    position: absolute !important;
    clip: rect(1px 1px 1px 1px);
    clip: rect(1px, 1px, 1px, 1px);
    padding: 0 !important;
    border: 0 !important;
    height: 1px !important;
    width: 1px !important;
    overflow: hidden;
  }