/* ============================================================
   Racepace — Global Stylesheet
   Dark navy theme, orange accent, card-based, athletic UI
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Palette — dark navy base */
  --color-bg:            #0a1628;
  --color-bg-alt:        #0f1f38;
  --color-surface:       #152240;
  --color-surface-hover: #1a2d52;
  --color-primary:       #0f3460;
  --color-primary-light: #1a4f8a;

  /* Accent — orange / red */
  --color-accent:        #e8622c;
  --color-accent-light:  #f07a4a;
  --color-accent-glow:   rgba(232, 98, 44, 0.15);
  --color-cta:           #e8622c;
  --color-cta-hover:     #d4541f;

  /* Text */
  --color-text:          #e2e8f0;
  --color-text-muted:    #8b9cc0;
  --color-text-heading:  #ffffff;
  --color-border:        rgba(255,255,255,0.08);

  /* Typography */
  --font-body:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: var(--font-body);

  /* Spacing / layout */
  --container-max:  1120px;
  --section-pad-y:  4rem;
  --radius:         0.75rem;
  --radius-lg:      1rem;
  --shadow-sm:      0 2px 8px rgba(0,0,0,.25);
  --shadow-md:      0 4px 20px rgba(0,0,0,.35);
  --transition:     0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  overflow-x: hidden;
}

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

a {
  color: var(--color-accent-light);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover, a:focus-visible { color: #fff; text-decoration: underline; }

ul, ol { list-style-position: inside; }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--color-text-heading);
  line-height: 1.25;
}
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

/* ---------- Utility / layout ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.section {
  padding-block: var(--section-pad-y);
}

.section-alt {
  background: var(--color-bg-alt);
}

.text-center { text-align: center; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-align: center;
  transition: background var(--transition), transform var(--transition);
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--color-cta);
  color: #fff;
}
.btn-primary:hover {
  background: var(--color-cta-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-accent-light);
  border: 1px solid var(--color-accent);
}
.btn-secondary:hover { background: var(--color-surface-hover); color: #fff; }

.btn-outline {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.3);
}
.btn-outline:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-color: rgba(255,255,255,0.5);
}

/* ---------- Preview banner ---------- */
.preview-banner {
  background: var(--color-surface);
  color: var(--color-text-muted);
  text-align: center;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--color-border);
}
.preview-banner strong {
  color: var(--color-accent-light);
}

/* ---------- Header / navigation ---------- */
.site-header {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 0.85rem;
}

.logo {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}
.logo span { color: var(--color-accent); }
.logo:hover { text-decoration: none; color: #fff; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  min-width: 44px;
  min-height: 44px;
}
.nav-toggle svg { width: 28px; height: 28px; stroke: #fff; }

.nav-links {
  display: flex;
  gap: 1.75rem;
  list-style: none;
}
.nav-links a {
  font-weight: 500;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}
.nav-links a:hover { color: #fff; text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--color-accent-light); }

/* Beta nav button */
.nav-links .nav-btn-beta {
  background: var(--color-cta);
  color: #fff;
  padding: 0.4rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  transition: background var(--transition), transform var(--transition);
}
.nav-links .nav-btn-beta:hover {
  background: var(--color-cta-hover);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}
.nav-links .nav-btn-beta:focus-visible {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 2px;
}
.nav-links .nav-btn-beta[aria-current="page"] {
  background: var(--color-cta-hover);
  color: #fff;
}

/* Mobile nav */
@media (max-width: 768px) {
  .nav-toggle { display: block; }

  .nav-links {
    display: none;
    flex-direction: column;
    gap: 0;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    z-index: 99;
    background: var(--color-bg-alt);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
  }
  .nav-links.open { display: flex; }

  .nav-links li { border-top: 1px solid var(--color-border); }
  .nav-links a { display: block; padding: 0.85rem 1.25rem; min-height: 44px; }
  .nav-links .nav-btn-beta { border-radius: 0; }
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(160deg, #0c2040 0%, #0a1628 60%, #1a1030 100%);
  color: #fff;
  padding-block: 5rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--color-accent-glow) 0%, transparent 70%);
  pointer-events: none;
}
.hero h1 { color: #fff; margin-bottom: 1rem; position: relative; }
.hero p {
  font-size: 1.15rem;
  max-width: 640px;
  margin-inline: auto;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  position: relative;
}
.hero .btn { margin: 0.35rem; position: relative; }

/* ---------- Steps (How it works) ---------- */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.step-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}
.step-card .step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem; height: 3rem;
  background: var(--color-accent);
  color: #fff;
  font-weight: 700;
  font-size: 1.25rem;
  border-radius: 50%;
  margin-bottom: 1rem;
}
.step-card h3 { margin-bottom: 0.5rem; }
.step-card p { color: var(--color-text-muted); font-size: 0.95rem; }

/* ---------- Data summary cards ---------- */
.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.data-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
}
.data-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.data-card p { font-size: 0.95rem; color: var(--color-text-muted); }

/* ---------- Section intro ---------- */
.section-intro {
  max-width: 680px;
  margin-inline: auto;
  margin-bottom: 0.5rem;
  color: var(--color-text-muted);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  padding-block: 2.5rem;
  font-size: 0.9rem;
  border-top: 1px solid var(--color-border);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}
.footer-brand .logo { color: #fff; margin-bottom: 0.35rem; }
.footer-brand p { color: var(--color-text-muted); max-width: 320px; }

.footer-links h4 { color: var(--color-text); margin-bottom: 0.5rem; font-size: 0.95rem; }
.footer-links ul { list-style: none; }
.footer-links a { color: var(--color-text-muted); font-size: 0.9rem; display: inline-block; padding-block: 0.25rem; }
.footer-links a:hover { color: #fff; text-decoration: none; }
.footer-links li + li { margin-top: 0.25rem; }

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.85rem;
}

/* ---------- Content pages (privacy, support, security) ---------- */
.page-header {
  background: linear-gradient(160deg, #0c2040 0%, #0a1628 100%);
  color: #fff;
  padding-block: 3rem 2.5rem;
  text-align: center;
}
.page-header h1 { color: #fff; margin-bottom: 0.5rem; }
.page-header p { color: var(--color-text-muted); max-width: 600px; margin-inline: auto; }

.content-body {
  max-width: 800px;
  margin-inline: auto;
  padding-block: 3rem;
  padding-inline: 1.25rem;
}
.content-body h2 {
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  font-size: 1.5rem;
  border-bottom: 2px solid var(--color-accent);
  padding-bottom: 0.35rem;
}
.content-body h3 {
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}
.content-body p,
.content-body li {
  margin-bottom: 0.75rem;
  color: var(--color-text);
}
.content-body ul,
.content-body ol {
  padding-left: 1.25rem;
  list-style-position: outside;
}
.content-body ul { list-style-type: disc; }
.content-body ol { list-style-type: decimal; }
.content-body strong { color: #fff; }
.content-body a { color: var(--color-accent-light); }
.content-body a:hover { color: #fff; }

.last-updated {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

/* ---------- FAQ (accordion) ---------- */
.faq-list {
  margin-top: 1.5rem;
}

.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.faq-item summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--color-surface);
  color: var(--color-text);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: 300;
  color: var(--color-accent);
  transition: transform var(--transition);
}
.faq-item[open] summary::after {
  content: '\2212'; /* minus */
}

.faq-item .faq-answer {
  padding: 0 1.25rem 1.25rem;
  color: var(--color-text-muted);
  background: var(--color-surface);
}
.faq-item .faq-answer p { margin-bottom: 0.5rem; }
.faq-item .faq-answer ol,
.faq-item .faq-answer ul {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}

/* ---------- Contact box ---------- */
.contact-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  margin-top: 2.5rem;
}
.contact-box h3 { margin-bottom: 0.5rem; }
.contact-box p { color: var(--color-text-muted); }
.contact-box .btn { font-weight: 600; color: #fff; }
.contact-box .btn:hover { color: #fff; }

/* ---------- Security feature list ---------- */
.security-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.security-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-accent);
}
.security-card h3 { margin-bottom: 0.5rem; }
.security-card p { font-size: 0.95rem; color: var(--color-text-muted); }

/* ============================================================
   Hero Screens — three app screenshots, staggered slide-in
   Apple-style: calm, smooth, intentional
   ============================================================ */

/* --- Row layout, centered --- */
.hero-screens {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 1.5rem;
  margin-top: 3.5rem;
  padding-bottom: 0.5rem;
}

/* --- Individual screen wrapper --- */
.hero-screen {
  flex: 0 1 auto;
  max-width: 200px;
  /* Pre-animation state: invisible, shifted left */
  opacity: 0;
  transform: translateX(-36px);
  /* Apple-style easing — smooth deceleration */
  transition: opacity 0.8s cubic-bezier(0.4, 0.0, 0.2, 1),
              transform 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
  /* Staggered delay per item via --i custom prop */
  transition-delay: calc(var(--i) * 0.12s);
  will-change: opacity, transform;
}

/* --- Visible state: triggered by IntersectionObserver --- */
.hero-screens.is-visible .hero-screen {
  opacity: 1;
  transform: translateX(0);
}

/* --- The screenshot image --- */
.hero-screen img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 20px;
}

/* --- Middle screen: slightly elevated for visual hierarchy --- */
.hero-screen:nth-child(2) {
  max-width: 220px;
  transform: translateX(-36px) translateY(-12px);
}
.hero-screens.is-visible .hero-screen:nth-child(2) {
  transform: translateX(0) translateY(-12px);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero-screens {
    gap: 1rem;
    margin-top: 2.5rem;
  }
  .hero-screen {
    max-width: 150px;
  }
  .hero-screen:nth-child(2) {
    max-width: 165px;
  }
}

@media (max-width: 480px) {
  .hero-screens {
    gap: 0.6rem;
    margin-top: 2rem;
  }
  .hero-screen {
    max-width: 105px;
  }
  .hero-screen:nth-child(2) {
    max-width: 115px;
  }
  .hero-screen img {
    border-radius: 12px;
  }
}

/* --- Reduced motion: show instantly, no slide --- */
@media (prefers-reduced-motion: reduce) {
  .hero-screen {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .hero-screen:nth-child(2) {
    transform: translateY(-12px);
  }
}

/* ============================================================
   Screenshot Grid — flat slide-in presentation
   ============================================================ */

/* --- Grid container --- */
.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-top: 2.5rem;
  justify-items: center;
}

/* --- Individual screenshot card --- */
.screenshot-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  /* Slide-in animation */
  opacity: 0;
  transform: translateX(60px);
  animation: screenshot-slide-in 0.6s ease-out forwards;
  animation-delay: calc(var(--delay) * 0.15s);
  /* Hover lift */
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.screenshot-card:hover,
.screenshot-card:focus-within {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* --- Screenshot image --- */
.screenshot-card img {
  max-width: 240px;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
}

/* --- Slide-in keyframes --- */
@keyframes screenshot-slide-in {
  from {
    opacity: 0;
    transform: translateX(60px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================================================
   Responsive — screenshots
   ============================================================ */

@media (max-width: 768px) {
  .screenshots-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  .screenshot-card img {
    max-width: 200px;
  }
}

@media (max-width: 480px) {
  :root {
    --section-pad-y: 2.5rem;
  }
  .hero { padding-block: 3rem 2.5rem; }
  .hero p { font-size: 1rem; }
  .btn { width: 100%; }
  .footer-inner { flex-direction: column; }

  .screenshots-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  .screenshot-card img {
    max-width: 160px;
  }
}

/* --- Reduced motion: disable slide-in, show static --- */
@media (prefers-reduced-motion: reduce) {
  .screenshot-card {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   Showcase grid — "Race Anywhere" image section
   ============================================================ */
.showcase-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-top: 2.5rem;
  justify-items: center;
}

.showcase-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0.4rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}
.showcase-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.showcase-card img {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
}

.showcase-text {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  padding: 0.6rem 0.4rem 0.4rem;
  text-align: center;
  line-height: 1.4;
}

.strava-orange {
  color: #FC4C02;
  font-weight: 700;
}

@media (max-width: 768px) {
  .showcase-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .showcase-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  .showcase-text { font-size: 0.7rem; }
}

/* ============================================================
   Beta page — badge, status cards, timeline
   ============================================================ */

/* ---------- Reusable beta badge ---------- */
.badge-beta {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--color-accent);
  color: #fff;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 0.5rem;
  position: relative;
  top: -0.15em;
}

/* ---------- Platform status cards ---------- */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.status-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-accent);
}
.status-card h3 { margin-bottom: 0.5rem; }
.status-card p { font-size: 0.95rem; color: var(--color-text-muted); }

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  margin-top: 2rem;
  padding-left: 2rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0.45rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  padding-bottom: 2rem;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.55rem;
  top: 0.35rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-bg);
}

.timeline-date {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-accent-light);
  margin-bottom: 0.25rem;
}

.timeline-item h3 { margin-bottom: 0.35rem; }
.timeline-item p { color: var(--color-text-muted); font-size: 0.95rem; }
