/* Strides — free tools
 *
 * Loaded after site.css: same tokens, nav, footer, pills and shape rule
 * (cards 26, panels 18, cells 12, every action a capsule). A tool page is a
 * calculator first — the input and the answer side by side on a white slab —
 * then a short read on how the numbers are made, in the blog's serif voice.
 *
 * Motion is the app's: figures change like numeric text, the track is the
 * Lap loader run for real, the zones lay down as one ribbon. Each plays once
 * per answer; nothing loops.
 */

@font-face { font-family: "Newsreader"; src: url("/assets/fonts/Newsreader-Italic-Variable.woff2") format("woff2"); font-weight: 300 700; font-style: italic; font-display: swap; }

:root {
  /* The app's seven pace-zone colours (TrainingZoneColors.pace). */
  --z1: #2a8a6a; --z2: #0c9fe9; --z3: #327de6; --z4: #4f56da; --z5: #e06a18; --z6: #a62f5c; --z7: #c41850;
  --measure: 680px;
}
@media (prefers-color-scheme: dark) {
  :root { --z1: #3aad84; --z2: #0c9fe9; --z3: #67a0ff; --z4: #9093ff; --z5: #f08a3a; --z6: #d45a8a; --z7: #f75178; }
}

.tool { padding-top: 68px; }
@media (max-width: 860px) { .tool { padding-top: 60px; } }

/* ---------- Head ---------- */

.tool-head { padding: clamp(40px, 7vw, 88px) 0 clamp(28px, 4vw, 44px); }
.tool-head .back { display: inline-flex; align-items: center; gap: 6px; font-size: 14.5px; color: var(--text-2); margin-bottom: 28px; transition: color .2s var(--ease); }
.tool-head .back:hover { color: var(--ink); }
.tool-head .back .icon { font-size: 16px; }
.tool-head h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(42px, 6.4vw, 80px); line-height: 1; letter-spacing: -.026em; text-wrap: balance; margin-top: 14px; max-width: 13em; }
.tool-head .lede { margin-top: 18px; }

/* ---------- Calculator ---------- */

.calc { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 14px; align-items: start; }
/* The race stays in reach beside a long answer. */
.calc > form { position: sticky; top: 88px; }
@media (max-width: 900px) { .calc { grid-template-columns: minmax(0, 1fr); } .calc > form { position: static; } }

.panel { background: var(--card); border-radius: var(--r-card); box-shadow: inset 0 0 0 1px var(--card-edge), 0 1px 2px #00000008; padding: clamp(22px, 3vw, 30px); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }

/* The race: distance capsules with a sliding ink thumb. */
.seg { position: relative; display: flex; padding: 3px; border-radius: 999px; background: var(--well); isolation: isolate; }
.seg button { position: relative; z-index: 1; flex: 1 1 auto; height: 38px; padding: 0 12px; border: 0; border-radius: 999px; background: none; font-size: 14.5px; font-weight: 500; color: var(--text-2); white-space: nowrap; transition: color .3s var(--ease); }
.seg button[aria-checked="true"] { color: var(--on-ink); }
.seg button:hover:not([aria-checked="true"]) { color: var(--ink); }
.seg-thumb { position: absolute; z-index: 0; top: 3px; left: 0; height: 38px; border-radius: 999px; background: var(--ink); transition: transform .45s var(--ease-out), width .45s var(--ease-out); }
@media (max-width: 420px) { .seg button { padding: 0 8px; font-size: 13.5px; } }

.time-field { display: block; margin-top: 22px; }
.time-field .label { display: block; margin-bottom: 6px; }
.time-input {
  width: 100%; border: 0; background: none; padding: 0; margin: 0;
  font-family: var(--serif); font-weight: 400; font-size: clamp(56px, 8vw, 76px); line-height: 1.05; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; color: var(--ink); caret-color: var(--easy);
  border-bottom: 1.5px solid var(--strong-hairline); padding-bottom: 6px; border-radius: 0;
  transition: border-color .25s var(--ease);
}
.time-input:focus { outline: none; border-bottom-color: var(--ink); }
.time-input::placeholder { color: var(--tertiary); }
.is-invalid .time-input { border-bottom-color: var(--worse); }
.hint { margin-top: 10px; min-height: 1.5em; font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--secondary); }
.is-invalid .hint { color: var(--worse); }

.panel-note { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--hairline); font-size: 14.5px; line-height: 1.5; color: var(--text-2); }
.panel-note strong { color: var(--ink); font-weight: 500; }

/* Miles or kilometres. */
.units { position: relative; display: inline-flex; padding: 3px; border-radius: 999px; background: var(--well); }
.units button { position: relative; z-index: 1; height: 30px; width: 46px; border: 0; border-radius: 999px; background: none; font-size: 13.5px; font-weight: 600; color: var(--text-2); transition: color .3s var(--ease); }
.units button[aria-checked="true"] { color: var(--on-ink); }
.units::before { content: ""; position: absolute; top: 3px; left: 3px; width: 46px; height: 30px; border-radius: 999px; background: var(--ink); transition: transform .4s var(--ease-out); }
.units[data-on="km"]::before { transform: translateX(46px); }

/* ---------- Answer ---------- */

.answer { display: flex; flex-direction: column; }
.answer-figure { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.figure { font-family: var(--serif); font-weight: 400; font-variant-numeric: tabular-nums; letter-spacing: -.02em; white-space: nowrap; }
.figure .glyph { display: inline-block; }
.unit-word { font-family: var(--serif); font-style: italic; color: var(--secondary); }

/* ---------- Race predictor ---------- */

.track-stage { position: relative; margin: 4px -6px 0; aspect-ratio: 16 / 8.2; }
.track-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.track-infield { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.track-infield .figure { font-size: clamp(34px, 5vw, 48px); line-height: 1; }
.track-infield .caption { margin-top: 6px; font-family: var(--serif); font-style: italic; font-size: 14.5px; color: var(--secondary); }

.predictions { width: 100%; border-collapse: collapse; margin-top: 14px; font-variant-numeric: tabular-nums; }
.predictions th, .predictions td { padding: 16px 0; border-bottom: 1px solid var(--hairline); text-align: right; }
.predictions th:first-child { text-align: left; }
.predictions thead th { font-size: 12px; font-weight: 400; color: var(--secondary); padding-bottom: 10px; }
.prediction-name { font-size: 15px; font-weight: 500; }
.prediction .figure { font-size: clamp(26px, 3.4vw, 32px); line-height: 1.1; }
.prediction-pace { width: 25%; font-size: 14px; color: var(--text-2); white-space: nowrap; }
.prediction-tag[hidden] { display: none; }
.prediction-tag { display: block; width: fit-content; margin-top: 4px; font-size: 11px; font-weight: 400; color: var(--secondary); }

.score-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; font-size: 14.5px; color: var(--text-2); }
.score-line .figure { font-size: 22px; color: var(--ink); }

/* ---------- Pace zones ---------- */

.ribbon-wrap { position: relative; margin-top: 34px; }
.ribbon { display: flex; gap: 3px; height: 54px; }
.ribbon-cell { position: relative; flex: var(--w) 1 0; min-width: 0; border-radius: 6px; background: var(--c); transform-origin: left center; }
.ribbon-cell:first-child { border-radius: 14px 6px 6px 14px; }
.ribbon-cell:last-child { border-radius: 6px 14px 14px 6px; }
.ribbon-cell span { position: absolute; left: 10px; top: 50%; translate: 0 -50%; font-size: 12px; font-weight: 600; color: #fff; opacity: .92; letter-spacing: .02em; }
.ribbon-ends { display: flex; justify-content: space-between; margin-top: 10px; font-family: var(--serif); font-style: italic; font-size: 14px; color: var(--secondary); }
.ribbon-pin { position: absolute; top: -10px; height: 74px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--ink); transition: left .7s var(--ease-out); }
.ribbon-pin::after { content: attr(data-label); position: absolute; bottom: calc(100% + 4px); left: 50%; translate: -50% 0; white-space: nowrap; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }

.zones { margin-top: 26px; border-top: 1px solid var(--hairline); }
.zone { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 2px 14px; align-items: baseline; padding: 15px 2px; border-bottom: 1px solid var(--hairline); }
.zone-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); align-self: center; }
.zone-name { font-size: 16px; font-weight: 500; }
.zone-name b { font-weight: 600; color: var(--secondary); margin-right: 6px; font-variant-numeric: tabular-nums; }
.zone .figure { font-size: clamp(22px, 2.8vw, 26px); text-align: right; }
.zone .figure em { font-style: normal; color: var(--secondary); margin: 0 .12em; }
.zone-use { grid-column: 2 / -1; font-size: 14.5px; line-height: 1.5; color: var(--text-2); max-width: 36em; }

/* ---------- Read ---------- */

.read { margin-top: clamp(64px, 9vw, 112px); }
.read .wrap { max-width: var(--measure); }
.read h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 3.6vw, 40px); line-height: 1.1; letter-spacing: -.02em; text-wrap: balance; margin: 56px 0 14px; }
.read h2:first-child { margin-top: 0; }
.read p, .read li { font-family: var(--serif); font-size: 19.5px; line-height: 1.62; color: color-mix(in srgb, var(--ink) 88%, var(--canvas)); text-wrap: pretty; }
.read p + p { margin-top: 1em; }
.read ul { margin: 1em 0; display: grid; gap: .5em; }
.read li { padding-left: 1.1em; position: relative; }
.read li::before { content: ""; position: absolute; left: 0; top: .72em; width: 6px; height: 6px; border-radius: 50%; background: var(--tertiary); }
.read a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--tertiary); }
.read a:hover { text-decoration-color: var(--ink); }
.read .sources { margin-top: 28px; font-family: var(--sans); font-size: 14px; color: var(--secondary); }
.read .sources p { font-family: var(--sans); font-size: 14px; color: var(--secondary); }

.qa { margin-top: 16px; border-top: 1px solid var(--hairline); }
.qa details { border-bottom: 1px solid var(--hairline); }
.qa summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 0; cursor: pointer; list-style: none; font-size: 17px; font-weight: 500; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary .icon { font-size: 18px; color: var(--secondary); transition: transform .35s var(--ease-out); }
.qa details[open] summary .icon { transform: rotate(45deg); }
.qa details p { padding: 0 0 20px; font-size: 18px; }

/* ---------- Strides does this for you ---------- */

.promo { margin-top: clamp(64px, 9vw, 104px); }
.promo-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 40px; align-items: center; padding: clamp(28px, 4vw, 48px); border-radius: var(--r-card); background: var(--inverted); color: var(--on-inverted); }
.promo-card h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 3.8vw, 44px); line-height: 1.06; letter-spacing: -.022em; text-wrap: balance; }
.promo-card p { margin-top: 12px; color: var(--on-inverted-2); max-width: 32em; }
.promo-card .pill { background: var(--on-inverted); color: #0b0b0c; }
@media (max-width: 760px) { .promo-card { grid-template-columns: minmax(0, 1fr); } }

.other-tool { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 14px; padding: 22px 26px; border-radius: var(--r-card); background: var(--card); box-shadow: inset 0 0 0 1px var(--card-edge); transition: transform .3s var(--ease); }
.other-tool:hover { transform: translateY(-2px); }
.other-tool h3 { font-family: var(--serif); font-weight: 400; font-size: 24px; letter-spacing: -.015em; }
.other-tool p { font-size: 15px; color: var(--text-2); margin-top: 2px; }
.other-tool .icon { font-size: 22px; flex: none; }

/* ---------- Tools index ---------- */

.tool-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 760px) { .tool-cards { grid-template-columns: minmax(0, 1fr); } }
.tool-card { display: flex; flex-direction: column; border-radius: var(--r-card); background: var(--card); box-shadow: inset 0 0 0 1px var(--card-edge); overflow: hidden; transition: transform .35s var(--ease); }
.tool-card:hover { transform: translateY(-3px); }
.tool-card-art { aspect-ratio: 16 / 9; background: var(--well); display: grid; place-items: center; }
.tool-card-art svg { width: 78%; height: auto; overflow: visible; }
.tool-card-body { padding: 24px 26px 26px; }
.tool-card h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 3vw, 32px); line-height: 1.1; letter-spacing: -.02em; }
.tool-card p { margin-top: 8px; color: var(--text-2); font-size: 16px; }
.tool-card .go { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; font-weight: 500; font-size: 15px; }
.tool-card .go .icon { transition: transform .3s var(--ease-out); }
.tool-card:hover .go .icon { transform: translateX(3px); }

/* Card art: the track and the ribbon, drawn once as each card arrives. */
.art-track .lane { fill: none; stroke: var(--strong-hairline); stroke-width: 1.2; }
.art-track .kerb { fill: none; stroke: var(--tertiary); stroke-width: 1.4; }
.art-track .run { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.art-track .line { stroke: var(--ink); stroke-width: 2; }
.art-ribbon rect { transform-box: fill-box; transform-origin: left center; }
.js .tool-card[data-reveal] .art-track .run { stroke-dasharray: var(--len) var(--len); stroke-dashoffset: var(--len); }
.js .tool-card[data-reveal].is-visible .art-track .run { stroke-dashoffset: calc(var(--len) * .14); transition: stroke-dashoffset 1.8s var(--ease-out) .3s; }
.js .tool-card[data-reveal] .art-ribbon rect { transform: scaleX(0); }
.js .tool-card[data-reveal].is-visible .art-ribbon rect { transform: none; transition: transform .9s var(--ease-out); transition-delay: calc(var(--i) * 80ms + 300ms); }

@media (prefers-reduced-motion: reduce) {
  .js .tool-card[data-reveal] .art-track .run { stroke-dashoffset: 0; }
  .js .tool-card[data-reveal] .art-ribbon rect { transform: none; }
}

/* Race conditions and goal equivalence tables. */
.input-stack { display: grid; gap: 14px; }
.conditions-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.conditions-head h2 { font-size: 18px; font-weight: 500; }
.conditions-head .text-button { padding: 0; }
.control-grid fieldset { border: 0; border-top: 1px solid var(--hairline); padding: 14px 0 0; min-width: 0; margin: 0; }
.control-grid legend { float: left; width: 100%; font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: 10px; padding: 0; }
.control-grid fieldset > .control-pair { clear: both; }
.control-grid [data-custom] { margin-top: 12px; }
.control-grid .control-note { font-size: 12px; margin-bottom: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.condition-error { color: var(--worse); }
.control-note { color: var(--text-2); font-size: 14px; line-height: 1.5; margin: 12px 0; }
.control-grid { display: grid; gap: 14px; margin-top: 18px; }
.control-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.control-pair[hidden], [data-custom-note][hidden] { display: none; }
.control-grid label, .goal-controls label { display: grid; gap: 7px; color: var(--text-2); font-size: 13px; min-width: 0; }
.control-grid input, .control-grid select, .goal-controls input, .goal-controls select { width: 100%; min-width: 0; height: 44px; padding: 10px; border: 1px solid var(--strong-hairline); border-radius: 10px; background: var(--well); color: var(--ink); font: inherit; font-size: 16px; }
.text-button { padding: 10px 0; background: none; border: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 4px; font: inherit; font-size: 14px; cursor: pointer; }
.condition-breakdown { margin-top: 24px; border-top: 1px solid var(--hairline); padding-top: 20px; }
.condition-breakdown > div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.condition-breakdown .label { margin-bottom: 10px; }
.breakdown-total { border-top: 1px solid var(--hairline); margin-top: 6px; }
.track-stage.is-road .track-infield { place-content: start center; padding-top: 5px; }
.track-stage canvas[hidden] { display: none; }
.equivalence-section { margin-top: 24px; }
.equivalence-section h2 { font: 400 clamp(26px, 4vw, 36px)/1.1 var(--serif); }
.goal-controls { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-top: 24px; }
.goal-ruler { padding-top: 24px; }
.goal-ruler input { display: block; width: 100%; height: 44px; accent-color: var(--ink); cursor: ew-resize; background: repeating-linear-gradient(90deg, var(--strong-hairline) 0 1px, transparent 1px 12px) center / 100% 18px no-repeat; }
.ruler-ends { display: flex; justify-content: space-between; color: var(--secondary); font-size: 12px; }
.table-scroll { overflow-x: auto; }
.equivalence-section table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin-top: 24px; }
.equivalence-section caption { text-align: left; font-weight: 500; font-size: 18px; padding-bottom: 14px; }
.equivalence-section th, .equivalence-section td { padding: 13px 8px; text-align: right; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.equivalence-section th:first-child { text-align: left; padding-left: 0; }
.equivalence-section th { font-weight: 500; }
.equivalence-section thead { color: var(--secondary); font-size: 12px; }
.equivalence-section td { font-size: 17px; }
.equivalence-section td small { display: block; color: var(--secondary); font-size: 11px; margin-top: 4px; }
.rep-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
[aria-invalid="true"] { outline: 2px solid var(--worse); }
@media (max-width: 600px) {
  .prediction .figure { font-size: 25px; }
  .prediction-name { font-size: 14px; }
  .prediction-pace { font-size: 12px; }
  .rep-tables { grid-template-columns: 1fr; gap: 0; }
  .goal-controls { grid-template-columns: 1fr 1fr; }
  .goal-controls label:last-child { grid-column: 1 / -1; }
  .equivalence-section .panel-head { align-items: start; flex-direction: column; }
  .equivalence-section td { font-size: 14px; }
  .track-infield .caption { font-size: 11px; }
}
.goal-ruler { background: repeating-linear-gradient(90deg, var(--strong-hairline) 0 1px, transparent 1px 12px) left 28px / 100% 24px no-repeat; }
[data-training] { table-layout: fixed; }
[data-training] th:first-child { width: 28%; }
.equivalence-section [data-training] td small { white-space: normal; }
@media (max-width: 600px) {
  .track-stage.is-road { aspect-ratio: 16 / 10; }
  .equivalence-section [data-training] th, .equivalence-section [data-training] td { padding-inline: 3px; font-size: 12px; }
  .equivalence-section [data-training] td small { font-size: 10px; }
}

.control-grid select, .goal-controls select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23808085' stroke-width='1.5'/%3E%3C/svg%3E"); background-position: right 12px center; background-repeat: no-repeat; }
.control-grid input::-webkit-inner-spin-button, .control-grid input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.control-grid input[type="number"] { -moz-appearance: textfield; }
.track-stage { max-height: 300px; }
.track-stage.is-road { aspect-ratio: 16 / 6.8; }
@media (min-width: 901px) { .calc > .answer { position: sticky; top: 88px; } }
@media (max-width: 600px) {
  .track-stage.is-road { aspect-ratio: 16 / 8; }
  .prediction-pace { font-size: 12px; }
  .predictions th, .predictions td { padding-block: 14px; }
  .control-grid input, .control-grid select { font-size: 14px; }
}
