*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
}

.prototype-flag {
  position: fixed;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 20;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

/* Intro ------------------------------------------------------------------ */
.intro {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 4rem 1.5rem;
  text-align: center;
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.intro h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 7vw, 4.5rem);
  font-weight: 400;
  line-height: 1.1;
}

.subtitle {
  margin: 1rem 0 2rem;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-style: italic;
}

.scroll-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 3rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.scroll-hint span {
  font-size: 1.2rem;
  animation: bob 2s ease-in-out infinite;
}

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

/* Scrolly layout: steps left, sticky graphic right ------------------------ */
.scrolly {
  display: grid;
  grid-template-columns: minmax(20rem, 40%) 1fr;
  grid-template-areas: "steps graphic";
}

.graphic {
  grid-area: graphic;
  position: sticky;
  top: 0;
  height: 100vh;
  margin: 0;
  align-self: start;
}

#graph {
  display: block;
  width: 100%;
  height: 100%;
}

.steps {
  grid-area: steps;
  padding: 0 1.5rem 30vh 2.5rem;
}

.step {
  min-height: 90vh;
  display: flex;
  align-items: center;
  opacity: 0.3;
  transition: opacity 0.4s ease;
}

.step.is-active {
  opacity: 1;
}

.step-card {
  width: 100%;
  max-width: var(--step-width);
  padding: 1.5rem 1.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.chapter-label {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.2;
}

.chapter-label[data-category] {
  padding-left: 0.75rem;
  border-left: 3px solid var(--chapter-color, var(--text-muted));
}

.step-text {
  margin: 0;
  font-size: 1.05rem;
}

/* Single verse and Catechism blocks --------------------------------------- */
.verse {
  margin: 1.1rem 0 0;
}

.verse figcaption,
.ccc-ref,
.meta-label {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.verse blockquote {
  margin: 0.3rem 0 0;
  font-family: var(--font-verse);
  font-size: 1rem;
  font-style: italic;
  line-height: 1.55;
  color: var(--text-primary);
}

.ccc {
  margin: 1rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.ccc p,
.commentary p {
  margin: 0.25rem 0 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Pair card --------------------------------------------------------------- */
.pair-card {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

.pair-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
}

.swatch {
  flex: none;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 3px;
  background: var(--swatch, var(--link-neutral));
}

.warrants {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
}

.badge {
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.pair-arrow {
  margin: 0.6rem 0 -0.4rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-style: italic;
}

.commentary {
  margin: 1rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.commentary .attribution {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Legend (over the graphic) ---------------------------------------------- */
.legend {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-width: 18rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgb(20 18 16 / 0.85);
  color: var(--text-secondary);
  font-size: 0.78rem;
  pointer-events: none;
}

.legend:empty {
  display: none;
}

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

.legend .swatch {
  width: 1rem;
  height: 3px;
  border-radius: 2px;
}

/* SVG text ---------------------------------------------------------------- */
.graph-header {
  fill: var(--text-muted);
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.node-label {
  fill: var(--text-muted);
  font-family: var(--font-body);
  font-size: 11px;
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.node-label.is-strong {
  fill: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

.leader {
  stroke: var(--text-muted);
  stroke-width: 0.75;
  opacity: 0.6;
}

/* Outro ------------------------------------------------------------------- */
.outro {
  max-width: 40rem;
  margin: 0 auto;
  padding: 6rem 1.5rem 8rem;
  text-align: center;
}

.outro p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.outro a {
  color: var(--text-secondary);
}

.load-error {
  max-width: 34rem;
  margin: 2rem auto;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
}
