/* Visitor Pulse — right-edge collapsible rail + expanded panel */

/* ===== Collapsed rail ===== */
.vp-rail {
  position: fixed;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 180;
  width: 64px;
  background: var(--c-charcoal);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  padding: 10px 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(6,23,31,0.28);
  font-family: var(--font-sans);
}
.vp-rail:hover { background: #0B1F28; }
.vp-rail__mini {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.vp-rail__label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 8.5px;
  letter-spacing: 0.24em;
  font-weight: 700;
  color: var(--c-lime-hivis);
  font-family: var(--font-mono);
  margin: 4px 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.vp-rail__label span {
  color: rgba(255,255,255,0.4);
  letter-spacing: 0;
  margin: 0 2px;
}
.vp-rail__def {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-direction: column;
}
.vp-rail__def-bar {
  width: 6px;
  height: 56px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.vp-rail__def-fill {
  width: 100%;
  background: linear-gradient(180deg, #ADEF9B 0%, var(--c-malachyte) 100%);
  border-radius: 3px;
  transition: height 600ms cubic-bezier(.22,.61,.36,1);
}
.vp-rail__def-num {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--c-lime-hivis);
  letter-spacing: 0.04em;
}
.vp-rail__chev {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
  line-height: 1;
}

/* ===== Expanded panel ===== */
.vp-panel {
  position: fixed;
  right: 14px;
  top: 14px;
  bottom: 14px;
  left: 14px;
  width: auto;
  max-width: 1480px;
  margin: 0 auto;
  z-index: 190;
  background: var(--c-charcoal);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  box-shadow: 0 18px 48px rgba(6,23,31,0.36);
  overflow: hidden;
  animation: vp-slide-in 320ms cubic-bezier(.22,.61,.36,1);
}
@keyframes vp-slide-in {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.vp-panel__head {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
}
.vp-panel__head-l { display: flex; flex-direction: column; gap: 2px; }
.vp-panel__eye {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--c-lime-hivis);
  font-weight: 700;
}
.vp-panel__id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.04em;
}
.vp-panel__close {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.vp-panel__close:hover { background: rgba(255,255,255,0.12); }

.vp-panel__body {
  flex: 1;
  padding: 16px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 260px;
  gap: 16px;
  min-height: 0;
}
.vp-panel__col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
}
.vp-panel__col--center { gap: 12px; min-height: 380px; }
@media (max-width: 820px) {
  .vp-panel__body { grid-template-columns: 1fr; overflow-y: auto; }
  .vp-panel__col { overflow: visible; }
  .vp-panel__col--center { min-height: 360px; }
}

/* ===== Cards ===== */
.vp-card {
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vp-card--dark {
  background: #0B1F28;
  border: 1px solid rgba(255,255,255,0.06);
  color: #fff;
}
.vp-card--context {
  background: linear-gradient(180deg, #0E2D2A 0%, #0A2422 100%);
  border: 1px solid rgba(122, 171, 124, 0.22);
  color: #fff;
}
.vp-card--context .vp-card__eye { color: #ADEF9B; }
.vp-card--context .vp-row__k { color: #ADEF9B; }
.vp-card--context .vp-row { border-bottom-color: rgba(122, 171, 124, 0.12); }

.vp-card--tracker {
  background: linear-gradient(180deg, #1B1730 0%, #161329 100%);
  border: 1px solid rgba(167, 160, 235, 0.22);
  color: #fff;
}
.vp-card--tracker .vp-card__eye--tracker { color: #C9C3F3; }
.vp-card--tracker .vp-event { border-bottom-color: rgba(167, 160, 235, 0.12); }
.vp-card--tracker .vp-event__kind { color: #C9C3F3; }
.vp-card--tracker .vp-dot { background: #C9C3F3; }
.vp-card--cream {
  background: #FBF9F2;
  color: #1F1F1F;
  border: 1px solid #E8E2D2;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.vp-card__eye {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  font-weight: 700;
  color: var(--c-lime-hivis);
  text-transform: uppercase;
}
.vp-card__eye--cream { color: #6E6657; }
.vp-card__eye--sub { margin-top: 6px; }
.vp-card__eye--top { margin-bottom: -2px; }
.vp-card__eye-meta {
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.08em;
  font-weight: 500;
}
.vp-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-lime-hivis);
  margin-right: 4px;
  vertical-align: middle;
  animation: vp-pulse 2s ease-in-out infinite;
}
@keyframes vp-pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ===== Context rows ===== */
.vp-rows { display: flex; flex-direction: column; gap: 0; }
.vp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.06);
  font-size: 11px;
}
.vp-row:last-child { border-bottom: none; }
.vp-row__k {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  font-weight: 700;
  color: var(--c-lime-hivis);
  text-transform: uppercase;
}
.vp-row__v {
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: rgba(255,255,255,0.86);
  font-weight: 500;
  text-align: right;
}

/* ===== Events ===== */
.vp-events { display: flex; flex-direction: column; gap: 4px; max-height: 130px; overflow-y: auto; }
.vp-event {
  display: grid;
  grid-template-columns: 78px 1fr auto;
  gap: 8px;
  font-size: 10.5px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.06);
  align-items: center;
}
.vp-event:last-child { border-bottom: none; }
.vp-event__kind {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--c-lime-hivis);
  font-weight: 700;
  text-transform: uppercase;
}
.vp-event__label { color: rgba(255,255,255,0.86); }
.vp-event__val { font-family: var(--font-mono); font-size: 10px; color: rgba(255,255,255,0.55); }

/* ===== Bars ===== */
.vp-bars { display: flex; flex-direction: column; gap: 10px; }
.vp-bar { display: flex; flex-direction: column; gap: 4px; }
.vp-bar__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
}
.vp-bar__label { color: rgba(255,255,255,0.86); font-weight: 500; }
.vp-bar__val { font-family: var(--font-mono); font-weight: 700; font-size: 11px; }
.vp-bar__val--lime { color: #ADEF9B; }
.vp-bar__val--violet { color: #A7A0EB; }
.vp-bar__val--rose { color: #F5BFC5; }
.vp-bar__val--amber { color: #D89251; }
.vp-bar__track {
  height: 5px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.vp-bar__fill {
  height: 100%;
  border-radius: 3px;
  transition: width 500ms cubic-bezier(.22,.61,.36,1);
}
.vp-bar__fill--lime { background: linear-gradient(90deg, #ADEF9B, var(--c-malachyte)); }
.vp-bar__fill--violet { background: linear-gradient(90deg, #C9C3F3, #A7A0EB); }
.vp-bar__fill--rose { background: linear-gradient(90deg, #F5BFC5, #C56F70); }
.vp-bar__fill--amber { background: linear-gradient(90deg, #D89251, #B86F3A); }

/* ===== Vector Space SVG ===== */
.vp-space {
  background:
    radial-gradient(ellipse at 50% 50%, #FFFFFF 0%, #F4EDD9 75%, #E7DDC0 100%);
  border-radius: 10px;
  padding: 14px;
  border: 1px solid #ECE5D2;
  flex: 1 1 auto;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: relative;
}

/* Scrubber — replay the scripted progression up to the current step */
.vp-scrubber {
  position: relative;
  z-index: 4;
  margin: -4px 4px 8px;
  padding: 8px 10px;
  background: rgba(31, 31, 31, 0.04);
  border: 1px solid rgba(31, 31, 31, 0.10);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-sans);
}
.vp-scrubber__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.vp-scrubber__eye {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.20em;
  font-weight: 700;
  color: #6E6657;
  text-transform: uppercase;
}
.vp-scrubber__pos {
  font-size: 11px;
  font-weight: 700;
  color: #1F1F1F;
  letter-spacing: 0.04em;
}
.vp-scrubber__scrub {
  margin-left: 6px;
  color: var(--c-malachyte);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  font-weight: 700;
}
.vp-scrubber__range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: linear-gradient(90deg, rgba(0,0,0,0.10) 0%, rgba(3, 131, 98, 0.55) 100%);
  border-radius: 999px;
  outline: none;
  cursor: grab;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.10);
}
.vp-scrubber__range:active { cursor: grabbing; }
.vp-scrubber__range::-webkit-slider-runnable-track {
  height: 8px;
  background: transparent;
  border-radius: 999px;
}
.vp-scrubber__range::-moz-range-track {
  height: 8px;
  background: transparent;
  border-radius: 999px;
}
.vp-scrubber__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ADEF9B 0%, var(--c-malachyte) 60%, var(--c-malachyte-dark) 100%);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(3,131,98,0.35), 0 0 0 4px rgba(3,131,98,0.10);
  cursor: grab;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.vp-scrubber__range::-webkit-slider-thumb:hover { transform: scale(1.08); }
.vp-scrubber__range::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(0.96);
  box-shadow: 0 2px 6px rgba(3,131,98,0.45), 0 0 0 6px rgba(3,131,98,0.18);
}
.vp-scrubber__range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ADEF9B 0%, var(--c-malachyte) 60%, var(--c-malachyte-dark) 100%);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(3,131,98,0.35), 0 0 0 4px rgba(3,131,98,0.10);
  cursor: grab;
}
.vp-scrubber__range::-moz-range-thumb:active { cursor: grabbing; transform: scale(0.96); }
.vp-scrubber__ticks {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}
.vp-scrubber__tick {
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.10em;
  color: #888;
  cursor: pointer;
  padding: 1px 4px;
  font-weight: 700;
  text-transform: uppercase;
}
.vp-scrubber__tick.is-active { color: var(--c-malachyte-dark); }
.vp-scrubber__tick:hover { color: #1F1F1F; }

.vp-svg-wrap {
  flex: 1 1 auto;
  min-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vp-svg {
  width: 100%;
  height: 100%;
  min-height: 400px;
  max-height: 720px;
  display: block;
}
.vp-svg--compact {
  width: 52px;
  height: 52px;
}
.vp-ring {
  fill: none;
  stroke: rgba(31,31,31,0.10);
  stroke-width: 0.3;
  stroke-dasharray: 0.8 1.2;
}
.vp-line { stroke-width: 0.5; }
.vp-cluster__label, .vp-cluster__d {
  font-family: var(--font-sans);
  paint-order: stroke;
  stroke: #FBF6E9;
  stroke-width: 0.6;
}

.vp-space__foot {
  margin-top: 8px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: #6E6657;
  line-height: 1.55;
  text-transform: uppercase;
}
.vp-space__foot b { font-weight: 700; }

/* ===== Mobile / narrow ===== */
@media (max-width: 880px) {
  .vp-rail { width: 52px; right: 8px; }
  .vp-panel { width: calc(100vw - 24px); right: 12px; left: 12px; }
}

/* When the rail is visible, leave room on the right so it doesn't overlap content edges */
body.has-vp-rail .demo-viewport { padding-right: 78px; transition: padding-right 250ms ease; }
@media (max-width: 880px) {
  body.has-vp-rail .demo-viewport { padding-right: 0; }
}

/* Inter-step vector update toast */
.vp-toast {
  position: fixed;
  top: 14px;
  right: 90px;
  z-index: 200;
  background: var(--c-charcoal);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 12px 32px rgba(6,23,31,0.32);
  font-family: var(--font-sans);
  font-size: 11.5px;
  max-width: 340px;
  animation: vp-toast-in 320ms cubic-bezier(.22,.61,.36,1), vp-toast-out 320ms cubic-bezier(.22,.61,.36,1) 4.6s forwards;
}
@keyframes vp-toast-in { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes vp-toast-out { to { transform: translateY(-10px); opacity: 0; visibility: hidden; } }
.vp-toast__eye {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.20em;
  color: var(--c-lime-hivis);
  font-weight: 700;
  white-space: nowrap;
}
.vp-toast__body { color: rgba(255,255,255,0.92); }
.vp-toast__body b { color: var(--c-lime-hivis); font-family: var(--font-mono); font-size: 10.5px; }
