/* Layout: a treadmill console. The hero is the console's display (always dark, like the app and
   the real thing), showing a Norwegian 4×4 as the app draws it; the rest of the page is quiet
   type on a neutral ground with hairline rules between sections. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #111114;
  --raise: #1b1b20;
  --line: #2c2c33;
  --fg: #f2f2f5;
  --muted: #a3a3ae;
  --accent: #f07a45;
  --accent-ink: #141416;

  /* The console display stays dark in both themes. */
  --console: #0a0a0c;
  --console-line: #24242a;
  --console-fg: #f2f2f5;
  --console-muted: #8e8e99;

  /* Step colors (dark variants from the app) and Apple's heart rate zone colors. */
  --warmup: #3987e5;
  --work: #d95926;
  --recovery: #199e70;
  --cooldown: #9085e9;
  --z1: #44b8fe;
  --z2: #42f9e7;
  --z3: #cffe01;
  --z4: #ff9004;
  --z5: #ff0a77;

  --font-display: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: "Archivo", -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.75rem;
  --step-3: clamp(2rem, 4.5vw, 2.75rem);
  --step-4: clamp(2.75rem, 8vw, 5.25rem);

  --wrap: 72rem;
  --radius: 14px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f4f4f6;
    --raise: #ffffff;
    --line: #dcdce2;
    --fg: #141418;
    --muted: #5c5c67;
    --accent: #c24e1c;
    --accent-ink: #ffffff;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 0.18em; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

h1, h2, h3 {
  font-family: var(--font-display);
  text-wrap: balance;
  margin: 0;
}
h1 { font-size: var(--step-4); font-weight: 820; font-stretch: 70%; line-height: 0.95; letter-spacing: -0.005em; }
h2 { font-size: var(--step-3); font-weight: 780; font-stretch: 78%; line-height: 1.05; }
h3 { font-size: var(--step-1); font-weight: 700; font-stretch: 92%; line-height: 1.25; }
p { margin: 0; }

.label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Header */
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 760;
  font-stretch: 85%;
  font-size: 1.125rem;
}
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.site-nav { display: flex; gap: 20px; font-size: var(--step--1); }
.site-nav a { text-decoration: none; color: var(--muted); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--fg); }
@media (max-width: 30rem) { .site-nav .optional { display: none; } }

/* Hero */
.hero { padding-block: 40px 56px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 36px; }
.hero-copy { display: grid; gap: 20px; max-width: 44rem; }
.hero-copy .lede { font-size: var(--step-1); color: var(--muted); max-width: 36rem; line-height: 1.5; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 1rem;
  text-decoration: none;
  border: 1px solid var(--line);
}
.button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.button.primary:hover { filter: brightness(1.08); }
.button:not(.primary):hover { border-color: var(--muted); }
.fine { font-size: var(--step--1); color: var(--muted); }

/* Console */
.console {
  background: var(--console);
  color: var(--console-fg);
  border: 1px solid var(--console-line);
  border-radius: 22px;
  padding: clamp(16px, 3vw, 28px);
  display: grid;
  gap: 18px;
  min-width: 0;
}
.console .label { color: var(--console-muted); }
.readouts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: var(--console-line);
  border: 1px solid var(--console-line);
  border-radius: 12px;
  overflow: hidden;
}
.readout { background: var(--console); padding: 12px 14px; display: grid; gap: 2px; min-width: 0; }
.readout .value {
  font-family: var(--font-display);
  font-stretch: 75%;
  font-weight: 700;
  font-size: clamp(1.5rem, 3.4vw, 2.25rem);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.readout .value small { font-size: 0.5em; font-weight: 500; color: var(--console-muted); margin-left: 3px; font-stretch: 100%; }
.step-name { color: var(--work); }
.zone-5 { color: var(--z5); }
@media (max-width: 40rem) {
  .readouts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readout:first-child { grid-column: 1 / -1; }
}

.profile-scroll { overflow-x: auto; }
.profile { width: 100%; min-width: 560px; height: auto; display: block; }
.profile .bar.warmup { fill: var(--warmup); }
.profile .bar.work { fill: var(--work); }
.profile .bar.recovery { fill: var(--recovery); }
.profile .bar.cooldown { fill: var(--cooldown); }
.profile .grid { stroke: var(--console-line); stroke-width: 1; }
.profile .zone-line { stroke: var(--console-line); stroke-width: 1; stroke-dasharray: 2 5; }
.profile .hr-halo { fill: none; stroke: var(--console); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.profile .hr { fill: none; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.profile .playhead { stroke: var(--console-fg); stroke-width: 1.5; opacity: 0.85; }
.profile .hr-dot { stroke: var(--console); stroke-width: 3; }
.profile .tick { fill: var(--console-muted); font-family: var(--font-mono); font-size: 13px; }
@media (max-width: 40rem) {
  /* Show the whole workout on a phone: the chart shrinks to about a third, so thicken what must stay legible. */
  .profile { min-width: 0; }
  .profile .tick { font-size: 26px; transform: translateY(12px); }
  .profile .hr { stroke-width: 7; }
  .profile .hr-halo { stroke-width: 15; }
  .profile .playhead { stroke-width: 3; }
  .profile .hr-dot { r: 13px; stroke-width: 6; }
}

.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: var(--step--1); color: var(--console-muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.legend .zones i { width: 22px; height: 6px; border-radius: 3px; }
.legend .divider { width: 1px; height: 14px; background: var(--console-line); }
.console-caption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; align-items: baseline; }
.console-caption h2 { font-size: var(--step-1); font-stretch: 85%; font-weight: 700; }

/* Sections */
.section { border-top: 1px solid var(--line); padding-block: 56px; }
.section-head { display: grid; gap: 10px; margin-bottom: 32px; max-width: 40rem; }
.section-head p { color: var(--muted); }

.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin: 0;
}
.gallery figure { margin: 0; display: grid; gap: 14px; align-content: start; min-width: 0; }
.gallery img {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #000;
}
.gallery figcaption { display: grid; gap: 4px; }
.gallery figcaption p { color: var(--muted); font-size: var(--step--1); }
@media (max-width: 52rem) {
  .gallery { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: min(78%, 300px); overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
  .gallery figure { scroll-snap-align: start; }
}

.features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 56px;
}
.feature { padding-block: 22px; border-top: 1px solid var(--line); display: grid; gap: 8px; align-content: start; min-width: 0; }
.feature p, .feature li { color: var(--muted); }
.feature ul { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; }
@media (max-width: 46rem) { .features { grid-template-columns: minmax(0, 1fr); } }

.spec {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--fg);
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  white-space: nowrap;
}

/* Support */
.support-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 48px; align-items: start; }
@media (max-width: 52rem) { .support-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; } }

.faq { display: grid; }
.faq h3 { font-size: var(--step--1); font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); padding-block: 28px 8px; }
.faq h3:first-child { padding-top: 0; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-of-type { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer;
  list-style: none;
  padding-block: 16px;
  font-weight: 620;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-mono); color: var(--muted); flex: none; }
.faq details[open] summary::after { content: "–"; }
.faq .answer { padding-bottom: 18px; color: var(--muted); display: grid; gap: 10px; max-width: 40rem; }
.faq .answer strong { color: var(--fg); font-weight: 600; }

/* Long-form pages */
.doc { padding-block: 40px 72px; max-width: 44rem; display: grid; gap: 18px; }
.doc h1 { font-size: var(--step-3); font-stretch: 78%; }
.doc h2 { font-size: var(--step-2); padding-top: 22px; }
.doc p, .doc li { color: var(--muted); }
.doc strong { color: var(--fg); font-weight: 600; }
.doc ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.doc .summary {
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  color: var(--fg);
}
.table-scroll { overflow-x: auto; }
.doc table { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-top: 1px solid var(--line); }
.doc th { color: var(--fg); font-weight: 600; white-space: nowrap; }
.doc td { color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); }
.site-footer .wrap { padding-block: 28px 40px; display: grid; gap: 10px; font-size: var(--step--1); color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.site-footer nav a { text-decoration: none; color: var(--fg); }
