/* ============================================================
   SW AUTOCARE — premium layer "showroom: elevated"
   Additive motion + material layer over styles.css (home page).
   Built by NightShyft Studios.
   - Page-load intro curtain
   - Cinematic hero media (parallax + slow zoom + light sweep)
   - Magnetic signature buttons + custom cursor
   - Scroll-driven reveals (clip / blur / stagger)
   All motion is gated on .js and disabled under reduced-motion.
   ============================================================ */

:root {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------------------------------------------------------------
   1 · PAGE-LOAD INTRO CURTAIN
   A brief cinematic "boot" — brand strikes in, panels split away,
   revealing the hero. Runs once per page load.
--------------------------------------------------------------- */

/* no-JS: never show the curtain markup */
.intro { display: none; }

html.js .intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: var(--void);
  overflow: hidden;
}
html.js .intro.done { pointer-events: none; }

/* two panels that split vertically to reveal the page */
html.js .intro::before,
html.js .intro::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 50%;
  background: linear-gradient(180deg, #0a0a0e, var(--void));
  z-index: 1;
  transition: transform 0.9s var(--ease-out-expo);
}
html.js .intro::before { top: 0; border-bottom: 1px solid var(--line-soft); }
html.js .intro::after  { bottom: 0; border-top: 1px solid var(--line-soft); }
html.js .intro.done::before { transform: translateY(-100%); }
html.js .intro.done::after  { transform: translateY(100%); }

html.js .intro-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  transition: opacity 0.4s ease, transform 0.6s var(--ease-out-expo);
}
html.js .intro.done .intro-inner { opacity: 0; transform: scale(1.04); }

html.js .intro-mark {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: clamp(40px, 9vw, 120px);
  line-height: 0.9;
  letter-spacing: 0.02em;
  background: var(--chrome-grad);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: intro-shine 1.6s var(--ease-out-quint) both, intro-chrome 2.2s linear infinite;
}
html.js .intro-mark span { color: transparent; }

@keyframes intro-shine {
  0%   { opacity: 0; transform: translateY(28px) skewY(4deg); letter-spacing: 0.3em; filter: blur(8px); }
  60%  { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: none; letter-spacing: 0.02em; }
}
@keyframes intro-chrome { to { background-position: 200% 0; } }

/* sweeping scan line under the mark */
html.js .intro-line {
  width: clamp(180px, 30vw, 360px);
  height: 2px;
  margin: 22px auto 0;
  background: var(--teal-grad);
  transform: scaleX(0);
  transform-origin: left;
  animation: intro-line 1.1s var(--ease-out-expo) 0.25s both;
}
@keyframes intro-line { to { transform: scaleX(1); } }

html.js .intro-tag {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: clamp(10px, 1.4vw, 12px);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--gray-mid);
  opacity: 0;
  animation: intro-tag 0.8s ease 0.6s both;
}
@keyframes intro-tag { to { opacity: 1; } }

/* lock scroll while intro is up */
html.js.intro-active,
html.js.intro-active body { overflow: hidden; height: 100%; }

/* ---------------------------------------------------------------
   2 · CINEMATIC HERO MEDIA
   A photoreal car layer behind the existing hero text, with
   slow zoom, mouse + scroll parallax, scrim + light sweep.
--------------------------------------------------------------- */

.hero { isolation: isolate; }

.hero-media {
  position: absolute;
  inset: -6% -4%;            /* overscan so parallax never reveals an edge */
  z-index: 0;
  pointer-events: none;
  opacity: 1;                /* no-JS: show the car immediately */
}
.hero-media .hero-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 70% 50%;
  transform: scale(1.08) translate(0, 0);
  will-change: transform;
}

/* scrims: keep the left/bottom dark so headline + sub stay legible */
.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--void) 8%, rgba(5,5,7,0.72) 34%, rgba(5,5,7,0.12) 70%, rgba(5,5,7,0.45) 100%),
    linear-gradient(0deg, var(--void) 2%, transparent 38%),
    radial-gradient(120% 90% at 60% 36%, transparent 50%, rgba(0,0,0,0.6) 100%);
}

html.js .hero-media { opacity: 0; }
html.js .hero.lit .hero-media {
  opacity: 1;
  transition: opacity 1.2s ease;
}
html.js .hero.lit .hero-photo {
  animation: hero-zoom 22s ease-in-out infinite alternate;
}
@keyframes hero-zoom {
  from { transform: scale(1.08); }
  to   { transform: scale(1.16); }
}

/* mouse parallax — JS feeds --hx/--hy in px */
html.js .hero-photo {
  transform: scale(1.1) translate(var(--hx, 0px), var(--hy, 0px));
}

/* a slow teal "inspection light" sweep across the car */
.hero-sweep {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  mix-blend-mode: screen;
  opacity: 0.6;
}
.hero-sweep::before {
  content: "";
  position: absolute;
  top: -20%; bottom: -20%;
  left: -30%;
  width: 22%;
  background: linear-gradient(100deg, transparent, rgba(110,237,221,0.16), rgba(45,212,191,0.05), transparent);
  transform: skewX(-14deg);
  animation: hero-light 7.5s ease-in-out 1.6s infinite;
}
@keyframes hero-light {
  0%   { left: -30%; opacity: 0; }
  18%  { opacity: 1; }
  55%  { opacity: 1; }
  72%  { left: 120%; opacity: 0; }
  100% { left: 120%; opacity: 0; }
}

/* lift the existing LED strips above the photo */
.hero-leds { z-index: 1; }
.hero .container { z-index: 3 !important; }

/* hero text entrance is staggered via JS reveal; sub + ctas + proof rise */
html.js .hero-sub,
html.js .hero-ctas,
html.js .hero-proof,
html.js .hero-tag {
  opacity: 0;
  transform: translateY(20px);
}
html.js .hero.lit .hero-tag   { animation: hero-rise 0.8s var(--ease-out-expo) 0.15s both; }
html.js .hero.lit .hero-sub   { animation: hero-rise 0.8s var(--ease-out-expo) 0.85s both; }
html.js .hero.lit .hero-ctas  { animation: hero-rise 0.8s var(--ease-out-expo) 1.0s both; }
html.js .hero.lit .hero-proof { animation: hero-rise 0.8s var(--ease-out-expo) 1.15s both; }
@keyframes hero-rise { to { opacity: 1; transform: none; } }

/* hold the split-word headline until the curtain lifts, then play it
   (overrides the immediate play-on-load rule in styles.css) */
html.js .hero h1 .w > i { transform: translateY(110%); animation: none; }
html.js .hero.lit h1 .w > i {
  animation: word-up 0.75s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  animation-delay: calc(var(--wi) * 80ms + 250ms);
}

/* a live "scanning" status chip in the hero tag */
.hero-tag .live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(45,212,191,0.6);
  animation: live-ping 2s ease-out infinite;
  flex: none;
}
@keyframes live-ping {
  0%   { box-shadow: 0 0 0 0 rgba(45,212,191,0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(45,212,191,0); }
  100% { box-shadow: 0 0 0 0 rgba(45,212,191,0); }
}

/* scroll cue at the base of the hero */
.hero-scroll {
  position: absolute;
  left: 24px; bottom: 26px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gray-mid);
  opacity: 0;
}
html.js .hero.lit .hero-scroll { animation: hero-rise 0.8s var(--ease-out-expo) 1.4s both; }
.hero-scroll i {
  width: 26px; height: 40px;
  border: 1px solid var(--line);
  border-radius: 20px;
  position: relative;
  flex: none;
}
.hero-scroll i::after {
  content: "";
  position: absolute;
  left: 50%; top: 8px;
  width: 3px; height: 8px;
  border-radius: 2px;
  background: var(--teal);
  transform: translateX(-50%);
  animation: scroll-wheel 1.8s ease-in-out infinite;
}
@keyframes scroll-wheel {
  0%   { opacity: 0; transform: translate(-50%, 0); }
  35%  { opacity: 1; }
  70%  { opacity: 0; transform: translate(-50%, 14px); }
  100% { opacity: 0; }
}

/* ---------------------------------------------------------------
   3 · CUSTOM CURSOR (desktop, fine pointer only)
--------------------------------------------------------------- */

@media (pointer: fine) {
  html.js.has-cursor, html.js.has-cursor * { cursor: none !important; }

  .cursor-dot,
  .cursor-ring {
    position: fixed;
    top: 0; left: 0;
    z-index: 9000;
    pointer-events: none;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    will-change: transform;
  }
  .cursor-dot {
    width: 6px; height: 6px;
    background: var(--teal);
    transition: opacity 0.2s ease, width 0.2s ease, height 0.2s ease;
  }
  .cursor-ring {
    width: 38px; height: 38px;
    border: 1px solid rgba(45,212,191,0.55);
    transition: width 0.25s var(--ease-out-quint), height 0.25s var(--ease-out-quint),
                background 0.25s ease, border-color 0.25s ease, opacity 0.2s ease;
    display: grid;
    place-items: center;
  }
  .cursor-ring .cursor-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--teal-ink);
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.18s ease, transform 0.18s ease;
    white-space: nowrap;
  }
  /* over interactive elements: ring swells */
  html.has-cursor.cursor-hot .cursor-ring {
    width: 56px; height: 56px;
    background: rgba(45,212,191,0.12);
    border-color: var(--teal);
  }
  /* over labelled targets (e.g. garage / sliders): ring fills + shows label */
  html.has-cursor.cursor-label-on .cursor-ring {
    width: 64px; height: 64px;
    background: var(--teal);
    border-color: var(--teal);
  }
  html.has-cursor.cursor-label-on .cursor-label { opacity: 1; transform: scale(1); }
  html.has-cursor.cursor-down .cursor-ring { width: 30px; height: 30px; }
  .cursor-hidden { opacity: 0 !important; }
}

/* ---------------------------------------------------------------
   4 · MAGNETIC SIGNATURE BUTTONS
   Buttons translate toward the cursor (JS sets --mx/--my) and the
   solid CTA gains an animated chrome-edge + breathing glow.
--------------------------------------------------------------- */

.btn.magnetic {
  transform: translate(var(--mx, 0px), var(--my, 0px));
  transition: transform 0.25s var(--ease-out-quint), box-shadow 0.25s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn.magnetic .btn-label { display: inline-block; transition: transform 0.25s var(--ease-out-quint); }
.btn.magnetic:hover .btn-label { transform: translate(calc(var(--mx, 0px) * 0.25), calc(var(--my, 0px) * 0.2)); }

/* animated conic chrome ring on the primary CTA */
.btn-solid.magnetic {
  background-clip: padding-box;
}
.btn-solid.magnetic::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from 0deg, transparent, rgba(255,255,255,0.85), transparent 30%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  animation: chrome-spin 3.2s linear infinite;
  transition: opacity 0.3s ease;
  z-index: 1;
}
.btn-solid.magnetic:hover::before { opacity: 1; }
@keyframes chrome-spin { to { transform: rotate(1turn); } }

/* breathing teal glow on idle primary CTAs in the hero */
html.js .hero.lit .hero-ctas .btn-solid {
  animation: hero-rise 0.8s var(--ease-out-expo) 1.0s both, cta-breathe 3.4s ease-in-out 2s infinite;
}
@keyframes cta-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45,212,191,0); }
  50%      { box-shadow: 0 10px 40px rgba(45,212,191,0.22); }
}

/* ghost button: corner-bracket HUD draw-in on hover */
.btn-ghost.magnetic::before,
.btn-ghost.magnetic::after {
  content: "";
  position: absolute;
  width: 10px; height: 10px;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.25s var(--ease-out-quint);
  z-index: 2;
}
.btn-ghost.magnetic::before {
  top: 6px; left: 6px;
  border-top: 1px solid var(--teal);
  border-left: 1px solid var(--teal);
  transform: translate(4px, 4px);
}
.btn-ghost.magnetic::after {
  bottom: 6px; right: 6px;
  border-bottom: 1px solid var(--teal);
  border-right: 1px solid var(--teal);
  transform: translate(-4px, -4px);
}
.btn-ghost.magnetic:hover::before,
.btn-ghost.magnetic:hover::after { opacity: 1; transform: none; }

/* ---------------------------------------------------------------
   5 · UPGRADED SCROLL REVEALS
   Richer entrances than the base .reveal — clip wipe + de-blur,
   with optional per-item stagger via --d.
--------------------------------------------------------------- */

html.js [data-rv] {
  opacity: 0;
  transform: translateY(34px);
  filter: blur(6px);
  transition:
    opacity 0.9s var(--ease-out-expo) var(--d, 0s),
    transform 0.9s var(--ease-out-expo) var(--d, 0s),
    filter 0.9s ease var(--d, 0s);
  will-change: opacity, transform;
}
html.js [data-rv="left"]  { transform: translateX(-40px); }
html.js [data-rv="right"] { transform: translateX(40px); }
html.js [data-rv="scale"] { transform: scale(0.94); }
html.js [data-rv="clip"]  {
  clip-path: inset(0 0 100% 0);
  transform: none;
  filter: none;
  transition: clip-path 1s var(--ease-out-expo) var(--d, 0s), opacity 0.6s ease var(--d, 0s);
}
html.js [data-rv].in {
  opacity: 1;
  transform: none;
  filter: blur(0);
  clip-path: inset(0 0 0 0);
}

/* section headline word-rise (JS wraps words like the hero) */
html.js .headline .w { display: inline-block; overflow: hidden; vertical-align: bottom; }
html.js .headline .w > i {
  display: inline-block;
  transform: translateY(108%);
  transition: transform 0.8s var(--ease-out-expo) calc(var(--wi, 0) * 55ms);
}
html.js .headline.in .w > i { transform: none; }

/* kicker line draws across when its section enters */
html.js .kicker.in::before { animation: kicker-draw 0.7s var(--ease-out-expo) both; }
@keyframes kicker-draw {
  from { width: 0; opacity: 0; }
  to   { width: 30px; opacity: 1; }
}

/* ---------------------------------------------------------------
   6 · MARQUEE / SECTION POLISH
--------------------------------------------------------------- */

/* fade the marquee edges into the background */
.marquee::before,
.marquee::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 14%;
  z-index: 2;
  pointer-events: none;
}
.marquee::before { left: 0; background: linear-gradient(90deg, var(--void), transparent); }
.marquee::after  { right: 0; background: linear-gradient(270deg, var(--void), transparent); }

/* garage cards lift + chrome-edge on hover */
.garage-card {
  transition: transform 0.4s var(--ease-out-quint), border-color 0.3s ease, box-shadow 0.4s ease;
}
.garage-strip:not(.dragging) .garage-card:hover {
  transform: translateY(-6px);
  border-color: var(--teal-deep);
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}

/* trust numbers get a subtle chrome shimmer once revealed */
.trust-item .t-num span {
  background-size: 200% 100%;
  animation: chrome-drift 6s linear infinite;
}
@keyframes chrome-drift { to { background-position: 200% 0; } }

/* ---------------------------------------------------------------
   7 · REDUCED MOTION — collapse everything to a clean static state
--------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html.js .intro { display: none; }
  html.js.intro-active, html.js.intro-active body { overflow: auto; height: auto; }

  html.js .hero-media { opacity: 1; }
  html.js .hero-photo { animation: none !important; transform: scale(1.05) !important; }
  .hero-sweep, .hero-scroll { display: none; }
  html.js .hero-tag, html.js .hero-sub, html.js .hero-ctas, html.js .hero-proof {
    opacity: 1 !important; transform: none !important; animation: none !important;
  }
  html.js .hero.lit .hero-ctas .btn-solid { animation: none !important; }
  html.js .hero h1 .w > i,
  html.js .hero.lit h1 .w > i { animation: none !important; transform: none !important; }

  .intro-mark, .hero-tag .live-dot, .trust-item .t-num span { animation: none !important; }
  .btn.magnetic { transform: none !important; }
  .btn-solid.magnetic::before { display: none; }

  html.js [data-rv] { opacity: 1 !important; transform: none !important; filter: none !important; clip-path: none !important; }
  html.js .headline .w > i { transform: none !important; }

  .cursor-dot, .cursor-ring { display: none !important; }
  html.js.has-cursor, html.js.has-cursor * { cursor: auto !important; }
}

/* ---------------------------------------------------------------
   8 · RESPONSIVE — disable cursor + heavy parallax on small screens
--------------------------------------------------------------- */

@media (max-width: 760px) {
  .hero-scroll { display: none; }
  .hero-media { inset: -3% -2%; }
  .hero-media .hero-photo { object-position: 64% 50%; }
  .hero-media::after {
    background:
      linear-gradient(90deg, var(--void) 4%, rgba(5,5,7,0.6) 40%, rgba(5,5,7,0.5) 100%),
      linear-gradient(0deg, var(--void) 6%, transparent 52%);
  }
}
