/* Scroll-story block — claude theme. Plain CSS only (no Tailwind utilities,
   so tailwind-compiled.css does not need rebuilding).

   ONE set of scene DOM drives two layouts:
   - default (no JS / reduced-motion / non-JS crawlers): a clean static card grid
   - .scroll-story--active (scroll-story.js initialised): pinned canvas-scrub view */

/* position:sticky needs no scrolling-container ancestor. The shared layout
   wrapper (#wrapper.wrap.overflow-x-hidden in base.html.twig) uses
   overflow-x:hidden, which forces overflow-y:auto — that makes .wrap a scroll
   container and breaks sticky inside it. overflow-x:clip clips horizontal
   overflow WITHOUT creating a scroll container. Scoped with :has() so only
   pages that actually contain a scroll-story block are affected. */
.wrap.overflow-x-hidden:has(.scroll-story) {
  overflow-x: clip;
}

.scroll-story {
  position: relative;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
}

/* ============================================================
   DEFAULT — static card grid (no JS / reduced-motion / crawlers).
   Semantic, single copy of every text, normal document flow.
   ============================================================ */

.scroll-story__canvas,
.scroll-story__scrim {
  display: none;
}

.scroll-story__overlay {
  max-width: 80rem;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.scroll-story__header {
  margin-bottom: 2.5rem;
}

.scroll-story__eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #2c0e6f;
}

.scroll-story__title {
  margin: 0;
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.15;
  color: #1a1a2e;
}

.scroll-story__intro {
  margin: 0.75rem 0 0;
  max-width: 48rem;
  font-size: 1.05rem;
  line-height: 1.6;
  color: #4b5563;
}

.scroll-story__scenes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 640px) {
  .scroll-story__scenes { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1024px) {
  .scroll-story__scenes { grid-template-columns: repeat(4, 1fr); }
}

.scroll-story__scene {
  padding: 1.5rem;
  background: #fff;
  border: 1px solid rgba(180, 167, 214, 0.25);
  border-radius: 1rem;
}

.scroll-story__scene-title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: #1a1a2e;
}

.scroll-story__scene-desc {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #6b7280;
}

.scroll-story__nav { display: none; }

.scroll-story__cta {
  margin-top: 2.5rem;
}

.scroll-story__cta-link {
  display: inline-flex;
  align-items: center;
  padding: 0.85rem 1.75rem;
  border-radius: 999px;
  background: #2c0e6f;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease;
}
.scroll-story__cta-link:hover { background: #3d1a9b; }

/* ============================================================
   ACTIVE — pinned canvas-scrub layout (scroll-story.js initialised).
   ============================================================ */

.scroll-story--active {
  height: var(--ss-h, 400vh);
}

.scroll-story--active .scroll-story__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #0b0b14;
}

.scroll-story--active .scroll-story__canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  will-change: transform, filter;
  transform-origin: center;
}

.scroll-story--active .scroll-story__scrim {
  display: block;
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* Same gradient pattern as page-hero (bg-gradient-to-r from primary to
     primary-dark), applied at ~80% opacity as a video overlay so Szymon
     and the signs remain readable through the tint. */
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--color-primary)      80%, transparent) 0%,
    color-mix(in srgb, var(--color-primary-dark) 80%, transparent) 100%
  );
}

.scroll-story--active .scroll-story__overlay {
  position: absolute;
  inset: 0;
  max-width: none;
  margin: 0;
  padding: 6vh 6vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
}

.scroll-story--active .scroll-story__header { margin-bottom: 2rem; }
.scroll-story--active .scroll-story__eyebrow { color: #b4a7d6; }
.scroll-story--active .scroll-story__title { color: #fff; max-width: 18ch; }
.scroll-story--active .scroll-story__intro { display: none; }

.scroll-story--active .scroll-story__scenes {
  display: block;
  position: relative;
  min-height: 11rem;
}

.scroll-story--active .scroll-story__scene {
  position: absolute;
  inset: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  opacity: 0;
  transition: opacity 0.25s ease;
  /* flex column so we can horizontally pin content left or right per scene */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start; /* default = left */
}

.scroll-story--active .scroll-story__scene--right {
  align-items: flex-end;
}

/* Cap text to the outer side strip so it never crashes into the centred
   subject + sign Szymon is holding. min() keeps a sensible ceiling at small
   viewports while clamping the column at wide viewports. */
.scroll-story--active .scroll-story__scene > * {
  max-width: min(32ch, 38vw);
}

.scroll-story--active .scroll-story__scene--right .scroll-story__scene-title,
.scroll-story--active .scroll-story__scene--right .scroll-story__scene-desc {
  text-align: right;
}

/* Legibility shadow — strong enough to survive any background photo
   (the per-scene side vignette was removed because during cross-fade the
   outgoing + incoming gradients overlapped and produced a visible dark
   block that resolved only on the HOLD keyframe). The purple brand scrim
   plus this text-shadow now carry all the contrast. */
.scroll-story--active .scroll-story__scene-title,
.scroll-story--active .scroll-story__scene-desc {
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.55), 0 1px 3px rgba(0, 0, 0, 0.6);
}

.scroll-story--active .scroll-story__scene-title {
  margin: 0 0 0.6rem;
  font-size: clamp(1.4rem, 2.8vw, 2.2rem);
  font-weight: 800;
  line-height: 1.2;
  color: #fff;
}

.scroll-story--active .scroll-story__scene-desc {
  font-size: clamp(0.95rem, 1.3vw, 1.1rem);
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.82);
}

.scroll-story--active .scroll-story__cta {
  margin-top: 2rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Nav dots: clickable jump-to-scene affordance. Bottom-centre of overlay. */
.scroll-story--active .scroll-story__nav {
  display: flex;
  position: absolute;
  bottom: 3vh;
  left: 50%;
  transform: translateX(-50%);
  gap: 0.7rem;
  padding: 0.5rem 0.85rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2;
}

.scroll-story__nav-dot {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.scroll-story__nav-dot:hover { background: rgba(255, 255, 255, 0.65); }
.scroll-story__nav-dot:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}
.scroll-story__nav-dot.is-active {
  background: #fff;
  transform: scale(1.4);
}

/* Mobile: shorter scroll budget */
@media (max-width: 768px) {
  .scroll-story--active { height: var(--ss-h-mobile, 240vh); }
  .scroll-story--active .scroll-story__overlay { padding: 5vh 7vw; }
}
