/* Next Best Sense page: before/after sliders, media grids, lazy videos. */

.nbs-lead {
  margin-bottom: 1rem;
}

/* ---------- Before/after slider ---------- */
.ba {
  --pos: 50%;
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #e8e8e8;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  cursor: ew-resize;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.ba:focus-visible {
  outline: 3px solid #3273dc;
  outline-offset: 2px;
}

.ba > img,
.ba > video {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.ba > .ba-before {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: cover;
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}

.ba-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 3px;
  margin-left: -1.5px;
  background: #fff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.ba-handle::after {
  content: "\2039\00a0\203A";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2.2rem;
  height: 2.2rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff;
  color: #333;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 2.1rem;
  text-align: center;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

.ba-label {
  position: absolute;
  top: 0.5rem;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  pointer-events: none;
  white-space: nowrap;
}

.ba-label-l {
  left: 0.5rem;
}

.ba-label-r {
  right: 0.5rem;
  background: rgba(35, 120, 60, 0.85);
}

/* ---------- Grids ---------- */
.nbs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
  margin: 0.75rem 0 1.75rem 0;
}

.nbs-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  align-items: end;
}

.nbs-grid.single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.nbs-cell {
  margin: 0;
}

.nbs-cell > img,
.nbs-cell > video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.nbs-cap {
  display: block;
  margin: 0 0 0.35rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  color: #363636;
}

.nbs-scene {
  margin: 1.5rem 0 0.25rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  color: #363636;
}

/* ---------- Ablation picker ---------- */
.nbs-picker {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.5rem 0 0.75rem 0;
}

.nbs-picker button {
  padding: 0.35rem 0.85rem;
  border: 1.5px solid #363636;
  border-radius: 999px;
  background: #fff;
  color: #363636;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.nbs-picker button[aria-pressed="true"] {
  background: #363636;
  color: #fff;
}

.nbs-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  background: #b91c1c;
  color: #fff;
  font-size: 0.8em;
  vertical-align: 0.1em;
}

#splash-video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

@media (max-width: 768px) {
  .nbs-grid,
  .nbs-grid.single {
    grid-template-columns: minmax(0, 1fr);
  }

  .nbs-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.3rem;
  }

  .nbs-grid.three .nbs-cap {
    font-size: 0.72rem;
  }

  .ba-label {
    font-size: 0.7rem;
  }
}

/* Bulma's .content adds side/top margins to figures; the grids handle spacing. */
.content figure.nbs-cell,
.content figure.ba,
.content .nbs-cell .ba {
  margin: 0;
}

/* ---------- Splash: interactive next-best-view toy ---------- */
.nbv-toy {
  max-width: 960px;
  margin: 0 auto 1.5rem auto;
}

.nbv-stage {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 35%, #1e293b 0%, #0b1120 75%);
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.35);
}

.nbv-stage canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 8.5;
  touch-action: pan-y;
  cursor: grab;
}

.nbv-stage canvas:active {
  cursor: grabbing;
}

.nbv-hud {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  background: rgba(11, 17, 32, 0.6);
  color: #e2e8f0;
  pointer-events: none;
  font-size: 0.85rem;
  line-height: 1.35;
}

.nbv-hud .nbv-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.3rem;
}

.nbv-hud b {
  color: #fff;
}

.nbv-meter {
  width: 10rem;
  height: 6px;
  margin: 0.35rem 0;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.3);
  overflow: hidden;
}

.nbv-meter span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #30123b, #4686fb, #1ae4b6, #a2fc3c, #fabb39, #e4460a, #7a0403);
  transition: width 0.6s ease;
}

.nbv-last {
  color: #facc15;
  font-weight: 600;
  min-height: 1.2em;
}

.nbv-legend {
  position: absolute;
  right: 1rem;
  bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #cbd5e1;
  font-size: 0.75rem;
  pointer-events: none;
}

.nbv-legend i {
  width: 6rem;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #30123b, #4686fb, #1ae4b6, #a2fc3c, #fabb39, #e4460a, #7a0403);
}

.nbv-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.nbv-controls button {
  padding: 0.45rem 1rem;
  border: 1.5px solid #363636;
  border-radius: 999px;
  background: #fff;
  color: #363636;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.nbv-controls button.is-primary-nbv {
  background: #363636;
  color: #fff;
}

.nbv-caption {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: #6b7280;
  text-align: center;
}

.nbv-fallback {
  display: none;
}

.nbv-toy.is-failed .nbv-stage,
.nbv-toy.is-failed .nbv-controls {
  display: none;
}

.nbv-toy.is-failed .nbv-fallback {
  display: block;
  width: 40%;
  margin: auto;
}

@media (max-width: 768px) {
  .nbv-stage canvas {
    aspect-ratio: 4 / 3.4;
  }

  .nbv-hud {
    top: 0.5rem;
    left: 0.5rem;
    font-size: 0.75rem;
  }

  .nbv-hud .nbv-title {
    font-size: 0.95rem;
  }

  .nbv-meter {
    width: 7rem;
  }

  .nbv-legend i {
    width: 4rem;
  }
}

/* ---------- Splash video (above the toy) ---------- */
.nbs-splash {
  display: block;
  width: 100%;
  max-width: 960px;
  height: auto;
  margin: 0 auto;
  border-radius: 14px;
  background: #0b1120;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.35);
}

.nbv-try {
  max-width: 960px;
  margin: 2rem auto 0.75rem auto;
  font-size: 1.15rem;
  font-weight: 600;
  text-align: center;
  color: #363636;
}
