/* CoderFlow website: video component (scripts/coderflow-site/media.mjs renders it, video.js drives it).
   Loaded only on pages with a video slot, after style.css, and uses its brand variables. Kept out of style.css. */

/* Frame: the screenshot .frame look (rounded, bordered, shadowed) without the fake browser bar */
.cf-media { position: relative; }
.cf-frame { background: var(--navy); }
.cf-frame > video, .cf-frame > img.cf-poster { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Loop play/pause button: always available (WCAG 2.2.2), the only control a silent loop has */
.cf-loop-toggle {
  position: absolute; right: 12px; bottom: 12px; z-index: 2;
  width: 36px; height: 36px; padding: 0; display: grid; place-items: center; cursor: pointer;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .4); background: rgba(10, 14, 39, .72); color: #fff;
  transition: background .15s ease;
}
.cf-loop-toggle[hidden] { display: none; }
.cf-loop-toggle:hover { background: rgba(10, 14, 39, .92); }
.cf-loop-ico { display: block; box-sizing: border-box; }
.cf-loop-toggle[data-state="playing"] .cf-loop-ico { width: 12px; height: 12px; border-left: 4px solid #fff; border-right: 4px solid #fff; }
.cf-loop-toggle[data-state="paused"] .cf-loop-ico { width: 0; height: 0; margin-left: 3px; border-style: solid; border-width: 7px 0 7px 11px; border-color: transparent transparent transparent #fff; }

/* Disclosure caption under the player ("Demonstration data · Fictional company" on every loop): outside the frame, so it
   never covers the video or its play/pause button; at least 12 px and slate (>= 4.5:1 on the site's light surfaces) */
.cf-media-caption { margin: 8px 0 0; font-size: max(12px, .8125rem); line-height: 1.4; color: var(--slate); text-align: center; text-wrap: balance; }
.cf-media-caption span { white-space: nowrap; }
.band-dark .cf-media-caption { color: #CBD5E1; }

/* Home, "Keep your agents" (slot index:agents): the loop takes the screenshot's place in a .split section, whose
   paragraph size and color would otherwise apply to the caption. Keep the caption every other loop has. */
#cf-index-agents .cf-media-caption { font-size: max(12px, .8125rem); color: var(--slate); }

/* Explainer poster: the whole frame is the play button; the pill is its visible label */
.cf-play {
  position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center;
  margin: 0; padding: 16px; border: 0; border-radius: inherit; cursor: pointer; font: inherit; color: #fff;
  background: linear-gradient(180deg, rgba(10, 14, 39, 0) 45%, rgba(10, 14, 39, .4));
}
.cf-play-pill {
  display: inline-flex; align-items: center; gap: 12px; max-width: 100%;
  padding: 10px 20px 10px 10px; border-radius: 999px; background: rgba(10, 14, 39, .88);
  font-weight: 700; font-size: .95rem; white-space: nowrap; box-shadow: var(--shadow-lg); transition: transform .2s ease;
}
.cf-play-ico { flex: none; position: relative; display: block; width: 40px; height: 40px; border-radius: 50%; background: var(--gradient); }
.cf-play-ico::before {
  content: ''; position: absolute; left: 50%; top: 50%; transform: translate(-35%, -50%);
  border-style: solid; border-width: 8px 0 8px 13px; border-color: transparent transparent transparent #fff;
}
.cf-play-dur { font-weight: 500; color: #CBD5E1; font-variant-numeric: tabular-nums; }
.cf-play:hover .cf-play-pill, .cf-play:focus-visible .cf-play-pill { transform: scale(1.04); }
/* The frame clips anything outside it, so these focus rings sit inside */
.cf-play:focus-visible { outline: 3px solid #fff; outline-offset: -6px; box-shadow: inset 0 0 0 3px var(--blue-text); border-radius: 18px; }
.cf-loop-toggle:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 5px var(--blue-text); border-radius: 50%; }

/* On-page transcript */
.cf-transcript { margin-top: 14px; text-align: left; font-size: .92rem; color: #334155; }
.cf-transcript-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font-weight: 600; color: var(--blue-text); }
.cf-transcript-toggle::-webkit-details-marker { display: none; }
.cf-transcript-toggle::before { content: '+'; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--blue-50); font-weight: 800; line-height: 1; }
.cf-transcript[open] .cf-transcript-toggle::before { content: '−'; }
.cf-transcript-body { margin-top: 10px; padding: 16px 18px; border-radius: 12px; background: var(--cloud); border: 1px solid var(--slate-200); }
.cf-transcript-body p { margin: 0 0 10px; }
.cf-transcript-body p:last-child { margin: 0; }
.cf-media-overview .cf-transcript { max-width: 760px; margin-left: auto; margin-right: auto; text-align: center; }
.cf-media-overview .cf-transcript-body { text-align: left; }

/* Player dialog */
html.cf-dlg-lock { overflow: hidden; }
dialog.cf-video-dlg {
  width: min(1120px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  padding: 0; border: 0; border-radius: 20px; overflow: auto; background: var(--navy); color: #fff; box-shadow: 0 30px 80px rgba(2, 6, 23, .5);
}
dialog.cf-video-dlg::backdrop { background: rgba(10, 14, 39, .82); backdrop-filter: blur(3px); }
.cf-video-dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 12px 12px 22px; }
.cf-video-dlg-title { margin: 0; font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; color: #fff; }
.cf-video-dlg-close {
  flex: none; width: 40px; height: 40px; padding: 0; cursor: pointer; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .3); background: transparent; color: #fff; font: inherit; font-size: 1.5rem; line-height: 1;
}
.cf-video-dlg-close:hover { background: rgba(255, 255, 255, .12); }
.cf-video-dlg .cf-explainer { display: block; width: 100%; height: auto; max-height: calc(100dvh - 100px); background: #000; }
dialog.cf-video-dlg :focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; box-shadow: none; }
dialog.cf-video-dlg .cf-explainer:focus-visible { outline-offset: -3px; }
.cf-explainer::cue { font-family: var(--font); background: rgba(0, 0, 0, .78); }

/* "Private media preview" in the preview bar (preview builds only) */
.cf-preview-note { display: inline-block; padding: 0 8px; border-radius: 999px; background: rgba(0, 212, 255, .16); color: var(--cyan); font-weight: 700; }

@media (max-width: 640px) {
  .cf-play { padding: 10px; }
  .cf-play-pill { gap: 8px; padding: 6px 14px 6px 6px; font-size: .85rem; }
  .cf-play-ico { width: 32px; height: 32px; }
  .cf-play-ico::before { border-width: 6px 0 6px 10px; }
  .cf-loop-toggle { right: 8px; bottom: 8px; }
  dialog.cf-video-dlg { width: calc(100vw - 16px); border-radius: 14px; }
  .cf-video-dlg-head { padding: 8px 8px 8px 16px; }
  .cf-video-dlg-title { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .cf-play-pill, .cf-loop-toggle { transition: none; }
  .cf-play:hover .cf-play-pill, .cf-play:focus-visible .cf-play-pill { transform: none; }
}
@media print { dialog.cf-video-dlg, .cf-loop-toggle, .cf-play { display: none !important; } }

/* Keep the homepage transcript with its film and readable against the dark dialog. */
.cf-video-dlg .cf-transcript { margin: 0; padding: 18px 22px; background: #fff; color: var(--ink); text-align: left; max-width: none; }
.cf-video-dlg .cf-transcript-body { max-height: 45vh; overflow: auto; }
.cf-video-dlg .cf-transcript :focus-visible { outline-color: var(--blue-text); }
