/* THE INTRO COMPONENT — the look of the short film beside the entry's
 * headline (C.215; markup in `_kit_intro.html`, behaviour in
 * `kit/intro.js`).
 *
 * C.226 (home-9 point 2): the film is the right column of the entry's
 * hero grid (`.kit-entry-hero`, abbundo.css), which places it; this file
 * only draws it. The film's frame is the theatre panel's own colours,
 * because the film is a dark picture and the frame is what shows while
 * the first frame loads.
 *
 * The first frame (the poster), the film and the end still all cover
 * the frame, so the picture never changes size between them and the
 * page does not move when the film starts or ends. */

.kit-intro { margin: 0; }

/* The frame cuts nothing (batch 39e, no-clipped-text): the picture and
   the control bar round their own corners to the frame's inner radius,
   so a control whose words outgrow the bar shows them rather than losing
   them at the frame's edge. */
.kit-intro-frame {
  /* the replay button sizes itself by the frame's width (C.226) */
  container-type: inline-size;
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--stage-bg);
  border: var(--hairline) solid var(--stage-line);
  border-radius: var(--radius);
}

.kit-intro-video,
.kit-intro-end {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius) - var(--hairline));
}

.kit-intro-video[hidden],
.kit-intro-end[hidden] { display: none; }

/* THE FILM'S OWN CONTROLS (owner 27.10.): drawn by hand from the kit's
   icons and the stage tokens, on the frame, never the browser's. The
   bar stands at the foot and is shown on hover and on focus (a keyboard
   reader tabs into it, so it is never out of reach), and on a touch
   screen whenever the film is paused. Once the film has ended the bar
   is gone and the replay button stands in the frame's top-right corner
   (C.226, home-9 law H7: it stood in the middle, on the arrow), clear of
   the end still's picture and of the end line at its foot. */
/* C.226 (home-9 law H7): the bar is as wide as its two buttons, in the
   frame's bottom-left corner, so even while it shows it covers nothing of
   the end block the last frames carry (the gate reads it out of the end stills) */
.kit-intro-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  border-top-right-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: var(--stage-bar);
  color: var(--stage-ink);
  border-radius: 0 0 calc(var(--radius) - var(--hairline)) calc(var(--radius) - var(--hairline));
  opacity: 0;
  /* a bar that is not shown takes no press either */
  pointer-events: none;
}

.kit-intro-frame:hover .kit-intro-bar,
.kit-intro-frame:focus-within .kit-intro-bar,
.kit-intro.is-shown .kit-intro-bar {
  opacity: 1;
  pointer-events: auto;
}

/* On a touch screen a bar that is not shown is INERT: not drawn, so not
   focusable and not tappable (an invisible sound button must not answer a
   stray tap). It stands while the film is paused, and for a few seconds
   after a tap on the film (kit/intro.js), which shows it before anything
   else happens. */
@media (hover: none) {
  .kit-intro-bar { visibility: hidden; }
  .kit-intro.is-paused .kit-intro-bar,
  .kit-intro.is-shown .kit-intro-bar {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }
}

.kit-intro.is-ended .kit-intro-bar { display: none; }

.kit-intro .kit-intro-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--stage-ink);
  outline-offset: calc(-1 * var(--focus-ring-width));
}

.kit-intro .kit-intro-btn:hover { background: var(--stage-hover-bg); }
.kit-intro .kit-intro-btn[hidden] { display: none; }

/* each toggle draws the icon of the act a press does: play while the
   film stands, pause while it runs; the speaker while it sounds, the
   crossed speaker while it is muted */
.kit-intro-toggle[data-on] .kit-icon-play,
.kit-intro-toggle:not([data-on]) .kit-icon-pause,
.kit-intro-mute[data-on] .kit-icon-speaker-off,
.kit-intro-mute:not([data-on]) .kit-icon-speaker { display: none; }

/* the place is a token (abbundo.css, --intro-replay-*):
   the button stays above the share of the frame the end still keeps
   clear, as large as the tap target where the frame allows */
.kit-intro .kit-intro-replay {
  position: absolute;
  top: var(--intro-replay-top);
  right: var(--intro-replay-right);
  background: var(--stage-bar);
  border: var(--hairline) solid var(--stage-line-strong);
  border-radius: 50%;
}
