/* ==========================================================================
   D09 — Deployment Story (Nordwerk), Cleanroom theme
   Long-form case study: hero, before/after metrics, scroll-driven timeline
   with a sticky week counter, before/after photo slider, lessons, CTA.
   Behavior: js/pages/d09-deployment-story.js
   ========================================================================== */

/* --------------------------------------------------------------------------
   Story hero
   -------------------------------------------------------------------------- */
.story-hero {
  position: relative;
  padding: clamp(56px, 8vw, 120px) 0 0;
}

.story-hero__intro {
  max-width: 1100px;
}

.story-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
}

.story-hero__title {
  margin-top: 20px;
  font-size: clamp(40px, 6.4vw, 96px);
  line-height: .94;
  font-weight: 750;
  font-stretch: 122%;
  letter-spacing: -.04em;
  text-wrap: balance;
}

.story-hero__lead {
  max-width: 56ch;
  margin-top: 28px;
  font-size: clamp(21px, 2vw, 26px);
  line-height: 1.4;
  color: var(--text-2);
}

.story-hero__media {
  margin-top: 48px;
}

/* Photo placeholder (dark in both themes) */
.story-photo {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  aspect-ratio: 21 / 9;
  padding: 16px;
  background:
    repeating-linear-gradient(135deg, rgba(237, 239, 242, .05) 0 1px, transparent 1px 10px),
    linear-gradient(160deg, #1c2a33, #07080B);
}

.story-photo__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-1);
  background: #EDEFF2;
  color: #07080B;
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
}

.story-photo__badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #07080B;
}

.story-photo__caption {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #AEB4BE;
}

/* --------------------------------------------------------------------------
   Before / after metrics
   The hairline background fills the whole container including its gutters,
   exactly as in the original.
   -------------------------------------------------------------------------- */
.story-results {
  position: relative;
  padding: clamp(56px, 7vw, 96px) 0;
  border-bottom: 1px solid var(--line);
}

.story-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.story-metrics__cell {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  background: var(--surface-1);
}

.story-metrics__values {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}

.story-metrics__before {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text-3);
  text-decoration: line-through;
}

.story-metrics__arrow {
  color: var(--text-3);
}

.story-metrics__after {
  font-size: 40px;
  font-weight: 600;
  font-stretch: 125%;
  letter-spacing: -.03em;
  line-height: 1;
}

.story-metrics__note {
  font-size: 13px;
  color: var(--text-2);
}

.story-results__source {
  margin-top: 12px;
}

/* --------------------------------------------------------------------------
   Timeline — sticky week counter + chapters
   -------------------------------------------------------------------------- */
.story-timeline {
  position: relative;
  border-bottom: 1px solid var(--line);
}

.story-timeline__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 0 64px;
}

.story-timeline__rail {
  position: relative;
}

.week-counter {
  position: sticky;
  top: 120px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 48px 0;
}

.week-counter__week {
  font-size: clamp(96px, 14vw, 200px);
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -.06em;
  line-height: .8;
  font-variant-numeric: tabular-nums;
}

.week-counter__units {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.week-counter__count {
  font-size: 44px;
  font-weight: 600;
  font-stretch: 125%;
  font-variant-numeric: tabular-nums;
}

.week-counter__unit-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
}

.week-counter__status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
}

/* 120 cells, one per robot; .is-on = live */
.unit-grid {
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 3px;
  max-width: 360px;
}

.unit-grid__cell {
  aspect-ratio: 1;
  background: var(--line);
  transition: background 400ms;
}

.unit-grid__cell.is-on {
  background: var(--text);
}

.story-timeline__chapters {
  padding: 48px 0 clamp(80px, 10vw, 160px);
}

.story-chapter {
  min-height: 70vh;
  padding: 48px 0;
  border-top: 1px solid var(--line);
  opacity: .4;
  transition: opacity 400ms;
}

.story-chapter.is-active {
  opacity: 1;
}

.story-chapter__title {
  margin-top: 12px;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.05;
  font-weight: 650;
  font-stretch: 118%;
  letter-spacing: -.025em;
}

.story-chapter__text {
  max-width: 62ch;
  margin-top: 18px;
  font-size: 21px;
  line-height: 1.6;
}

.story-chapter__quote {
  margin-top: 28px;
  padding: 0 0 0 24px;
  border-left: 2px solid var(--text);
  font-style: italic;
  font-size: 26px;
  line-height: 1.35;
}

.story-chapter__source {
  margin-top: 12px;
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 14px;
  color: var(--text-2);
}

/* --------------------------------------------------------------------------
   Before / after slider + lessons
   -------------------------------------------------------------------------- */
.story-lessons {
  position: relative;
  padding: clamp(80px, 9vw, 136px) 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface-1);
}

.story-lessons__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
  gap: 48px;
  align-items: start;
}

/* --pos (0–100 %) = split position, set by the range input */
.before-after__frame {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #07080B;
}

.before-after__layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #EDEFF2;
}

.before-after__layer--before {
  background:
    repeating-linear-gradient(135deg, rgba(237, 239, 242, .06) 0 1px, transparent 1px 10px),
    linear-gradient(160deg, #3a2a12, #07080B);
}

.before-after__layer--after {
  justify-content: flex-end;
  clip-path: inset(0 0 0 var(--pos));
  background:
    repeating-linear-gradient(135deg, rgba(237, 239, 242, .06) 0 1px, transparent 1px 10px),
    linear-gradient(160deg, #153a4a, #07080B);
}

.before-after__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 2px;
  background: #FFB020;
}

.before-after__range {
  width: 100%;
  height: 40px;
  accent-color: #FFB020;
}

.lesson-list {
  margin-top: 28px;
  border-top: 1px solid var(--line-strong);
}

.lesson-list__item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.lesson-list__num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-3);
}

.lesson-list__title {
  font-size: 18px;
}

.story-lessons__setback {
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-2);
}

/* --------------------------------------------------------------------------
   CTA
   -------------------------------------------------------------------------- */
.story-cta {
  position: relative;
  padding: clamp(96px, 11vw, 160px) 0;
}

.story-cta__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
  gap: 40px;
  align-items: end;
}

.story-cta__title {
  font-size: clamp(40px, 5.6vw, 88px);
  line-height: .92;
  font-weight: 700;
  font-stretch: 125%;
  letter-spacing: -.04em;
}

.story-cta__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.story-cta__text {
  max-width: 44ch;
  color: var(--text-2);
}

.story-cta__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* The original buttons have no border box */
/* Secondary link keeps the plain body type of the original; on hover only
   the text turns amber (base link hover), the border stays. */
.story-cta__secondary {
  padding: 0 22px;
  font-weight: 400;
  font-stretch: 100%;
}

.story-cta__secondary:hover {
  border-color: var(--line-strong);
  color: var(--action-text);
}

/* Annotation box: components/annotation.css */

