/* Home concept scene: two separate videos glide together into one viewing. Desktop only; phones get a loop video. */

/* Title + stage + steps are pinned together and centered in the viewport. */
.scene-section { padding: 0; }
.scene-pin { min-height: calc(100vh - var(--header-h)); display: flex; flex-direction: column; justify-content: center; padding: 20px 0; }
.scene-pin .section-head { margin-bottom: 8px; }

.scene { display: grid; gap: 16px; }

.scene__stage {
  position: relative; width: 100%; margin: 0 auto; aspect-ratio: 16 / 7;
  max-width: min(1120px, calc((100vh - var(--header-h) - 340px) * 16 / 7));
  perspective: 1400px; perspective-origin: 50% 45%;
}

/* Windows keep their start box; motion is transform-only (x / y / scale) for smooth scrubbing. */
.scene__win {
  position: absolute; margin: 0; aspect-ratio: 16 / 9;
  transform-origin: 0 0; will-change: transform;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.scene__win video, .scene__win img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: var(--radius-window); background: var(--card-dark);
}
/* Shadow on a separate pre-rendered layer: it scales with the window as a bitmap instead of being redrawn. */
.scene__win::before {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: var(--radius-window);
  box-shadow: 0 24px 48px -18px rgba(20, 20, 30, 0.35), 0 8px 16px -10px rgba(20, 20, 30, 0.2);
  will-change: transform;
}
.scene__win--reaction { left: 2%; top: 20.4%; width: 46%; z-index: 1; }
.scene__win--original { left: 52%; top: 20.4%; width: 46%; z-index: 2; }

.scene__label {
  position: absolute; top: calc(63.75% + 12px); margin: 0; white-space: nowrap;
  font-size: var(--fs-small); color: var(--text-2);
}
.scene__label strong { color: var(--text); font-weight: 600; }
.scene__label--reaction { left: 2%; }
.scene__label--original { left: 52%; }

/* Dashed link between the windows at the "approach" layout (see STATES in concept-scene.js). */
.scene__link {
  position: absolute; left: 58.5%; top: 38.5%; width: 9%; height: 2px; z-index: 3; pointer-events: none;
  background: repeating-linear-gradient(90deg, var(--red) 0 6px, transparent 6px 12px);
  transform-origin: 0 50%; transform: scaleX(0); opacity: 0;
}
.scene__link span {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--radius-pill);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-card);
  font-size: var(--fs-tiny); font-weight: 600; color: var(--text-2);
}
.scene__link span .material-icons { font-size: 14px; color: var(--red); }

/* Overlays placed at the final merged layout (stage %), so they never scale with the windows. */
.scene__yt {
  position: absolute; right: calc(18.5% + 8px); top: calc(43.4% - 34px); z-index: 4;
  display: inline-flex; align-items: center; gap: 4px;
  height: 26px; padding: 0 10px; border-radius: 8px; background: rgba(0, 0, 0, 0.62); color: #fff;
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em; opacity: 0;
}
.scene__yt::before { content: ''; width: 0; height: 0; border-left: 7px solid #FF0033; border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.scene__viewer {
  position: absolute; left: calc(17% + 12px); right: calc(17% + 12px); bottom: calc(7.55% + 12px); height: 36px; z-index: 3;
  display: flex; align-items: center; gap: 10px; padding: 0 12px; border-radius: 10px;
  background: rgba(15, 15, 18, 0.78);
  color: #fff; font-size: 12px; opacity: 0; transform: translateY(8px);
}
.scene__viewer .material-icons { font-size: 18px; }
.scene__viewer i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.25); position: relative; overflow: hidden; }
.scene__viewer i::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 30%; background: var(--red); }
.scene__viewer b { font-weight: 600; opacity: 0.85; }

/* Steps sit below the stage as three columns */
.scene__steps {
  list-style: none; margin: 0 auto; padding: 0; width: 100%; max-width: 1120px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: step;
}
.scene__steps li {
  position: relative; padding: 14px 0 0; border-top: 2px solid var(--line);
  font-size: var(--fs-small); line-height: 1.5; color: var(--text-3);
  transition: color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}
.scene__steps li::before {
  counter-increment: step; content: '0' counter(step);
  display: block; font-weight: 700; font-size: var(--fs-tiny); letter-spacing: 0.06em; margin-bottom: 4px;
}
.scene__steps strong { display: block; font-size: 0.95rem; margin-bottom: 2px; color: inherit; }
.scene__steps li.is-active { color: var(--text-2); border-top-color: var(--red); }
.scene__steps li.is-active strong { color: var(--text); }
.scene__steps li.is-active::before { color: var(--red); }


/* Fallback: final frame, no motion */
.scene--static .scene__win--reaction { left: 17%; top: 7.55%; width: 66%; }
.scene--static .scene__win--original { left: 55.5%; top: 10%; width: 26%; }
.scene--static .scene__yt, .scene--static .scene__viewer { opacity: 1; transform: none; }
.scene--static .scene__label { display: none; }
.scene-section.scene--static .scene-pin { min-height: 0; }

@media (max-width: 900px) { .scene__steps { grid-template-columns: 1fr; } .scene-pin { min-height: 0; } }

/* Player chrome on each window so they read as videos (fades out on merge). */
.scene__chrome { position: absolute; inset: 0; border-radius: var(--radius-window); overflow: hidden; pointer-events: none; }
.scene__top {
  position: absolute; left: 0; right: 0; top: 0; height: 44px; padding: 0 14px;
  display: flex; align-items: center; gap: 8px; color: #fff; font-size: 13px;
  background: linear-gradient(180deg, rgba(0,0,0,.55), transparent);
}
.scene__top b { font-weight: 600; }
.scene__top em { font-style: normal; opacity: .7; font-size: 12px; }
.scene__avatar { width: 22px; height: 22px; border-radius: 50%; flex: none; }
.scene__avatar--me { background: linear-gradient(135deg, var(--red), #ff8a65); }
.scene__avatar--yt { background: #FF0033; position: relative; }
.scene__avatar--yt::after { content: ''; position: absolute; left: 8px; top: 6px; border-left: 8px solid #fff; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.scene__bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 40px; padding: 0 12px;
  display: flex; align-items: center; gap: 10px; color: #fff; font-size: 12px;
  background: linear-gradient(0deg, rgba(0,0,0,.6), transparent);
}
.scene__bar .material-icons { font-size: 20px; }
.scene__bar i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.3); overflow: hidden; }
.scene__bar s { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--red); }
.scene__win--original .scene__bar s { background: #FF0033; }
.scene__bar time { font-variant-numeric: tabular-nums; opacity: .85; }
.scene--static .scene__chrome { display: none; }

.scene__views { font-variant-numeric: tabular-nums; }

/* After the merge: both channels show their count, and both counts roll up together. */
.scene__badge--reaction {
  position: absolute; left: calc(17% + 12px); top: calc(7.55% + 12px); z-index: 4;
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 8px;
  background: rgba(0, 0, 0, 0.62); color: #fff; font-size: 12px; font-weight: 600; opacity: 0;
}
.scene__badge { overflow: visible; gap: 0; transition: box-shadow 400ms var(--ease-out); }
.scene__badge.is-bump { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25); }
.scene__count { font-variant-numeric: tabular-nums; }
.scene__badge .material-icons { font-size: 14px; margin-right: 4px; opacity: .8; }
.scene__badge em { font-style: normal; font-weight: 500; opacity: .72; margin-right: 8px; }
.scene__yt::before { display: none; }
/* Rolling count: the old value slides up and out while the new one slides in. */
.scene__badge .scene__count { display: inline-block; position: relative; overflow: hidden; height: 1.2em; line-height: 1.2em; vertical-align: bottom; margin: 0; }
.scene__count > span { display: block; }
.scene__count > span + span { position: absolute; left: 0; top: 0; }
.scene--static .scene__badge--reaction { opacity: 1; }

/* Phones: looped version. Smaller stage text, steps stay compact. */
@media (max-width: 899px) {
  .scene-pin { min-height: 0; padding: 72px 0 24px; }
  .scene__stage { max-width: 100%; }
  .scene__top { height: 30px; padding: 0 8px; font-size: 10px; gap: 5px; }
  .scene__top em { display: none; }
  .scene__top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .scene__avatar { width: 14px; height: 14px; }
  .scene__bar { height: 26px; padding: 0 8px; font-size: 9px; gap: 6px; }
  .scene__bar .material-icons { font-size: 14px; }
  .scene__viewer { height: 24px; font-size: 9px; padding: 0 8px; left: calc(17% + 6px); right: calc(17% + 6px); bottom: calc(7.55% + 6px); }
  .scene__viewer .material-icons { font-size: 13px; }
  .scene__badge, .scene__badge--reaction { height: 18px; padding: 0 6px; font-size: 9px; border-radius: 5px; }
  .scene__badge em { display: none; }
  .scene__badge .material-icons { font-size: 10px; }
  .scene__badge--reaction { left: calc(17% + 6px); top: calc(7.55% + 6px); }
  .scene__yt { right: calc(18.5% + 4px); top: calc(43.4% - 22px); }
  .scene__steps { grid-template-columns: 1fr; gap: 0; }
  .scene__steps li { padding: 10px 0; }
}

/* Used directly under the hero copy (no own title): sits close to the hero text. */
.scene-section--hero .scene-pin { min-height: 0; padding: 8px 0 24px; }
.scene-section--hero .scene__stage { max-width: min(1120px, calc((100vh - var(--header-h) - 440px) * 16 / 7)); }
@media (min-width: 900px) { .scene-section--hero .scene__stage { margin-top: -64px; } }

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
/* Player chrome: keep the title row on one line at any stage size */
.scene__top b, .scene__top em { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.scene__top em { flex: 1; }

/* Hero + scene: CSS sticky instead of JS pinning. The stack is one viewport tall plus the scroll
   length of the animation; its inner part sticks under the header while the timeline plays. */
@media (min-width: 900px) {
  .hero-stack.is-sticky { height: calc(100vh - var(--header-h) + 1250px); }
  .hero-stack.is-sticky .hero-stack__inner {
    position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow: hidden;
  }
}

/* Low laptop screens: give the height to the video, keep the steps to their titles. */
@media (min-width: 900px) and (max-height: 800px) {
  .hero { padding: 20px 0 16px; }
  .hero__copy .lead { margin-top: 12px; }
  .scene-section--hero .scene__stage { max-width: min(1120px, calc((100vh - var(--header-h) - 255px) * 16 / 7)); }
  .scene { gap: 8px; }
  .scene__steps li { padding-top: 8px; font-size: 0; }
  .scene__steps li::before { margin-bottom: 0; }
  .scene__steps strong { margin-bottom: 0; font-size: 0.875rem; }
}
/* Phones: the small stage holds one count. */
@media (max-width: 899px) {
  .scene-section--hero .scene__stage { max-width: min(100%, 720px); }
}

/* The intro video takes over the stage when the merge ends: full stage height, centered.
   It starts over the merged frame (see VIDEO in concept-scene.js) and grows into this box. */
.scene__video {
  position: absolute; left: 11.11%; top: 0; width: 77.78%; aspect-ratio: 16 / 9; z-index: 5;
  border-radius: var(--radius-window); overflow: hidden; background: var(--card-dark);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(193, 42, 31, 0.1), 0 0 16px rgba(193, 42, 31, 0.08);
  transform-origin: 0 0; opacity: 0; visibility: hidden;
}
.scene__video.is-playing, .scene--static .scene__video { opacity: 1 !important; visibility: visible !important; transform: none !important; }
/* Home: the headline and download buttons sit above the stage, so the stage starts below them. */
@media (min-width: 900px) { .hero--home + .scene-section--hero .scene__stage { margin-top: 0; } }
