/* ============================================================
   MOTOSALON — design tokens
   Dark-first, motorsport luxury.
   Display: Saira Extra Condensed · Body: Manrope · Spec: IBM Plex Mono
   ============================================================ */

:root {
  --bg: #0a0b0d;
  --surface: #131519;
  --surface-2: #1c1f24;
  --line: rgba(255, 255, 255, 0.08);
  --text: #edeff2;
  --muted: #8b919c;
  --accent: #e8112d;
  --accent-hover: #ff2440;
  --glass: rgba(19, 21, 25, 0.72);
  --shadow-soft: 0 8px 40px rgba(0, 0, 0, 0.45);
  --radius: 1rem;
}

html.light {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eceef1;
  --line: rgba(10, 11, 13, 0.09);
  --text: #14161a;
  --muted: #5c626c;
  --glass: rgba(255, 255, 255, 0.78);
  --shadow-soft: 0 8px 32px rgba(20, 22, 26, 0.1);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.font-display {
  font-family: "Saira Extra Condensed", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.font-spec { font-family: "IBM Plex Mono", monospace; }

/* ---------- glass header ---------- */
.glass {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}

/* ---------- signature: spec plate ---------- */
.spec-plate {
  display: grid;
  grid-auto-flow: column;
  border-block: 1px solid var(--line);
}
.spec-plate > div { padding: .8rem 1rem; border-inline-start: 1px solid var(--line); }
.spec-plate > div:first-child { border-inline-start: 0; }
.spec-plate .v {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.35rem; font-weight: 600; line-height: 1;
}
.spec-plate .k {
  font-size: .65rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin-top: .35rem;
}

/* ---------- signature: speedline hover ---------- */
.speedline { position: relative; overflow: hidden; }
.speedline::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 2px;
  background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform .45s cubic-bezier(.77, 0, .18, 1);
}
.speedline:hover::after, .group:hover .speedline::after { transform: scaleX(1); }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform .35s ease, box-shadow .35s ease, border-color .35s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-soft);
  border-color: rgba(232, 17, 45, 0.35);
}

/* ---------- buttons ---------- */
.btn-accent {
  background: var(--accent); color: #fff;
  transition: background .25s ease, transform .2s ease, box-shadow .25s ease;
}
.btn-accent:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(232, 17, 45, 0.35);
}
.btn-ghost {
  border: 1px solid var(--line); color: var(--text);
  transition: border-color .25s ease, background .25s ease;
}
.btn-ghost:hover { border-color: var(--accent); }

/* ---------- badges ---------- */
.badge {
  font-size: .65rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; padding: .3rem .6rem; border-radius: .4rem;
}
.badge-new { background: var(--accent); color: #fff; }
.badge-limited { background: #b7791f; color: #fff; }
.badge-discount { background: #14161a; color: #fff; border: 1px solid var(--accent); }
html.light .badge-discount { background: #fff; color: var(--accent); }

/* ---------- skeleton loading ---------- */
.skeleton {
  background: linear-gradient(100deg, var(--surface) 40%, var(--surface-2) 50%, var(--surface) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- reveal on scroll (GSAP adds .is-visible) ---------- */
.reveal { opacity: 0; transform: translateY(28px); }
.reveal.is-visible { opacity: 1; transform: none; transition: opacity .7s ease, transform .7s cubic-bezier(.22,1,.36,1); }

/* ---------- page transition ---------- */
.page-fade { animation: pageIn .5s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- lightbox ---------- */
.lightbox { background: rgba(5,6,8,.92); backdrop-filter: blur(8px); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- focus ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- fixed-track grid layouts ----------
   `minmax(0, 1fr)` instead of a bare `1fr`/implicit auto track: the track
   contains the Swiper gallery (aspect-ratio slides inside a flex wrapper), and
   an unconstrained track's implicit `min-width: auto` inherits that content's
   intrinsic size, which is indeterminate here — classic CSS grid "blowout"
   that made the column resolve to a many-million-pixel width and pushed the
   image off-screen. This must be pinned at EVERY breakpoint, including the
   single-column mobile layout below `lg:` — an implicit default track has the
   exact same unconstrained behavior as a bare `1fr` one. */
.grid-product-detail { display: grid; gap: 2.5rem; grid-template-columns: minmax(0, 1fr); }
.grid-product-list { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) {
  .grid-product-detail { grid-template-columns: minmax(0, 1fr) 380px; }
  .grid-product-list { grid-template-columns: 260px minmax(0, 1fr); }
}

/* ---------- alpine: hide until initialized (prevents flash of modals/menus) ---------- */
[x-cloak] { display: none !important; }

/* ---------- scroll-driven hero (PNG-sequence logo reveal) ----------
   .hero-scroll-wrap is a tall track (set inline via --frames-vh) that defines
   how much scroll distance plays the sequence; .hero-scroll-pin sticks to the
   viewport for that whole distance via plain CSS position:sticky (no layout
   surprises from a JS-driven pin), while GSAP ScrollTrigger only measures
   scroll progress across the wrap and reports it back to the frame renderer. */
.hero-scroll-wrap {
  position: relative;
  height: calc(var(--frames-vh, 400) * 1vh);
  background: var(--bg);
}
.hero-scroll-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background: var(--bg);
}
.hero-scroll-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.hero-scroll-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  text-align: center;
  padding: 0 1.5rem 4.5rem;
  background: linear-gradient(0deg, rgba(5,6,8,.82) 0%, rgba(5,6,8,.15) 45%, transparent 75%);
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}
.hero-scroll-overlay.is-interactive { pointer-events: auto; }
.hero-scroll-overlay .buttons { pointer-events: auto; }
.hero-scroll-scrolldown {
  position: absolute;
  left: 50%;
  bottom: 1.75rem;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  font-size: .65rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 1;
  transition: opacity .3s ease;
  animation: hero-bounce 1.8s ease-in-out infinite;
}
/* A running CSS animation on `opacity` would override any inline/JS opacity
   value every tick, so the bounce only ever animates position — visibility
   is toggled separately via this class from hero-scroll.js. */
.hero-scroll-scrolldown.is-hidden { opacity: 0; }
@keyframes hero-bounce {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}
.hero-scroll-loading {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--bg);
  transition: opacity .5s ease;
}
.hero-scroll-loading.is-hidden { opacity: 0; pointer-events: none; }
.hero-scroll-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: hero-spin .8s linear infinite;
}
@keyframes hero-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .hero-scroll-scrolldown { animation: none; }
}
