/* K1 Stats: the stylesheet of all pages of the service.
   docs/ui-design.md describes the direction, the tokens and the components.
   tools/session_explorer.html has a copy of the tokens. Change a value in the two files together.

   Direction: a precision instrument for a sport. Warm neutral paper, ink for text and actions,
   colour only for data. Text and tables are on the paper. Only charts and tools are on a plate.

   Contents: 1 tokens, 2 base, 3 shell, 4 sections and text, 5 controls, 6 numbers, 7 left and right,
   8 tables, 9 charts, 10 pages, 11 small screens. */

/* ---------------------------------------------------------------- 1 tokens */
:root {
  --bg: #f5f3ee; --surface: #fdfcfa; --sunk: #ece9e1;
  --ink: #1b1a17; --ink-2: #4a4841; --muted: #6b685f;
  --rule: #e2ded4; --rule-strong: #c9c4b7; --line: #34322c; --band: rgba(27, 26, 23, .055);
  /* Actions use the ink colour. The interface has no accent colour: colour is for data. */
  --accent: #1b1a17; --accent-ink: #f5f3ee;
  /* Green shows only a selection in a chart, as in the explorer page. */
  --select: #1baf7a; --select-fill: rgba(27, 175, 122, .1);
  /* Blue is always the left stroke. Orange is always the right stroke. */
  --left: #2a78d6; --right: #eb6834;
  --bad: #a8281c; --bad-wash: rgba(168, 40, 28, .07);
  --plate-ring: 0 0 0 1px rgba(27, 26, 23, .05), 0 1px 2px rgba(27, 26, 23, .04);
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 14px; --radius-s: 8px;
  --page: 1120px; --gutter: 32px; --bar-h: 60px; --tabs-h: 0px; --gap: 48px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1a18; --surface: #252422; --sunk: #141312;
    --ink: #f2efe8; --ink-2: #c6c2b8; --muted: #9d998f;
    --rule: #33312d; --rule-strong: #4d4a44; --line: #d8d4ca; --band: rgba(242, 239, 232, .07);
    --accent: #f2efe8; --accent-ink: #1b1a18;
    --select: #199e70; --select-fill: rgba(25, 158, 112, .2);
    --left: #3987e5; --right: #d95926;
    --bad: #f08a7c; --bad-wash: rgba(240, 138, 124, .1);
    --plate-ring: 0 0 0 1px rgba(242, 239, 232, .05);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1a18; --surface: #252422; --sunk: #141312;
  --ink: #f2efe8; --ink-2: #c6c2b8; --muted: #9d998f;
  --rule: #33312d; --rule-strong: #4d4a44; --line: #d8d4ca; --band: rgba(242, 239, 232, .07);
  --accent: #f2efe8; --accent-ink: #1b1a18;
  --select: #199e70; --select-fill: rgba(25, 158, 112, .2);
  --left: #3987e5; --right: #d95926;
  --bad: #f08a7c; --bad-wash: rgba(240, 138, 124, .1);
  --plate-ring: 0 0 0 1px rgba(242, 239, 232, .05);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- 2 base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.55 var(--font); min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
h1, h2, h3 { font-weight: 500; line-height: 1.15; text-wrap: balance; }
h1 { font-size: 34px; letter-spacing: -.022em; }
h2 { font-size: 20px; letter-spacing: -.012em; }
h3 { font-size: 16px; font-weight: 600; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: currentColor; }
code { font-family: var(--font-mono); font-size: .9em; background: var(--sunk); border-radius: 4px; padding: 1px 5px; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: var(--radius-s); z-index: 20; text-decoration: none; }
.skip:focus { top: 8px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------------------------------------------------------------- 3 shell */
/* The bar has a plain background. A filter on the bar moves the fixed navigation of the phone layout into the bar. */
.bar { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--rule); background: var(--bg); }
.bar-in { max-width: calc(var(--page) + 2 * var(--gutter)); margin: 0 auto; height: var(--bar-h); display: flex; align-items: stretch; gap: 40px;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px)); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 600 17px/1 var(--font); letter-spacing: -.012em; white-space: nowrap; }
.brand svg { width: 26px; height: 17px; flex: none; }
.brand .tag { font: 400 12.5px/1 var(--font); color: var(--muted); letter-spacing: 0; background: var(--sunk); border-radius: 5px; padding: 4px 7px; }
.nav { display: flex; align-items: stretch; gap: 26px; }
.nav a { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14.5px;
  border-bottom: 1.5px solid transparent; border-top: 1.5px solid transparent; margin-bottom: -1px; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.nav svg { width: 22px; height: 22px; display: none; }
.who { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 14.5px; }
.who a { color: var(--muted); text-decoration: none; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who a:hover { color: var(--ink); }
/* The state of the Garmin connection in the top bar. A text and a dot: colour is not the only signal. */
.who a.tag-state { max-width: none; font-size: 13.5px; color: var(--ink-2); }
.who a.tag-state.off { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
/* The Garmin attribution: "Garmin [device model]" next to the title of each view of device data. */
.source { margin: 4px 0 0; font: 500 12.5px/1.3 var(--mono, ui-monospace, monospace); letter-spacing: .03em; color: var(--ink-2); }
span.source { margin: 0; }
/* The full name of the Garmin application with its tile, where a person connects. The tile is not changed. */
.garmin-app { display: flex; align-items: center; gap: 12px; margin: 0; font-weight: 500; }
.garmin-app img { border-radius: 22%; flex: none; }
ul.plain, ol.plain { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--ink-2); }

.wrap { width: 100%; max-width: calc(var(--page) + 2 * var(--gutter)); margin: 0 auto; flex: 1; display: flex; flex-direction: column; gap: var(--gap); padding-block: 44px 72px;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px)); }
.wrap.narrow { max-width: calc(30rem + 2 * var(--gutter)); margin-left: max(0px, calc((100% - var(--page) - 2 * var(--gutter)) / 2)); padding-top: 72px; gap: 24px; }
.foot { border-top: 1px solid var(--rule); color: var(--muted); font-size: 13.5px; }
.foot-in { max-width: calc(var(--page) + 2 * var(--gutter)); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 6px 26px; padding-block: 22px calc(22px + var(--tabs-h));
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px)); }
.foot span:last-child { margin-left: auto; }

/* ---------------------------------------------------------------- 4 sections and text
   A section is on the paper, with one thin line above it. A plate is a lighter surface: only charts and tools use it. */
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; }
.head .sub { color: var(--ink-2); margin-top: 8px; max-width: 62ch; }
.back { font-size: 14px; color: var(--muted); text-decoration: none; display: inline-block; margin-bottom: 10px; }
.back::before { content: "‹"; margin-right: 6px; }
.back:hover { color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.panel { display: flex; flex-direction: column; gap: 20px; min-width: 0; padding-top: 22px; border-top: 1px solid var(--rule-strong); }
.panel.plate, .plate { background: var(--surface); border: 0; border-radius: var(--radius); padding: 24px 26px 22px; box-shadow: var(--plate-ring); }
.panel.bare { border-top: 0; padding-top: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 24px; }
.panel-head > a, .more-link { font-size: 14.5px; color: var(--ink-2); }
h2 .u { color: var(--muted); font: 400 12.5px var(--font-mono); margin-left: 8px; letter-spacing: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: var(--gap) 56px; align-items: start; }
.cols.wide-left { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
/* A section with its heading in a column on the left, as a data sheet. */
.spec { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px 56px; }
.spec > .body { display: flex; flex-direction: column; gap: 16px; min-width: 0; max-width: 68ch; }
.spec > .body.full { max-width: none; }
.spec > .terms.body, .spec > .steps.body { gap: 0; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 13.5px; line-height: 1.5; max-width: 76ch; }
.bad { color: var(--bad); }
.lead { font-size: 20px; line-height: 1.45; color: var(--ink-2); max-width: 46ch; letter-spacing: -.005em; }
.note { background: var(--sunk); padding: 12px 16px; border-radius: var(--radius-s); max-width: 76ch; font-size: 15px; }
.note.bad { background: var(--bad-wash); color: var(--ink); }
.note.bad::before { content: "Error. "; font-weight: 600; color: var(--bad); }
.facts { display: flex; flex-wrap: wrap; gap: 4px 22px; color: var(--muted); font-size: 15px; }
.facts b { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.item-title { font: 500 22px/1.25 var(--font); letter-spacing: -.015em; }
.item-title a { text-decoration: none; }
.item-title a:hover { text-decoration: underline; }
/* Rows of a term and its description, with a thin line between the rows. */
.terms { display: flex; flex-direction: column; }
.terms > div { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 4px 32px; padding: 13px 0; border-top: 1px solid var(--rule); font-size: 15px; }
.terms > div:first-child { border-top: 0; padding-top: 0; }
.terms dt { font-weight: 500; color: var(--ink); }
.terms dd { color: var(--ink-2); max-width: 60ch; }
.empty { max-width: 60ch; color: var(--ink-2); }

/* The approved legal texts (privacy.html, terms.html) use these classes. */
.doc { max-width: 72ch; gap: 14px; border-top: 0; padding-top: 0; }
.doc h2 { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--rule); }
.doc h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; font-size: 34px; letter-spacing: -.022em; }
.doc ul { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.doc li::marker { color: var(--muted); }
.doc a { color: var(--ink); }
.doc td, .doc th { white-space: normal; vertical-align: top; font-family: var(--font); text-align: left; }

/* ---------------------------------------------------------------- 5 controls */
.btn, button { font: 500 15px/1 var(--font); letter-spacing: -.003em; border-radius: var(--radius-s); padding: 0 16px; height: 40px; cursor: pointer; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.btn:hover, button:hover { opacity: .86; }
.btn.quiet, button.quiet, button.plain { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn.quiet:hover, button.quiet:hover, button.plain:hover { background: var(--band); opacity: 1; }
.btn.danger, button.danger { background: var(--bad); color: var(--bg); }
.btn.small, button.small { height: 32px; padding: 0 11px; font-size: 14px; }
.btn.large { height: 46px; padding: 0 20px; font-size: 16px; }
button.textual { background: none; border: 0; height: auto; padding: 0; color: var(--muted); font-weight: 400; font-size: inherit; }
button.textual:hover { color: var(--ink); opacity: 1; }
button:disabled { opacity: .5; cursor: default; }
form.fields { display: flex; flex-wrap: wrap; gap: 14px 16px; align-items: flex-end; }
form.col { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--muted); min-width: 0; flex: 1 1 220px; }
input[type="text"], input[type="file"] { font: 16px var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--rule-strong); border-radius: var(--radius-s); padding: 8px 12px; width: 100%; height: 40px; }
.plate input[type="text"], .plate input[type="file"] { background: var(--bg); }
input[type="text"]:focus-visible, input[type="file"]:focus-visible { outline-offset: 0; border-color: var(--ink); }
input[type="file"] { padding: 5px 6px; font-size: 15px; }
input[type="file"]::file-selector-button { font: 500 13.5px var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 5px; padding: 4px 10px; margin-right: 10px; cursor: pointer; }
input[type="checkbox"] { accent-color: var(--ink); width: 17px; height: 17px; flex: none; }
label.check { display: flex; align-items: center; gap: 10px; }
.seg { display: inline-flex; border-radius: 10px; padding: 3px; background: var(--sunk); }
.seg a { padding: 6px 14px; border-radius: 7px; font-size: 14.5px; font-weight: 500; color: var(--muted); text-decoration: none; white-space: nowrap; }
.seg a:hover { color: var(--ink); }
.seg a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--plate-ring); }
details.more > summary { cursor: pointer; color: var(--muted); width: fit-content; font-size: 15px; }
details.more > summary:hover { color: var(--ink); }
details.more[open] > summary { margin-bottom: 14px; }
.tag-state { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.tag-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.tag-state.on::before { background: var(--select); }
.tag-state.busy::before { width: 10px; height: 10px; background: transparent; border: 1.5px solid var(--ink-2); border-right-color: transparent; animation: turn 1s linear infinite; }
.tag-state.failed { color: var(--bad); } .tag-state.failed::before { background: var(--bad); }

/* ---------------------------------------------------------------- 6 numbers
   A readout is a row of large numbers with a thin line between them, as the fields of an instrument. */
.readout { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 22px 0; margin-left: -24px; overflow: hidden; }
.stat { padding: 2px 16px 2px 24px; box-shadow: -1px 0 0 var(--rule-strong); min-width: 0; }
.stat .k { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.stat .v { font: 500 30px/1.05 var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.035em; white-space: nowrap; }
.stat .u { font: 400 13px/1 var(--font); color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.stat .d { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 6px; }
.readout.small { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.readout.small .stat .v { font-size: 22px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num, .mono { font-family: var(--font-mono); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2.5px; vertical-align: 0; margin-right: 6px; }
.sw.left, .fill.left { background: var(--left); } .sw.right, .fill.right { background: var(--right); }
.sw.line { background: var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-2); align-items: center; }

/* ---------------------------------------------------------------- 7 left and right
   One row compares a left value and a right value. The left value is on the left side of a centre line,
   as the boat shows from above. The bar goes from the centre to the side with the larger value. */
.lr-list { display: flex; flex-direction: column; }
.lr { display: grid; grid-template-columns: minmax(78px, max-content) minmax(60px, 1fr) minmax(78px, max-content); align-items: center; gap: 10px 16px; padding: 16px 0; border-top: 1px solid var(--rule); }
.lr:first-child { border-top: 0; padding-top: 0; } .lr:last-child { padding-bottom: 0; }
.lr-name { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; align-items: baseline; font-size: 15px; }
.lr-name b { font-weight: 500; } .lr-name .u { color: var(--muted); font-size: 13px; margin-left: 6px; }
.lr-name .diff { font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.lr-val { font: 500 19px/1 var(--font-mono); letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.lr-val .side { font: 500 13px/1 var(--font); letter-spacing: 0; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.lr-val .side .sw { margin: 0; }
.lr-val.r { justify-content: flex-end; }
.track { position: relative; height: 6px; background: var(--sunk); border-radius: 3px; }
.track::before { content: ""; position: absolute; left: 50%; top: -6px; bottom: -6px; width: 1.5px; margin-left: -.75px; background: var(--ink); border-radius: 1px; z-index: 1; }
.track .tick { position: absolute; top: 1px; bottom: 1px; width: 1px; background: var(--rule-strong); }
.track .fill { position: absolute; top: 0; bottom: 0; }
.track .fill.right { left: 50%; border-radius: 0 3px 3px 0; transform-origin: left center; }
.track .fill.left { right: 50%; border-radius: 3px 0 0 3px; transform-origin: right center; }
.track.mini { display: inline-block; width: 60px; height: 5px; vertical-align: middle; margin-right: 10px; }
.track.mini::before { top: -4px; bottom: -4px; }
@media (prefers-reduced-motion: no-preference) {
  .lr .track .fill { animation: settle .5s cubic-bezier(.2, .8, .2, 1) both; }
  @keyframes settle { from { transform: scaleX(0); } }
}
@keyframes turn { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- 8 tables */
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th { color: var(--muted); font-weight: 400; font-size: 13px; vertical-align: bottom; padding-top: 0; padding-bottom: 9px; border-bottom-color: var(--rule-strong); }
th:first-child, td:first-child { padding-left: 0; } th:last-child, td:last-child { padding-right: 0; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody tr:hover td { background: var(--band); }
td.num { font-size: 14px; }
td .where { display: block; color: var(--muted); font-size: 13px; font-family: var(--font); margin-top: 1px; }
td a.title { font-weight: 500; color: var(--ink); text-decoration: none; }
td a.title:hover { text-decoration: underline; }
td.wrap-ok { white-space: normal; min-width: 180px; }
tr.sum td { font-weight: 500; border-top: 1px solid var(--ink); }
tr.sum:hover td { background: none; }
table.dense th, table.dense td { padding-left: 8px; padding-right: 8px; }
table.dense th:first-child, table.dense td:first-child { padding-left: 0; }
table.dense th:last-child, table.dense td:last-child { padding-right: 0; }
table.sticky th:first-child, table.sticky td:first-child { position: sticky; left: 0; background: var(--bg); padding-right: 12px; z-index: 1; }
.kv th { width: 180px; font-size: 14.5px; padding-top: 11px; padding-bottom: 11px; border-bottom-color: var(--rule); color: var(--muted); }
.kv td { white-space: normal; }
.kind { display: inline-block; min-width: 28px; text-align: center; font: 500 12px/1 var(--font-mono); padding: 4px 5px; border-radius: 4px; margin-right: 8px; border: 1px solid var(--rule-strong); color: var(--ink-2); }
.kind.effort { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------------------------------------------------------------- 9 charts
   The new charts use the drawing style of the explorer page: thin grid lines, lines of 2 px,
   axis text in the mono font, the unit in brackets after the title. */
.chart-block { display: flex; flex-direction: column; gap: 8px; }
.chart-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 16px; font-size: 15px; }
.chart-title b { font-weight: 500; } .chart-title .u { color: var(--muted); font: 12.5px var(--font-mono); margin-left: 8px; }
.chart { position: relative; height: 132px; margin: 6px 0 24px 38px; }
.chart.tall { height: 240px; }
.chart.short { height: 150px; }
.chart > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart line, .chart polyline, .chart polygon { vector-effect: non-scaling-stroke; }
.chart .g { stroke: var(--rule); stroke-width: 1; }
.chart .g.zero { stroke: var(--muted); }
.chart polyline { fill: none; stroke: var(--line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart polyline.left { stroke: var(--left); } .chart polyline.right { stroke: var(--right); }
.chart.bold polyline { stroke-width: 2.5; }
.chart polygon.area { fill: var(--band); stroke: none; }
.yt, .xt { position: absolute; font: 11px/1 var(--font-mono); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.yt { right: 100%; margin-right: 8px; transform: translateY(-50%); }
.xt { top: 100%; margin-top: 8px; transform: translateX(-50%); }
.xt.first { transform: none; } .xt.last { transform: translateX(-100%); }
.pt { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--line); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.pt.left { background: var(--left); } .pt.right { background: var(--right); }
.pt.few { background: var(--surface); border: 2px solid var(--line); } .pt.few.left { border-color: var(--left); } .pt.few.right { border-color: var(--right); }
.pt.hot { transform: scale(1.35); }
.barv { position: absolute; width: 10px; margin-left: -5px; pointer-events: none; }
.barv.right { background: var(--right); border-radius: 3px 3px 0 0; } .barv.left { background: var(--left); border-radius: 0 0 3px 3px; }
.barv.few { opacity: .45; }
.hit { position: absolute; top: -4px; bottom: -22px; padding: 0; height: auto; border: 0; border-radius: 4px; background: transparent; cursor: pointer; }
.hit:hover, .hit.hot { background: var(--band); opacity: 1; }
.hit.on { background: var(--select-fill); box-shadow: inset 0 0 0 1.5px var(--select); }
.end-label { position: absolute; font: 500 11.5px/1 var(--font-mono); color: var(--ink-2); transform: translate(9px, -50%); background: var(--surface); padding: 2px 4px; border-radius: 3px; white-space: nowrap; }
.chart-readout { font: 12.5px/1.6 var(--font-mono); color: var(--ink-2); min-height: 2.9em; font-variant-numeric: tabular-nums; display: flex; flex-wrap: wrap; gap: 0 20px; align-items: center;
  padding-bottom: 14px; border-bottom: 1px solid var(--rule); }
.chart-readout b { font-weight: 500; color: var(--ink); } .chart-readout a { font-family: var(--font); font-size: 14px; margin-left: auto; }
.band { position: absolute; top: 0; bottom: 0; }
.band.effort { background: var(--band); }
.band span { position: absolute; bottom: 100%; margin-bottom: 4px; left: 50%; transform: translateX(-50%); font: 11px/1 var(--font-mono); color: var(--muted); }
.band span b { font-weight: 400; }
.band.narrow span { display: none; }
.chart.banded { margin-top: 22px; }
.spark { position: relative; height: 36px; }
.spark > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.spark polyline { fill: none; stroke: var(--line); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.spark line { stroke: var(--rule-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark polyline.left { stroke: var(--left); } .spark polyline.right { stroke: var(--right); }
.spark .pt { width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; box-shadow: 0 0 0 2px var(--bg); }
.trend-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, 1.3fr) minmax(84px, auto); gap: 18px; align-items: center; padding: 14px 0; border-top: 1px solid var(--rule); }
.trend-row:first-child { border-top: 0; padding-top: 0; } .trend-row:last-child { padding-bottom: 0; }
.trend-row .now { font: 500 17px/1.2 var(--font-mono); letter-spacing: -.02em; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.trend-row .name { font-size: 15px; }
.trend-row .name small { display: block; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- 10 pages */
/* Start page. The headline and the product view carry the page. */
.hero { padding-block: 40px 8px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .86fr); gap: 32px 56px; align-items: center; }
.hero-text { display: flex; flex-direction: column; gap: 26px; align-items: flex-start; min-width: 0; }
/* The picture of the watch on the boat. The pages of the watch application move across the watch display. */
.hero-shot { position: relative; margin: 0; }
.hero-shot > img { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: 20px; background: #2b5f7c; }
.hero-shot figcaption { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
/* The display circle of the picture: centre and radius measured in the image, in percent of its size. */
.hero-shot .screen { position: absolute; left: 38.415%; top: 0; margin-top: 48.938%; width: 23.154%; aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: #000; }
.hero-shot .strip { display: flex; flex-direction: column; animation: watch-pages 17.5s cubic-bezier(.6, 0, .25, 1) infinite; will-change: transform; }
.hero-shot .strip img { display: block; width: 100%; height: auto; aspect-ratio: 1; }
/* A dark edge and a weak reflection, so that the pages look like a part of the picture. */
.hero-shot .screen::after { content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  box-shadow: inset 0 0 .45em .1em rgba(0, 0, 0, .9);
  background: linear-gradient(140deg, rgba(255, 255, 255, .09) 0%, rgba(255, 255, 255, 0) 36%); }
/* Each page stays for some seconds, then the next page moves up, as on the watch. The last image is the first page again. */
@keyframes watch-pages {
  0%, 16% { transform: translateY(0); }
  20%, 36% { transform: translateY(-16.6667%); }
  40%, 56% { transform: translateY(-33.3333%); }
  60%, 76% { transform: translateY(-50%); }
  80%, 96% { transform: translateY(-66.6667%); }
  100% { transform: translateY(-83.3333%); }
}
@media (prefers-reduced-motion: reduce) { .hero-shot .strip { animation: none; } }
@media (max-width: 860px) { .hero { grid-template-columns: minmax(0, 1fr); } .hero-shot { max-width: 520px; } }
.hero h1 { font-size: clamp(40px, 6.4vw, 72px); line-height: 1; letter-spacing: -.038em; max-width: 13ch; font-weight: 500; }
.hero .lead { max-width: 44ch; }
.hero .actions { gap: 12px 20px; }
.hero-text > .hint { margin-top: -10px; }
/* The product view: a plate with a header and a caption that do not move, and a row of slides between them.
   The row has a fixed height, thus the length of the page does not change with the slide. */
.product { display: flex; flex-direction: column; gap: 20px; padding: 28px 32px 22px; }
.product > header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 24px; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.product > header h2 { font-size: 17px; letter-spacing: -.01em; }
.slides { display: flex; height: 318px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scroll-behavior: smooth; overscroll-behavior-x: contain; border-radius: 4px; }
.slides.js { scrollbar-width: none; } .slides.js::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; min-width: 0; height: 100%; overflow: hidden; scroll-snap-align: start; scroll-snap-stop: always;
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px 56px; padding: 0 2px; }
.slide .chart { margin-bottom: 22px; }
.product .side-col { display: flex; flex-direction: column; gap: 24px; justify-content: center; min-width: 0; }
.product .stat { padding-left: 0; box-shadow: none; }
.say { font-size: 17px; line-height: 1.4; letter-spacing: -.008em; max-width: 30ch; text-wrap: pretty; }
.slide-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; padding-top: 14px; border-top: 1px solid var(--rule); }
.slide-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.slide-nav button { width: 32px; height: 32px; border-radius: 8px; color: var(--ink-2); }
.slide-nav button:hover { background: var(--band); color: var(--ink); }
.slide-nav button svg { width: 20px; height: 20px; display: block; }
.slide-nav button[data-play] { margin-left: 6px; }
/* The last button shows what a click does: "stop" while the slides change, "start" while they do not change. */
.slide-nav .when-off, .slide-nav button[data-stopped="true"] .when-on { display: none; }
.slide-nav button[data-stopped="true"] .when-off { display: block; }
/* Each mark is a short line. The line of the slide in view is longer and has the ink colour. */
.dots { display: flex; align-items: center; }
.dots a { display: block; padding: 14px 4px; }
.dots a::before { content: ""; display: block; width: 14px; height: 3px; border-radius: 2px; background: var(--rule-strong); transition: width .25s, background-color .25s; }
.dots a:hover::before { background: var(--muted); }
.dots a[aria-current="true"]::before { width: 28px; background: var(--ink); }
/* Charts of the slides. A wash is the area below a step line. A dot is a short line with round ends. */
.chart polygon.wash { stroke: none; opacity: .16; }
.chart polygon.wash.left { fill: var(--left); } .chart polygon.wash.right { fill: var(--right); }
.chart path.dots { fill: none; stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke; opacity: .5; }
.chart path.dots.left { stroke: var(--left); } .chart path.dots.right { stroke: var(--right); }
@media (prefers-reduced-motion: reduce) { .slides { scroll-behavior: auto; } .dots a::before { transition: none; } }
.steps { list-style: none; padding: 0; counter-reset: step; display: flex; flex-direction: column; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 4px 32px; padding: 13px 0; border-top: 1px solid var(--rule); font-size: 15px; }
.steps li:first-child { border-top: 0; padding-top: 0; }
.steps b { font-weight: 500; } .steps b::before { content: counter(step); font: 400 13px var(--font-mono); color: var(--muted); margin-right: 14px; }
.steps span { color: var(--ink-2); max-width: 60ch; }

/* Watch application page. The frame of each picture is a plain dark ring. It is not a picture of a real watch. */
.screens { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px 28px; }
.screens figure { display: flex; flex-direction: column; gap: 14px; }
.watch { width: 100%; max-width: 212px; aspect-ratio: 1; border-radius: 50%; background: #0b0b0a; padding: 4%; box-shadow: 0 0 0 1px var(--rule-strong), 0 0 0 5px var(--sunk); }
.watch img { display: block; width: 100%; height: 100%; border-radius: 50%; }
.screens figcaption b { display: block; font-weight: 500; font-size: 15px; }
.screens figcaption span { color: var(--ink-2); font-size: 14px; line-height: 1.45; display: block; margin-top: 2px; }
.store { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; }

.session-title { display: flex; flex-direction: column; gap: 10px; min-width: 0; align-items: flex-start; }
.session-title h1 { overflow-wrap: anywhere; }

/* Parts for the coach pages (work package 2). No page uses them at this time. docs/ui-design.md shows their use. */
.delta { display: inline-block; font: 400 12px/1 var(--font-mono); color: var(--muted); margin-left: 8px; font-variant-numeric: tabular-nums; }
.delta.strong { color: var(--ink); font-weight: 500; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); background: var(--sunk); border-radius: 6px; padding: 3px 8px; white-space: nowrap; }
.tag.on { color: var(--bg); background: var(--ink); }
.request { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 16px 0; border-top: 1px solid var(--rule); }
.request:first-child { border-top: 0; padding-top: 0; }
.request .who-what b { font-weight: 500; } .request .who-what small { display: block; color: var(--muted); font-size: 13.5px; }
.choice { display: grid; gap: 10px; }
.choice label { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 14px 16px; border: 1px solid var(--rule-strong); border-radius: var(--radius-s); cursor: pointer; }
.choice label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice small { grid-column: 2; color: var(--ink-2); font-size: 14px; }
.compare { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 40px; overflow-x: auto; }

/* ---------------------------------------------------------------- 11 small screens
   A phone shows the navigation as a bar at the bottom of the screen, in reach of the thumb. */
@media (max-width: 899px) {
  .spec { grid-template-columns: 1fr; gap: 16px; }
  .cols.wide-left { grid-template-columns: 1fr; }
  .product { padding: 22px 22px 16px; }
  .slides { height: 540px; }
  .slide { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 4px; padding-right: 12px; }
  .slide .chart.tall { height: 200px; }
  .product .side-col { justify-content: flex-start; gap: 18px; }
  .say { max-width: 44ch; }
}
@media (max-width: 759px) {
  :root { --gutter: 18px; --tabs-h: calc(58px + env(safe-area-inset-bottom, 0px)); --bar-h: 52px; --gap: 34px; }
  body.app .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--bg); border-top: 1px solid var(--rule);
    padding-bottom: env(safe-area-inset-bottom, 0px); gap: 0; justify-content: space-around; height: var(--tabs-h); }
  body.app .nav a { flex: 1; flex-direction: column; justify-content: center; gap: 4px; font-size: 11.5px; border-bottom: 0; margin: 0; }
  body.app .nav a[aria-current="page"] { border-top-color: var(--ink); }
  .nav svg { display: block; }
  .who .name, .who form { display: none; }
  h1 { font-size: 28px; } h2 { font-size: 19px; }
  .wrap { padding-block: 26px 40px; }
  .wrap.narrow { padding-top: 36px; }
  .panel.plate, .plate { padding: 18px 18px 16px; border-radius: 12px; }
  .hero { padding-block: 14px 0; gap: 20px; }
  .lead { font-size: 18px; }
  .stat .v { font-size: 26px; }
  .readout, .readout.small { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-left: -18px; }
  .stat { padding-left: 18px; }
  .btn, button { height: 44px; }
  .btn.small, button.small { height: 36px; }
  input[type="text"], input[type="file"] { height: 44px; }
  .lr-val { font-size: 17px; }
  .chart { margin-left: 32px; }
  .band.medium span b, .band.medium.paddle span { display: none; }
  .chart.many .pt { width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; box-shadow: 0 0 0 1px var(--surface); }
  .chart.many .barv { width: 6px; margin-left: -3px; border-radius: 2px 2px 0 0; }
  .chart.many .barv.left { border-radius: 0 0 2px 2px; }
  .trend-row { grid-template-columns: 1fr auto; } .trend-row .spark { grid-column: 1 / -1; grid-row: 2; }
  .terms > div, .steps li { grid-template-columns: 1fr; }
  .screens { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 18px; }
  .foot span:last-child { margin-left: 0; }

  /* A table with the class "cards" shows each row as a block on a phone. */
  table.cards thead { display: none; }
  table.cards tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
  table.cards tbody tr:last-child { border-bottom: 0; padding-bottom: 0; } table.cards tbody tr:first-child { padding-top: 0; }
  table.cards td { border: 0; padding: 0; text-align: left; white-space: normal; background: none !important; }
  table.cards td[data-k]::before { content: attr(data-k); display: block; font: 400 12.5px/1.4 var(--font); color: var(--muted); }
  table.cards td.main, table.cards td.full { grid-column: 1 / -1; }
  table.cards td.main { order: -1; } table.cards td.full { order: 1; }
  table.cards td.main a.title { font-size: 17px; letter-spacing: -.01em; }
  table.cards td.none { display: none; }
}
@media (min-width: 760px) {
  .only-phone { display: none !important; }
}
@media print {
  .bar, .foot, .nav, .actions { display: none !important; }
  body { background: #fff; }
}
