kitbash Sign in Connect agent
Components

Captioned film still

A dark picture in a black frame with a bracketed caption that changes cue and a sound toggle.

Part of the style

Line Screen Folio

6 parts that belong together, with their tokens, type and rules.

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --night: #251a1a;
  --night-raised: #2c2121;
  --night-warm: #342929;
  --ivory: #fbf4ee;
  --ivory-soft: rgba(251, 244, 238, 0.62);
  --ivory-faint: rgba(251, 244, 238, 0.32);
  --rule: rgba(251, 244, 238, 0.16);
  --paper: #f7f0ea;
  --paper-shade: #e6dfd9;
  --ink: #2e2222;
  --ink-soft: #6e6262;
  --screen-ice: #fef7f1;
  --black: #070202;
  --rule-faint: rgba(251, 244, 238, 0.06);
  --night-panel: #211717;
  --silver: #c9c1ba;
  --screen-blue: #87645e;
  --folder-deep: #c0afac;
  --screen-steel: #958c8a;
  --screen-night: #1c1716;
  --folder-light: #f9efed;
  --screen-sepia: #a07b75;
  --copper: #be7266;
}
</style>

<section class="film" aria-label="Film still">
  <figure class="film__frame">
    <div class="film__window">
      <img class="film__picture" src="assets/night-carriage.jpg" alt="Two travellers dozing in a railway carriage at night" width="1200" height="989" loading="lazy">
    </div>
    <figcaption class="film__caption" aria-live="polite">
      <span class="film__cue is-current">[ whistle, far down the line ]</span>
      <span class="film__cue">[ a ledger closes ]</span>
      <span class="film__cue">[ rain on the window ]</span>
    </figcaption>
    <button class="film__sound" type="button" aria-pressed="false" aria-label="Sound off">
      <svg class="film__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
        <path class="film__speaker" d="M4 9.5h3.2L11.5 6v12l-4.3-3.5H4z" />
        <path class="film__mute" d="M15 9.5l5 5M20 9.5l-5 5" />
        <path class="film__waves" d="M15 9a4 4 0 0 1 0 6M17.5 6.5a7.5 7.5 0 0 1 0 11" />
      </svg>
    </button>
  </figure>
</section>

<style>
  .film {
    padding: var(--space-l) var(--edge);
    background: var(--night);
  }
  .film__frame {
    position: relative;
    display: grid;
    justify-items: center;
    gap: var(--space-m);
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(1.5rem, 4vw, 3.5rem) clamp(1rem, 7vw, 6rem) clamp(3.5rem, 6vw, 5rem);
    background: var(--black);
    border: var(--line) solid var(--rule-faint);
  }
  .film__window {
    width: 100%;
    aspect-ratio: 16 / 7;
    overflow: hidden;
    background: var(--night-raised);
  }
  .film__picture {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.5) contrast(1.2) saturate(0.7) sepia(0.25);
    object-position: 50% 45%;
    animation: film-drift 24s var(--ease) infinite alternate;
  }
  @keyframes film-drift {
    from { transform: scale(1.02) translateX(0); }
    to { transform: scale(1.12) translateX(-2%); }
  }
  .film__caption {
    display: grid;
    min-height: 1.6em;
    color: var(--ivory);
    font-family: var(--font-sans);
    font-size: clamp(0.8rem, 1.1vw, 0.95rem);
    font-style: italic;
    letter-spacing: var(--track-label);
    text-transform: uppercase;
  }
  .film__cue {
    grid-area: 1 / 1;
    justify-self: center;
    white-space: nowrap;
    opacity: 0;
    transition: opacity var(--fade) var(--ease);
  }
  .film__cue.is-current { opacity: 1; }
  .film__sound {
    position: absolute;
    right: var(--space-s);
    bottom: var(--space-s);
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-s);
    background: none;
    color: var(--ivory-soft);
    cursor: pointer;
    transition: color var(--quick) ease-out;
  }
  .film__sound:hover,
  .film__sound:focus-visible { color: var(--ivory); }
  .film__sound:focus-visible { outline: var(--line) solid var(--ivory); }
  .film__icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .film__waves { display: none; }
  .film__sound.is-on .film__waves { display: inline; }
  .film__sound.is-on .film__mute { display: none; }

  @media (prefers-reduced-motion: reduce) {
    .film__picture { animation: none; transform: scale(1.04); }
  }
</style>

<script>
  (() => {
    const still = matchMedia('(prefers-reduced-motion: reduce)');
    for (const root of document.querySelectorAll('.film')) {
      const cues = [...root.querySelectorAll('.film__cue')];
      const sound = root.querySelector('.film__sound');
      const picture = root.querySelector('.film__picture');
      let index = 0;
      let timer = 0;
      const step = () => {
        cues[index].classList.remove('is-current');
        index = (index + 1) % cues.length;
        cues[index].classList.add('is-current');
      };
      new IntersectionObserver(([entry]) => {
        clearInterval(timer);
        picture.style.animationPlayState = entry.isIntersecting ? 'running' : 'paused';
        if (entry.isIntersecting && !still.matches) timer = setInterval(step, 4000);
      }).observe(root);
      sound.addEventListener('click', () => {
        const on = sound.classList.toggle('is-on');
        sound.setAttribute('aria-pressed', String(on));
        sound.setAttribute('aria-label', on ? 'Sound on' : 'Sound off');
      });
    }
  })();
</script>

Similar components

Edge-to-edge plate

Edge-to-edge plate

Open plate

Open plate

Grain player

Grain player

Bleed

Bleed

Cut-letter plate

Cut-letter plate

Grain deck

Grain deck

Film player

Film player

Record button preview

Record button preview