/* ==========================================================================
   NADIR Pipeline Demo — cinematic Console walkthrough
   ========================================================================== */

.pipeline-demo {
  --pd-radius: 16px;
  --pd-bg: #0a0b0b;
  --pd-panel: #111210;
  --pd-line: rgba(255, 255, 255, 0.08);
  --pd-caption-h: 52px;
  position: relative;
  width: 100%;
  color: #e8e4da;
  font-family: var(--body);
}

.pipeline-demo[data-variant="hero"] {
  width: 760px;
  max-width: 100%;
  margin-right: -145px;
  transform: perspective(1400px) rotateY(-2deg) rotateX(1deg);
  transform-origin: center;
}

.pipeline-demo[data-variant="cinema"] {
  max-width: 1120px;
  margin: 0 auto;
}

.pd-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--pd-radius);
  background: var(--pd-bg);
  box-shadow:
    0 44px 90px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(0, 0, 0, 0.55),
    inset 0 1px rgba(255, 255, 255, 0.04);
}

.pd-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(115deg, rgba(255, 101, 52, 0.06), transparent 38%, transparent 62%, rgba(126, 227, 154, 0.04));
}

.pd-topbar {
  position: relative;
  z-index: 3;
  display: grid;
  height: 44px;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid var(--pd-line);
  background: #111210;
  grid-template-columns: 1fr auto 1fr;
}

.pd-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.pd-brand img {
  width: 18px;
  height: 18px;
}

.pd-mode {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid rgba(126, 227, 154, 0.14);
  border-radius: 999px;
  background: rgba(126, 227, 154, 0.04);
  color: #95a397;
  font-family: var(--mono);
  font-size: 0.48rem;
  letter-spacing: 0.1em;
}

.pd-mode i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pd-pulse 1.8s ease-in-out infinite;
}

.pd-dots {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
}

.pd-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34342f;
}

.pd-viewport {
  position: relative;
  z-index: 2;
  height: 520px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    var(--pd-bg);
  background-size: 24px 24px;
}

.pipeline-demo[data-variant="hero"] .pd-viewport {
  height: 468px;
}

.pipeline-demo[data-variant="cinema"] .pd-viewport {
  height: min(62vh, 620px);
  min-height: 480px;
}

.pd-scene {
  position: absolute;
  inset: 0;
  display: grid;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.985) translateY(8px);
  transition:
    opacity 0.65s var(--ease),
    transform 0.75s var(--ease),
    visibility 0s linear 0.75s;
  grid-template-columns: 48px 1fr;
}

.pd-scene.is-active {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
  transition:
    opacity 0.55s var(--ease),
    transform 0.65s var(--ease),
    visibility 0s;
}

.pd-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  border-right: 1px solid rgba(255, 255, 255, 0.055);
  background: #0d0e0d;
}

.pd-rail img {
  width: 19px;
  height: 19px;
  margin-bottom: 8px;
}

.pd-rail span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 6px;
  color: #4e504c;
}

.pd-rail span.is-lit {
  color: var(--orange-light);
  background: var(--orange-wash);
}

.pd-rail svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.25;
}

.pd-main {
  position: relative;
  padding: 22px 24px 18px;
  overflow: hidden;
}

.pd-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pd-kicker {
  color: #6c6d67;
  font-family: var(--mono);
  font-size: 0.48rem;
  letter-spacing: 0.12em;
}

.pd-head h3 {
  margin: 5px 0 0;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.pd-meta {
  color: #545650;
  font-family: var(--mono);
  font-size: 0.48rem;
  white-space: nowrap;
}

/* Scene: Import */

.pd-import-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  grid-template-columns: 1fr 1.1fr;
}

.pd-drop {
  position: relative;
  min-height: 210px;
  padding: 18px;
  border: 1px dashed rgba(255, 101, 52, 0.35);
  border-radius: 12px;
  background: rgba(255, 101, 52, 0.04);
}

.pd-drop.is-active {
  border-color: rgba(126, 227, 154, 0.45);
  background: rgba(126, 227, 154, 0.05);
  box-shadow: inset 0 0 0 1px rgba(126, 227, 154, 0.08);
}

.pd-drop-label {
  color: #8a8780;
  font-size: 0.72rem;
}

.pd-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(18, 19, 18, 0.95);
  opacity: 0;
  transform: translateY(10px);
  font-family: var(--mono);
  font-size: 0.62rem;
}

.pd-scene.is-active .pd-file-chip {
  animation: pd-rise 0.55s var(--ease) 0.35s forwards;
}

.pd-file-chip svg {
  width: 14px;
  height: 14px;
  stroke: var(--orange);
  fill: none;
  stroke-width: 1.5;
}

.pd-upload-bar {
  height: 4px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.pd-upload-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--green));
}

.pd-scene.is-active .pd-upload-bar i {
  animation: pd-upload 1.8s var(--ease) 0.6s forwards;
}

.pd-ro-table {
  min-height: 210px;
  padding: 14px;
  border: 1px solid var(--pd-line);
  border-radius: 12px;
  background: rgba(18, 19, 18, 0.92);
}

.pd-ro-table table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.52rem;
}

.pd-ro-table th {
  padding: 0 0 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #6c6d67;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-align: left;
}

.pd-ro-table td {
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #c9c5bc;
}

.pd-ro-row {
  opacity: 0;
  transform: translateX(-8px);
}

.pd-scene.is-active .pd-ro-row:nth-child(1) { animation: pd-row-in 0.45s var(--ease) 1.1s forwards; }
.pd-scene.is-active .pd-ro-row:nth-child(2) { animation: pd-row-in 0.45s var(--ease) 1.45s forwards; }
.pd-scene.is-active .pd-ro-row:nth-child(3) { animation: pd-row-in 0.45s var(--ease) 1.8s forwards; }
.pd-scene.is-active .pd-ro-row:nth-child(4) { animation: pd-row-in 0.45s var(--ease) 2.15s forwards; }

.pd-import-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(126, 227, 154, 0.12);
  border-radius: 8px;
  background: rgba(126, 227, 154, 0.04);
  opacity: 0;
  font-size: 0.72rem;
}

.pd-scene.is-active .pd-import-stat {
  animation: pd-rise 0.5s var(--ease) 2.5s forwards;
}

.pd-import-stat b {
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.58rem;
}

/* Scene: Score */

.pd-score-layout {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  grid-template-columns: 1.1fr 0.9fr;
}

.pd-terminal {
  overflow: hidden;
  border: 1px solid var(--pd-line);
  border-radius: 12px;
  background: #0d0e0d;
}

.pd-terminal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #6c6d67;
  font-family: var(--mono);
  font-size: 0.48rem;
  letter-spacing: 0.08em;
}

.pd-terminal-body {
  min-height: 200px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 0.54rem;
  line-height: 1.65;
}

.pd-log {
  opacity: 0;
  transform: translateY(4px);
  color: #8a8780;
}

.pd-log b { color: #d8d4cb; font-weight: 500; }
.pd-log .ok { color: var(--green); }
.pd-log .warn { color: var(--amber); }
.pd-log .crit { color: var(--red); }

.pd-scene.is-active .pd-log:nth-child(1) { animation: pd-log-in 0.35s var(--ease) 0.2s forwards; }
.pd-scene.is-active .pd-log:nth-child(2) { animation: pd-log-in 0.35s var(--ease) 0.55s forwards; }
.pd-scene.is-active .pd-log:nth-child(3) { animation: pd-log-in 0.35s var(--ease) 0.9s forwards; }
.pd-scene.is-active .pd-log:nth-child(4) { animation: pd-log-in 0.35s var(--ease) 1.25s forwards; }
.pd-scene.is-active .pd-log:nth-child(5) { animation: pd-log-in 0.35s var(--ease) 1.6s forwards; }
.pd-scene.is-active .pd-log:nth-child(6) { animation: pd-log-in 0.35s var(--ease) 1.95s forwards; }
.pd-scene.is-active .pd-log:nth-child(7) { animation: pd-log-in 0.35s var(--ease) 2.3s forwards; }

.pd-score-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pd-ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 16px;
  border: 1px solid var(--pd-line);
  border-radius: 12px;
  background: rgba(18, 19, 18, 0.92);
}

.pd-ring {
  position: relative;
  width: 88px;
  height: 88px;
}

.pd-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.pd-ring circle {
  fill: none;
  stroke-width: 4;
}

.pd-ring .track { stroke: rgba(255, 255, 255, 0.06); }
.pd-ring .fill {
  stroke: url(#pd-ring-gradient);
  stroke-dasharray: 226;
  stroke-dashoffset: 226;
}

.pd-scene.is-active .pd-ring .fill {
  animation: pd-ring-fill 2.2s var(--ease) 0.4s forwards;
}

.pd-ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
}

.pd-ring-caption {
  margin-top: 10px;
  color: #8a8780;
  font-size: 0.68rem;
  text-align: center;
}

.pd-tier-bars {
  display: grid;
  gap: 8px;
}

.pd-tier-bar {
  display: grid;
  align-items: center;
  gap: 8px;
  grid-template-columns: 64px 1fr 28px;
  font-family: var(--mono);
  font-size: 0.48rem;
}

.pd-tier-bar span:first-child { color: #6c6d67; }

.pd-tier-bar i {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.pd-tier-bar i::after {
  content: "";
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
}

.pd-tier-bar.nom i::after { background: var(--green); }
.pd-tier-bar.cau i::after { background: var(--amber); }
.pd-tier-bar.cri i::after { background: var(--red); }

.pd-scene.is-active .pd-tier-bar.nom i::after { animation: pd-bar-w 0.8s var(--ease) 1.2s forwards; width: 72%; }
.pd-scene.is-active .pd-tier-bar.cau i::after { animation: pd-bar-w 0.8s var(--ease) 1.5s forwards; width: 18%; }
.pd-scene.is-active .pd-tier-bar.cri i::after { animation: pd-bar-w 0.8s var(--ease) 1.8s forwards; width: 10%; }

@keyframes pd-bar-w {
  from { width: 0; }
}

/* Scene: Queue */

.pd-queue-tabs {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.pd-queue-tabs button {
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #6c6d67;
  font-family: var(--mono);
  font-size: 0.48rem;
  letter-spacing: 0.06em;
}

.pd-queue-tabs button.is-on {
  border-color: rgba(255, 98, 90, 0.25);
  background: rgba(255, 98, 90, 0.08);
  color: #ffb4af;
}

.pd-queue-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.pd-q-row {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  background: rgba(18, 19, 18, 0.88);
  opacity: 0;
  transform: translateY(12px);
  grid-template-columns: auto 1fr 72px auto;
}

.pd-scene.is-active .pd-q-row:nth-child(1) { animation: pd-queue-in 0.55s var(--ease) 0.35s forwards; }
.pd-scene.is-active .pd-q-row:nth-child(2) { animation: pd-queue-in 0.55s var(--ease) 0.75s forwards; }
.pd-scene.is-active .pd-q-row:nth-child(3) { animation: pd-queue-in 0.55s var(--ease) 1.15s forwards; }

.pd-q-row.is-focus {
  border-color: rgba(255, 98, 90, 0.28);
  box-shadow: 0 0 0 1px rgba(255, 98, 90, 0.08), 0 12px 32px rgba(255, 98, 90, 0.08);
}

.pd-van-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.pd-van-icon svg {
  width: 22px;
  height: 14px;
  fill: none;
  stroke: #9a9892;
  stroke-width: 1.2;
}

.pd-q-copy strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
}

.pd-q-copy small {
  color: #7a7770;
  font-size: 0.62rem;
}

.pd-spark {
  height: 28px;
}

.pd-spark svg {
  width: 100%;
  height: 100%;
}

.pd-spark path {
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.pd-spark.red path { stroke: var(--red); }
.pd-spark.amber path { stroke: var(--amber); }

.pd-badge {
  padding: 4px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.44rem;
  letter-spacing: 0.06em;
}

.pd-badge.red {
  border: 1px solid rgba(255, 98, 90, 0.25);
  background: rgba(255, 98, 90, 0.1);
  color: #ffb4af;
}

.pd-badge.amber {
  border: 1px solid rgba(255, 193, 90, 0.22);
  background: rgba(255, 193, 90, 0.08);
  color: #ffd899;
}

.pd-queue-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: #6c6d67;
  font-family: var(--mono);
  font-size: 0.48rem;
}

.pd-queue-foot b { color: var(--red); }

/* Scene: Detail */

.pd-detail-layout {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  grid-template-columns: 0.85fr 1.15fr;
}

.pd-mini-queue {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--pd-line);
  border-radius: 10px;
  background: rgba(14, 15, 14, 0.95);
}

.pd-mini-row {
  padding: 8px 10px;
  border-radius: 8px;
  color: #6c6d67;
  font-family: var(--mono);
  font-size: 0.5rem;
}

.pd-mini-row.is-on {
  border: 1px solid rgba(255, 98, 90, 0.22);
  background: rgba(255, 98, 90, 0.06);
  color: #ffb4af;
}

.pd-detail-card {
  padding: 14px;
  border: 1px solid rgba(255, 98, 90, 0.18);
  border-radius: 12px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 98, 90, 0.08), transparent 42%),
    rgba(18, 19, 18, 0.95);
  opacity: 0;
  transform: translateY(10px) scale(0.98);
}

.pd-scene.is-active .pd-detail-card {
  animation: pd-detail-open 0.7s var(--ease) 0.25s forwards;
}

.pd-detail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.pd-detail-top h4 {
  margin: 4px 0 0;
  font-size: 1rem;
  font-weight: 600;
}

.pd-ro-pill {
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  font-family: var(--mono);
  font-size: 0.46rem;
  line-height: 1.5;
  text-align: right;
}

.pd-ro-pill b { color: #d8d4cb; }

.pd-chart {
  height: 110px;
  margin-top: 14px;
}

.pd-chart svg {
  width: 100%;
  height: 100%;
}

.pd-chart .grid-line {
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 1;
}

.pd-chart .residual {
  fill: none;
  stroke: var(--red);
  stroke-width: 2;
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
}

.pd-scene.is-active .pd-chart .residual {
  animation: pd-draw-line 1.4s var(--ease) 0.8s forwards;
}

.pd-chart .anchor {
  stroke: var(--orange);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
  opacity: 0;
}

.pd-scene.is-active .pd-chart .anchor {
  animation: pd-fade-in 0.4s var(--ease) 1.2s forwards;
}

.pd-metrics-row {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  grid-template-columns: repeat(3, 1fr);
}

.pd-metric {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.pd-metric small {
  color: #6c6d67;
  font-family: var(--mono);
  font-size: 0.42rem;
  letter-spacing: 0.06em;
}

.pd-metric strong {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 0.78rem;
}

.pd-metric.pass strong { color: var(--green); }

/* Scene: Evidence */

.pd-evidence-layout {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  align-items: center;
  grid-template-columns: 1fr 1fr;
}

.pd-evb {
  position: relative;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(24, 25, 23, 0.98), rgba(12, 13, 12, 0.98));
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

.pd-evb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.pd-evb-head span {
  font-family: var(--mono);
  font-size: 0.48rem;
  letter-spacing: 0.1em;
}

.pd-evb-id {
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
}

.pd-evb-lines span {
  display: block;
  height: 5px;
  margin-bottom: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.pd-evb-lines span:nth-child(1) { width: 92%; }
.pd-evb-lines span:nth-child(2) { width: 78%; }
.pd-evb-lines span:nth-child(3) { width: 64%; }

.pd-hash-block {
  margin-top: 14px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
}

.pd-hash-block small {
  color: #6c6d67;
  font-family: var(--mono);
  font-size: 0.42rem;
}

.pd-hash-block code {
  display: block;
  margin-top: 6px;
  color: #b8b4ab;
  font-family: var(--mono);
  font-size: 0.5rem;
  line-height: 1.5;
  word-break: break-all;
}

.pd-verify-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pd-verify-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  background: rgba(18, 19, 18, 0.9);
  opacity: 0;
  transform: translateX(8px);
  font-size: 0.72rem;
}

.pd-scene.is-active .pd-verify-step:nth-child(1) { animation: pd-slide-in 0.45s var(--ease) 0.3s forwards; }
.pd-scene.is-active .pd-verify-step:nth-child(2) { animation: pd-slide-in 0.45s var(--ease) 0.7s forwards; }
.pd-scene.is-active .pd-verify-step:nth-child(3) { animation: pd-slide-in 0.45s var(--ease) 1.1s forwards; }

.pd-check {
  display: grid;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: transparent;
  font-size: 0.65rem;
}

.pd-verify-step.done .pd-check {
  background: rgba(126, 227, 154, 0.15);
  color: var(--green);
  box-shadow: 0 0 16px rgba(126, 227, 154, 0.25);
}

.pd-scene.is-active .pd-verify-step:nth-child(1).done .pd-check { animation: pd-check-pop 0.4s var(--ease) 0.55s forwards; }
.pd-scene.is-active .pd-verify-step:nth-child(2).done .pd-check { animation: pd-check-pop 0.4s var(--ease) 0.95s forwards; }
.pd-scene.is-active .pd-verify-step:nth-child(3).done .pd-check { animation: pd-check-pop 0.4s var(--ease) 1.35s forwards; }

.pd-stamp {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border: 2px solid rgba(126, 227, 154, 0.35);
  border-radius: 12px;
  background: rgba(126, 227, 154, 0.06);
  opacity: 0;
  transform: scale(0.92);
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.pd-scene.is-active .pd-stamp {
  animation: pd-stamp-in 0.55s var(--ease) 1.6s forwards;
}

/* Caption + progress */

.pd-caption-bar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--pd-caption-h);
  padding: 0 16px;
  border-top: 1px solid var(--pd-line);
  background: rgba(10, 11, 10, 0.96);
}

.pd-caption-text {
  flex: 1;
  min-width: 0;
  color: #d8d4cb;
  font-size: 0.78rem;
}

.pd-caption-text small {
  display: block;
  margin-bottom: 2px;
  color: var(--orange-light);
  font-family: var(--mono);
  font-size: 0.44rem;
  letter-spacing: 0.1em;
}

.pd-caption-text span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pd-scene-dots {
  display: flex;
  gap: 6px;
}

.pd-scene-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease);
}

.pd-scene-dots button.is-on {
  background: var(--orange);
  transform: scale(1.15);
}

.pd-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--orange), var(--green));
  box-shadow: 0 0 12px rgba(255, 101, 52, 0.45);
}

/* Cinema controls */

.pd-cinema-wrap {
  display: grid;
  gap: 24px;
}

.pd-cinema-side {
  display: grid;
  gap: 20px;
  grid-template-columns: 240px 1fr;
  align-items: start;
}

.pd-chapters {
  position: sticky;
  top: calc(var(--header-height) + 20px);
  padding: 16px;
  border: 1px solid var(--pd-line);
  border-radius: 14px;
  background: rgba(14, 15, 14, 0.92);
}

.pd-chapters strong {
  display: block;
  margin-bottom: 12px;
  color: #6c6d67;
  font-family: var(--mono);
  font-size: 0.48rem;
  letter-spacing: 0.1em;
}

.pd-chapters button {
  display: grid;
  width: 100%;
  gap: 2px;
  margin-bottom: 6px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #8a8780;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.pd-chapters button.is-on {
  border-color: rgba(255, 101, 52, 0.22);
  background: rgba(255, 101, 52, 0.06);
  color: #f4f1e9;
}

.pd-chapters button small {
  color: #6c6d67;
  font-family: var(--mono);
  font-size: 0.44rem;
}

.pd-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pd-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #d8d4cb;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.52rem;
}

.pd-controls button:hover {
  border-color: rgba(255, 101, 52, 0.3);
  background: rgba(255, 101, 52, 0.08);
}

.pd-glow {
  position: absolute;
  z-index: 0;
  inset: 5% 2% -12% 7%;
  background: radial-gradient(ellipse, rgba(255, 83, 29, 0.2), transparent 63%);
  filter: blur(35px);
  pointer-events: none;
}

.hero-product-demo {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 720px;
  margin-inline: auto;
  padding-bottom: 28px;
}

.hero-product-demo .pd-link {
  position: absolute;
  right: 0;
  bottom: -36px;
  color: #8a8780;
  font-size: 0.72rem;
  text-decoration: none;
}

.hero-product-demo .pd-link:hover { color: var(--orange-light); }

/* Keyframes */

@keyframes pd-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}

@keyframes pd-rise {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pd-row-in {
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pd-upload {
  to { width: 100%; }
}

@keyframes pd-log-in {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pd-ring-fill {
  to { stroke-dashoffset: 18; }
}

@keyframes pd-queue-in {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pd-detail-open {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pd-draw-line {
  to { stroke-dashoffset: 0; }
}

@keyframes pd-fade-in {
  to { opacity: 1; }
}

@keyframes pd-slide-in {
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pd-check-pop {
  to { color: var(--green); transform: scale(1); }
}

@keyframes pd-stamp-in {
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .pd-scene,
  .pd-scene.is-active,
  .pd-scene.is-active *,
  .pd-ring .fill,
  .pd-progress {
    animation: none !important;
    transition: none !important;
  }

  .pd-scene { opacity: 0; visibility: hidden; }
  .pd-scene.is-active { opacity: 1; visibility: visible; transform: none; }

  .pd-file-chip,
  .pd-ro-row,
  .pd-import-stat,
  .pd-log,
  .pd-q-row,
  .pd-detail-card,
  .pd-verify-step,
  .pd-stamp {
    opacity: 1 !important;
    transform: none !important;
  }

  .pd-ring .fill { stroke-dashoffset: 18; }
  .pd-chart .residual { stroke-dashoffset: 0; }
  .pd-upload-bar i { width: 100%; }
}

@media (max-width: 1100px) {
  .pipeline-demo[data-variant="hero"] {
    width: 100%;
    margin-right: 0;
    transform: none;
  }
}

@media (max-width: 900px) {
  .pd-import-grid,
  .pd-score-layout,
  .pd-detail-layout,
  .pd-evidence-layout,
  .pd-cinema-side {
    grid-template-columns: 1fr;
  }

  .pd-cinema-side { grid-template-columns: 1fr; }
  .pd-chapters { position: static; }
}

@media (max-width: 640px) {
  .pd-viewport,
  .pipeline-demo[data-variant="hero"] .pd-viewport {
    height: 420px;
  }

  .pd-main { padding: 16px; }
  .pd-caption-text span { white-space: normal; }
}

/* Video showcase (recorded pipeline demo) */

.pd-showcase {
  position: relative;
  z-index: 2;
}

.pd-showcase[data-variant="hero"] {
  width: 760px;
  max-width: 100%;
  margin-right: -145px;
  transform: perspective(1400px) rotateY(-2deg) rotateX(1deg);
  transform-origin: center;
}

.pd-showcase[data-variant="cinema"] {
  max-width: 1120px;
  margin: 0 auto;
}

.pd-shell--video .pd-video-stage {
  position: relative;
  overflow: hidden;
  background: #0a0b0b;
  aspect-ratio: 1280 / 620;
  max-height: min(62vh, 620px);
}

.pd-showcase[data-variant="hero"] .pd-shell--video .pd-video-stage {
  height: 468px;
  max-height: 468px;
  aspect-ratio: auto;
}

.pd-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  background: #0a0b0b;
}

.pd-video-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.05) 0%,
    transparent 35%,
    transparent 65%,
    rgba(255, 101, 52, 0.04) 100%
  );
}

.pd-shell--video .pd-progress {
  position: relative;
  bottom: auto;
  left: auto;
  width: 100%;
  height: 2px;
}

.pd-showcase.is-fallback .pd-video-stage {
  aspect-ratio: auto;
  height: auto;
  max-height: none;
}

.pd-showcase.is-fallback .pd-coded-fallback {
  display: block !important;
}

.pd-cinema-layout {
  display: grid;
  gap: 24px;
  grid-template-columns: 240px 1fr;
  align-items: start;
}

.pd-cinema-chapters-wrap .pd-chapters {
  position: sticky;
  top: calc(var(--header-height) + 20px);
}

.pd-chapters-video button.is-on,
.pd-chapters button.is-on {
  border-color: rgba(255, 101, 52, 0.22);
  background: rgba(255, 101, 52, 0.06);
  color: #f4f1e9;
}

@media (max-width: 900px) {
  .pd-cinema-layout {
    grid-template-columns: 1fr;
  }

  .pd-cinema-chapters-wrap .pd-chapters {
    position: static;
  }
}

@media (max-width: 1100px) {
  .pd-showcase[data-variant="hero"] {
    width: 100%;
    margin-right: 0;
    transform: none;
  }
}
