/* ============================================================
   《三体》书籍品牌形象页  style.css
   布局：Flexbox + Grid ｜ 主题：乱纪元(暗夜) / 恒纪元(白昼)
   ============================================================ */

/* ---------- 设计令牌：双主题变量 ---------- */
:root {
  --serif-en: 'Instrument Serif', 'Noto Serif SC', serif;
  --serif-cn: 'Noto Serif SC', 'Instrument Serif', 'Songti SC', 'SimSun', serif;
  --radius-lg: 28px;
  --radius-md: 20px;
}

/* 乱纪元：深邃黑夜（默认，参照设计稿 bg-black） */
[data-theme='chaos'] {
  --bg: #000000;
  --bg-soft: #060608;
  --text: #ffffff;
  --text-soft: rgba(255, 255, 255, 0.72);
  --text-faint: rgba(255, 255, 255, 0.42);
  --line: rgba(255, 255, 255, 0.1);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-inset: inset 0 1px 1px rgba(255, 255, 255, 0.1);
  --glass-gradient: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.45) 0%,
    rgba(255, 255, 255, 0.15) 20%,
    rgba(255, 255, 255, 0) 40%,
    rgba(255, 255, 255, 0) 60%,
    rgba(255, 255, 255, 0.15) 80%,
    rgba(255, 255, 255, 0.45) 100%
  );
  --accent: #8fd0ff;
  --accent-glow: rgba(143, 208, 255, 0.35);
  --star-opacity: 1;
  --nebula: radial-gradient(
    ellipse at 50% 0%,
    rgba(56, 96, 168, 0.22) 0%,
    rgba(20, 10, 45, 0.12) 40%,
    transparent 70%
  );
}

/* 恒纪元：温暖白昼（三体星系运行稳定、太阳如期升起的纪元） */
[data-theme='stable'] {
  --bg: #f1e8d8;
  --bg-soft: #ece1cc;
  --text: #221d14;
  --text-soft: rgba(34, 29, 20, 0.75);
  --text-faint: rgba(34, 29, 20, 0.48);
  --line: rgba(34, 29, 20, 0.12);
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-inset: inset 0 1px 1px rgba(255, 255, 255, 0.85);
  --glass-gradient: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.3) 20%,
    rgba(255, 255, 255, 0) 40%,
    rgba(255, 255, 255, 0) 60%,
    rgba(255, 255, 255, 0.3) 80%,
    rgba(255, 255, 255, 0.9) 100%
  );
  --accent: #b45309;
  --accent-glow: rgba(180, 83, 9, 0.25);
  --star-opacity: 0.12;
  --nebula: radial-gradient(
    ellipse at 50% 0%,
    rgba(255, 214, 150, 0.5) 0%,
    rgba(255, 230, 190, 0.25) 40%,
    transparent 75%
  );
}

/* ---------- 基础重置 ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif-cn);
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.6s ease, color 0.6s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

em {
  font-style: italic;
  font-family: var(--serif-en), var(--serif-cn);
}

/* ---------- 液态玻璃（复刻设计稿 .liquid-glass） ---------- */
.liquid-glass {
  background: var(--glass-bg);
  background-blend-mode: luminosity;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: none;
  box-shadow: var(--glass-inset);
  position: relative;
  overflow: hidden;
  transition: background 0.6s ease, box-shadow 0.6s ease, transform 0.35s ease;
}

.liquid-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.4px;
  background: var(--glass-gradient);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ============================================================
   星空背景（纯 CSS，三层视差 + 星云）
   ============================================================ */
.starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--star-opacity);
  transition: opacity 0.8s ease;
}

.star-layer {
  position: absolute;
  inset: -100%;
  width: 300%;
  height: 300%;
  background-repeat: repeat;
}

.star-layer-1 {
  background-image:
    radial-gradient(1.2px 1.2px at 20px 30px, #fff, transparent),
    radial-gradient(1px 1px at 130px 90px, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 80px 160px, #cfe6ff, transparent),
    radial-gradient(1px 1px at 200px 50px, #fff, transparent),
    radial-gradient(1px 1px at 260px 180px, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1.4px 1.4px at 40px 230px, #fff, transparent);
  background-size: 300px 260px;
  animation: star-drift 140s linear infinite;
}

.star-layer-2 {
  background-image:
    radial-gradient(1px 1px at 60px 70px, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1.8px 1.8px at 180px 140px, #fff, transparent),
    radial-gradient(1px 1px at 240px 30px, #b9d8ff, transparent),
    radial-gradient(1.2px 1.2px at 110px 220px, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 20px 300px, #fff, transparent);
  background-size: 340px 320px;
  animation: star-drift 90s linear infinite reverse;
}

.star-layer-3 {
  background-image:
    radial-gradient(2.2px 2.2px at 100px 100px, rgba(255, 255, 255, 0.95), transparent),
    radial-gradient(2px 2px at 280px 240px, #dcefff, transparent),
    radial-gradient(1.6px 1.6px at 30px 380px, #fff, transparent);
  background-size: 420px 460px;
  animation: star-twinkle 6s ease-in-out infinite alternate, star-drift 200s linear infinite;
}

.nebula {
  position: absolute;
  inset: 0;
  background: var(--nebula);
  transition: background 0.8s ease;
}

@keyframes star-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-300px, -260px, 0); }
}

@keyframes star-twinkle {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

/* ============================================================
   SECTION 1 · HERO
   ============================================================ */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* 导航 */
.navbar {
  position: relative;
  z-index: 20;
  padding: 24px;
}

.nav-inner {
  max-width: 64rem;
  margin: 0 auto;
  border-radius: 999px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.brand svg {
  color: var(--accent);
  animation: brand-spin 24s linear infinite;
}

.brand-en {
  font-family: var(--serif-en);
  font-style: italic;
  font-weight: 400;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  color: var(--text-faint);
  margin-left: 8px;
}

@keyframes brand-spin {
  to { transform: rotate(360deg); }
}

.nav-links {
  display: flex;
  gap: 32px;
  margin-left: 32px;
  margin-right: auto;
}

.nav-links a {
  font-size: 0.875rem;
  color: var(--text-soft);
  transition: color 0.25s;
}

.nav-links a:hover {
  color: var(--text);
}

.era-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-family: var(--serif-cn);
  color: var(--text);
  white-space: nowrap;
}

.era-toggle:hover {
  background: rgba(128, 128, 128, 0.12);
}

/* 两个图标随主题切换显隐 */
[data-theme='chaos'] .icon-sun { display: none; }
[data-theme='stable'] .icon-moon { display: none; }

/* Hero 主内容：Flex 垂直居中 */
.hero-content {
  position: relative;
  z-index: 10;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  transform: translateY(-8%);
  gap: 22px;
}

.hero-kicker {
  font-size: 0.8rem;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  color: var(--text-faint);
  text-transform: uppercase;
}

.hero-title {
  font-family: var(--serif-cn);
  font-weight: 700;
  font-size: clamp(4.5rem, 16vw, 11rem);
  line-height: 1;
  letter-spacing: 0.12em;
  text-indent: 0.12em;
  display: flex;
}

/* 渐变裁剪必须落在文字所在的元素（span）上，否则文字会透明不可见 */
.reveat-line {
  display: inline-block;
  background: linear-gradient(180deg, var(--text) 30%, var(--text-faint) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--text); /* 不支持 background-clip 时的兜底颜色 */
  animation: title-rise 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.reveat-line:last-child {
  animation-delay: 0.18s;
}

@keyframes title-rise {
  from { opacity: 0; transform: translateY(60px) rotate(4deg); }
  to { opacity: 1; transform: translateY(0) rotate(0); }
}

.hero-slogan {
  font-family: var(--serif-cn);
  font-size: clamp(1.05rem, 2.4vw, 1.5rem);
  color: var(--text-soft);
  letter-spacing: 0.14em;
  min-height: 2.2em;
}

.caret {
  color: var(--accent);
  animation: caret-blink 0.9s steps(1) infinite;
  font-weight: 300;
}

@keyframes caret-blink {
  50% { opacity: 0; }
}

.hero-sub {
  max-width: 40rem;
  font-size: 0.92rem;
  color: var(--text-soft);
  line-height: 2;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 13px 30px;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  transition: transform 0.25s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.97); }

.btn-primary {
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
}

[data-theme='stable'] .btn-primary {
  background: #221d14;
  color: #faf4e8;
}

.btn-primary:hover {
  box-shadow: 0 8px 30px var(--accent-glow);
}

/* 向下滚动提示 */
.scroll-hint {
  position: relative;
  z-index: 10;
  align-self: center;
  width: 26px;
  height: 42px;
  border: 1.5px solid var(--text-faint);
  border-radius: 14px;
  margin-bottom: 28px;
  display: flex;
  justify-content: center;
  padding-top: 7px;
}

.scroll-hint span {
  width: 3px;
  height: 8px;
  border-radius: 3px;
  background: var(--text-soft);
  animation: scroll-dot 1.6s ease-in-out infinite;
}

@keyframes scroll-dot {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* ============================================================
   通用 SECTION
   ============================================================ */
.section {
  max-width: 72rem;
  margin: 0 auto;
  padding: 110px 24px;
}

.section-head {
  max-width: 46rem;
  margin-bottom: 64px;
}

.section-label {
  font-family: var(--serif-en);
  font-size: 0.8rem;
  letter-spacing: 0.32em;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-bottom: 16px;
}

.section-title {
  font-size: clamp(2rem, 4.6vw, 3.6rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: 0.02em;
  margin-bottom: 18px;
}

.section-title em {
  color: var(--text-faint);
  font-size: 1.06em;
}

.section-desc {
  color: var(--text-soft);
  font-size: 0.98rem;
}

/* ============================================================
   SECTION 2 · 核心解读（Flexbox 纵向卡片）
   ============================================================ */
.insights {
  background:
    radial-gradient(ellipse at top, rgba(143, 208, 255, 0.05) 0%, transparent 65%);
}

.insight-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.insight-card {
  border-radius: var(--radius-lg);
  display: flex;
  gap: 32px;
  padding: 40px 44px;
  align-items: flex-start;
}

.insight-card:hover {
  transform: translateY(-4px);
}

.insight-index {
  font-family: var(--serif-en);
  font-style: italic;
  font-size: 3.4rem;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--text-faint);
  flex-shrink: 0;
  width: 88px;
}

.insight-body h3 {
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 16px;
  letter-spacing: 0.01em;
}

.insight-body h3 strong {
  color: var(--accent);
  font-weight: 700;
}

.insight-body p {
  color: var(--text-soft);
  font-size: 0.97rem;
  margin-bottom: 14px;
  text-align: justify;
}

.my-story {
  margin-top: 20px;
  padding: 20px 24px;
  border-left: 2px solid var(--accent);
  background: rgba(128, 128, 128, 0.06);
  border-radius: 0 14px 14px 0;
}

.story-label {
  font-size: 0.82rem !important;
  letter-spacing: 0.12em;
  color: var(--accent) !important;
  margin-bottom: 8px !important;
  font-weight: 600;
}

.my-story p:last-child {
  margin-bottom: 0;
}

/* ============================================================
   SECTION 3 · 金句博物馆（Grid 卡片）
   ============================================================ */
.quote-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.quote-card {
  border-radius: var(--radius-md);
  padding: 34px 28px 26px;
  display: flex;
  flex-direction: column;
  min-height: 230px;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease, background 0.6s ease;
}

.quote-card:hover {
  transform: translateY(-8px) scale(1.015);
  box-shadow: var(--glass-inset), 0 20px 50px -20px var(--accent-glow);
}

.quote-mark {
  font-family: var(--serif-en);
  font-size: 3.4rem;
  line-height: 0.8;
  color: var(--accent);
  opacity: 0.65;
  margin-bottom: 10px;
}

.quote-card blockquote {
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.8;
  letter-spacing: 0.02em;
  flex: 1;
}

.quote-card figcaption {
  margin-top: 18px;
  font-size: 0.8rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* ============================================================
   ABOUT · 关于本书
   ============================================================ */
.about-card {
  border-radius: var(--radius-lg);
  padding: 56px;
  display: flex;
  align-items: center;
  gap: 48px;
}

.about-text {
  flex: 1;
}

.about-text p {
  color: var(--text-soft);
  font-size: 0.97rem;
  margin-bottom: 24px;
}

.about-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  list-style: none;
}

.about-meta li {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 8px 18px;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.about-meta span {
  color: var(--text-faint);
  margin-right: 8px;
}

/* 三体轨道装饰 */
.about-orbit {
  position: relative;
  width: 240px;
  height: 240px;
  flex-shrink: 0;
}

.orbit-ring {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.orbit-ring.r2 { inset: 28px; }
.orbit-ring.r3 { inset: 56px; }

.planet {
  position: absolute;
  top: -5px;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.r1 { animation: orbit-spin 9s linear infinite; }
.r2 { animation: orbit-spin 6s linear infinite reverse; }
.r3 { animation: orbit-spin 4s linear infinite; }

.p2 { width: 8px; height: 8px; background: var(--text-soft); }
.p3 { width: 6px; height: 6px; background: var(--text-faint); }

@keyframes orbit-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.orbit-sun {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--text), var(--text-faint));
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  text-align: center;
  padding: 48px 24px 56px;
  color: var(--text-faint);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}

.footer-sub {
  margin-top: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

/* ============================================================
   滚动进入动画（IntersectionObserver 控制 .is-visible）
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ============================================================
   响应式适配（平板）
   ============================================================ */
@media (max-width: 960px) {
  .quote-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .about-card {
    flex-direction: column-reverse;
    text-align: center;
    padding: 40px 32px;
  }

  .about-meta {
    justify-content: center;
  }

  .about-orbit {
    width: 190px;
    height: 190px;
  }
}

/* ============================================================
   响应式适配（手机）
   ============================================================ */
@media (max-width: 640px) {
  .navbar {
    padding: 16px;
  }

  .nav-inner {
    padding: 10px 16px;
  }

  .nav-links {
    display: none; /* 手机端隐藏导航链接，保留品牌与主题切换 */
  }

  .brand-en {
    display: none;
  }

  .hero-content {
    transform: none;
    gap: 16px;
    padding: 32px 20px;
  }

  .hide-mobile {
    display: none;
  }

  .section {
    padding: 72px 18px;
  }

  .section-head {
    margin-bottom: 40px;
  }

  /* 核心解读卡片：手机端改纵向排列 */
  .insight-card {
    flex-direction: column;
    gap: 12px;
    padding: 28px 24px;
  }

  .insight-index {
    width: auto;
    font-size: 2.4rem;
  }

  /* 金句：手机端单列 */
  .quote-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .quote-card {
    min-height: 0;
  }

  .about-card {
    padding: 32px 24px;
  }

  .about-orbit {
    width: 160px;
    height: 160px;
  }

  .hero-cta .btn {
    width: 100%;
    justify-content: center;
  }
}
