/* ========================================
   Responsive - 响应式设计
   ======================================== */

/* === 平板端 === */
@media (max-width: 1200px) {
  :root {
    --container-padding: 2rem;
  }

  .section {
    padding: var(--space-20) 0;
  }

  .hero-stats {
    gap: var(--space-8);
  }

  .hero-stat-value {
    font-size: var(--text-3xl);
  }

  .footer-grid {
    gap: var(--space-8);
  }

  /* 轮播响应式 */
  .carousel-control {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .carousel-control.prev {
    left: 10px;
  }

  .carousel-control.next {
    right: 10px;
  }
}

/* === 小平板端 === */
@media (max-width: 1024px) {
  :root {
    --container-padding: 1.5rem;
  }
  
  .section {
    padding: var(--space-16) 0;
  }
  
  /* 视频展示区：主视频上移，列表折叠 */
  .video-showcase-wrapper {
    grid-template-columns: 1fr;
  }
  .video-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .video-thumb {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    padding: 8px;
  }
  .video-thumb-cover {
    aspect-ratio: 16/9;
  }

  /* 三列变两列 */
  .philosophy-grid,
  .systems-grid,
  .testimonials-slider,
  .news-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* 页脚调整 */
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-8);
  }
  
  /* Hero 调整 */
  .hero-title-main {
    font-size: var(--text-4xl);
  }
  
  .section-title {
    font-size: var(--text-3xl);
  }
  
  /* CTA 调整 */
  .cta-box {
    padding: var(--space-14);
  }
  
  .cta-features {
    flex-wrap: wrap;
    gap: var(--space-6);
  }
}

/* === 移动端 === */
@media (max-width: 768px) {
  :root {
    --container-padding: 1.25rem;
    --text-4xl: 2rem;
    --text-3xl: 1.75rem;
    --text-2xl: 1.5rem;
  }

  /* iOS 安全区域适配 */
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* === 导航 === */
  .header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-fixed);
    padding-top: env(safe-area-inset-top);
    background: rgba(26, 74, 63, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  /* 全屏导航面板 */
  .nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface);
    flex-direction: column;
    padding: calc(var(--space-20) + 52px) var(--space-6) calc(80px + var(--space-6) + env(safe-area-inset-bottom));
    gap: var(--space-2);
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: var(--z-fixed);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-menu.active {
    transform: translateX(0);
  }

  /* 底部关闭按钮 */
  .nav-close-btn {
    display: flex;
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-8);
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    cursor: pointer;
    z-index: calc(var(--z-fixed) + 2);
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    min-width: 140px;
    min-height: 48px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.2s ease;
  }

  .nav-menu.active ~ .nav-close-btn,
  .nav-close-btn {
    /* shown via JS when menu open */
  }

  .nav-close-btn.visible {
    opacity: 1;
    pointer-events: auto;
  }

  /* 汉堡按钮 — 放大，更醒目 */
  .nav-toggle {
    display: flex;
    width: 52px;
    height: 52px;
    padding: var(--space-2);
    background: rgba(255,255,255,0.12);
    border: 2px solid rgba(255,255,255,0.25);
    border-radius: var(--radius-lg);
  }

  .nav-toggle span {
    width: 22px;
    height: 2px;
    background: #fff;
  }

  /* 汉堡→X 动画 */
  .nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-8px);
  }
  .nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  /* 全屏菜单链接 — 大触摸区域 */
  .nav-link {
    display: flex;
    align-items: center;
    width: 100%;
    padding: var(--space-4) var(--space-5);
    font-size: 1.1rem;
    font-weight: var(--font-medium);
    border-radius: var(--radius-xl);
    text-align: left;
    min-height: 56px;
    color: var(--text-primary);
    background: transparent;
    transition: background 0.2s ease, color 0.2s ease;
  }

  .nav-link:active {
    background: rgba(201,169,76,0.1);
  }

  /* 当前页高亮 */
  .nav-link.active {
    color: var(--color-primary);
    background: rgba(201,169,76,0.12);
    font-weight: var(--font-semibold);
  }

  /* 一级下拉手风琴 */
  .nav-item.has-dropdown {
    flex-direction: column;
  }

  .nav-arrow {
    margin-left: auto;
    transition: transform 0.3s ease;
    font-size: 0.75rem;
    color: var(--text-tertiary);
  }

  .nav-dropdown {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0;
    min-width: unset;
    border-radius: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .nav-dropdown::before { display: none; }

  /* 展开下拉 */
  .nav-item.has-dropdown.open > .nav-dropdown {
    pointer-events: auto;
    max-height: 600px;
  }

  .nav-item.has-dropdown.open > .nav-link .nav-arrow {
    transform: rotate(180deg);
  }

  /* 下拉分组标题 */
  .nav-dropdown-group {
    display: block;
    padding: var(--space-2) var(--space-5);
    font-size: 0.7rem;
    font-weight: var(--font-bold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-top: var(--space-2);
  }

  /* 下拉子项 */
  .nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-lg);
    min-height: 52px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    transition: background 0.2s ease, color 0.2s ease;
  }

  .nav-dropdown-item:active {
    background: rgba(201,169,76,0.1);
  }

  .nav-dropdown-item.active {
    color: var(--color-primary);
    background: rgba(201,169,76,0.1);
    font-weight: var(--font-semibold);
  }

  .nav-dropdown-item .nav-dropdown-icon {
    width: 34px;
    height: 34px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(201,169,76,0.12);
    border-radius: var(--radius-md);
    flex-shrink: 0;
  }

  .nav-dropdown-item.active .ndi-icon {
    background: rgba(201,169,76,0.2);
  }

  /* 隐藏桌面端下拉 */
  .header .nav-dropdown { display: none; }

  @media (min-width: 769px) {
    .header .nav-dropdown { display: block; }
    .nav-close-btn { display: none !important; }
  }
  
  /* === Hero 轮播 === */
  .hero-carousel {
    min-height: auto;
    margin-top: 0;
    padding-top: 76px;
  }

  .carousel-container {
    height: auto;
    min-height: 65vh;
  }

  .slide-content {
    padding: var(--space-10) var(--space-4);
  }

  .slide-badge {
    font-size: var(--text-xs);
    padding: var(--space-2) var(--space-4);
  }

  .slide-title-main {
    font-size: var(--text-3xl);
  }

  .slide-title-sub {
    font-size: var(--text-xl);
  }

  .slide-desc {
    font-size: var(--text-base);
    margin-bottom: var(--space-8);
  }

  .slide-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }
  
  .hero-stats {
    flex-direction: column;
    gap: var(--space-6);
    padding-top: var(--space-8);
  }
  
  .hero-stat-value {
    font-size: var(--text-2xl);
  }
  
  .hero-scroll {
    display: none;
  }
  
  .hero-decoration-1,
  .hero-decoration-2 {
    display: none;
  }
  
  /* === 视频展示区 === */
  .video-showcase-wrapper {
    grid-template-columns: 1fr;
  }
  .video-list {
    grid-template-columns: 1fr;
  }
  .video-thumb {
    grid-template-columns: 120px 1fr;
    grid-template-rows: auto;
    padding: 10px;
  }

  /* === 理念 === */
  .philosophy-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .philosophy-card {
    padding: var(--space-8) var(--space-6);
  }
  
  .philosophy-icon {
    width: 72px;
    height: 72px;
  }
  
  /* === 体系 === */
  .systems-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  
  .system-card {
    padding: var(--space-6);
  }
  
  .system-icon {
    width: 60px;
    height: 60px;
  }
  
  /* === 团队 === */
  .team-preview-grid {
    grid-template-columns: 1fr;
  }
  
  .team-card {
    padding: var(--space-8);
  }
  
  /* === 评价 === */
  .testimonials-slider {
    grid-template-columns: 1fr;
  }
  
  .testimonial-card {
    padding: var(--space-6);
  }
  
  /* === 新闻 === */
  .news-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  
  /* === CTA === */
  .cta-section {
    padding: var(--space-16) 0;
  }
  
  .cta-box {
    padding: var(--space-10) var(--space-6);
    border-radius: var(--radius-xl);
  }
  
  .cta-box h2 {
    font-size: var(--text-2xl);
  }
  
  .cta-box p {
    font-size: var(--text-base);
  }
  
  .cta-actions {
    flex-direction: column;
  }
  
  .cta-actions .btn {
    width: 100%;
    justify-content: center;
  }
  
  .cta-features {
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
  }
  
  /* === 页脚 === */
  .footer {
    padding: var(--space-16) 0 var(--space-8);
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
    text-align: center;
  }
  
  .footer-brand {
    text-align: center;
  }
  
  .footer-logo {
    justify-content: center;
  }
  
  .footer-social {
    justify-content: center;
  }
  
  .footer-links,
  .footer-contact {
    text-align: center;
  }
  
  /* === Section === */
  .section-header {
    margin-bottom: var(--space-10);
  }
  
  .section-cta {
    margin-top: var(--space-8);
  }
}

/* === 小屏手机 === */
@media (max-width: 480px) {
  :root {
    --container-padding: 1rem;
    --text-4xl: 1.75rem;
    --text-3xl: 1.5rem;
    --text-2xl: 1.25rem;
    --text-xl: 1.125rem;
  }

  .container {
    padding: 0 var(--space-4);
  }

  .section {
    padding: var(--space-12) 0;
  }

  /* 轮播小屏适配 */
  .carousel-container {
    min-height: 60vh;
  }

  .slide-content {
    padding: var(--space-8) var(--space-4);
  }

  .slide-title-main {
    font-size: var(--text-2xl);
  }

  .slide-title-sub {
    font-size: var(--text-lg);
  }

  .slide-badge {
    font-size: 10px;
    padding: var(--space-1) var(--space-3);
  }

  .carousel-indicators {
    bottom: 20px;
    gap: var(--space-2);
  }

  .indicator {
    width: 10px;
    height: 10px;
  }

  .carousel-control {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
  }
  
  .philosophy-icon,
  .system-icon {
    width: 60px;
    height: 60px;
  }
  
  .team-avatar {
    width: 96px;
    height: 96px;
  }
  
  .cta-box {
    padding: var(--space-8) var(--space-4);
  }

  .section-tag {
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-3);
  }

  /* === 课程预告 & 每日一症 移动端适配 === */
  .course-preview-grid,
  .daily-tip-grid {
    grid-template-columns: 1fr;
  }

  .course-preview-card,
  .tip-card {
    padding: 20px;
  }

  .course-preview-card h3,
  .tip-card h3 {
    font-size: 16px;
  }
}

/* === 横屏模式 === */
@media (max-width: 768px) and (orientation: landscape) {
  .hero-carousel {
    min-height: auto;
  }

  .carousel-container {
    min-height: auto;
    height: auto;
  }

  .slide-content {
    padding: var(--space-8) var(--space-4);
  }

  .slide-title-main {
    font-size: var(--text-2xl);
  }
}

/* === 高DPI屏幕 === */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .hero-pattern {
    background-size: 24px 24px;
  }
  
  .testimonials::before {
    background-size: 16px 16px;
  }
}

/* === 触摸设备优化 === */
@media (hover: none) and (pointer: coarse) {
  /* 触摸设备禁用悬停效果 */
  .card:hover,
  .philosophy-card:hover,
  .system-card:hover,
  .team-card:hover,
  .news-card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }

  /* 触摸设备增加点击区域 */
  .btn {
    min-height: 48px;
    padding: var(--space-4) var(--space-6);
  }

  .btn-lg {
    min-height: 56px;
  }

  .nav-link {
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  /* 触摸设备优化滑动 */
  .carousel-container {
    touch-action: pan-y;
  }

  /* 评价卡片触摸反馈 */
  .testimonial-card,
  .review-card {
    -webkit-tap-highlight-color: rgba(45, 134, 89, 0.1);
  }

  /* 新闻卡片触摸反馈 */
  .news-item {
    -webkit-tap-highlight-color: rgba(45, 134, 89, 0.1);
  }
}

/* === 移动端滚动优化 === */
@media (max-width: 768px) {
  html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }

  /* 滚动条美化 */
  ::-webkit-scrollbar {
    width: 4px;
    height: 4px;
  }

  ::-webkit-scrollbar-thumb {
    background: rgba(45, 134, 89, 0.3);
    border-radius: 2px;
  }

  /* 理念卡片移动端优化 */
  .philosophy-card {
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-2);
  }

  .philosophy-card h3 {
    font-size: var(--text-lg);
  }

  /* 体系卡片移动端优化 */
  .system-card {
    padding: var(--space-5);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-2);
  }

  /* 团队卡片移动端优化 */
  .team-card {
    padding: var(--space-6);
    border-radius: var(--radius-xl);
  }

  .team-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto var(--space-4);
  }

  .team-info {
    text-align: center;
  }

  /* 评价区域移动端 */
  .testimonial-card,
  .review-card {
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
  }

  .testimonial-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .testimonial-author {
    text-align: left;
  }

  /* 新闻区域移动端 */
  .news-item {
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
  }

  .news-item h3 {
    font-size: var(--text-base);
  }

  .news-item p {
    font-size: var(--text-sm);
    -webkit-line-clamp: 2;
  }

  /* 底部CTA移动端优化 */
  .cta-box {
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    margin: 0 -1.25rem;
    padding: var(--space-8) var(--space-5);
  }

  /* 页脚移动端优化 */
  .footer {
    padding: var(--space-12) 0 calc(var(--space-8) + env(safe-area-inset-bottom));
  }

  /* 返回顶部按钮 */
  .back-to-top {
    position: fixed;
    bottom: calc(var(--space-6) + env(safe-area-inset-bottom));
    right: var(--space-4);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    z-index: var(--z-sticky);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
  }

  .back-to-top.visible {
    opacity: 1;
    visibility: visible;
  }

  .back-to-top:active {
    transform: scale(0.95);
    background: var(--color-primary-dark);
  }
}

/* === 深色模式（可选） === */
@media (prefers-color-scheme: dark) {
  /* 深色模式特定调整 */
  .hero-pattern {
    background-image: 
      radial-gradient(circle at 2px 2px, rgba(27, 107, 90, 0.15) 1px, transparent 1px);
  }
  
  .testimonials::before {
    background-image: 
      radial-gradient(circle at 2px 2px, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  }
}

/* === 打印样式 === */
@media print {
  .header,
  .hero-scroll,
  .hero-actions,
  .cta-section,
  .footer {
    display: none;
  }
  
  .section {
    padding: var(--space-8) 0;
  }
  
  .card,
  .philosophy-card,
  .system-card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
}
