/* ==========================================================================
   Workflow Studio — showreel
   media.css
   The window frame around a screenshot, and the still/motion switch inside it.
   ========================================================================== */

/* --- Window / media frame ------------------------------------------------- */

/* Borderless: no rule, no card, no shadow, no rounded corners — the footage and
   the stills sit straight on the page. overflow stays, so the wipe's sweep is
   still clipped to the frame. */
.window {
  overflow: hidden;
}

.window-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-raised);
}

.window-dots {
  display: flex;
  gap: 6px;
}

.window-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-strong);
}

.window-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.window-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--completed);
}

.media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface);
}

.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Still / motion switch -------------------------------------------------
   Two stacked layers in one frame: a screenshot of the module, then the how-to
   footage wiped over it. Everything here is driven by [data-state] on the
   container, so a second panel needs the markup and nothing else — no
   per-panel rules.
   -------------------------------------------------------------------------- */

.media-switch {
  overflow: hidden;
}

.media-layer {
  position: absolute;
  inset: 0;
}

/* contain, not cover: the still is an interface at its own aspect ratio and
   cropping it would cut off the very panel it is here to show. The 16/9 frame
   letterboxes it against the card. */
.media-layer img {
  object-fit: contain;
}

/* Closed from the right, so it opens left to right. Sits above the still, and
   being 16/9 it covers the frame completely once open — nothing to fade. */
.media-layer.is-motion {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.media-switch[data-state='motion'] .media-layer.is-motion {
  clip-path: inset(0);
}

/* The leading edge of the wipe. Travelling on `left` keeps it measured against
   the frame; a percentage transform would only ever move it by its own 2px. Its
   timing mirrors the clip-path above, which is what keeps the two together. */
.media-sweep {
  position: absolute;
  inset-block: 0;
  left: 0;
  width: 2px;
  background: var(--accent);
  box-shadow: 0 0 20px 3px rgba(216, 181, 111, 0.45);
  opacity: 0;
  pointer-events: none;
}

.media-switch.is-wiping .media-sweep {
  animation: media-sweep 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes media-sweep {
  from {
    left: 0;
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  88% {
    opacity: 1;
  }
  to {
    left: 100%;
    opacity: 0;
  }
}

.media-toggle {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px 7px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  /* Reads over both a bright screenshot and dark footage. */
  background: rgba(15, 15, 15, 0.62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.media-toggle:hover {
  background: rgba(15, 15, 15, 0.82);
  border-color: var(--accent);
}

.media-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.media-toggle svg {
  width: 13px;
  height: 13px;
  color: var(--accent);
}

.media-toggle .icon-play {
  fill: currentColor;
}

/* One icon per state, so the button always shows what pressing it will do. */
.media-switch[data-state='still'] .media-toggle .icon-still,
.media-switch[data-state='motion'] .media-toggle .icon-play {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .media-layer.is-motion {
    transition: none;
  }

  .media-switch.is-wiping .media-sweep {
    animation: none;
  }
}
