/* ===========================================================================
   FLNT AI — Motion layer styles (loaded only when the motion layer is active)
   Preloader sheet · page transitions · blur strip · hero thumbnails ·
   scroll line · pinned CTA grid · 3D hexagon · cursor tags · letter roll.
   html.fm       = motion active (set by the inline boot script)
   html.fm-preload = preloader plays on this page view
   html.fm-ready = motion.js has taken over (everything below is released)
   =========================================================================== */

:root {
  --fm-ease: cubic-bezier(0.76, 0, 0.24, 1);
  --fm-sheet: #08090b;
}

/* The legacy IntersectionObserver reveal is replaced by GSAP here (main.js drops the class). */
.fm .reveal { opacity: 1; transform: none; }
/* Never let a CSS transition fight a GSAP tween on the same property. */
.fm .fm-tw { transition: none !important; }

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------------------------------------------------------------------------
   0. Hold the first paint until motion.js is ready (4 s CSS fallback)
   --------------------------------------------------------------------------- */
/* Only the hero's text waits for motion.js; its background paints at first paint (LCP) */
.fm:not(.fm-ready) [data-fm-hero] > :not([aria-hidden="true"]):not(.hero__bg):not(.hero__scrim):not(.page-hero__bg):not(.page-hero__scrim) { opacity: 0; animation: fm-release 0s 4s forwards; }
.fm.fm-preload:not(.fm-ready) .site-nav { visibility: hidden; animation: fm-release 0s 4s forwards; }
@keyframes fm-release { to { opacity: 1; clip-path: none; visibility: visible; } }

/* ---------------------------------------------------------------------------
   1. Preloader / page-transition sheet
   --------------------------------------------------------------------------- */
.fm-pre {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  place-items: center;
  pointer-events: none;
}
.fm.fm-preload .fm-pre { display: grid; }
.fm.fm-preload:not(.fm-ready) .fm-pre { animation: fm-release-pre 0s 4.2s forwards; }
.fm-pre.is-active { display: grid !important; animation: none !important; pointer-events: auto; }
.fm-pre.is-done { display: none !important; }
@keyframes fm-release-pre { to { visibility: hidden; } }

.fm-pre__sheet {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 50% at 50% 100%, rgba(0, 240, 255, 0.07) 0%, rgba(5, 5, 6, 0) 70%),
    var(--fm-sheet);
  transform-origin: 50% 0%;
  will-change: transform;
}
/* Plasma hairline on the sheet's leading edge */
.fm-pre__line {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--gradient-plasma);
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.55);
  opacity: 0.9;
}
.fm-pre__logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  opacity: 0;
  visibility: hidden;
}
.fm-pre__logo img { width: 56px; height: 56px; object-fit: contain; }
.fm-pre__word {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #fff;
  line-height: 1;
}
.fm-pre__count {
  position: absolute;
  right: var(--space-margin-edge);
  bottom: 2.5rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  opacity: 0;
}
.no-js .fm-pre { display: none !important; }

/* ---------------------------------------------------------------------------
   2. Progressive blur strip (desktop, between hero and footer)
   --------------------------------------------------------------------------- */
.fm-blur {
  --blur: 0.75rem; --ratio: 2;
  display: none;
  position: fixed;
  inset: auto 0 0 0;
  z-index: 40;
  height: 14vh;
  pointer-events: none;
  overflow: clip;
  transform: rotate(180deg);
  contain: strict;
}
.fm-blur i { position: absolute; inset: 0; display: block; }
.fm-blur i:nth-child(1) { backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); mask: linear-gradient(#000 0%, #000 12%, transparent 40%); -webkit-mask: linear-gradient(#000 0%, #000 12%, transparent 40%); }
.fm-blur i:nth-child(2) { backdrop-filter: blur(calc(var(--blur) / var(--ratio))); -webkit-backdrop-filter: blur(calc(var(--blur) / var(--ratio))); mask: linear-gradient(transparent 5%, #000 30%, #000 42%, transparent 65%); -webkit-mask: linear-gradient(transparent 5%, #000 30%, #000 42%, transparent 65%); }
.fm-blur i:nth-child(3) { backdrop-filter: blur(calc(var(--blur) / (var(--ratio) * var(--ratio)))); -webkit-backdrop-filter: blur(calc(var(--blur) / (var(--ratio) * var(--ratio)))); mask: linear-gradient(transparent 35%, #000 62%, #000 100%); -webkit-mask: linear-gradient(transparent 35%, #000 62%, #000 100%); }
@media (min-width: 1024px) { .fm .fm-blur.is-on { display: block; } }
html.menu-open .fm-blur { display: none !important; }

/* ---------------------------------------------------------------------------
   3. Split text pieces
   --------------------------------------------------------------------------- */
.fm-c, .fm-w { display: inline-block; }
.fm-w { white-space: nowrap; }
/* Gradient words: each character paints its own slice of the plasma gradient */
.text-gradient .fm-c {
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.text-gradient.fm-split { background: none; -webkit-text-fill-color: initial; }

.screen-reader-text, .sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------------------
   5. Cursor tag ("Explore →") on cards, "Drag to spin" on the hexagon
   --------------------------------------------------------------------------- */
.fm-tag {
  position: absolute;
  left: 0; top: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 2.2rem;
  padding: 0 1rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 240, 255, 0.35);
  background: rgba(5, 5, 6, 0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--glow-cyan-soft);
  color: #fff;
  font-family: var(--font-display);
  font-size: var(--label-sm-size);
  letter-spacing: var(--label-sm-track);
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
}
.fm-tag__arrow { color: var(--electric-cyan); }
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) { .fm .fm-tag { display: inline-flex; } }

/* Service cards: whole card is a link; image wakes up on hover */
.service-card__link { position: absolute; inset: 0; z-index: 5; border-radius: inherit; }
.service-card__link:focus-visible { outline: 2px solid var(--electric-cyan); outline-offset: -2px; }
@media (hover: none), (pointer: coarse) { .fm [data-fm-card] { cursor: pointer; } }
.service-card__bg--dim { transition: opacity 0.6s ease, transform 0.9s var(--ease-soft, ease); }
.service-card:hover .service-card__bg--dim { opacity: 0.5; }

/* ---------------------------------------------------------------------------
   6. Manifesto — scroll line
   --------------------------------------------------------------------------- */
.fm-scroll { overflow: clip; padding-block: var(--space-stack-lg) var(--space-stack-md); }
.fm-scroll__track { overflow: clip; padding-block: 1.5rem; }
.fm-scroll__text {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
  margin: 0;
  padding-inline: var(--space-margin-edge);
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.045em;
  line-height: 0.9;
  font-size: clamp(3.5rem, 1rem + 10vw, 11.5rem);
  color: #fff;
}
.no-js .fm-scroll__text, html:not(.fm) .fm-scroll__text { white-space: normal; font-size: clamp(2.5rem, 1rem + 5vw, 6rem); }

/* ---------------------------------------------------------------------------
   7. Final CTA — pinned 3D image grid
   --------------------------------------------------------------------------- */
.fm-cta { position: relative; height: 250vh; height: 250svh; }
.fm-cta__pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.fm-cta__grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1vw;
  align-content: space-between;
  place-items: center;
  width: 100%;
  height: 100%;
  perspective: 1000px;
}
.fm-cta__img {
  width: 100%;
  height: 49.5vh;
  height: 49.5svh;
  transform-style: preserve-3d;
  overflow: hidden;
  border-radius: var(--radius-lg);
  outline: 1px solid var(--glass-border);
  outline-offset: -1px;
}
.fm-cta__img img { width: 100%; height: 100%; object-fit: cover; }
.fm-cta__overlay { position: absolute; inset: 0; background: radial-gradient(70% 70% at 50% 50%, rgba(5,5,6,0.78), rgba(5,5,6,0.92)); }
.fm-cta__block {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: min(2.5rem, 4vh);
  padding: var(--space-margin-edge);
  text-align: center;
}
.fm-cta__title { max-width: 18ch; font-size: clamp(2.75rem, 1rem + 5vw, 6rem); line-height: 0.98; }
.fm-cta__side { width: 100%; max-width: 34rem; display: grid; gap: 1.75rem; justify-items: center; }
@media (max-width: 767px) {
  .fm-cta__grid { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
  .fm-cta__img--extra { display: none; }
  .fm-cta__img { height: 49vh; }
}

/* ---------------------------------------------------------------------------
   8. Services Hub — six engines + 3D hexagon
   --------------------------------------------------------------------------- */
.fm-engines {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-stack-lg);
  align-items: center;
  padding-block: var(--space-stack-xl);
}
.fm-engines__copy { display: grid; gap: 1.25rem; }
.fm-engines__list { list-style: none; margin: 1rem 0 0; padding: 0; border-top: 1px solid var(--glass-border); }
.fm-engines__list li {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--glass-border);
  font-family: var(--font-display);
  font-size: var(--headline-sm-size);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
}
.fm-hex-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1800px;
  min-height: 30rem;
  touch-action: pan-y;
}
.fm-hex {
  --r: 12.99rem; /* apothem = width × 0.866 */
  position: relative;
  width: 15rem;
  height: 19rem;
  transform-style: preserve-3d;
  transform: rotateX(-6deg) rotateY(0deg);
  cursor: grab;
}
.fm-hex:active { cursor: grabbing; }
.fm-hex__face {
  position: absolute;
  inset: 0;
  margin: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  border-radius: var(--radius-lg);
  outline: 1px solid var(--glass-border);
  outline-offset: -1px;
  background: var(--surface-container-lowest);
}
.fm-hex__face img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.fm-hex__face figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 2.5rem 1rem 1rem;
  background: linear-gradient(to top, rgba(5,5,6,0.9), rgba(5,5,6,0));
  color: #fff;
}
.fm-hex__face:nth-child(1) { transform: rotateY(0deg)   translateZ(var(--r)); }
.fm-hex__face:nth-child(2) { transform: rotateY(60deg)  translateZ(var(--r)); }
.fm-hex__face:nth-child(3) { transform: rotateY(120deg) translateZ(var(--r)); }
.fm-hex__face:nth-child(4) { transform: rotateY(180deg) translateZ(var(--r)); }
.fm-hex__face:nth-child(5) { transform: rotateY(240deg) translateZ(var(--r)); }
.fm-hex__face:nth-child(6) { transform: rotateY(300deg) translateZ(var(--r)); }
@media (max-width: 1023px) {
  .fm-engines { grid-template-columns: 1fr; padding-block: var(--space-stack-lg); }
  .fm-hex { --r: 10.4rem; width: 12rem; height: 15rem; }
  .fm-hex-wrap { min-height: 24rem; }
}
@media (max-width: 479px) {
  .fm-hex { --r: 8.66rem; width: 10rem; height: 13rem; }
  .fm-hex-wrap { min-height: 20rem; }
}
/* Without motion the hexagon becomes a simple 3-column grid */
html:not(.fm) .fm-hex { transform: none; width: 100%; height: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
html:not(.fm) .fm-hex__face { position: relative; transform: none; aspect-ratio: 4 / 5; }
html:not(.fm) .fm-hex-wrap { perspective: none; min-height: 0; }

/* ---------------------------------------------------------------------------
   9. Footer slogan
   --------------------------------------------------------------------------- */
.footer-slogan {
  margin: 0 0 var(--space-stack-lg);
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.045em;
  line-height: 0.9;
  font-size: clamp(2.25rem, 0.5rem + 5.6vw, 7rem);
  color: #fff;
  text-align: center;
  overflow: hidden;
  padding-block: 0.06em;
}

/* ---------------------------------------------------------------------------
   10. Letter roll (buttons + nav)
   --------------------------------------------------------------------------- */
.fm .fm-roll { display: inline-flex; overflow: hidden; height: 1.35em; line-height: 1.35; vertical-align: middle; }
.fm .fm-l {
  display: inline-block;
  text-shadow: 0 1.35em 0 currentColor;
  transition: transform 0.45s var(--fm-ease);
  transition-delay: calc(var(--i, 0) * 16ms);
  white-space: pre;
  pointer-events: none; /* hit-testing stays on the label, so the roll never flickers */
}
.fm .site-nav__menu a { display: inline-block; }
@media (hover: hover) {
  .fm .btn:hover .fm-l,
  .fm .site-nav__menu a:hover .fm-l { transform: translateY(-1.35em); }
}
.fm .btn:focus-visible .fm-l,
.fm .site-nav__menu a:focus-visible .fm-l { transform: translateY(-1.35em); }
/* The underline from main.css sits under the rolled label */
.fm .site-nav__menu a::after { bottom: -2px; }

/* Metric bars fill on scroll */
.fm .metric-card__bar span { transform-origin: 0 50%; }

/* ---------------------------------------------------------------------------
   11. Reduced motion (unless forced from FLNT Control) + print
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html:not(.fm-force) .fm-pre, html:not(.fm-force) .fm-blur { display: none !important; }
}
@media print {
  .fm-pre, .fm-blur, .fm-tag, .fm-full, .fm-cta__overlay { display: none !important; }
  main { clip-path: none !important; }
  .fm-c, .fm-w, [style*="opacity"], [style*="filter"] { opacity: 1 !important; filter: none !important; transform: none !important; visibility: visible !important; }
}

/* ---------------------------------------------------------------------------
   12. The 3D FLNT mark (page loader + interactive hero logo)
   Three traced shards, each extruded from stacked SVG layers in CSS 3D.
   --------------------------------------------------------------------------- */
.fm-m3 {
  --h: 120px;
  --depth: 18px;
  position: relative;
  width: calc(var(--h) * 0.7363);
  height: var(--h);
  perspective: 900px;
  flex: none;
}
html:not(.fm) .fm-m3 { display: none; }
.fm-m3__tilt, .fm-m3__idle, .fm-m3__spin, .fm-m3__shard { position: absolute; inset: 0; transform-style: preserve-3d; }
.fm-m3__layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: translateZ(calc(var(--z) * var(--depth)));
}
.fm-m3__layer polygon { vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.fm-m3__layer--side polygon { fill: #0e1418; stroke: rgba(0, 240, 255, 0.16); stroke-width: 1.4; }
.fm-m3__layer--back polygon { fill: #050607; stroke: rgba(0, 240, 255, 0.55); stroke-width: 1.2; }
.fm-m3__layer--front polygon { fill: url(#fm-m3-face); stroke: rgba(150, 250, 255, 0.9); stroke-width: 1.4; }
.fm-m3__shard--1 .fm-m3__layer--front polygon { fill: url(#fm-m3-lit); stroke: #7ff8ff; }
.fm-m3__layer--glow { opacity: 0.3; filter: blur(7px); pointer-events: none; transform: translateZ(calc(var(--z) * var(--depth) - 1px)); }
.fm-m3__layer--glow polygon { fill: #00F0FF; stroke: none; }
/* Hero idle: float + sway run on the compositor; GSAP only handles tilt (pointer) and spin (click/drag) */
:is(.fm-m3--hero, .fm-m3--thanks) { animation: fm-m3-float 5.6s ease-in-out infinite alternate; }
:is(.fm-m3--hero, .fm-m3--thanks) .fm-m3__idle { animation: fm-m3-sway 6.8s ease-in-out infinite alternate; }
.fm-m3.is-resting, .fm-m3.is-resting .fm-m3__idle { animation-play-state: paused; }
@keyframes fm-m3-float { from { transform: translateY(4px); } to { transform: translateY(-8px); } }
@keyframes fm-m3-sway  { from { transform: rotateY(-13deg); } to { transform: rotateY(13deg); } }
@media (prefers-reduced-motion: reduce) { html:not(.fm-force) .fm-m3, html:not(.fm-force) .fm-m3 .fm-m3__idle { animation: none; } }

/* Before motion.js takes over, the mark turns on its own — the "loading" state */
.fm-m3.is-idle .fm-m3__spin { animation: fm-m3-spin 2.4s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
@keyframes fm-m3-spin { from { transform: rotateY(0deg); } to { transform: rotateY(360deg); } }

/* Loader layout: mark above the wordmark */
.fm-pre__logo--3d { flex-direction: column; gap: 22px; }
.fm-pre__logo--3d .fm-pre__word { font-size: 26px; letter-spacing: 0.32em; margin-right: -0.32em; font-weight: 700; color: var(--text-muted); }
.fm-pre__logo--3d::after {
  content: '';
  position: absolute;
  left: 50%; top: 118px;
  width: 140px; height: 26px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(0, 240, 255, 0.28), rgba(0, 240, 255, 0));
  filter: blur(4px);
  pointer-events: none;
}
/* Arriving from another page: the turning mark shows straight away while the page loads */
.fm-quick.fm-preload .fm-pre__logo--3d { opacity: 1; visibility: visible; }

/* Hero: the interactive mark */
.hero__mark-wrap { position: relative; z-index: 2; display: flex; justify-content: center; margin: 0 auto var(--space-stack-md); will-change: transform; } /* z-index: the docking mark travels over the headline */
.hero__mark-wrap .hero__mark { margin: 0; }
.fm .hero__mark-wrap--3d .hero__mark { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; } /* stays in the accessibility tree for its alt text */
.fm-m3--hero { --h: 9.5rem; --depth: 24px; cursor: grab; touch-action: pan-y; }
.fm-m3--hero:active { cursor: grabbing; }
.fm .hero__mark-wrap--3d::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -14px;
  width: 9rem; height: 1.6rem;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(0, 240, 255, 0.42), rgba(0, 240, 255, 0));
  opacity: var(--pool-o, 0.3);
  pointer-events: none;
}
.hero__pool { position: absolute; left: 50%; bottom: -14px; width: 9rem; height: 1.6rem; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(0, 240, 255, 0.42), rgba(0, 240, 255, 0)); opacity: 0; pointer-events: none; }
@media (max-width: 1024px) { .fm-m3--hero { --h: 6.5rem; --depth: 18px; } }
@media (max-width: 768px)  { .fm-m3--hero { --h: 5.5rem; --depth: 16px; } }


/* Manifesto: per-character drop stays on the compositor */
.fm-scroll .fm-c { will-change: transform; }

/* Edge-on, slightly thicker side strokes close the gaps between extrusion layers */
.fm-m3--hero .fm-m3__layer--side polygon { stroke-width: 2.2; }
