/* ─────────────────────────────────────────────────────────────
   LevTech incident-detail drawer — Wave 1 Step 3.
   Ported from design_handoff_levtech_wave1/app.css lines 556-724.
   Adjusted for native <video> playback (the prototype used a styled
   gradient mock-clip). When video_url is null, the mock-clip styling
   serves as the placeholder.
   ───────────────────────────────────────────────────────────── */

/* ─── Scrim ─── */
.drawer-scrim {
  position: fixed; inset: 0;
  background: rgba(17, 19, 25, 0.32);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--dur-3) var(--ease-out);
  z-index: 50;
  pointer-events: none;
}
.drawer-scrim.open { opacity: 1; pointer-events: auto; }
.drawer-scrim[hidden] { display: none; }

/* ─── Panel ─── */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(560px, 44vw);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top-left-radius: var(--radius-xl);
  border-bottom-left-radius: var(--radius-xl);
  box-shadow: var(--shadow-overlay);
  z-index: 51;
  transform: translateX(100%);
  transition: transform var(--dur-3) var(--ease-out);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.drawer.open { transform: translateX(0); }
.drawer[hidden] { display: none; }

/* Reduced motion: snap, no slide */
@media (prefers-reduced-motion: reduce) {
  .drawer { transition: none; }
  .drawer-scrim { transition: none; }
}

/* ─── Body scroll lock ─── */
body.drawer-locked { overflow: hidden; }

/* ─── Drawer head ─── */
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border-divider);
}
.drawer-head .meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.drawer-head .meta .t-h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-close {
  appearance: none;
  border: 1px solid var(--border-default);
  background: var(--bg-raised);
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--text-secondary);
  flex: 0 0 auto;
  margin-left: 12px;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.drawer-close:hover { background: var(--bg-sunken); color: var(--text-primary); }

/* ─── Drawer body ─── */
.drawer-body {
  overflow-y: auto;
  padding: 22px 24px 40px;
  display: flex; flex-direction: column; gap: 22px;
}

/* ─── Video clip / placeholder ─── */
.clip {
  width: 100%; aspect-ratio: 16/9;
  background: linear-gradient(135deg, #1f2128, #383a43);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}
.clip video {
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}
.clip-overlay {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,0.02) 0,
    rgba(255,255,255,0.02) 8px,
    transparent 8px,
    transparent 16px
  );
  pointer-events: none;
}
.clip-placeholder-caption {
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  letter-spacing: 0.02em;
}
.clip-caption {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

/* ─── AI's reasoning card ─── */
.reasoning {
  padding: 18px;
  background: var(--bg-sunken);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.reasoning-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
  gap: 12px;
}
.reasoning-body {
  font-size: 15px; line-height: 1.55;
  color: var(--text-primary);
}
.reasoning-body.italic { font-style: italic; color: var(--text-secondary); }

/* ─── VLM frames strip ─── */
.frames-details {
  margin: 0;
  padding: 0;
}
.frames-details > summary {
  list-style: none;
  cursor: pointer;
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.frames-details > summary::-webkit-details-marker { display: none; }
.frames-details > summary .frame-count { color: var(--text-tertiary); }
.frames-strip {
  display: flex; gap: 6px; overflow-x: auto;
  padding-bottom: 4px;
}
.frame {
  flex: 0 0 auto;
  display: block;
  width: 128px; height: 96px;
  background: linear-gradient(135deg, #2a2c34, #4a4d57);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-default);
  text-decoration: none;
}
.frame img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.frame::after {
  content: attr(data-t);
  position: absolute; left: 6px; bottom: 4px;
  font: 500 10px/1 var(--font-mono);
  color: rgba(255,255,255,0.78);
  background: rgba(0,0,0,0.35);
  padding: 2px 5px; border-radius: 3px;
}

/* ─── Alert card ─── */
.alert-card {
  padding: 18px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.alert-card .eyebrow { margin-bottom: 4px; }
.alert-card--unknown {
  background: var(--status-degraded-weak);
  border-color: color-mix(in oklab, var(--status-degraded) 36%, transparent);
}
.alert-card--failed {
  background: var(--status-offline-weak);
  border-color: color-mix(in oklab, var(--status-offline) 36%, transparent);
}
.alert-headline {
  font-size: 16px; font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-primary);
}
.alert-body {
  font-size: var(--text-body);
  line-height: 1.55;
  color: var(--text-secondary);
}

/* ─── Recipient list ─── */
.recipient-list {
  display: flex; flex-direction: column; gap: 0;
}
.recipient {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border-divider);
}
.recipient:first-child { border-top: 0; }
.recipient-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-sunken);
  color: var(--text-secondary);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  flex: 0 0 auto;
}
.recipient-meta { flex: 1; min-width: 0; }
.recipient-name {
  font-size: 13.5px; font-weight: 500;
  color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recipient-email {
  font-size: 12px; color: var(--text-tertiary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recipient .badge { flex: 0 0 auto; }

/* ─── Skeleton placeholder while fetch is in flight ─── */
.drawer-body .skel {
  background: linear-gradient(
    90deg,
    var(--bg-sunken) 0%,
    var(--bg-inset) 50%,
    var(--bg-sunken) 100%
  );
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: skel-pulse 1.2s ease-in-out infinite;
  color: transparent !important;
}

/* Footnote under the reviewed-frames strip: the on-frame camera clock is not
   the record's clock (cameras stamp their own time and can lag local). */
.frames-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-tertiary);
}
