/* ════════════════════════════════════════════════════════════
   EOS — Cinematic Layer
   A. Pinned Hero 3D
   B. Sticky Reveal
   E. Color Wash boundaries
   ════════════════════════════════════════════════════════════ */

/* ────────────────────────────────────────────────────────────
   A. PINNED HERO 3D
   - 200vh tall outer; sticky inner pinned at 100vh
   - centered text + framed product image
   - scroll drives 3D rotation + scale
──────────────────────────────────────────────────────────── */

.hero-3d {
  position: relative;
  height: 200vh;
  background: #0a0a0c;
  color: var(--on-dark);
  overflow: clip;
}

.hero-3d-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 640px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: clamp(96px, 14vh, 160px) var(--margin) clamp(40px, 8vh, 80px);
  overflow: hidden;
}

.h3-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 28%, rgba(229,57,26,0.05) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 50% 80%, rgba(255,255,255,0.025) 0%, transparent 60%),
    linear-gradient(180deg, #0a0a0c 0%, #14141a 60%, #0a0a0c 100%);
  pointer-events: none;
}

.h3-text {
  position: relative; z-index: 3;
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: clamp(48px, 7vh, 140px);
  max-width: 760px;
  will-change: transform, opacity;
}

.h3-text .tile-eye { color: rgba(245,245,243,0.78); }
.h3-text .tile-title {
  color: var(--on-dark);
  letter-spacing: -0.03em;
  line-height: 1.04;
  margin-bottom: 14px;
}
.h3-text .tile-sub { color: rgba(245,245,243,0.78); margin-bottom: 28px; }
.h3-text .tile-link { color: var(--on-dark); }
.h3-text .tile-link.muted { color: rgba(245,245,243,0.65); }

.h3-product {
  position: relative; z-index: 2;
  width: min(80vw, 980px);
  perspective: 1800px;
  perspective-origin: 50% 30%;
  will-change: transform;
}

.h3-product-inner {
  width: 85%;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  background-color: #15151a;
  transform-style: preserve-3d;
  will-change: transform;
  position: relative;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,0.5);
  margin: 0 auto;
}

.h3-product-inner::after {
  /* subtle highlight rim */
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, transparent 35%, transparent 65%, rgba(0,0,0,0.18) 100%);
  pointer-events: none;
}

/* tiny scroll indicator at bottom */
.h3-scroll {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 4;
  display: flex; align-items: center; gap: 10px;
  font-family: var(--t-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(245,245,243,0.5);
  pointer-events: none;
}
.h3-scroll .bar {
  width: 32px; height: 1px;
  background: rgba(245,245,243,0.35);
  position: relative; overflow: hidden;
}
.h3-scroll .bar::after {
  content: ''; position: absolute; left: -50%; top: 0; bottom: 0; width: 50%;
  background: var(--on-dark);
  animation: h3-cue 2.2s cubic-bezier(0.22,1,0.36,1) infinite;
}
@keyframes h3-cue {
  0% { left: -50%; }
  100% { left: 100%; }
}

/* ────────────────────────────────────────────────────────────
   B. STICKY REVEAL
   - 3 text panels crossfade as scroll progresses
   - product image stays centered, subtly scales
──────────────────────────────────────────────────────────── */

.sticky-reveal {
  position: relative;
  /* no fixed height — GSAP pin manages scroll spacing for a clean exit */
  background: var(--bg-parchment);
}

.sr-stage {
  position: relative;
  height: 100vh;
  min-height: 580px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: clamp(56px, 8vh, 80px) var(--margin) clamp(40px, 6vh, 64px);
  overflow: hidden;
  background: var(--bg-parchment);
  z-index: 2;
  will-change: transform, opacity;
}

.sr-text-track {
  position: relative;
  width: 100%;
  max-width: 760px;
  height: clamp(160px, 20vh, 220px);
  display: flex; align-items: flex-end; justify-content: center;
  margin-bottom: clamp(20px, 3vh, 36px);
}

.sr-panel {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.22,1,0.36,1), transform 0.8s cubic-bezier(0.22,1,0.36,1);
  pointer-events: none;
}
.sr-panel.active {
  opacity: 1;
  /*transform: translateY(0);*/
  pointer-events: auto;
}

.sr-panel .tile-eye { color: var(--ink-dim); margin-bottom: 10px; }
.sr-panel .tile-title {
  font-family: var(--t-display);
  font-size: clamp(40px, 6vw, 80px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.04;
  margin-bottom: 14px;
  text-wrap: balance;
}
.sr-panel .tile-sub {
  font-size: clamp(18px, 2.2vw, 26px);
  color: var(--ink-dim);
  max-width: 30ch;
  text-wrap: balance;
}

.sr-product {
  position: relative;
  width: min(72vw, 920px);
  margin: 0 auto;
  will-change: transform;
  aspect-ratio: 16 / 9;
}
.sr-product-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: rgba(0,0,0,0.04);
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 0.75s cubic-bezier(0.22,1,0.36,1), transform 1.2s cubic-bezier(0.22,1,0.36,1);
  will-change: opacity, transform;
}
.sr-product-img.active {
  opacity: 1;
  transform: scale(1);
}

.sr-progress {
  position: absolute;
  bottom: clamp(28px, 6vh, 56px);
  left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px;
  z-index: 3;
}
.sr-progress .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(29,29,31,0.18);
  transition: background 0.4s ease, width 0.4s cubic-bezier(0.22,1,0.36,1);
}
.sr-progress .dot.on {
  background: var(--accent);
  width: 22px; border-radius: 999px;
}

/* ────────────────────────────────────────────────────────────
   SECTION BRIDGE — fade overlay at section bottom to preview
   the next section's color, masking the empty scroll-out tail
──────────────────────────────────────────────────────────── */

[data-bridge-next] {
  position: relative;
}

[data-bridge-next]::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 60vh;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent 0%,
    transparent 25%,
    var(--bridge-to, #1a1a1c) 100%
  );
  opacity: var(--bridge-opacity, 0);
  transition: opacity 0.05s linear;
}

[data-bridge-next="dark"]      { --bridge-to: #1a1a1c; }
[data-bridge-next="dark-2"]    { --bridge-to: #15151a; }
[data-bridge-next="ink"]       { --bridge-to: #15151a; }
[data-bridge-next="hero-3d"]   { --bridge-to: #0a0a0c; }
[data-bridge-next="parchment"] { --bridge-to: #f5f5f3; }

/* ────────────────────────────────────────────────────────────
   E. COLOR WASH — boundary gradient bleed
   adds a soft 120px fade at each section's top edge,
   from the previous section's color to transparent
──────────────────────────────────────────────────────────── */

.tile, .grid-section, .pullquote, .contact, .sticky-reveal, .hero-3d, footer.foot {
  position: relative;
}
.tile > *, .grid-section > *, .pullquote > *, .contact > *,
.sticky-reveal > *, .hero-3d > *, footer.foot > * {
  position: relative;
  z-index: 1;
}

[data-wash]::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: clamp(80px, 12vh, 160px);
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(180deg, var(--wash-from) 0%, var(--wash-from) 8%, transparent 100%);
  opacity: 0.85;
}

/* helper: data-wash="hex" sets the from-color */
[data-wash="dark"]    { --wash-from: #0a0a0c; }
[data-wash="dark-2"]  { --wash-from: #15151a; }
[data-wash="ink"]     { --wash-from: #1a1a1c; }
[data-wash="parchment"] { --wash-from: #f5f5f3; }
[data-wash="white"]   { --wash-from: #ffffff; }

/* skip wash inside sticky-reveal pinned content */
.sticky-reveal > * { z-index: 2; }
.sticky-reveal::before { z-index: 0; }

/* ────────────────────────────────────────────────────────────
   RESPONSIVE
──────────────────────────────────────────────────────────── */

@media (max-width: 980px) {
  .hero-3d { height: 180vh; }
  .h3-product { width: min(92vw, 720px); }
  .sticky-reveal { height: 360vh; }
  .sr-text-track { height: clamp(200px, 28vh, 280px); }
  .sr-product { width: min(88vw, 640px); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-3d { height: 100vh; }
  .sticky-reveal { height: auto; }
  .sr-stage { position: relative; height: auto; }
  .sr-text-track { height: auto; }
  .sr-panel { position: relative; opacity: 1; transform: none; }
  .h3-product { transform: none !important; }
  .frame-zoom { height: auto; }
  .callout { opacity: 1 !important; transform: none !important; }
}

/* ────────────────────────────────────────────────────────────
   G. FRAME ZOOM
   - small framed product image expands to full-bleed on scroll
   - then overlay text + callouts fade in over the expanded frame
──────────────────────────────────────────────────────────── */


/* ────────────────────────────────────────────────────────────
   M. MAGNETIC HOVER  (on cards + CTA links)
   pure structural prep — JS supplies the transforms
──────────────────────────────────────────────────────────── */

.pgrid { perspective: 1200px; }

.pcard {
  transform-style: preserve-3d;
  will-change: transform;
  transition: box-shadow 0.5s var(--ease);
}

.pcard:hover {
  z-index: 2;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.25);
}
.pcard.dark:hover { box-shadow: 0 24px 60px -20px rgba(0,0,0,0.6); }

.pcard .pc-img { will-change: transform; }

.tile-link { will-change: transform; }

/* ════════════════════════════════════════════════════════════
   K. COLOR MORPH
   - centered panel render
   - scroll cross-fades between N color variants
   - color name + code label rotates alongside
   ════════════════════════════════════════════════════════════ */

.color-morph {
  position: relative;
  /* no fixed height — GSAP pin manages scroll for slow, deliberate color changes */
  background: var(--bg-parchment);
  overflow: clip;
}

.cm-stage {
  position: relative;
  height: 100vh;
  min-height: 640px;
  display: flex;
  align-items: center; justify-content: center;
  padding: clamp(96px, 14vh, 140px) var(--margin) clamp(60px, 10vh, 100px);
  text-align: center;
  background: var(--bg-parchment);
  z-index: 2;
  will-change: transform, opacity;
}

.cm-eye {
  font-size: 14px;
  color: var(--ink-dim);
  margin-bottom: 12px;
}
.cm-title {
  font-family: var(--t-display);
  font-size: clamp(32px, 4.5vw, 56px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.06;
  text-wrap: balance;
  margin-left: 30px;
}

.cm-canvas {
  position: relative;
  width: min(60vw, 640px);
  aspect-ratio: 4 / 5;
  margin: 0 auto;
}

/* layered SVG panel — paths picked up by JS for color animation */
.cm-canvas svg { width: 100%; height: 100%; display: block; }

.cm-shadow {
  position: absolute;
  left: 50%; bottom: -8%;
  transform: translateX(-50%);
  width: 70%; height: 8%;
  background: radial-gradient(ellipse 50% 100% at 50% 50%, rgba(0,0,0,0.18) 0%, transparent 70%);
  filter: blur(8px);
  pointer-events: none;
}

.cm-meta {
  margin-top: clamp(36px, 6vh, 56px);
  display: flex; align-items: center; gap: 22px;
  justify-content: center;
  position: relative;
  height: 32px;
}

.cm-swatch-row {
  display: flex; gap: 8px;
}
.cm-swatch-row .cm-sw {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  transition: border-color 0.4s var(--ease), transform 0.4s var(--ease);
  background-clip: padding-box;
  cursor: pointer;
}
.cm-swatch-row .cm-sw.on {
  border-color: var(--ink);
  transform: scale(1.12);
}

.cm-label {
  position: relative;
  display: flex; flex-direction: column;
  text-align: left;
  min-width: 130px;
}
.cm-label .cm-name {
  font-family: var(--t-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
  transition: opacity 0.4s ease;
}
.cm-label .cm-code {
  font-family: var(--t-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
}

/* ════════════════════════════════════════════════════════════
   J. CROSS-FADE CAROUSEL
   - one stage, N images crossfade as scroll progresses
   - text panel matches active image
   ════════════════════════════════════════════════════════════ */

.xcarousel {
  position: relative;
  height: 320vh;
  background: var(--tile-dark);
  color: var(--on-dark);
  overflow: clip;
}

.xc-stage {
  position: sticky; top: 0;
  height: 100vh;
  min-height: 640px;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: clamp(40px, 6vw, 80px);
  align-items: center;
  padding: clamp(96px, 14vh, 140px) var(--margin) clamp(60px, 10vh, 100px);
}

.xc-text {
  position: relative;
  align-self: center;
  min-height: 220px;
}
.xc-panel {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s var(--ease), transform 0.8s var(--ease);
  pointer-events: none;
}
.xc-panel.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.xc-panel .xc-eye {
  font-size: 14px;
  color: rgba(245,245,243,0.65);
  margin-bottom: 12px;
}
.xc-panel .xc-title {
  font-family: var(--t-display);
  font-size: clamp(36px, 5vw, 55px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.06;
  color: #fff;
  margin-bottom: 14px;
}
.xc-panel .xc-sub {
  font-size: 17px;
  color: rgba(245,245,243,0.78);
  max-width: 38ch;
  line-height: 1.5;
}

.xc-media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 78vh;
  background: rgba(255,255,255,0.04);
  overflow: hidden;
}
.xc-frame {
  position: absolute; inset: 0;
  opacity: 0;
  will-change: opacity, transform;
}
.xc-frame.active { opacity: 1; }
.xc-frame .xc-img {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  background-color: #1a1a1c;
  transform: scale(1.05);
  transition: transform 1.6s var(--ease);
}
.xc-frame.active .xc-img { transform: scale(1.0); }

.xc-frame .xc-frame-num {
  position: absolute; bottom: 14px; left: 16px;
  font-family: var(--t-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: rgba(255,255,255,0.65);
}

.xc-progress {
  position: absolute;
  bottom: clamp(28px, 6vh, 56px);
  left: 50%; transform: translateX(-50%);
  z-index: 3;
  display: flex; gap: 8px;
}
.xc-progress .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(245,245,243,0.18);
  transition: background 0.4s ease, width 0.4s var(--ease);
}
.xc-progress .dot.on {
  background: var(--accent);
  width: 22px;
  border-radius: 999px;
}

@media (max-width: 980px) {
  .xc-stage { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 32px; }
  .xc-text { min-height: 140px; }
  .xc-media { max-height: 50vh; aspect-ratio: 16/10; }
  .xcarousel { height: 380vh; }
  .color-morph { height: 280vh; }
  .cm-canvas { width: 80vw; }
}

/* ════════════════════════════════════════════════════════════
   F. IMAGE SEQUENCE — PROTOTYPE (no real frames)
   demonstrates scroll-driven frame-stepping with procedurally
   transformed SVG panel — real version would use 24+ photos
   ════════════════════════════════════════════════════════════ */

.image-seq {
  position: relative;
  height: 240vh;
  background: #0e0e10;
  color: var(--on-dark);
  overflow: clip;
}

.is-stage {
  position: sticky; top: 0;
  height: 100vh;
  min-height: 640px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: clamp(96px, 14vh, 140px) var(--margin) clamp(60px, 10vh, 100px);
  text-align: center;
}

.is-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% 45%, rgba(229,57,26,0.04) 0%, transparent 65%),
    linear-gradient(180deg, #0a0a0c 0%, #14141a 60%, #0a0a0c 100%);
  pointer-events: none;
}

.is-prototype-badge {
  position: relative; z-index: 2;
  font-family: var(--t-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(245,245,243,0.55);
  padding: 6px 12px;
  border: 1px solid rgba(245,245,243,0.18);
  border-radius: 999px;
  margin-bottom: 28px;
  display: inline-flex; align-items: center; gap: 8px;
}
.is-prototype-badge::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.is-text {
  position: relative; z-index: 2;
  max-width: 640px;
  margin-bottom: clamp(32px, 5vh, 56px);
}
.is-text .is-eye {
  font-size: 14px;
  color: rgba(245,245,243,0.65);
  margin-bottom: 10px;
}
.is-text .is-title {
  font-family: var(--t-display);
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.06;
  color: #fff;
  margin-bottom: 12px;
}
.is-text .is-sub {
  font-size: 16px;
  color: rgba(245,245,243,0.72);
}

.is-canvas-wrap {
  position: relative;
  z-index: 2;
  width: min(70vw, 720px);
  aspect-ratio: 16 / 10;
  perspective: 1600px;
  perspective-origin: 50% 40%;
}

.is-panel {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transform: rotateY(0deg) rotateX(0deg);
  will-change: transform;
}

.is-panel-face {
  position: absolute; inset: 8% 12%;
  background: linear-gradient(135deg, #2c2c30 0%, #1d1d20 100%);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--t-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: rgba(255,255,255,0.45);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 -1px 0 rgba(0,0,0,0.3),
    0 30px 60px -20px rgba(0,0,0,0.6);
}

.is-panel-face::before {
  content: '';
  position: absolute; inset: 16% 22%;
  border: 1px solid rgba(255,255,255,0.06);
}

.is-panel-shadow {
  position: absolute;
  bottom: -2%; left: 12%; right: 12%;
  height: 4%;
  background: radial-gradient(ellipse 50% 100% at 50% 50%, rgba(0,0,0,0.55) 0%, transparent 80%);
  filter: blur(8px);
  z-index: -1;
}

.is-frame-meta {
  position: relative; z-index: 2;
  margin-top: 36px;
  display: flex; align-items: center; gap: 14px;
  font-family: var(--t-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(245,245,243,0.55);
}
.is-frame-meta .is-bar {
  width: 140px; height: 1px;
  background: rgba(245,245,243,0.15);
  position: relative;
}
.is-frame-meta .is-bar i {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  background: var(--on-dark);
}
.is-frame-meta .is-num { color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .color-morph, .xcarousel, .image-seq { height: auto; }
  .cm-stage, .xc-stage, .is-stage { position: relative; height: auto; }
  .xc-panel, .xc-frame { position: relative; opacity: 1; transform: none; }
  .is-panel { transform: none !important; }
}

