/* ============================================================
   LAMPWORK — Homepage Motion Layer v1
   Loaded only on index.html, on top of style.css
   ============================================================ */

/* ---------- global page feel ---------- */
html.has-motion { scroll-behavior: auto; } /* Lenis takes over */
body.home { overflow-x: clip; }

/* film grain */
.grain {
  position: fixed; inset: -50%; z-index: 60; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  opacity: .035; mix-blend-mode: overlay;
  animation: grainShift 0.9s steps(2) infinite;
}
@keyframes grainShift { 0%{transform:translate(0,0)} 25%{transform:translate(-2%,1.5%)} 50%{transform:translate(1.5%,-2%)} 75%{transform:translate(-1%, -1%)} 100%{transform:translate(2%,2%)} }

/* scroll progress */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 100%;
  z-index: 95; pointer-events: none;
  background: linear-gradient(90deg, var(--accent), #ff8a5c);
  transform-origin: 0 50%; transform: scaleX(0);
}

/* ---------- preloader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 200; background: #060607;
  display: none; align-items: center; justify-content: center; flex-direction: column;
  transition: transform .9s cubic-bezier(.76,0,.24,1);
}
html.js .loader { display: flex; }
.loader.done { transform: translateY(-101%); }
.loader-word { display: flex; gap: .08em; font-family: var(--font-brand); font-size: clamp(1.6rem, 5vw, 3rem); letter-spacing: .32em; color: var(--text); }
.loader-word span { opacity: 0; filter: blur(6px); transform: translateY(14px); animation: ignite .55s var(--ease) forwards; }
.loader-word span:nth-child(odd) { color: var(--accent); }
@keyframes ignite { to { opacity: 1; filter: blur(0); transform: translateY(0); } }
.loader-bar { width: min(280px, 50vw); height: 1px; background: rgba(255,255,255,.12); margin-top: 28px; overflow: hidden; }
.loader-bar i { display: block; height: 100%; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; transition: transform .25s linear; }
.loader-pct { margin-top: 14px; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .2em; color: var(--text-faint); }

/* ---------- custom cursor ---------- */
.cursor-dot, .cursor-ring { position: fixed; top: 0; left: 0; z-index: 300; pointer-events: none; border-radius: 50%; will-change: transform; }
.cursor-dot { width: 6px; height: 6px; background: var(--accent); margin: -3px 0 0 -3px; }
.cursor-ring { width: 36px; height: 36px; margin: -18px 0 0 -18px; border: 1px solid rgba(255,90,38,.5); transition: width .3s var(--ease), height .3s var(--ease), margin .3s var(--ease), border-color .3s, background .3s; }
.cursor-ring.is-hover { width: 64px; height: 64px; margin: -32px 0 0 -32px; border-color: rgba(255,90,38,.9); background: rgba(255,90,38,.08); }
@media (pointer: coarse) { .cursor-dot, .cursor-ring { display: none; } }

/* ---------- hero ---------- */
.hero-x {
  position: relative; min-height: 100svh;
  display: flex; align-items: center;
  padding: calc(var(--nav-h) + 60px) 0 80px;
  isolation: isolate; overflow: clip;
}
#ember-gl { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; display: block; }
.hero-x::after { /* bottom fade into page */
  content: ''; position: absolute; inset: auto 0 0 0; height: 28%;
  background: linear-gradient(to bottom, transparent, var(--bg) 92%); z-index: -1; pointer-events: none;
}
.hero-x.no-gl::before {
  content: ''; position: absolute; inset: -20%; z-index: -2;
  background:
    radial-gradient(50% 60% at 68% 30%, rgba(255,90,38,.16), transparent 62%),
    radial-gradient(42% 52% at 24% 76%, rgba(255,90,38,.08), transparent 65%);
  animation: heroDrift 16s ease-in-out infinite alternate;
}
@keyframes heroDrift { from { transform: translate3d(-2%, -1%, 0) scale(1); } to { transform: translate3d(2%, 2%, 0) scale(1.06); } }

.hero-x .display { font-size: clamp(3rem, 8.2vw, 7.2rem); line-height: 1.02; letter-spacing: -0.03em; }
.hl-line { display: block; overflow: hidden; padding-block: .04em; }
.hl-inner { display: inline-block; will-change: transform; }
.has-motion .hl-inner { transform: translateY(115%) rotate(2.5deg); }

.hero-kicker { display: inline-flex; align-items: center; gap: 10px; }
.has-motion [data-anim] { opacity: 0; }
.has-motion [data-anim="up"] { transform: translateY(34px); }
.has-motion [data-anim="fade"] { transform: none; }

/* hero data strip */
.data-strip {
  margin-top: clamp(36px, 5vw, 60px);
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
}
.data-cell { padding: 22px 26px 4px 0; border-right: 1px solid var(--border); margin-right: 26px; position: relative; }
.data-cell:last-child { border-right: 0; margin-right: 0; }
.data-cell::before { content:''; position:absolute; top:-1px; left:0; height:1px; width:0; background: var(--accent); transition: width 1.1s var(--ease); }
.data-cell.lit::before { width: calc(100% - 26px); }
.data-cell:last-child.lit::before { width: 100%; }
.data-val { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.25rem, 2.4vw, 1.9rem); letter-spacing: -0.02em; }
.data-lbl { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: var(--text-faint); margin-top: 6px; }
@media (max-width: 860px) { .data-strip { grid-template-columns: 1fr 1fr; } .data-cell { border-right: 0; margin-right: 0; padding-right: 0; } }

/* scroll cue */
.scroll-cue { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; z-index: 2; }
.scroll-cue .sc-label { font-family: var(--font-mono); font-size: .6rem; letter-spacing: .3em; color: var(--text-faint); }
.scroll-cue .sc-line { width: 1px; height: 54px; background: rgba(255,255,255,.14); overflow: hidden; position: relative; }
.scroll-cue .sc-line i { position: absolute; top: -40%; left: 0; width: 100%; height: 40%; background: var(--accent); animation: cueDrop 1.8s cubic-bezier(.76,0,.24,1) infinite; }
@keyframes cueDrop { 0% { top: -40%; } 60%, 100% { top: 110%; } }

/* ---------- giant marquee ---------- */
.marquee-giant { padding: clamp(30px, 4vw, 54px) 0; border-block: 1px solid var(--border); }
.marquee-giant .marquee-track { font-size: clamp(3rem, 9vw, 8rem); }
.marquee-giant .marquee-track span { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; color: transparent; -webkit-text-stroke: 1px rgba(244,244,242,.32); }
.marquee-giant .marquee-track span:nth-child(4n+1) { color: var(--text); -webkit-text-stroke: 0; }
.marquee-giant .marquee-track span:nth-child(8n+5) { color: var(--accent); -webkit-text-stroke: 0; }
.marquee-giant .marquee-inner { will-change: transform; }

/* ---------- filament band ---------- */
.band-x { position: relative; }
.band-clip { border-radius: var(--radius-lg); overflow: clip; border: 1px solid var(--border); position: relative; }
.band-clip img { width: 100%; aspect-ratio: 21/9; object-fit: cover; display: block; transform: scale(1.18); will-change: transform; }
@media (max-width: 700px) { .band-clip img { aspect-ratio: 4/3; } }

/* ---------- horizontal lifecycle ---------- */
.hscroll-wrap { position: relative; }
.hscroll { display: flex; will-change: transform; }
.hpanel {
  flex: 0 0 100vw; min-height: 100svh;
  display: flex; align-items: center; position: relative; overflow: clip;
  border-right: 1px solid var(--border);
}
.hpanel-inner { width: min(1160px, calc(100% - 48px)); margin: 0 auto; position: relative; z-index: 2; display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.hpanel .ghost-num {
  position: absolute; right: -2%; bottom: -6%; z-index: 1; line-height: .8;
  font-family: var(--font-display); font-weight: 700; font-size: clamp(16rem, 42vw, 34rem);
  color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.06); pointer-events: none; user-select: none;
}
.hpanel-tag { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .24em; color: var(--accent); margin-bottom: 20px; }
.hpanel h3 { font-family: var(--font-display); font-weight: 700; font-size: clamp(2.6rem, 6vw, 5rem); letter-spacing: -0.03em; line-height: 1; margin-bottom: 22px; }
.hpanel p { color: var(--text-dim); font-size: clamp(1rem, 1.4vw, 1.2rem); max-width: 52ch; }
.hpanel-visual { aspect-ratio: 1; border-radius: 50%; position: relative; max-width: 380px; justify-self: center; width: 100%; }
.hpanel-visual::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--border-strong); }
.hpanel-visual::after { content: ''; position: absolute; inset: 18%; border-radius: 50%; background: radial-gradient(circle at 38% 32%, rgba(255,90,38,.5), rgba(255,90,38,.06) 58%, transparent 75%); filter: blur(2px); }
.hpanel-visual svg { position: absolute; inset: 30%; width: 40%; height: 40%; stroke: var(--text); opacity: .9; }
.lifecycle-progress { position: absolute; bottom: 34px; left: 0; width: 100%; z-index: 5; pointer-events: none; }
.lifecycle-progress .lp-inner { width: min(1160px, calc(100% - 48px)); margin: 0 auto; }
.lifecycle-progress .lp-track { height: 1px; background: rgba(255,255,255,.12); position: relative; }
.lifecycle-progress .lp-fill { position: absolute; inset: 0; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; }
.lifecycle-progress .lp-labels { display: flex; justify-content: space-between; margin-top: 12px; font-family: var(--font-mono); font-size: .62rem; letter-spacing: .2em; color: var(--text-faint); }
@media (max-width: 899px) {
  .hscroll { display: block; }
  .hpanel { flex: none; min-height: 0; border-right: 0; border-bottom: 1px solid var(--border); padding: 64px 0; }
  .hpanel-inner { grid-template-columns: 1fr; gap: 28px; }
  .hpanel .ghost-num { font-size: 11rem; right: -4%; top: -4%; bottom: auto; }
  .hpanel-visual { max-width: 220px; }
  .lifecycle-progress { display: none; }
}

/* ---------- criteria upgrade ---------- */
.criteria-x .criteria-cell { position: relative; overflow: clip; }
.criteria-x .criteria-cell::after { content:''; position:absolute; inset:0; background: linear-gradient(120deg, transparent 30%, rgba(255,90,38,.09) 50%, transparent 70%); transform: translateX(-120%); transition: transform .9s var(--ease); pointer-events:none; }
.criteria-x .criteria-cell:hover::after { transform: translateX(120%); }

/* ---------- flagship ---------- */
.flagship-x .brand-tile { transform-style: preserve-3d; will-change: transform; }
.flagship-x .tilt-wrap { perspective: 900px; }

/* ---------- OS section ---------- */
.os-x { position: relative; }
.os-x .process { position: relative; }
.os-x .os-line { position: absolute; left: 0; top: 0; width: 1px; height: 100%; background: rgba(255,255,255,.09); }
.os-x .os-line i { display: block; width: 100%; height: 100%; background: var(--accent); transform: scaleY(0); transform-origin: 0 0; }
.os-x .process-row { padding-left: clamp(24px, 4vw, 56px); }

/* ---------- insights tilt ---------- */
.tilt-card { transform-style: preserve-3d; will-change: transform; }
.tilt-field { perspective: 1100px; }
.post-card .post-img { will-change: transform; }

/* ---------- CTA ---------- */
.cta-x { position: relative; overflow: clip; }
.cta-x::before { content: ''; position: absolute; inset: -40% -20%; z-index: 0; pointer-events: none;
  background: conic-gradient(from 0deg at 50% 50%, transparent 0deg, rgba(255,90,38,.07) 40deg, transparent 90deg, transparent 200deg, rgba(255,90,38,.05) 260deg, transparent 320deg);
  animation: ctaSpin 26s linear infinite; }
@keyframes ctaSpin { to { transform: rotate(360deg); } }
.cta-x > * { position: relative; z-index: 1; }
.btn-magnet { will-change: transform; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .grain, .scroll-cue .sc-line i, .cta-x::before { animation: none !important; }
  .loader { display: none !important; }
  .has-motion [data-anim], .has-motion .hl-inner { opacity: 1 !important; transform: none !important; }
  .band-clip img { transform: none; }
  .cursor-dot, .cursor-ring { display: none; }
}

/* hero staged elements start offset */
.has-motion [data-anim="kicker"],
.has-motion [data-anim="lead"],
.has-motion [data-anim="actions"],
.has-motion [data-anim="strip"] { transform: translateY(26px); }
.has-motion [data-anim="cue"] { transform: none; }

/* ============ v2 upgrades ============ */

/* alternating marquee directions */

/* data cells: hover lift + glow */
.data-cell { transition: transform .5s var(--ease); }
.data-cell:hover { transform: translateY(-4px); }
.data-cell:hover .data-val { color: var(--accent); transition: color .3s; }

/* CTA mouse spotlight */
.cta-x { --sx: 50%; --sy: 50%; }
.cta-x::after {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(320px 320px at var(--sx) var(--sy), rgba(255,90,38,.12), transparent 70%);
  opacity: 0; transition: opacity .4s;
}
.cta-x:hover::after { opacity: 1; }

/* flagship tile shine sweep */
.brand-tile { position: relative; overflow: hidden; }
.brand-tile::after {
  content: ''; position: absolute; inset: -30%; pointer-events: none;
  background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,.14) 50%, transparent 58%);
  transform: translateX(-130%) rotate(0.001deg);
  transition: transform 1.1s var(--ease);
}
.tilt-wrap:hover .brand-tile::after { transform: translateX(130%) rotate(0.001deg); }

/* nav smart hide */
.nav { transition: transform .45s var(--ease), background .3s, border-color .3s; }
.nav.nav-hidden { transform: translateY(-110%); }
@media (prefers-reduced-motion: reduce) { .nav.nav-hidden { transform: none; } }

/* footer curtain */
footer { overflow: hidden; }

/* ============ v3: scroll + header + scrollbar fixes ============ */
html.lenis, .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; }

.ticker-bar { transition: transform .45s var(--ease); }
.ticker-bar.nav-hidden { transform: translateY(-110px); }

html { scrollbar-width: thin; scrollbar-color: #38383b #0a0a0b; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: #0a0a0b; }
::-webkit-scrollbar-thumb { background: #2e2e31; border-radius: 6px; border: 2px solid #0a0a0b; }
::-webkit-scrollbar-thumb:hover { background: #ff5a26; }

.scroll-progress { height: 3px; box-shadow: 0 0 12px rgba(255,90,38,.55); }

/* ============ v3: giant wordmark outro ============ */
.giant-wordmark { padding: clamp(60px, 10vw, 140px) 0 clamp(30px, 5vw, 60px); overflow: clip; }
.gw-line { position: relative; text-align: center; line-height: .9; white-space: nowrap; }
.gw-ghost, .gw-fill {
  font-family: var(--font-brand); font-weight: 600;
  font-size: clamp(3.2rem, 11.5vw, 11rem); letter-spacing: .04em;
}
.gw-ghost { color: transparent; -webkit-text-stroke: 1px rgba(244,244,242,.18); }
.gw-fill {
  position: absolute; inset: 0; color: var(--accent);
  clip-path: inset(0 100% 0 0); will-change: clip-path;
  
}
.gw-sub { margin-top: 26px; text-align: center; font-family: var(--font-mono); font-size: .66rem; letter-spacing: .34em; color: var(--text-faint); }

/* band clip reveal start state */
.has-motion .band-clip { clip-path: inset(10% 7% round var(--radius-lg)); will-change: clip-path; }

/* ============ v4: marquee rows, wordmark centering, shimmer, pulse ============ */

/* two counter-rotating marquee rows — legible sizes, no collisions */
.marquee-giant { display: block; }
.marquee-giant .m-row { display: flex; overflow: clip; }
.marquee-giant .m-row + .m-row { margin-top: clamp(4px, 1vw, 14px); }
.marquee-giant .marquee-track { font-size: clamp(2.1rem, 5.6vw, 4.6rem); animation-duration: 38s; }
.marquee-giant .marquee-track span { -webkit-text-stroke: 1px rgba(244,244,242,.45); }
.marquee-giant .marquee-track span:nth-child(4n+1) { color: var(--text); -webkit-text-stroke: 0; }
.marquee-giant .m-rev .marquee-track { animation-direction: reverse; animation-duration: 46s; }
.marquee-giant .m-rev .marquee-track span:nth-child(4n+1) { color: transparent; -webkit-text-stroke: 1px rgba(244,244,242,.45); }
.marquee-giant .m-rev .marquee-track span:nth-child(4n+3) { color: var(--accent); -webkit-text-stroke: 0; }

/* wordmark: guaranteed centering via stack */
.gw-line { display: flex; justify-content: center; }
.gw-stack { position: relative; display: inline-block; white-space: nowrap; }
.gw-ghost, .gw-fill { font-size: clamp(2.6rem, 9.4vw, 9rem); letter-spacing: .03em; }
.gw-fill { position: absolute; inset: 0; }

/* serif accent words get a slow ember shimmer */
.gradient-text {
  background: linear-gradient(100deg, #f4f4f2 0%, #f4f4f2 40%, #ffb08a 47%, #ff5a26 52%, #ffb08a 57%, #f4f4f2 64%, #f4f4f2 100%);
  background-size: 280% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gtSweep 7.5s ease-in-out infinite;
}
@keyframes gtSweep { 0%, 45% { background-position: 125% 0; } 85%, 100% { background-position: -55% 0; } }

/* CTA primary button breathing glow */
.cta-x .btn-primary { animation: btnPulse 3.4s ease-in-out infinite; }
@keyframes btnPulse { 50% { box-shadow: 0 0 34px rgba(255,90,38,.4); } }

@media (prefers-reduced-motion: reduce) {
  .gradient-text { animation: none; -webkit-text-fill-color: var(--text); background: none; }
  .cta-x .btn-primary { animation: none; }
}
