/*
 * The walkthrough video: the landing page hero and /extension/about both show it,
 * through templates/components/walkthrough.mustache, which loads this file.
 *
 * Pixels matter here. The 1x video is 1024 wide and the frame adds a 1px border each
 * side, so on a wide screen it is drawn at exactly its own pixels. The browser only
 * ever shrinks it on screens too narrow to hold it.
 */

.landing-walkthrough {
  width: min(100%, 1026px);
  margin: clamp(0.75rem, 2vw, 1.25rem) 0 0;
}

.landing-walkthrough__frame {
  overflow: hidden;
  background: #202124;
  border: 1px solid color-mix(in oklch, var(--line) 60%, #000);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-overlay);
}

.landing-walkthrough__video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: #202124;
  cursor: pointer;
}

/* The caption and control bar are part of the video's dark frame in both themes. */
.landing-walkthrough__caption {
  display: flex;
  min-height: 3.4em;
  margin: 0;
  padding: 0.625rem 1.125rem;
  flex-direction: column;
  justify-content: center;
  background: #161616;
  border-top: 1px solid #000;
  color: #f1f1f1;
  font-size: clamp(0.95rem, 1.6vw, 1.1rem);
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
}

.landing-walkthrough__caption b {
  color: oklch(0.82 0.15 68);
  font-weight: 600;
}

.landing-walkthrough__step {
  margin-bottom: 0.2rem;
  color: #a8a8a8;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.landing-walkthrough__controls {
  display: flex;
  padding: 0.25rem 0.875rem 0.5rem 0.375rem;
  align-items: center;
  gap: 0.75rem;
  background: #161616;
  color: #d6d6d6;
}

.landing-walkthrough__controls[hidden] {
  display: none;
}

.landing-walkthrough__play {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
  place-items: center;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  color: inherit;
  cursor: pointer;
}

.landing-walkthrough__play:hover,
.landing-walkthrough__play:focus-visible {
  background: #2a2a2a;
  color: #fff;
}

.landing-walkthrough__play svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.landing-walkthrough__icon-play,
.landing-walkthrough__play.is-paused .landing-walkthrough__icon-pause {
  display: none;
}

.landing-walkthrough__play.is-paused .landing-walkthrough__icon-play {
  display: block;
}

/* One segment per chapter; click or drag anywhere to seek. */
.landing-walkthrough__timeline {
  position: relative;
  min-width: 0;
  flex: 1;
  padding: 0.6875rem 0;
  cursor: pointer;
  outline: none;
  touch-action: none;
}

.landing-walkthrough__timeline:focus-visible {
  border-radius: 3px;
  box-shadow: 0 0 0 2px oklch(0.82 0.15 68);
}

.landing-walkthrough__segments {
  display: flex;
  height: 6px;
  gap: 3px;
  transition: height var(--transition-fast);
}

.landing-walkthrough__timeline.is-dragging .landing-walkthrough__segments,
.landing-walkthrough__timeline:focus-visible .landing-walkthrough__segments {
  height: 9px;
}

.landing-walkthrough__segment {
  position: relative;
  overflow: hidden;
  background: rgb(255 255 255 / 0.22);
  border-radius: 2px;
}

.landing-walkthrough__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: oklch(0.79 0.15 68);
}

.landing-walkthrough__tip {
  position: absolute;
  bottom: calc(100% + 2px);
  padding: 0.25rem 0.5rem;
  background: #000;
  border-radius: 4px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity var(--transition-fast);
}

.landing-walkthrough__timeline.is-dragging .landing-walkthrough__tip {
  opacity: 1;
}

/* On touch screens a tap would leave the hover state, and the tip, stuck on. */
@media (hover: hover) {
  .landing-walkthrough__timeline:hover .landing-walkthrough__segments {
    height: 9px;
  }

  .landing-walkthrough__timeline:hover .landing-walkthrough__tip {
    opacity: 1;
  }
}

.landing-walkthrough__time {
  flex: none;
  color: #a8a8a8;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.landing-walkthrough__chapters {
  display: grid;
  margin: 0.75rem 0 0;
  padding: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  list-style: none;
}

.landing-walkthrough__chapters[hidden] {
  display: none;
}

.landing-walkthrough__chapters button {
  position: relative;
  width: 100%;
  padding: 0.625rem 0.75rem 0.75rem;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1.35;
  text-align: left;
}

.landing-walkthrough__chapters button b {
  display: block;
  margin-bottom: 0.125rem;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.landing-walkthrough__chapters button.is-current {
  border-color: var(--accent);
}

.landing-walkthrough__chapters button.is-current b {
  color: var(--accent);
}

.landing-walkthrough__chapter-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--accent);
}

@media (min-width: 760px) {
  .landing-walkthrough__chapters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
