/* Morning check-in: a left-aligned heading over the tinted stage. The mascot at its desk
   stands on the tint beside a try-it-yourself check-in that hands back a boarding pass. */
.s-checkin {
  --checkin-card-pad: var(--space-lg);
  --checkin-ring-size: 104px;
  --checkin-score-size: 46px;
  --checkin-unit-size: 11px;
  --checkin-effect-size: 17px;
  --checkin-arc-swap: 0.14s;
  --checkin-stage-column: 216px;
  --checkin-dot: 36px;
  --checkin-q-icon: 28px;
  --checkin-scene-size: 148px;
  --checkin-controls-width: 26rem;
  --checkin-pass-radius: 16px;
  --checkin-pass-notch: 12px;
  --checkin-pass-rule: color-mix(in srgb, var(--jet) 32%, transparent);
  --checkin-preset-icon: 26px;
  --checkin-result-icon: 28px;
  --checkin-digit-pitch: 1.4em;
  --checkin-digit-window: 1.1em;
  --checkin-row-gap: var(--space-md);
  --checkin-stagger: 55ms;
  --checkin-stage-pad: var(--space-md);
  --checkin-stage-radius: 32px;
  padding-block: calc(var(--section-gap) / 2);
  /* Linked to from the header: the label lands just below the sticky header. */
  scroll-margin-top: calc(var(--space-xxxl) * -1);
}

.s-checkin .checkin-head {
  display: grid;
  gap: var(--space-md);
}

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

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

/* Stage: the tinted panel every feature section stands on */
.s-checkin .checkin-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: var(--space-md);
  margin-top: var(--space-xxxl);
  margin-inline: calc(var(--space-sm) - var(--gutter));
  padding: var(--space-lg) var(--checkin-stage-pad) var(--checkin-stage-pad);
  background: var(--jet-tint);
  border-radius: var(--checkin-stage-radius);
}

.s-checkin .checkin-demo {
  container-type: inline-size;
  justify-self: stretch;
  min-width: 0;
}

/* The owner's mascot, untouched, straight on the tint. */
.s-checkin .checkin-scene {
  width: var(--checkin-scene-size);
  height: auto;
}

/* Demo card */
.s-checkin .demo {
  display: grid;
  gap: var(--space-lg);
  padding: var(--space-xl) var(--checkin-card-pad);
  border-radius: var(--radius-card-large);
  color: var(--jet-ink);
}

/* Result stage: the ring and the one-line result, straight on the card. */
.s-checkin .demo-stage {
  display: grid;
  grid-template-columns: auto minmax(0, auto);
  justify-content: center;
  align-items: center;
  gap: var(--space-lg);
}

.s-checkin [data-tone="ready"] {
  --checkin-tone: var(--recovery);
  --checkin-tone-text: var(--recovery-text);
}

.s-checkin [data-tone="steady"] {
  --checkin-tone: var(--caution);
  --checkin-tone-text: var(--caution-text);
}

.s-checkin [data-tone="recover"] {
  --checkin-tone: var(--effort);
  --checkin-tone-text: var(--effort-text);
}

.s-checkin .ring {
  position: relative;
  width: var(--checkin-ring-size);
  aspect-ratio: 1;
}

.s-checkin .ring-svg {
  width: 100%;
  height: 100%;
}

.s-checkin .ring-track {
  stroke: var(--jet-tint);
}

/* The script fades a new colour in on top, quickly; the old arc holds until that is done, then drops. */
.s-checkin .ring-arc {
  opacity: 0;
  transition: opacity 0s linear var(--checkin-arc-swap);
}

.s-checkin .ring-arc--ready {
  stroke: var(--recovery);
}

.s-checkin .ring-arc--steady {
  stroke: var(--caution);
}

.s-checkin .ring-arc--recover {
  stroke: var(--effort);
}

.s-checkin [data-tone="ready"] .ring-arc--ready,
.s-checkin [data-tone="steady"] .ring-arc--steady,
.s-checkin [data-tone="recover"] .ring-arc--recover {
  opacity: 1;
  transition: none;
}

/* A soft halo that scales out and fades when the status changes. Driven from script. */
.s-checkin .ring-glow {
  position: absolute;
  inset: 0;
  border: 7px solid var(--checkin-tone);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.s-checkin .ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.s-checkin .ring-score {
  font-size: var(--checkin-score-size);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* The score as three rolling digit columns (built by the script). */
.s-checkin .ring-score.is-rolling {
  letter-spacing: 0;
}

.s-checkin .digits {
  display: flex;
  transition: transform var(--duration-snappy) var(--ease-standard);
}

.s-checkin .ring-score[data-digits="2"] .digits {
  transform: translateX(-0.5ch);
}

.s-checkin .ring-score[data-digits="1"] .digits {
  transform: translateX(-1ch);
}

/* Window a little taller than a digit, cells taller still: a digit glides out through a soft edge before the next arrives. */
.s-checkin .digit {
  display: block;
  width: 1ch;
  height: var(--checkin-digit-window);
  margin-block: calc((1em - var(--checkin-digit-window)) / 2);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 17%, #000 83%, transparent);
  mask-image: linear-gradient(transparent, #000 17%, #000 83%, transparent);
  transition: opacity var(--duration-rest) var(--ease-standard);
}

.s-checkin .digit.is-off {
  opacity: 0;
}

.s-checkin .digit-strip {
  display: flex;
  flex-direction: column;
  margin-top: calc((var(--checkin-digit-window) - var(--checkin-digit-pitch)) / 2);
  transition: opacity 0.14s linear;
}

.s-checkin .digit-strip span {
  display: block;
  height: var(--checkin-digit-pitch);
  line-height: var(--checkin-digit-pitch);
  text-align: center;
}

.s-checkin .ring-unit {
  margin-top: 0.4em;
  font-size: var(--checkin-unit-size);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-tertiary);
}

/* The result, said once, as a boarding pass: what today's session becomes, and a stub with its icon. */
.s-checkin .result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 64px;
  background: var(--jet-tint);
  border-radius: var(--checkin-pass-radius);
}

.s-checkin .result-main {
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
  padding: var(--space-sm) var(--space-md) var(--space-sm) 14px;
}

.s-checkin .result-tag {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--jet);
}

.s-checkin .result-text {
  font-size: var(--checkin-effect-size);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

/* The tear-off stub: a dashed rule with a notch punched out at each end. */
.s-checkin .result-stub {
  position: relative;
  display: grid;
  place-items: center;
  padding-inline: var(--space-md);
  border-left: 2px dashed var(--checkin-pass-rule);
}

.s-checkin .result-stub::before,
.s-checkin .result-stub::after {
  content: "";
  position: absolute;
  left: calc(var(--checkin-pass-notch) / -2 - 1px);
  width: var(--checkin-pass-notch);
  height: var(--checkin-pass-notch);
  background: var(--surface);
  border-radius: 50%;
}

.s-checkin .result-stub::before {
  top: calc(var(--checkin-pass-notch) / -2);
}

.s-checkin .result-stub::after {
  bottom: calc(var(--checkin-pass-notch) / -2);
}

.s-checkin .result-icon {
  width: var(--checkin-result-icon);
  height: var(--checkin-result-icon);
  background: center / contain no-repeat;
}

.s-checkin [data-tone="ready"] .result-icon,
.s-checkin .preset--rested .preset-icon {
  background-image: url("/assets/icons/icon-takeoff.svg");
}

.s-checkin [data-tone="steady"] .result-icon,
.s-checkin .preset--average .preset-icon {
  background-image: url("/assets/icons/icon-dumbbell.svg");
}

.s-checkin [data-tone="recover"] .result-icon,
.s-checkin .preset--rough .preset-icon {
  background-image: url("/assets/icons/icon-moon.svg");
}

.s-checkin .demo-controls {
  width: 100%;
  max-width: var(--checkin-controls-width);
  margin-inline: auto;
}

/* Questions: a glyph in a tinted disc, a one-word name, the chosen answer, and five numbered dots. */
.s-checkin .questions {
  display: grid;
  gap: var(--checkin-row-gap);
}

.s-checkin .q {
  display: grid;
  gap: var(--space-xs);
  min-width: 0;
}

.s-checkin .q-label {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  column-gap: var(--space-sm);
  font-size: 15px;
  line-height: 1.3;
}

.s-checkin .q-icon {
  display: grid;
  place-items: center;
  width: var(--checkin-q-icon);
  height: var(--checkin-q-icon);
  background: var(--jet-tint);
  border-radius: 50%;
}

.s-checkin .q-icon svg {
  width: 62%;
  height: 62%;
}

.s-checkin .q-name {
  font-weight: 600;
}

.s-checkin .q-value {
  justify-self: end;
  font-size: 14px;
  color: var(--ink-secondary);
  white-space: nowrap;
}

.s-checkin .seg {
  display: flex;
  justify-content: space-between;
  gap: var(--space-xs);
}

.s-checkin .seg-option {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--tap-min);
  height: var(--tap-min);
  -webkit-tap-highlight-color: transparent;
}

.s-checkin .seg-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
}

.js .s-checkin .seg-input:enabled {
  cursor: pointer;
}

.s-checkin .seg-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--checkin-dot);
  height: var(--checkin-dot);
  background: var(--jet-tint);
  border-radius: 50%;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  transition: transform var(--duration-rest) var(--ease-snappy);
}

.s-checkin .seg-input:checked + .seg-dot {
  background: var(--jet);
  color: #fff;
}

.s-checkin .seg-input:enabled:active + .seg-dot {
  transform: scale(0.9);
}

.s-checkin .seg-input:focus-visible + .seg-dot {
  outline: 2px solid var(--jet);
  outline-offset: 2px;
}

/* Scripts off: nothing here can be tapped, so only the chosen answers stand out and the one-tap mornings go. */
html:not(.js) .s-checkin .seg-input:not(:checked) + .seg-dot {
  opacity: 0.45;
}

html:not(.js) .s-checkin .presets {
  display: none;
}

/* One-tap example mornings: three equal chips, each with the icon of the pass it prints. */
.s-checkin .presets {
  margin-top: var(--space-xl);
}

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

.s-checkin .preset {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 48px;
  padding: var(--space-xs) var(--space-sm);
  background: var(--jet-tint);
  color: var(--jet-ink);
  border: 0;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--duration-rest) var(--ease-snappy);
}

.s-checkin .preset-icon {
  flex: none;
  width: var(--checkin-preset-icon);
  height: var(--checkin-preset-icon);
  background: var(--surface) center / 68% no-repeat;
  border-radius: 50%;
}

/* Hover tone as an overlay, so only opacity animates. */
.s-checkin .preset::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--jet);
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-rest) var(--ease-standard);
}

.s-checkin .preset[aria-pressed="true"] {
  background: var(--jet);
  color: #fff;
}

.s-checkin .preset:focus-visible {
  outline: 2px solid var(--jet);
  outline-offset: 2px;
}

@media (hover: hover) {
  .s-checkin .seg-input:enabled:not(:checked):hover + .seg-dot {
    transform: scale(1.08);
  }

  .s-checkin .preset:not([aria-pressed="true"]):hover::after {
    opacity: 0.1;
  }
}

.s-checkin .preset:active {
  transform: scale(0.95);
}

/* Entry: the rows rise in one after another (the script numbers them) once it has armed the demo. */
@media (prefers-reduced-motion: no-preference) {
  .s-checkin .demo.is-armed .q,
  .s-checkin .demo.is-armed .presets {
    transition:
      opacity var(--duration-gentle) var(--ease-standard),
      transform var(--duration-gentle) var(--ease-standard);
    transition-delay: calc(var(--checkin-row, 0) * var(--checkin-stagger));
  }

  .s-checkin .demo.is-armed:not(.is-in) .q,
  .s-checkin .demo.is-armed:not(.is-in) .presets {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* Narrow card: the ring is too small to carry a word, so the number stands alone as the score. */
@container (max-width: 419.98px) {
  .s-checkin .ring-unit {
    display: none;
  }
}

/* Smallest phones: a smaller ring, and each chip stacks its icon over its word. */
@container (max-width: 310px) {
  .s-checkin .demo {
    --checkin-ring-size: 92px;
    --checkin-score-size: 40px;
    --checkin-effect-size: 15px;
    --checkin-result-icon: 24px;
  }

  .s-checkin .demo-stage {
    gap: var(--space-md);
  }

  .s-checkin .result-main {
    padding-inline: var(--space-md) var(--space-sm);
  }

  .s-checkin .result-stub {
    padding-inline: var(--space-sm);
  }

  .s-checkin .preset {
    flex-direction: column;
    gap: 2px;
    padding-block: 6px;
    border-radius: var(--radius-control);
    font-size: 13px;
  }
}

/* Roomier card: each question is one line, the name over its answer, the dots at the end. */
@container (min-width: 420px) {
  .s-checkin .demo {
    --checkin-ring-size: 128px;
    --checkin-score-size: 52px;
    --checkin-effect-size: 19px;
    --checkin-result-icon: 32px;
    --checkin-q-icon: 36px;
    gap: var(--space-xxl);
  }

  .s-checkin .demo-stage {
    gap: var(--space-xl);
  }

  .s-checkin .result-main {
    padding-inline: var(--space-lg);
  }

  .s-checkin .q {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-md);
  }

  .s-checkin .q-label {
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: var(--space-md);
  }

  .s-checkin .q-icon {
    grid-row: span 2;
  }

  .s-checkin .q-value {
    grid-column: 2;
    justify-self: start;
    font-size: 13px;
    line-height: 1.2;
  }

  .s-checkin .seg {
    gap: var(--space-sm);
  }
}

/* Wide card: the ring and its pass stand on the left, the questions on the right. */
@container (min-width: 680px) {
  .s-checkin .demo {
    --checkin-ring-size: 200px;
    --checkin-score-size: 80px;
    --checkin-unit-size: 12px;
    --checkin-effect-size: 20px;
    grid-template-columns: var(--checkin-stage-column) minmax(0, var(--checkin-controls-width));
    justify-content: space-evenly;
    align-items: center;
    gap: var(--space-xxxl);
    padding: 28px;
  }

  .s-checkin .demo-stage {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: var(--space-xl);
  }

  .s-checkin .result {
    justify-self: stretch;
  }

  .s-checkin .presets {
    margin-top: var(--space-xxl);
  }
}

@media (min-width: 640px) {
  .s-checkin {
    --checkin-card-pad: var(--space-xl);
    --checkin-stage-pad: var(--space-xxl);
    --checkin-stage-radius: 40px;
    --checkin-scene-size: 176px;
  }

  .s-checkin .checkin-stage {
    margin-inline: 0;
    margin-top: var(--space-section);
    padding-top: var(--space-xl);
  }
}

/* Side by side: the mascot on the left, the card filling the rest. */
@media (min-width: 900px) {
  .s-checkin {
    --checkin-scene-size: 190px;
  }

  .s-checkin .checkin-stage {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: var(--space-xxl);
    padding-top: var(--checkin-stage-pad);
  }
}

@media (min-width: 1140px) {
  .s-checkin {
    --checkin-stage-pad: var(--space-xxxl);
    --checkin-scene-size: 220px;
  }

  .s-checkin .checkin-stage {
    gap: var(--space-xxxl);
  }
}

/* The mascot's face follows the score. */
.s-checkin .checkin-stage:has([data-ring][data-tone="steady"]) .mood-ok,
.s-checkin .checkin-stage:has([data-ring][data-tone="recover"]) .mood-tired {
  opacity: 1;
}

.s-checkin .checkin-stage:has([data-ring][data-tone="recover"]) .mood {
  transform: var(--mood-droop);
}
