/* Community Viber locality motion — Coos Bay header.
   Every selector is .pbl-motion-* or scoped under it, so no county, market, locality,
   fourteen.css or ad-rail rule is touched and no inherited layout is overridden.

   Geometry: the header stylesheet forces the still to 1600/552. The still STAYS IN FLOW and
   keeps defining the box height, so nothing reflows when motion loads or fails.

   The approved loop is 1112x834 while the box is 1600x552, so `contain` letterboxes it. The
   letterbox area is a solid purple matte, never the still: showing the still beside a
   differently framed generated frame would put two versions of the same scene side by side.
   The still is therefore hidden (visibility only, so it keeps its space) exactly while the
   video is ready, and restored the moment the video fails. */

.pbl-motion-box {
  position: relative;
  display: block;
  overflow: hidden;
  line-height: 0;
}

.pbl-motion-box .pbl-motion-still {
  display: block;
  width: 100%;
  height: auto;
}

/* Hidden only while the video is actually ready; visibility keeps the box's geometry. */
.pbl-motion-box[data-ready="1"] .pbl-motion-still { visibility: hidden; }

.pbl-motion-box .pbl-motion-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #23134e;          /* the matte behind the contained frame */
  opacity: 0;
  transition: opacity .25s linear;
  pointer-events: none;
}

/* Shown once ready, and it stays shown while paused: pausing must not crop or swap the frame. */
.pbl-motion-box[data-ready="1"] .pbl-motion-video { opacity: 1; }

.pbl-motion-box.pbl-motion-failed .pbl-motion-video { display: none; }

.pbl-motion-toggle {
  position: absolute;
  right: .6rem;
  bottom: .6rem;
  z-index: 2;
  margin: 0;
  padding: .35rem .7rem;
  font: inherit;
  font-size: .78rem;
  line-height: 1.2;
  color: #110c2b;
  background: #ffcf54;
  border: 2px solid #110c2b;
  border-radius: 999px;
  cursor: pointer;
}

.pbl-motion-toggle:hover { background: #ffeea4; }
.pbl-motion-toggle:focus-visible { outline: 3px solid #fff2c6; outline-offset: 2px; }

.pbl-motion-note {
  display: block;
  font-style: italic;
  opacity: .85;
}

@media (prefers-reduced-motion: reduce) {
  .pbl-motion-box .pbl-motion-video { transition: none; }
}
