/* ═══════════════════════════════════════════════════════════════
   BEANGAME — build effects: cursors, wireframes, the design canvas,
   and the per-element reveal styles the swarm toggles.
   ═══════════════════════════════════════════════════════════════ */

/* ── Hidden until built (only when the build is on) ──────────── */
.will-build [data-b]:not(.b-done) { opacity: 0 !important; pointer-events: none; }
.will-build [data-b="deal"]:not(.b-dealt) > :not(.b-in),
.will-build [data-b="plot"]:not(.b-dealt) > .dot:not(.b-in) { opacity: 0; pointer-events: none; }

.b-in { animation: bIn 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.25) backwards; }
@keyframes bIn { from { opacity: 0; scale: 0.6; } }

.b-pop { animation: bPop 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.35) backwards; }
@keyframes bPop { from { opacity: 0; scale: 0.55; } }

/* typing: untyped text keeps its space but can't be seen */
.b-ghost { color: transparent !important; text-shadow: none !important; -webkit-text-fill-color: transparent; }

/* headline drawn as outlines first, then filled */
.b-outline, .b-outline * {
  color: transparent !important;
  -webkit-text-stroke: 1.3px var(--orange-bright);
  text-shadow: none !important;
}
.b-filled { animation: bFill 0.7s ease-out; }
@keyframes bFill {
  from { -webkit-text-stroke: 1.3px var(--orange-bright); color: transparent; text-shadow: none; }
  to   { -webkit-text-stroke: 0 transparent; }
}

/* image placeholder → dropped picture */
.b-ph { position: relative; background: #35343b !important; border-radius: 12px; }
.b-ph > *, .b-ph img { opacity: 0 !important; }
.b-ph::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23898891' stroke-width='1.5'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Ccircle cx='9' cy='10' r='2'/%3E%3Cpath d='m21 16-5-5-9 9'/%3E%3C/svg%3E") center / 42px no-repeat;
  opacity: 1 !important;
}
.b-dropped { animation: bDrop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3); }
@keyframes bDrop { from { scale: 0.93; filter: brightness(1.8); } }

/* card being dragged into place */
.b-drag {
  transition: none !important;
  outline: 1.5px dashed var(--wire);
  outline-offset: 6px;
  box-shadow: 14px 14px 0 -4px rgba(61, 155, 255, 0.14), var(--shadow-md) !important;
  z-index: 5;
}

/* background swept in behind a drag */
.b-sweep { animation: bSweep 0.42s cubic-bezier(0.6, 0, 0.3, 1); }
@keyframes bSweep { from { clip-path: inset(0 100% 0 0 round 10px); } to { clip-path: inset(0 0 0 0 round 10px); } }

/* ── The design canvas behind a section while it's being built ── */
.b-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: #2a292e;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 24px 24px;
  transition: opacity 1.1s ease;
}
.is-filling > .b-canvas { opacity: 0; }
main [data-build]:not(section) { position: relative; }
[data-build].is-building > :not(.b-canvas):not(.hero__bg) { position: relative; z-index: 1; }
main [data-build]:not(section) > .b-canvas { inset: -14px; border-radius: var(--radius-lg); }
main [data-build]:not(section) > .b-canvas .b-ruler { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.b-ruler {
  position: absolute;
  inset: 0 0 auto 0;
  height: 18px;
  background-color: #1f1e23;
  background-image:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.35) 0 1px, transparent 1px 100px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px 10px);
  background-size: 100% 18px, 100% 6px;
  background-position: 0 0, 0 100%;
  background-repeat: no-repeat;
  border-bottom: 1px solid rgba(61, 155, 255, 0.4);
}
.hero .b-ruler { top: 72px; }
.b-guide {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  background: #ff4d4d;
  box-shadow: 0 0 6px rgba(255, 77, 77, 0.6);
  transition: transform 0.35s ease;
}

/* ── Overlay layer: cursors + wires live in document coordinates ── */
.swarm {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  z-index: 120;
  pointer-events: none;
  overflow-x: clip;     /* name tags at the right edge must never widen the page */
}
.swarm.is-off { display: none; }

.cur {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  will-change: transform;
  transition: opacity 0.35s ease;
}
/* Dispersed: fades while drifting to the screen edge, fades back in when recalled. */
.cur.is-away { opacity: 0; transition-duration: 0.9s; }
.cur__i {
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  display: none;
  overflow: visible;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
  transition: scale 0.12s ease;
}
.cur__arrow { margin: -3px 0 0 -3px; }
.cur__arrow path { fill: var(--c); stroke: #fff; stroke-width: 1.3; stroke-linejoin: round; }
.cur__cross { margin: -11px 0 0 -11px; }
.cur__cross path, .cur__text path { stroke: #fff; stroke-width: 1.8; stroke-linecap: round; fill: none; }
.cur__cross { filter: drop-shadow(0 0 1.5px var(--c)) drop-shadow(0 0 1px var(--c)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.cur__text { margin: -3px 0 0 -11px; filter: drop-shadow(0 0 1.5px var(--c)) drop-shadow(0 0 1px var(--c)); }
.cur__grab { margin: -6px 0 0 -8px; }
.cur__grab path { fill: var(--c); stroke: #fff; stroke-width: 1.2; stroke-linejoin: round; }
.cur--arrow .cur__arrow, .cur--cross .cur__cross, .cur--text .cur__text, .cur--grab .cur__grab { display: block; }
.cur.is-click .cur__i { scale: 0.8; }
.cur__tag {
  position: absolute;
  top: 18px;
  left: 14px;
  padding: 2px 7px 3px;
  border-radius: 5px 5px 5px 2px;
  background: var(--c);
  color: var(--ct);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
}
.cur--text .cur__tag { top: 24px; }

.cur-ripple {
  position: absolute;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 2px solid var(--c);
  animation: ripple 0.5s ease-out forwards;
}
@keyframes ripple { from { scale: 0.2; opacity: 1; } to { scale: 1.3; opacity: 0; } }

.wire {
  position: absolute;
  z-index: 1;
  border: 1px solid var(--c, var(--wire));
  border-color: var(--wire);
  background: rgba(61, 155, 255, 0.05);
  transition: opacity 0.4s ease;
}
.wire.is-hover { border-color: var(--c); background: transparent; }
.wire.is-gone { opacity: 0; }
.wire__h {
  position: absolute;
  width: 7px;
  height: 7px;
  background: #fff;
  border: 1px solid var(--wire);
  opacity: 0;
}
.wire.is-set .wire__h { opacity: 1; }
.wire.is-hover .wire__h { border-color: var(--c); }
.wire__h--tl { left: -4px; top: -4px; }
.wire__h--tr { right: -4px; top: -4px; }
.wire__h--bl { left: -4px; bottom: -4px; }
.wire__h--br { right: -4px; bottom: -4px; }
.wire__badge {
  position: absolute;
  left: 50%;
  bottom: -22px;
  translate: -50% 0;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--wire);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.wire.is-hover .wire__badge { background: var(--c); color: var(--ink-900); }
.wire:not(.is-set) .wire__badge { left: auto; right: -4px; bottom: -22px; translate: 100% 0; }

.b-carry {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 76px;
  height: 52px;
  border-radius: 6px;
  border: 2px solid #fff;
  background: #3a3940 center / cover no-repeat;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
  opacity: 0.92;
  rotate: -4deg;
}
.b-carry.is-drop { transition: opacity 0.25s ease, scale 0.25s ease; opacity: 0; scale: 1.6; }

.spawn {
  position: absolute;
  z-index: 2;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 12px;
  background: #1d1a17 url("../images/beangame-logo.png") center / 78% no-repeat;
  box-shadow: 0 0 0 1px rgba(255, 236, 214, 0.18), 0 0 40px rgba(242, 101, 34, 0.45);
  animation: spawnIn 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.4);
  transition: opacity 0.35s ease, scale 0.35s ease;
}
.spawn.is-gone { opacity: 0; scale: 0.4; }
@keyframes spawnIn { from { scale: 0; opacity: 0; } }

/* Hero: the background art waits under the canvas until the fill pass. */
.will-build .hero:not(.is-built):not(.is-filling) .hero__bg { opacity: 0; }
.hero__bg { transition: opacity 1.2s ease; }

/* While the build is off or done, none of this should leak. */
.no-build .swarm, .no-build .buildbar { display: none; }
