/* ============================================
   WILLOUGHBY 1553 — 북극 탐험 시각화
   아트 디렉션: 16세기 항해 지도, 낡은 양피지, 극야
   ============================================ */

/* --- CUSTOM PALETTE (항해 테마) ---
   Dark: 심해 네이비 + 녹슨 구리 + 북극 얼음 민트
   Light: 낡은 양피지 베이지 + 진한 잉크 + 앤티크 골드
*/

:root, [data-theme="light"] {
  --color-bg:             #f5f0e8;
  --color-surface:        #faf6ee;
  --color-surface-2:      #fffdf8;
  --color-surface-offset: #ede7d9;
  --color-surface-dynamic:#e5dece;
  --color-divider:        #d4c9b8;
  --color-border:         #c8bca8;

  --color-text:           #1e1a12;
  --color-text-muted:     #6b5f4a;
  --color-text-faint:     #a8977e;
  --color-text-inverse:   #faf6ee;

  /* 앤티크 골드 → 구리 계열 주조색 */
  --color-primary:        #8b5e1a;
  --color-primary-hover:  #6b4512;
  --color-primary-active: #4e300c;
  --color-primary-highlight: #e8d9be;

  /* 블러드 레드 — 위험 표시 */
  --color-danger:         #8b1a1a;
  --color-danger-hover:   #6b1212;
  --color-danger-hl:      #e8bebe;

  /* 딥 틸 — 성공/챈슬러 */
  --color-success:        #1a5c6b;
  --color-success-hover:  #124557;
  --color-success-hl:     #bee5ea;

  --color-gold:           #c4920a;
  --color-ice:            #a8d4dc;

  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1.25rem;
  --radius-full: 9999px;

  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  --shadow-sm: 0 1px 3px rgba(30, 18, 8, 0.08);
  --shadow-md: 0 4px 16px rgba(30, 18, 8, 0.12);
  --shadow-lg: 0 12px 40px rgba(30, 18, 8, 0.18);
  --shadow-parchment: 2px 4px 12px rgba(100, 70, 20, 0.15), inset 0 0 40px rgba(180, 140, 60, 0.04);

  --font-display: 'Cinzel', 'Palatino Linotype', serif;
  --font-body: 'Crimson Pro', 'Georgia', serif;

  --text-xs:   clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem, 1.2rem + 2.5vw, 3.5rem);
  --text-3xl:  clamp(2.5rem, 1rem + 4vw, 5rem);
  --text-hero: clamp(3rem, 0.5rem + 7vw, 8rem);

  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
}

/* Dark theme — data-theme is always set via HTML/JS, so single selector suffices */
[data-theme="dark"] {
  --color-bg:             #0d0f14;
  --color-surface:        #12151c;
  --color-surface-2:      #161a22;
  --color-surface-offset: #0f1219;
  --color-surface-dynamic:#1c2030;
  --color-divider:        #1e2535;
  --color-border:         #252d40;

  --color-text:           #e0e7f2;
  --color-text-muted:     #c0ccde;
  --color-text-faint:     #7888a5;
  --color-text-inverse:   #0d0f14;

  --color-primary:        #c4922a;
  --color-primary-hover:  #d4a840;
  --color-primary-active: #e4c060;
  --color-primary-highlight: #2a2010;

  --color-danger:         #c44a4a;
  --color-danger-hover:   #d46a6a;
  --color-danger-hl:      #2a1010;

  --color-success:        #4ab0c0;
  --color-success-hover:  #6ac4d4;
  --color-success-hl:     #102025;

  --color-gold:           #d4a830;
  --color-ice:            #7ab8c4;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  --shadow-parchment: 0 4px 24px rgba(0, 0, 0, 0.5);
}

/* --- BASE --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  min-height: 100dvh;
  line-height: 1.7;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: background-color 0.3s ease, color 0.3s ease;
}

img, video, canvas, svg { display: block; max-width: 100%; height: auto; }
ul[role="list"], ol[role="list"] { list-style: none; }
input, button, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4, h5, h6 { text-wrap: balance; line-height: 1.2; font-family: var(--font-display); }
p, li { text-wrap: pretty; }
button { cursor: pointer; background: none; border: none; }

.container {
  width: 100%;
  max-width: var(--content-wide);
  margin: 0 auto;
  padding-inline: clamp(var(--space-6), 5vw, var(--space-16));
}

/* --- NAV --- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: color-mix(in srgb, var(--color-bg) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  height: 64px;
  transition: background 0.3s ease;
}

.nav-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding-inline: clamp(var(--space-6), 5vw, var(--space-16));
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: var(--space-6);
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  transition: color var(--transition-interactive);
}

.nav-links a:hover { color: var(--color-primary); }

.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: var(--color-primary-highlight);
}

/* --- HERO --- */
.hero {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-top: 64px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 40%, rgba(80, 40, 5, 0.2) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 70%, rgba(10, 40, 80, 0.3) 0%, transparent 60%),
              linear-gradient(180deg, rgba(4,6,8,0.55) 0%, rgba(10,14,24,0.45) 40%, rgba(5,8,16,0.7) 100%),
              url('images/hero-bg.jpg') center center / cover no-repeat;
}

[data-theme="light"] .hero-bg {
  background: radial-gradient(ellipse at 30% 40%, rgba(180, 120, 40, 0.25) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 70%, rgba(20, 60, 120, 0.2) 0%, transparent 60%),
              linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

#starCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 60%, var(--color-bg) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: var(--space-16) var(--space-6);
  max-width: 800px;
}

.hero-label {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

.hero-title {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.hero-title-main {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: #e8d4a8;
  letter-spacing: 0.02em;
  text-shadow: 0 0 60px rgba(200, 140, 40, 0.3);
}

[data-theme="light"] .hero-title-main { color: #e8d4a8; }

.hero-title-sub {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400;
  color: var(--color-ice);
  letter-spacing: 0.08em;
}

[data-theme="light"] .hero-title-sub { color: #9accd8; }

.hero-desc {
  font-size: var(--text-lg);
  color: rgba(200, 212, 232, 0.8);
  line-height: 1.8;
  margin-bottom: var(--space-10);
  max-width: 600px;
  margin-inline: auto;
}

[data-theme="light"] .hero-desc { color: rgba(220, 200, 160, 0.9); }

.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  margin-bottom: var(--space-10);
  flex-wrap: wrap;
}

.stat { text-align: center; }

.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
}

.stat-label {
  display: block;
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

[data-theme="light"] .stat-label { color: rgba(180, 160, 120, 0.8); }

.stat-divider {
  width: 1px;
  height: 40px;
  background: var(--color-border);
  opacity: 0.5;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-8);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-full);
  color: var(--color-primary);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  transition: all var(--transition-interactive);
}

.hero-cta:hover {
  background: var(--color-primary);
  color: var(--color-bg);
}

.hero-scroll-hint {
  position: absolute;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.scroll-line {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, transparent, var(--color-primary));
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.6); }
  50% { opacity: 1; transform: scaleY(1); }
}

/* --- SECTION COMMON --- */
.section-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.section-header h2 {
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.section-header p {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 520px;
  margin-inline: auto;
  line-height: 1.7;
}

/* --- INTRO SECTION --- */
.intro-section {
  padding-block: clamp(var(--space-16), 8vw, var(--space-24));
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
}

.intro-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-10);
  align-items: center;
}

.intro-portrait {
  text-align: center;
}

.intro-portrait img {
  width: 100%;
  max-width: 260px;
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 8px 32px rgba(0,0,0,0.7));
}

@media (max-width: 1024px) {
  .intro-grid { grid-template-columns: 200px 1fr; }
  .intro-portrait { grid-row: 1 / 3; }
}

@media (max-width: 768px) {
  .intro-grid { grid-template-columns: 1fr; }
  .intro-portrait img { max-width: 180px; }
}

.intro-text h2 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-4);
  color: var(--color-primary);
}

.intro-text p {
  font-size: var(--text-base);
  line-height: 1.85;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.intro-text p:last-child { margin-bottom: 0; }

.intro-text strong { color: var(--color-text); }

.intro-quote {
  padding: var(--space-8);
  background: var(--color-surface-offset);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-md);
}

.intro-quote blockquote p {
  font-size: var(--text-lg);
  font-style: italic;
  line-height: 1.8;
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

.intro-quote cite {
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  font-style: normal;
}

/* --- MAP SECTION --- */
.map-section {
  padding-block: clamp(var(--space-16), 8vw, var(--space-24));
  background: var(--color-bg);
}

.map-legend {
  display: flex;
  gap: var(--space-6);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
  padding-inline: var(--space-6);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-family: var(--font-display);
  letter-spacing: 0.05em;
}

.legend-line {
  display: block;
  width: 28px;
  height: 3px;
  border-radius: 2px;
}

.shared-line { background: #c4922a; }
.willoughby-line { background: #c44a4a; }
.chancellor-line { background: #4ab0c0; }

.legend-dot {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid;
}

.departure-dot { border-color: var(--color-primary); background: transparent; }
.death-dot { border-color: #c44a4a; background: rgba(196, 74, 74, 0.3); }

#expedition-map {
  width: 100%;
  height: clamp(500px, 75vh, 960px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* Leaflet dark theme override */
[data-theme="dark"] .leaflet-tile {
  filter: brightness(0.5) saturate(0.6) sepia(0.3);
}

.leaflet-popup-content-wrapper {
  background: var(--color-surface) !important;
  color: var(--color-text) !important;
  border: 1px solid var(--color-border) !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: var(--radius-md) !important;
}

.leaflet-popup-tip { background: var(--color-surface) !important; }

.map-marker-icon > div:hover { transform: scale(1.5); }

.custom-popup h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-primary);
}

.custom-popup p {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--color-text);
}

.custom-popup .popup-date {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
}

/* --- TIMELINE SECTION --- */
.timeline-section {
  padding-block: clamp(var(--space-16), 8vw, var(--space-24));
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
}

.timeline {
  position: relative;
  max-width: 780px;
  margin: 0 auto;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--color-border) 10%, var(--color-border) 90%, transparent);
}

@media (max-width: 640px) {
  .timeline::before { left: 16px; }
}

.timeline-item {
  position: relative;
  padding-left: 56px;
  padding-bottom: var(--space-10);
  opacity: 1;
  transform: translateX(0);
}

/* JS가 로드되면 body에 .js-loaded 추가 → 애니메이션 활성화 */
.js-loaded .timeline-item {
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.js-loaded .timeline-item.visible {
  opacity: 1;
  transform: translateX(0);
}

.timeline-marker {
  position: absolute;
  left: 12px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid;
  background: var(--color-bg);
  z-index: 1;
}

.timeline-marker.founding {
  border-color: var(--color-primary);
  background: var(--color-primary);
}

.timeline-marker.departure {
  border-color: var(--color-primary);
  width: 20px; height: 20px;
  left: 10px;
  background: var(--color-primary);
  box-shadow: 0 0 12px color-mix(in srgb, var(--color-primary) 50%, transparent);
}

.timeline-marker.waypoint {
  border-color: var(--color-danger);
  background: var(--color-danger);
}

.timeline-marker.storm {
  border-color: var(--color-danger);
  background: var(--color-danger);
  width: 20px; height: 20px;
  left: 10px;
  box-shadow: 0 0 12px rgba(196, 74, 74, 0.4);
  animation: stormPulse 2s ease-in-out infinite;
}

@keyframes stormPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(196, 74, 74, 0.4); }
  50% { box-shadow: 0 0 20px rgba(196, 74, 74, 0.7); }
}

.timeline-marker.chancellor {
  border-color: var(--color-success);
  background: var(--color-success);
}

.timeline-marker.death {
  border-color: var(--color-danger);
  background: var(--color-danger);
}

.timeline-marker.discovery {
  border-color: var(--color-gold);
  background: var(--color-gold);
}

.timeline-content {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
}

.timeline-content:hover {
  box-shadow: var(--shadow-md);
}

/* 챈슬러 이벤트 — 청록 좌측 보더 */
.timeline-marker.chancellor + .timeline-content {
  border-left: 3px solid var(--color-success);
}
.timeline-marker.chancellor + .timeline-content:hover {
  border-color: var(--color-success);
}

/* 위험/사망 이벤트 — 붉은 좌측 보더 */
.timeline-marker.death + .timeline-content,
.timeline-marker.storm + .timeline-content {
  border-left: 3px solid var(--color-danger);
}
.timeline-marker.death + .timeline-content:hover,
.timeline-marker.storm + .timeline-content:hover {
  border-color: var(--color-danger);
}

.timeline-date {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}

.timeline-content h3 {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

.critical-title { color: var(--color-danger) !important; }

.timeline-content p {
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--color-text-muted);
}

.timeline-tag {
  display: inline-block;
  margin-top: var(--space-3);
  padding: 2px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  font-family: var(--font-display);
}

.timeline-tag.danger {
  background: var(--color-danger-hl, rgba(196, 74, 74, 0.15));
  color: var(--color-danger);
}

.timeline-tag.success {
  background: var(--color-success-hl, rgba(74, 176, 192, 0.15));
  color: var(--color-success);
}

/* --- SHIPS SECTION --- */
.ships-section {
  padding-block: clamp(var(--space-16), 8vw, var(--space-24));
  background: var(--color-bg);
  border-top: 1px solid var(--color-divider);
}

.ships-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

@media (max-width: 900px) {
  .ships-grid { grid-template-columns: 1fr; max-width: 520px; margin: 0 auto; }
}

.ship-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: transform var(--transition-interactive), box-shadow var(--transition-interactive), border-color var(--transition-interactive);
  position: relative;
  overflow: hidden;
}

.ship-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.ship-card.lost::before { background: var(--color-danger); }
.ship-card.survived::before { background: var(--color-success); }

.ship-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.ship-card.lost:hover { border-color: var(--color-danger); }
.ship-card.survived:hover { border-color: var(--color-success); }

.ship-icon {
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
}

.ship-card.lost .ship-icon { color: var(--color-danger); }
.ship-card.survived .ship-icon { color: var(--color-success); }

.ship-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.ship-header h3 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.ship-badge {
  flex-shrink: 0;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  white-space: nowrap;
}

.lost-badge {
  background: var(--color-danger-hl, rgba(196, 74, 74, 0.15));
  color: var(--color-danger);
}

.survived-badge {
  background: var(--color-success-hl, rgba(74, 176, 192, 0.15));
  color: var(--color-success);
}

.ship-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

.ship-meta span {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-family: var(--font-display);
  letter-spacing: 0.03em;
}

.ship-card p {
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--color-text-muted);
}

/* --- MYSTERY SECTION --- */
.mystery-section {
  padding-block: clamp(var(--space-16), 8vw, var(--space-24));
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
}

.mystery-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  grid-template-areas:
    "highlight traditional"
    "highlight barents";
  gap: var(--space-6);
  align-items: start;
}

.theory-card.highlight-theory { grid-area: highlight; }
.theory-card.traditional      { grid-area: traditional; }
.theory-card.barents          { grid-area: barents; }

@media (max-width: 900px) {
  .mystery-grid {
    grid-template-columns: 1fr;
    grid-template-areas: "highlight" "traditional" "barents";
    max-width: 600px;
    margin: 0 auto;
  }
}

.theory-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  position: relative;
}

.theory-card.highlight-theory {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary-highlight) 60%, var(--color-surface-2));
  box-shadow: var(--shadow-md);
}

.theory-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  white-space: nowrap;
}

[data-theme="light"] .theory-badge { color: #faf6ee; }

.theory-icon {
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
}

.theory-card.traditional .theory-icon { color: var(--color-ice); }
.theory-card.highlight-theory .theory-icon { color: var(--color-primary); }
.theory-card.barents .theory-icon { color: var(--color-text-muted); }

.theory-card h3 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-1);
}

.theory-card h4 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.theory-card p {
  font-size: var(--text-sm);
  line-height: 1.8;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.theory-problem,
.theory-evidence {
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-size: var(--text-xs);
  line-height: 1.7;
  color: var(--color-text-muted);
}

.theory-problem strong,
.theory-evidence strong {
  color: var(--color-text);
  display: block;
  margin-bottom: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.theory-evidence ul {
  padding-left: var(--space-4);
  list-style: disc;
}

.theory-evidence ul li {
  margin-bottom: var(--space-1);
  color: var(--color-text-muted);
}

/* --- THEORY IMAGE --- */
.theory-image {
  margin: var(--space-3) 0;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.theory-image img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-md);
}

/* --- LEGACY SECTION --- */
.legacy-section {
  padding-block: clamp(var(--space-16), 8vw, var(--space-24));
  background: var(--color-bg);
}

.legacy-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
  text-align: center;
}

@media (max-width: 640px) {
  .legacy-grid { grid-template-columns: 1fr; }
}

.legacy-item {
  padding: var(--space-8) var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
}

.legacy-num {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
  margin-bottom: var(--space-4);
}

.legacy-num span {
  font-size: var(--text-xl);
}

.legacy-item p {
  font-size: var(--text-sm);
  line-height: 1.8;
  color: var(--color-text-muted);
  max-width: 240px;
  margin-inline: auto;
}

/* --- TIMELINE FORK --- */
.timeline-fork {
  margin: var(--space-8) 0;
  padding: var(--space-6) var(--space-8);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-align: center;
}

.fork-label {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-bottom: var(--space-5);
}

.fork-paths {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
}

.fork-path {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  max-width: 200px;
}

.fork-path-icon {
  font-size: 1.25rem;
}

.fork-path strong {
  font-family: var(--font-display);
  font-size: var(--text-base);
  letter-spacing: 0.06em;
}

.fork-path span {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  line-height: 1.5;
}

.path-chancellor strong { color: var(--color-success); }
.path-willoughby strong { color: var(--color-danger, #c0392b); }

.fork-divider {
  width: 1px;
  height: 60px;
  background: var(--color-border);
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .fork-paths { flex-direction: column; gap: var(--space-4); }
  .fork-divider { width: 60px; height: 1px; }
}

/* --- TIMELINE IMAGES --- */
.timeline-image {
  margin: var(--space-3) 0;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.timeline-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
}
.image-caption {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-style: italic;
  text-align: right;
  padding-right: var(--space-2);
}

/* --- TIMELINE QUOTES & NOTES --- */
.timeline-quote {
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-left: 2px solid var(--color-primary);
  background: var(--color-surface-offset);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--text-xs);
  font-style: italic;
  line-height: 1.8;
  color: var(--color-text);
}

.timeline-quote small {
  display: block;
  margin-top: var(--space-2);
  font-style: normal;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  letter-spacing: 0.03em;
}

.timeline-note {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-style: italic;
}

/* --- EPILOGUE SECTION --- */
.epilogue-section {
  padding-block: clamp(var(--space-16), 8vw, var(--space-24));
  background: var(--color-surface-offset);
  border-top: 1px solid var(--color-divider);
}

.epilogue-content {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.epilogue-content h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-danger);
  margin-bottom: var(--space-6);
}

.epilogue-content > p {
  font-size: var(--text-base);
  line-height: 1.85;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  text-align: left;
}

.epilogue-quote {
  margin-block: var(--space-8);
  padding: var(--space-6) var(--space-8);
  border-left: 3px solid var(--color-primary);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  text-align: left;
}

.epilogue-quote p {
  font-size: var(--text-base);
  font-style: italic;
  line-height: 1.8;
  color: var(--color-text);
}

.epilogue-note {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  letter-spacing: 0.03em;
  margin-top: var(--space-8);
}

/* --- COUNTERFACTUAL (미스터리 섹션 하단) --- */
.counterfactual {
  margin-top: var(--space-10);
  padding: var(--space-6) var(--space-8);
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-danger) 6%, transparent);
  text-align: center;
}

.counterfactual p {
  font-family: var(--font-display);
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--color-text);
  font-weight: 400;
}

/* --- CHANCELLOR'S FATE --- */
.chancellor-section {
  padding-block: clamp(var(--space-16), 8vw, var(--space-24));
  background: var(--color-surface-offset);
  border-top: 1px solid var(--color-divider);
}

.chancellor-content {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.chancellor-content h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-danger);
  margin-bottom: var(--space-6);
}

.chancellor-content > p {
  font-size: var(--text-base);
  line-height: 1.85;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  text-align: left;
}

.chancellor-coda {
  margin-top: var(--space-8);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text) !important;
  text-align: center !important;
  letter-spacing: 0.02em;
}

/* --- FOOTER --- */
.footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
  padding-block: var(--space-10);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.footer-sources {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  line-height: 1.8;
}

.footer-sources a {
  color: var(--color-text-faint);
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  transition: color var(--transition-interactive);
}

.footer-sources a:hover { color: var(--color-primary); }

.footer-copy {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* --- BACK TO TOP --- */
.back-to-top {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 900;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-bg) 90%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--color-text-muted);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease, color var(--transition-interactive), border-color var(--transition-interactive);
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* --- MOBILE MENU --- */
.mobile-menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
  flex-shrink: 0;
}

.mobile-menu-toggle:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

@media (max-width: 640px) {
  .mobile-menu-toggle { display: flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: color-mix(in srgb, var(--color-bg) 96%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-4) var(--space-6);
    gap: var(--space-1);
  }

  .nav-links.open { display: flex; }

  .nav-links a {
    display: block;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    transition: background var(--transition-interactive);
  }

  .nav-links a:hover { background: var(--color-surface-dynamic); }

  .hero-stats { gap: var(--space-4); }
  .stat-divider { display: none; }
  .timeline-item { padding-left: 44px; }
}

/* ============================================
   SCROLL IMPROVEMENT — 추가 스타일
   ============================================ */

/* 타임라인 서스펜스 브리지 */
.suspense-bridge {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-text-muted);
  opacity: 0.85;
}

/* Intro 미스터리 암시 문장 */
.intro-foreshadow {
  margin-top: var(--space-4);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--color-accent);
  opacity: 0.9;
  letter-spacing: 0.01em;
}

