/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / JScms                         # ||
|| # ----------------------------------------- # ||
|| # Copyright 2026 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/

/*
  TERRAVITA: the parcours panel, the stop list, and the figures.

  The panel reuses the loop panel's controls wholesale, .tleagues-loop-start,
  .tleagues-stepper, .tleagues-select, .tleagues-loop-go: it asks the same
  three questions and a second set of controls that looked almost the same
  would be a second set to keep in step. What is here is only what TerraVita
  adds, which is the stop list and the drawings.
*/

/* ------------------------------------------------------- the qualities ----

  Three hues already in the palette, and three clearly different ones at the
  20mm a figure is drawn at. Olive for what the legs do, gold for what the
  joints do, terracotta for what has to be pushed. Coordination shares gold
  with mobility: it is the same kind of work and a fourth hue would be a
  fourth thing to learn for two exercises.
*/
:root,
[data-bs-theme=light] {
  --tv-q-mobility: var(--tl-surface-gravel, #D19A3E);
  --tv-q-coordination: var(--tl-surface-gravel, #D19A3E);
  --tv-q-endurance: var(--tl-accent, #46603C);
  --tv-q-strength: var(--tl-cta, #C86B3F);
  /* The far side of the body, so a reader can tell which leg is which. */
  --tv-far: #CFCCBB;
}

/*
  The night face's lifted hues, and anything drawn on the night ground in
  either face: the session-complete hero is night by day too, and the day
  hues go muddy on it.
*/
[data-bs-theme=dark],
.tv-on-night {
  --tv-q-mobility: #DCAE5E;
  --tv-q-coordination: #DCAE5E;
  --tv-q-endurance: #7FA271;
  --tv-q-strength: #DE8155;
  --tv-far: #3A3A2F;
}

/* ---------------------------------------------------------- the figure ----

  One stroke weight throughout, the jointed pictogram: it reads like a station
  sign, holds up at phone size, and stays quiet next to a map. The trunk
  carries the quality colour, which is the only colour in the drawing.

  Every rule here is a class rather than an element, so a cue keeps its own
  weight: .tv-fig path would otherwise repaint the ground and the arrows at
  7.5px along with the bones.
*/
.tv-fig {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.tv-fig path {
  fill: none;
  stroke: var(--tl-ink, #23281F);
  stroke-width: 7.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tv-fig .trunk { stroke: var(--q, var(--tl-accent, #46603C)); stroke-width: 9; }
.tv-fig .yoke,
.tv-fig .pelvis { stroke-width: 7; }
.tv-fig .head { fill: var(--tl-ink, #23281F); stroke: none; }

/* Depth. The far arm and leg recede so the near side reads in front. */
.tv-fig .far path,
.tv-fig .far circle { stroke: var(--tv-far, #CFCCBB); }
.tv-fig .far .head { fill: var(--tv-far, #CFCCBB); }

.tv-fig .ground { stroke: var(--tl-hairline-strong, #C9C5B2); stroke-width: 3; }
.tv-fig .prop { stroke: var(--tl-dim, #8B8F80); stroke-width: 4; }
.tv-fig .arrow { stroke: var(--tl-cta, #C86B3F); stroke-width: 3.2; }
.tv-fig .arrowhead { fill: var(--tl-cta, #C86B3F); stroke: none; }
.tv-fig .dots {
  stroke: var(--tl-cta, #C86B3F);
  stroke-width: 3;
  stroke-dasharray: 0.1 8;
}

/* ------------------------------------------------------------ the kit ----

  WHAT THE FIGURE IS HOLDING.

  Indoors there is equipment, and a figure pressing a dumbbell with nothing in
  its hand is a figure doing a different exercise. Three weights of grey, and
  no colour at all: the quality colour belongs to the trunk, and a terracotta
  dumbbell would compete with it for the one thing the drawing is saying.

  `.prop` is the existing class, already used by the cue that draws a bench
  line under a plank, and it keeps its 4px. What is new is the mass and the
  band.
*/

/*
  The plates on a dumbbell and the bell of a kettlebell: the part with the
  weight in it, drawn heavier than the bar it hangs on so the eye reads which
  end is loaded. Filled for the bell, stroked for the plates, which is why
  both fill and stroke are set.
*/
.tv-fig .prop-mass {
  stroke: var(--tl-muted, #5C6253);
  stroke-width: 6;
  fill: none;
}

.tv-fig circle.prop-mass {
  fill: var(--tl-muted, #5C6253);
  stroke: none;
}

/*
  THE BAND, AND WHY IT IS THINNER AND DARKER THAN IT LOOKS LIKE IT SHOULD BE.

  It is the one prop that legitimately changes length, because that is what a
  band does, and the emitter animates its `d` rather than rotating a group.
  Drawn at 3.5px so a band stretched from a foot to a hand never reads as a
  limb: at bone weight the figure grows a third arm.

  --tl-muted, not --tl-dim, and that was a real mistake worth recording. A
  band runs at roughly the angle of the leg it passes, and at dim grey it sat
  in the same tonal band as --tv-far, the far side of the body: on the banded
  row the eye could not tell the band from the far shin. Muted is darker than
  the far side and lighter than a near bone, which is exactly where a thing
  held in front of the body belongs.

  Not dashed. A dashed line here is the dotted trace the cues use for a hold,
  and the two would be the same mark meaning two things.
*/
.tv-fig .band {
  fill: none;
  stroke: var(--tl-muted, #5C6253);
  stroke-width: 3.5;
  stroke-linecap: round;
}

/* An athlete who has asked their system for less movement gets a still. */
@media (prefers-reduced-motion: reduce) {
  .tv-fig * { animation-play-state: paused; }
}

/* ----------------------------------------------------------- the panel ----*/

.tleagues-tv-stopcount {
  font-family: var(--tl-font-mono, monospace);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tl-dim, #8B8F80);
  margin-top: 0.1rem;
}

.tleagues-tv-seg {
  display: flex;
  gap: 3px;
  width: 100%;
}

.tleagues-tv-seg button {
  flex: 1 1 0;
  border: 1px solid var(--tl-hairline, #DFDCCB);
  background: var(--tl-white, #fff);
  color: var(--tl-ink, #23281F);
  border-radius: 9px;
  padding: 0.4rem 0.2rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.tleagues-tv-seg button[aria-pressed="true"] {
  background: var(--tl-ink, #23281F);
  border-color: var(--tl-ink, #23281F);
  color: var(--tl-white, #fff);
}

/*
  THE SOURCE TOGGLE, and the route it reads off the map.

  Two words and an icon each, so the seg buttons hold a glyph beside the
  label rather than only text like the difficulty row above. Disabled is a
  real state here: My route is not offered until there is one, and a control
  that vanishes as you draw is a control nobody finds twice.
*/
.tleagues-tv-seg button i {
  margin-right: 0.3rem;
  font-size: 0.78rem;
  pointer-events: none;
}

.tleagues-tv-seg button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tleagues-tv-seg button:disabled[aria-pressed="true"] {
  /* Pressed and unavailable at once would read as the chosen answer. */
  background: var(--tl-white, #fff);
  border-color: var(--tl-hairline, #DFDCCB);
  color: var(--tl-ink, #23281F);
}

/* The route's own length, which is the distance when the route is the answer.
   Same two line shape as the pin row it replaces, so the card does not jump
   when the toggle moves. */
.tleagues-tv-mine-read b {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--tl-ink, #23281F);
}

.tleagues-tv-mine-read span {
  display: block;
  font-family: var(--tl-font-mono, ui-monospace, monospace);
  font-size: 0.68rem;
  color: var(--tl-dim, #8B8F80);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tleagues-tv-mine-read em {
  font-style: normal;
  font-size: 0.85rem;
  color: var(--tl-muted, #5C6253);
}

/* ------------------------------------------------------- what it found ----*/

.tleagues-tv-head { margin-bottom: 0.6rem; }

/*
  The session in one line: a bar of the qualities in the order they come, so
  a reader can see at a glance that it is not all stretching. Drawn from the
  same stop list as the cards below it, so the two cannot disagree.
*/
.tleagues-tv-bar {
  display: flex;
  gap: 2px;
  height: 8px;
  margin: 0.45rem 0 0.4rem;
  border-radius: 99px;
  overflow: hidden;
}

.tleagues-tv-bar i {
  flex: 1 1 0;
  background: var(--tv-q-mobility);
}

.tleagues-tv-bar i[data-q="endurance"] { background: var(--tv-q-endurance); }
.tleagues-tv-bar i[data-q="strength"] { background: var(--tv-q-strength); }
.tleagues-tv-bar i[data-q="coordination"] { background: var(--tv-q-coordination); }

.tleagues-tv-trained {
  font-family: var(--tl-font-mono, monospace);
  font-size: 0.66rem;
  color: var(--tl-muted, #5C6253);
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.7rem;
}

.tleagues-tv-trained span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 0.3rem;
  background: var(--tv-q-mobility);
}

.tleagues-tv-trained span[data-q="endurance"]::before { background: var(--tv-q-endurance); }
.tleagues-tv-trained span[data-q="strength"]::before { background: var(--tv-q-strength); }
.tleagues-tv-trained span[data-q="coordination"]::before { background: var(--tv-q-coordination); }

/* ------------------------------------------------------- the stop list ----

  A row per stop: the distance, the drawing, the name and the dose. The
  drawing is 74px wide, which is where a jointed figure stops being readable
  on a phone; below that the limbs merge.
*/
.tleagues-tv-stops {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}

/*
  A STOP IS A BOARD, so the card is a column: a head that says which stop
  this is and what it trains, then the exercises stacked under it.

  It was a row, because a stop was one exercise and the drawing sat beside
  the name. Two or three drawings in a row on a 390px screen is three
  thumbnails and no room for their names.
*/
.tleagues-tv-stop {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--tl-hairline, #DFDCCB);
  border-radius: 12px;
  background: var(--tl-white, #fff);
  text-align: left;
  width: 100%;
  cursor: pointer;
}

/* The head: the number, what it trains, and how far along it is. */
.tleagues-tv-stop-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.tleagues-tv-stop-what { min-width: 0; flex: 1 1 auto; }

.tleagues-tv-q {
  display: block;
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.2;
  color: var(--tl-ink, #23281F);
}

.tleagues-tv-count {
  display: block;
  font-family: var(--tl-font-mono, monospace);
  font-size: 0.66rem;
  color: var(--tl-dim, #8B8F80);
}

/* The exercises. One row each, so a drawing keeps its name beside it. */
.tleagues-tv-board {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}

.tleagues-tv-ex {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

/* A rule between them, so three exercises read as three and not as one
   paragraph with pictures in it. */
.tleagues-tv-ex + .tleagues-tv-ex {
  border-top: 1px solid var(--tl-hairline, #DFDCCB);
  padding-top: 0.4rem;
}

.tleagues-tv-stop:hover,
.tleagues-tv-stop:focus-visible {
  border-color: var(--tl-hairline-strong, #C9C5B2);
}

/* The number, in the quality's colour, because that is the one thing a
   reader wants to scan down the list. */
/* The list's own badge, centred the same way and for the same reason as the
   marker's dot: a line box is taller than the digits in it. */
.tleagues-tv-n {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  /* Measured 3.56px above the glyph and 4.44px below, same cause as the
     marker's dot. */
  padding-top: 1px;
  font-family: var(--tl-font-mono, monospace);
  font-size: 0.68rem;
  font-weight: 600;
  color: #fff;
  background: var(--tv-q-mobility);
}

.tleagues-tv-stop[data-q="endurance"] .tleagues-tv-n { background: var(--tv-q-endurance); }
.tleagues-tv-stop[data-q="strength"] .tleagues-tv-n { background: var(--tv-q-strength); }
.tleagues-tv-stop[data-q="coordination"] .tleagues-tv-n { background: var(--tv-q-coordination); }

.tleagues-tv-art {
  flex: 0 0 auto;
  width: 86px;
}

/*
  SMALLER ON A BOARD.

  86px was the size for one drawing per stop. Three of them at that size makes
  a stop 300px tall and a five stop parcours a 1500px scroll, which is a lot
  of scrolling to read a session that takes twenty minutes to run. The figures
  are line drawings of a whole body, so they stay legible well below that.
*/
.tleagues-tv-ex .tleagues-tv-art {
  width: 62px;
}

.tleagues-tv-ex .tleagues-tv-art svg {
  display: block;
  width: 100%;
  height: auto;
}

.tleagues-tv-copy { min-width: 0; flex: 1 1 auto; }

/* Both are spans inside a <button>, and a button's children do not stack on
   their own: without this the name and the dose ran together as one line,
   "Ankle rocker15x". */
.tleagues-tv-name {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.25;
}

.tleagues-tv-dose {
  display: block;
  font-family: var(--tl-font-mono, monospace);
  font-size: 0.72rem;
  color: var(--tl-muted, #5C6253);
}

.tleagues-tv-at {
  font-family: var(--tl-font-mono, monospace);
  font-size: 0.66rem;
  color: var(--tl-dim, #8B8F80);
  flex: 0 0 auto;
  margin-left: auto;
}

/* The how-to, opened by pressing the row. Closed by default: ten of these
   open at once is a wall of text on a 390px screen. */
.tleagues-tv-how {
  font-size: 0.82rem;
  color: var(--tl-muted, #5C6253);
  margin: 0.3rem 0 0;
}

.tleagues-tv-stop:not(.is-open) .tleagues-tv-how { display: none; }

/* Start again carries an icon beside its label, and the label is what gives
   way first when the two secondaries share a line. */
.tleagues-tv-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.tleagues-tv-reset i {
  flex: 0 0 auto;
  font-size: 0.76rem;
  pointer-events: none;
}

.tleagues-tv-reset span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Said under the stop list: even spacing is where a parcours starts, not
   where it belongs. */
.tleagues-tv-hint {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0.55rem 0 0;
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--tl-dim, #8B8F80);
}

.tleagues-tv-hint i {
  flex: 0 0 auto;
  font-size: 0.72rem;
}

/* ----------------------------------------------------- on the map ----

  A stop marker. Numbered, in the quality's colour, and small: ten of these
  on a 4 km loop at phone zoom sit close together, and anything bigger merges
  into one blob.
*/
/*
  THE STOP MARKER: A WRAPPER WE DO NOT TOUCH, ROUND A DOT WE DO.

  MapLibre positions a marker by writing an inline transform on the element
  it was handed, so a transform of ours on that element is either ignored or
  throws the marker off the map. .is-on said scale(1.25) and did nothing at
  all, because the inline style wins.

  So the wrapper only sizes itself and the dot carries everything: the
  circle, the colour, the digit and the scale. The wrapper has no size of its
  own beyond the dot's, so MapLibre's centre anchor still centres it.
*/
.tleagues-tv-marker {
  /* Grab, because it moves. A stop that can be dragged and looks like a
     label is a stop nobody tries to drag. */
  cursor: grab;
  line-height: 0;
}

.tleagues-tv-marker:active {
  cursor: grabbing;
}

.tleagues-tv-dot {
  box-sizing: border-box;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--tl-white, #fff);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  /*
    CENTRED ON THE INK, NOT ON THE LINE BOX.

    place-items: center on a grid centres the line box, and a line box is
    taller than the digits in it by the font's descent, so every number sat
    high in its circle by a pixel or two. A flex row with line-height: 1
    collapses the box onto the glyphs, and the digits land in the middle.
  */
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  /*
    AND ONE PIXEL OF IT BACK.
    
    Centring the line box leaves the digits high, because a font's ascent and
    descent are not symmetrical about its ink: measured on IBM Plex Mono at
    this size, 3.88px above the glyph and 5.13px below. A pixel of padding at
    the top takes that from 1.25px of asymmetry to 0.25px, which is the
    closest a box can get without translating the glyph itself, and
    translating it is not free here: the transform belongs to the open
    marker's scale.
  */
  padding-top: 1px;
  font-family: var(--tl-font-mono, monospace);
  font-size: 0.64rem;
  font-weight: 700;
  color: #fff;
  background: var(--tv-q-mobility);
  transition: transform 0.12s ease;
}

.tleagues-tv-marker[data-q="endurance"] .tleagues-tv-dot { background: var(--tv-q-endurance); }
.tleagues-tv-marker[data-q="strength"] .tleagues-tv-dot { background: var(--tv-q-strength); }
.tleagues-tv-marker[data-q="coordination"] .tleagues-tv-dot { background: var(--tv-q-coordination); }

/* Now it actually grows: the transform is on the dot, which MapLibre never
   writes to. */
.tleagues-tv-marker.is-on {
  z-index: 2;
}

.tleagues-tv-marker.is-on .tleagues-tv-dot {
  transform: scale(1.3);
}

@media (prefers-reduced-motion: reduce) {
  .tleagues-tv-dot { transition: none; }
}

/* ------------------------------------------------------ a friendly reminder ----

  WHEREVER EXERCISES ARE SUGGESTED, the same line, styled once here because
  both the indoor page and the planner's parcours card load this file.

  Warm, not alarming: a small heart and two short sentences in muted ink on
  the page's own paper. A red warning box next to a set of squats would say
  the exercises are dangerous, which is not the message.
*/
.tv-safety {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin: 0.8rem 0;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--tl-hairline, #DFDCCB);
  border-radius: var(--tl-radius, 8px);
  background: var(--tl-paper-deep, #EFEDE2);
  color: var(--tl-muted, #5C6253);
  font-size: 0.8rem;
  line-height: 1.45;
}

.tv-safety i {
  flex: none;
  color: var(--tv-q-strength, #C86B3F);
}
