/* ── The Book of Elon — 共用樣式 ── */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
  --bg: #05070a;
  --surface: #0c1018;
  --card: #111827;
  --border: #1e293b;
  --border-light: #334155;
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --accent-dim: #1d4ed8;
  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.12);
  --white: #f1f5f9;
  --text: #cbd5e1;
  --text-sec: #94a3b8;
  --text-dim: #475569;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  overflow-x: hidden;
}

/* ── Grain + Glow ── */
body::after {
  content: '';
  position: fixed; inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

.container { max-width: 860px; margin: 0 auto; padding: 0 24px; }

/* ── Nav ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(5, 7, 10, 0.88);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
nav .container { display: flex; align-items: center; justify-content: space-between; }
nav .logo {
  font-family: var(--font-display);
  font-weight: 700; font-size: 0.95rem;
  color: var(--white);
  text-decoration: none;
  letter-spacing: 0.05em;
}
nav .logo span { color: var(--accent); }
nav .nav-links { display: flex; gap: 24px; }
nav .nav-links a {
  color: var(--text-sec); text-decoration: none;
  font-size: 0.82rem; font-weight: 500;
  transition: color 0.3s;
}
nav .nav-links a:hover { color: var(--accent); }
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.hamburger span { display: block; width: 20px; height: 2px; background: var(--text); margin: 4px 0; transition: all 0.3s; }
@media (max-width: 640px) {
  .hamburger { display: block; }
  nav .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; background: rgba(5,7,10,0.95); flex-direction: column; padding: 16px 24px; gap: 14px; border-bottom: 1px solid var(--border); }
  nav .nav-links.open { display: flex; }
}

/* ── Hero ── */
.hero {
  position: relative;
  min-height: 70vh;
  display: flex; align-items: center;
  padding: 120px 24px 80px;
  overflow: hidden;
}
.hero::before {
  content: ''; position: absolute;
  top: -30%; right: -20%;
  width: 700px; height: 700px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  border-radius: 50%;
  animation: drift 12s ease-in-out infinite;
}
.hero::after {
  content: ''; position: absolute;
  bottom: -20%; left: -15%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--cyan-glow) 0%, transparent 70%);
  border-radius: 50%;
  animation: drift 16s ease-in-out infinite reverse;
}
@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, -20px); }
}
.hero-content { position: relative; z-index: 2; max-width: 700px; }
.hero-badge {
  display: inline-block; font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent); border: 1px solid rgba(59,130,246,0.3);
  padding: 5px 14px; border-radius: 999px; margin-bottom: 24px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 700; line-height: 1.15;
  color: var(--white); margin-bottom: 16px;
}
.hero h1 .glow {
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero .subtitle {
  font-size: 1.05rem; color: var(--text-sec);
  max-width: 560px; margin-bottom: 32px;
}

/* ── Section ── */
section { padding: 80px 0; }
.section-label {
  font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 10px;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700; color: var(--white);
  margin-bottom: 12px;
}
.section-desc { color: var(--text-sec); font-size: 0.95rem; max-width: 600px; margin-bottom: 40px; }

/* ── Chapter Cards ── */
.chapters-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 640px) { .chapters-grid { grid-template-columns: 1fr; } }
.ch-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px;
  text-decoration: none; color: inherit;
  transition: all 0.3s; position: relative; overflow: hidden;
}
.ch-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(59,130,246,0.08);
}
.ch-card .ch-num {
  font-family: var(--mono); font-size: 0.7rem; font-weight: 700;
  color: var(--accent); margin-bottom: 8px;
}
.ch-card h3 {
  font-family: var(--font-display);
  font-size: 1rem; font-weight: 600;
  color: var(--white); margin-bottom: 6px;
}
.ch-card p { font-size: 0.82rem; color: var(--text-sec); line-height: 1.5; }
.part-label {
  font-family: var(--font-display);
  font-size: 0.85rem; font-weight: 700;
  color: var(--cyan); margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── Chapter Page ── */
.ch-hero {
  position: relative; padding: 120px 24px 60px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}
.ch-hero .ch-badge {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 700;
  color: var(--accent); margin-bottom: 8px;
}
.ch-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700; color: var(--white);
  margin-bottom: 12px; line-height: 1.2;
}
.ch-hero .ch-oneliner {
  font-size: 1.05rem; color: var(--text-sec);
  max-width: 600px; font-style: italic;
}

/* ── Content Blocks ── */
.content-section { padding: 48px 0; }
.content-section + .content-section { border-top: 1px solid var(--border); }

.story-block {
  background: var(--surface); border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0; padding: 24px 28px;
  margin-bottom: 24px;
}
.story-block h3 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; color: var(--white); margin-bottom: 12px; }
.story-block p { font-size: 0.92rem; color: var(--text); margin-bottom: 10px; }

.key-points { list-style: none; padding: 0; }
.key-points li {
  position: relative; padding: 12px 0 12px 28px;
  border-bottom: 1px solid rgba(30,41,59,0.5);
  font-size: 0.92rem; color: var(--text);
}
.key-points li:last-child { border-bottom: none; }
.key-points li::before {
  content: '→'; position: absolute; left: 0;
  color: var(--accent); font-weight: 700;
}

.quote-block {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 28px;
  margin: 20px 0; position: relative;
}
.quote-block::before {
  content: '"'; font-family: var(--font-display);
  font-size: 3.5rem; color: rgba(59,130,246,0.2);
  line-height: 1; display: block; margin-bottom: 4px;
}
.quote-block .quote-en {
  font-size: 0.9rem; color: var(--text-sec);
  font-style: italic; margin-bottom: 8px;
}
.quote-block .quote-zh {
  font-size: 1rem; color: var(--white);
  font-weight: 600;
}

/* ── Diagram ── */
.diagram-container {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 32px; margin: 24px 0;
  text-align: center;
}
.diagram-title {
  font-family: var(--font-display); font-size: 0.85rem;
  font-weight: 700; color: var(--cyan); margin-bottom: 20px;
}

/* ── Takeaway ── */
.takeaway {
  background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(6,182,212,0.08));
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 12px; padding: 28px; margin: 32px 0;
  text-align: center;
}
.takeaway .label {
  font-size: 0.7rem; font-weight: 700; color: var(--accent);
  letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 8px;
}
.takeaway p {
  font-family: var(--font-display);
  font-size: 1.15rem; font-weight: 700;
  color: var(--white); line-height: 1.5;
}

/* ── Chapter Nav ── */
.ch-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 40px 0; border-top: 1px solid var(--border);
  margin-top: 40px;
}
.ch-nav a {
  color: var(--accent); text-decoration: none;
  font-size: 0.88rem; font-weight: 600;
  transition: color 0.3s;
}
.ch-nav a:hover { color: var(--cyan); }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 24px 0; text-align: center;
  font-size: 0.75rem; color: var(--text-dim);
}

/* ── Animations ── */
.fade-up {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-up.visible { opacity: 1; transform: translateY(0); }

/* ── Framework diagram elements ── */
.framework { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.fw-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.fw-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 20px;
  font-size: 0.82rem; font-weight: 600; color: var(--white);
  min-width: 120px; text-align: center;
}
.fw-box.accent { border-color: var(--accent); color: var(--accent); }
.fw-box.cyan { border-color: var(--cyan); color: var(--cyan); }
.fw-arrow { color: var(--text-dim); font-size: 1.2rem; }
.fw-label { font-size: 0.72rem; color: var(--text-dim); margin-top: 4px; }
