/* ============================================================
   Glass + alive layer (2026-11-05)
   Liquid-glass surfaces over a slow ambient light field, plus small
   motion: card tilt + cursor spotlight, magnetic primary buttons, scroll
   progress, hero entrance, cards cascading in. Loaded after styles.css.
   Under prefers-reduced-motion everything is still glass, nothing moves.
   ============================================================ */

:root {
  --glass-fill: linear-gradient(160deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.018) 55%, rgba(255, 255, 255, 0.04));
  --glass-tint: rgba(26, 26, 28, 0.58);
  --glass-line: rgba(255, 255, 255, 0.1);
  --glass-blur: blur(22px) saturate(170%);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  --glass-drop: 0 30px 60px -32px rgba(0, 0, 0, 0.8);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}
@media (max-width: 640px) {
  :root { --glass-blur: blur(14px) saturate(160%); }
}

/* ---------- Ambient light field (sits behind everything) ---------- */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  will-change: transform;
}
body::before {
  width: 70vmax; height: 70vmax;
  left: -24vmax; top: -26vmax;
  background: radial-gradient(circle, rgba(255, 102, 0, 0.26), rgba(255, 102, 0, 0.08) 38%, rgba(255, 102, 0, 0) 66%);
  animation: fc-drift-a 36s ease-in-out infinite alternate;
}
body::after {
  width: 60vmax; height: 60vmax;
  right: -24vmax; top: 34vh;
  background: radial-gradient(circle, rgba(47, 107, 255, 0.2), rgba(47, 107, 255, 0.06) 40%, rgba(47, 107, 255, 0) 66%);
  animation: fc-drift-b 44s ease-in-out infinite alternate;
}
@keyframes fc-drift-a {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(14vw, 22vh, 0) scale(1.12); }
  100% { transform: translate3d(4vw, 58vh, 0) scale(0.94); }
}
@keyframes fc-drift-b {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-16vw, -18vh, 0) scale(0.92); }
  100% { transform: translate3d(-6vw, 30vh, 0) scale(1.1); }
}

/* ---------- Glass surfaces ---------- */
.card, .step, .rider-card, .hero__card, .final, .buybox {
  background: var(--glass-fill), var(--glass-tint);
  border-color: var(--glass-line);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-hi), var(--glass-drop);
}
.card, .step, .rider-card, .hero__card, .final { position: relative; isolation: isolate; }
.buybox { isolation: isolate; } /* stays sticky */

/* Light rim: brighter top-left edge, like light catching curved glass */
.card::after, .step::after, .rider-card::after, .hero__card::after, .final::after, .buybox::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.04) 32%, rgba(255, 255, 255, 0) 60%, rgba(255, 255, 255, 0.12));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
  z-index: 2;
}

/* Free competition keeps its orange glow, on glass */
.card--free {
  border-color: rgba(255, 102, 0, 0.5);
  box-shadow: var(--glass-hi), 0 0 0 1px rgba(255, 102, 0, 0.14), 0 30px 70px -30px rgba(255, 102, 0, 0.5);
}
.card--free::after { background: linear-gradient(140deg, rgba(255, 160, 90, 0.55), rgba(255, 102, 0, 0.08) 35%, rgba(255, 255, 255, 0) 60%, rgba(255, 102, 0, 0.25)); }

/* Nav pill: clearer glass */
.nav__pill {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02)), rgba(20, 20, 22, 0.55);
  border-color: rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 16px 40px -20px rgba(0, 0, 0, 0.8);
}

/* Category strip: hairlines on the light field instead of a grey band */
.cats-strip { background: rgba(255, 255, 255, 0.025); border-color: rgba(255, 255, 255, 0.07); }
.cats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.cats__k, .cats__v { font-size: 14px; line-height: 20px; }

/* Glassy secondary buttons and socials */
.btn--ghost { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.14); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.24); }
.socials a { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.12); }

/* Hero photo sits in a glass frame */
.hero__art { border-color: rgba(255, 255, 255, 0.12); box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.9), 0 0 0 6px rgba(255, 255, 255, 0.03); }

/* Primary button: soft orange glow, deeper on hover */
.btn--primary { box-shadow: 0 8px 24px -10px rgba(255, 102, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.btn--primary:hover { box-shadow: 0 12px 32px -10px rgba(255, 102, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.btn:active { transform: scale(0.97); }

/* ---------- Scroll progress ---------- */
.fc-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 300;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transform-origin: 0 50%;
  transform: scaleX(var(--progress, 0));
  pointer-events: none;
}

/* ---------- Motion (only when the visitor allows it) ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* Hero entrance: copy rises in line by line, photo settles */
  .hero .eyebrow, .hero h1, .hero__sub, .hero__cta, .hero__proof, .hero__art, .hero__card {
    animation: fc-rise 900ms var(--ease-out) both;
  }
  .hero h1 { animation-delay: 80ms; }
  .hero__sub { animation-delay: 180ms; }
  .hero__cta { animation-delay: 260ms; }
  .hero__proof { animation-delay: 340ms; }
  .hero__art { animation-name: fc-settle; animation-duration: 1400ms; animation-delay: 100ms; }
  .hero__card { animation-delay: 420ms; }

  /* Competition cards cascade in when the grid scrolls into view */
  /* .card.reveal beats main.js's `.js .reveal.in` transform/transition */
  .js .cards > .card.reveal {
    transition: opacity 700ms var(--ease-out) var(--d, 0ms), translate 700ms var(--ease-out) var(--d, 0ms),
      transform 450ms var(--ease-out), border-color 300ms var(--ease);
  }
  .js .cards:not(.is-in) > .card { opacity: 0; translate: 0 32px; }
  .cards > .card:nth-child(2) { --d: 70ms; }
  .cards > .card:nth-child(3) { --d: 140ms; }
  .cards > .card:nth-child(4) { --d: 210ms; }
  .cards > .card:nth-child(5) { --d: 280ms; }
  .cards > .card:nth-child(6) { --d: 350ms; }
  .cards > .card:nth-child(n+7) { --d: 420ms; }

  /* Magnetic primary buttons (JS sets --mx/--my; uses translate so :active scale still works) */
  .btn--primary {
    translate: var(--mx, 0px) var(--my, 0px);
    transition: transform 160ms var(--ease-out), translate 350ms var(--ease-out), background-color 300ms var(--ease),
      box-shadow 300ms var(--ease), border-color 300ms var(--ease), color 300ms var(--ease);
  }
}
@keyframes fc-rise {
  from { opacity: 0; transform: translateY(18px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes fc-settle {
  from { opacity: 0; transform: scale(1.04); filter: blur(8px); }
  to { opacity: 1; transform: none; filter: none; }
}

/* Tilt + spotlight: desktop pointers only, never on touch */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .js .cards > .card.reveal {
    transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px));
  }
  .js .cards > .card.reveal:hover { --lift: -6px; transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px)); }
  .js .cards > .card.reveal.is-tilting { transition: transform 120ms linear, border-color 300ms var(--ease), opacity 700ms var(--ease-out), translate 700ms var(--ease-out); }

  .card::before, .step::before, .rider-card::before, .final::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(380px circle at var(--spot-x, 50%) var(--spot-y, 50%), rgba(255, 122, 40, 0.14), rgba(255, 122, 40, 0) 70%);
    opacity: 0;
    transition: opacity 300ms var(--ease);
    pointer-events: none;
    z-index: -1; /* host has isolation: above its glass, below its content */
  }
  .is-spot::before { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  body::before, body::after { animation: none; }
  .fc-progress { display: none; }
}
