@font-face {
  font-family: Oswald;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/oswald-400.woff2") format("woff2");
}

@font-face {
  font-family: Oswald;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/oswald-700.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --ink: #121212;
  --paper: #ffffff;
  --canvas: #f3f3f3;
  --line: #e4e4e4;
  --muted: #5c5c5c;
  --shadow: 0 14px 40px rgba(18, 18, 18, 0.08);
  font-family: Oswald, "Arial Narrow", Impact, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.35;
  color: var(--ink);
  background: var(--canvas);
}

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

body {
  margin: 0;
  background:
    radial-gradient(900px 280px at 50% -40px, rgba(18, 18, 18, 0.04), transparent 70%),
    var(--canvas);
}

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

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

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.hero {
  color: var(--ink);
  background: #f7f6f3;
  border-bottom: 1px solid #e6e4df;
}

.hero-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  max-width: 960px;
  margin: 0 auto;
  padding: 0.7rem 1rem;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 44px;
}

.logo-link img {
  height: 40px;
  width: auto;
}

.hero-copy h1 {
  margin: 0;
  font-weight: 400;
  font-size: 1.45rem;
  line-height: 1.1;
  letter-spacing: 0.01em;
}

.hero-copy p {
  margin: 0.12rem 0 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--muted);
}

.wrap {
  max-width: 960px;
  margin: 1rem auto 0;
  padding: 0 0.85rem 2rem;
  position: relative;
}

.card {
  background: var(--paper);
  margin-top: 0.75rem;
  padding: 1rem 0.95rem 1.1rem;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

fieldset.card,
fieldset.time-field {
  border: 0;
  min-width: 0;
}

fieldset.card {
  display: block;
}

fieldset.card > legend {
  float: left;
  margin: 0 0 0.35rem;
}

fieldset.card > :not(legend) {
  clear: left;
}

legend {
  padding: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.15;
}

.time-field {
  margin: 0.7rem 0 0;
  padding: 0;
}

.time-field legend {
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  text-transform: none;
  margin-bottom: 0.35rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  margin-top: 0.65rem;
}

.pair .field:first-child {
  margin-top: 0.65rem;
}

.field > span,
.time-parts label > span {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

input[type="text"] {
  width: 100%;
  max-width: 9.5rem;
  min-height: 40px;
  padding: 0.2rem 0.7rem;
  border: 1px solid #cfcfcf;
  border-radius: 12px;
  background: #fafafa;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--ink);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(18, 18, 18, 0.12);
}

.time-parts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 6.25rem));
  gap: 0.45rem;
  max-width: 13rem;
}

.time-parts label {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-width: 0;
}

.time-parts input[type="text"] {
  max-width: none;
}

.bike-choice {
  display: grid;
  grid-template-columns: minmax(0, 9.5rem) auto minmax(0, 9.5rem);
  column-gap: 0.4rem;
  align-items: end;
  justify-content: start;
  margin-top: 0.65rem;
}

.bike-choice .field {
  margin-top: 0;
  min-width: 0;
}

.bike-choice .field > span {
  line-height: 1.15;
}

.bike-choice .field-unit {
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--ink);
  white-space: nowrap;
}

.bike-choice input[type="text"] {
  width: 100%;
  max-width: none;
}

.bike-choice .or {
  display: flex;
  justify-content: center;
  margin: 0 0 3px;
  align-self: end;
}

.or span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

@media (max-width: 339px) {
  .bike-choice {
    grid-template-columns: minmax(0, 9.5rem);
    row-gap: 0.4rem;
    align-items: start;
  }

  .bike-choice .or {
    margin: 0;
    align-self: start;
  }
}

.hint,
.aside {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

output {
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.hint output[hidden] {
  display: none;
}

.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.8rem;
}

.toggle {
  position: relative;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.toggle span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.toggle input:checked + span {
  background: var(--ink);
  color: #fff;
}

.toggle input:focus-visible + span {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.actions {
  margin-top: 0.95rem;
}

button {
  appearance: none;
  width: 100%;
  max-width: 18rem;
  min-height: 44px;
  padding: 0.45rem 1.1rem;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(18, 18, 18, 0.18);
}

button:hover {
  background: #000;
}

button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.form-errors {
  margin: 0 0 0.75rem;
  padding: 0.85rem 0.95rem;
  background: var(--paper);
  border-radius: 16px;
  box-shadow: var(--shadow);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
  line-height: 1.35;
}

#output[hidden],
#form-errors[hidden] {
  display: none;
}

.results {
  margin-top: 0.9rem;
}

.coaching-cta h2 {
  margin: 0;
  max-width: 22rem;
  font-weight: 700;
  font-size: 1.45rem;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

.coaching-cta > p {
  margin: 0.4rem 0 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.4;
}

.cta-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 20rem;
  margin-top: 0.9rem;
  min-height: 44px;
  padding: 0.45rem 1.15rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  text-align: center;
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.2;
  box-shadow: 0 8px 18px rgba(18, 18, 18, 0.16);
}

.cta-primary:hover {
  background: #000;
  color: #fff;
}

.cta-quiz {
  margin-top: 0.7rem;
  font-size: 0.88rem;
  line-height: 1.35;
}

.cta-quiz a {
  color: var(--muted);
  text-underline-offset: 0.18em;
}

.cta-quiz a:hover {
  color: var(--ink);
}

.finish-hero {
  padding: 1.15rem 1rem 1.25rem;
  border-radius: 22px;
  color: #fff;
  background:
    radial-gradient(420px 160px at 100% 0%, rgba(255, 255, 255, 0.1), transparent 55%),
    linear-gradient(160deg, #0a0a0a, #242424 70%, #121212);
  box-shadow: var(--shadow);
}

.kicker {
  display: block;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--muted);
}

.finish-hero .kicker {
  color: rgba(255, 255, 255, 0.68);
}

.finish-value {
  display: block;
  margin-top: 0.15rem;
  font-weight: 700;
  font-size: clamp(3rem, 14vw, 5.4rem);
  line-height: 0.9;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.tiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
  margin-top: 0.7rem;
}

.tile {
  background: var(--paper);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 0.9rem 0.95rem 1rem;
}

.tile-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}

.tile-head svg {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.tile h3,
.zone-card h3,
.prose h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 1.05rem;
}

.stat + .stat {
  margin-top: 0.45rem;
}

.num {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 1.45rem;
  line-height: 1.05;
}

.num-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
}

.unit {
  color: var(--muted);
}

.zone-card h3 {
  margin-bottom: 0.35rem;
}

.zone {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.zone:last-child {
  border-bottom: 0;
}

.zone-head {
  display: none;
}

.zone-name {
  letter-spacing: 0.04em;
}

.zone .num {
  font-size: 1.15rem;
}

.prose ol,
.prose ul {
  margin: 0.45rem 0 0;
  padding-left: 1.15rem;
}

.prose li + li {
  margin-top: 0.5rem;
}

.prose p,
footer p {
  margin: 0;
}

footer {
  margin-top: 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  letter-spacing: 0.04em;
}

noscript {
  display: block;
  max-width: 960px;
  margin: 1rem auto;
  padding: 0 1rem;
}

#output {
  animation: rise 0.45s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #output,
  input[type="text"] {
    animation: none;
    transition: none;
  }
}

@media (min-width: 720px) {
  .hero-inner {
    padding: 0.85rem 1.5rem;
  }

  .logo-link img {
    height: 46px;
  }

  .hero-copy h1 {
    font-size: 1.7rem;
  }

  .wrap {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .card {
    padding: 1.15rem 1.3rem 1.25rem;
  }

  .pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 11rem));
    gap: 0.35rem 1.25rem;
    justify-content: start;
  }

  .pair .field,
  .pair .field:first-child {
    margin-top: 0;
  }

  .pair.race-dist {
    grid-template-columns: repeat(3, minmax(0, 9.5rem));
  }

  button {
    width: auto;
    min-width: 16rem;
  }

  .cta-primary {
    width: auto;
    min-width: 16rem;
  }

  .tiles {
    grid-template-columns: 1fr 1fr;
  }

  .zone-head {
    display: grid;
    padding-bottom: 0.35rem;
    color: var(--muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 0.75rem;
  }

  .zone {
    grid-template-columns: 11rem 1fr auto;
    align-items: baseline;
    column-gap: 1rem;
    min-height: 44px;
  }

  .zone-card + .zone-card .zone {
    grid-template-columns: 11rem 1fr;
  }
}
