/* ============================================================
   FLOTARIUM — SCROLL HERO  (GSAP 3 + ScrollTrigger)
   Single-screen, scroll-driven hero. Own .sh-* namespace so the
   legacy scroll.js hero hooks (.hero / .hero-figure / .hero-stage)
   stay dormant. All motion gates on [data-motion]/reduced-motion.
   ============================================================ */

.sh {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 600px;
  overflow: hidden;
  background: #03080f;
  isolation: isolate;
}

/* ---------- background layers ---------- */
.sh-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.sh-bg img,
.sh-bg video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 42%;
  will-change: transform;
}
/* image-slot backgrounds fill the layer edge-to-edge */
.sh-bg image-slot {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  will-change: transform;
}
.sh-bg1 img,
.sh-bg1 video { object-position: 82% 50%; }

/* Original Yandex badges: top-right on desktop, in the copy on mobile. */
.sh-yandex {
  position: absolute;
  top: 94px;
  right: var(--sh-yandex-right, var(--gut));
  z-index: 6;
  display: block;
  width: 110px;
  flex: none;
  will-change: transform, opacity;
}
.sh-yandex img { display: block; width: 100%; height: auto; }
.sh-yandex:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 6px; border-radius: 8px; }

/* ---------- floating logo-circle motif (over background 1) ---------- */
.sh-orbit {
  position: absolute;
  inset: 0;
  z-index: 2;        /* above the photo, below the text content */
  display: grid;
  place-items: center;
  pointer-events: none;
}
.sh-orbit-drift {
  width: min(72vmin, 680px);
  aspect-ratio: 1;
  position: relative;
}
.sh-orbit-sway {
  position: absolute;
  inset: 0;
}
/* each loop is its own full-size square layer; rotating the SQUARE around its
   own centre (= the shared screen centre) keeps all 4 anchored to one point */
.sh-loop {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transform-origin: 50% 50%;
  will-change: transform;
}
.sh-loop svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.sh-loop path {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}
/* central pair — brighter, thin */
.l-a path, .l-b path {
  stroke: color-mix(in oklch, var(--accent-2) 86%, white);
  stroke-width: 1.1;
  opacity: 0.42;
}
/* outer pair — larger + more transparent */
.l-c, .l-d { transform: scale(1.34); }
.l-c path, .l-d path {
  stroke: var(--accent);
  stroke-width: 0.85;
  opacity: 0.18;
}
.l-a { animation: rlSpin 58s linear infinite; }
.l-b { animation: rlSpin 72s linear infinite reverse; }
.l-c { animation: rlSpinBig 96s linear infinite reverse; }
.l-d { animation: rlSpinBig 116s linear infinite; }

@keyframes rlSpin    { to { transform: rotate(360deg); } }
@keyframes rlSpinBig { to { transform: scale(1.34) rotate(360deg); } }
[data-motion="off"] .sh-loop { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .sh-loop { animation: none; }
}

/* legibility grade over the photos (top meta + bottom hint + left column) */
.sh-grade {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(90deg,  rgba(3,9,18,0.82) 0%, rgba(3,9,18,0.52) 30%, rgba(3,9,18,0.08) 58%, rgba(3,9,18,0) 76%),
    linear-gradient(180deg, rgba(3,9,18,0.60) 0%, rgba(3,9,18,0.06) 18%, rgba(3,9,18,0) 38%),
    linear-gradient(0deg,   rgba(3,9,18,0.74) 0%, rgba(3,9,18,0.10) 26%, rgba(3,9,18,0) 50%),
    radial-gradient(130% 100% at 38% 50%, transparent 48%, rgba(3,9,18,0.46) 100%);
}
.sh-grain {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- foreground content ---------- */
.sh-content {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  row-gap: clamp(20px, 3vh, 32px);
  padding: clamp(112px, 15vh, 150px) var(--gut) clamp(24px, 4vh, 40px);
  /* let drag-and-drop of a Higgsfield render reach the image-slot below;
     interactive bits below opt back in */
  pointer-events: none;
}
.sh-content button,
.sh-content a { pointer-events: auto; }

.sh-eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(0.62rem, 0.55rem + 0.25vw, 0.75rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-2);
  display: inline-flex;
  align-items: center;
  gap: 0.85em;
  will-change: transform, opacity;
}
.sh-eyebrow::before {
  content: "";
  width: 30px;
  height: 1px;
  background: var(--accent);
  opacity: 0.75;
}
.sh-eyebrow > span,
.sh-lede > span {
  display: block;
}

/* slogan + brief text + cta — floats in the middle row with air around it */
.sh-head {
  grid-row: 1;
  align-self: center;
  justify-self: start;
  max-width: min(60ch, 710px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(24px, 3.4vh, 40px);
}
.sh-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(24px, 3.4vh, 40px);
  margin-top: clamp(-38px, -3vh, -22px);
  margin-bottom: clamp(22px, 3vh, 38px);
}
.sh-lede {
  margin: 0;
  max-width: 46ch;
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.92rem + 0.5vw, 1.3rem);
  line-height: 1.55;
  color: var(--text-dim);
  text-shadow: 0 1px 18px rgba(3,9,18,0.6);
  text-wrap: pretty;
  will-change: transform, opacity;
}
.sh-head-cta {
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 40px);
  margin-top: clamp(8px, 1.2vh, 16px);
  flex-wrap: nowrap;
  width: max-content;
  will-change: transform, opacity;
}
.sh-cta-slot { width: max-content; }
.sh-offer-cta {
  gap: 14px;
  padding-right: 0.72em;
  white-space: nowrap;
}
.sh-offer-cta strong {
  display: inline-grid;
  place-items: center;
  min-width: 52px;
  min-height: 32px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--coral-deep);
  background: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* stats bar (company advantages) — bottom of the hero */
.sh-stats {
  grid-row: 2;
  margin: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(14px, 2.6vw, 46px);
  padding-top: clamp(24px, 3vw, 38px);
  border-top: 1px solid var(--line-strong);
  will-change: transform, opacity;
}
.sh-stat-col { min-width: 0; }
.sh-num {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: clamp(1.55rem, 0.95rem + 2.2vw, 2.6rem);
  line-height: 1;
  color: #fff;
  letter-spacing: -0.01em;
}
.sh-num.accent-text { color: #fff; }
.sh-num .stars { font-size: 0.42em; color: var(--coral); letter-spacing: 2px; vertical-align: middle; margin-left: 0.2em; }
.sh-lbl {
  margin: 12px 0 0;
  font-family: var(--font-mono);
  font-size: clamp(0.6rem, 0.5rem + 0.3vw, 0.72rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text-mute) 55%, var(--text) 45%);
  text-wrap: balance;
}

/* title */
.sh-title-wrap {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}
.sh-title {
  margin: 0;
  text-align: left;
  color: var(--text);
  text-shadow: 0 2px 34px rgba(3,9,18,0.55), 0 1px 8px rgba(3,9,18,0.45);
  will-change: transform, opacity;
  transform-origin: 0% 50%;
}
.sh-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  column-gap: 0.3em;
}
.sh-word { display: inline-flex; }
.ltr {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  line-height: 0.98;
  will-change: transform, opacity;
  backface-visibility: hidden;
}
.sh-line1 .ltr {
  font-size: clamp(2.6rem, 1.3rem + 6.4vw, 5.6rem);
  letter-spacing: -0.02em;
}
.sh-title--studio .sh-line + .sh-line {
  margin-top: 0.06em;
}
.sh-title--studio .ltr {
  font-size: clamp(2.7rem, 1.85rem + 2.8vw, 4.55rem);
  font-weight: 600;
}
.sh-line2 {
  margin-top: 0.16em;
}
.sh-line2 .ltr {
  font-size: clamp(1.35rem, 0.85rem + 3vw, 2.9rem);
  font-style: italic;
  color: var(--accent-2);
  letter-spacing: -0.005em;
}

/* ---------- title variant: ASSEMBLE (one line, left → two lines, centered) ---------- */
.sh--assemble .sh-title {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.sh--assemble .sh-line {
  width: -moz-fit-content;
  width: fit-content;
}
.sh--assemble .sh-line2 { margin-top: 0.08em; }
/* transient measuring state: single left-aligned row, uniform small size */
.sh--measure-start .sh-title-wrap {
  justify-content: flex-start !important;
}
.sh--measure-start .sh-title {
  flex-direction: row !important;
  align-items: flex-end !important;
  justify-content: flex-start !important;
  column-gap: 0.32em;
}
.sh--measure-start .sh-line2 { margin-top: 0 !important; }
.sh--measure-start .sh-line1 .ltr,
.sh--measure-start .sh-line2 .ltr {
  font-size: clamp(1.05rem, 1rem + 2.2vw, 2rem) !important;
}

/* scroll hint — horizontal, sits beside the primary CTA */
.sh-scroll {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-2);
  transition: color .35s var(--ease);
  will-change: transform, opacity;
}
.sh-scroll:hover { color: #b8d9ff; }
.sh-scroll .sh-scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.sh-scroll .sh-scroll-line::after {
  content: "";
  position: absolute;
  left: 0; top: -50%;
  width: 100%; height: 50%;
  background: linear-gradient(to bottom, transparent, var(--coral));
  box-shadow: 0 0 8px 1px var(--coral-soft);
  animation: shScrollDrop 2.2s var(--ease) infinite;
}
@keyframes shScrollDrop {
  0%   { transform: translateY(-100%); opacity: 0; }
  35%  { opacity: 1; }
  100% { transform: translateY(300%); opacity: 0; }
}
[data-motion="off"] .sh-scroll .sh-scroll-line::after { animation: none; }

/* ============================================================
   STATIC / REDUCED-MOTION FALLBACK — show the first screen without
   scroll animation (applied by JS when motion is off or reduced).
   ============================================================ */
.sh.sh--static .sh-content,
.sh.sh--static .sh-eyebrow,
.sh.sh--static .sh-title,
.sh.sh--static .sh-lede,
.sh.sh--static .sh-head-cta,
.sh.sh--static .sh-yandex,
.sh.sh--static .sh-stats,
.sh.sh--static .sh-orbit {
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 999px) {
  .sh { min-height: 700px; background: #061a2e; }
  .sh-content {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 116px var(--gut) 22px;
  }
  .sh-head {
    width: 100%;
    max-width: none;
    flex: 1;
    justify-content: space-between;
    gap: 90px;
  }
  .sh-copy { width: 100%; gap: 17px; margin: 0; }
  .sh-eyebrow { font-weight: 700; letter-spacing: .17em; }
  .sh-lede { max-width: 100%; color: rgba(232, 241, 247, .88); }
  .sh-lede-line { display: block; white-space: nowrap; }
  .sh-yandex { position: static; width: 72px; margin-top: 1px; }
  .sh-title--studio .ltr { font-size: clamp(2.05rem, 9.55vw, 3.2rem); font-weight: 600; line-height: .92; }
  .sh-title--studio .sh-line + .sh-line { margin-top: 0; }
  /* Lower the portrait without scaling it; the hero crops the bottom edge. */
  .sh-bg1 { transform: translateY(clamp(40px, 7svh, 64px)); }
  .sh-bg1 img {
    inset: 0;
    height: 100%;
    object-position: 100% 50%;
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 48px);
    mask-image: linear-gradient(180deg, transparent, #000 48px);
  }
  .sh-grade {
    /* Top/bottom shadows are in the WebP; shade the copy from the left, as on desktop. */
    background:
      linear-gradient(90deg, rgba(3, 9, 18, .82) 0%, rgba(3, 9, 18, .52) 30%, rgba(3, 9, 18, .08) 58%, rgba(3, 9, 18, 0) 76%);
  }
  .sh-cta-slot { width: min(100%, 260px); }
  .sh-head-cta { width: 100%; flex-direction: column; align-items: stretch; gap: 10px; margin-top: 0; }
  .sh-offer-cta { width: 100%; height: 52px; justify-content: space-between; padding: 10px 10px 10px 22px; gap: 10px; font-size: .62rem; letter-spacing: .06em; }
  .sh-offer-cta > span { font-size: .72rem; font-weight: 700; }
  .sh-offer-cta strong { min-width: 46px; min-height: 30px; font-size: .74rem; }
  .sh-scroll { display: none; }
  .sh-stats { flex: none; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-top: 22px; padding-top: 18px; }
  .sh-stat-col { text-align: center; padding-inline: 8px; }
  .sh-stat-col + .sh-stat-col { border-left: 1px solid var(--line-strong); }
  .sh-stat-col:first-child { padding-left: 0; }
  .sh-stat-col:nth-child(3) { padding-right: 0; }
  .sh-stat-col--desktop { display: none; }
  .sh-num { font-size: clamp(1.35rem, 5.4vw, 1.95rem); white-space: nowrap; }
  .sh-lbl { margin-top: 7px; white-space: nowrap; }
}
@media (min-width: 621px) and (max-width: 999px) {
  .sh-copy { max-width: 520px; }
}
@media (max-width: 360px) {
  .sh-content { padding-top: 108px; padding-bottom: 18px; }
  .sh-copy { gap: 14px; }
  .sh-eyebrow { font-size: .58rem; letter-spacing: .12em; }
  .sh-eyebrow::before { width: 20px; }
  .sh-title--studio .ltr { font-size: 2.05rem; }
  .sh-head { gap: 70px; }
  .sh-stat-col { padding-inline: 5px; }
}
