:root {
  --navy: #102a43;
  --navy-2: #203f63;
  --ink: #122236;
  --muted: #5e6b76;
  --paper: #f6f8f8;
  --surface: #ffffff;
  --line: #d5dfe3;
  --teal: #2f7d7a;
  --violet: #655a90;
  --focus: #f1b24a;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex="-1"]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 3000;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--navy);
  transform: translateY(-160%);
  transition: transform 150ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(28px, 5vw, 76px);
  align-items: center;
  min-height: 410px;
  padding: clamp(52px, 7vw, 96px) clamp(24px, 6vw, 92px);
  color: #fff;
}

.masthead-copy {
  min-width: 0;
}

.eyebrow,
.small-label {
  display: block;
  margin: 0;
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.masthead .eyebrow {
  color: #a8c9da;
}

.masthead h1 {
  margin: 14px 0 16px;
  font-size: clamp(3rem, 6.2vw, 6.6rem);
  line-height: 0.92;
  letter-spacing: -0.045em;
}

.subtitle {
  max-width: 760px;
  margin: 0;
  color: #d8e5ed;
  font-size: clamp(1.05rem, 1.8vw, 1.45rem);
  line-height: 1.5;
}

.app-shell {
  display: grid;
  gap: 22px;
  width: min(1500px, calc(100% - 40px));
  margin: 30px auto 48px;
}

.journey {
  min-width: 0;
  padding: 22px;
  border-radius: 20px;
  color: #fff;
  box-shadow: 0 16px 42px rgba(22, 43, 61, 0.13);
}

.journey-heading,
.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.journey-heading .small-label {
  color: #a9c5d6;
}

.journey-heading strong {
  font-size: 0.92rem;
}

.point-navigation {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.point-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
  min-height: 52px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 10px;
  color: #eaf2f7;
  background: rgba(255, 255, 255, 0.065);
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.point-button:hover {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.point-button.active {
  border-color: #fff;
  background: #fff;
  box-shadow: 0 8px 20px rgba(3, 18, 31, 0.18);
}

.point-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.7rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.point-button.active .point-number {
  color: #fff;
  background: var(--violet);
}

.point-button[data-stage="1"] .point-number { background: #3c7c86; }
.point-button[data-stage="2"] .point-number { background: #506f9a; }
.point-button[data-stage="3"] .point-number { background: #74658f; }
.point-button[data-stage="4"] .point-number { background: #8a655f; }

.point-name {
  min-width: 0;
  overflow: hidden;
  font-size: 0.74rem;
  font-weight: 760;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-area {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.progress-meta {
  color: #c4d7e3;
  font-size: 0.72rem;
  font-weight: 750;
}

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
}

.progress-bar {
  width: 5%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #81c7c2, #d6c4ef);
  transition: width 180ms ease;
}

.presentation {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 18px 46px rgba(28, 50, 65, 0.09);
}

.presentation-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 28px 30px 24px;
  border-bottom: 1px solid var(--line);
}

.presentation-header > div:first-child {
  min-width: 0;
}

.presentation-header h2 {
  max-width: 860px;
  margin: 7px 0 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.navigation-buttons {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.navigation-buttons button,
.review-bar button {
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid #c8d3da;
  border-radius: 9px;
  color: var(--navy);
  background: #fff;
  font-weight: 760;
  cursor: pointer;
}

.navigation-buttons button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.72fr);
  min-width: 0;
}

.experiment-pane {
  min-width: 0;
  padding: 28px 30px 30px;
}

.question-block {
  margin-bottom: 20px;
}

.question-block .small-label,
.reasoning-block .small-label,
.review-bar .small-label {
  color: var(--violet);
}

.question-block h3 {
  max-width: 920px;
  margin: 7px 0 0;
  font-size: clamp(1.25rem, 2.1vw, 1.9rem);
  line-height: 1.25;
}

.interpretation-pane {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 28px;
  border-left: 1px solid var(--line);
  background: #f6f8f9;
}

.reasoning-block {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.reasoning-block p {
  margin: 8px 0 0;
  color: #4f5f69;
  font-size: 0.88rem;
  line-height: 1.55;
}

.review-bar {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: center;
  padding: 22px 30px;
  border-top: 1px solid var(--line);
  background: #f5f7f7;
}

.review-bar p {
  margin: 7px 0 0;
  line-height: 1.45;
}

.review-answer {
  padding: 20px 30px 25px;
  border-top: 1px solid var(--line);
  color: #334853;
  background: #edf3f1;
  line-height: 1.6;
}

.review-answer[hidden] {
  display: none;
}

@media (max-width: 1180px) {
  .point-navigation {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .content-layout {
    grid-template-columns: 1fr;
  }

  .interpretation-pane {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .ensemble-block {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .masthead {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .point-navigation {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .presentation-header {
    flex-direction: column;
  }

  .navigation-buttons {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 650px) {
  .app-shell {
    width: min(100% - 20px, 1500px);
    margin-top: 14px;
  }

  .journey,
  .presentation {
    border-radius: 15px;
  }

  .journey {
    padding: 15px;
  }

  .point-navigation {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .point-button {
    min-height: 48px;
    padding: 7px 8px;
  }

  .point-name {
    font-size: 0.68rem;
  }

  .presentation-header,
  .experiment-pane,
  .interpretation-pane,
  .review-bar,
  .review-answer {
    padding-right: 18px;
    padding-left: 18px;
  }

  .navigation-buttons button {
    flex: 1 1 calc(50% - 8px);
  }

  .python-companion-button {
    flex-basis: 100% !important;
  }

  .interpretation-pane {
    grid-template-columns: 1fr;
  }

  .ensemble-block {
    grid-column: auto;
  }

  .review-bar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
