/* ============================================================
   VIDEO BEAM — animated border-beam frame for case-study videos
   ============================================================
   Black surface + comet-of-light traveling around the perimeter
   (magicui border-beam style). Sweeping scan line, CRT scanlines,
   pulsing play button. Click anywhere on the surface to play.
   ============================================================ */

.video-beam {
  /* tone palette — overridden via [data-tone] below */
  --vb-c1: #b6441e;     /* deep accent — comet tail */
  --vb-c2: #ffd9c0;     /* warm highlight */
  --vb-c3: #ffffff;     /* hot core */
  --vb-thickness: 1.5px;
  --vb-duration: 5s;

  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  isolation: isolate;
}

.video-beam[data-tone="warm"]  { --vb-c1: #b6441e; --vb-c2: #ffd9c0; }
.video-beam[data-tone="beige"] { --vb-c1: #b39a7a; --vb-c2: #f5e8d0; }
.video-beam[data-tone="cool"]  { --vb-c1: #5a7a8a; --vb-c2: #d4e4ed; }
.video-beam[data-tone="muted"] { --vb-c1: #4a4540; --vb-c2: #8a847e; --vb-c3: #c7c1ba; }

/* ----- the rotating beam ---------------------------------------
   A square element bigger than the box, with a conic-gradient that
   has a small bright arc. As it spins, that arc traces the visible
   1.5px border. The surface above masks everything except the edge.
   ---------------------------------------------------------------- */
.video-beam::before {
  content: "";
  position: absolute;
  width: 220%;
  aspect-ratio: 1;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(0deg);
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 295deg,
    var(--vb-c1) 328deg,
    var(--vb-c2) 348deg,
    var(--vb-c3) 357deg,
    var(--vb-c2) 360deg
  );
  animation: vb-spin var(--vb-duration) linear infinite;
  z-index: 0;
  pointer-events: none;
  will-change: transform;
}

/* a second, slower beam — counter-rotates for a richer feel */
.video-beam::after {
  content: "";
  position: absolute;
  width: 220%;
  aspect-ratio: 1;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(180deg);
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 320deg,
    var(--vb-c2) 348deg,
    transparent 360deg
  );
  opacity: 0.55;
  animation: vb-spin-rev calc(var(--vb-duration) * 1.7) linear infinite;
  z-index: 0;
  pointer-events: none;
  filter: blur(1px);
  will-change: transform;
}

@keyframes vb-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes vb-spin-rev {
  to { transform: translate(-50%, -50%) rotate(-180deg); }
}

/* ----- surface: black plate inside the beam border ---------- */
.video-beam-surface {
  position: absolute;
  inset: var(--vb-thickness);
  z-index: 1;
  background: #000;
  overflow: hidden;
}

.video-beam-surface video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #000;
  opacity: 0;
  transition: opacity 0.5s ease 0.1s;
}

.video-beam.is-playing .video-beam-surface video { opacity: 1; }

/* ----- pre-play overlay -------------------------------------- */
.video-beam-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% 50%,
      rgba(34, 22, 18, 0.45) 0%,
      rgba(0, 0, 0, 1) 78%),
    #000;
  cursor: pointer;
  transition: opacity 0.6s ease, visibility 0.6s ease;
  overflow: hidden;
}

.video-beam.is-playing .video-beam-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* faint blueprint grid */
.video-beam-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
  opacity: 0.65;
  -webkit-mask-image: radial-gradient(ellipse 100% 70% at 50% 50%, #000 30%, transparent 82%);
  mask-image: radial-gradient(ellipse 100% 70% at 50% 50%, #000 30%, transparent 82%);
}

/* CRT scanlines */
.video-beam-scanlines {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.025) 0px,
    rgba(255, 255, 255, 0.025) 1px,
    transparent 1px,
    transparent 3px);
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0.7;
}

/* sweeping scan line */
.video-beam-scan {
  position: absolute;
  left: 0;
  right: 0;
  top: -2%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--vb-c2) 50%, transparent);
  box-shadow: 0 0 14px var(--vb-c2), 0 0 32px rgba(255, 255, 255, 0.2);
  opacity: 0;
  animation: vb-scan 6.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  pointer-events: none;
}
@keyframes vb-scan {
  0%   { top: -2%;  opacity: 0; }
  10%  { opacity: 0.75; }
  90%  { opacity: 0.75; }
  100% { top: 102%; opacity: 0; }
}

/* engineering corner brackets */
.video-beam-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--vb-c2);
  border-style: solid;
  opacity: 0.45;
  pointer-events: none;
}
.video-beam-corner.tl { top: 14px; left: 14px;  border-width: 1px 0 0 1px; }
.video-beam-corner.tr { top: 14px; right: 14px; border-width: 1px 1px 0 0; }
.video-beam-corner.bl { bottom: 14px; left: 14px;  border-width: 0 0 1px 1px; }
.video-beam-corner.br { bottom: 14px; right: 14px; border-width: 0 1px 1px 0; }

/* HUD labels */
.video-beam-hud {
  position: absolute;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.26em;
  color: var(--vb-c2);
  opacity: 0.7;
  pointer-events: none;
  text-transform: uppercase;
  white-space: nowrap;
}
.video-beam-hud.tl { top: 16px; left: 40px; }
.video-beam-hud.tr { top: 16px; right: 40px; }
.video-beam-hud.bl { bottom: 16px; left: 40px; }
.video-beam-hud.br { bottom: 16px; right: 40px; }

/* status pill — bottom-center */
.video-beam-status {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--vb-c2);
  opacity: 0.78;
  pointer-events: none;
  text-transform: uppercase;
}
.video-beam-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--vb-c1);
  box-shadow: 0 0 10px var(--vb-c1);
  animation: vb-blink 1.6s ease-in-out infinite;
}
@keyframes vb-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.25; }
}

/* play button */
.video-beam-play {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(20, 18, 16, 0.55);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--vb-c2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.3s ease, border-color 0.3s ease, background 0.3s ease, color 0.3s ease;
  z-index: 3;
  padding: 0;
  font: inherit;
}
.video-beam-play svg {
  width: 32px;
  height: 32px;
  margin-left: 5px;
  transition: transform 0.3s ease;
}

.video-beam-overlay:hover .video-beam-play {
  transform: scale(1.07);
  border-color: var(--vb-c2);
  background: rgba(40, 28, 22, 0.72);
  color: var(--vb-c3);
}
.video-beam-overlay:hover .video-beam-play svg {
  transform: translateX(1px) scale(1.04);
}

/* pulse rings */
.video-beam-play::before,
.video-beam-play::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--vb-c2);
  pointer-events: none;
  animation: vb-pulse 2.8s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}
.video-beam-play::after { animation-delay: 1.4s; }

@keyframes vb-pulse {
  0%   { transform: scale(1);    opacity: 0.5; }
  100% { transform: scale(1.95); opacity: 0; }
}

/* keep the beam visible (slightly subdued) once video is playing */
.video-beam.is-playing::before { opacity: 0.7; }
.video-beam.is-playing::after  { opacity: 0.35; }

/* placeholder variant (M.07 — no video) */
.video-beam.is-placeholder .video-beam-overlay { cursor: default; }
.video-beam.is-placeholder .video-beam-play    { display: none; }

.video-beam-placeholder {
  position: relative;
  z-index: 3;
  display: grid;
  gap: 14px;
  place-items: center;
  text-align: center;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  color: var(--vb-c2);
  padding: 0 24px;
}
.video-beam-placeholder .ph-eyebrow {
  font-size: 10px;
  letter-spacing: 0.3em;
  opacity: 0.55;
}
.video-beam-placeholder .ph-title {
  font-size: 18px;
  letter-spacing: 0.22em;
  color: var(--vb-c3);
}
.video-beam-placeholder .ph-hint {
  font-size: 10px;
  letter-spacing: 0.26em;
  opacity: 0.5;
  max-width: 320px;
  line-height: 1.6;
}

/* ============================================================
   SLIDE variant — info panel inside the beam frame.
   Used where there is no video but a feature-summary slide:
   • M.00 — Умный чат
   • M.07 — СтройБот МО
   Keeps the rotating border-beam, drops the click overlay,
   renders structured content directly on the dark surface.
   ============================================================ */

.video-beam.is-slide .video-beam-overlay { display: none; }

.video-beam.is-slide .video-beam-surface {
  display: block;
  padding: 34px 44px 56px;
  background:
    radial-gradient(ellipse 90% 70% at 25% 25%, rgba(60, 36, 26, 0.45) 0%, rgba(0, 0, 0, 1) 78%),
    #050505;
  color: #ede4d6;
}

.video-beam.is-slide[data-tone="cool"] .video-beam-surface {
  background:
    radial-gradient(ellipse 90% 70% at 25% 25%, rgba(40, 60, 70, 0.45) 0%, rgba(0, 0, 0, 1) 78%),
    #050505;
}

.video-beam.is-slide[data-tone="beige"] .video-beam-surface {
  background:
    radial-gradient(ellipse 90% 70% at 25% 25%, rgba(60, 50, 35, 0.45) 0%, rgba(0, 0, 0, 1) 78%),
    #050505;
}

/* HUD chrome works inside surface for slide variant */
.video-beam.is-slide .video-beam-surface > .video-beam-corner,
.video-beam.is-slide .video-beam-surface > .video-beam-hud,
.video-beam.is-slide .video-beam-surface > .video-beam-status,
.video-beam.is-slide .video-beam-surface > .video-beam-grid,
.video-beam.is-slide .video-beam-surface > .video-beam-scanlines {
  z-index: 1;
}

.slide-panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100%;
  font-family: "Inter Tight", system-ui, -apple-system, sans-serif;
}

.sp-head { display: flex; flex-direction: column; gap: 10px; }

.sp-eyebrow {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--vb-c2);
  opacity: 0.85;
  text-transform: uppercase;
}

.sp-title {
  font-size: clamp(28px, 3.4vw, 42px);
  line-height: 1;
  letter-spacing: -0.025em;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.sp-lede {
  font-size: 14px;
  line-height: 1.5;
  color: rgba(245, 235, 215, 0.78);
  max-width: 72ch;
  margin: 0;
}
.sp-lede strong { color: var(--vb-c2); font-weight: 500; }

.sp-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  flex: 1;
  min-height: 0;
}

.sp-body.is-single { grid-template-columns: 1fr; }

.sp-col { display: flex; flex-direction: column; gap: 12px; }

.sp-block-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--vb-c2);
  opacity: 0.7;
  text-transform: uppercase;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 217, 192, 0.16);
}

.sp-block {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(245, 235, 215, 0.88);
}
.sp-block + .sp-block { margin-top: 4px; }
.sp-block strong { color: var(--vb-c2); font-weight: 600; }
.sp-block-meta {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: rgba(245, 235, 215, 0.5);
  margin-top: 4px;
}

.sp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sp-list li {
  position: relative;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(245, 235, 215, 0.88);
}
.sp-list li::before {
  content: "▸";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--vb-c2);
  font-size: 12px;
  line-height: 1.5;
}
.sp-list li strong { color: var(--vb-c2); font-weight: 600; }

/* responsive */
@media (max-width: 760px) {
  .video-beam.is-slide .video-beam-surface {
    padding: 24px 22px 44px;
  }
  .sp-body { grid-template-columns: 1fr; gap: 18px; }
  .sp-title { font-size: 26px; }
  .sp-lede, .sp-block, .sp-list li { font-size: 12px; }
}

/* row wrapper — keep visual hierarchy consistent with old media-frame */
.module-media-row { margin-bottom: var(--s-7); }

/* Module sections m0–m6: heading + content grid above, video below.
   m7 keeps natural DOM order (description + iPhone row on top, metrics below). */
section#m0,
section#m1,
section#m2,
section#m3,
section#m4,
section#m5,
section#m6 {
  display: flex;
  flex-direction: column-reverse;
}
section#m0 .module-media-row,
section#m1 .module-media-row,
section#m2 .module-media-row,
section#m3 .module-media-row,
section#m4 .module-media-row,
section#m5 .module-media-row,
section#m6 .module-media-row {
  margin-bottom: 0;
  margin-top: var(--s-7);
}

/* responsive */
@media (max-width: 720px) {
  .video-beam { --vb-thickness: 1px; }
  .video-beam-play { width: 72px; height: 72px; }
  .video-beam-play svg { width: 26px; height: 26px; }
  .video-beam-corner { width: 14px; height: 14px; }
  .video-beam-hud { font-size: 8px; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  .video-beam::before,
  .video-beam::after,
  .video-beam-scan,
  .video-beam-play::before,
  .video-beam-play::after,
  .video-beam-dot {
    animation: none;
  }
}
