/* ==========================================================================
   AMSG ITB — cinematic layer (video backgrounds, scroll scenes, 3D, transitions)
   ========================================================================== */

/* ---------- Hero ---------- */
.c-hero {
  position: relative;
  min-height: calc(100svh - var(--nav-h));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  background: #050507;
}
.c-hero-video {
  position: absolute;
  transform: translateZ(0);
  inset: -4%;
  width: 108%;
  height: 108%;
  object-fit: cover;
  z-index: -3;
  will-change: transform;
}
.c-hero-shade {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(5,5,7,.92) 0%, rgba(5,5,7,.6) 42%, rgba(5,5,7,.05) 78%),
    linear-gradient(180deg, rgba(5,5,7,.55) 0%, transparent 28%, transparent 60%, rgba(5,5,7,.95) 100%);
}
.c-hero-glow {
  position: absolute;
  left: -10%;
  top: 30%;
  width: 55vw;
  height: 55vw;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(225,6,0,.22), transparent 70%);
  pointer-events: none;
}
.c-hero-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 64px;
  padding-bottom: 32px;
}
.c-title {
  font-size: clamp(3rem, 8.4vw, 6.8rem);
  line-height: .95;
  margin: 22px 0 24px;
}
.c-title .line { display: block; overflow: hidden; padding-bottom: .06em; }
.c-title .line > span { display: inline-block; will-change: transform; }
.c-title i { font-style: normal; }
.c-hero .lead { max-width: 520px; }
.c-hero-bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.55));
}
.c-hero-bottom .container { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.c-scroll {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
}
.c-scroll i { display: block; width: 1px; height: 44px; background: linear-gradient(var(--red), transparent); animation: c-drip 1.8s ease-in-out infinite; transform-origin: top; }
@keyframes c-drip { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* initial states (JS reveals them; no-JS keeps everything visible) */
.js-cinema .c-in { opacity: 0; transform: translateY(24px); }
.js-cinema .c-title .line > span { transform: translateY(110%); }

/* ---------- Pinned process scene ---------- */
.c-process { position: relative; height: 420vh; background: #050507; }
.c-process-stage { position: sticky; top: 0; height: 100vh; overflow: hidden; }
.c-process-videos, .c-process-videos video { position: absolute; inset: 0; width: 100%; height: 100%; }
.c-process-videos video { object-fit: cover; opacity: 0; will-change: opacity, transform; }
.c-process-videos video:first-child { opacity: 1; }
.c-process-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5,5,7,.9) 0%, rgba(5,5,7,.5) 45%, rgba(5,5,7,.1) 100%),
    linear-gradient(180deg, #050507 0%, transparent 18%, transparent 80%, #050507 100%);
}
.c-process-ui {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}
.c-process-num { font-size: clamp(4rem, 12vw, 9rem); font-weight: 900; line-height: .9; color: transparent; -webkit-text-stroke: 2px rgba(255,255,255,.35); }
.c-process-num em { font-style: normal; font-size: .28em; margin-left: 12px; -webkit-text-stroke: 0; color: var(--muted); font-weight: 600; }
.c-process-texts { position: relative; min-height: 210px; max-width: 520px; }
.c-ptext { position: absolute; inset: 0 auto auto 0; opacity: 0; transform: translateY(30px); pointer-events: none; }
.c-ptext:first-child { opacity: 1; transform: none; pointer-events: auto; }
.c-ptext h2 { font-size: clamp(2rem, 4.6vw, 3.4rem); margin: 0 0 12px; }
.c-ptext p { color: #cfcfd6; font-size: 1.05rem; margin: 0 0 16px; }
.c-ptext .link-arrow { color: var(--text); }
.c-process-bar { position: absolute; left: var(--gutter, 24px); right: var(--gutter, 24px); bottom: 36px; height: 2px; background: rgba(255,255,255,.12); }
.c-process-bar i { display: block; height: 100%; width: 0; background: var(--red); box-shadow: 0 0 12px var(--red); }

/* ---------- 3D gears ---------- */
.c-gears { position: relative; height: 100vh; min-height: 640px; overflow: hidden; background: radial-gradient(70% 80% at 70% 50%, #1a0b0b 0%, #050507 70%); }
.c-gears canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.c-gears-text { position: relative; z-index: 2; height: 100%; display: flex; flex-direction: column; justify-content: center; pointer-events: none; }
.c-gears-text h2 { font-size: clamp(2.6rem, 6.4vw, 5rem); margin: 14px 0 16px; }
.c-gears-text .lead { max-width: 440px; }

/* ---------- Marquee ---------- */
.c-marquee { overflow: hidden; border-block: 1px solid var(--line); background: #08080b; padding: 20px 0; }
.c-marquee-track { display: flex; gap: 56px; width: max-content; animation: c-marquee 28s linear infinite; }
.c-marquee-track span { font-size: clamp(1.6rem, 4vw, 3rem); font-weight: 900; letter-spacing: 2px; color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.35); white-space: nowrap; }
.c-marquee-track span:nth-child(3n) { color: var(--red); -webkit-text-stroke: 0; }
@keyframes c-marquee { to { transform: translateX(-50%); } }

/* ---------- Page transition curtain (all pages) ---------- */
.c-curtain {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #050507;
  pointer-events: none;
  transform: translateY(100%);
}
.c-curtain::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--red); box-shadow: 0 0 20px var(--red); }
body.cinema .nav { background: rgba(5,5,7,.9); }

@media (max-width: 760px) {
  .c-hero-bottom .container { flex-direction: column; align-items: flex-start; }
  .c-scroll { display: none; }
  .c-process { height: 360vh; }
  .c-process-texts { min-height: 240px; }
  .c-gears-text { justify-content: flex-start; padding-top: 18vh; }
}
@media (prefers-reduced-motion: reduce) {
  .js-cinema .c-in { opacity: 1; transform: none; }
  .js-cinema .c-title .line > span { transform: none; }
  .c-marquee-track, .c-scroll i { animation: none; }
}

/* ---------- Manifesto: scroll-lit words ---------- */
.c-manifesto { padding-block: clamp(6rem, 16vw, 12rem); background: #050507; }
.c-manifesto-text { max-width: 22ch; font-family: var(--font-display); font-weight: 700; text-transform: uppercase; font-size: clamp(2.2rem, 6.2vw, 5.4rem); line-height: 1.02; letter-spacing: -.01em; margin: 24px 0 0; color: #fff; max-width: 20ch; }
.c-manifesto-text .w { opacity: .14; transition: opacity .25s linear, color .25s linear; }
.c-manifesto-text .w.on { opacity: 1; }
.c-manifesto-text .w.hot.on { color: var(--red); }

/* ---------- Horizontal projects ---------- */
.c-hscroll { position: relative; background: #07070a; }
.c-hscroll-stage { height: 100vh; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: clamp(1.5rem, 4vh, 3rem); }
.c-hscroll-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; }
.c-hscroll-track { display: flex; gap: 24px; padding-inline: max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter))); width: max-content; will-change: transform; }
.c-hscroll-track .tile { width: clamp(280px, 30vw, 420px); flex: none; opacity: 1; transform: none; }

/* ---------- Finale ---------- */
.c-finale { position: relative; min-height: 100vh; display: grid; align-items: center; overflow: hidden; isolation: isolate; background: #050507; }
.c-finale-video { position: absolute; inset: -6%; width: 112%; height: 112%; object-fit: cover; z-index: -2; will-change: transform; }
.c-finale-shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(5,5,7,.92), rgba(5,5,7,.45) 60%, rgba(5,5,7,.7)), linear-gradient(#050507, transparent 20%, transparent 75%, #050507); }
.c-finale-content { display: grid; gap: 22px; justify-items: start; }
.c-finale-title { font-size: var(--fs-display-xl); }

/* ---------- Progress rail ---------- */
.c-rail { position: fixed; right: clamp(10px, 1.6vw, 24px); top: 50%; transform: translateY(-50%); z-index: 90; display: grid; gap: 14px; opacity: 0; transition: opacity .4s; }
.c-rail.show { opacity: 1; }
.c-rail a { position: relative; display: block; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.55); background: transparent; transition: background .25s, transform .25s, border-color .25s; }
.c-rail a.on { background: var(--red); border-color: var(--red); transform: scale(1.35); }
.c-rail a span { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .2s; text-shadow: 0 1px 8px #000; }
.c-rail a:hover span, .c-rail a:focus-visible span { opacity: 1; }
.c-pct { position: fixed; left: clamp(12px, 1.6vw, 24px); bottom: 20px; z-index: 90; font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; color: rgba(255,255,255,.7); font-variant-numeric: tabular-nums; text-shadow: 0 1px 6px #000; }

@media (max-width: 760px) {
  .c-rail, .c-pct { display: none; }
  .c-hscroll-head { flex-direction: column; align-items: flex-start; }
  .c-hscroll-track .tile { width: 78vw; }
}
@media (prefers-reduced-motion: reduce) {
  .c-manifesto-text .w { opacity: 1; }
  .c-hscroll-stage { height: auto; padding-block: 64px; overflow: visible; }
  .c-hscroll-track { width: auto; flex-wrap: wrap; }
}

.c-hscroll-track .tile .media { height: clamp(140px, 30vh, 260px); aspect-ratio: auto; }
.c-hscroll-track .tile .tile-body { padding: var(--sp-4) var(--sp-5); }

/* ---------- Lite mode (auto, slow GPU): static 3D, no heavy overlays ---------- */
.lite .c-hero-glow, .lite .c-gears canvas { display: none; }
.lite .c-gears { background: radial-gradient(70% 80% at 70% 50%, #2a0d0d 0%, #050507 70%); }
.lite .c-hero-video { inset: 0; width: 100%; height: 100%; }
.lite .c-finale-video { inset: 0; width: 100%; height: 100%; }
.lite .c-marquee-track { animation: none; }
.lite .c-curtain { display: none; }

/* Lenis owns smooth scrolling: native CSS smoothing would fight it and cause stutter */
html.js-cinema, html.lenis, html.lenis body { scroll-behavior: auto !important; }
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; }

/* ==========================================================================
   INNER PAGES: cinematic hero, technology scenes, grids, progress bar
   ========================================================================== */
.c-phero { position: relative; min-height: clamp(420px, 68vh, 640px); display: flex; align-items: flex-end; overflow: hidden; isolation: isolate; background: #050507; }
.c-phero-video, .c-phero-img { position: absolute; inset: -6% 0; width: 100%; height: 112%; object-fit: cover; z-index: -3; will-change: transform; }
.c-phero-img { background-size: cover; background-position: center 30%; }
.c-phero-shade { position: absolute; inset: 0; z-index: -2; background: linear-gradient(90deg, rgba(5,5,7,.92) 0%, rgba(5,5,7,.55) 48%, rgba(5,5,7,.15) 100%), linear-gradient(180deg, rgba(5,5,7,.6) 0%, transparent 30%, transparent 55%, var(--bg) 100%); }
.c-phero-inner { width: 100%; padding-block: clamp(2.5rem, 8vh, 5rem) clamp(2rem, 6vh, 3.5rem); }
.c-phero .page-head { padding: 0; margin: 0; border: 0; background: none; }
.c-phero .page-head h1 { font-size: var(--fs-display-xl); line-height: .92; letter-spacing: -.015em; margin-top: 14px; }
.c-phero .page-head .lead { margin-top: 16px; }
.c-phero .page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.c-phero .line { display: block; overflow: hidden; padding-bottom: .06em; }
.c-phero .line > span { display: inline-block; will-change: transform; }
.c-phero .back-link { display: inline-flex; margin-bottom: 18px; }
.js-cinema .c-phero .kicker, .js-cinema .c-phero .lead, .js-cinema .c-phero .team-stats, .js-cinema .c-phero .steps, .js-cinema .c-phero .store-tools, .js-cinema .c-phero .tagline-right, .js-cinema .c-phero .pill, .js-cinema .c-phero .back-link { opacity: 0; transform: translateY(22px); }
.js-cinema .c-phero .line > span { transform: translateY(110%); }
.c-phero-scroll { position: absolute; right: clamp(1rem, 4vw, 3rem); bottom: 0; width: 1px; height: 64px; background: rgba(255,255,255,.18); overflow: hidden; }
.c-phero-scroll i { display: block; width: 100%; height: 100%; background: var(--red); animation: c-drip 1.8s ease-in-out infinite; transform-origin: top; }
.c-phero-project { min-height: clamp(460px, 74vh, 700px); }
.c-phero .steps { margin: 0; }

/* page scroll progress */
.c-progress { position: fixed; left: 0; top: 0; height: 3px; width: 100%; z-index: 120; background: transparent; pointer-events: none; }
.c-progress i { display: block; height: 100%; width: 100%; background: var(--red); box-shadow: 0 0 12px var(--red); transform: scaleX(0); transform-origin: left; }

/* technology: full-bleed video scenes */
.tech-list { margin: 0; }
.c-tech { position: relative; width: 100%; min-height: 100vh; display: grid; align-items: center; overflow: hidden; isolation: isolate; background: #050507; }
.c-tech-video { position: absolute; inset: -8% 0; width: 100%; height: 116%; object-fit: cover; z-index: -3; will-change: transform; }
.c-tech-shade { position: absolute; inset: 0; z-index: -2; background: linear-gradient(90deg, rgba(5,5,7,.94) 0%, rgba(5,5,7,.6) 50%, rgba(5,5,7,.1) 100%), linear-gradient(180deg, var(--bg) 0%, transparent 18%, transparent 82%, var(--bg) 100%); }
.c-tech-inner { position: relative; padding-block: clamp(5rem, 14vh, 8rem); }
.c-tech-num { position: absolute; right: var(--gutter); top: 50%; transform: translateY(-50%); font-family: var(--font-display); font-weight: 800; font-size: clamp(9rem, 28vw, 24rem); line-height: .8; color: transparent; -webkit-text-stroke: 2px rgba(255,255,255,.16); user-select: none; pointer-events: none; }
.c-tech-copy { position: relative; max-width: 34rem; display: grid; gap: 18px; justify-items: start; }
.c-tech-copy h2 { font-size: var(--fs-display-l); }
.c-tech-copy .tech-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; width: 100%; padding-block: 14px; border-block: 1px solid rgba(255,255,255,.14); }
.c-tech-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; color: var(--text-2); font-size: var(--fs-body-sm); }
.c-tech-list li { position: relative; padding-left: 18px; }
.c-tech-list li::before { content: ""; position: absolute; left: 0; top: .65em; width: 8px; height: 2px; background: var(--red); }
.js-cinema .c-tech-copy > * { opacity: 0; transform: translateY(36px); }

/* grids: stagger + tilt */
.tilt { transform-style: preserve-3d; will-change: transform; transition: box-shadow .3s; }
.tilt:hover { box-shadow: 0 24px 60px -20px rgba(225,6,0,.35); }
.chips { position: sticky; top: calc(var(--nav-h) + 8px); z-index: 40; padding-block: 10px; background: linear-gradient(var(--bg) 70%, transparent); }
.round { transition: transform .35s var(--ease-out), border-color .25s, background .25s; }
.round:hover { transform: translateX(8px); }
.tile .media img, .product .media img, .news-card .media img, .round .media img { transition: transform .7s var(--ease-out); }
.tile:hover .media img, .product:hover .media img, .news-card:hover .media img, .round:hover .media img { transform: scale(1.06); }

@media (max-width: 760px) {
  .c-phero { min-height: 460px; }
  .c-tech { min-height: 92vh; }
  .c-tech-num { font-size: 40vw; opacity: .7; }
  .c-phero-scroll { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .js-cinema .c-phero .kicker, .js-cinema .c-phero .lead, .js-cinema .c-phero .team-stats, .js-cinema .c-phero .steps, .js-cinema .c-phero .store-tools, .js-cinema .c-phero .tagline-right, .js-cinema .c-phero .pill, .js-cinema .c-phero .back-link, .js-cinema .c-tech-copy > * { opacity: 1; transform: none; }
  .js-cinema .c-phero .line > span { transform: none; }
}
.lite .c-phero-shade { background: linear-gradient(90deg, rgba(5,5,7,.92), rgba(5,5,7,.4)), linear-gradient(180deg, transparent 60%, var(--bg)); }
.lite .tilt { transform: none !important; }
