/* Design tokens copied from the VeloMetrics app (src/app/globals.css).
   Public pages use the blue #0099CC accent (.public-theme). */
:root {
  --cds-surface-0: #080b0f;
  --cds-surface-1: #0b0f14;
  --cds-surface-2: #121920;
  --cds-surface-3: #1a232c;
  --cds-border: #1d262f;
  --cds-border-strong: #2c3944;
  --cds-text-primary: #f2f6f5;
  --cds-text-secondary: #b8c1c5;
  --cds-text-muted: #8a959c;
  --cds-danger: #ff6467;
  --cds-success: #05df72;
  --cds-warning: #ffb900;
  --cds-info: #00bcff;
  --cds-card-sheen: radial-gradient(ellipse 90% 85% at 12% 0%, rgb(45 212 191 / 0.07), transparent 72%),
    linear-gradient(160deg, rgb(255 255 255 / 0.025), transparent 52%);
  --cds-card-shadow: 0 12px 40px rgb(0 0 0 / 0.4), inset 0 1px 0 rgb(255 255 255 / 0.06);
  --glass: rgb(11 15 20 / 0.55);
  --glass-border: rgb(255 255 255 / 0.1);
  --accent: #14b8a6;
  --accent-hover: #2dd4bf;
  --on-accent: #04201c;
  --radius: 16px;
  color-scheme: dark;
}

.light {
  --cds-surface-0: #ffffff;
  --cds-surface-1: #f0f3f5;
  --cds-surface-2: #e3e8ec;
  --cds-surface-3: #d5dce1;
  --cds-border: #c2ccd3;
  --cds-border-strong: #97a5af;
  --cds-text-primary: #0b0f14;
  --cds-text-secondary: #243039;
  --cds-text-muted: #47535d;
  --cds-danger: #c10007;
  --cds-success: #016630;
  --cds-warning: #973c00;
  --cds-info: #00598a;
  --cds-card-sheen: radial-gradient(ellipse 90% 85% at 12% 0%, rgb(20 184 166 / 0.06), transparent 72%);
  --cds-card-shadow: 0 1px 2px rgb(11 15 20 / 0.1), 0 4px 16px rgb(11 15 20 / 0.1);
  --glass: rgb(255 255 255 / 0.7);
  --glass-border: rgb(11 15 20 / 0.1);
  color-scheme: light;
}

.public-theme { --accent: #0099cc; --accent-hover: #33addb; --on-accent: #021a24; }
.light .public-theme { --accent: #0077a8; --accent-hover: #005f87; --on-accent: #ffffff; }

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--cds-surface-1);
  color: var(--cds-text-primary);
  font-family: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.12; }
h2 { font-size: clamp(1.75rem, 3.2vw, 2.5rem); }
h3 { font-size: 1.05rem; font-weight: 500; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / 0.14) transparent; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 820px; }
@media (min-width: 640px) { .container { padding: 0 40px; } }

.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nowrap { white-space: nowrap; }
.block { display: block; }
.accent-text { color: var(--accent); }
.muted { color: var(--cds-text-muted); }
.small { font-size: 0.875rem; }
.lead { color: var(--cds-text-secondary); font-size: clamp(1rem, 1.3vw, 1.125rem); line-height: 1.65; max-width: 40rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, transform .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { border-color: var(--cds-border-strong); color: var(--cds-text-primary); background: transparent; font-weight: 500; }
.btn-ghost:hover { background: var(--cds-surface-2); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 0.85rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--cds-border); background: transparent; color: var(--cds-text-secondary); cursor: pointer;
}
.icon-btn:hover { color: var(--cds-text-primary); background: var(--cds-surface-2); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icon-moon { display: none; }
.light .icon-sun { display: none; }
.light .icon-moon { display: block; }

.pill {
  display: inline-block; width: fit-content; padding: 4px 12px; border-radius: 999px; font-size: 0.875rem;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.eyebrow { display: block; font-size: 0.8rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: 12px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  transition: background-color .2s, border-color .2s;
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--cds-surface-0) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--cds-border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 1.125rem; font-weight: 500; letter-spacing: -0.01em; }
.brand-mark { width: 32px; height: 32px; color: var(--accent); }
.nav { display: flex; gap: 28px; font-size: 0.9rem; color: var(--cds-text-secondary); }
.nav a:hover { color: var(--cds-text-primary); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; }

@media (max-width: 899px) {
  .menu-btn { display: inline-grid; }
  .nav {
    position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--cds-surface-0); border-bottom: 1px solid var(--cds-border);
    padding: 8px 24px 16px; display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 12px 0; border-bottom: 1px solid var(--cds-border); }
}
@media (max-width: 479px) { .hide-sm { display: none; } }

/* Login popover (native Popover API, anchored under the header) */
.login-pop {
  position: fixed; inset: 76px 16px auto auto; margin: 0;
  width: min(320px, calc(100vw - 32px)); padding: 22px;
  display: none; flex-direction: column; gap: 12px;
  background: var(--cds-surface-1); color: var(--cds-text-primary);
  border: 1px solid var(--glass-border); border-radius: var(--radius);
  box-shadow: var(--cds-card-shadow);
}
.login-pop:popover-open { display: flex; }
.login-pop h2 { font-size: 1.05rem; font-weight: 500; }
.login-pop .muted:last-child { margin-top: 4px; }
.login-pop .accent-text:hover { text-decoration: underline; }
.login-btn { width: 100%; gap: 12px; }
.login-icon { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; }
.login-icon-google { background: #fff; }
.login-icon svg { width: 18px; height: 18px; }
@media (min-width: 1240px) { .login-pop { right: calc((100vw - 1240px) / 2 + 40px); } }

/* Hero */
.hero { position: relative; isolation: isolate; margin-top: -68px; padding: 132px 0 80px; background: var(--cds-surface-0); min-height: 100vh; display: flex; align-items: center; }
.hero-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.hero-bg img { position: absolute; inset: 0 0 0 0; width: 100%; height: 100%; object-fit: cover; object-position: 35% 70%; }
@media (min-width: 1024px) {
  .hero-bg img {
    left: 22%; width: 78%;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 35%);
    mask-image: linear-gradient(to right, transparent, #000 35%);
  }
}
.hero-shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(to bottom, color-mix(in srgb, var(--cds-surface-0) 80%, transparent), transparent 140px),
    linear-gradient(to top, var(--cds-surface-0), transparent 33%),
    linear-gradient(to right, var(--cds-surface-0) 20%, color-mix(in srgb, var(--cds-surface-0) 70%, transparent) 40%, transparent 75%),
    color-mix(in srgb, var(--cds-surface-0) 25%, transparent);
}
@media (max-width: 1023px) { .hero-shade { background-color: color-mix(in srgb, var(--cds-surface-0) 60%, transparent); } }
.hero-grid { display: grid; gap: 48px; }
@media (min-width: 1024px) { .hero-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 56px; align-items: center; } }
.hero h1 { margin-top: 24px; font-size: clamp(2.25rem, 5.5vw, 3.75rem); line-height: 1.08; }
.hero .lead { margin-top: 28px; max-width: 32rem; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.hero-stats { display: flex; gap: 36px; list-style: none; padding: 0; margin: 44px 0 0; }
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 1.75rem; font-weight: 500; letter-spacing: -0.02em; }
.hero-stats span { font-size: 0.8rem; color: var(--cds-text-muted); }

.hero-hud { display: grid; gap: 20px; }
@media (min-width: 640px) { .hero-hud { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .hero-hud { grid-template-columns: 1fr; max-width: 28rem; justify-self: end; width: 100%; } }
.tile {
  border-radius: var(--radius); border: 1px solid var(--glass-border); background: var(--glass);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: 24px;
  display: flex; flex-direction: column;
  animation: rise .7s ease both;
}
.tile + .tile { animation-delay: .15s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.tile-head { display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; color: var(--cds-text-muted); margin-bottom: 12px; gap: 8px; }
.tile-title { font-weight: 500; color: var(--cds-text-primary); }
.workout-head { display: flex; justify-content: space-between; align-items: baseline; }
.workout-name { font-size: 1.125rem; font-weight: 500; }
.workout-dur { font-size: 1.25rem; font-weight: 500; }
.workout-dur small { margin-left: 4px; font-size: 0.75rem; color: var(--cds-text-muted); }

/* Graphs */
.form-graph svg { width: 100%; height: auto; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; font-size: 0.6875rem; color: var(--cds-text-muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; }
.flamegraph { margin-top: auto; padding-top: 16px; }
.flame-bars { display: flex; align-items: flex-end; gap: 1px; height: 72px; background: var(--cds-surface-2); border-radius: 4px; overflow: hidden; }
.flame-bars div { border-radius: 2px 2px 0 0; min-width: 1px; transform-origin: bottom; animation: grow .6s ease both; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.flame-sets { display: flex; gap: 1px; margin-top: 2px; font-size: 9px; color: var(--cds-text-muted); text-align: center; }

/* Sections */
.section { padding: 96px 0; }
.section-alt { background: var(--cds-surface-0); border-block: 1px solid var(--cds-border); }
.section-head { margin-bottom: 48px; }
.section-head .lead { margin-top: 16px; }

.card {
  background: var(--cds-surface-2); border: 1px solid var(--cds-border); border-radius: var(--radius); padding: 24px;
}
.card-raised { background-image: var(--cds-card-sheen); box-shadow: var(--cds-card-shadow); }

.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.step-no {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 600; font-size: 0.9rem; margin-bottom: 16px;
}
.step p { margin-top: 8px; color: var(--cds-text-secondary); font-size: 0.925rem; }

/* Pricing */
.billing-toggle { display: inline-flex; margin-top: 28px; padding: 4px; border-radius: 12px; border: 1px solid var(--cds-border); background: var(--cds-surface-1); }
.billing-toggle button {
  font: inherit; font-size: 0.875rem; border: 0; background: transparent; color: var(--cds-text-secondary);
  padding: 8px 16px; border-radius: 9px; cursor: pointer;
}
.billing-toggle button.is-active { background: var(--cds-surface-3); color: var(--cds-text-primary); }
.save { color: var(--cds-success); font-size: 0.75rem; margin-left: 4px; }
.pricing { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: stretch; }
.plan { display: flex; flex-direction: column; position: relative; padding: 28px; }
.plan.is-featured { border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent), var(--cds-card-shadow); }
.plan-badge {
  position: absolute; top: -12px; left: 28px; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600;
  background: var(--accent); color: var(--on-accent);
}
.plan h3 { font-size: 1.35rem; font-weight: 600; }
.plan-tagline { color: var(--cds-text-muted); font-size: 0.9rem; margin-top: 4px; }
.plan-price { margin: 24px 0 4px; font-size: 2.5rem; font-weight: 500; letter-spacing: -0.03em; }
.plan-price small { font-size: 0.9rem; color: var(--cds-text-muted); font-weight: 400; letter-spacing: 0; margin-left: 4px; }
.plan-note { font-size: 0.8rem; color: var(--cds-text-muted); min-height: 1.2em; }
.plan ul { list-style: none; padding: 0; margin: 24px 0 28px; display: grid; gap: 10px; font-size: 0.925rem; color: var(--cds-text-secondary); }
.plan .btn { margin-top: auto; }

.checks { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; color: var(--cds-text-secondary); }
.checks li, .plan li { position: relative; padding-left: 26px; }
.checks li::before, .plan li::before {
  content: ""; position: absolute; left: 0; top: 0.35em; width: 16px; height: 16px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 16%, transparent)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2l2.2 2.2 4.8-4.8' fill='none' stroke='%230099cc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat;
}

/* Feature rows */
.features { display: grid; gap: 112px; }
.feature { display: grid; gap: 40px; align-items: center; }
@media (min-width: 900px) {
  .feature { grid-template-columns: 1fr 1fr; gap: 72px; }
  .feature.reverse .feature-copy { order: 2; }
}
.feature-copy p { color: var(--cds-text-secondary); margin-top: 16px; line-height: 1.7; }
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* Season plan bars */
.season { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 180px; }
.season .wk { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.season .bar { width: 100%; border-radius: 6px 6px 2px 2px; transition: height .8s cubic-bezier(.2,.8,.2,1); height: 0; }
.season .lbl { font-size: 10px; color: var(--cds-text-muted); }
.phase-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 16px; font-size: 0.75rem; color: var(--cds-text-muted); }
.phase-legend span { display: inline-flex; align-items: center; gap: 6px; }
.phase-legend i { width: 10px; height: 10px; border-radius: 3px; }

/* Zones */
.range input { width: 100%; accent-color: var(--accent); margin: 4px 0 16px; }
.zones { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.zones td { padding: 8px 4px; border-top: 1px solid var(--cds-border); }
.zones td:last-child { text-align: right; font-variant-numeric: tabular-nums; color: var(--cds-text-secondary); }
.zones .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 10px; vertical-align: -1px; }

/* Chat */
.chat-log { display: flex; flex-direction: column; gap: 10px; min-height: 300px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 0.9rem; line-height: 1.5; animation: rise .35s ease both; }
.msg-user { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px; }
.msg-ai { align-self: flex-start; background: var(--cds-surface-3); border-bottom-left-radius: 4px; }
.msg-meta { display: block; font-size: 0.7rem; opacity: .7; margin-bottom: 2px; }
.typing { display: inline-flex; gap: 4px; padding: 14px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--cds-text-muted); animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* Approval */
.approval-list { list-style: none; padding: 0; margin: 4px 0 20px; display: grid; gap: 8px; font-size: 0.9rem; }
.approval-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--cds-surface-1); border: 1px solid var(--cds-border); transition: opacity .3s; }
.approval.is-done .approval-list li { opacity: .6; }
.approval-actions { display: flex; justify-content: flex-end; gap: 8px; }
.tag, .badge { font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.tag-move { color: var(--cds-info); background: color-mix(in srgb, var(--cds-info) 14%, transparent); }
.tag-new { color: var(--cds-success); background: color-mix(in srgb, var(--cds-success) 14%, transparent); }
.tag-del { color: var(--cds-danger); background: color-mix(in srgb, var(--cds-danger) 14%, transparent); }
.badge-warn { color: var(--cds-warning); background: color-mix(in srgb, var(--cds-warning) 14%, transparent); }
.badge-ok { color: var(--cds-success); background: color-mix(in srgb, var(--cds-success) 14%, transparent); }
.badge-no { color: var(--cds-danger); background: color-mix(in srgb, var(--cds-danger) 14%, transparent); }

/* Coaches */
.coaches { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.coach { padding: 0; overflow: hidden; }
.coach-avatar {
  aspect-ratio: 4 / 3; display: grid; place-items: center; font-size: 2.25rem; font-weight: 600; letter-spacing: -0.02em;
  color: var(--accent);
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 60%),
    var(--cds-surface-3);
}
.coach-body { padding: 20px; }
.coach-role { font-size: 0.85rem; color: var(--accent); margin-top: 2px; }
.coach ul { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 6px; font-size: 0.85rem; color: var(--cds-text-secondary); }

/* FAQ */
.faq { display: grid; gap: 12px; }
.faq details { background: var(--cds-surface-2); border: 1px solid var(--cds-border); border-radius: 12px; padding: 0 20px; }
.faq summary { cursor: pointer; list-style: none; padding: 18px 0; font-weight: 500; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--cds-text-muted); font-size: 1.25rem; line-height: 1; transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding-bottom: 18px; color: var(--cds-text-secondary); }

/* Contact */
.contact { display: grid; gap: 40px; align-items: start; }
@media (min-width: 900px) { .contact { grid-template-columns: 1fr 1fr; gap: 72px; } }
.contact .lead { margin: 16px 0 12px; }
.contact-form { display: grid; gap: 16px; }
.contact-form label { display: grid; gap: 6px; font-size: 0.85rem; color: var(--cds-text-secondary); }
.contact-form input, .contact-form select, .contact-form textarea {
  font: inherit; font-size: 0.95rem; color: var(--cds-text-primary); background: var(--cds-surface-1);
  border: 1px solid var(--cds-border-strong); border-radius: 10px; padding: 10px 12px; resize: vertical;
}
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.contact-form [aria-invalid="true"] { border-color: var(--cds-danger); }
.form-msg { font-size: 0.875rem; min-height: 1.3em; }
.form-msg.is-error { color: var(--cds-danger); }
.form-msg.is-ok { color: var(--cds-success); }
@media (max-width: 639px) { .contact-form input, .contact-form select, .contact-form textarea { font-size: 16px; } }

/* Footer */
.site-footer { border-top: 1px solid var(--cds-border); padding: 28px 0; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.site-footer a:hover { color: var(--cds-text-primary); }

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