@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300;400;600&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Cormorant Garamond', serif;
  background: linear-gradient(to bottom,
    rgba(99, 167, 191, 1),
    rgba(94, 86, 179, 1),
    rgba(72, 139, 163, 1),
    rgba(79, 124, 179, 1),
    rgba(52, 115, 140, 1),
    rgba(48, 92, 145, 1),
    rgba(39, 82, 145, 1),
    rgba(19, 58, 110, 1),
    rgba(10, 50, 80, 1),
    rgba(40, 41, 100, 1),
    rgba(14, 52, 94, 1),
    black);
  color: white;
  overflow-x: hidden;
}

#canvas-container {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100vh;
  z-index: 1;
  pointer-events: none;
}

#loading {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  z-index: 1000;
  transition: opacity 0.5s ease;
}
#loading.hidden { opacity: 0; pointer-events: none; }

.rays {
  --size: max(60vh, 80rem);
  position: fixed;
  pointer-events: none;
  top: calc(var(--size) * -0.55);
  left: 50%;
  transform: translateX(-50%);
  width: var(--size);
  height: var(--size);
  z-index: 0;
}
.rays > div {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: repeating-conic-gradient(
    rgba(255, 251, 227, 0.15), 
    rgba(255, 251, 227, 0.15) 10deg, 
    transparent 10deg, 
    transparent 20deg
  );
  -webkit-mask-image: radial-gradient(circle at center, black, transparent 50%);
  mask-image: radial-gradient(circle at center, black, transparent 50%);
  animation: raysRotate 120000ms linear infinite;
}
@keyframes raysRotate {
  50% { transform: rotate(180deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1); }
}

.lights {
  position: fixed;
  pointer-events: none;
  top: 0; left: 0;
  width: 100%; height: 100vh;
  z-index: 2;
}
.light {
  width: 0.35rem; height: 0.35rem;
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  filter: blur(1px);
  animation: blink 2500ms var(--d, 0ms) infinite alternate;
}
@keyframes blink { to { opacity: 0; } }

.vignette {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100vh;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 30%, rgba(0, 0, 0, 0.4) 100%);
  z-index: 3;
}

.scenes { position: relative; z-index: 10; }
.scene { height: 150vh; position: relative; }

.scene[data-scene="5"],
.scene[data-scene="6"],
.scene[data-scene="7"] { height: 80vh; }

.scene[data-scene="8"],
.scene[data-scene="9"],
.scene[data-scene="10"],
.scene[data-scene="11"],
.scene[data-scene="12"],
.scene[data-scene="13"],
.scene[data-scene="14"],
.scene[data-scene="15"],
.scene[data-scene="16"] { height: 120vh; }

.scene-text {
  position: fixed;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  max-width: 800px;
  padding: 2rem;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 100;
}

.scene-text.visible { opacity: 1; }

.scene-text p {
  font-size: clamp(1.4rem, 4vw, 2.5rem);
  font-weight: 300;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.8);
  line-height: 1.6;
}

.scene-text h2 {
  font-size: clamp(1.8rem, 5vw, 3.5rem);
  font-weight: 300;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.8);
  margin-bottom: 0.5rem;
}

.scene-text .stat {
  font-size: clamp(3rem, 12vw, 7rem);
  font-weight: 600;
  color: rgba(255, 251, 227, 0.95);
  text-shadow: 0 0 60px rgba(255, 251, 227, 0.5);
  display: block;
  letter-spacing: 0.02em;
}

.scroll-indicator {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 100;
  transition: opacity 0.5s ease;
}
.scroll-indicator.hidden { opacity: 0; }
.scroll-indicator span { display: block; font-size: 1rem; }
.scroll-indicator .arrow { animation: bounce 0.6s infinite alternate; }
@keyframes bounce { to { transform: translateY(8px); } }

.bubbles { position: fixed; pointer-events: none; z-index: 2; }
.bubble {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.4), transparent 60%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: rise 4s ease-in infinite;
  opacity: 0;
}
@keyframes rise {
  0% { transform: translateY(0) scale(0); opacity: 0; }
  10% { opacity: 0.6; transform: scale(1); }
  90% { opacity: 0.3; }
  100% { transform: translateY(-300px) scale(0.5); opacity: 0; }
}

.data-viz {
  position: fixed;
  bottom: 5%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 1s ease;
  pointer-events: none;
  z-index: 50;
  background: rgba(255, 255, 255, 0.95) !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3) !important;
}

.data-scene.active .data-viz {
  opacity: 1;
  pointer-events: auto;
}

.myth-bubbles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  pointer-events: none;
  z-index: 90;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.misconception-scene.active .myth-bubbles {
  opacity: 1;
}

.myth-bubble {
  position: absolute;
  background: rgba(180, 60, 60, 0.85);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 20px;
  font-size: clamp(0.9rem, 2vw, 1.3rem);
  font-style: italic;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: scale(0.8);
  animation: mythAppear 0.6s var(--delay, 0s) forwards;
}

@keyframes mythAppear {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.debunk-facts {
  position: fixed;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: left;
  z-index: 90;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.debunk-scene.active .debunk-facts {
  opacity: 1;
}

.debunk-item {
  margin-bottom: 1.5rem;
  font-size: clamp(1rem, 2.5vw, 1.5rem);
}

.myth-crossed {
  color: rgba(255, 100, 100, 0.9);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  margin-right: 1rem;
}

.fact {
  color: rgba(100, 255, 150, 0.95);
  font-weight: 400;
}

.impact-stat {
  color: rgba(255, 80, 80, 0.95) !important;
  text-shadow: 0 0 60px rgba(255, 50, 50, 0.6) !important;
}

#fishing-net {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 80;
  opacity: 0;
  transition: opacity 1s ease;
  background: 
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 30px,
      rgba(100, 80, 60, 0.15) 30px,
      rgba(100, 80, 60, 0.15) 32px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 30px,
      rgba(100, 80, 60, 0.15) 30px,
      rgba(100, 80, 60, 0.15) 32px
    );
}

.impact-scene.active #fishing-net {
  opacity: 1;
}

#dark-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  z-index: 4;
  transition: background 1s ease;
}

/* Body Map Inline Styles */
.bodymap-viz-wrapper {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

.bodymap-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.bodymap-header {
  text-align: center;
  margin-bottom: 0.5rem;
}

.bodymap-header h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #0F172A;
  margin-bottom: 0.25rem;
}

.bodymap-header .section-subtitle {
  font-size: 0.9rem;
  color: #64748B;
}

.main-display {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 2rem;
  align-items: center;
  min-height: 340px;
}

.human-column, .surfboard-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.column-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.human-wrapper {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 280px;
  width: 160px;
}

#human-svg {
  width: 140px;
  height: 260px;
  transform-origin: bottom center;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.human-silhouette {
  fill: #0F2744;
  opacity: 0.85;
}

.body-bubble {
  cursor: pointer;
  transition: r 0.4s ease, opacity 0.2s ease;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.body-bubble:hover {
  opacity: 1 !important;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.25));
}

.population-display {
  font-size: 1rem;
  font-weight: 700;
  color: #0F2744;
  padding: 0.3rem 0.8rem;
  background: #DBEAFE;
  border-radius: 6px;
}

.surfboard-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.surfboard-img {
  height: 240px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.15));
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center center;
}

.surfboard-rate {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: #FFFFFF;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  pointer-events: none;
}

.rate-number {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.rate-label {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.9;
}

.stats-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 200px;
}

.year-display { text-align: center; }

.year-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: #3B82F6;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.stat-card {
  background: #F1F5F9;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-card.fatal {
  background: #FEF2F2;
  border-left: 3px solid #F87171;
}

.stat-card.nonfatal {
  background: #F0FDF4;
  border-left: 3px solid #22C55E;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0F172A;
}

.stat-card.fatal .stat-value { color: #F87171; }
.stat-card.nonfatal .stat-value { color: #16A34A; }

.stat-label {
  font-size: 0.75rem;
  color: #64748B;
  font-weight: 500;
}

.insight-box {
  background: linear-gradient(135deg, #DBEAFE 0%, #E0F2FE 100%);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  border-left: 3px solid #3B82F6;
}

.insight-box p {
  font-size: 0.75rem;
  color: #334155;
  margin: 0;
  line-height: 1.4;
}

.insight-box strong { color: #3B82F6; }

.controls-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #E2E8F0;
}

.legend-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.legend-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748B;
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: #334155;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.slider-container {
  background: #F1F5F9;
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.year-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748B;
  min-width: 32px;
}

#year-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #CBD5E1;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

#year-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #3B82F6;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
}

#year-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #3B82F6;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.slider-buttons {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.control-btn {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #FFFFFF;
  background: #3B82F6;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.control-btn:hover {
  background: #1E4976;
}

.control-btn.secondary {
  background: #64748B;
}

.control-btn.secondary:hover {
  background: #334155;
}

#bodymap-tooltip {
  position: absolute;
  padding: 10px 14px;
  background: #0A1628;
  color: #FFFFFF;
  border-radius: 6px;
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  max-width: 160px;
  opacity: 0;
  transition: opacity 0.2s ease;
  font-family: 'Segoe UI', sans-serif;
}

#bodymap-tooltip.visible { opacity: 1; }

#bodymap-tooltip .tooltip-title {
  font-weight: 700;
  color: #60A5FA;
  margin-bottom: 5px;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  padding-bottom: 4px;
}

#bodymap-tooltip .tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 2px 0;
}

#bodymap-tooltip .tooltip-label { color: #CBD5E1; }
#bodymap-tooltip .tooltip-value { font-weight: 600; }
#bodymap-tooltip .tooltip-value.fatal { color: #F87171; }
#bodymap-tooltip .tooltip-value.non-fatal { color: #4ADE80; }

@media (max-width: 800px) {
  .main-display {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }
  .stats-column {
    grid-column: 1 / 3;
    max-width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  .year-display { width: 100%; }
  .stats-grid {
    flex-direction: row;
    width: 100%;
    justify-content: center;
  }
  .stat-card {
    flex: 1;
    min-width: 100px;
    max-width: 140px;
    flex-direction: column;
    text-align: center;
  }
}
