/* =============================================================================
   ZASTRON LABS V2 · stories.css
   The six picker-word walkthrough lessons on the home page ("stories").
   One story visible at a time; site.js swaps them on the hero:mode event.
   Ported from the Figma "Home - states" page (CEO-approved format, 2026-07-07):
   kicker + title + intro, 4 steps (sentence beside its exact labelled visual),
   outro + next-word link, sources line. SVG shapes carry literal hex fills
   (matching the site tokens); SVG text is styled here.
   ========================================================================== */

/* =============================================================================
   FIGMA HERO (.fhero) · exact mirror of the "Home - states" frames (1240x720):
   72-dot field (grid lines for spreadsheets, wavy lanes for pipelines), a 55%
   paper panel at (40,150) 720x360 behind the copy, headline at (80,190) 52px,
   quip at (80,380) 22px, chips at (80,440), and the per-word illustration
   placed at its Figma rect, in front (pointer-events off).
   ========================================================================== */
.fhero {
  max-width: 1240px;
  margin: 1rem auto 0;
  padding: 0 0.5rem;
}

/* The hidden attribute alone is not enough here: author img/svg resets beat
   the UA [hidden] rule, and SVG roots ignore it entirely (L103). */
.fhero__stage [hidden] { display: none !important; }

.fhero__stage {
  position: relative;
  aspect-ratio: 1240 / 720;
}

.fhero__dots {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.fhero__panel {
  position: absolute;
  left: 3.2258%;   /* 40/1240 */
  top: 20.8333%;   /* 150/720 */
  width: 58.0645%; /* 720/1240 */
  height: 50%;     /* 360/720 */
  background: rgba(250, 249, 247, 0.55);
  -webkit-backdrop-filter: blur(9px) saturate(120%);
  backdrop-filter: blur(9px) saturate(120%);
  border-radius: 14px;
  pointer-events: none;
}

.fhero__copy {
  position: absolute;
  left: 6.4516%;   /* 80/1240 */
  top: 26.3889%;   /* 190/720 */
  max-width: 52%;
}

.fhero__title {
  font-size: clamp(2rem, 4.194vw, 3.25rem); /* 52px at 1240 */
  font-weight: 500;
  line-height: 1.731;                        /* 90px line pitch at 52px */
  letter-spacing: var(--ls-tight);
  color: var(--ink);
  margin: 0;
}

.fhero__line { display: block; white-space: nowrap; }

.fhero__quip {
  margin-top: clamp(1rem, 2.6vw, 2.3rem);   /* quip top = 380 in Figma */
  font-size: clamp(1rem, 1.774vw, 1.375rem); /* 22px at 1240 */
  color: var(--ink);
  transition: opacity 180ms var(--ease, ease);
}

.fhero__quip.is-swapping { opacity: 0; }

.fhero__chips { margin-top: clamp(0.9rem, 2.3vw, 2rem); }

.fhero__img {
  --tr: none;
  position: absolute;
  object-fit: contain;
  pointer-events: none;
  height: auto;
  transform: var(--tr);
  animation:
    fhero-in 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both,
    fhero-float 7s 0.7s ease-in-out infinite;
}

@keyframes fhero-in {
  from { opacity: 0; transform: var(--tr) translateY(16px) scale(0.985); }
  to   { opacity: 1; transform: var(--tr) translateY(0)    scale(1); }
}

@keyframes fhero-float {
  0%, 100% { transform: var(--tr) translateY(0); }
  50%      { transform: var(--tr) translateY(-9px); }
}

@media (prefers-reduced-motion: reduce) {
  .fhero__img { animation: none !important; }
}

/* Per-word placement: figures sit in the right half, clear of the copy. */
.fhero__img--data         { left: 40.3226%; top: 19.5%;   width: 58.0645%; }

/* The dinosaur walks for real (a looping alpha video); entrance only here. */
.fhero__img--data {
  animation: fhero-in 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.fhero__img--spreadsheets { left: 49.5%;    top: 32%;     width: 45.5%; }
.fhero__img--models       { left: 41%;      top: 17.5%;   width: 60%; }
.fhero__img--forecasts    { left: 41.5%;    top: 21.5%;   width: 55%; }
.fhero__img--experiments  { left: 40%; top: 20%; width: 58%; }

.fhero__rule {
  margin-top: 0;
  border-top: 1px solid var(--line);
  margin-left: 6.4516%;
  margin-right: 6.4516%;
}

@media (max-width: 45em) {
  .fhero__stage {
    aspect-ratio: auto;
    padding: 1.5rem 1rem 0;
    display: flex;
    flex-direction: column;
  }
  .fhero__dots, .fhero__panel { display: none; }
  /* Dissolve the copy wrapper so headline / art / quip / chips can be
     ordered individually: headline, then the art, then quip + chips. */
  .fhero__copy { display: contents; }
  .fhero__title { order: 0; }
  .fhero__quip { order: 2; margin-top: 1.25rem; }
  .fhero__chips { order: 3; }
  .fhero__line { white-space: normal; display: inline; }
  .fhero__img {
    position: static;
    display: block;
    width: 100% !important;
    margin-top: 1rem;
    transform: none;
    order: 1;
  }
  .fhero__img[hidden] { display: none; }
  /* Pipelines has no separate figure: its lanes + packets ARE the visual,
     so on mobile the lanes SVG becomes an in-flow figure below the copy
     (negative margins trim the empty bands of the 1240x720 viewBox). */
  svg.fhero__dots[data-hero-art="pipelines"] {
    display: block;
    position: static;
    width: 100%;
    height: auto;
    margin: -4% 0 -10%;
    order: 1;
  }
}

.stories { padding: 1rem 0 2rem; }

.story[hidden] { display: none; }

.story__head { max-width: 46rem; }

.story__intro {
  margin-top: 1rem;
  font-size: var(--fs-lead);
  line-height: 1.6;
  color: var(--ink-2);
}

/* -- steps ---------------------------------------------------------------- */
.story__steps {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
}

.sstep {
  display: grid;
  grid-template-columns: minmax(16rem, 5fr) 8fr;
  gap: 2rem 3rem;
  align-items: center;
  padding: 1.75rem 0;
}

.sstep__n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.875rem;
}

.sstep__copy h3 {
  font-size: 1.4375rem;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.625rem;
}

.sstep__copy p {
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink-2);
  margin: 0;
  max-width: 26rem;
}

.sstep__vis {
  margin: 0;
  background: var(--bg-elev);
  border-radius: 18px;
  overflow: hidden;
}

.sstep__vis svg {
  display: block;
  width: 100%;
  height: auto;
}

/* -- svg text ------------------------------------------------------------- */
.story svg text { font-family: var(--font-sans); }
.story svg .svg-tb   { fill: var(--ink); font-weight: 600; }
.story svg .svg-tb60 { fill: var(--ink); opacity: 0.65; font-weight: 600; }
.story svg .svg-tm   { fill: var(--ink); opacity: 0.6;  font-weight: 500; }
.story svg .svg-t    { fill: var(--ink); opacity: 0.55; }
.story svg .svg-t2   { fill: var(--ink); opacity: 0.45; }
.story svg .svg-ta   { fill: var(--accent); font-weight: 600; }
.story svg .svg-tp   { fill: #FAF9F7; font-weight: 600; }
.story svg .svg-red  { fill: #B84D38; font-weight: 600; }

/* -- outro + sources ------------------------------------------------------ */
.story__outro {
  border-top: 1px solid var(--line);
  margin-top: 2rem;
  padding-top: 1.75rem;
  max-width: 46rem;
}

.story__outro p {
  font-size: var(--fs-lead);
  line-height: 1.65;
  color: var(--ink-2);
  margin: 0 0 1.25rem;
}

.story__next {
  display: inline-block;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.story__next:hover,
.story__next:focus-visible {
  border-bottom-color: var(--accent);
}

.story__sources {
  margin-top: 1.75rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--ink-3);
  max-width: 56rem;
}

/* -- small screens: copy above its visual --------------------------------- */
@media (max-width: 56.25em) {
  .sstep {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1.5rem 0;
  }
  .sstep__copy p { max-width: none; }
}

/* Pipelines: amber packets travel the lanes (ported from hero-bg.js). */
.fhero__packet {
  animation: packetFlow 9s linear infinite;
}
.fhero__packet--l2 { animation-delay: -2.25s; }
.fhero__packet--l3 { animation-delay: -4.5s; }
.fhero__packet--l4 { animation-delay: -6.75s; }
@keyframes packetFlow {
  0%   { offset-distance: 0%;   opacity: 0; }
  4%   { opacity: 1; }
  96%  { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .fhero__packet { animation: none; }
}
