/* ===========================================================================
   Dailies · Video / Reel Review  —  C-level Feed extension
   ---------------------------------------------------------------------------
   A real <video> over a two-lane timeline. The lower strip is the scrubber;
   the upper "notes lane" is the comment surface — click a frame or drag a range
   and a note anchors to that point/span in time, showing as a marker on the
   lane so the reviewer sees at a glance where feedback lands. Threads open in
   the right rail (a bottom sheet on mobile), mirroring the document review.
   Self-contained, themed entirely from bsp-tokens.css / dailies-theme.css and
   loaded AFTER feed-styles.css so the .review--video layout wins the cascade.
   =========================================================================== */

/* --- Shell: force a flex column so the desktop `.review { display:grid }`
   asset layout never imposes itself on the player. ------------------------- */
.review--video { display: flex; flex-direction: column; }

.vid-body {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  position: relative;            /* anchor the mobile bottom sheet + backdrop */
}

/* --- The player column ---------------------------------------------------- */
.vid-main {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  padding: 8px 14px 12px;
  overflow: visible;             /* let marker tooltips escape upward */
}

.vid-ctx {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--bsp-fg-dim);
  margin-bottom: 12px;
}
.vid-ctx .ip {
  font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--bsp-yellow);
  padding: 3px 8px;
  border: 1px solid var(--bsp-border-gold);
  border-radius: var(--bsp-radius-pill);
  font-size: 10px;
}
.vid-ctx .who strong { color: var(--bsp-fg-muted); font-weight: 500; }
.vid-ctx .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--bsp-fg-dim); }

/* --- Stage: the video letterboxed on a true-black ground ------------------ */
.vid-stage {
  flex: 1; min-height: 0;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  background: #05090c;
  border: 1px solid var(--bsp-border);
  border-radius: var(--bsp-radius-1);
  overflow: hidden;
}
.vid-el { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; }

.vid-playpause {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(8, 14, 18, 0.5);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff; cursor: pointer;
  transition: opacity var(--bsp-dur-fast) var(--bsp-ease-out),
              transform var(--bsp-dur-fast) var(--bsp-ease-out);
}
.vid-playpause svg { transform: translateX(1px); }   /* optical center the play glyph */
.vid-playpause:hover { transform: translate(-50%, -50%) scale(1.05); }
.vid-playpause.playing { opacity: 0; pointer-events: none; }
.vid-stage:hover .vid-playpause.playing { opacity: 0.9; pointer-events: auto; }

/* --- Transport: play · clock · timeline · comment ------------------------- */
.vid-transport {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding-top: 14px;
  overflow: visible;
}
.vid-play-sm {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bsp-yellow); border: 1px solid var(--bsp-yellow); color: var(--bsp-accent-on);
  cursor: pointer; transition: background var(--bsp-dur-fast) var(--bsp-ease-out);
}
.vid-play-sm:hover { background: var(--bsp-yellow-hi); border-color: var(--bsp-yellow-hi); }
.vid-play-sm svg { transform: translateX(1px); }

.vid-time {
  flex: none; min-width: 88px;
  font-size: 12px; color: var(--bsp-fg-dim);
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
}
.vid-time span { color: var(--bsp-fg-muted); font-weight: 500; }
.vid-time i { font-style: normal; color: var(--bsp-fg-faint); margin: 0 2px; }

/* --- Timeline: notes lane stacked over the scrubber, one shared width ------ */
.vid-timeline {
  flex: 1; min-width: 0;
  position: relative;
  padding: 14px 0 8px;           /* lane sits below the top pad; tooltips escape */
  overflow: visible;
}
.vid-lane {
  position: relative; height: 22px;
  cursor: crosshair; touch-action: none;
  overflow: visible;
}
.vid-scrub {
  position: relative; height: 8px; margin-top: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--bsp-radius-pill);
  cursor: pointer; touch-action: none;
  overflow: hidden;
}
.vid-played {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: var(--bsp-yellow);
  border-radius: var(--bsp-radius-pill);
}
.vid-playhead {
  position: absolute; top: 14px; bottom: 8px; left: 0;
  width: 2px; background: var(--bsp-yellow);
  transform: translateX(-50%);
  pointer-events: none; z-index: 6;
}
.vid-playhead::after {
  content: ""; position: absolute; left: 50%; bottom: -1px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bsp-yellow);
  transform: translate(-50%, 30%);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.55);
}
/* Live range painted while dragging the notes lane */
.vid-drag-band {
  position: absolute; top: 5px; height: 12px; left: 0; width: 0;
  display: none;
  background: rgba(255, 210, 0, 0.16);
  border: 1px dashed var(--bsp-yellow);
  border-radius: 3px; pointer-events: none; z-index: 4;
}

/* --- Markers: a pin per frame note, a band per range note ----------------- */
.vid-mk {
  position: absolute; top: 0; bottom: 0;
  background: none; border: none; padding: 0; margin: 0;
  cursor: pointer; z-index: 5;
}
.vid-mk.point { width: 16px; transform: translateX(-50%); }
.vid-mk.point .vid-mk-dot {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%) rotate(45deg);
  width: 9px; height: 9px; border-radius: 2px; background: var(--bsp-yellow);
  transition: box-shadow var(--bsp-dur-fast) var(--bsp-ease-out), background var(--bsp-dur-fast) var(--bsp-ease-out);
}
.vid-mk.point::after {
  content: ""; position: absolute; left: 50%; top: 9px; bottom: 0; width: 2px;
  transform: translateX(-50%); background: var(--bsp-yellow); opacity: 0.5;
}
.vid-mk.span {
  top: 5px; height: 12px; border-radius: 3px;
  background: rgba(255, 210, 0, 0.18);
  border: 1px solid var(--bsp-border-gold);
  transition: background var(--bsp-dur-fast) var(--bsp-ease-out), border-color var(--bsp-dur-fast) var(--bsp-ease-out);
}
.vid-mk.span .vid-mk-dot { display: none; }

/* resolved → drop to neutral so open notes keep the gold */
.vid-mk.resolved.point .vid-mk-dot { background: var(--bsp-fg-dim); }
.vid-mk.resolved.point::after { background: var(--bsp-fg-dim); opacity: 0.4; }
.vid-mk.resolved.span { background: rgba(255, 255, 255, 0.06); border-color: var(--bsp-border-hi); }

/* draft → outlined, not filled */
.vid-mk.draft.point .vid-mk-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--bsp-yellow); }
.vid-mk.draft.span { border-style: dashed; }

/* active / hover → emphasize */
.vid-mk:hover.point .vid-mk-dot,
.vid-mk.active.point .vid-mk-dot { box-shadow: 0 0 0 4px rgba(255, 210, 0, 0.26); }
.vid-mk:hover.span,
.vid-mk.active.span { background: rgba(255, 210, 0, 0.3); border-color: var(--bsp-yellow); }

/* tooltip: timecode + first note, on hover or while focused */
.vid-mk-tip {
  position: absolute; bottom: calc(100% + 9px); left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: max-content; max-width: 230px;
  background: var(--bsp-bg-elev);
  border: 1px solid var(--bsp-border-hi);
  border-radius: 9px; padding: 8px 11px;
  box-shadow: var(--bsp-shadow-card);
  text-align: left; opacity: 0; pointer-events: none; z-index: 30;
  transition: opacity var(--bsp-dur-fast) var(--bsp-ease-out), transform var(--bsp-dur-fast) var(--bsp-ease-out);
}
.vid-mk:hover .vid-mk-tip,
.vid-mk.active .vid-mk-tip { opacity: 1; transform: translateX(-50%) translateY(0); }
.vid-mk-tip b { display: block; font-size: 11px; color: var(--bsp-yellow); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.vid-mk-tip .who { display: block; font-size: 10px; color: var(--bsp-fg-dim); margin-top: 3px; }
.vid-mk-tip em {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-style: normal; font-size: 11.5px; line-height: 1.4; color: var(--bsp-fg-muted); margin-top: 3px; font-weight: 300;
}

/* --- Comment-on-frame button --------------------------------------------- */
.vid-frame-btn {
  flex: none;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--bsp-bg-card); border: 1px solid var(--bsp-border-gold);
  color: var(--bsp-fg); border-radius: var(--bsp-radius-pill);
  padding: 9px 15px; cursor: pointer;
  font-family: var(--bsp-font-body); font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  transition: border-color var(--bsp-dur-fast) var(--bsp-ease-out), transform var(--bsp-dur-fast) var(--bsp-ease-out);
}
.vid-frame-btn svg { stroke: var(--bsp-yellow); fill: none; stroke-width: 2; }
.vid-frame-btn:hover { border-color: var(--bsp-yellow); transform: translateY(-1px); }

.vid-hint {
  flex-shrink: 0;
  margin-top: 9px; font-size: 11px; color: var(--bsp-fg-dim); font-weight: 300; letter-spacing: 0.01em;
}

/* --- The notes rail (mirrors the document rail) --------------------------- */
.vid-rail {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--bsp-bg-deep);
}
.vid-sheet-handle { display: none; }
.vid-rail-head {
  flex-shrink: 0; display: flex; align-items: center; gap: 10px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--bsp-border);
}
.vid-rail-lbl {
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--bsp-yellow);
}
.vid-rail-count { font-size: 11px; color: var(--bsp-fg-dim); letter-spacing: 0.02em; }
.vid-sheet-close {
  margin-left: auto; display: none;
  background: none; border: none; color: var(--bsp-fg-dim);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.vid-rail-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 14px; display: flex; flex-direction: column; gap: 12px;
}
.vid-rail-empty {
  font-size: 13px; line-height: 1.55; color: var(--bsp-fg-dim);
  font-weight: 300; padding: 8px 4px;
}

/* --- Thread card ---------------------------------------------------------- */
.vid-card {
  background: var(--bsp-bg-elev);
  border: 1px solid var(--bsp-border);
  border-radius: var(--bsp-radius-1);
  padding: 13px 14px; cursor: pointer;
  transition: border-color var(--bsp-dur-fast) var(--bsp-ease-out),
              box-shadow var(--bsp-dur-fast) var(--bsp-ease-out);
}
.vid-card:hover { border-color: var(--bsp-border-hi); }
.vid-card.active {
  border-color: var(--bsp-border-gold);
  box-shadow: 0 0 0 1px var(--bsp-border-gold), var(--bsp-shadow-card);
  cursor: default;
}
.vid-card.resolved { opacity: 0.72; }
.vid-card.resolved.active { opacity: 1; }

.vid-card-tc {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 11px;
  font-size: 12.5px; font-weight: 600; color: var(--bsp-yellow);
  font-variant-numeric: tabular-nums; letter-spacing: 0.03em;
}
.vid-tc-glyph { flex: none; width: 9px; height: 9px; background: var(--bsp-yellow); }
.vid-tc-glyph.point { transform: rotate(45deg); border-radius: 2px; }
.vid-tc-glyph.span { width: 16px; height: 7px; border-radius: 2px; }
.vid-tc-kind {
  margin-left: auto; font-size: 9px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--bsp-fg-dim);
}
.vid-card.resolved .vid-card-tc { color: var(--bsp-fg-dim); }
.vid-card.resolved .vid-tc-glyph { background: var(--bsp-fg-dim); }

.vid-resolved-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: #7fd1a8; margin-bottom: 10px;
}
.vid-resolved-tag svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2.4; }

.vid-c { display: flex; gap: 10px; margin-bottom: 11px; }
.vid-c:last-child { margin-bottom: 0; }
.vid-c-av {
  width: 27px; height: 27px; flex-shrink: 0;
  border-radius: var(--bsp-radius-pill);
  background: var(--bsp-navy-light); border: 1px solid var(--bsp-border-hi);
  color: var(--bsp-fg-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.04em;
}
.vid-c-av.me { background: var(--bsp-yellow); color: var(--bsp-accent-on); border-color: var(--bsp-yellow); }
.vid-c-body { min-width: 0; flex: 1; }
.vid-c-head { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; margin-bottom: 2px; }
.vid-c-head .n { font-size: 12px; font-weight: 500; color: var(--bsp-fg); }
.vid-c-head .r { font-size: 10px; color: var(--bsp-fg-dim); }
.vid-c-head .w { font-size: 10px; color: var(--bsp-fg-dim); margin-left: auto; }
.vid-c-text { font-size: 13px; line-height: 1.5; color: var(--bsp-fg-muted); font-weight: 300; }

/* --- Composer ------------------------------------------------------------- */
.vid-composer {
  display: flex; align-items: flex-end; gap: 7px;
  margin-top: 11px; padding-top: 11px;
  border-top: 1px solid var(--bsp-border);
}
.vid-input {
  flex: 1; min-width: 0;
  background: var(--bsp-bg-card); border: 1px solid var(--bsp-border-hi);
  border-radius: 11px; color: var(--bsp-fg);
  font-family: var(--bsp-font-body); font-size: 13px; line-height: 1.45;
  padding: 8px 11px; resize: none; min-height: 38px; max-height: 140px;
  outline: none; transition: border-color var(--bsp-dur-fast) var(--bsp-ease-out);
}
.vid-input:focus { border-color: var(--bsp-border-gold); }
.vid-input::placeholder { color: var(--bsp-fg-dim); }
.vid-mic, .vid-send-c, .vid-cancel {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: 1px solid var(--bsp-border-hi); background: var(--bsp-bg-card);
  color: var(--bsp-fg-muted); transition: all var(--bsp-dur-fast) var(--bsp-ease-out);
}
.vid-mic:hover, .vid-cancel:hover { border-color: var(--bsp-border-hi); color: var(--bsp-fg); transform: translateY(-1px); }
.vid-mic svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.vid-send-c { background: var(--bsp-yellow); border-color: var(--bsp-yellow); color: var(--bsp-accent-on); }
.vid-send-c svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
.vid-send-c:hover { background: var(--bsp-yellow-hi); border-color: var(--bsp-yellow-hi); transform: translateY(-1px); }
.vid-send-c:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.vid-cancel { width: 34px; height: 34px; font-size: 18px; line-height: 1; }

/* --- Card footer (resolve / reopen) --------------------------------------- */
.vid-card-foot { display: flex; align-items: center; gap: 12px; margin-top: 11px; }
.vid-resolve, .vid-reopen {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer; padding: 2px 0;
  font-family: var(--bsp-font-body); font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; color: var(--bsp-fg-dim);
  transition: color var(--bsp-dur-fast) var(--bsp-ease-out);
}
.vid-resolve:hover { color: #7fd1a8; }
.vid-reopen:hover { color: var(--bsp-yellow); }
.vid-resolve svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2.2; }

/* --- Footer action bar ---------------------------------------------------- */
.vid-foot {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px calc(env(safe-area-inset-bottom, 0px) + 16px);
  border-top: 1px solid var(--bsp-border);
}
.vid-foot-meta { font-size: 12px; color: var(--bsp-fg-dim); display: flex; align-items: center; gap: 10px; }
.vid-foot-meta strong { color: var(--bsp-fg-muted); font-weight: 600; }
.vid-foot-open { color: var(--bsp-yellow); font-weight: 500; }
.vid-foot-actions { display: flex; align-items: center; gap: 10px; }
.vid-notes-toggle {
  background: var(--bsp-bg-card); border: 1px solid var(--bsp-border-hi);
  color: var(--bsp-fg-muted); border-radius: var(--bsp-radius-pill);
  padding: 9px 16px; cursor: pointer;
  font-family: var(--bsp-font-body); font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
}
.vid-send-review {
  background: var(--bsp-yellow); border: 1px solid var(--bsp-yellow); color: var(--bsp-accent-on);
  border-radius: var(--bsp-radius-pill); padding: 9px 20px; cursor: pointer;
  font-family: var(--bsp-font-body); font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  transition: all var(--bsp-dur-fast) var(--bsp-ease-out);
}
.vid-send-review:hover { background: var(--bsp-yellow-hi); border-color: var(--bsp-yellow-hi); transform: translateY(-1px); }

/* --- Mobile bottom sheet + backdrop --------------------------------------- */
.vid-sheet-backdrop {
  position: absolute; inset: 0; z-index: 18;
  background: rgba(0, 0, 0, 0.5);
  animation: vid-fade 0.25s var(--bsp-ease-out);
}
@keyframes vid-fade { from { opacity: 0; } }

@media (max-width: 1099px) {
  /* The feed frame grows with its content; pin the review to the viewport so
     the sheet and footer stay on-screen. */
  .review--video { position: fixed; inset: 0; height: 100dvh; }
  .vid-stage { flex: none; width: 100%; aspect-ratio: 16 / 9; max-height: 44vh; }
  .vid-notes-toggle { display: inline-flex; align-items: center; }
  .vid-rail {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
    max-height: 76%;
    background: var(--bsp-bg-elev);
    border-top: 1px solid var(--bsp-border-hi);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, 0.7);
    transform: translateY(101%);
    transition: transform var(--bsp-dur-base) var(--bsp-ease-out);
    pointer-events: none;
  }
  .vid-rail.sheet-open { transform: translateY(0); pointer-events: auto; }
  .vid-sheet-handle {
    display: block; width: 40px; height: 4px; border-radius: 999px;
    background: var(--bsp-border-hi); margin: 9px auto 2px;
  }
  .vid-sheet-close { display: block; }
  .vid-rail-head { padding-top: 8px; }
}

@media (max-width: 480px) {
  .vid-frame-btn span { display: none; }       /* icon-only on the narrowest screens */
  .vid-frame-btn { padding: 9px 11px; }
  .vid-time { min-width: 0; }
}

@media (min-width: 1100px) {
  .vid-notes-toggle { display: none; }
  .vid-sheet-backdrop { display: none; }
  .vid-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 384px;
    grid-template-rows: minmax(0, 1fr);
  }
  .vid-rail { border-left: 1px solid var(--bsp-border); }
  .vid-main { padding: 20px 26px; }
  .vid-foot { padding: 16px 40px; }
}

/* --- Reduced motion: keep it instant -------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .vid-mk, .vid-mk-tip, .vid-mk-dot, .vid-frame-btn, .vid-send-review,
  .vid-play-sm, .vid-playpause, .vid-card, .vid-rail { transition: none; }
  .vid-sheet-backdrop { animation: none; }
}
