/* ============================================
   VECTORLIFT — Global Styles
   ============================================ */

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

/* ============================================
   CSS Variables — Design Tokens
   ============================================ */
:root {
  /* Colors */
  --bg: #1a1b2e;
  --surface: #16213e;
  --deep: #0f3460;
  --accent: #e94560;
  --sky: #00b4d8;
  --lift: #06d6a0;
  --drag: #ef476f;
  --thrust: #f4a261;
  --text: #eaeaea;
  --muted: #8892a4;
  --border: rgba(255, 255, 255, 0.08);

  /* Typography */
  --font-head: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Spacing */
  --nav-height: 52px;
}

/* ============================================
   Reset & Base
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.2;
}

a {
  color: var(--sky);
  text-decoration: none;
}

a:hover {
  color: var(--text);
}

button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: var(--font-body);
}

/* ============================================
   HERO SECTION
   ============================================ */
#hero {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
}

#hero-eyebrow {
  font-family: var(--font-head);
  font-size: 13px;
  letter-spacing: 0.25em;
  color: var(--sky);
  font-weight: 500;
}

#hero-title {
  font-size: clamp(36px, 6vw, 72px);
  color: var(--text);
  font-weight: 600;
}

#hero-subtitle {
  font-size: 16px;
  color: var(--muted);
  max-width: 420px;
}

#hero-btn {
  margin-top: 8px;
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 500;
  padding: 12px 32px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  transition: opacity 0.2s;
}

#hero-btn:hover {
  opacity: 0.85;
  color: #fff;
}

#scroll-prompt {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#scroll-arrow {
  font-size: 18px;
  animation: bounce 2s infinite;
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(6px);
  }
}

/* ============================================
   CHAPTER INDEX SECTION
   ============================================ */
#chapter-index {
  max-width: 90vw;
  margin: 0 auto;
  padding: 80px 4vw 120px;
}

/* Tab buttons */
#chapter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.chapter-tab {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 1.1vw;
  font-weight: 500;
  padding: 14px 28px;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.chapter-tab:hover {
  color: var(--text);
}

.chapter-tab.active {
  color: var(--text);
  border-bottom: 2px solid var(--sky);
}

/* Topic sets */
.topic-set {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.topic-set.active {
  display: grid;
}

/* Topic cards */
.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2vw;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.topic-card:hover {
  border-color: rgba(0, 180, 216, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.topic-card-name {
  font-family: var(--font-head);
  font-size: 1.2vw;
  font-weight: 600;
  color: var(--text);
}

.topic-card-graphic {
  width: 100%;
  aspect-ratio: 5/4;
  background: var(--deep);
  border-radius: 10px;
  border: 1px dashed rgba(0, 180, 216, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.topic-card-desc {
  font-size: 0.9vw;
  color: var(--muted);
  line-height: 1.65;
  flex: 1;
  margin: 10px 0;
}

.topic-card-btn {
  display: block;
  text-align: center;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-head);
  font-size: 0.9vw;
  font-weight: 500;
  padding: 12px 16px;
  border-radius: 999px;
  transition: opacity 0.2s;
  text-decoration: none;
}

.topic-card-btn:hover {
  opacity: 0.85;
  color: #fff;
}

/* ============================================
   HERO CONTENT FIX
   ============================================ */
#hero-content {
  position: relative;
  z-index: 2;
}


/* ============================================
   CHAPTER PAGE — BASE
   ============================================ */
.chapter-page {
  overflow: hidden;
  height: 100vh;
}

/* ============================================
   TOP NAV BAR
   ============================================ */
#chapter-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(26, 27, 46, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 100;
}

#nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

#nav-logo {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  color: var(--sky);
  text-decoration: none;
}

#nav-divider {
  color: var(--border);
  font-size: 18px;
}

#nav-chapter-name {
  font-family: var(--font-head);
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

#nav-topics {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-topic {
  font-family: var(--font-head);
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 999px;
  transition: color 0.2s, background 0.2s;
  font-weight: 500;
}

.nav-topic:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-topic.active {
  color: var(--text);
  background: rgba(0, 180, 216, 0.12);
  border-bottom: 2px solid var(--sky);
  border-radius: 999px 999px 0 0;
}

#nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-chapter-btn {
  font-family: var(--font-head);
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color 0.2s, border-color 0.2s;
}

.nav-chapter-btn:hover {
  color: var(--text);
  border-color: var(--sky);
}

/* ============================================
   SCROLL CONTAINER
   ============================================ */
#scroll-container {
  height: 100vh;
  overflow-y: scroll;
  padding-top: var(--nav-height);
  box-sizing: border-box;
}

/* ============================================
   SCROLL SECTIONS
   ============================================ */

.scroll-section {
  min-height: calc(80vh - var(--nav-height));
  display: flex;
  align-items: center;
  padding: 0 6vw;
  gap: 4vw;
}

/* ============================================
   OVERVIEW SECTION
   ============================================ */

#overview {
  justify-content: space-between;
  align-items: stretch;
  padding: 6vh 6vw;
}

#overview-left {
  flex: 0 0 38%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  padding-right: 4vw;
  border-right: 1px solid var(--border);
}

.section-eyebrow {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--sky);
  font-family: var(--font-head);
  font-weight: 500;
  text-transform: uppercase;
}

#overview-title {
  font-size: clamp(36px, 4vw, 64px);
  font-weight: 700;
  color: var(--text);
}

#overview-desc {
  font-size: clamp(14px, 1.1vw, 18px);
  color: var(--muted);
  line-height: 1.7;
  max-width: 420px;
}

#overview-scroll-prompt {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  margin-top: 8px;
}

#overview-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding-left: 4vw;
  padding-top: 0vh;
  padding-bottom: 0vh;
}

.overview-topic-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 28px;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
  flex: 1;
  min-height: 100px;
}

.overview-topic-card:hover {
  border-color: var(--sky);
  transform: translateX(6px);
}

.overview-topic-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 45%;
}

.overview-topic-number {
  font-family: var(--font-head);
  font-size: clamp(28px, 2.5vw, 44px);
  font-weight: 700;
  color: var(--deep);
  line-height: 1;
}

.overview-topic-name {
  font-family: var(--font-head);
  font-size: clamp(16px, 1.3vw, 22px);
  font-weight: 600;
  color: var(--text);
}

.overview-topic-sub {
  font-size: clamp(12px, 0.9vw, 15px);
  color: var(--muted);
  line-height: 1.5;
}

.overview-topic-graphic {
  flex: 0 0 50%;
  aspect-ratio: 16/9;
  background: var(--deep);
  border-radius: 12px;
  border: 1px solid rgba(0, 180, 216, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

/* ============================================
   TOPIC SECTIONS
   ============================================ */

.topic-section {
  align-items: center;
  padding-top: 12vh;
  padding-bottom: 12vh;
}

.topic-left {
  flex: 0 0 42%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.topic-title {
  font-size: clamp(24px, 2.5vw, 40px);
  font-weight: 700;
  color: var(--text);
}

.topic-intuition {
  font-size: clamp(13px, 1vw, 16px);
  color: var(--muted);
  line-height: 1.75;
}

/* Equation block */
.equation-block {
  background: rgba(0, 0, 0, 0.3);
  border-left: 3px solid var(--sky);
  border-radius: 0 12px 12px 0;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.equation-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--sky);
  font-family: var(--font-head);
  font-weight: 500;
  text-transform: uppercase;
}

.equation-formula {
  font-size: clamp(16px, 1.4vw, 22px);
  color: var(--text);
  font-family: var(--font-head);
  font-weight: 500;
}

.equation-vars {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 4px;
}

.equation-vars span {
  font-size: clamp(11px, 0.8vw, 13px);
  color: var(--muted);
}

.equation-insight {
  font-size: clamp(11px, 0.85vw, 13px);
  color: var(--sky);
  font-style: italic;
  margin-top: 4px;
}

/* Right side */
.topic-right {
  flex: 0 0 54%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.viz-placeholder {
  width: 100%;
  aspect-ratio: 16/10;
  background: var(--surface);
  border: 1px dashed rgba(0, 180, 216, 0.25);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

/* Sliders */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-row label {
  font-size: clamp(11px, 0.85vw, 13px);
  color: var(--muted);
  min-width: 120px;
  font-family: var(--font-head);
}

.slider-row input[type="range"] {
  flex: 1;
  appearance: none;
  height: 3px;
  background: var(--deep);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--sky);
  cursor: pointer;
  transition: transform 0.15s;
}

.slider-row input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

.slider-value {
  font-size: clamp(11px, 0.85vw, 13px);
  color: var(--sky);
  font-family: var(--font-head);
  font-weight: 500;
  min-width: 40px;
  text-align: right;
}

/* ============================================
   CHAPTER END SECTION
   ============================================ */
#chapter-end {
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6vh 6vw;
  border-top: 1px solid var(--border);
}

#chapter-end-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 32px;
  max-width: 600px;
}

#chapter-end-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#chapter-end-text h2 {
  font-size: clamp(20px, 2vw, 32px);
  font-weight: 600;
  color: var(--text);
}

#chapter-end-text p {
  font-size: clamp(13px, 1vw, 16px);
  color: var(--muted);
}

#chapter-end-btns {
  display: flex;
  gap: 16px;
}

.chapter-end-btn {
  font-family: var(--font-head);
  font-size: clamp(13px, 1vw, 15px);
  font-weight: 500;
  padding: 12px 28px;
  border-radius: 999px;
  text-decoration: none;
  transition: opacity 0.2s, border-color 0.2s;
}

.chapter-end-btn.primary {
  background: var(--accent);
  color: #fff;
}

.chapter-end-btn.primary:hover {
  opacity: 0.85;
  color: #fff;
}

.chapter-end-btn.secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.chapter-end-btn.secondary:hover {
  border-color: var(--sky);
  color: var(--text);
}

.viz-canvas {
  width: 100%;
  aspect-ratio: 16/10;
  border-radius: 16px;
  background: var(--surface);
  display: block;
}

.preview-canvas-wrap {
  position: relative;
  overflow: hidden;
  padding: 0;
}

.preview-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--surface);
}

.disturb-btn {
  align-self: flex-start;
  background: var(--deep);
  color: var(--text);
  font-family: var(--font-head);
  font-size: clamp(12px, 0.9vw, 14px);
  font-weight: 500;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--sky);
  transition: background 0.2s, transform 0.1s, border-color 0.2s;
}

.disturb-btn:hover {
  background: rgba(0, 180, 216, 0.15);
  border-color: var(--text);
}

.disturb-btn:active {
  transform: scale(0.96);
}

/* ============================================
   RESPONSIVE LAYER
   Everything below only adds to or overrides the rules above.
   To undo the responsive pass, delete this whole section.
   ============================================ */

/* ---- Text that was sized in vw alone (unreadably small on laptops and phones) ---- */
.chapter-tab {
  font-size: clamp(14px, 1.1vw, 18px);
}

.topic-card {
  padding: clamp(16px, 2vw, 32px);
}

.topic-card-name {
  font-size: clamp(16px, 1.2vw, 20px);
}

.topic-card-desc,
.topic-card-btn {
  font-size: clamp(13px, 0.9vw, 15px);
}

/* ---- Chapter pages: long lesson text ---- */

/* Land just below the fixed nav when jumping to a topic */
.scroll-section {
  scroll-margin-top: var(--nav-height);
}

/* Keep the simulation in view while the text beside it scrolls */
.topic-right {
  align-self: flex-start;
  position: sticky;
  top: calc(var(--nav-height) + 24px);
}

/* Wide formulas scroll instead of overflowing */
.equation-formula {
  overflow-x: auto;
}

/* Mobile browsers: 100vh is taller than the visible screen while the address bar shows */
@supports (height: 100dvh) {
  #hero {
    height: 100dvh;
  }

  .chapter-page,
  #scroll-container {
    height: 100dvh;
  }
}

/* ---- Tablets and phones: stack the layout ---- */
@media (max-width: 900px) {

  /* Chapter pages: text above the simulation */
  .scroll-section {
    flex-direction: column;
    align-items: stretch;
    padding: 0 5vw;
    gap: 24px;
  }

  .topic-section {
    padding-top: 6vh;
    padding-bottom: 6vh;
  }

  .topic-left,
  .topic-right {
    flex: none;
    width: 100%;
  }

  .topic-right {
    align-self: stretch;
    position: static;
  }

  /* Chapter overview */
  #overview {
    padding: 4vh 5vw;
  }

  #overview-left {
    flex: none;
    padding-right: 0;
    padding-bottom: 24px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  #overview-right {
    padding-left: 0;
  }

  .overview-topic-card {
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
  }

  .overview-topic-text,
  .overview-topic-graphic {
    flex: none;
    width: 100%;
  }

  /* Navigation bar */
  #chapter-nav {
    padding: 0 16px;
    gap: 12px;
  }

  #nav-divider,
  #nav-chapter-name {
    display: none;
  }

  #nav-topics {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav-topic,
  .nav-chapter-btn {
    font-size: 12px;
    padding: 6px 10px;
    white-space: nowrap;
  }

  /* Landing page */
  #chapter-index {
    padding: 48px 4vw 80px;
  }

  #chapter-tabs {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .chapter-tab {
    padding: 12px 16px;
    white-space: nowrap;
  }

  .topic-set {
    grid-template-columns: 1fr;
  }

  /* Chapter end */
  #chapter-end-btns {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ---- Phones ---- */
@media (max-width: 760px) {

  /* Topic links stay; chapter links are still at the end of each chapter */
  #nav-right {
    display: none;
  }

  /* Label and value on one row, slider full width below */
  .slider-row {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .slider-row label {
    flex: 1;
    min-width: 0;
  }

  .slider-value {
    min-width: 0;
  }

  .slider-row input[type="range"] {
    flex: 1 0 100%;
    order: 3;
  }
}

/* ---- Touch screens: easier-to-grab slider handle ---- */
@media (pointer: coarse) {
  .slider-row input[type="range"]::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }
}

/* ---- Chapter nav bar: scrolls sideways when it does not fit --you can remove thee cleanu-- */
#chapter-nav {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

#chapter-nav::-webkit-scrollbar {
  height: 4px;
}

#chapter-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
}

#nav-left,
#nav-topics,
#nav-right {
  flex-shrink: 0;
}

#nav-chapter-name,
.nav-topic,
.nav-chapter-btn {
  white-space: nowrap;
}