/* Veya Digital — case-study chapter opener. Shared by every /work/ page
   and the homepage. Each chapter is a normal, stacked block in document
   flow — no scroll pin, no position:fixed, no scrub. It fades up into
   place as it's scrolled to, then stays put; the next chapter does the
   same below it. Distinct copy and per-page chapter count, same rhythm. */

.case-story {
  position: relative;
  padding: 130px 0;
  overflow: hidden;
  background: var(--ink);
  border-top: 1px solid var(--line);
  counter-reset: veya-chapter;
}

.case-story-canvas {
  display: none;
}

.case-story-wrap {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 4.5vw;
}

.case-story-stage {
  position: relative;
  counter-increment: veya-chapter;
  padding: 70px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.case-story-stage:first-child {
  padding-top: 0;
}

/* The chapter divider draws itself in left-to-right as the chapter
   enters, instead of just being there — a rule being ruled, not a
   line that was always drawn. */
.case-story-stage::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.1s;
}

.case-story-stage:first-child::after {
  display: none;
}

.case-story-stage::before {
  content: "0" counter(veya-chapter);
  font: 11px var(--mono);
  letter-spacing: 0.1em;
  color: var(--muted-on-dark);
  margin: 0 0 22px;
}

.case-story-stage.is-in {
  opacity: 1;
  transform: none;
}

.case-story-stage.is-in::after {
  transform: scaleX(1);
}

.case-story-kicker {
  font: 11px var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--acid);
  margin: 0 0 18px;
}

.case-story-stage h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(28px, 4vw, 54px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--paper);
  margin: 0;
  max-width: 780px;
  text-wrap: balance;
}

.case-story-stage p.case-story-sub {
  margin: 18px 0 0;
  max-width: 460px;
  color: var(--muted-on-dark-soft);
  font-size: 16px;
  line-height: 1.5;
}

.case-story-badge {
  margin-top: 28px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 40px;
  background: rgba(242, 240, 235, 0.04);
}

/* The three client marks are supplied as dark-on-light lockups of differing
   proportions (a 16:9 brand card, a square lockup, a wide horizontal
   lockup). `object-fit: cover` in a 32px circle cropped straight through
   the middle of all three, so each one read as a fragment of a logo rather
   than the logo. Contain them on a paper plate instead: every mark is shown
   whole, at its own aspect ratio, exactly as supplied. */
.case-story-badge img {
  height: 36px;
  width: auto;
  max-width: 116px;
  object-fit: contain;
  display: block;
  border-radius: 999px;
  background: var(--paper);
  padding: 5px 9px;
}

.case-story-badge span {
  font: 12px var(--mono);
  color: var(--muted-on-dark);
}

.case-story-chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 30px 0 0;
  padding: 0;
  max-width: 560px;
}

.case-story-chips li {
  font: 11px var(--mono);
  letter-spacing: 0.03em;
  color: var(--muted-on-dark);
  border: 1px solid var(--line);
  border-radius: 40px;
  padding: 8px 14px;
}

.case-story-stage .cta {
  margin-top: 30px;
}

/* Cinematic cascade: once a chapter is in view, its kicker, sub-copy,
   badge, spec row and CTA settle in one after another instead of all
   at once — the heading gets its own char-level reveal (motion.js),
   this staggers everything else around it so the whole chapter feels
   like it's assembling, not just fading up as one flat block. */
.case-story-kicker,
.case-story-stage p.case-story-sub,
.case-story-badge,
.case-story-stage .spec-row,
.case-story-stage .cta {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.case-story-stage.is-in .case-story-kicker {
  transition-delay: 0.05s;
}
.case-story-stage.is-in p.case-story-sub {
  transition-delay: 0.25s;
}
.case-story-stage.is-in .case-story-badge {
  transition-delay: 0.4s;
}
.case-story-stage.is-in .spec-row {
  transition-delay: 0.5s;
}
.case-story-stage.is-in .cta {
  transition-delay: 0.6s;
}
.case-story-stage.is-in .case-story-kicker,
.case-story-stage.is-in p.case-story-sub,
.case-story-stage.is-in .case-story-badge,
.case-story-stage.is-in .spec-row,
.case-story-stage.is-in .cta {
  opacity: 1;
  transform: none;
}

/* Homepage real-work chapters (#work) get a full-scene pacing — each
   project takes up most of the viewport as you scroll to it, so moving
   from CareVeya to Eby's Place to Kouvia reads as one chapter after
   another rather than a quick flat scroll. No pin, no scrub: still a
   normal in-flow block, just a tall one, same mechanism as every other
   .case-story-stage on the site. */
/* `svh` throughout: plain `vh` follows the *large* viewport, so every one
   of these tall stages re-lays-out the instant a mobile address bar
   collapses or expands mid-scroll. `svh` is fixed to the chrome-visible
   viewport and never moves, which is what keeps the scroll steady. */
#work .case-story-stage {
  min-height: 74vh;
  min-height: 74svh;
  justify-content: center;
}

.case-story-ctas {
  margin-top: 38px;
  display: flex;
  align-items: center;
  gap: 30px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Homepage systems-story (#story) — the "Complexity → Momentum" narrative.
   Extra scroll room per stage plus a background canvas layer that holds
   its position while the still-normal-flow text stages scroll past it,
   then lets go once the section ends. NOT a ScrollTrigger pin (see
   MOTION.md): the section itself is a real, tall, in-flow block and
   nothing about the text layout is touched. The canvas layer's position
   is toggled fixed/absolute by hand (see assets/js/systems-story.js) —
   this predates the switch to `overflow-x: clip` on html/body and is left
   as-is deliberately: it works, and it is the mechanism systems-story.js
   is written against (see the matching note in styles.css). */
.case-story--systems {
  padding-top: 60px;
}

.case-story--systems .case-story-wrap {
  position: relative;
  z-index: 2;
}

.case-story--systems .case-story-stage {
  min-height: 80vh;
  min-height: 80svh;
  justify-content: center;
}

.case-story--systems .case-story-stage:first-child {
  padding-top: 70px;
}

.systems-story-visual {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  height: 100svh;
  z-index: 1;
  pointer-events: none;
  /* This layer is toggled to position:fixed while the section is on screen.
     Promoting it to its own compositor layer keeps its repaints out of the
     page's — without it, every scroll frame re-rasterises the content
     behind a full-viewport fixed element. */
  transform: translateZ(0);
  will-change: transform;
  contain: layout paint;
}

.systems-story-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.8s ease;
}

@media (max-width: 720px) {
  .case-story--systems .case-story-stage {
    min-height: 62vh;
    min-height: 62svh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .case-story--systems .case-story-stage {
    min-height: 0;
  }
  .systems-story-visual {
    display: none;
  }
}

@media (max-width: 720px) {
  .case-story {
    padding: 90px 0;
  }
  .case-story-stage {
    padding: 50px 0;
  }
  #work .case-story-stage {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .case-story-stage {
    opacity: 1;
    transform: none;
  }
  .case-story-stage::after {
    transform: scaleX(1);
  }
  .case-story-kicker,
  .case-story-stage p.case-story-sub,
  .case-story-badge,
  .case-story-stage .spec-row,
  .case-story-stage .cta {
    opacity: 1;
    transform: none;
    transition-delay: 0s;
  }
}

