/* ============================================================
   VELOCITA GT — exploded-effect scrollytelling
   Dark premium product page. Animation is GSAP-driven (main.js);
   this file owns layout, type, and static states.
   Generated per project from the Exploded Studio template.
   ============================================================ */

:root {
  --bg: #0a0c10;          /* page base */
  --bg-raised: #12151c;   /* cards, panels */
  --ink: #f2f4f8;         /* primary text on dark */
  --ink-dim: #9aa3b2;     /* secondary text on dark */
  --hairline: #262b34;
  --accent: #C8102E;   /* per-project accent (validated hex by the builder) */

  /* Accent tints derived with color-mix so a single injected hex recolors
     every hover/backdrop consistently — no hand-tuned rgba() twins that
     would silently keep the old hue. */
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
  --accent-soft-2: color-mix(in srgb, var(--accent) 22%, transparent);
  --accent-glow: color-mix(in srgb, var(--accent) 45%, #ffffff);

  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Hide the scrollbar only for the smooth-scroll (Lenis) experience;
   reduced-motion and no-JS users keep the native scrollbar. */
html:not(.no-js):not(.reduced-motion) { scrollbar-width: none; }
html:not(.no-js):not(.reduced-motion)::-webkit-scrollbar { display: none; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, svg, canvas { display: block; max-width: 100%; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }

a { color: inherit; text-decoration: none; }

/* Anchor targets clear the 64px fixed topbar on native fragment jumps too */
section[id], footer[id], main[id] { scroll-margin-top: 72px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: fixed; top: 12px; left: 16px; z-index: 200;
  background: var(--accent); color: #04121f; font-weight: 600;
  padding: 10px 18px; border-radius: 999px;
  transform: translateY(-72px); transition: transform .2s;
}
.skip-link:focus { transform: translateY(0); }

.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
}

/* ============================================================
   Chrome — top bar + scroll progress
   ============================================================ */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 48px); height: 64px;
  background: transparent;
  transition: background .35s ease, backdrop-filter .35s ease, border-color .35s ease;
  border-bottom: 1px solid transparent;
}
.topbar--scrolled, html.no-js .topbar {
  background: rgba(10, 12, 16, 0.72);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom-color: var(--hairline);
}
.topbar__brand {
  font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: 0.12em;
  /* Long product names must never push the nav off screen */
  max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar__nav { display: flex; gap: clamp(14px, 2.5vw, 32px); }
.topbar__nav a { font-size: 14px; font-weight: 500; color: var(--ink-dim); transition: color .2s; }
.topbar__nav a:hover { color: var(--ink); }

.cta-pill {
  font-size: 14px; font-weight: 600; color: var(--ink);
  border: 1px solid #3a4250; border-radius: 999px; padding: 9px 20px;
  transition: border-color .25s, background .25s, transform .25s;
}
.cta-pill:hover { border-color: var(--accent); background: var(--accent-soft); }
.cta-pill--big { font-size: 16px; padding: 14px 32px; border-color: var(--accent); background: var(--accent-soft); }
.cta-pill--big:hover { background: var(--accent-soft-2); transform: translateY(-2px); }

.progress {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 110; pointer-events: none;
}
.progress__fill {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-glow));
  transform: scaleX(0); transform-origin: left center;
}

/* ============================================================
   S1 · Film — scroll-scrubbed image sequence
   ============================================================ */
.film { position: relative; height: 100vh; overflow: hidden; }

.film__poster,
.film__canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.film__poster { z-index: 1; }
.film__canvas { z-index: 2; opacity: 0; }        /* JS fades it in once frames are ready */

.film__shade {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(10,12,16,.55) 0%, rgba(10,12,16,0) 22%, rgba(10,12,16,0) 72%, rgba(10,12,16,.65) 100%);
}

.film__loader {
  position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%);
  width: 120px; height: 2px; border-radius: 2px; background: rgba(255,255,255,.14);
  z-index: 6; overflow: hidden;
}
.film__loader-bar {
  display: block; height: 100%; width: 100%; background: var(--accent);
  transform: scaleX(0); transform-origin: left center;
}

/* Copy beats over the film */
.beat { position: absolute; z-index: 5; max-width: 460px; }
.beat h2 { font-size: clamp(28px, 3.6vw, 52px); margin-bottom: 12px; text-shadow: 0 2px 24px rgba(5, 7, 10, 0.85); }
.beat p { color: #b6bfcc; font-size: clamp(15px, 1.2vw, 18px); text-shadow: 0 1px 14px rgba(5, 7, 10, 0.9); }

.beat--title {
  inset: 0; max-width: none; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
/* Center scrim so the title holds over the bright product body */
.beat--title::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(58% 54% at 50% 46%, rgba(8, 10, 14, 0.55), rgba(8, 10, 14, 0) 74%);
}
.beat--title > * { position: relative; }
.beat__display {
  font-size: clamp(44px, 9vw, 148px); line-height: 0.95; letter-spacing: 0.01em;
  max-width: 94vw; overflow-wrap: break-word;     /* any product name fits */
  background: linear-gradient(180deg, #ffffff 30%, #93a1b8 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.beat__sub { margin-top: 18px; color: var(--ink-dim); font-size: clamp(15px, 1.4vw, 20px); }

/* Vertical centering via flex (not transform) — GSAP owns transforms on these */
.beat--left, .beat--right {
  top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: center;
  padding: 0 36px;
}
.beat--left  { left: clamp(0px, 5vw, 80px); background: linear-gradient(90deg, rgba(8, 10, 14, 0.55), rgba(8, 10, 14, 0)); }
.beat--right {
  right: clamp(0px, 5vw, 80px); text-align: right; align-items: flex-end;
  background: linear-gradient(270deg, rgba(8, 10, 14, 0.55), rgba(8, 10, 14, 0));
}
.beat--end {
  inset: 0; max-width: none; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; text-align: center;
  padding-bottom: clamp(48px, 10vh, 120px);
}
.beat--end h2 { margin-bottom: 24px; }

/* Beats start transparent; GSAP scrubs opacity only, so the copy stays in
   the accessibility tree at all times. Pointer events are off while the
   beats float over the film; the end-card CTA re-enables its own. */
#beat1, #beat2, #beat3, #beatEnd { opacity: 0; }
.beat { pointer-events: none; }
.beat--end .cta-pill { pointer-events: auto; }
/* A keyboard user tabbing to the end-card CTA reveals the whole card */
.beat--end:focus-within { opacity: 1 !important; }
html.no-js #beat1, html.no-js #beat2, html.no-js #beat3, html.no-js #beatEnd { opacity: 1; position: relative; inset: auto; margin: 48px auto; }
/* No-JS: the film section becomes a static poster + flowed copy. The title
   is pinned to the poster's 100vh only, so it never overlaps flowed beats. */
html.no-js .film { height: auto; overflow: visible; }
html.no-js .film__canvas, html.no-js .film__loader { display: none; }
html.no-js .film__poster { position: relative; height: 100vh; }
html.no-js .beat--title { position: absolute; inset: 0 0 auto 0; height: 100vh; }
html.no-js .beat--left, html.no-js .beat--right, html.no-js .beat--end {
  align-items: flex-start; text-align: left; padding: 0 24px;
}

.scroll-cue {
  margin-top: 42px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--ink-dim); font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase;
}
.scroll-cue i {
  width: 1px; height: 44px; background: linear-gradient(180deg, var(--accent), transparent);
}

/* ============================================================
   S2 · Feature split rows
   ============================================================ */
.features { padding: clamp(72px, 12vh, 140px) clamp(20px, 6vw, 96px); display: grid; gap: clamp(48px, 8vh, 96px); }

.feature {
  display: grid; grid-template-columns: 1.15fr 1fr; align-items: center;
  gap: clamp(28px, 5vw, 72px); max-width: 1180px; margin: 0 auto;
}
.feature--flip .feature__media { order: 2; }
.feature--flip .feature__copy { order: 1; }

.feature__media { border-radius: 20px; overflow: hidden; background: var(--bg-raised); }
.feature__media img { width: 100%; height: auto; transition: transform .6s cubic-bezier(.19,1,.22,1); }
.feature:hover .feature__media img { transform: scale(1.04); }

.feature__copy h3 { font-size: clamp(26px, 3vw, 42px); margin-bottom: 14px; }
.feature__copy p:not(.eyebrow) { color: var(--ink-dim); max-width: 44ch; }

/* ============================================================
   S3 · Specs
   ============================================================ */
.specs { padding: clamp(72px, 12vh, 140px) clamp(20px, 6vw, 96px); }
.specs__head { text-align: center; margin-bottom: clamp(40px, 7vh, 72px); }
.specs__head h2 { font-size: clamp(30px, 4vw, 56px); }

.specs__grid {
  max-width: 1080px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.spec {
  background: var(--bg-raised); border: 1px solid var(--hairline); border-radius: 16px;
  padding: 26px 24px;
  transition: transform .4s cubic-bezier(.19,1,.22,1), border-color .4s;
}
.spec:hover { transform: translateY(-6px); border-color: #3a4250; }
.spec dt {
  font-size: 11px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 10px;
}
.spec dd { font-family: var(--font-display); font-size: clamp(17px, 1.5vw, 21px); font-weight: 600; line-height: 1.35; }

/* ============================================================
   Footer
   ============================================================ */
.footer {
  border-top: 1px solid var(--hairline);
  padding: clamp(56px, 10vh, 110px) clamp(20px, 6vw, 96px) 48px;
  text-align: center; overflow: hidden;
}
.footer__brand {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(48px, 11vw, 200px); line-height: 0.9; letter-spacing: 0.04em;
  color: transparent; -webkit-text-stroke: 1px #2c333f;
  overflow-wrap: break-word;
  user-select: none;
}
.footer__note { color: var(--ink-dim); font-size: 13.5px; max-width: 62ch; margin: 28px auto 0; }
.footer__links { display: flex; flex-wrap: wrap; gap: 10px 26px; justify-content: center; margin-top: 26px; }
.footer__links a { font-size: 13px; color: var(--ink-dim); transition: color .2s; }
.footer__links a:hover { color: var(--ink); }
.footer__meta { color: #5b6472; font-size: 12px; margin-top: 22px; }

/* ============================================================
   Scroll-reveal defaults (elements GSAP fades in once)
   ============================================================ */
.reveal { opacity: 0; }
html.no-js .reveal, html.reduced-motion .reveal { opacity: 1; }

/* ============================================================
   Responsive — ≤ 900px
   ============================================================ */
@media (max-width: 900px) {
  .topbar__nav { display: none; }

  .film__shade {
    background:
      linear-gradient(180deg, rgba(10,12,16,.55) 0%, rgba(10,12,16,0) 20%, rgba(10,12,16,0) 50%, rgba(10,12,16,.8) 100%);
  }
  .beat { max-width: min(78vw, 340px); }
  .beat--left  { top: auto; bottom: 10vh; padding-bottom: 24px; }
  .beat--right {
    top: auto; bottom: 10vh; padding-bottom: 24px; text-align: left; align-items: flex-start;
    left: clamp(0px, 5vw, 80px); right: auto;
    background: linear-gradient(90deg, rgba(8, 10, 14, 0.55), rgba(8, 10, 14, 0));
  }

  .feature, .feature--flip { grid-template-columns: 1fr; }
  .feature--flip .feature__media { order: 0; }
  .feature--flip .feature__copy { order: 1; }
  .specs__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .specs__grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Reduced motion — no pins, no scrub; everything readable
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .film { height: auto; min-height: 100vh; }
  .film__canvas, .film__loader { display: none; }
  .film__poster { position: relative; height: 100vh; }

  .beat, #beat1, #beat2, #beat3, #beatEnd { opacity: 1; visibility: visible; }
  .beat--left, .beat--right, .beat--end {
    position: relative; inset: auto; transform: none; text-align: left;
    max-width: 640px; margin: 48px auto; padding: 0 24px;
  }
  .scroll-cue { display: none; }

  /* Keep the title on the poster area only — the beats flow below it */
  .beat--title { position: absolute; inset: 0 0 auto 0; height: 100vh; }

  .reveal { opacity: 1; }
  .feature__media img, .spec { transition: none; }
}
