.coach-page {
  display: grid;
  gap: var(--space-3);
  max-width: 48rem;
  margin: 0 auto;
  /* Clear of the dock fixed at the bottom (class_clock_controller.js
     holdRoomForDock measures it). */
  padding-bottom: var(--class-clock-dock, 0px);
}

/* The class clock's top (class_clock_controller.js): the part under way
   and the time left in it, and the class's own clock. Sticky, so it stays
   in view down the page; the drills stay in the page. */
.class-clock {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border: var(--line-width) solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* display: grid outranks the browser's own [hidden] rule. */
.class-clock[hidden] {
  display: none;
}

/* The class clock's bottom, under the thumb: what is next, the steps to
   the part before and after with End class, and before the clock Start
   at, Resume class and Start class. Fixed over the page, the page's own
   width, clear of a phone's home indicator. */
.class-clock-dock {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  display: grid;
  /* One column no wider than the screen: a long step's name is cut short
     rather than widening the dock past the edge. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2);
  padding: var(--space-2) max(var(--space-3), calc((100% - 48rem) / 2)) calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
  border-top: var(--line-width) solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* End class, then the part before, then the part after at the right
   edge, where the thumb rests; the steps share what End class leaves. */
.class-clock-steps {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.class-clock-steps[hidden] {
  display: none;
}

.class-clock-step {
  flex: 1 1 0;
  min-width: 0;
}

/* End class in the last part, and once the class is over: what comes
   next, so in the next step's place at the right edge, as wide. */
.class-clock-end-last {
  order: 1;
  flex: 1 1 0;
  min-width: 0;
}

/* A step's label, cut short with an ellipsis rather than pushing the
   dock past the screen's edge. */
.class-clock-step-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Start at and Resume class on the left, Start class at the right edge. */

.class-clock-start {
  margin-left: auto;
}

/* Start at's panel: the time to start the clock, Save and Clear. */
.class-clock-start-at {
  width: 14rem;
  padding: var(--space-2) var(--space-3);
}

/* The class's own clock, under the headline: a figure the coach can
   find, not the headline. */
.class-clock-elapsed {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

.class-clock-time {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* The page while the clock runs or a part is focused: room under it so
   any part, the last ones too, scrolls up to just under the clock. A
   block of the page's own, so the sticky clock still has the page to
   stick within. */
.class-clock-room::after {
  content: "";
  display: block;
  height: 75svh;
}

/* Before a start set ahead: when it starts, and how long until. */
.class-clock-now {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

/* The headline of the now card: the part under way and the time left in
   it, read from arm's length; then how far from its plan the class runs,
   and before the clock the pinned part's Unfocus. */
.class-clock-head {
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--space-3);
  align-items: baseline;
}

.class-clock-head[hidden] {
  display: none;
}

.class-clock-part {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: var(--leading-tight);
  text-wrap: balance;
}

.class-clock-left {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: var(--leading-tight);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Past the plan's end: how far over the class runs, in the caution ink. */
.class-clock-left[data-over] {
  color: var(--caution-ink);
}

.class-clock-shift {
  grid-column: 1 / -1;
  margin: 0;
  font-size: var(--text-sm);
  color: var(--caution-ink);
}

/* What is next and when, at the top of the dock. */
.class-clock-next {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: var(--tap-dense);
  font-size: var(--text-md);
  color: var(--ink-muted);
}

/* display: flex outranks the browser's own [hidden] rule. */
.class-clock-next[hidden] {
  display: none;
}

/* What is next, wrapping rather than cut: the part and the countdown
   first; the time of day where the screen has room for it. */
.class-clock-next-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: var(--space-2);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.class-clock-next-when {
  display: none;
}

/* The next workout and when it starts, on a line of its own under what is
   next, in ink: the time the room changes. */
.class-clock-next-work {
  flex-basis: 100%;
  font-weight: 600;
  color: var(--ink);
}

@media (min-width: 40rem) {
  .class-clock-next-when {
    display: inline;
  }
}

/* The next part a minute out: the line comes forward and pulses slowly;
   twenty seconds out, faster (class_clock_controller.js soon). */
.class-clock-next-text[data-soon] {
  color: var(--accent-ink);
  font-weight: 600;
}

.class-clock-next-text[data-soon="slow"] {
  animation: class-clock-pulse 2s ease-in-out infinite;
}

.class-clock-next-text[data-soon="fast"] {
  animation: class-clock-pulse 0.6s ease-in-out infinite;
}

@keyframes class-clock-pulse {
  50% {
    opacity: 0.5;
  }
}

/* The part the clock reaches next, a minute out and then twenty seconds
   out: a halo that pulses at the foot's pace. */
.coach-halo-slow {
  animation: coach-halo 2s ease-in-out infinite;
}

.coach-halo-fast {
  animation: coach-halo 0.6s ease-in-out infinite;
}

@keyframes coach-halo {
  50% {
    box-shadow: 0 0 0 4px var(--accent-fill);
  }
}

/* With a part under way, every other part steps back so it stands out:
   its ink drops to the muted ink, which still reads at 4.5:1, and its
   bands and chips keep their colour, so a workout's band still says where
   the work is. --coach-ink carries the step back to text that names its
   own ink (a drill's dose, over its muted column). */
.coach-dim {
  --coach-ink: var(--ink-muted);
  color: var(--ink-muted);
}

@media (prefers-reduced-motion: reduce) {
  .class-clock-next-text[data-soon],
  .coach-halo-slow,
  .coach-halo-fast {
    animation: none;
  }

  .coach-halo-slow,
  .coach-halo-fast {
    box-shadow: 0 0 0 4px var(--accent-fill);
  }
}

/* The planning pieces (the equipment, What to build, the days around
   and the fatigue) and the Session's planning tools, put away while the
   clock runs; the days around and the fatigue sit behind one disclosure. */
.coach-planning {
  display: contents;
}

.coach-planning[hidden] {
  display: none;
}

.coach-around {
  display: grid;
  gap: var(--space-3);
}

.coach-plan-tools {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.coach-plan-tools[hidden] {
  display: none;
}

/* A phase's body: its shared cue and its drills, what the now card copies. */
.coach-phase-body {
  display: block;
}

/* A warmup phase as one block: marked by the button in its heading, or
   reached by the class clock, it takes aria-current="step" and a tint all
   round. One that runs past the minutes its period has takes the same in
   the danger tone (Components::WarmupPeriod), the mark winning when both. */
.coach-phase-block {
  padding: var(--space-1) var(--space-2);
  margin: 0 calc(-1 * var(--space-2));
  border-radius: var(--radius-md);
}

.coach-phase-over {
  background: var(--danger-soft);
  box-shadow: 0 0 0 2px var(--danger);
}

/* How far over, beside the name: whole, the name wrapping instead. */
.coach-phase-over-note {
  flex: none;
}

.coach-phase-block[aria-current="step"] {
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent);
}

/* A phase's drills while the page is edited: an emptied phase keeps a
   dashed row's worth of room to drag a drill back into. */
.coach-warmup-drills:empty {
  min-height: var(--tap-dense);
  border: var(--line-width) dashed var(--line);
  border-radius: var(--radius-md);
}

/* A window's phases, drawn right under its row with the panel's inset.
   While editing, a window with no phase keeps a dashed row's worth of
   room to drag a phase into. */
.coach-phases {
  padding: var(--space-1) var(--space-3);
}

.coach-phases:empty {
  min-height: var(--tap-dense);
  margin: var(--space-1) var(--space-3);
  border: var(--line-width) dashed var(--line);
  border-radius: var(--radius-md);
}

/* A drill's name while editing: the button that opens its editor, as
   wide as the row's name column so the whole name is the tap target. */
.coach-drill-name {
  display: flex;
  min-height: var(--tap-dense);
  align-items: center;
}

/* While editing, a drill's name is the control that opens its editor, and
   is underlined so it reads as one; the text is otherwise the row's. */
.coach-drill-trigger {
  text-decoration: underline dotted;
  text-underline-offset: 0.2em;
}

/* In a drill's editor, the second form: a movement to add after it. */
.coach-edit-subhead {
  margin: var(--space-3) 0 var(--space-1);
  padding-top: var(--space-2);
  border-top: var(--line-width) solid var(--line);
  font-size: var(--text-sm);
  font-weight: 600;
}

.coach-cues {
  padding-left: var(--space-4);
  font-size: var(--text-sm);
}

.coach-cue {
  list-style: disc;
}

.coach-phase {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--ink-muted);
}

/* The clock a phase starts at, ahead of its name: plain small text, as a
   row's is, so the work's start on its band is the time that stands out;
   a fixed width, empty for a phase that starts with its row, so the names
   after it line up down the warmup. */
.coach-phase-clock {
  flex: none;
  min-width: 3rem;
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* The heading's end: the mark button, and while editing the phase's
   Change beside it. */
.coach-phase-tools {
  display: inline-flex;
  gap: var(--space-1);
  margin-left: auto;
}

/* The warmup is read at a glance (Jim, 2026-10-31): its doses and drills
   a size up from the timeline's rows, and its cues, hidden until Show
   cues (warmup_cues_controller.js), a size up from the row's notes. */
.coach-warmup-cue {
  font-size: var(--text-md);
  color: var(--ink-muted);
}

/* The dose's column: wide enough for the common "10 reps" and "2 x 10 m"
   so the names line up, and no wider, so the movement sits close to its
   amount; a long dose ("15 m at workout weight") wraps in it. */
.coach-warmup-dose {
  display: block;
  min-width: 4.5rem;
  max-width: 8rem;
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--coach-ink, var(--ink));
}

.coach-warmup-drill {
  flex: 1 1 0;
  min-width: 0;
  font-size: var(--text-lg);
}

.coach-warmup-drill-cue {
  margin-top: var(--space-1);
  font-size: var(--text-md);
  color: var(--ink-muted);
}

/* A workout's name in the Session, a button that opens its description
   (Components::DayTimeline on the coach page): its popover takes the
   title's room in the row, and the button has the row title's look with
   none of a button's. */
.coach-session-name {
  flex: 1 1 0;
  min-width: 0;
}

.coach-session-title {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
}

.coach-session-peek {
  width: 26rem;
  padding: var(--space-2) var(--space-3);
}

/* The controls a row or heading ends with while the coach page is being
   edited (Components::WarmupSection and DayTimeline with editing:):
   Change and +, each opening a popover that holds the form. */
.coach-edit-tools {
  display: inline-flex;
  gap: var(--space-1);
  margin-left: auto;
}

.coach-edit-panel {
  width: 22rem;
  padding: var(--space-2) var(--space-3);
}

/* A work row's start, slid along the class and read out as its clock,
   over a strip of the class's sections with Gathering and Cooldown marked
   at its ends; the slider and the strip run the same length, so the
   thumb reads against the sections under it. */
.coach-start-slider {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-1) var(--space-2);
  align-items: center;
}

.coach-start-hint {
  grid-column: 1 / -1;
}

.coach-start-track {
  display: flex;
  gap: 1px;
  height: var(--space-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.coach-start-band {
  flex: 0 0 0;
  min-width: 1px;
  background: var(--line);
}

.coach-start-band-edge {
  background: var(--caution-fill);
}

.coach-start-band-work {
  background: var(--ink-muted);
}

.coach-start-band-this {
  background: var(--accent);
}

.coach-start-clock {
  min-width: 3.5rem;
  font-size: var(--text-md);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* --- The energy systems graph on the Learn page (Components::EnergySystemGraph) --- */
.energy-graph {
  margin: 0;
  display: grid;
  gap: var(--space-2);
}

/* The percent scale down the side, the plot, and the minutes under the plot. */
.energy-graph-plot-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-1) var(--space-2);
}

.energy-graph-y {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: right;
  font-size: var(--text-xs);
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.energy-graph-plot {
  position: relative;
  height: 14rem;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  overflow: hidden;
  touch-action: pan-y;
}

.energy-graph-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.energy-graph-grid {
  stroke: var(--line);
  stroke-width: 1;
}

/* Each system's line in its colour, and its own dash, so the three read
   apart without the colour. */
.energy-graph-line {
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.energy-graph-line-phosphagen {
  stroke: var(--energy-phosphagen);
}

.energy-graph-line-glycolytic {
  stroke: var(--energy-glycolytic);
  stroke-dasharray: 6 4;
}

.energy-graph-line-oxidative {
  stroke: var(--energy-oxidative);
  stroke-dasharray: 2 3;
}

.energy-graph-cursor {
  stroke: var(--ink-muted);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.energy-graph-label {
  position: absolute;
  transform: translateY(-50%);
  padding: 0 var(--space-1);
  border-radius: var(--radius-sm);
  background: color-mix(in oklab, var(--surface) 85%, transparent);
  font-size: var(--text-xs);
  color: var(--ink);
  pointer-events: none;
}

.energy-graph-label-start {
  left: var(--space-1);
}

.energy-graph-label-end {
  right: var(--space-1);
}

.energy-graph-x {
  grid-column: 2;
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.energy-graph-readout {
  margin: 0;
  min-height: 1.5em;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.energy-graph-caption {
  font-size: var(--text-sm);
  color: var(--ink-muted);
}
