/* ========================================
   STORY PAGE — Narrative Timeline
   Scroll-driven vertical timeline with
   era sections and model story cards
   ======================================== */

/* ========================================
   STORY HERO
   ======================================== */

.story-hero {
  min-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-8) var(--space-6);
  position: relative;
  overflow: hidden;
}

.story-hero::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  height: 800px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-glow) 0%, transparent 60%);
  pointer-events: none;
  opacity: 0.6;
}

.story-hero__inner {
  position: relative;
  max-width: 680px;
}

.story-hero__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: var(--space-4);
}

.story-hero__heading {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--color-text);
  margin-bottom: var(--space-6);
}

.story-hero__sub {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.75;
  max-width: 520px;
  margin: 0 auto;
}

.story-hero__scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-12);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  animation: story-cue-bob 2s ease-in-out infinite;
}

@keyframes story-cue-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ========================================
   PROGRESS BAR
   ======================================== */

.story-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 110;
  background: transparent;
  pointer-events: none;
}

.story-progress__fill {
  height: 100%;
  width: 0%;
  background: var(--color-primary);
  transition: width 60ms linear;
}

/* ========================================
   STORY MAIN — Timeline Container
   ======================================== */

.story-main {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 var(--space-6) var(--space-16);
  position: relative;
}

/* Vertical line (the "spine") */
.story-main::before {
  content: '';
  position: absolute;
  top: 0;
  left: 36px;
  width: 2px;
  height: 100%;
  background: var(--color-divider);
}

@media (min-width: 640px) {
  .story-main::before {
    left: 50%;
    transform: translateX(-1px);
  }
}

/* ========================================
   ERA SECTIONS
   ======================================== */

.story-era {
  position: relative;
  padding-top: var(--space-20);
  margin-bottom: var(--space-4);
}

.story-era__badge {
  position: relative;
  z-index: 2;
  margin-left: 12px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 0 0 4px var(--color-bg), 0 2px 8px rgba(0,0,0,0.12);
}

.story-era__badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.7;
}

.story-era__info {
  margin-left: 12px;
  margin-top: var(--space-3);
  padding-left: var(--space-4);
  max-width: 480px;
}

.story-era__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.story-era__dates {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-faint);
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
}

.story-era__desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.65;
}

@media (min-width: 640px) {
  .story-era__badge {
    margin-left: 0;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
  }

  .story-era__info {
    margin-left: 0;
    text-align: center;
    padding-left: 0;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ========================================
   STORY ENTRIES (Model Cards)
   ======================================== */

.story-entry {
  position: relative;
  display: flex;
  align-items: flex-start;
  padding: var(--space-6) 0;
}

/* Node on the spine */
.story-entry__node {
  position: absolute;
  left: 28px;
  top: var(--space-8);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid var(--color-bg);
  box-shadow: 0 0 0 2px var(--node-color, var(--color-primary));
  background: var(--node-color, var(--color-primary));
  z-index: 2;
  flex-shrink: 0;
  transition: transform 350ms var(--ease-out), box-shadow 350ms var(--ease-out);
}

.story-entry.revealed .story-entry__node {
  box-shadow: 0 0 0 2px var(--node-color, var(--color-primary)), 0 0 12px oklch(from var(--node-color, var(--color-primary)) l c h / 0.35);
}

/* Card */
.story-entry__card {
  margin-left: 62px;
  flex: 1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  position: relative;
  /* Scroll reveal — start hidden */
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
}

.story-entry.revealed .story-entry__card {
  opacity: 1;
  transform: translateY(0);
}

/* Accent top stripe */
.story-entry__card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--node-color, var(--color-primary));
}

/* Connector line from node to card */
.story-entry__card::after {
  content: '';
  position: absolute;
  top: 22px;
  left: -26px;
  width: 26px;
  height: 2px;
  background: var(--color-divider);
}

.story-entry__card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.story-entry__name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.story-entry__org {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 4px;
}

.story-entry__meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-variant-numeric: tabular-nums;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.story-entry__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.story-entry__meta-icon {
  width: 14px;
  height: 14px;
  opacity: 0.55;
}

.story-entry__desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.75;
  margin-bottom: var(--space-4);
}

/* Tags */
.story-entry__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.story-entry__tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  color: var(--color-text-faint);
  border: 1px solid var(--color-border);
}

/* Score bar */
.story-entry__score {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
}

.story-entry__score-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-faint);
  white-space: nowrap;
}

.story-entry__score-bar {
  flex: 1;
  height: 5px;
  background: var(--color-divider);
  border-radius: 3px;
  overflow: hidden;
}

.story-entry__score-fill {
  height: 100%;
  border-radius: 3px;
  width: 0%;
  background: var(--node-color, var(--color-primary));
  transition: width 900ms var(--ease-out) 200ms;
}

.story-entry.revealed .story-entry__score-fill {
  width: var(--score-width);
}

.story-entry__score-value {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  min-width: 26px;
  text-align: right;
}

/* ========================================
   DESKTOP ALTERNATING LAYOUT
   ======================================== */

@media (min-width: 640px) {
  .story-entry {
    width: 50%;
    padding: var(--space-4) 0;
  }

  /* Left side entries */
  .story-entry:nth-child(odd) {
    margin-left: 0;
    padding-right: var(--space-8);
    justify-content: flex-end;
  }

  .story-entry:nth-child(odd) .story-entry__node {
    left: auto;
    right: -9px;
  }

  .story-entry:nth-child(odd) .story-entry__card {
    margin-left: 0;
  }

  .story-entry:nth-child(odd) .story-entry__card::after {
    left: auto;
    right: -26px;
  }

  /* Right side entries */
  .story-entry:nth-child(even) {
    margin-left: 50%;
    padding-left: var(--space-8);
  }

  .story-entry:nth-child(even) .story-entry__node {
    left: -9px;
  }

  .story-entry:nth-child(even) .story-entry__card {
    margin-left: 0;
  }

  .story-entry:nth-child(even) .story-entry__card::after {
    left: -26px;
  }

  /* Alternating slide direction */
  .story-entry:nth-child(odd) .story-entry__card {
    transform: translateX(-24px);
    opacity: 0;
  }
  .story-entry:nth-child(even) .story-entry__card {
    transform: translateX(24px);
    opacity: 0;
  }
  .story-entry.revealed:nth-child(odd) .story-entry__card,
  .story-entry.revealed:nth-child(even) .story-entry__card {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ========================================
   STORY CLOSING
   ======================================== */

.story-closing {
  text-align: center;
  padding: var(--space-32) var(--space-6) var(--space-20);
  position: relative;
  overflow: hidden;
}

.story-closing::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-glow) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.4;
}

.story-closing__inner {
  position: relative;
  max-width: 580px;
  margin: 0 auto;
}

.story-closing__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: var(--space-4);
}

.story-closing__heading {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: var(--color-text);
  margin-bottom: var(--space-6);
}

.story-closing__sub {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-8);
}

.story-closing__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: #fff;
  background: var(--color-primary);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: background var(--transition-interactive), transform var(--transition-interactive), box-shadow var(--transition-interactive);
}

.story-closing__cta:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.story-closing__cta:active {
  transform: translateY(0);
}

/* ========================================
   MILESTONE MARKERS
   ======================================== */

.story-entry--milestone .story-entry__card {
  border-color: oklch(from var(--node-color, var(--color-primary)) l c h / 0.25);
  box-shadow: 0 0 24px oklch(from var(--node-color, var(--color-primary)) l c h / 0.06);
}

.story-entry--milestone .story-entry__node {
  width: 22px;
  height: 22px;
}

@media (min-width: 640px) {
  .story-entry--milestone:nth-child(odd) .story-entry__node {
    right: -11px;
  }
  .story-entry--milestone:nth-child(even) .story-entry__node {
    left: -11px;
  }
}

.story-entry--milestone .story-entry__milestone-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--node-color, var(--color-primary));
  margin-bottom: var(--space-2);
}

.story-entry__milestone-badge {
  display: none;
}

/* ========================================
   RESPONSIVE TWEAKS
   ======================================== */

@media (max-width: 639px) {
  .story-entry__card::after {
    display: none;
  }

  .story-era__badge {
    margin-left: 12px;
  }

  .story-era__info {
    margin-left: 12px;
    text-align: left;
    padding-left: var(--space-4);
    max-width: none;
  }
}

@media (max-width: 480px) {
  .story-hero__heading {
    font-size: var(--text-2xl);
  }

  .story-entry__card {
    padding: var(--space-4);
  }

  .story-entry__name {
    font-size: var(--text-base);
  }

  .story-entry__card-top {
    flex-direction: column;
    gap: var(--space-1);
  }

  .story-entry__org {
    align-self: flex-start;
    margin-top: 0;
  }
}
