/* Keep the original wide scene. Selection moves neither the tape nor its target. */
.video-room .photo-vhs-stack .vhs-tape.active .vhs-label-area span {
  color: #203a60;
}

@media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
  .video-room .photo-vhs-stack .vhs-tape-slot:is(:hover, :focus-within) .vhs-tape {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .video-room .photo-tv-shell.switching,
  .video-room .photo-tv-shell.switching .tv-static {
    animation: none;
  }
}

@media (max-width: 1100px) {
  .video-basement {
    container-type: inline-size;
  }

  .video-room {
    --crt: min(calc(100cqw - 32px), 704px);
    --headroom: clamp(20px, 4cqw, 38px);
    /* The opaque CRT starts at y=109 and its feet end at y=1149 of 1254. */
    --crt-top: calc(var(--headroom) - var(--crt) * .087);
    --tv-contact: calc(var(--crt-top) + var(--crt) * .9163);
    --tape-width: min(calc(var(--crt) * .43), 275px);
    --tape-row: max(24px, calc(var(--tape-width) * .146));
    --stack-gap: clamp(22px, calc(var(--crt) * .115), 70px);
    /* The taller stack starts below the screen, even when the minimum hit area dominates. */
    --tape-contact: max(
      calc(var(--tv-contact) + var(--crt) * .045),
      calc(var(--crt-top) + var(--crt) * .675 + 6px + 4 * var(--tape-row))
    );
    --desk-width: max(110cqw, calc(var(--crt) * 1.42));
    --desk-top: calc(var(--tv-contact) - var(--crt) * .014);
    min-height: calc(var(--tape-contact) + clamp(24px, 5cqw, 56px));
  }

  .video-room .tube-tv {
    top: var(--crt-top);
    width: var(--crt);
  }

  .video-room .vintage-table {
    top: var(--desk-top);
    bottom: auto;
    width: var(--desk-width);
    height: auto;
    aspect-ratio: 1742 / 613;
  }

  .video-room .vintage-table img {
    /* Remove the transparent space above the tabletop at y=290 of 903. */
    transform: translateY(-32.115%);
  }

  .video-room .photo-vhs-stack {
    display: grid;
    grid-template-columns: repeat(2, var(--tape-width));
    grid-template-rows: repeat(4, var(--tape-row));
    column-gap: var(--stack-gap);
    top: calc(var(--tape-contact) - 4 * var(--tape-row));
    bottom: auto;
    width: max-content;
    aspect-ratio: auto;
  }

  .video-room .photo-vhs-stack .vhs-tape-slot {
    position: relative;
    top: auto;
    height: auto;
    grid-column: 1;
  }

  .video-room .photo-vhs-stack .vhs-tape-slot:nth-child(n+5) {
    grid-column: 2;
  }

  .video-room .photo-vhs-stack .vhs-tape-slot:is(.slot-1) { grid-row: 1; }
  .video-room .photo-vhs-stack .vhs-tape-slot:is(.slot-2, .slot-5) { grid-row: 2; }
  .video-room .photo-vhs-stack .vhs-tape-slot:is(.slot-3, .slot-6) { grid-row: 3; }
  .video-room .photo-vhs-stack .vhs-tape-slot:is(.slot-4, .slot-7) { grid-row: 4; }

  .video-room .photo-vhs-stack .vhs-tape-art {
    position: absolute;
    bottom: 0;
    height: auto;
  }

  .video-room .photo-vhs-stack .vhs-label-area {
    top: auto;
    bottom: calc(var(--tape-width) * .022);
    height: calc(var(--tape-width) * .100);
  }

  .video-room .photo-vhs-stack .vhs-tape .vhs-label-area span {
    inset: 0;
    padding: 0;
    font-size: clamp(9px, calc(var(--tape-width) * .062), 16px);
    line-height: .96;
  }

  .video-room .photo-vhs-stack .vhs-tape-slot .vhs-tape:focus-visible,
  .video-room .photo-vhs-stack .vhs-tape-slot:hover .vhs-tape {
    transform: none;
  }
}

@media (max-width: 1100px) and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .video-room .photo-vhs-stack .vhs-tape-slot:hover .vhs-tape-art,
  .video-room .photo-vhs-stack .vhs-tape-slot:hover .vhs-label-area {
    translate: var(--tape-pull);
  }

  .video-room .vhs-tape-slot {
    --tape-pull: -6px;
  }

  .video-room .vhs-tape-slot:nth-child(n+5) {
    --tape-pull: 6px;
  }

  .video-room .vhs-tape-art,
  .video-room .vhs-label-area {
    transition: translate 180ms ease-out;
  }
}

@media (max-width: 760px) {
  .video-basement {
    width: 100%;
  }

  .video-room {
    /* The artwork includes 196px of transparent side padding in its 1254px canvas. */
    --crt: calc(100cqw * 1254 / 1058);
    --tape-width: min(88cqw, calc(100cqw - 44px));
    /* Start the stack at the shelf opening, below the tabletop lip. */
    --shelf-top: calc(var(--desk-top) + var(--desk-width) * .058);
    min-height: 0;
    padding: var(--shelf-top) 0 1rem;
    border-inline: 0;
  }

  .video-room .photo-vhs-stack {
    position: relative;
    left: auto;
    top: auto;
    width: var(--tape-width);
    margin-inline: auto;
    transform: none;
    grid-template: none / minmax(0, 1fr);
    row-gap: 2px;
  }

  .video-room .photo-vhs-stack .vhs-tape-slot:is(.slot-1, .slot-2, .slot-3, .slot-4, .slot-5, .slot-6, .slot-7) {
    grid-area: auto;
  }

  .video-room .photo-vhs-stack .vhs-tape-slot .vhs-tape {
    position: relative;
    display: grid;
    place-items: center;
    height: auto;
    min-height: 44px;
  }

  .video-room .photo-vhs-stack .vhs-tape-art {
    position: static;
    grid-area: 1 / 1;
  }

  .video-room .photo-vhs-stack .vhs-label-area {
    position: relative;
    grid-area: 1 / 1;
    left: auto;
    bottom: auto;
    width: 72.5%;
    height: calc(var(--tape-width) * .1);
  }

  .video-room .photo-vhs-stack .vhs-tape .vhs-label-area span {
    font-size: clamp(14px, 4.1cqw, 28px);
    transform: none;
  }

  .video-room .photo-vhs-stack .vhs-tape-slot {
    --tape-pull: 10px;
  }
}
