/* ========================================
   留下研习社 - 统一站点样式
   版本: 2.0 (浏览器兼容性增强版)
   ======================================== */

/* ========== 1. CSS变量定义 ========== */
:root {
  --primary-color: #0085D0;
  --primary-dark: #0075BB;
  --bg-color: #FFFFFF;
  --bg-gradient-start: #FFFFFF;
  --bg-gradient-end: #F4F9FD;
  --text-color: #333333;
  --text-secondary: #666666;
  --border-color: #DAEAF5;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-gold: #f59e0b;
}

/* ========== 2. 全局重置 ========== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
}

/* ========== 3. Body基础样式 ========== */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* 渐变背景（带回退） */
  background: #FFFFFF;
  background: linear-gradient(180deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  
  color: var(--text-color);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  
  /* 字体渲染优化（跨浏览器） */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ========== 4. 网格背景 ========== */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  
  /* 回退方案 */
  background-color: rgba(238, 238, 238, 0.1);
  
  /* 现代浏览器：网格背景 */
  background-image: 
    linear-gradient(#EEEEEE 1px, transparent 1px),
    linear-gradient(90deg, #EEEEEE 1px, transparent 1px);
  background-size: 40px 40px;
  
  opacity: 0.3;
  z-index: -1;
  pointer-events: none;
}

/* ========== 5. 装饰几何 ========== */
.deco-shape {
  position: fixed;
  border: 1px solid var(--primary-color);
  opacity: 0.05;
  z-index: -1;
  pointer-events: none;
  
  /* 防止闪烁 */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.deco-shape-1 {
  top: 150px;
  left: -20px;
  width: 580px;
  height: 550px;
  -webkit-transform: skewY(-5deg);
  transform: skewY(-5deg);
}

.deco-shape-2 {
  top: 180px;
  left: 135px;
  width: 365px;
  height: 320px;
  border-width: 1.5px;
  opacity: 0.08;
}

/* ========== 6. 布局容器 ========== */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ========== 7. Header ========== */
header {
  padding: 80px 0 60px;
  text-align: center;
}

.logo-wrapper {
  /* Flexbox 兼容性 */
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  
  gap: 20px;
  margin-bottom: 30px;
}

.logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  
  /* 图片渲染优化 */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

h1 {
  font-size: 48px;
  font-weight: 900;
  color: var(--primary-color);
  letter-spacing: 2px;
  margin: 0;
}

.subtitle {
  font-size: 22px;
  color: #555555;
  font-weight: 400;
  margin-top: 20px;
}

/* ========== 8. Hero Section ========== */
.hero-section {
  position: relative;
  margin: 60px -24px;
  padding: 60px 40px;
  
  /* 回退方案：纯色背景 */
  background: #0085D0;
  background: var(--primary-color);
  
  /* 斜切效果（带前缀） */
  -webkit-clip-path: polygon(0 20px, 100% 0, 100% calc(100% - 20px), 0 100%);
  clip-path: polygon(0 20px, 100% 0, 100% calc(100% - 20px), 0 100%);
  
  text-align: center;
  color: white;
}

/* Safari 降级方案 */
@supports not (clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%)) {
  .hero-section {
    clip-path: none;
    -webkit-clip-path: none;
    border-radius: 8px;
  }
}

.hero-title {
  font-size: 34px;
  font-weight: 800;
  color: white;
  margin-bottom: 15px;
}

.hero-subtitle {
  font-size: 18px;
  color: #DAF0FF;
  font-weight: 400;
}

/* ========== 9. Sections ========== */
.section {
  padding: 60px 0;
}

.section-header {
  text-align: center;
  margin-bottom: 40px;
}

.section-label {
  display: inline-block;
  padding: 4px 12px;
  background: #E6F4FF;
  color: var(--primary-color);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 16px;
}

.section-title {
  font-size: 28px;
  font-weight: 800;
  color: #333;
  margin-bottom: 12px;
}

/* ========== 10. Cards & Grid ========== */
.card-grid {
  display: grid;
  gap: 24px;
}

.info-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 32px;
  transition: all 0.3s ease;
}

.info-card:hover {
  -webkit-transform: translateY(-4px);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 133, 208, 0.08);
  border-color: var(--primary-color);
}

.info-card h4 {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 16px;
  
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  
  gap: 10px;
}

.info-card h4::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--primary-color);
  -webkit-transform: rotate(45deg);
  transform: rotate(45deg);
  opacity: 0.8;
}

.info-card ul {
  list-style: none;
  padding-left: 0;
}

.info-card li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.7;
}

.info-card li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--primary-color);
  font-weight: bold;
}

.info-card p {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ========== 11. Layer Cards (About Page) ========== */
.layer-card {
  position: relative;
  background: white;
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 24px;
  border-left: 4px solid var(--primary-color);
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.layer-num {
  position: absolute;
  right: 24px;
  top: 24px;
  font-size: 64px;
  font-weight: 900;
  color: #F0F7FF;
  z-index: 0;
  line-height: 1;
  
  /* 防止选中 */
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

.layer-content {
  position: relative;
  z-index: 1;
}

.layer-content h4 {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 12px;
}

.layer-content p {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
}

.layer-content ul {
  list-style: none;
  padding-left: 0;
  margin-top: 12px;
}

.layer-content li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.6;
}

.layer-content li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--primary-color);
  font-weight: bold;
}

/* ========== 12. Pricing Card ========== */
.pricing-card {
  background: #ffffff;
  background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 48px 32px;
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
}

.price-large {
  font-size: 56px;
  font-weight: 900;
  color: var(--primary-color);
  margin: 20px 0;
  line-height: 1;
}

.price-sub {
  font-size: 16px;
  color: #666;
}

/* ========== 13. Buttons ========== */
.btn {
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: 1px solid transparent;
  
  /* 防止双击选中文字 */
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  
  /* 触摸优化 */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 133, 208, 0.2);
}

.btn-primary:hover {
  background: var(--primary-dark);
  -webkit-transform: translateY(-2px);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 133, 208, 0.3);
}

.btn-primary:active {
  -webkit-transform: translateY(0);
  transform: translateY(0);
}

/* ========== 14. 链接样式统一 ========== */
a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:link,
a:visited {
  color: var(--primary-color);
}

a:hover,
a:active {
  color: var(--primary-dark);
}

/* Footer 链接特殊处理 */
.footer-links a {
  color: var(--primary-color);
  text-decoration: none;
  margin: 0 10px;
  transition: color 0.2s ease;
}

.footer-links a:link,
.footer-links a:visited {
  color: var(--primary-color);
}

.footer-links a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ========== 15. 动画系统 ========== */
.fade-in {
  opacity: 0;
  -webkit-transform: translateY(30px);
  transform: translateY(30px);
  
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  -webkit-transition: opacity 0.8s ease-out, -webkit-transform 0.8s ease-out;
  
  /* 性能优化 */
  will-change: opacity, transform;
}

.fade-in.visible {
  opacity: 1;
  -webkit-transform: translateY(0);
  transform: translateY(0);
  
  /* 动画完成后移除will-change */
  will-change: auto;
}

/* 延迟类 */
.delay-1 { 
  transition-delay: 0.1s;
  -webkit-transition-delay: 0.1s;
}

.delay-2 { 
  transition-delay: 0.2s;
  -webkit-transition-delay: 0.2s;
}

.delay-3 { 
  transition-delay: 0.3s;
  -webkit-transition-delay: 0.3s;
}

/* ========== 16. Footer ========== */
footer {
  text-align: center;
  padding: 60px 0;
  color: #666;
  font-size: 14px;
}

footer p {
  margin-bottom: 12px;
}

/* ========== 17. 响应式设计 ========== */
@media (max-width: 768px) {
  h1 { 
    font-size: 36px; 
  }
  
  .hero-section {
    margin: 40px -20px;
    padding: 40px 24px;
  }
  
  .hero-title { 
    font-size: 28px; 
  }
  
  .container { 
    padding: 0 20px; 
  }
  
  .section {
    padding: 40px 0;
  }
  
  .section-title {
    font-size: 24px;
  }
  
  .info-card {
    padding: 24px;
  }
  
  .layer-card {
    padding: 24px;
  }
  
  .layer-num {
    font-size: 48px;
    right: 16px;
    top: 16px;
  }
  
  .pricing-card {
    padding: 32px 24px;
  }
  
  .price-large {
    font-size: 42px;
  }
  
  .logo-wrapper {
    flex-direction: column;
    gap: 12px;
  }
}

@media (max-width: 600px) {
  h1 { 
    font-size: 28px; 
  }
  
  .subtitle {
    font-size: 16px;
  }
  
  .hero-title { 
    font-size: 24px; 
  }
  
  .hero-subtitle {
    font-size: 16px;
  }
  
  .section-title {
    font-size: 20px;
  }
  
  .info-card h4 {
    font-size: 16px;
  }
  
  .info-card li,
  .info-card p {
    font-size: 14px;
  }
}

/* ========== 18. 打印样式优化 ========== */
@media print {
  body::before,
  .deco-shape,
  .fade-in {
    display: none;
  }
  
  .hero-section {
    clip-path: none;
    -webkit-clip-path: none;
  }
  
  .info-card,
  .layer-card {
    page-break-inside: avoid;
  }
}

/* ========== 19. 高对比度模式支持 ========== */
@media (prefers-contrast: high) {
  .info-card {
    border-width: 2px;
  }
  
  .btn-primary {
    border: 2px solid var(--primary-dark);
  }
}

/* ========== 20. 减少动画模式支持 ========== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .fade-in {
    opacity: 1;
    transform: none;
  }
}

/* ========== 21. 滚动优化 ========== */
html {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* 禁用平滑滚动的场景 */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
