/* ============================================================
   Plooi interactive mini-canvas — a real draggable / wireable
   board. Vanilla, self-contained. Accent via --accent tokens.
   ============================================================ */
.pcv {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--paper);
  box-shadow:
    0 1px 0 rgba(26, 24, 20, 0.04),
    0 26px 60px rgba(26, 24, 20, 0.12);
}
.pcv-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--cream-deep);
}
.pcv-bar .d {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
}
.pcv-bar .u {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  margin-left: 10px;
}
.pcv-live {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
}
.pcv-live .lpin {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
}
@media (prefers-reduced-motion: no-preference) {
  .pcv-live .lpin {
    animation: pcvpin 2.2s ease-out infinite;
  }
}
@keyframes pcvpin {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent);
  }
  70% {
    box-shadow: 0 0 0 8px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

.pcv-stage {
  position: relative;
  height: clamp(360px, 52vh, 520px);
  overflow: hidden;
  touch-action: none;
  background: color-mix(in srgb, var(--cream) 55%, var(--paper));
  background-image: radial-gradient(circle at 1px 1px, rgba(26, 24, 20, 0.09) 1px, transparent 0);
  background-size: 22px 22px;
  cursor: grab;
}
.pcv-wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.pcv-wire {
  fill: none;
  stroke: color-mix(in srgb, var(--ink) 26%, transparent);
  stroke-width: 1.6;
}
.pcv-wire.hot {
  stroke: var(--accent);
  stroke-width: 2;
}
.pcv-wire.temp {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 5 4;
}

.pcv-node {
  position: absolute;
  z-index: 2;
  min-width: 138px;
  max-width: 180px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  cursor: grab;
  box-shadow:
    0 1px 0 rgba(26, 24, 20, 0.04),
    0 8px 20px rgba(26, 24, 20, 0.1);
  user-select: none;
  -webkit-user-select: none;
  transition:
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}
.pcv-node:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
}
.pcv-node.dragging {
  cursor: grabbing;
  box-shadow:
    0 2px 0 rgba(26, 24, 20, 0.05),
    0 18px 38px rgba(26, 24, 20, 0.18);
  z-index: 5;
}
.pcv-node.hot {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}
.pcv-node .pcv-nb {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pcv-node .pcv-ntx {
  flex: 1;
  min-width: 0;
}
.pcv-node .pcv-glyph {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent-weak);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pcv-node .pcv-glyph svg {
  width: 18px;
  height: 18px;
}
.pcv-node .pcv-nt {
  font-family: var(--display), serif;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--ink);
}
.pcv-node .pcv-nm {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-soft);
  margin-top: 3px;
  letter-spacing: 0.02em;
}
.pcv-node .pcv-rm {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 6;
  box-shadow: 0 2px 6px rgba(26, 24, 20, 0.16);
}
.pcv-node:hover .pcv-rm {
  display: flex;
}
.pcv-node .pcv-rm:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.pcv-port {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--accent);
  cursor: crosshair;
  z-index: 4;
  transition:
    transform 0.12s ease,
    background 0.12s ease;
}
.pcv-port.pin {
  left: -7px;
}
.pcv-port.pout {
  right: -7px;
}
.pcv-port:hover {
  transform: translateY(-50%) scale(1.35);
  background: var(--accent);
}
.pcv-node.wire-target .pcv-port.pin {
  background: var(--accent);
  transform: translateY(-50%) scale(1.35);
}

.pcv-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  background: var(--cream-deep);
}
.pcv-palette {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pcv-plabel {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.pcv-chip {
  font-family: var(--body);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 6px 13px;
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s,
    transform 0.12s;
}
.pcv-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}
.pcv-chip:active {
  transform: translateY(0);
}
.pcv-reset {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px 4px;
}
.pcv-reset:hover {
  color: var(--accent);
}
/* per-node live run: each node has its own run button + output line */
.pcv-noderun {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.pcv-noderun:hover {
  background: var(--accent-weak);
  border-color: var(--accent);
}
.pcv-noderun svg {
  width: 12px;
  height: 12px;
}
.pcv-noderun .ic-spin,
.pcv-noderun .ic-done {
  display: none;
}
.pcv-node.running .pcv-noderun {
  color: var(--accent);
  border-color: var(--accent);
}
.pcv-node.running .pcv-noderun .ic-play {
  display: none;
}
.pcv-node.running .pcv-noderun .ic-spin {
  display: block;
  animation: pcvspin 0.8s linear infinite;
}
.pcv-node.done .pcv-noderun {
  color: #1f8a5b;
  border-color: color-mix(in srgb, #1f8a5b 50%, var(--line));
  background: rgba(31, 138, 91, 0.1);
}
.pcv-node.done .pcv-noderun .ic-play {
  display: none;
}
.pcv-node.done .pcv-noderun .ic-done {
  display: block;
}
@keyframes pcvspin {
  to {
    transform: rotate(360deg);
  }
}
.pcv-nout {
  display: none;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  align-items: center;
  gap: 7px;
}
.pcv-node.running .pcv-nout,
.pcv-node.done .pcv-nout {
  display: flex;
}
.pcv-nk {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  flex: none;
}
.pcv-node.done .pcv-nk {
  color: #1f8a5b;
}
.pcv-nv {
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.3;
  color: var(--ink-soft);
}
.pcv-node.running .pcv-nv {
  color: var(--accent);
}
.pcv-node.running {
  border-color: var(--accent);
  box-shadow:
    0 0 0 3px var(--accent-weak),
    0 10px 24px rgba(26, 24, 20, 0.14);
}
.pcv-node.done {
  border-color: color-mix(in srgb, #1f8a5b 55%, var(--line));
}
.pcv-node.done .pcv-glyph {
  background: rgba(31, 138, 91, 0.15);
  color: #1f8a5b;
}
.pcv-node.running,
.pcv-node.done {
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}
.pcv-pulse {
  fill: var(--accent);
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent) 60%, transparent));
}
.pcv-reset:focus-visible,
.pcv-chip:focus-visible,
.pcv-node:focus-visible,
.pcv-port:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pcv-hint {
  padding: 11px 16px 14px;
  font-family: var(--display), serif;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
  border-top: 1px solid var(--line);
  text-wrap: pretty;
}
html[data-display='Bricolage Grotesque'] .pcv-hint {
  font-style: normal;
  font-weight: 500;
}

/* entrance */
@media (prefers-reduced-motion: no-preference) {
  .pcv-node {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  .pcv.ready .pcv-node {
    opacity: 1;
    transform: none;
    transition:
      opacity 0.5s ease,
      transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
}
@media (max-width: 560px) {
  .pcv-stage {
    height: clamp(320px, 60vh, 440px);
  }
  .pcv-node {
    min-width: 120px;
    padding: 9px 11px;
  }
  .pcv-reset {
    margin-left: 0;
  }
}

/* ============================================================
   Hero canvas variant — toggled by the "Hero canvas" tweak.
   Off (default): decorative .hero-net shows, board hidden.
   On: decorative net hides, a live compact board takes its place.
   ============================================================ */
.hero-board {
  display: none;
}
.hero-board .pcv {
  max-width: 820px;
  margin: clamp(20px, 4vh, 40px) auto 0;
  width: 100%;
}
.hero-board .pcv-stage {
  height: clamp(300px, 38vh, 360px);
  background-color: var(--paper);
}
html[data-herocanvas='on'] .hero-board {
  display: block;
  width: 100%;
  position: relative;
  z-index: 5;
}
html[data-herocanvas='on'] .hero-net {
  display: none;
}
/* The live board replaces the decorative net AND the compact snapshot, so the
   snapshot never stacks under the interactive board on narrow viewports (where
   both would otherwise be display:block). */
html[data-herocanvas='on'] .hero-canvas {
  display: none;
}
/* stack text over the live board, and let the hero grow past 100vh */
html[data-herocanvas='on'] .hero {
  flex-direction: column;
  justify-content: center;
  min-height: auto;
  height: auto;
  position: relative;
  top: auto;
  padding-top: clamp(96px, 12vh, 150px);
  padding-bottom: clamp(40px, 6vh, 72px);
}
html[data-herocanvas='on'] .hero .sub {
  margin-left: auto;
  margin-right: auto;
}
@media (max-width: 560px) {
  .hero-board .pcv-stage {
    height: clamp(300px, 52vh, 400px);
  }
}
/* Why-page "try it" board — a touch shorter than the full section-03 board */
#pcv-why {
  margin-top: 8px;
}
#pcv-why .pcv-stage {
  height: clamp(320px, 42vh, 420px);
}

/* touch: vertical swipes over the demo scroll the page; drags still move nodes */
@media (pointer: coarse) {
  .pcv-stage {
    touch-action: pan-y;
  }
}
