/* B-Roll Engine screen (owner sketch IMG_8585, CONTRACT.md W3): source
   chips + search row over a 4-across tile grid, selected tiles green with
   a checkmark, Next Step in a sticky footer card. House radii only
   (--radius-sm 6 / --radius-md 10 / --radius-lg 12) and existing tokens —
   no new visual system, and nothing hard-coded that the glow theme
   (glow.css, data-glow="on") would have to fight. */

.vbroll-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.vbroll-project-note {
  margin: 0 0 12px;
}

.vbroll-search-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vbroll-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.vbroll-chip {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.vbroll-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* A site with no key can't be searched — shown, but visibly off and not
   clickable, rather than pretending it works. */
.vbroll-chip-off {
  opacity: 0.5;
  cursor: default;
  color: var(--text-muted);
}

.vbroll-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.vbroll-query {
  flex: 1;
  min-width: 0;
}

.vbroll-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.vbroll-section-title {
  margin: 20px 0 10px;
}

.vbroll-results {
  margin-bottom: 16px;
}

.vbroll-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

/* Wrapper so the Watch button can sit visually inside the tile while
   staying a DOM sibling of the select button (no nested <button>). */
.vbroll-tile-wrap {
  position: relative;
  display: flex;
}

.vbroll-tile {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.vbroll-tile:focus-visible {
  outline: 2px solid var(--focus-ring, var(--primary));
  outline-offset: 2px;
}

/* Selected = green + checkmark, straight from the sketch. */
.vbroll-tile.selected {
  border-color: var(--success);
  box-shadow: 0 0 0 2px var(--success);
  background: color-mix(in srgb, var(--success) 12%, var(--bg-elevated));
}

.vbroll-tile-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-sunken);
}

.vbroll-tile-img,
.vbroll-tile-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Watch/Stop — small, low-contrast until hovered/focused so it never
   competes with the green selected state. */
/* Anchored to the TOP of the square thumbnail, not offset up from the
   tile's bottom: the number of text lines under the thumbnail varies (the
   licence line only exists for the free archives), and a bottom offset that
   cleared two lines landed on top of the provider name once a third
   appeared. Top-left is always inside the frame; the ✓ owns top-right. */
.vbroll-watch {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.78em;
  line-height: 1.4;
  opacity: 0.85;
  cursor: pointer;
}

.vbroll-watch:hover,
.vbroll-watch:focus-visible {
  opacity: 1;
}

.vbroll-watch:focus-visible {
  outline: 2px solid var(--focus-ring, var(--primary));
  outline-offset: 2px;
}

.vbroll-watch[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  opacity: 1;
}

.vbroll-tile-fallback {
  font-size: 1.6em;
}

.vbroll-tile-check {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--success);
  color: #fff;
  font-weight: 700;
  font-size: 0.85em;
}

.vbroll-tile.selected .vbroll-tile-check {
  display: flex;
}

.vbroll-tile-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.85em;
}

.vbroll-tile-source {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Provider credit — required on display by the stock sites' terms, so it
   is always rendered, never hover-only. Quiet enough not to compete with
   the thumbnail or the green selected state, and clipped to one line so a
   long creator name can't push the 4-across grid around. Inherits colour
   from the tile so it stays legible on the selected (green) background. */
.vbroll-tile-credit {
  display: block;
  font-size: 0.72em;
  line-height: 1.35;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The licence that travels with a free-archive clip into the finished
   advert. Same quiet one-line treatment as the credit, but not muted — it
   is a term she is taking on, not a footnote. */
/* Wraps rather than ellipsising: this is now a short SENTENCE she has to
   read in full to know what she is accepting ("Covered by NASA's media
   usage guidelines." was being cut to "…media usage guide…"). The
   one-line clamp still applies to the credit above, which is a name. */
.vbroll-tile-license {
  display: block;
  font-size: 0.72em;
  line-height: 1.35;
}

/* Why a pick didn't take. Wraps rather than ellipsising — a reason she
   can only half-read is no reason at all. */
.vbroll-tile-problem {
  display: block;
  font-size: 0.72em;
  line-height: 1.35;
  color: var(--coral-ink, var(--coral));
}

/* Per-tile "Checking this clip…" — sits over that one thumbnail only, so
   the rest of the grid stays readable and clickable while it resolves. */
.vbroll-tile.checking .vbroll-tile-frame {
  opacity: 0.6;
}

.vbroll-tile-checking {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.72em;
  line-height: 1.35;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vbroll-selected-sources {
  margin: 0;
}

.vbroll-more {
  margin-top: 12px;
}

.vbroll-error {
  color: var(--coral-ink, var(--coral));
}

.vbroll-partial-error {
  margin: 0 0 6px;
}

.vbroll-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  bottom: 0;
}

.vbroll-selection-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.vbroll-selected-count {
  margin: 0;
  font-weight: 600;
}

.vbroll-footer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (max-width: 900px) {
  .vbroll-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.vbroll-sources-note {
  width: 100%;
  margin: 0;
}

/* The clip's own description (app/api/broll_titles.py). Sits above the
   licence credit, which is a required attribution and NOT a name — before
   this, every Pexels tile in a grid read identically. */
.vbroll-tile-title {
  display: block;
  font-weight: 600;
  font-size: 0.86rem;
  line-height: 1.25;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}
