/* ==========================================================
   Laps — marketing site
   Tokens mirror src/Laps/Shared/LapsColors.swift
   ========================================================== */

:root {
  /* Foundations */
  --bg: #000;
  --text-primary: #f5f5f0;
  --text-secondary: #a5a5a0;
  --text-tertiary: #6b6b65;

  /* Strip palette (sRGB fallback) */
  --strip-easy:  #3a3a38;
  --strip-200:   #ffa87a;
  --strip-400:   #ff5a28;
  --strip-600:   #ff2e80;
  --strip-800:   #f01088;
  --strip-1000:  #c828d0;
  --strip-1200:  #9c3fff;

  /* Functional */
  --heart-red:    #ff2a22;
  --warmup-green: #2ed096;
  --destructive:  #ff352a;

  /* Layout */
  --max-w: 1100px;
  --radius-sm: 6px;
  --radius-md: 14px;
  --radius-lg: 28px;
  --gutter: clamp(20px, 4vw, 56px);
}

/* P3 progressive enhancement on wide-gamut displays. */
@supports (color: color(display-p3 1 1 1)) {
  :root {
    --strip-200:   color(display-p3 1.0 0.658 0.478);
    --strip-400:   color(display-p3 1.0 0.353 0.157);
    --strip-600:   color(display-p3 1.0 0.180 0.502);
    --strip-800:   color(display-p3 0.941 0.063 0.533);
    --strip-1000:  color(display-p3 0.784 0.157 0.816);
    --strip-1200:  color(display-p3 0.612 0.247 1.0);
    --heart-red:   color(display-p3 1.0 0.165 0.133);
    --warmup-green:color(display-p3 0.180 0.816 0.588);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont,
               system-ui, "Segoe UI", sans-serif;
  font-feature-settings: "ss01", "tnum";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

strong { color: var(--text-primary); font-weight: 600; }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ==========================================================
   HERO
   ========================================================== */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(40px, 8vh, 96px) var(--gutter) clamp(60px, 10vh, 120px);
  overflow: hidden;
  isolation: isolate;
}

/* ---- Hero background: aerial track photo with slow flyover ---- */
.hero__glow {
  position: absolute;
  inset: -10%;
  z-index: -2;
  background-image: url('assets/track-aerial-4.jpg');
  background-size: cover;
  background-position: center 60%;
  background-repeat: no-repeat;
  transform-origin: 50% 50%;
  animation: flyover 38s ease-in-out infinite alternate;
  will-change: transform;
  filter: grayscale(1) contrast(1.05);
}

/* Dark + tonal overlay so the wordmark and text pop. Uses a near-black
   wash plus a faint pink/purple tint at the edges to keep the photo on-brand. */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 50% at 50% 50%, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0.78) 70%, rgba(0,0,0,0.92) 100%),
    radial-gradient(40% 35% at 18% 90%, rgba(255, 46, 128, 0.18), transparent 70%),
    radial-gradient(40% 35% at 85% 10%, rgba(156, 63, 255, 0.18), transparent 70%),
    linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.30) 35%, rgba(0,0,0,0.65) 100%);
  pointer-events: none;
}

@keyframes flyover {
  0%   { transform: translate3d(-1.5%, -1.5%, 0) scale(1.10); }
  50%  { transform: translate3d( 1.5%,  1.0%, 0) scale(1.16); }
  100% { transform: translate3d( 2.0%,  2.0%, 0) scale(1.12); }
}

.hero__inner {
  position: relative;
  text-align: center;
  width: 100%;
  max-width: 920px;
}

.logo-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: clamp(110px, 17vw, 220px);
  margin-bottom: clamp(8px, 1.5vh, 18px);
  opacity: 0;
  transform: translateY(8px);
  animation: fadeUp 0.9s 0.1s ease-out forwards;
}
.logo-slot img {
  height: 100%;
  width: auto;
  filter: drop-shadow(0 0 30px rgba(255, 46, 128, 0.28))
          drop-shadow(0 0 60px rgba(156, 63, 255, 0.18));
}

.hero__tagline {
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 32ch;
  margin: 0 auto clamp(16px, 2.4vh, 22px);
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp 1s 0.25s ease-out forwards;
}

.hero__tagline-accent {
  display: block;
  margin-top: 6px;
  color: var(--text-secondary);
  font-weight: 500;
}

.hero__platform {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  margin: 0 auto 24px;
  padding: 6px 14px;
  border: 1px solid #1f1f1c;
  border-radius: 999px;
  background: #0a0a0944;
  opacity: 0;
  animation: fadeUp 1s 0.6s ease-out forwards;
}

.app-store-link {
  display: block;
  width: fit-content;
  margin: 0 auto clamp(40px, 7vh, 72px);
  border-radius: 10px;
  transition: transform 0.25s ease, filter 0.25s ease;
  opacity: 0;
  transform: translateY(8px);
  animation: fadeUp 1s 0.75s ease-out forwards;
}
.app-store-link img {
  height: 50px;
  width: auto;
  display: block;
}
@media (max-width: 480px) {
  .app-store-link img { height: 44px; }
}
.app-store-link:hover  { transform: translateY(-2px); filter: brightness(1.08); }
.app-store-link:active { transform: translateY(0);    filter: brightness(0.95); }
.app-store-link:focus-visible {
  outline: 2px solid var(--strip-400);
  outline-offset: 4px;
}

.watch-glyph {
  width: 12px; height: 16px;
  border: 1.5px solid var(--text-secondary);
  border-radius: 3px;
  position: relative;
}
.watch-glyph::before,
.watch-glyph::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 4px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 1px;
  transform: translateX(-50%);
}
.watch-glyph::before { top: -3px; }
.watch-glyph::after  { bottom: -3px; }

.hero__caption {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-top: 22px;
  letter-spacing: 0.02em;
  opacity: 0;
  animation: fadeIn 1.2s 1.4s ease-out forwards;
}

.hero__scroll {
  position: absolute;
  bottom: 22px; left: 50%;
  transform: translateX(-50%);
  width: 22px; height: 36px;
  border: 1.5px solid var(--text-tertiary);
  border-radius: 14px;
  opacity: 0.65;
}
.hero__scroll span {
  position: absolute;
  top: 6px; left: 50%;
  width: 2px; height: 8px;
  background: var(--text-secondary);
  border-radius: 2px;
  transform: translateX(-50%);
  animation: scrollDot 1.8s ease-in-out infinite;
}
@keyframes scrollDot {
  0%, 100% { transform: translate(-50%, 0); opacity: 1; }
  60%      { transform: translate(-50%, 12px); opacity: 0; }
  61%      { transform: translate(-50%, 0);    opacity: 0; }
}

/* ==========================================================
   SESSION STRIP — shared
   ========================================================== */
.strip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
}

.strip--hero {
  margin: 0 auto;
  height: 22px;
  justify-content: center;
  flex-wrap: nowrap;
  filter: drop-shadow(0 0 18px rgba(255, 46, 128, 0.25));
}

.strip--mini { height: 4cqw; gap: 1cqw; margin: 2cqw 0; }

.strip--showcase {
  height: clamp(28px, 5vw, 44px);
  gap: 5px;
  width: 100%;
  justify-content: flex-start;
  flex-wrap: nowrap;
  filter: drop-shadow(0 0 24px rgba(255, 90, 40, 0.2));
}

.seg {
  display: inline-block;
  height: 100%;
  width: calc(var(--w, 1) * var(--unit, 28px));
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transform-origin: left center;
}

.strip--mini .seg     { --unit: 6cqw; border-radius: 1.5cqw; }
.strip--showcase .seg { --unit: clamp(18px, 4vw, 38px); border-radius: 7px; }

.seg--easy { background: var(--strip-easy); }
.seg--200  { background: var(--strip-200); }
.seg--400  { background: var(--strip-400); }
.seg--600  { background: var(--strip-600); }
.seg--800  { background: var(--strip-800); }
.seg--1000 { background: var(--strip-1000); }
.seg--1200 { background: var(--strip-1200); }

/* Hero strip stagger-in (segments start invisible, JS adds .is-built) */
.strip--hero .seg {
  opacity: 0;
  transform: scaleX(0.2);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(.2,.8,.2,1);
}
.strip--hero.is-built .seg { opacity: 1; transform: scaleX(1); }
.strip--hero.is-built .seg:nth-child(1) { transition-delay: 0.65s; }
.strip--hero.is-built .seg:nth-child(2) { transition-delay: 0.78s; }
.strip--hero.is-built .seg:nth-child(3) { transition-delay: 0.91s; }
.strip--hero.is-built .seg:nth-child(4) { transition-delay: 1.04s; }
.strip--hero.is-built .seg:nth-child(5) { transition-delay: 1.17s; }
.strip--hero.is-built .seg:nth-child(6) { transition-delay: 1.30s; }
.strip--hero.is-built .seg:nth-child(7) { transition-delay: 1.43s; }
.strip--hero.is-built .seg:nth-child(8) { transition-delay: 1.56s; }
.strip--hero.is-built .seg:nth-child(9) { transition-delay: 1.69s; }

/* ==========================================================
   SECTIONS — shared
   ========================================================== */
.eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--strip-400);
  margin: 0 0 14px;
  font-weight: 600;
}

section h2 {
  font-size: clamp(1.9rem, 4.4vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 700;
  margin: 0 0 32px;
  max-width: 22ch;
}

/* ==========================================================
   WHY LAPS
   ========================================================== */
.why {
  padding: clamp(80px, 14vh, 160px) 0;
  border-top: 1px solid #161614;
}

.why__body {
  display: grid;
  gap: 22px;
  max-width: 64ch;
  font-size: clamp(1rem, 1.4vw, 1.13rem);
  line-height: 1.6;
  color: var(--text-secondary);
}

.why__pivot {
  color: var(--text-primary);
  border-left: 3px solid var(--strip-400);
  padding-left: 18px;
  margin-top: 6px;
}

.why__pivot strong { color: var(--text-primary); font-weight: 600; }

/* ==========================================================
   FEATURES
   ========================================================== */
.features { padding: clamp(60px, 10vh, 120px) 0 clamp(80px, 14vh, 160px); }

.features__title { margin-bottom: clamp(48px, 8vh, 96px); }

.feature {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: clamp(32px, 6vw, 80px);
  padding: clamp(40px, 8vh, 96px) 0;
}

.feature--reverse .feature__copy { order: 2; }
.feature--reverse .feature__shot { order: 1; }

.feature__copy h3 {
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  font-weight: 700;
  line-height: 1.15;
}

.feature__copy p {
  font-size: clamp(0.98rem, 1.2vw, 1.08rem);
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

.feature__copy code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
  background: #15151399;
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text-primary);
}

.feature__copy strong { color: var(--text-primary); font-weight: 600; }

.feature__shot {
  display: flex;
  justify-content: center;
  align-items: center;
}

.feature__shot--wide { justify-content: stretch; }

/* ----- Apple Watch device frame (SVG outline + masked screenshot) -----
   The frame outline and the screen clip-path live in a single hidden <svg>
   <defs> block at the top of <body>; each .watch-frame instance is its own
   inline <svg> that <use>s the outline symbol and <image>s a screenshot
   clipped to the screen path. */
.watch-frame {
  display: block;
  width: clamp(220px, 26vw, 320px);
  height: auto;
  color: #6a6a6e; /* drives stroke="currentColor" */
  filter:
    drop-shadow(0 24px 40px rgba(0, 0, 0, 0.5))
    drop-shadow(0 0 80px rgba(255, 46, 128, 0.14))
    drop-shadow(0 0 100px rgba(156, 63, 255, 0.12));
}

.watch-frame image {
  /* Tiny black backdrop bleed so the screen edge doesn't show seams
     when the screenshot's top/bottom rows are non-black. */
  filter: none;
}

.watch-frame path {
  vector-effect: non-scaling-stroke;
}

.phone-frame {
  display: block;
  width: clamp(220px, 26vw, 320px);
  height: auto;
  color: #6a6a6e;
  filter:
    drop-shadow(0 24px 40px rgba(0, 0, 0, 0.5))
    drop-shadow(0 0 80px rgba(255, 46, 128, 0.14))
    drop-shadow(0 0 100px rgba(156, 63, 255, 0.12));
}

.phone-frame rect,
.phone-frame path {
  vector-effect: non-scaling-stroke;
}

.phone-frame--half {
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
}

.frame-label { display: none; }

.frame-label {
  position: absolute;
  bottom: -28px; left: 0; right: 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ----- Watch screen mock content -----
   Sizes use cqw (container query units) so everything scales with the
   actual on-screen size of the watch screen, regardless of the parent
   frame's CSS width. */

/* Rep screen */
.ws-rep { display: flex; flex-direction: column; height: 100%; justify-content: space-between; }
.ws-rep__time {
  font-size: 26cqw;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  text-align: center;
  line-height: 1;
}
.ws-rep__row {
  display: flex;
  justify-content: space-between;
  font-size: 9cqw;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.ws-rep__dist {
  text-align: center;
  font-size: 9cqw;
  color: var(--strip-400);
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Recovery screen */
.ws-rec { display: flex; flex-direction: column; height: 100%; gap: 3cqw; }
.ws-rec__top {
  display: flex; justify-content: space-between; align-items: baseline;
}
.ws-rec__rest {
  font-size: 18cqw; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.ws-rec__last { font-size: 7cqw; color: var(--text-secondary); }
.ws-rec__pills { display: flex; gap: 3cqw; flex-wrap: wrap; margin-top: auto; }

/* Idle screen */
.ws-idle { display: flex; flex-direction: column; height: 100%; gap: 4cqw; }
.ws-idle__warmup {
  background: var(--warmup-green);
  color: #001a10;
  font-weight: 700;
  font-size: 8.5cqw;
  text-align: center;
  padding: 5cqw;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.ws-idle__pills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3cqw;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3.5cqw 6cqw;
  font-size: 8cqw;
  font-weight: 600;
  border-radius: 999px;
  background: #16161499;
  color: var(--text-secondary);
  border: 1px solid #1f1f1c;
}
.pill--focus {
  background: var(--strip-400);
  color: #1a0700;
  border-color: transparent;
}

.ws-hr { color: var(--heart-red); font-weight: 600; }

/* ----- Health-sync card (Feature 4) ----- */
.health-card {
  position: relative;
  width: clamp(240px, 28vw, 320px);
  aspect-ratio: 1 / 1.05;
  background: linear-gradient(160deg, #15100f 0%, #0a0807 100%);
  border: 1px solid #20181a;
  border-radius: 28px;
  padding: clamp(20px, 3vw, 32px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  overflow: hidden;
  box-shadow:
    0 24px 50px rgba(0, 0, 0, 0.55),
    0 0 80px rgba(255, 42, 34, 0.15);
}
.health-card__heart {
  font-size: clamp(64px, 8vw, 96px);
  line-height: 1;
  color: var(--heart-red);
  filter: drop-shadow(0 0 24px rgba(255, 42, 34, 0.5));
  animation: heartbeat 1.6s ease-in-out infinite;
}
.health-card__label {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.health-card__pulse {
  position: absolute;
  left: 0; right: 0; bottom: 24%;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--heart-red) 30%,
    var(--strip-600) 55%,
    var(--strip-1200) 85%,
    transparent 100%);
  opacity: 0.7;
}
@keyframes heartbeat {
  0%, 60%, 100% { transform: scale(1); }
  20%           { transform: scale(1.10); }
  35%           { transform: scale(1.02); }
  50%           { transform: scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
  .health-card__heart { animation: none; }
}

/* ----- Strip showcase stage ----- */
.strip-stage {
  width: 100%;
  background: linear-gradient(180deg, #0a0a09 0%, #000 100%);
  border: 1px solid #1c1c19;
  border-radius: var(--radius-lg);
  padding: clamp(28px, 5vw, 56px);
  overflow: hidden;
}
.strip-stage .strip { min-height: 44px; }

.strip-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 22px;
  font-size: 0.78rem;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
}
.legend { display: inline-flex; align-items: center; gap: 7px; }
.dot {
  width: 10px; height: 10px; border-radius: 3px;
  display: inline-block;
}
.dot--200  { background: var(--strip-200); }
.dot--400  { background: var(--strip-400); }
.dot--600  { background: var(--strip-600); }
.dot--800  { background: var(--strip-800); }
.dot--1000 { background: var(--strip-1000); }
.dot--1200 { background: var(--strip-1200); }

/* ==========================================================
   CTA
   ========================================================== */
.cta {
  padding: clamp(80px, 14vh, 160px) 0 clamp(60px, 10vh, 120px);
  border-top: 1px solid #161614;
  text-align: center;
}
.cta__title {
  font-size: clamp(1.1rem, 1.8vw, 1.4rem);
  letter-spacing: -0.005em;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0 auto clamp(22px, 3.5vh, 36px);
  max-width: 32ch;
  line-height: 1.3;
}
.cta .app-store-link {
  margin: 0 auto;
  animation: none;
  opacity: 1;
  transform: none;
}

/* ==========================================================
   FOOTER
   ========================================================== */
.footer {
  padding: 60px 0 80px;
  border-top: 1px solid #161614;
  text-align: center;
}
.footer__mark {
  height: 36px;
  width: auto;
  margin: 0 auto 14px;
  display: block;
  filter: drop-shadow(0 0 18px rgba(255, 46, 128, 0.2));
}
.footer__line { color: var(--text-tertiary); font-size: 0.85rem; margin: 0; }
.footer__credit {
  color: var(--text-tertiary);
  font-size: 0.75rem;
  margin: 14px 0 0;
  opacity: 0.7;
}
.footer__credit a {
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px solid #2a2a26;
  transition: color 0.2s, border-color 0.2s;
}
.footer__credit a:hover {
  color: var(--text-primary);
  border-bottom-color: var(--strip-400);
}

/* ==========================================================
   REVEAL ON SCROLL
   ========================================================== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(.2,.8,.2,1);
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* Showcase strip segments populated by JS — animate in one-by-one */
.strip--showcase .seg {
  opacity: 0;
  transform: scaleX(0.05);
  transition: opacity 0.45s ease, transform 0.55s cubic-bezier(.2,.8,.2,1);
}
.strip--showcase .seg.is-on { opacity: 1; transform: scaleX(1); }

/* ==========================================================
   ANIMATIONS — keyframes
   ========================================================== */
@keyframes fadeUp {
  to { opacity: 1; transform: none; }
}
@keyframes fadeIn { to { opacity: 1; } }

/* ==========================================================
   MOBILE
   ========================================================== */
@media (max-width: 760px) {
  .feature {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 48px 0;
  }
  .feature--reverse .feature__copy { order: 0; }
  .feature--reverse .feature__shot { order: 0; }

  .feature__shot { order: -1; }

  .watch-frame { width: clamp(170px, 56vw, 220px); }
  .phone-frame { width: clamp(170px, 56vw, 220px); }

  .strip--hero { gap: 3px; height: 18px; }
  .seg { --unit: 18px; }
  .strip--showcase .seg { --unit: clamp(14px, 6vw, 24px); }
  .strip--showcase { gap: 4px; }

  /* Slightly dim the photo on mobile so the text remains readable. */
  .hero::before { background-color: rgba(0, 0, 0, 0.15); }
}

@media (max-width: 380px) {
  .ws-idle__pills { grid-template-columns: repeat(2, 1fr); }
  .pill { padding: 4px 7px; font-size: 0.7rem; }
}

/* ==========================================================
   REDUCED MOTION
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .hero__glow { animation: none; transform: scale(1.10); }
  .reveal { opacity: 1; transform: none; }
  .strip--hero .seg,
  .strip--showcase .seg { opacity: 1; transform: none; }
  .hero__scroll { display: none; }
}
