/* ===========================================================
   Metcut Toolings — Special Tools flagship page
   Page-scoped: loaded only by products/special-tools.html.

   The blueprint design language itself (grid, mono labels, HUD, .bp
   draw-on, callout pins, stat readout, process rail, tilt cards) now
   lives in css/style.css and is shared site-wide. What remains here is
   only this page's scroll choreography — the cinematic opener and the
   pinned blueprint->steel sequence.
   =========================================================== */

.st-page {
  background: var(--ink);
  color: var(--text-hi);
}

/* film grain, flagship only */
.st-page::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

/* ===========================================================
   1. Opener
   =========================================================== */
.st-hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: radial-gradient(ellipse 90% 60% at 50% 0%, #10141c 0%, var(--ink) 62%);
  isolation: isolate;
}
/* pointer-follow spotlight */
.st-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    460px circle at var(--mx, 50%) var(--my, 40%),
    rgba(47, 107, 255, 0.13),
    transparent 70%
  );
  transition: opacity 0.6s var(--ease);
}
.st-hero .container {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 40px;
  align-items: center;
  padding-top: calc(140px + var(--banner-h));
  padding-bottom: 90px;
}

.st-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--blue-hi);
  margin-bottom: 26px;
}
.st-hero-eyebrow::before { content: ""; width: 40px; height: 1px; background: var(--blue-hi); }

.st-hero h1 {
  font-size: clamp(2.9rem, 6.4vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin-bottom: 28px;
}
.st-hero h1 .l2 { color: var(--blue-hi); display: block; }

/* word-by-word reveal */
.w { display: inline-block; overflow: hidden; vertical-align: bottom; }
.w > span {
  display: inline-block;
  transform: translateY(105%);
  transition: transform 0.95s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--i, 0) * 65ms);
}
.st-hero.in .w > span { transform: translateY(0); }

.st-hero-lead {
  max-width: 40ch;
  color: var(--text-lo);
  font-size: 1.08rem;
  margin-bottom: 36px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.9s var(--ease) 0.5s, transform 0.9s var(--ease) 0.5s;
}
.st-hero.in .st-hero-lead { opacity: 1; transform: none; }

.st-hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.9s var(--ease) 0.66s, transform 0.9s var(--ease) 0.66s;
}
.st-hero.in .st-hero-actions { opacity: 1; transform: none; }

/* hero tool stage: blueprint outline dissolving into the real tool */
.st-hero-stage {
  position: relative;
  aspect-ratio: 3 / 4;
  max-height: 74vh;
  justify-self: center;
  width: 100%;
}
.st-hero-stage .bp,
.st-hero-stage .st-hero-tool {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.st-hero-stage .bp {
  z-index: 2;
  opacity: 0;
  transition: opacity 1.2s var(--ease) 1.6s;
}
.st-hero.in .st-hero-stage .bp { opacity: 0.55; }

.st-hero-tool {
  z-index: 3;
  object-fit: contain;
  opacity: 0;
  transform: translateY(38px) scale(0.97);
  transition: opacity 1.4s var(--ease) 0.75s, transform 1.6s var(--ease) 0.75s;
  filter: drop-shadow(0 40px 70px rgba(0, 0, 0, 0.75));
}
.st-hero.in .st-hero-tool { opacity: 1; transform: none; }

.st-hero-stage .glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(47, 107, 255, 0.3), transparent 68%);
  filter: blur(28px);
  z-index: 1;
  opacity: 0;
  transition: opacity 1.6s var(--ease) 1s;
}
.st-hero.in .st-hero-stage .glow { opacity: 1; }

.st-scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.24em;
  color: rgba(160, 180, 215, 0.6);
  text-transform: uppercase;
}
.st-scroll-cue i {
  width: 1px;
  height: 46px;
  background: linear-gradient(var(--blue-hi), transparent);
  position: relative;
  overflow: hidden;
}
.st-scroll-cue i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--blue-hi);
  animation: cueRun 2.2s var(--ease) infinite;
}
@keyframes cueRun {
  0% { transform: translateY(-100%); }
  60%, 100% { transform: translateY(100%); }
}

/* ===========================================================
   2. Blueprint -> Steel (pinned)
   =========================================================== */
.st-track { position: relative; height: 230vh; background: var(--ink); }
.st-stage {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.st-stage .container {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 56px;
  align-items: center;
  width: 100%;
}

/* left rail: step copy that swaps with progress — all steps stack in one box */
.st-steps { position: relative; min-height: 300px; padding-bottom: 60px; }
.st-steps .st-step {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  pointer-events: none;
}
.st-steps .st-step.on { opacity: 1; transform: none; pointer-events: auto; }
.st-step .n {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  color: var(--blue-hi);
  margin-bottom: 16px;
  display: block;
}
.st-step h2 { font-size: clamp(1.8rem, 3.1vw, 2.7rem); margin-bottom: 16px; letter-spacing: -0.02em; }
.st-step p { color: var(--text-lo); max-width: 44ch; font-size: 1.02rem; }

/* progress ticks */
.st-progress { position: absolute; bottom: 0; left: 0; display: flex; gap: 8px; }
.st-progress b {
  width: 46px;
  height: 2px;
  background: rgba(255, 255, 255, 0.14);
  position: relative;
  overflow: hidden;
}
.st-progress b::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--blue-hi);
  transform: scaleX(var(--f, 0));
  transform-origin: left;
  transition: transform 0.35s linear;
}

/* right: the layered stage */
.st-morph {
  position: relative;
  aspect-ratio: 4 / 5;
  max-height: 78vh;
  width: 100%;
  justify-self: center;
}
.st-morph .frame {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(20, 26, 38, 0.6), rgba(10, 12, 15, 0.9));
  overflow: hidden;
}
/* corner registration marks */
.st-morph .frame::before,
.st-morph .frame::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 1px solid var(--bp-line-hi);
  opacity: 0.5;
}
.st-morph .frame::before { top: 12px; left: 12px; border-right: 0; border-bottom: 0; }
.st-morph .frame::after { bottom: 12px; right: 12px; border-left: 0; border-top: 0; }

/* replaced elements ignore bottom:0, so width/height must be explicit */
.st-morph .bp {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  opacity: calc(1 - var(--wipe, 0));
}
.st-morph .photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  object-fit: contain;
  padding: 6%;
  clip-path: inset(0 0 calc((1 - var(--wipe, 0)) * 100%) 0);
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.7));
}
/* the scan line that rides the wipe edge */
.st-morph .scan {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--wipe, 0) * 100%);
  height: 2px;
  z-index: 4;
  background: linear-gradient(90deg, transparent, var(--blue-hi), transparent);
  box-shadow: 0 0 22px 3px rgba(47, 107, 255, 0.55);
  opacity: var(--scan, 0);
}

/* dimension callouts that settle in at the end */
.st-dim {
  position: absolute;
  z-index: 5;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  color: rgba(210, 225, 250, 0.9);
  text-transform: uppercase;
  white-space: nowrap;
  opacity: var(--settle, 0);
  transition: opacity 0.4s linear;
}
.st-dim::before {
  content: "";
  position: absolute;
  top: 50%;
  width: 34px;
  height: 1px;
  background: var(--bp-line-hi);
}
.st-dim.l { text-align: right; }
.st-dim.l::before { right: -40px; }
.st-dim.r::before { left: -40px; }
.st-dim i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid var(--blue-hi);
  margin: 0 0 -1px 8px;
}

/* ===========================================================
   3. Sections / type cards
   =========================================================== */
.st-section { position: relative; padding: 120px 0; background: var(--ink); overflow: hidden; }
.st-section.alt { background: #0d1016; }

.st-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; position: relative; z-index: 2; }
.st-type { padding: 32px 28px 30px; }
.st-type .ico { width: 62px; height: 62px; margin-bottom: 22px; color: var(--blue-hi); }
.st-type .ico svg { width: 100%; height: 100%; overflow: visible; }
.st-type h3 { font-size: 1.05rem; margin-bottom: 8px; }
.st-type p { font-size: 0.88rem; color: var(--text-lo); }
.st-type .idx {
  position: absolute;
  top: 22px;
  right: 24px;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  color: rgba(140, 165, 210, 0.4);
}

/* ===========================================================
   4. Annotated showcase (layout; media + pins are shared)
   =========================================================== */
.st-shot {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
  padding: 96px 0;
}
.st-shot + .st-shot { border-top: 1px solid rgba(255, 255, 255, 0.06); }
.st-shot.flip .shot-media { order: 2; }
.st-shot .shot-media { max-height: 78vh; }

.st-shot-copy .job {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--blue-hi);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.st-shot-copy .job::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,0.1); }
.st-shot-copy h3 { font-size: clamp(1.5rem, 2.4vw, 2.1rem); letter-spacing: -0.02em; margin-bottom: 16px; }
.st-shot-copy p { color: var(--text-lo); margin-bottom: 20px; max-width: 46ch; }

/* ===========================================================
   5. Numbers wrapper
   =========================================================== */
.st-numbers-wrap { background: #0d1016; padding-bottom: 26px; }
.st-numbers-note { padding-top: 22px; font-family: var(--mono); font-size: 0.72rem; color: var(--text-lo); }

/* ===========================================================
   7. Close
   =========================================================== */
.st-close {
  position: relative;
  padding: 140px 0;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 60% at 50% 100%, rgba(47, 107, 255, 0.18), transparent 70%),
    var(--ink);
}
.st-close h2 {
  font-size: clamp(2.1rem, 4.6vw, 3.6rem);
  letter-spacing: -0.03em;
  max-width: 18ch;
  margin: 0 auto 20px;
  line-height: 1.04;
}
.st-close p { color: var(--text-lo); max-width: 52ch; margin: 0 auto 36px; font-size: 1.06rem; }
.st-close .acts { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ===========================================================
   Responsive
   =========================================================== */
@media (max-width: 1080px) {
  .st-hero .container { grid-template-columns: 1fr; gap: 48px; padding-top: calc(130px + var(--banner-h)); }
  .st-hero-stage { max-height: 52vh; order: -1; }
  .st-stage .container { grid-template-columns: 1fr; gap: 28px; }
  .st-morph { max-height: 40vh; }
  .st-steps { min-height: 250px; padding-bottom: 48px; }
  .st-types { grid-template-columns: repeat(2, 1fr); }
  .st-shot { grid-template-columns: 1fr; gap: 34px; padding: 72px 0; }
  .st-shot.flip .shot-media { order: 0; }
  .st-shot .shot-media { max-height: 52vh; }
}

@media (max-width: 620px) {
  .st-section { padding: 84px 0; }
  .st-types { grid-template-columns: 1fr; }
  .st-steps { min-height: 300px; }
  .st-morph { max-height: 34vh; }
  .st-track { height: 210vh; }
}

/* Must come last: a viewport too short to hold the pinned stage unpins it entirely
   rather than clipping the choreography. Wins over the width queries above. */
@media (max-height: 640px) {
  .st-track { height: auto; }
  .st-stage { position: static; height: auto; padding: 80px 0; }
  .st-stage .container { grid-template-columns: 1fr; gap: 34px; }
  .st-steps { min-height: 0; position: static; padding-bottom: 0; }
  .st-steps .st-step { position: relative; opacity: 1; transform: none; margin-bottom: 30px; }
  .st-progress { position: static; display: none; }
  .st-morph { max-height: 60vh; }
  .st-morph .bp { opacity: 0.25; }
  .st-morph .photo { clip-path: none; }
  .st-morph .scan { display: none; }
  .st-dim { opacity: 1; }
}

/* ===========================================================
   Reduced motion — full static fallback
   =========================================================== */
@media (prefers-reduced-motion: reduce) {
  .st-hero .w > span,
  .st-hero-lead,
  .st-hero-actions,
  .st-hero-tool,
  .st-hero-stage .bp,
  .st-hero-stage .glow {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .st-scroll-cue i::after { animation: none; }

  .st-track { height: auto; }
  .st-stage { position: static; height: auto; padding: 90px 0; }
  .st-stage .container { grid-template-columns: 1fr; gap: 40px; }
  .st-steps { min-height: 0; position: static; }
  .st-steps .st-step { position: relative; opacity: 1; transform: none; margin-bottom: 34px; }
  .st-morph { aspect-ratio: 4/5; max-height: 70vh; }
  .st-morph .bp { opacity: 0.25; }
  .st-morph .photo { clip-path: none; }
  .st-morph .scan { display: none; }
  .st-dim { opacity: 1; }
  .st-progress { display: none; }
}
