/* Same hero, header, buttons and benefits; the character variant only changes
   the scene canvas, copy measure and the position of the video control. */
.hero--character {
  --hero-desktop-min-height: calc(40.875rem * var(--hero-scene-scale));
  --hero-compact-ratio: var(--character-compact-width, 760) / var(--character-compact-height, 654);
  container: character-hero / inline-size;
}

/* Optional source typography keeps the common fluid curve and enlarged text.
   Characters without an override retain the existing token and measure. */
.hero--character.hero--custom-typography {
  --hero-title-font-size: calc(var(--character-title-size) * 1rem);
}

/* Only media uses scene coordinates. All text and controls stay in HTML.
   Separate layers allow a new client photo without rebuilding the component. */
.hero__art--layered {
  max-width: none;
}
.hero__art--layered::after { display: none; }
.hero__art--layered > picture { display: block; }
.hero__art--layered > picture img { object-position: center top; }
.hero__scene {
  position: absolute;
  top: 0;
  left: 50%;
  width: auto;
  height: 100%;
  aspect-ratio: var(--scene-ratio);
  translate: -50% 0;
  isolation: isolate;
}
.hero__scene img { object-fit: fill; }
.hero__scene-layer {
  position: absolute;
  left: var(--layer-x);
  top: var(--layer-y);
  width: var(--layer-width);
  height: var(--layer-height);
  mix-blend-mode: var(--layer-blend, normal);
  transform: var(--layer-transform, none);
  transform-origin: 0 0;
}
.hero__scene-layer picture { display: block; }
/* 1px past each side: a scene shifted by a fractional offset (taller titled
   heroes) must not leave the outer pixel column of the sky uncovered. */
.hero__scene-layer--surface {
  left: calc(50% - 50vw - 1px);
  width: calc(100vw + 2px);
}
.hero--character .video-trigger { --character-play-size: min(var(--play-size), 28vw, 124px); }

@media (width >= 75rem) {
  .hero--character {
    padding-bottom: 2.075439453rem;
    background: var(--hero-compact-sky);
    /* Client 27.10.2026: the surface fades into the page colour, so the
       Figma 50 / 1400 lower corners only cut that fade into a visible arc
       (with the purple sky on its antialiased rim). The lower edge is
       straight, as on compact layouts, and the fade meets the page seamlessly. */
    border-radius: 0;
  }
  .hero--character .hero__content { width: min(100%, 45rem); }
  .hero--character.hero--custom-typography .hero__content {
    width: min(100%, calc(var(--character-title-width) * var(--hero-design-unit, 1rem)));
  }
  .hero--character.hero--custom-typography h1 {
    font-size: calc(var(--character-title-size) * var(--hero-design-unit, 1rem));
  }
  .hero--character .hero__video-area { width: min(100%, calc(87.5rem * var(--hero-scene-scale))); }
  .hero--character .video-trigger {
    left: var(--character-video-x, 51.392857%);
    right: auto;
    top: var(--character-video-y, 60%);
    translate: -50% -50%;
  }
  .hero--character .hero__art--layered {
    mask-image: none;
  }
  /* The desktop frame matches Figma, including where it crops a photo. */
  .hero--character .hero__scene-layer[data-edge-fade] { mask-image: none; }
}

@media (width < 75rem) {
  .hero--character::before { background-size: auto 70rem; }
  .hero--character .hero__media {
    /* The backdrop remains edge-to-edge after the photo reaches its size cap. */
    max-height: 40.875rem;
  }
  .hero--character .hero__scene {
    height: 100%;
    width: auto;
    /* The focal point belongs to the scene data, not the character's slug. */
    translate: calc(-1 * var(--character-focal-x, 70%)) 0;
  }
  .hero--character .hero__scene-layer--surface { left: calc(var(--character-focal-x, 70%) - 50vw); }
  .hero--character .hero__art--layered::after {
    display: block;
    background: var(--hero-compact-fade);
  }
  /* Client 24.10.2026: a short, dense strip of haze at the photo's lower cut,
     as in the character programme, instead of a third of the picture. */
  .hero--character .hero__scene-layer[data-edge-fade] { --edge-fade-size: 5%; }
  .hero--character .video-trigger {
    left: var(--character-compact-video-x, 28%);
    top: min(var(--character-compact-video-y, 65%), calc(100% - var(--hero-compact-cta-overlap) - var(--character-play-size) * .678 - .5rem));
    width: var(--character-play-size);
    height: var(--character-play-size);
  }
}
@media (width < 48rem) {
  /* Client 24.10.2026: characters a little larger on phones — the frame is
     8 % narrower than each scene's compact width, so the scene scales up. */
  .hero--character { --hero-compact-ratio: calc(var(--character-compact-width, 760) * .92) / var(--character-compact-height, 654); }
}

/* At enlarged text sizes a nominal desktop no longer fits the split scene.
   Switch just the arrangement; retain the requested text size and one DOM. */
@media (width >= 75rem) {
  @container character-hero (max-width: 70em) {
    .hero__intro { order: 0; }
    .hero__content { text-align: center; }
    .hero__location { justify-content: center; }
    .hero__media {
      order: 1;
      position: relative;
      flex: none;
      width: 100%;
      aspect-ratio: var(--hero-compact-ratio);
      max-height: 654px;
      margin-top: 1.5rem;
    }
    .hero__scene {
      height: 100%;
      width: auto;
      translate: calc(-1 * var(--character-focal-x, 70%)) 0;
    }
    .hero__scene-layer--surface { left: calc(var(--character-focal-x, 70%) - 50vw); }
    .hero__art--layered { mask-image: linear-gradient(transparent, #000 10%); }
    .hero--character .hero__scene-layer[data-edge-fade] { mask-image: var(--edge-fade-mask); }
    .hero__art--layered::after {
      display: block;
      inset: auto 0 0;
      height: var(--hero-compact-fade-height);
      background: var(--hero-compact-fade);
    }
    .hero__video-area { width: 100%; }
    .hero--character .video-trigger {
      left: var(--character-compact-video-x, 28%);
      top: min(var(--character-compact-video-y, 65%), calc(100% - var(--hero-compact-cta-overlap) - var(--character-play-size) * .678 - .5rem));
      width: var(--character-play-size);
      height: var(--character-play-size);
    }
    .hero__cta {
      order: 2;
      position: relative;
      width: 100%;
      padding-inline: var(--page-gutter);
      margin-top: calc(-1 * var(--hero-compact-cta-overlap));
      text-align: center;
      background: linear-gradient(transparent var(--hero-compact-cta-overlap), var(--color-page) var(--hero-compact-cta-overlap));
    }
    .hero__cta .split-button { margin-top: 0; }
    .hero__benefits {
      order: 3;
      width: 100%;
      padding: 2rem var(--page-gutter);
      background: var(--color-page);
    }
  }
}
/* Heading line breaks, docs/heading-typography.md. Desktop keeps the Figma
   lines as blocks and balances only a line that still has to wrap. Phones flow
   the lines as one balanced paragraph; the data supplies no-break spaces for
   prices and short words, so nothing hangs alone at either end of a line. */
.hero--character h1 span { text-wrap: balance; }
/* A no-break joiner is real text: between block lines it would add an empty line. */
.hero--character h1 .hero__title-joiner { display: none; }
/* Price markup stays plain inline text on tablet/desktop (Figma lines). */
.hero--character h1 .hero__price,
.hero--character h1 .hero__amount { display: inline; }
@media (width < 48rem) {
  .hero--character h1 { text-wrap: balance; }
  .hero--character h1 span,
  .hero--character h1 .hero__title-joiner { display: inline; }
  /* "от 4 990 ₽" is one atomic box with an atomic amount inside: it never
     leaves "от" at a line end; if it is wider than the line (200% text on a
     320 px phone) it can only break after "от". */
  .hero--character h1 .hero__price,
  .hero--character h1 .hero__amount { display: inline-block; }
}

/* A centred location that wraps keeps its pin beside the first word instead
   of at the left edge of the whole two-line box. The pin is centred on the
   text line: Golos Text ascent .98 / descent .22 put that line's middle .38em
   above the baseline, minus half of the pin height used in each range. */
@media (width < 75rem) {
  .hero--character .hero__location { display: block; text-wrap: balance; }
  .hero--character .hero__location img { display: inline-block; margin-inline-end: .5rem; vertical-align: calc(.38em - .59375rem); }
}
@media (48rem <= width < 75rem) {
  .hero--character .hero__location img { margin-inline-end: .6875rem; vertical-align: calc(.38em - .71875rem); }
}
@media (width >= 75rem) {
  @container character-hero (max-width: 70em) {
    .hero--character .hero__location { display: block; text-wrap: balance; }
    .hero--character .hero__location img { display: inline-block; margin-inline-end: .9375rem; vertical-align: calc(.38em - .625rem); }
  }
}

/* Approved 2026-11-02: grow upward from the original visible lower edge.
   The measured costume keeps 24px above and at least 16px on both sides. */
@media (width < 48rem) {
 .hero--character[data-mobile-actor-fit] .hero__art--layered { top: -32px; height: calc(100% + 32px); mask-image: linear-gradient(transparent,#000 12px); }
 .hero--character[data-mobile-actor-fit] .hero__scene { top: 32px; height: calc(100% - 32px); }
 .hero--character[data-mobile-actor-fit] [data-mobile-actor-bounds] { transform: scale(var(--mobile-actor-scale,1)); transform-origin: var(--mobile-actor-origin-x,50%) var(--mobile-actor-origin-y,100%); }
}
