:root {
  --background-color: #0b0d10;
  --text-color: #f0f4f8;
  --text-muted: #8c9ba5;
  --accent-color: #00ffff;
  --sky-cyan: #7df9ff;
  --accent-glow: rgba(0, 255, 255, 0.4);
  --gold-color: #ffd700;
  --card-bg: rgba(15, 20, 28, 0.75);
  --card-border: rgba(0, 255, 255, 0.18);
  --card-border-active: rgba(0, 255, 255, 0.55);
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: var(--font-body);
  overflow-x: hidden;
  scroll-behavior: smooth;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#root {
  width: 100%;
  min-height: 100vh;
  position: relative;
}

/* Background WebGL Canvas Container */
.canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
}

.canvas-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  pointer-events: auto;
}

/* Scrollytelling Overlay & Narrative */
.scroll-content {
  width: 100%;
  position: relative;
  z-index: 10;
  pointer-events: none;
}

section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 4rem 10%;
  position: relative;
  pointer-events: none;
}

section.left-align {
  justify-content: flex-start;
}

section.right-align {
  justify-content: flex-end;
}

section.center-align {
  justify-content: center;
  text-align: center;
}

/* Extended scroll runway for long anatomical structures (Esophagus) */
#gi_section_2 {
  min-height: 280vh;
}

/* Glassmorphism Story Card */
.narrative-card {
  position: relative;
  max-width: 490px;
  width: 100%;
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 2.5rem;
  border-radius: 16px;
  border: 1px solid var(--card-border);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.65), 0 0 35px rgba(0, 255, 255, 0.06);
  pointer-events: auto;
  overflow: hidden;
  transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Holographic glowing top edge */
.narrative-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1.5px;
  background: linear-gradient(90deg, transparent 5%, rgba(0, 255, 255, 0.8) 50%, transparent 95%);
}

.narrative-card:hover {
  border-color: var(--card-border-active);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.75), 0 0 40px var(--accent-glow);
  transform: translateY(-2px);
}

/* Hero Section Top-Pinned Layout for Immediate Visibility */
#hero-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 3.5rem 5% 2rem 5%;
  position: relative;
}

.hero-card {
  max-width: 760px;
  width: 92%;
  padding: 2.5rem 2.75rem;
  background: rgba(15, 20, 28, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 255, 255, 0.35);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 255, 255, 0.12);
  z-index: 20;
  margin-top: 0.5rem;
  opacity: 1 !important;
  visibility: visible !important;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 3.2rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-color);
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #ffffff 45%, var(--accent-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(0, 255, 255, 0.25);
}

.hero-tagline {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.hero-scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.5rem;
  padding: 0.6rem 1.4rem;
  border-radius: 9999px;
  background: rgba(0, 255, 255, 0.08);
  border: 1px solid rgba(0, 255, 255, 0.35);
  color: var(--accent-color);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: pulse-glow 2.5s infinite ease-in-out;
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.hero-scroll-cue:hover {
  background: rgba(0, 255, 255, 0.2);
  border-color: rgba(0, 255, 255, 0.75);
  transform: translateY(2px);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
}

.cue-arrow {
  display: inline-block;
  transition: transform 0.3s ease;
}

.hero-scroll-cue:hover .cue-arrow {
  transform: translateY(3px);
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(0, 255, 255, 0.2); }
  50% { box-shadow: 0 0 25px rgba(0, 255, 255, 0.5); }
}

/* Card Headings & Body */
h1, h2, h3 {
  font-family: var(--font-heading);
  color: var(--accent-color);
  margin-bottom: 1rem;
  font-weight: 600;
}

h2 {
  font-size: 2.25rem;
  line-height: 1.25;
}

h3 {
  font-size: 1.5rem;
}

p {
  font-size: 1.05rem;
  line-height: 1.75;
  color: #d1dce5;
}

p + p {
  margin-top: 1rem;
}

/* Transition Section Milestone Gate */
.transition-section {
  padding: 0;
  justify-content: center;
  text-align: center;
}

.transition-card {
  max-width: 540px;
  background: rgba(11, 13, 16, 0.55);
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 14px;
  padding: 2rem 2.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 255, 255, 0.08);
}

.transition-tag {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--sky-cyan);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 0.5rem;
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: rgba(0, 255, 255, 0.08);
  border-radius: 4px;
  border: 1px solid rgba(0, 255, 255, 0.2);
}

.transition-title {
  font-size: 1.55rem;
  color: #ffffff;
  margin: 0.5rem 0 0.25rem 0;
}

.transition-text {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Contact Links */
.contact-links {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.contact-link-item {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease, transform 0.2s ease;
}

.contact-link-item:hover {
  color: var(--accent-color);
  transform: translateX(4px);
}

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--sky-cyan);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.28rem 0.8rem;
  margin-bottom: 1.2rem;
  background: rgba(0, 255, 255, 0.08);
  border: 1px solid rgba(0, 255, 255, 0.28);
  border-radius: 9999px;
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.1);
  width: fit-content;
}

.contact-badge {
  color: var(--accent-color);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.55rem;
  background: rgba(0, 255, 255, 0.08);
  border-radius: 4px;
  border: 1px solid rgba(0, 255, 255, 0.2);
}

/* Nav Dots / Chapter Navigation Timeline */
.nav-dots {
  position: fixed;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  pointer-events: auto;
}

/* Connecting Timeline Rail behind dots */
.nav-dots::before {
  content: '';
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  background: rgba(0, 255, 255, 0.2);
  z-index: -1;
}

.nav-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(15, 20, 28, 0.9);
  border: 1.5px solid rgba(0, 255, 255, 0.45);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.nav-dot.active {
  background: var(--accent-color);
  border-color: #ffffff;
  box-shadow: 0 0 15px var(--accent-color), 0 0 25px rgba(0, 255, 255, 0.6);
  transform: scale(1.35);
}

.nav-dot .tooltip {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 20, 28, 0.92);
  color: var(--text-color);
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--card-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-dot:hover .tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(-4px);
}

/* Mobile Floating Active Chapter Pill */
.mobile-chapter-pill {
  display: none;
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  z-index: 150;
  background: rgba(15, 20, 28, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 255, 255, 0.3);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-color);
  box-shadow: 0 0 8px var(--accent-color);
}

.pill-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-color);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Top Reading Progress Bar */
.progress-bar-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  z-index: 200;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ffff, #7df9ff, #ffd700);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
  width: 0%;
  transition: width 0.1s linear;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--background-color);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(0, 255, 255, 0.15);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent-color);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  section {
    padding: 3.5rem 6%;
    justify-content: center !important;
    text-align: center;
  }

  .narrative-card {
    max-width: 100%;
    padding: 2.25rem 1.75rem;
  }

  .hero-title {
    font-size: 2.9rem;
  }

  .hero-card {
    padding: 2.75rem 1.75rem;
  }

  h2 {
    font-size: 1.95rem;
  }

  .nav-dots {
    right: 0.75rem;
    gap: 0.85rem;
  }
}

@media (max-width: 600px) {
  section {
    padding: 3rem 1.25rem;
  }

  .hero-title {
    font-size: 2.25rem;
  }

  .hero-tagline {
    font-size: 1.05rem;
  }

  p {
    font-size: 0.95rem;
    line-height: 1.65;
  }

  /* Switch desktop nav dots to mobile floating chapter pill */
  .nav-dots {
    display: none;
  }

  .mobile-chapter-pill {
    display: inline-flex;
  }
}
