/* Scroll story: hero → notch fills → grey covers → grey splits to show «Для дому» → «Для бізнесу» → section 02 slides over.
   Base rules are the static page (no JS, reduced motion, very short windows): the blocks follow one another.
   story.js adds .story--live, which pins the stage and drives it from the scroll position. */
.story { position: relative; }
.story__stage { position: relative; }
.story__cover { display: none; }

/* ───────────── Full-screen scenes ───────────── */
.scene {
  position: relative;
  overflow: hidden;
  height: 100svh;
  min-height: 600px;
  color: #fff;
}
.scene__media { position: absolute; inset: 0; overflow: hidden; background: var(--color-bg-inverse); }
.scene__media img { width: 100%; height: 100%; object-fit: cover; }
.scene--home img { object-position: 38% 50%; }
.scene--business img { object-position: 52% 50%; }
.scene__shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgb(28 27 25 / .42), rgb(28 27 25 / 0) 48%),
    linear-gradient(rgb(28 27 25 / 0) 45%, rgb(28 27 25 / .36) 68%, rgb(28 27 25 / .84));
}

/* the card's parts, laid out for a whole screen with the page's 64px margins */
.scene__content { position: absolute; inset: 0; }
.scene__content > .solution__tag { position: absolute; top: calc(64 * var(--ui)); left: calc(64 * var(--u)); }
.scene__content > .solution__stat { position: absolute; top: calc(64 * var(--ui)); right: calc(64 * var(--u)); left: auto; color: var(--color-text-primary); }
.scene__body {
  position: absolute;
  right: calc(64 * var(--u));
  bottom: calc(64 * var(--ui));
  left: calc(64 * var(--u));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: calc(32 * var(--ui));
}
.scene__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: calc(88 * var(--ui));
  line-height: calc(84 * var(--ui));
  letter-spacing: -.035em;
}
.scene .solution__benefits li { font-size: calc(18 * var(--ui)); line-height: calc(26 * var(--ui)); }
.scene .solution__footer { justify-content: flex-start; gap: calc(32 * var(--ui)); width: auto; }

@media (max-width: 899px) {
  .scene__content > .solution__tag { top: 20px; right: 20px; left: 20px; justify-self: start; width: fit-content; }
  .scene__content > .solution__stat { top: 78px; right: auto; left: 20px; }
  .scene__body { right: 20px; bottom: 24px; left: 20px; gap: 20px; }
  .scene__title { font-size: 48px; line-height: 1; }
  .scene .solution__benefits li { font-size: 15px; line-height: 21px; }
  .scene .solution__footer { flex-wrap: wrap; gap: 14px 24px; }
}

/* ───────────── Pinned (live) ─────────────
   Full screens are 100lvh, the height with the phone browser's bars tucked away: sized by the small
   viewport they leave a strip uncovered at the bottom in Safari. On desktop the units are the same. */
.story--live { height: calc(var(--stage-h, 100lvh) + 5 * 100lvh); }
.story--live .scene__body { margin-bottom: calc(100lvh - 100dvh); } /* stays above the bars while they show */
.story--live .story__stage {
  position: sticky;
  top: var(--stick-top, 0px);
  overflow: hidden;
  height: var(--stage-h, 100lvh);
}
.story--live .story__cover,
.story--live .story__scenes { position: absolute; right: 0; bottom: 0; left: 0; height: 100lvh; }
.story--live .story__cover {
  display: block;
  z-index: 22; /* above the scenes, so its halves can part over the first one */
  visibility: hidden;
  background: var(--color-bg-page); /* one solid sheet until the cut: no seam at any zoom level */
  will-change: transform;
}
.story__half { position: absolute; right: 0; left: 0; background: var(--color-bg-page); will-change: transform; }
.story__half--top { top: 0; height: calc(50% + 1px); } /* 1px overlap: no seam while closed */
.story__half--bottom { top: 50%; bottom: 0; }
.story--live .story__scenes { z-index: 21; pointer-events: none; }
.story--live .scene { position: absolute; inset: 0; height: auto; min-height: 0; visibility: hidden; }
.story--live .scene.is-in { pointer-events: auto; }
.story--live .scene--home .scene__media { will-change: transform; }
.story--live .scene--business { will-change: transform; }
/* the first scene dims as the second slides over it */
.story--live .scene--home::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-bg-strong);
  opacity: var(--dim, 0);
  pointer-events: none;
}
/* section 02 is the grey sheet that covers the last scene */
.story--live + .solutions {
  position: relative;
  z-index: 30;
  min-height: 100lvh;
  margin-top: -100lvh;
  background: var(--color-bg-page);
}

/* ── Scene content: arrives once the photo fills the screen, leaves all at once ── */
.story--live .scene :is(.solution__tag, .solution__stat, .scene__title, .solution__benefits li, .solution__footer) {
  opacity: 0;
  translate: 0 var(--rise, 24px);
  transition: opacity .2s ease, translate .2s ease;
}
.story--live .scene.is-in :is(.solution__tag, .solution__stat, .scene__title, .solution__benefits li, .solution__footer) {
  opacity: 1;
  translate: 0 0;
  transition:
    opacity .6s cubic-bezier(.23, 1, .32, 1) var(--delay, 0s),
    translate .7s cubic-bezier(.23, 1, .32, 1) var(--delay, 0s);
}
.scene .solution__tag { --rise: 0px; }
.scene .scene__title { --rise: 36px; }
.scene .solution__stat { --rise: 16px; --delay: .18s; }
.scene .solution__benefits li:nth-child(1) { --delay: .09s; }
.scene .solution__benefits li:nth-child(2) { --delay: .15s; }
.scene .solution__benefits li:nth-child(3) { --delay: .2s; }
.scene .solution__footer { --delay: .27s; }

/* ── Section 02: head and the three cards arrive after the grey has covered the screen ── */
.js-reveal .solutions .reveal {
  opacity: 0;
  translate: 0 48px;
  transition: opacity .2s ease, translate .2s ease;
}
.js-reveal .solutions.is-revealed .reveal {
  opacity: 1;
  translate: 0 0;
  transition:
    opacity .7s cubic-bezier(.23, 1, .32, 1) var(--delay, 0s),
    translate .8s cubic-bezier(.23, 1, .32, 1) var(--delay, 0s);
}
.solutions .solution--home { --delay: .14s; }
.solutions .solution--business { --delay: .24s; }
.solutions .dealers { --delay: .32s; }
