/* ==========================================================================
   Video section — stacked-panel frame, custom play control, empty state
   Drop your file at:  assets/video/formglyph-demo.mp4
   ========================================================================== */

.section { position: relative; padding-block: clamp(70px, 9vw, 150px); }

.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: clamp(34px, 4vw, 64px);
}
.section__title {
  margin-top: 18px;
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  font-size: var(--fs-h2);
  line-height: 0.92;
  color: var(--ink);
}
.section__intro {
  max-width: 28em;
  font-size: clamp(16px, 1.3vw, 21px);
  line-height: 1.55;
  color: var(--muted);
}

.video { position: relative; --step: clamp(8px, 1vw, 16px); }

/* Back panels echo the logo's layered planes: two sheets stepping down-right behind the frame */
.video__plane {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  transition: transform 1.4s var(--ease-out) var(--d, 0s), opacity 1.2s ease var(--d, 0s);
}
.video__plane--1 { background: #cdbfa8; transform: translate(calc(var(--step) * 2), calc(var(--step) * 2)); opacity: 0.7; }
.video__plane--2 { background: #8a7864; transform: translate(var(--step), var(--step)); opacity: 0.55; }
.js .video__plane { transform: none; opacity: 0; }
.js .video.is-visible .video__plane--1 { transform: translate(calc(var(--step) * 2), calc(var(--step) * 2)); opacity: 0.7; --d: 0.25s; }
.js .video.is-visible .video__plane--2 { transform: translate(var(--step), var(--step)); opacity: 0.55; --d: 0.12s; }

.video__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: #11100e;
  box-shadow: 0 50px 90px -40px rgba(40, 28, 10, 0.55), 0 0 0 1px rgba(20, 18, 16, 0.9);
}
.video__el { width: 100%; height: 100%; object-fit: cover; background: #11100e; }

/* Frosted pills: readable over any frame of the film without covering it */
.video__rec,
.video__tag {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px;
  border: 1px solid rgba(243, 238, 228, 0.16);
  border-radius: 999px;
  background: rgba(20, 18, 16, 0.5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-family: var(--font-mono);
  font-size: clamp(10px, 0.8vw, 12px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  color: rgba(243, 238, 228, 0.92);
}
.video__chrome {
  position: absolute; left: 0; top: 0;
  padding: clamp(10px, 1.3vw, 20px);
  pointer-events: none;
  z-index: 3;
  transition: opacity 0.5s;
}
.video__rec i { width: 8px; height: 8px; border-radius: 50%; background: var(--generated); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.video.is-playing .video__chrome { opacity: 0; }

/* Overlay + play button */
.video__overlay {
  position: absolute; inset: 0;
  z-index: 2;
  display: grid; place-items: center;
  /* light vignette only, so the thumbnail stays clear (labels carry their own backing) */
  background: radial-gradient(ellipse at 50% 50%, rgba(10, 9, 8, 0.08) 40%, rgba(10, 9, 8, 0.32));
  border: 0;
  transition: opacity 0.6s var(--ease-out), visibility 0.6s;
}
.video.is-playing .video__overlay { opacity: 0; visibility: hidden; }

.video__play {
  position: relative;
  width: clamp(76px, 8vw, 128px);
  height: clamp(76px, 8vw, 128px);
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper);
  color: var(--ink);
  transition: transform 0.6s var(--ease-spring), background 0.3s;
}
.video__play svg { width: 36%; height: 36%; margin-left: 6%; fill: currentColor; }
.video__play::before,
.video__play::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(243, 238, 228, 0.7);
  animation: ring 3.2s ease-out infinite;
}
.video__play::after { animation-delay: 1.6s; }
@keyframes ring { from { transform: scale(1); opacity: 0.8; } to { transform: scale(1.9); opacity: 0; } }
.video__overlay:hover .video__play { transform: scale(1.08); background: #fff; }

.video__caption {
  position: absolute; left: 0; bottom: 0; z-index: 3;
  padding: clamp(10px, 1.3vw, 20px);
  pointer-events: none;
  transition: opacity 0.5s;
}
.video.is-playing .video__caption { opacity: 0; }
.video__dur:not(:empty)::before { content: "·"; margin: 0 8px; opacity: 0.6; }
.video__dur { font-weight: 500; }

/* Empty state when no file exists yet */
.video__empty {
  position: absolute; inset: 0; z-index: 1;
  display: none;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: rgba(243, 238, 228, 0.82);
  background:
    radial-gradient(circle at 20% 20%, rgba(184, 146, 79, 0.2), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(154, 90, 78, 0.18), transparent 45%),
    #14120f;
}
.video.is-empty .video__empty { display: grid; }
.video.is-empty .video__overlay { display: none; }
.video__empty code {
  display: inline-block; margin-top: 12px; padding: 8px 14px;
  border: 1px dashed rgba(243, 238, 228, 0.4); border-radius: 6px;
  font-family: var(--font-mono); font-size: clamp(11px, 1vw, 15px); color: var(--gold-light);
}
.video__empty p { font-size: clamp(14px, 1.2vw, 18px); max-width: 30em; margin-inline: auto; line-height: 1.5; }
.video__empty-bars { display: flex; gap: 8px; justify-content: center; align-items: flex-end; height: 64px; margin-bottom: 22px; }
.video__empty-bars i { width: 12px; border-radius: 6px 6px 0 0; animation: eq 1.6s ease-in-out infinite; }
.video__empty-bars i:nth-child(1) { background: var(--human); }
.video__empty-bars i:nth-child(2) { background: var(--assisted); animation-delay: 0.2s; }
.video__empty-bars i:nth-child(3) { background: var(--generated); animation-delay: 0.4s; }
.video__empty-bars i:nth-child(4) { background: var(--inconclusive); animation-delay: 0.6s; }
@keyframes eq { 0%, 100% { height: 18px; } 50% { height: 60px; } }

/* Film layout: player in the middle, live rails either side ---------------- */
.film {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(0, 820px) minmax(210px, 1fr);
  grid-template-areas: "l v r";
  align-items: center;
  gap: clamp(22px, 3vw, 54px);
}
.film .video { grid-area: v; }
.rail--l { grid-area: l; }
.rail--r { grid-area: r; }

.rail {
  position: relative;
  max-width: 300px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--ink-2);
}
.rail--l { justify-self: end; width: 100%; }
.rail--r { justify-self: start; width: 100%; }

.rail__head {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 12px; margin-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted);
}
.rail__head { gap: 10px; }
.rail__head > * { white-space: nowrap; }
.rail__head b { font-weight: 500; color: var(--ink); }
.rail__live { display: inline-flex; align-items: center; gap: 7px; }
.rail__live i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: background 0.4s; }
.film.is-playing .rail__live i { background: var(--generated); animation: blink 1.2s ease-in-out infinite; }

/* Signal mix */
.mix + .mix { margin-top: 14px; }
.mix__top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.mix__top span { display: inline-flex; align-items: center; gap: 8px; letter-spacing: 0.1em; text-transform: uppercase; font-size: 10.5px; }
.mix__top span::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.mix__top b { font-family: var(--font-display); font-weight: 400; font-size: 22px; letter-spacing: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.mix__bar { height: 6px; border-radius: 6px; background: var(--paper-3); overflow: hidden; }
.mix__bar i { display: block; height: 100%; width: 25%; border-radius: 6px; background: var(--c); }

.scope { display: block; width: 100%; height: 64px; margin-top: 20px; border-top: 1px dashed var(--line-soft); border-bottom: 1px dashed var(--line-soft); }
.rail__foot { margin-top: 10px; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }

/* Evidence log */
.log { position: relative; list-style: none; margin: 0; padding: 0 0 0 18px; }
.log::before { content: ""; position: absolute; left: 3px; top: 4px; bottom: 4px; width: 1px; background: var(--line-soft); }
.log__track { position: absolute; left: 3px; top: 4px; bottom: 4px; width: 1px; background: var(--gold); transform-origin: top; transform: scaleY(var(--p, 0)); }
.log li {
  position: relative;
  padding: 0 0 13px;
  opacity: 0.3;
  transform: translateX(8px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
.log li::before {
  content: ""; position: absolute; left: -18px; top: 4px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--line);
  transition: background 0.4s, border-color 0.4s, box-shadow 0.4s;
}
.log li.is-on { opacity: 1; transform: none; }
.log li.is-on::before { background: var(--gold); border-color: var(--gold); }
.log li.is-new::before { box-shadow: 0 0 0 5px rgba(166, 124, 71, 0.22); }
.log li.is-alert.is-on::before { background: var(--generated); border-color: var(--generated); box-shadow: 0 0 0 5px rgba(154, 90, 78, 0.2); }
.log__row { display: flex; justify-content: space-between; gap: 10px; }
.log__n { text-transform: uppercase; letter-spacing: 0.1em; font-size: 10.5px; }
.log__t { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.log__o { display: block; margin-top: 3px; font-size: 11px; letter-spacing: 0.02em; color: var(--muted); }
.log li.is-alert .log__n { color: var(--generated); font-weight: 600; }

@media (max-width: 1360px) {
  .film { grid-template-columns: 1fr 1fr; grid-template-areas: "v v" "l r"; row-gap: 40px; align-items: start; }
  .rail { max-width: none; justify-self: stretch; }
  /* rails sit under the video here: rise in instead of sliding in from the sides */
  .js .rail[data-reveal] { transform: translate3d(0, 24px, 0); }
  .js .rail[data-reveal].is-visible { transform: none; }
}
@media (max-width: 760px) {
  .film { grid-template-columns: 1fr; grid-template-areas: "v" "l" "r"; row-gap: 34px; }
  .section__head { flex-direction: column; align-items: flex-start; gap: 18px; }

  /* compact rails: mix as a 2 × 2 grid, log shows only the latest entry and the next one */
  .rail--l { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; row-gap: 14px; }
  .rail--l .rail__head, .rail--l .scope, .rail--l .rail__foot { grid-column: 1 / -1; }
  .rail--l .rail__head { margin-bottom: 2px; }
  .mix + .mix { margin-top: 0; }
  .mix__top { gap: 6px; }
  .mix__top span { min-width: 0; font-size: 9.5px; letter-spacing: 0.06em; gap: 6px; }
  .mix__top b { font-size: 18px; }
  .scope { height: 44px; margin-top: 4px; }
  .rail__foot { margin-top: -4px; }
  .log li { display: none; }
  .log li.is-new, .log li.is-next { display: block; }

  /* video frame labels */
  .video__rec, .video__tag { padding: 5px 10px; font-size: 9.5px; letter-spacing: 0.12em; }
  .video__chrome, .video__caption { padding: 8px; }
  .video__play { width: 64px; height: 64px; }
}
