/* ============================================================
   FLOTARIUM — SCROLL HERO  (GSAP 3 + ScrollTrigger)
   Layered, scroll-driven cinematic 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-bg2 image-slot { object-position: 50% 50%; }

.sh-bg2 {
  z-index: 2;
  /* the expanding circle reveal — starts as a tiny disc below the frame */
  -webkit-clip-path: circle(30% at 50% 150%);
  clip-path: circle(30% at 50% 150%);
}
.sh-bg2 img { object-position: 50% 50%; }
.sh-bg1 img,
.sh-bg1 video { object-position: 100% 42%; }
.sh-bg2 .sh-ovr {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 38%, rgba(3,10,22,0.30), rgba(2,7,16,0.74) 92%);
  opacity: 0;
}

/* ---------- floating logo-circle motif (over background 1) ---------- */
.sh-orbit {
  position: absolute;
  inset: 0;
  z-index: 2;        /* above bg1, below bg2 reveal + 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: auto 1fr auto;
  row-gap: clamp(24px, 4.5vh, 52px);
  padding: calc(var(--gut) + 64px) var(--gut) clamp(34px, 5.5vh, 64px);
  /* 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;
}

/* slogan + brief text + cta — floats in the middle row with air around it */
.sh-head {
  align-self: center;
  justify-self: start;
  max-width: min(56ch, 660px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(24px, 3.4vh, 40px);
}
.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);
  flex-wrap: wrap;
  will-change: transform, opacity;
}

/* stats bar (company advantages) — bottom of the hero */
.sh-stats {
  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.7rem, 1rem + 2.6vw, 3rem);
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.01em;
}
.sh-num.accent-text { color: var(--accent); }
.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: var(--text-mute);
  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-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(--text-mute);
  transition: color .35s var(--ease);
  will-change: transform, opacity;
}
.sh-scroll:hover { color: var(--text); }
.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; }

/* ---------- final brand block (revealed on scroll) ---------- */
.sh-final {
  position: absolute;
  inset: 0;
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--gut) + 80px) var(--gut) clamp(40px, 8vh, 90px);
}
.sh-final-inner {
  width: min(92vw, 760px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.sh-logo {
  height: clamp(34px, 1.4rem + 1.8vw, 58px);
  width: auto;
  margin: 0 0 20px;
}
.sh-underline {
  display: block;
  width: clamp(120px, 20vw, 220px);
  height: 18px;
  margin: 0 0 26px;
  overflow: visible;
}
.sh-underline path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
.sh-final-text {
  margin: 0;
  max-width: 40ch;
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: clamp(1.3rem, 0.95rem + 1.5vw, 2.1rem);
  line-height: 1.32;
  letter-spacing: var(--display-tracking);
  color: var(--text);
  text-wrap: pretty;
}
.sh-final-cta {
  margin-top: clamp(64px, 11vh, 140px);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

/* ============================================================
   STATIC / REDUCED-MOTION FALLBACK — show the FINAL state, no scene
   (applied by JS when motion is off or reduced-motion is set)
   ============================================================ */
.sh.sh--static .sh-bg2 {
  -webkit-clip-path: circle(150% at 50% 50%);
  clip-path: circle(150% at 50% 50%);
}
.sh.sh--static .sh-bg2 .sh-ovr { opacity: 1; }
.sh.sh--static .sh-content { opacity: 0; pointer-events: none; }
.sh.sh--static .sh-orbit { opacity: 0; }
.sh.sh--static .sh-final { opacity: 1; pointer-events: auto; }
.sh.sh--static .sh-underline path { stroke-dashoffset: 0 !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 999px) {
  .sh-content { padding-top: calc(var(--gut) + 76px); }
  .sh-stats { gap: 12px clamp(14px, 3vw, 30px); }
  .sh-num { font-size: clamp(1.5rem, 6vw, 2.2rem); }
  .sh-line1 .ltr { font-size: clamp(2.4rem, 11vw, 4.2rem); }
  .sh-line2 .ltr { font-size: clamp(1.25rem, 5.4vw, 2rem); }
}
@media (max-width: 620px) {
  .sh-stats { grid-template-columns: repeat(2, 1fr); row-gap: 22px; }
}
