/* Earthmoving case study — full-width editorial flow */

.page-case-study {
  --case-gutter: clamp(1rem, 3vw, 2rem);
  --case-wide: min(96vw, 1520px);
  --case-cab-embed-max: min(1040px, 92vw);
  /* Zoomed device chapters — tune to match editorial comp */
  --device-phone-height: clamp(620px, 82vh, 920px);
  --device-phone-width: calc(var(--device-phone-height) * 0.462 + 1.35rem);
  --device-tablet-width: clamp(640px, 72vw, 860px);
  --device-tablet-copy-gap: clamp(1.5rem, 3vh, 2.5rem);
  --device-laptop-finale-width: min(var(--case-wide), 1440px);
  --device-chapter-gap: clamp(2.5rem, 5vw, 4.5rem);
  --device-copy-offset: clamp(2.5rem, 5.5vh, 4rem);
}

.case-skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 100;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-bg);
  background: var(--color-accent);
  border-radius: 6px;
  text-decoration: none;
}

.case-skip-link:focus {
  position: fixed;
  left: 1rem;
  top: 5rem;
  width: auto;
  height: auto;
  overflow: visible;
}

/* ============================================================
   Hero header — title + lede use full width
   ============================================================ */

.page-case-study .work-page-header.container,
.page-case-study .work-page-header.case-hero {
  max-width: var(--case-wide);
  padding-left: var(--case-gutter);
  padding-right: var(--case-gutter);
}

.case-hero__grid {
  display: grid;
  gap: var(--space-lg);
}

.page-case-study .work-page-intro {
  max-width: none;
}

.page-case-study .work-page-title {
  max-width: none;
  font-size: clamp(2.75rem, 5.2vw, 4.25rem);
  line-height: 1.06;
  letter-spacing: -0.035em;
  text-wrap: balance;
  margin-bottom: 0;
}

.page-case-study .case-hero__lede {
  max-width: none;
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  line-height: 1.75;
  color: var(--color-text-muted);
  font-weight: 300;
}

@media (min-width: 900px) {
  .case-hero__grid {
    grid-template-columns: 1.35fr 1fr;
    gap: var(--space-2xl);
    align-items: end;
  }

  .page-case-study .work-page-intro {
    grid-column: 1;
  }

  .page-case-study .case-hero__lede {
    grid-column: 2;
    grid-row: 1;
    padding-bottom: 0.15em;
  }
}

/* ============================================================
   Acts 01–03 — full-width narrative
   ============================================================ */

.case-narrative {
  max-width: var(--case-wide);
  margin: 0 auto;
  padding: 0 var(--case-gutter);
}

.case-act {
  padding: var(--space-2xl) 0;
}

.case-act + .case-act {
  border-top: 1px solid var(--color-border);
}

.case-act__number {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-md);
}

.case-act__title {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 3.8vw, 2.75rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.12;
  text-wrap: balance;
  margin-bottom: var(--space-lg);
}

.case-act__subtitle {
  font-family: var(--font-mono);
  font-size: clamp(1.1rem, 1.8vw, 1.35rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.3;
  margin: var(--space-xl) 0 var(--space-md);
  color: var(--color-text);
}

.case-act__body-grid {
  display: grid;
  gap: var(--space-md);
}

@media (min-width: 768px) {
  .case-act__body-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg) var(--space-2xl);
  }
}

.case-act__body {
  font-size: clamp(1.02rem, 1.25vw, 1.12rem);
  font-weight: 300;
  line-height: 1.8;
  color: var(--color-text-muted);
}

.case-act__body--span {
  margin-top: var(--space-lg);
}

.case-act__list {
  margin: var(--space-lg) 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-md);
}

@media (min-width: 768px) {
  .case-act__list {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg) var(--space-2xl);
  }
}

.case-act__list li {
  font-size: clamp(1rem, 1.15vw, 1.08rem);
  font-weight: 300;
  line-height: 1.75;
  color: var(--color-text-muted);
  padding-left: 1.5rem;
  position: relative;
}

.case-act__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  opacity: 0.65;
}

.case-act__list li strong {
  color: var(--color-text);
  font-weight: 500;
}

.case-act__principles {
  margin-top: var(--space-lg);
  display: grid;
  gap: var(--space-md);
}

@media (min-width: 640px) {
  .case-act__principles {
    grid-template-columns: 1fr 1fr;
  }
}

.case-act__principle {
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-size: clamp(0.95rem, 1.1vw, 1.02rem);
  font-weight: 300;
  line-height: 1.7;
  color: var(--color-text-muted);
}

.case-act__principle strong {
  display: block;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 0.35rem;
}

.case-act__vignette {
  margin-top: var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
  border-left: 3px solid var(--color-accent-border-strong);
  font-size: clamp(1.02rem, 1.2vw, 1.1rem);
  font-style: italic;
  font-weight: 300;
  line-height: 1.8;
  color: var(--color-text-muted);
}

/* ============================================================
   Act 04 — features: full-width intro, embed, try hint
   ============================================================ */

.case-features {
  max-width: var(--case-wide);
  margin: 0 auto;
  padding: var(--space-2xl) var(--case-gutter) 0;
  border-top: 1px solid var(--color-border);
}

.case-features__header {
  margin-bottom: var(--space-xl);
}

.case-features__title {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 3.8vw, 2.75rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.12;
  text-wrap: balance;
  margin-bottom: var(--space-md);
}

.case-features__lede {
  font-size: clamp(1.02rem, 1.25vw, 1.12rem);
  font-weight: 300;
  line-height: 1.8;
  color: var(--color-text-muted);
}

.case-feature {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--color-border);
}

.case-feature__intro {
  display: grid;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

@media (min-width: 900px) {
  .case-feature__intro {
    grid-template-columns: minmax(200px, 0.38fr) 1fr;
    gap: var(--space-2xl);
    align-items: baseline;
  }
}

.case-feature__kicker {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.case-feature__copy {
  min-width: 0;
}

.case-feature__title {
  font-family: var(--font-mono);
  font-size: clamp(1.65rem, 2.6vw, 2.15rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-wrap: balance;
  margin-bottom: var(--space-sm);
}

.case-feature__desc {
  font-size: clamp(1.02rem, 1.25vw, 1.12rem);
  font-weight: 300;
  line-height: 1.8;
  color: var(--color-text-muted);
}

.case-feature__embed {
  margin: 0;
  width: 100%;
}

.case-feature__embed .hmi-panel--portal,
.case-finale .hmi-panel--portal {
  max-width: 100%;
  width: 100%;
}

/* In-cab HMI panels (P1, P3) — smaller frame that fits the editorial layout */
.page-case-study .hmi-panel--cab {
  max-width: min(100%, calc(var(--case-cab-embed-max) + 48px));
  margin-left: auto;
  margin-right: auto;
}

.page-case-study .hmi-panel--cab .demo-embed-frame {
  width: 100%;
  max-width: none;
  margin: 0;
}

/* Fleet portal (P2) — unchanged; generous viewport */
.page-case-study .demo-embed-frame--fleet {
  width: 100%;
  max-width: none;
  min-height: clamp(360px, 52vw, 810px);
}

.case-feature__try {
  margin-top: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  border-radius: 0 10px 10px 0;
  font-size: clamp(0.95rem, 1.1vw, 1rem);
  font-weight: 400;
  line-height: 1.7;
  color: var(--color-text);
}

.case-feature__try-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.35rem;
}

/* Compact HMI panel — slimmer bezel only; viewport stays full width */
.hmi-panel--compact .hmi-panel__shell {
  padding: 12px 12px 10px;
  border-radius: 16px;
}

.hmi-panel--compact .hmi-panel__chrome {
  padding-bottom: 8px;
  font-size: 0.62rem;
}

.hmi-panel--compact .hmi-panel__chin {
  padding: 8px 0 2px;
}


/* Lazy-load placeholder */
[data-embed-lazy]:not(.is-loaded) .demo-embed-frame {
  background:
    linear-gradient(
      110deg,
      var(--panel-glass, #0a0f0a) 8%,
      #141a14 18%,
      var(--panel-glass, #0a0f0a) 33%
    );
  background-size: 200% 100%;
}

[data-embed-lazy]:not(.is-loaded) .demo-embed-scaler iframe {
  visibility: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  [data-embed-lazy]:not(.is-loaded) .demo-embed-frame {
    animation: embed-skeleton-shimmer 1.8s ease-in-out infinite;
  }
}

@keyframes embed-skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

[data-embed-lazy].is-loaded .demo-embed-scaler iframe {
  visibility: visible;
}

/* Device frames in case study embeds */
.page-case-study .case-feature__embed .device-frame--laptop,
.page-case-study .case-finale .device-frame--laptop:not(.device-frame--laptop-finale) {
  max-width: min(100%, 1100px);
  margin-left: auto;
  margin-right: auto;
}

.page-case-study .case-finale .device-frame--laptop-finale {
  max-width: none;
  width: 100%;
}

.page-case-study .case-finale__embed {
  width: 100%;
  max-width: var(--device-laptop-finale-width);
  margin: 0 auto;
}

.page-case-study .case-feature__embed .device-frame--tablet {
  max-width: min(100%, 520px);
  margin-left: auto;
  margin-right: auto;
}

.page-case-study .case-feature--device-zoom .case-feature__embed .device-frame--tablet {
  max-width: none;
  width: 100%;
}

.page-case-study .showcase-hero--angled .device-frame {
  width: 100%;
}

.page-case-study .showcase-hero--angled .device-frame--laptop {
  max-width: min(100%, 1100px);
  margin-left: auto;
  margin-right: auto;
  box-shadow: none;
}

.page-case-study .showcase-hero--angled .device-frame__shell {
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.05) inset,
    0 72px 160px -24px rgba(0, 0, 0, 0.8);
}

.page-case-study .device-embed-frame {
  width: 100%;
  max-width: none;
}

[data-embed-lazy].is-loaded .device-embed-scaler iframe {
  visibility: visible;
}

/* ── Device chapters: copy above or beside frame ── */

.case-device-block {
  display: grid;
  gap: var(--space-lg);
  align-items: center;
}

/* Stacked — copy centered above device */
.case-feature--device-above .case-device-copy {
  text-align: center;
  max-width: 42ch;
  margin: 0 auto;
}

.case-feature--device-above .case-device-copy .case-feature__desc {
  margin-left: auto;
  margin-right: auto;
}

.case-feature--device-above .case-feature__embed {
  max-width: min(100%, 560px);
  margin-left: auto;
  margin-right: auto;
}

.case-feature--device-above .case-feature__try {
  max-width: 42ch;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

/* Side-by-side — copy beside device */
@media (min-width: 900px) {
  .case-feature--device-beside .case-device-block {
    grid-template-columns: minmax(260px, 1fr) minmax(280px, auto);
    gap: clamp(var(--space-lg), 5vw, var(--space-2xl));
  }

  /* Device left, copy right — figure first in DOM */
  .case-feature--device-beside.case-feature--device-left .case-device-block {
    grid-template-columns: minmax(280px, auto) minmax(260px, 1fr);
  }

  .case-feature--device-beside .case-device-copy {
    padding: var(--space-sm) 0;
  }

  .case-feature--device-beside .case-feature__desc {
    max-width: 38ch;
  }

  .case-feature--device-left .case-feature__embed {
    justify-self: start;
  }

  .case-feature--device-beside:not(.case-feature--device-left) .case-feature__embed {
    justify-self: end;
  }
}

.case-feature--device-beside .device-frame--phone,
.case-feature--device-beside .device-frame--tablet {
  max-width: 100%;
}

@media (max-width: 899px) {
  .case-feature--device-beside .case-device-copy {
    order: -1;
  }
}

/* Zoomed viewport-scale device chapters (editorial comp sizing) */
.case-feature--device-zoom {
  padding: clamp(var(--space-lg), 5vh, var(--space-xl)) 0;
}

@media (min-width: 900px) {
  .case-feature--device-zoom.case-feature--device-beside.case-feature--device-left .case-device-block {
    grid-template-columns: minmax(260px, 32%) minmax(0, 1fr);
    gap: var(--device-chapter-gap);
    align-items: center;
  }

  .case-feature--device-zoom.case-feature--device-beside .case-device-block {
    align-items: center;
  }

  .case-feature--device-zoom.case-feature--device-left .case-feature__embed {
    justify-self: start;
    width: var(--device-phone-width);
    max-width: 100%;
  }

  .case-feature--device-zoom.case-feature--device-beside .case-device-copy {
    padding-top: 0;
    max-width: none;
    width: 100%;
    min-width: 0;
  }

  .case-feature--device-zoom.case-feature--device-beside .case-feature__title {
    font-size: clamp(2.15rem, 3.6vw, 3rem);
    line-height: 1.1;
    letter-spacing: -0.025em;
    max-width: none;
    text-wrap: pretty;
  }

  .case-feature--device-zoom.case-feature--device-beside .case-feature__desc {
    max-width: none;
    width: 100%;
    font-size: clamp(1.05rem, 1.25vw, 1.12rem);
    line-height: 1.75;
  }

  .case-feature--device-zoom.case-feature--device-beside .case-feature__try {
    margin-top: var(--space-lg);
    max-width: none;
    width: 100%;
  }
}

.case-feature--device-zoom .device-frame--phone {
  max-width: none;
  width: 100%;
  margin: 0;
}

.case-feature--device-zoom.case-feature--device-above .case-feature__embed {
  width: var(--device-tablet-width);
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.case-feature--device-zoom.case-feature--device-above .device-frame--tablet {
  max-width: none;
  width: 100%;
}

@media (min-width: 900px) {
  .case-feature--device-zoom.case-feature--device-above {
    padding: clamp(var(--space-lg), 5vh, var(--space-xl)) 0;
  }

  .case-feature--device-zoom.case-feature--device-above .case-device-block {
    display: flex;
    flex-direction: column;
    gap: var(--device-tablet-copy-gap);
    align-items: stretch;
    margin-bottom: 0;
  }

  .case-feature--device-zoom.case-feature--device-above .case-device-copy {
    text-align: center;
    max-width: none;
    width: 100%;
    margin: 0;
  }

  .case-feature--device-zoom.case-feature--device-above .case-feature__title {
    font-size: clamp(2.15rem, 3.6vw, 3rem);
    line-height: 1.1;
    letter-spacing: -0.025em;
    max-width: none;
    text-wrap: pretty;
  }

  .case-feature--device-zoom.case-feature--device-above .case-feature__desc {
    max-width: none;
    width: 100%;
    font-size: clamp(1.05rem, 1.25vw, 1.12rem);
    line-height: 1.75;
  }

  .case-feature--device-zoom.case-feature--device-above .case-feature__try {
    max-width: 52ch;
    width: 100%;
    margin-top: var(--space-md);
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    border-left: 1px solid var(--color-border);
    border-top: 3px solid var(--color-accent);
    border-radius: 10px;
  }
}

@media (max-width: 899px) {
  .case-feature--device-zoom .case-feature__embed {
    width: min(100%, var(--device-phone-width));
    margin-left: auto;
    margin-right: auto;
  }

  .case-feature--device-zoom.case-feature--device-above .case-feature__embed {
    width: min(100%, var(--device-tablet-width));
  }
}

/* ============================================================
   Act 05 — finale
   ============================================================ */

.case-finale {
  padding: var(--space-2xl) 0 var(--space-xl);
  border-top: 1px solid var(--color-border);
}

.case-finale__inner {
  max-width: var(--case-wide);
  margin: 0 auto;
  padding: 0 var(--case-gutter);
}

.case-finale__intro {
  display: grid;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

@media (min-width: 900px) {
  .case-finale__intro {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
    align-items: end;
  }

  .case-finale__intro .case-act__number,
  .case-finale__title {
    grid-column: 1;
  }

  .case-finale-lede {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: end;
  }
}

.case-finale__title {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 3.8vw, 2.75rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.12;
  text-wrap: balance;
  margin-bottom: 0;
}

.case-finale-lede {
  font-size: clamp(1.02rem, 1.25vw, 1.12rem);
  font-weight: 300;
  line-height: 1.8;
  color: var(--color-text-muted);
}

.case-finale__stage {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.case-finale__controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.625rem;
  margin-bottom: var(--space-xs);
}

.case-finale__controls .demo-embed-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.case-finale__hint {
  max-width: 52ch;
  margin: var(--space-md) auto 0;
  text-align: center;
  border-left: 1px solid var(--color-border);
  border-top: 3px solid var(--color-accent);
  border-radius: 10px;
}

.case-finale .demo-embed-header {
  justify-content: flex-end;
  margin-bottom: var(--space-sm);
}

.case-finale .demo-embed-controls {
  justify-content: center;
  gap: 0.625rem;
  margin-bottom: var(--space-xs);
}

.case-finale .demo-embed-hint {
  margin-top: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-size: clamp(0.95rem, 1.1vw, 1rem);
  line-height: 1.7;
}

.case-framing {
  margin-top: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-size: clamp(0.92rem, 1.05vw, 0.98rem);
  font-weight: 300;
  line-height: 1.7;
  color: var(--color-text-muted);
}

.case-framing strong {
  font-weight: 500;
  color: var(--color-text);
}

.page-case-study .showcase-footer.container {
  max-width: var(--case-wide);
  padding-left: var(--case-gutter);
  padding-right: var(--case-gutter);
}

/* Embed scroll isolation + focus */
.case-feature__embed .demo-embed-frame,
.case-finale .demo-embed-frame {
  overscroll-behavior: contain;
}

.case-feature__embed .hmi-panel__viewport:focus-within,
.case-finale .hmi-panel__viewport:focus-within {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .case-act__principles,
  .case-act__list {
    grid-template-columns: 1fr;
  }

  .case-act__title,
  .case-features__title {
    text-wrap: wrap;
  }

  .case-platform-dives {
    grid-template-columns: 1fr;
  }
}

/* Platform overview — deep dive cards (Act 05) */
.case-platform-dives {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

@media (max-width: 960px) {
  .case-platform-dives {
    grid-template-columns: 1fr;
  }
}

.case-platform-dive {
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.3s ease, transform 0.35s var(--ease-out-expo), box-shadow 0.35s ease;
}

.case-platform-dive:hover {
  border-color: var(--color-accent-border-strong);
  transform: translateY(-3px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

.case-platform-dive--hero {
  border-color: rgba(54, 124, 43, 0.35);
  background: linear-gradient(165deg, rgba(54, 124, 43, 0.08) 0%, var(--color-surface) 55%);
}

.case-platform-dive__eyebrow {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-sm);
}

.case-platform-dive__title {
  font-family: var(--font-mono);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: var(--space-sm);
}

.case-platform-dive__desc {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1.65;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}

.case-platform-dive__cta {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.case-platform-dive:hover .case-platform-dive__cta {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ============================================================
   Story rail — scroll progress through acts
   ============================================================ */

.case-story-rail {
  position: fixed;
  right: clamp(0.75rem, 2vw, 1.25rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 0.5rem;
  border-radius: 999px;
  background: rgba(10, 12, 10, 0.72);
  border: 1px solid var(--color-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.4s ease,
    visibility 0.4s ease,
    transform 0.4s var(--ease-out-expo);
}

.case-story-rail.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.case-story-rail__link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease;
  white-space: nowrap;
}

.case-story-rail__dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  transition: opacity 0.25s ease, transform 0.25s var(--ease-out-expo), background 0.25s ease;
}

.case-story-rail__label {
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-width 0.35s var(--ease-out-expo), opacity 0.25s ease;
}

.case-story-rail:hover .case-story-rail__label,
.case-story-rail:focus-within .case-story-rail__label {
  max-width: 6rem;
  opacity: 1;
}

.case-story-rail__link:hover,
.case-story-rail__link:focus-visible {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.case-story-rail__link.is-active {
  color: var(--color-accent);
}

.case-story-rail__link.is-active .case-story-rail__dot {
  opacity: 1;
  transform: scale(1.35);
  background: var(--color-accent);
}

.case-story-rail__link.is-passed .case-story-rail__dot {
  opacity: 0.7;
}

@media (max-width: 1100px) {
  .case-story-rail {
    top: auto;
    bottom: 1rem;
    right: 50%;
    transform: translateX(50%);
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    max-width: calc(100vw - 2rem);
    border-radius: 12px;
    padding: 0.5rem 0.65rem;
    gap: 0.25rem;
  }

  .case-story-rail.is-visible {
    transform: translateX(50%);
  }

  .case-story-rail__label {
    display: none;
  }

  .case-story-rail__link {
    padding: 0.4rem 0.55rem;
    font-size: 0.58rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .case-story-rail {
    transition: none;
  }
}

/* ============================================================
   Act bridge — narrative → interactive turn
   ============================================================ */

.case-bridge {
  max-width: var(--case-wide);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vh, 4rem) var(--case-gutter);
  text-align: center;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  background:
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(54, 124, 43, 0.07) 0%, transparent 70%);
}

.case-bridge__text {
  font-family: var(--font-mono);
  font-size: clamp(1.35rem, 2.8vw, 2rem);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: -0.02em;
  text-wrap: balance;
  color: var(--color-text);
  margin-bottom: var(--space-md);
}

.case-bridge__muted {
  display: block;
  margin-top: 0.35em;
  font-weight: 300;
  color: var(--color-text-muted);
}

.case-bridge__cue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  font-size: 0.85rem;
  color: var(--color-accent);
  animation: case-bridge-bob 2.4s ease-in-out infinite;
}

@keyframes case-bridge-bob {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(4px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .case-bridge__cue { animation: none; opacity: 0.85; }
}

/* ============================================================
   HMI hero embeds (earthmoving case studies)
   ============================================================ */

.page-case-study .showcase-hero--hmi {
  max-width: var(--case-wide);
  margin: 0 auto;
  padding: 0 var(--case-gutter);
}

.page-case-study .showcase-hero--hmi .showcase-hero-stage {
  padding: var(--space-md) 0 var(--space-lg);
}

.page-case-study .showcase-hero--hmi .hmi-panel {
  width: 100%;
  margin: 0 auto;
}

.page-case-study .showcase-hero--hmi .hmi-panel--cab {
  max-width: min(100%, calc(var(--case-cab-embed-max) + 48px));
}

.page-case-study .showcase-hero--angled .hmi-panel--cab .hmi-panel__shell {
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.05) inset,
    0 72px 160px -24px rgba(0, 0, 0, 0.8);
}

.page-case-study .showcase-hero--portal .hmi-panel--portal {
  max-width: 100%;
}

.page-case-study .showcase-hero--portal .hmi-panel__shell {
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.04) inset,
    0 48px 120px -20px rgba(0, 0, 0, 0.75);
}

/* Narrative rhythm — first act breathes after hero */
.page-case-study .case-narrative .case-act:first-child {
  padding-top: clamp(var(--space-xl), 4vh, var(--space-2xl));
}

.case-bridge + .case-features {
  border-top: none;
  padding-top: var(--space-xl);
}

/* Feature chapter counter */
.case-features {
  counter-reset: case-feature;
}

.case-feature {
  counter-increment: case-feature;
  position: relative;
}

.case-feature__kicker::before {
  content: counter(case-feature, decimal-leading-zero) " · ";
  opacity: 0.65;
}

/* Features header — clearer interactive turn */
.case-features__header {
  position: relative;
  padding-bottom: var(--space-md);
}

.case-features__header::after {
  content: "";
  display: block;
  width: 3rem;
  height: 2px;
  margin-top: var(--space-lg);
  background: linear-gradient(90deg, var(--color-accent), transparent);
  border-radius: 2px;
}

/* Showcase statement on case studies — wider rhythm */
.page-case-study .showcase-statement {
  max-width: var(--case-wide);
  margin: 0 auto;
  padding: clamp(2rem, 5vh, 3.5rem) var(--case-gutter);
}

.page-case-study .showcase-statement-text {
  max-width: 28ch;
  margin: 0 auto;
  text-wrap: balance;
}
