/* The walkthrough player: a 1280 x 800 stage scaled to fit, the caption under
   it, and the controls. Scenes are drawn in stage pixels. */

.wt {
  display: grid;
  justify-items: center;
  gap: 14px;
  max-width: 1280px;
  margin-inline: auto;

  &:fullscreen {
    align-content: center;
    padding: 12px;
    background: var(--paper);
  }
}

.wt-viewport {
  position: relative;
  overflow: hidden;
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-2);
  box-shadow: 8px 8px 0 var(--shade);
}

.wt-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 1280px;
  height: 800px;
  overflow: hidden;
  transform-origin: 0 0;
  font-size: 16px;
  line-height: 1.4;
}

.wt-scene {
  position: absolute;
  inset: 0;
  background-color: var(--paper-2);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px);
  background-size: 80px 80px;
  font-size: 18px;
}

.wt-scene [data-x] {
  position: absolute;
}

.wt-scene [data-enter] {
  opacity: 0;
}

/* ---------- marker ink, notes, pointer and badges ---------- */

.wt-ink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;

  path {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
  }
  /* A note's arrow is as quiet as the note. */
  .wt-note-arrow {
    stroke: var(--ink-3);
    stroke-width: 2;
  }
}

.wt-note {
  max-width: 250px;
  margin: 0;
  font-size: 19px;
  line-height: 1.35;
  color: var(--ink-2);
  opacity: 0;
  pointer-events: none;
}

.wt-cursor {
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 36px;
  margin: -3px 0 0 -4px;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgb(0 0 0 / 0.35));

  path {
    fill: #fff;
    stroke: #111;
    stroke-width: 1.6;
    stroke-linejoin: round;
  }
}

.wt-ripple {
  position: absolute;
  top: 0;
  left: 0;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.wt-key {
  position: absolute;
  left: 50%;
  bottom: 70px;
  min-width: 80px;
  padding: 10px 24px 8px;
  border: 2px solid var(--ink);
  border-bottom-width: 6px;
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  font: 500 44px/1.1 var(--font-mono);
  text-align: center;
  translate: -50% 0;
  opacity: 0;
  box-shadow: 0 10px 30px var(--shade);
  pointer-events: none;
}

.wt-speed {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: 500 18px/1.3 var(--font-mono);
  letter-spacing: 0.06em;

  &[hidden] {
    display: none;
  }
}

/* ---------- scene building blocks ----------
   Mock windows, meters and buttons that scenes are drawn with. */

.muted {
  color: var(--ink-2);
}

.good {
  color: var(--ok);
  font-weight: 600;
}

/* Two or more states stacked in one spot, so one can fade into the other. */
.swap {
  display: grid;

  > * {
    grid-area: 1 / 1;
  }
}

.win {
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 10px 10px 0 var(--shade);
}

.win-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 40px;
  padding: 0 16px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--ink-2);

  &::after {
    content: "";
    width: 54px;
    height: 12px;
    margin-left: auto;
    background: radial-gradient(circle, var(--ink-3) 5px, transparent 5.5px) 0
      50% / 18px 12px repeat-x;
  }
}

.win-head {
  padding: 18px 26px 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);

  h3 {
    margin-bottom: 6px;
    font-size: 30px;
    font-stretch: 75%;
    font-weight: 600;
  }

  p + p {
    margin-top: 4px;
  }
}

.win-body {
  padding: 18px 26px;
}

.win-foot {
  padding: 0 26px 20px;
}

.fake-btn {
  display: inline-block;
  padding: 9px 18px;
  border: var(--line) solid var(--ink);
  border-radius: 9px;
  font-weight: 600;

  &.is-primary {
    background: var(--ink);
    color: var(--paper);
  }

  &.is-pressed {
    background: var(--accent-ink);
    border-color: var(--accent-ink);
    color: var(--on-accent);
  }

  &.is-danger {
    border-color: var(--danger);
    color: var(--danger);
  }

  &.is-armed {
    background: var(--danger);
    color: var(--paper);
  }
}

.meter {
  height: 12px;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--paper-2);

  span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--accent);
  }
}

/* ---------- caption and controls ---------- */

.wt-bottom {
  display: grid;
  gap: 12px;
  width: 100%;
}

.wt-caption {
  min-height: 5.2em;

  .wt-text {
    max-width: 52em;
    margin-top: 6px;
    font-size: clamp(1.02rem, 1.6vw, 1.18rem);
    line-height: 1.5;
  }
}

.wt-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.wt-time {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.wt-chapters {
  width: 100%;
}

.wt-track {
  display: flex;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;

  li {
    min-width: 0;
  }
}

.wt-seg {
  position: relative;
  display: block;
  width: 100%;
  padding: 14px 0 0;
  border: 0;
  background: none;
  color: var(--ink-3);
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;

  &::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    border-radius: 3px;
    background: var(--rule);
  }

  &[aria-current] {
    color: var(--ink);
    font-weight: 600;
  }

  &:hover {
    color: var(--accent-ink);
  }
}

.wt-seg-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 6px;
  border-radius: 3px;
  background: var(--accent);
}

.wt-seg-label {
  display: block;
  overflow: hidden;
  padding-top: 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .wt-seg-label {
    position: absolute;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
  }
}

.wt-transcript {
  max-width: 52em;
  margin: clamp(24px, 4vw, 40px) auto 0;

  summary {
    font-weight: 600;
    cursor: pointer;
  }

  ol {
    display: grid;
    gap: 18px;
    margin-top: 16px;
    padding-left: 1.4em;
  }

  h2 {
    font-size: 1.25rem;
    font-stretch: 78%;
    font-weight: 600;
    margin-bottom: 6px;
  }

  p {
    color: var(--ink-2);
    margin-bottom: 0.5em;
  }
}

.wt-credits {
  max-width: 52em;
  margin: 18px auto 0;
  font-size: 0.85rem;
  color: var(--ink-3);
}
