/* IntervalRun landing page.
   Tokens mirror the app's AppTheme.swift design system v2. */

:root {
  --bg: #0C0B0A;
  --text: #F5F1EC;
  --muted: #A9A29A;
  --accent: #FF5A00;
  --accent-deep: #EE3400;
  --accent-hi: #FA5D00;
  --on-accent: #FDFCFA;
  --success: #3BC479;
  --warning: #E0B14E;
  --cool: #8FA8C7;
  --stroke: rgba(255, 255, 255, 0.10);
  --card-grad: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  --card-grad-elevated: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
  --accent-grad: linear-gradient(135deg, var(--accent-hi), var(--accent-deep));
  --radius-card: 20px;
  --radius-small: 12px;
  --shadow-soft: 0 20px 40px -15px rgba(12, 8, 4, 0.55);
  --shadow-accent: 0 16px 40px -12px rgba(255, 90, 0, 0.45);
  --font: "Nunito", "SF Pro Rounded", -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Grain overlay for warmth and texture */
.grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.container {
  width: min(1120px, calc(100% - 48px));
  margin-inline: auto;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

p { margin: 0; }

a { color: var(--accent); }

ul { margin: 0; padding: 0; list-style: none; }

.grad-text {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 32px;
  border-radius: 9999px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.btn:active { transform: scale(0.98); }

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--accent);
}

.btn-primary {
  background: var(--accent-grad);
  color: var(--on-accent);
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 48px -12px rgba(255, 90, 0, 0.55);
}

.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--stroke);
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.04);
}

.btn-small { padding: 11px 22px; font-size: 15px; }

.btn-block { width: 100%; }

.apple-glyph { margin-top: -2px; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(12, 11, 10, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav {
  display: flex;
  align-items: center;
  gap: 32px;
  padding-block: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 19px;
  font-weight: 900;
  color: var(--text);
  text-decoration: none;
}

.brand img { border-radius: 9px; }

.nav-links {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.nav-links a {
  display: inline-block;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 9999px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-links a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-links a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding-block: 96px 80px;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(680px 480px at 78% 30%, rgba(255, 90, 0, 0.16), transparent 65%),
    radial-gradient(520px 420px at 12% 85%, rgba(255, 90, 0, 0.06), transparent 60%);
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 48px;
  align-items: center;
}

.hero-copy h1 {
  font-size: clamp(42px, 6vw, 68px);
  letter-spacing: -0.02em;
}

.hero-sub {
  margin-top: 24px;
  max-width: 34em;
  font-size: 19px;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 36px;
}

.hero-note {
  margin-top: 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

/* ---------- Watch mockup ---------- */

.hero-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.watch {
  display: flex;
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.5));
  transform: rotate(3deg);
}

.watch-band {
  width: 120px;
  height: 58px;
  background: linear-gradient(180deg, #201d1a, #16130f);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.watch-band-top { border-radius: 26px 26px 10px 10px; }
.watch-band-bottom { border-radius: 10px 10px 26px 26px; }

.watch-case {
  position: relative;
  width: 232px;
  padding: 12px;
  background: linear-gradient(160deg, #2c2a27, #131110);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 56px;
  z-index: 1;
}

.watch-crown {
  position: absolute;
  right: -7px;
  top: 74px;
  width: 10px;
  height: 34px;
  border-radius: 5px;
  background: linear-gradient(90deg, #3a3733, #191715);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.watch-button {
  position: absolute;
  right: -5px;
  top: 124px;
  width: 6px;
  height: 44px;
  border-radius: 3px;
  background: #24211e;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Nested corners: inner = outer - padding (56 - 12 = 44) */
.watch-screen {
  background: #000503;
  background: radial-gradient(140% 120% at 30% 15%, #171310 0%, #0a0908 55%, #060505 100%);
  border-radius: 44px;
  padding: 26px 22px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.watch-topline {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.watch-phase { position: relative; display: inline-block; min-width: 46px; height: 1.3em; }

.watch-phase span {
  position: absolute;
  left: 0;
  top: 0;
}

.phase-run { color: var(--accent); animation: phaseRun 12s infinite; }
.phase-walk { color: var(--success); animation: phaseWalk 12s infinite; }

@keyframes phaseRun {
  0%, 49% { opacity: 1; }
  50%, 99% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes phaseWalk {
  0%, 49% { opacity: 0; }
  50%, 99% { opacity: 1; }
  100% { opacity: 0; }
}

.watch-cycle {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.ring-wrap {
  position: relative;
  width: 148px;
  height: 148px;
}

.ring { width: 100%; height: 100%; transform: rotate(-90deg); }

.ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.09);
  stroke-width: 9;
}

.ring-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  animation: ringSweep 6s linear infinite, ringColor 12s infinite;
}

@keyframes ringSweep {
  from { stroke-dashoffset: 326.7; }
  to { stroke-dashoffset: 0; }
}

@keyframes ringColor {
  0%, 49% { stroke: var(--accent); }
  50%, 99% { stroke: var(--success); }
  100% { stroke: var(--accent); }
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.countdown {
  height: 44px;
  overflow: hidden;
}

.digits {
  display: flex;
  flex-direction: column;
  animation: countdown 6s steps(8, end) infinite;
}

.digits span {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 1000;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

@keyframes countdown {
  from { transform: translateY(0); }
  to { transform: translateY(-352px); }
}

.watch-elapsed {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.watch-stats {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.stat-hr .heart {
  color: var(--accent);
  display: inline-block;
  animation: heartbeat 1.1s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  18% { transform: scale(1.25); }
  36% { transform: scale(1); }
}

.stat-pace { color: var(--muted); }

/* Interval timeline bar under the watch */

.interval-bar {
  position: relative;
  width: min(340px, 100%);
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid var(--stroke);
}

.bar-segments {
  display: flex;
  height: 100%;
  gap: 2px;
}

.seg { display: block; }
.seg.run { background: var(--accent-grad); }
.seg.walk { background: rgba(59, 196, 121, 0.55); }

.bar-playhead {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 3px;
  border-radius: 2px;
  background: var(--text);
  box-shadow: 0 0 10px rgba(245, 241, 236, 0.6);
  animation: playhead 24s linear infinite;
}

@keyframes playhead {
  from { left: 0%; }
  to { left: 100%; }
}

.bar-caption {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- Sections ---------- */

.section { padding-block: 104px; }

.section-head { max-width: 46em; }

.section-head h2 {
  font-size: clamp(30px, 4vw, 42px);
}

.section-head p {
  margin-top: 18px;
  color: var(--muted);
  font-size: 18px;
}

.section-footnote {
  margin-top: 36px;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
}

/* ---------- Cards ---------- */

.card {
  background: var(--card-grad);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-card);
  padding: 28px;
  box-shadow: var(--shadow-soft);
}

/* Program week cards */

.week-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 48px;
}

.week-card h3 { font-size: 20px; }

.week-card p {
  margin-top: 14px;
  font-size: 15px;
  color: var(--muted);
}

.mini-bar {
  display: flex;
  gap: 2px;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  margin-top: 16px;
}

/* Watch feature grid */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 48px;
}

.feature-card h3 { font-size: 18px; }

.feature-card p {
  margin-top: 12px;
  font-size: 15px;
  color: var(--muted);
}

/* ---------- Routes ---------- */

.route-grid {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: 64px;
  align-items: center;
}

.route-copy h2 { font-size: clamp(30px, 4vw, 42px); }

.route-copy > p {
  margin-top: 18px;
  color: var(--muted);
  font-size: 18px;
}

.checklist { margin-top: 28px; display: grid; gap: 14px; }

.checklist li {
  position: relative;
  padding-left: 34px;
  font-size: 16px;
  font-weight: 600;
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-grad);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round' d='M4 10.5l4 4 8-9'/%3E%3C/svg%3E") center / contain no-repeat,
        linear-gradient(#000 0 0);
  mask-composite: exclude;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round' d='M4 10.5l4 4 8-9'/%3E%3C/svg%3E") center / contain no-repeat;
}

.map-card {
  position: relative;
  background: var(--card-grad-elevated);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-card);
  padding: 12px;
  box-shadow: var(--shadow-soft);
  transform: rotate(-2deg);
}

.map-svg {
  display: block;
  width: 100%;
  height: auto;
  /* Nested corners: 20 - 12 = 8 */
  border-radius: 8px;
  background: radial-gradient(120% 120% at 25% 20%, #17140f 0%, #0e0c0a 60%, #0a0908 100%);
}

.map-streets path {
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 6;
}

.route-path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 12 10;
  animation: routeDash 2.2s linear infinite;
  filter: drop-shadow(0 0 6px rgba(255, 90, 0, 0.5));
}

@keyframes routeDash {
  from { stroke-dashoffset: 44; }
  to { stroke-dashoffset: 0; }
}

.route-start {
  fill: var(--text);
  stroke: var(--accent);
  stroke-width: 4;
}

.map-badge {
  position: absolute;
  top: 26px;
  right: 26px;
  padding: 8px 16px;
  border-radius: 9999px;
  background: rgba(12, 11, 10, 0.85);
  border: 1px solid var(--stroke);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ---------- Stats ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 48px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.stat-number {
  font-size: 44px;
  font-weight: 1000;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

/* ---------- Pricing ---------- */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 48px;
  align-items: stretch;
}

.price-card {
  display: flex;
  flex-direction: column;
}

.price-card h3 { font-size: 22px; }

.price-line {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.price-card .checklist {
  margin-block: 24px 32px;
  flex: 1;
}

.price-card .checklist li { font-size: 15px; }

.price-card-featured {
  background: var(--card-grad-elevated);
  border-color: rgba(255, 90, 0, 0.45);
  box-shadow: 0 24px 60px -20px rgba(255, 90, 0, 0.35);
}

/* ---------- FAQ ---------- */

.faq-container { max-width: 760px; }

.faq-item {
  margin-top: 16px;
  background: var(--card-grad);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-small);
  overflow: hidden;
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 20px 24px;
  font-size: 17px;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  transition: background-color 0.2s ease;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: "+";
  flex-shrink: 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  transition: transform 0.25s ease;
}

.faq-item[open] summary::after { transform: rotate(45deg); }

.faq-item summary:hover { background: rgba(255, 255, 255, 0.04); }

.faq-item summary:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.faq-item p {
  padding: 0 24px 22px;
  color: var(--muted);
  font-size: 16px;
}

/* ---------- Final CTA ---------- */

.cta-section {
  position: relative;
  overflow: hidden;
}

.cta-section::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(640px 420px at 50% 100%, rgba(255, 90, 0, 0.14), transparent 65%);
}

.cta-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
}

.cta-icon {
  border-radius: 22px;
  box-shadow: var(--shadow-accent);
}

.cta-inner h2 { font-size: clamp(30px, 4vw, 44px); max-width: 16em; }

.cta-inner p {
  color: var(--muted);
  font-size: 18px;
  max-width: 30em;
}

.cta-inner .btn { margin-top: 8px; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-block: 40px;
}

.footer-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 16px;
}

.footer-brand img { border-radius: 7px; }

.footer-links {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-left: auto;
}

.footer-links a {
  display: inline-block;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  border-radius: 8px;
}

.footer-links a:hover { color: var(--text); }

.footer-copy {
  width: 100%;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Reveal on scroll ---------- */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.in {
  opacity: 1;
  transform: none;
}

.week-card.reveal:nth-child(2), .feature-card.reveal:nth-child(2), .price-card.reveal:nth-child(2) { transition-delay: 0.1s; }
.week-card.reveal:nth-child(3), .feature-card.reveal:nth-child(3), .price-card.reveal:nth-child(3) { transition-delay: 0.2s; }
.feature-card.reveal:nth-child(4) { transition-delay: 0.3s; }

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 64px; }
  .hero { padding-block: 64px; }
  .week-cards, .pricing-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .route-grid { grid-template-columns: 1fr; gap: 48px; }
  .section { padding-block: 72px; }
  .nav-links { display: none; }
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .feature-grid { grid-template-columns: 1fr; }
  .hero-actions .btn { width: 100%; }
  .watch { transform: rotate(0deg) scale(0.92); }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ring-progress, .digits, .bar-playhead, .route-path,
  .stat-hr .heart, .phase-run, .phase-walk {
    animation: none;
  }
  .ring-progress { stroke-dashoffset: 82; }
  .reveal { transition: none; }
}
