/* ==========================================================================
   SIHI VIDEO — shared_package/platform/sihi_video.css
   Real-video layer that sits beside the 3D avatar strips: curated YouTube
   played through the signed-in Google session + copyright-free stock MP4.
   Every surface here renders inside the app window; nothing opens a popup.

   Marker contract:  SIHI_VIDEO_CSS_START / SIHI_VIDEO_CSS_END
   Injected inline into a <style> block (never its own <style> tag).
   ========================================================================== */

.sihi-video {
  margin: 16px 0;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, #F7FBFF, #EAF4FF);
  border: 1px solid #CFE3FA;
  box-shadow: 0 12px 30px rgba(30,64,175,.12);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
.sihi-video-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #D6E6FA;
  background: #EAF4FF;
}
.sihi-video-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font: 800 10px/1 "Segoe UI", system-ui, sans-serif;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #04211E;
  background: linear-gradient(135deg, #5EEAD4, #2DD4BF);
}
.sihi-video-badge.live::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: #FF5F6D;
  box-shadow: 0 0 0 0 rgba(255,95,109,.7);
  animation: sihiLivePulse 1.8s infinite;
  margin-right: 2px;
}
@keyframes sihiLivePulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,95,109,.7); }
  70%  { box-shadow: 0 0 0 7px rgba(255,95,109,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,95,109,0); }
}
.sihi-video-title {
  font: 600 14px/1.3 "Segoe UI", system-ui, sans-serif;
  color: #0B2545;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sihi-video-src {
  font: 500 11px/1 "Segoe UI", system-ui, sans-serif;
  color: #5B6B85;
  letter-spacing: .02em;
}

/* --- stage --------------------------------------------------------------- */
.sihi-video-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #05080C;
}
.sihi-video-stage.portrait { aspect-ratio: 9 / 16; max-height: 76vh; margin: 0 auto; }
.sihi-video-stage iframe,
.sihi-video-stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #05080C;
}
.sihi-video-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: radial-gradient(circle at 50% 45%, rgba(45,212,191,.16), rgba(5,8,12,.72) 70%);
  transition: opacity .25s ease;
}
.sihi-video-play span {
  width: 62px; height: 62px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #5EEAD4, #2DD4BF);
  color: #04211E;
  font-size: 24px;
  box-shadow: 0 8px 28px rgba(45,212,191,.45);
  transition: transform .18s ease;
}
.sihi-video-play:hover span { transform: scale(1.08); }
.sihi-video-play.hidden { opacity: 0; pointer-events: none; }

/* --- list ---------------------------------------------------------------- */
.sihi-video-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  padding: 12px 16px 16px;
}
.sihi-video-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid #D6E6FA;
  background: #FFFFFF;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
  text-align: left;
}
.sihi-video-item:hover { border-color: #60A5FA; background: #EFF6FF; transform: translateY(-1px); }
.sihi-video-item.on { border-color: #3B82F6; background: #DBEAFE; }
.sihi-video-item img {
  width: 62px; height: 40px;
  object-fit: cover;
  border-radius: 6px;
  flex: none;
  background: #0B1118;
}
.sihi-video-item-meta { min-width: 0; }
.sihi-video-item-kind {
  font: 800 9px/1 "Segoe UI", system-ui, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #0F766E;
}
.sihi-video-item-t {
  font: 600 12px/1.35 "Segoe UI", system-ui, sans-serif;
  color: #0B2545;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sihi-video-item-c {
  font: 500 10px/1.3 "Segoe UI", system-ui, sans-serif;
  color: #5B6B85;
  margin-top: 2px;
}

/* --- promo hero ---------------------------------------------------------- */
/* A split light-blue editorial card rather than a full-bleed dark panel: the
   video keeps its own dark stage, while all surrounding copy sits on a
   legible pale-blue surface. */
.sihi-video-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  margin: 24px auto;
  max-width: 1120px;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 58%, #E0F2FE 100%);
  border: 1px solid #BFDBFE;
  box-shadow: 0 18px 44px rgba(30,64,175,.16);
}
.sihi-video-hero .sihi-video-stage {
  aspect-ratio: 16 / 10;
  max-height: 420px;
  background: #0B1220;
}
.sihi-video-hero-copy {
  position: static;
  inset: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: clamp(20px, 3vw, 34px);
  background: transparent;
  pointer-events: auto;
}
.sihi-video-hero-copy h3 {
  margin: 0 0 6px;
  font: 600 clamp(19px, 2.4vw, 27px)/1.2 "Segoe UI", system-ui, sans-serif;
  color: #0B2545;
  letter-spacing: -.01em;
}
.sihi-video-hero-copy p {
  margin: 0;
  font: 500 13px/1.55 "Segoe UI", system-ui, sans-serif;
  color: #1E3A5F;
  max-width: 62ch;
}
.sihi-video-cta {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 7px;
  margin-top: 12px;
  padding: 10px 18px;
  border-radius: 999px;
  font: 800 11px/1 "Segoe UI", system-ui, sans-serif;
  letter-spacing: .07em;
  text-transform: uppercase;
  text-decoration: none;
  color: #04211E;
  background: linear-gradient(135deg, #5EEAD4, #2DD4BF);
  box-shadow: 0 6px 22px rgba(45,212,191,.4);
  pointer-events: auto;
}
.sihi-video-note {
  padding: 8px 16px 12px;
  font: 500 11px/1.5 "Segoe UI", system-ui, sans-serif;
  color: #5B6B85;
}
.sihi-video-offline {
  padding: 22px 16px;
  text-align: center;
  font: 500 12px/1.6 "Segoe UI", system-ui, sans-serif;
  color: #5B6B85;
}
.sihi-video-offline a { color: #1D4ED8; }

/* --- theatre affordance on the inline stage ------------------------------ */
.sihi-video-expand {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  background: rgba(5,8,12,.72);
  color: #E2E8F0;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity .18s ease, background .18s ease, border-color .18s ease;
}
.sihi-video-stage:hover .sihi-video-expand,
.sihi-video-expand:focus-visible { opacity: 1; }
.sihi-video-expand:hover { background: rgba(45,212,191,.22); border-color: rgba(45,212,191,.6); }

/* --- theatre player (in-document, never a new window) -------------------- */
.sihi-media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3,6,10,.86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity .2s ease;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
.sihi-media-lightbox.on { opacity: 1; }
.sihi-media-panel {
  width: min(1080px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  background: #070B10;
  border: 1px solid rgba(45,212,191,.28);
  box-shadow: 0 28px 90px rgba(0,0,0,.72);
  transform: translateY(10px) scale(.985);
  transition: transform .2s ease;
}
.sihi-media-lightbox.on .sihi-media-panel { transform: none; }
.sihi-media-panel.portrait { width: min(440px, 100%); }
.sihi-media-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.03);
}
.sihi-media-title {
  flex: 1;
  min-width: 0;
  font: 600 13px/1.3 "Segoe UI", system-ui, sans-serif;
  color: #EDF3FA;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sihi-media-chan {
  font: 500 11px/1 "Segoe UI", system-ui, sans-serif;
  color: rgba(226,232,240,.5);
  white-space: nowrap;
}
.sihi-media-close {
  flex: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px;
  background: rgba(255,255,255,.04);
  color: #E2E8F0;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.sihi-media-close:hover { background: rgba(251,113,133,.2); border-color: rgba(251,113,133,.55); }
.sihi-media-body {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  min-height: 0;
}
.sihi-media-body.portrait { aspect-ratio: 9 / 16; max-height: 72vh; margin: 0 auto; }
.sihi-media-body iframe,
.sihi-media-body video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
}
/* The app-mode hand-off is prose, not a 16:9 frame: let it size to content
   and scroll inside the panel instead of being clipped by the aspect box. */
.sihi-media-body.appmode {
  aspect-ratio: auto;
  background: transparent;
  max-height: min(72vh, 640px);
  overflow-y: auto;
  display: flex;
}
.sihi-media-body.appmode.portrait {
  aspect-ratio: auto;
  max-height: min(72vh, 640px);
  margin: 0;
}
.sihi-media-body.appmode .sihi-video-appmode {
  flex: 1;
  min-height: 0;
  border: 0;
  border-radius: 0;
}
.sihi-media-foot {
  padding: 9px 16px 11px;
  border-top: 1px solid rgba(255,255,255,.06);
  font: 500 11px/1.4 "Segoe UI", system-ui, sans-serif;
  color: rgba(226,232,240,.55);
  background: rgba(255,255,255,.02);
}

@media (max-width: 900px) {
  .sihi-video-hero { grid-template-columns: 1fr; margin: 18px 12px; }
  .sihi-video-hero .sihi-video-stage { aspect-ratio: 16 / 9; max-height: none; }
}
@media (max-width: 640px) {
  .sihi-video-list { grid-template-columns: 1fr; }
  .sihi-video-hero .sihi-video-stage { aspect-ratio: 16 / 9; }
  .sihi-media-lightbox { padding: 12px; }
  .sihi-media-chan { display: none; }
  .sihi-video-expand { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .sihi-video-badge.live::before { animation: none; }
  .sihi-video-item:hover { transform: none; }
  .sihi-media-lightbox,
  .sihi-media-panel { transition: none; transform: none; }
}
