/* Progress. One white stage holds the headline, a tinted bay with the owner's take-off scene and
   the tinted demo card: an example weight trend you can scrub, with three private photo days.
   Same build as the Sick day stage beside it: tinted cards, white tiles, navy text. */
.s-progress {
  --plot-height: 176px;
  --dot-size: 26px;
  --ring-size: 10px;
  --pin-size: 10px;
  --halo-spread: 7px;
  --stage-pad: var(--space-md);
  --stage-radius: 32px;
  --chart-pad: var(--space-lg);
  --chart-gap: var(--space-md);
  --tile-pad: var(--space-md);
  --bay-height: 112px;
  --scene-size: 108px;
  --shot-art: 48px;
  --number-size: 52px;
  --trend-width: 4;
  --dots-width: 6;
  --trend-halo: color-mix(in srgb, var(--jet) 18%, transparent);
  --area-top: color-mix(in srgb, var(--jet) 14%, transparent);
  --trail: color-mix(in srgb, var(--jet) 38%, transparent);
  /* Mirrors --pair-height and --pair-gap in sickday.css: the two cards share one row on desktop. */
  --pair-height: 1140px;
  --pair-gap: var(--space-xxl);
  /* Progress is the wider card: the divide sits this far left of centre. */
  --pair-shift: clamp(72px, 7vw, 90px);
  padding-block: calc(var(--section-gap) / 2);
  scroll-margin-top: calc(var(--space-xxxl) * -1);
}

.s-progress .sprite {
  position: absolute;
  width: 0;
  height: 0;
}

/* Stage */
.s-progress .stage {
  display: grid;
  gap: var(--space-xl);
  margin-inline: calc(var(--space-sm) - var(--gutter));
  padding: var(--space-xxxl) var(--stage-pad) var(--stage-pad);
  background: var(--surface);
  border-radius: var(--stage-radius);
  box-shadow: var(--shadow-card);
}

.s-progress .section-head {
  display: grid;
  gap: var(--space-md);
  padding-inline: var(--space-sm);
}

.s-progress .section-head .label {
  color: var(--jet);
  font-weight: 700;
}

.s-progress .title {
  font-size: clamp(32px, 4.6vw, 52px);
  line-height: 1.06;
  letter-spacing: -0.03em;
  color: var(--jet-ink);
}

/* Bay: the owner's scene on the tint, trailing a dotted flight path through a few stray dots.
   The picture says what the headline says, so it carries no words. */
.s-progress .bay {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: var(--bay-height);
  padding: var(--space-xs) var(--space-lg) var(--space-xs) 0;
  background: var(--jet-tint);
  border-radius: var(--radius-card-large);
  overflow: hidden;
}

.s-progress .bay-trail {
  flex: 1;
  align-self: stretch;
  min-width: 0;
  height: auto;
  overflow: visible;
}

.s-progress .bay-trail path {
  fill: none;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.s-progress .bay-path {
  stroke: var(--jet);
  stroke-width: 4;
  stroke-dasharray: 0.1 12;
}

.s-progress .bay-noise {
  stroke: var(--trail);
  stroke-width: 7;
}

.s-progress .bay-scene {
  flex: none;
  width: var(--scene-size);
  height: auto;
}

/* Demo card: tinted, with white tiles. */
.s-progress .chart {
  display: grid;
  align-content: start;
  gap: var(--chart-gap);
  min-width: 0;
  padding: var(--chart-pad);
  background: var(--jet-tint);
  border-radius: var(--radius-card-large);
  box-shadow: none;
}

/* Readout: the trend figure, then two white tiles. Every label carries one small glyph. */
.s-progress .readout {
  display: grid;
  gap: var(--chart-gap);
}

.s-progress .readout-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

/* The same inline pill as the Sick day card. */
.s-progress .example {
  padding: 3px 10px;
  background: var(--surface);
  color: var(--jet);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.s-progress .readout-date {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}

.s-progress .readout-key,
.s-progress .fact dt,
.s-progress .photo-days-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: var(--ink-secondary);
  white-space: nowrap;
}

.s-progress .key-icon {
  flex: none;
  width: 20px;
  height: 20px;
}

.s-progress .key-plane {
  fill: var(--jet);
}

.s-progress .lock {
  color: var(--jet);
}

.s-progress .readout-figure {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}

.s-progress .readout-number {
  font-size: var(--number-size);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  margin-left: -0.04em;
  color: var(--jet-ink);
}

.s-progress .readout-unit {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.s-progress .readout-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
}

.s-progress .fact {
  display: grid;
  gap: 2px;
  padding: 10px var(--tile-pad);
  background: var(--surface);
  border-radius: var(--radius-control);
}

.s-progress .fact dd {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--jet-ink);
  white-space: nowrap;
}

/* Plot: a white tile holding the chart and its axis. */
.s-progress .plot-area {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--space-md);
  padding: var(--space-lg) var(--tile-pad) var(--space-lg) var(--space-lg);
  background: var(--surface);
  border-radius: var(--radius-card);
}

/* Keyboard focus: one ring around the tile. The script marks keyboard use, and a finger never
   takes focus at all, so a touch or a click on the chart cannot leave a ring behind. */
.s-progress .chart.is-keyboard .plot-area:has(.scrub:focus) {
  outline: 2px solid var(--jet);
  outline-offset: 2px;
}

.s-progress .scrub {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  outline: none;
  pointer-events: none;
}

html:not(.js) .s-progress .scrub {
  display: none;
}

.s-progress .plot {
  position: relative;
  height: var(--plot-height);
  outline: none;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.js .s-progress .plot {
  cursor: ew-resize;
}

/* A taller invisible target so a thumb does not have to land exactly on the plot. */
.s-progress .plot::before {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--space-lg)) 0;
}

.s-progress .plot-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.s-progress .plot-svg path {
  vector-effect: non-scaling-stroke;
}

.s-progress .grid {
  fill: none;
  stroke: var(--hairline);
  stroke-width: 1;
}

.s-progress .dots {
  fill: none;
  stroke: var(--ink-quaternary);
  stroke-width: var(--dots-width);
  stroke-linecap: round;
}

.s-progress .trend {
  fill: none;
  stroke: var(--jet);
  stroke-width: var(--trend-width);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.s-progress .area-top {
  stop-color: var(--area-top);
}

.s-progress .area-bottom {
  stop-color: transparent;
}

/* The trend line is revealed left to right by sliding a clip and its content in opposite
   directions (driven from script, so the plane can ride the tip of the line). */
.s-progress .wipe,
.s-progress .wipe-inner {
  position: absolute;
}

.s-progress .wipe {
  inset: -8px;
  overflow: hidden;
}

.s-progress .wipe-inner {
  inset: 8px;
}

/* Before the first draw the clip is parked off to the left (the script sets the exact offsets). */
.s-progress .chart.is-waiting .wipe {
  opacity: 0;
}

/* Photo days, ringed on the trend line (positions match the example series). */
.s-progress .pin {
  position: absolute;
  top: var(--pin-y);
  left: var(--pin-x);
  width: 0;
  transition: opacity var(--duration-rest) var(--ease-standard);
}

.s-progress .pin.is-covered {
  opacity: 0;
}

.s-progress .pin-mark {
  position: absolute;
  top: calc(var(--pin-size) / -2);
  left: calc(var(--pin-size) / -2);
  width: var(--pin-size);
  height: var(--pin-size);
  background: var(--surface);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--jet);
}

.s-progress .pin-first {
  --pin-x: 0%;
  --pin-y: 16%;
}

.s-progress .pin-middle {
  --pin-x: 50.6%;
  --pin-y: 49.75%;
}

.s-progress .pin-last {
  --pin-x: 100%;
  --pin-y: 87%;
}

/* Cursor (positioned from script): a small plane rides the trend line. The guide line and the
   day's weigh-in ring appear only while the chart is being scrubbed. */
.s-progress .cursor {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-rest) var(--ease-standard);
}

.s-progress .chart.is-ready .cursor {
  opacity: 1;
}

.s-progress .chart.is-waiting .cursor {
  opacity: 0;
}

.s-progress .cursor-line,
.s-progress .cursor-dot-weight {
  opacity: 0;
  transition: opacity var(--duration-rest) var(--ease-standard);
}

.s-progress .chart.is-scrubbing .cursor-line,
.s-progress .chart.is-scrubbing .cursor-dot-weight {
  opacity: 1;
}

.s-progress .cursor-line {
  position: absolute;
  top: calc(-1 * var(--space-sm));
  bottom: 0;
  left: -0.5px;
  width: 1px;
  background: var(--ink-quaternary);
}

.s-progress .cursor-dot {
  position: absolute;
  top: calc(var(--dot-size) / -2);
  left: calc(var(--dot-size) / -2);
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 50%;
}

.s-progress .cursor-dot-trend {
  display: grid;
  place-items: center;
  background: var(--jet);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 var(--halo-spread) var(--trend-halo);
}

.s-progress .cursor-plane {
  width: 18px;
  height: 18px;
  fill: var(--surface);
}

/* The day's weigh-in: an open navy ring, so it never smudges into the plane. */
.s-progress .cursor-dot-weight {
  top: calc(var(--ring-size) / -2);
  left: calc(var(--ring-size) / -2);
  width: var(--ring-size);
  height: var(--ring-size);
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--jet-ink);
}

.s-progress .chart.is-scrubbing .cursor-dot-weight.is-near {
  opacity: 0;
}

/* Scrub hint: no word, just a ring pulsing off the plane and two arrows nudging back along the
   line. It is gone for good the first time the chart is used. */
.s-progress .hint {
  position: absolute;
  inset: 0;
  display: none;
  color: var(--jet);
}

.s-progress .chart.is-drawn .hint {
  display: block;
}

.s-progress .chart.is-used .hint,
.s-progress .chart.is-scrubbing .hint {
  display: none;
}

.s-progress .hint::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--jet);
  opacity: 0;
}

.s-progress .hint-arrows {
  position: absolute;
  top: 50%;
  right: calc(100% + var(--halo-spread) + 3px);
  width: 20px;
  height: 16px;
  margin-top: -8px;
}

@media (prefers-reduced-motion: no-preference) {
  .s-progress .hint::before {
    animation: progress-pulse 1.8s var(--ease-standard) infinite;
  }

  .s-progress .hint-arrows {
    animation: progress-nudge 1.8s var(--ease-standard) infinite;
  }
}

@keyframes progress-pulse {
  0% {
    opacity: 0.7;
    transform: scale(1);
  }

  70%,
  100% {
    opacity: 0;
    transform: scale(2.1);
  }
}

@keyframes progress-nudge {
  0%,
  100% {
    opacity: 0.35;
    transform: translateX(0);
  }

  50% {
    opacity: 1;
    transform: translateX(-7px);
  }
}

/* Axis */
.s-progress .axis-y {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: var(--plot-height);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.s-progress .axis-y li {
  display: flex;
  align-items: center;
  height: 0;
  white-space: nowrap;
}

/* Photo days: three even white tiles, one owner scene each. The blue ring on a tile and the
   plane sitting on its pin tie the two together. */
.s-progress .photo-days {
  display: grid;
  gap: var(--space-sm);
}

.s-progress .shots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-sm);
}

.s-progress .shot {
  position: relative;
  min-width: 0;
  background: var(--surface);
  border-radius: var(--radius-control);
}

/* The selected ring is its own layer so it can fade with opacity alone. */
.s-progress .shot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-control);
  box-shadow: inset 0 0 0 2px var(--jet);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-rest) var(--ease-standard);
}

.s-progress .shot.is-active::after {
  opacity: 1;
}

.s-progress .shot-body {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--space-xs);
  width: 100%;
  min-height: var(--tap-min);
  margin: 0;
  padding: var(--space-sm);
  background: none;
  border: 0;
  border-radius: var(--radius-control);
  color: var(--jet-ink);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.s-progress button.shot-body {
  cursor: pointer;
}

/* Parts of the owner's scenes are white, so each sits on its own tinted square. */
.s-progress .shot-art {
  width: var(--shot-art);
  height: var(--shot-art);
  padding: 3px;
  background: var(--jet-tint);
  border-radius: var(--space-md);
}

.s-progress .shot-date {
  font-family: var(--font-rounded);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.s-progress .shot.is-active .shot-date {
  color: var(--jet);
}

@media (hover: hover) {
  .s-progress button.shot-body:hover .shot-date {
    color: var(--jet);
  }

  .s-progress .shot:has(button:hover)::after {
    opacity: 0.45;
  }

  .s-progress .shot.is-active:has(button:hover)::after {
    opacity: 1;
  }
}

/* Narrowest phones: tighter padding and a shorter plot, so the card still fits one screen. */
@media (max-width: 359px) {
  .s-progress {
    --plot-height: 156px;
    --stage-pad: var(--space-sm);
    --chart-pad: var(--space-md);
    --tile-pad: 10px;
    --bay-height: 96px;
    --scene-size: 92px;
    --number-size: 48px;
  }
}

@media (min-width: 400px) {
  .s-progress {
    --stage-pad: var(--space-lg);
    --shot-art: 56px;
    --scene-size: 120px;
    --bay-height: 124px;
  }
}

@media (min-width: 640px) {
  .s-progress {
    --stage-pad: var(--space-section);
    --chart-pad: var(--space-xxl);
    --chart-gap: var(--space-lg);
    --tile-pad: var(--space-lg);
    --plot-height: 230px;
    --number-size: 64px;
    --bay-height: 150px;
    --scene-size: 144px;
    --shot-art: 64px;
    --halo-spread: 8px;
    --trend-width: 5;
    --dots-width: 7;
  }

  /* Wide card: the figure on the left, its two tiles on the right. */
  .s-progress .readout {
    grid-template-columns: auto minmax(0, 22rem);
    justify-content: space-between;
    align-items: end;
  }

  .s-progress .readout-top {
    grid-column: 1 / -1;
  }
}

@media (min-width: 900px) {
  .s-progress {
    --stage-pad: clamp(40px, 5vw, 64px);
    --plot-height: 260px;
  }
}

/* Desktop: Progress takes the right half of a row it shares with Sick day. The stage is as tall
   as its neighbour; the bay takes up the slack so the demo card stays short enough to be read in
   one screen (number, plot and photo days together). */
@media (min-width: 1024px) {
  .s-progress {
    --stage-pad: var(--space-section);
    --stage-radius: 40px;
    --plot-height: 236px;
    --number-size: 72px;
    --scene-size: 168px;
    --bay-height: 150px;
    --shot-art: 56px;
    float: right;
    width: calc(50% + var(--pair-shift));
  }

  .s-progress .wrap {
    max-width: none;
    padding-inline: calc(var(--pair-gap) / 2) max(var(--gutter), calc(100% - var(--pair-shift) - var(--page-width) / 2));
  }

  .s-progress .stage {
    grid-template-rows: auto minmax(var(--bay-height), 1fr) auto;
    row-gap: var(--space-xxl);
    height: var(--pair-height);
    margin-inline: 0;
    padding-top: 56px;
  }

  .s-progress .section-head {
    padding-inline: 0;
  }

  .s-progress .title {
    font-size: clamp(36px, 3.4vw, 44px);
  }

  .s-progress .readout {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
  }
}
