/* ==========================================================================
   n3-buttons.css — "Request a demo" · Pixel charge (Arcaneflow, Nocturne)

     <a class="bd [bd--forge]" href="…"><span class="bd-label">Request a demo</span>
       <span class="bd-icon" aria-hidden="true">↗</span> <span class="bd-fx" aria-hidden="true"></span></a>

   Dark glass with a stepped pixel outline in the mana gradient; the arrow sits in a small pink cube.
   Hover / keyboard focus: a pixel charge fills it left → right (pink → violet → blue, drawn by
   n3-buttons.js on a <canvas class="bd-cv"> it adds inside .bd-fx) and the cube hops when the charge
   reaches it. The accessible name is the text of .bd-label; everything else is aria-hidden.
   .bd--forge = the ManaForge context: same button, warmer (hot outline, ember charge, hot cube, embers).

   n3-buttons.js adds:  .bd-js (wired) · .is-hot (mouse / pen hover, or while a touch press lasts)
                        .bd-vis (near the viewport: the forge embers only run then)
   Motion only runs when the page is not paused (html.af-paused, set by af-core.js) and
   prefers-reduced-motion is not set; otherwise every state is shown at once, as a finished static pose.
   ========================================================================== */

.bd {
  --bd-u: 3px;                                   /* pixel step of the stepped corners */
  --bd-sw: 2px;                                  /* outline width */
  --bd-step: polygon(0 calc(var(--bd-u) * 2), var(--bd-u) calc(var(--bd-u) * 2), var(--bd-u) var(--bd-u), calc(var(--bd-u) * 2) var(--bd-u), calc(var(--bd-u) * 2) 0, calc(100% - var(--bd-u) * 2) 0, calc(100% - var(--bd-u) * 2) var(--bd-u), calc(100% - var(--bd-u)) var(--bd-u), calc(100% - var(--bd-u)) calc(var(--bd-u) * 2), 100% calc(var(--bd-u) * 2), 100% calc(100% - var(--bd-u) * 2), calc(100% - var(--bd-u)) calc(100% - var(--bd-u) * 2), calc(100% - var(--bd-u)) calc(100% - var(--bd-u)), calc(100% - var(--bd-u) * 2) calc(100% - var(--bd-u)), calc(100% - var(--bd-u) * 2) 100%, calc(var(--bd-u) * 2) 100%, calc(var(--bd-u) * 2) calc(100% - var(--bd-u)), var(--bd-u) calc(100% - var(--bd-u)), var(--bd-u) calc(100% - var(--bd-u) * 2), 0 calc(100% - var(--bd-u) * 2));
  /* the ↗ glyph, drawn (↗ is not in the Latin font subsets): a 7 × 7 pixel arrow */
  --bd-arrow-px: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7' shape-rendering='crispEdges'%3E%3Cpath d='M2 0h5v2h-5zM4 2h3v1h-3zM3 3h4v1h-4zM2 4h2v1h-2zM5 4h2v1h-2zM1 5h2v1h-2zM0 6h2v1h-2z'/%3E%3C/svg%3E");
  --bd-line: linear-gradient(90deg, #FF73C3 0%, #C38CFF 50%, #7FA0FF 100%);
  --bd-face-a: #1C1839; --bd-face-b: #110F27;
  --bd-cube-top: #FFD0EA; --bd-cube: #FF4FA3; --bd-cube-side: #9E1E68; --bd-cube-ink: #FFFFFF;
  --bd-glow: linear-gradient(90deg, #FF2FBF, #9B48E0 50%, #2F5BFF);
  position: relative; isolation: isolate; z-index: 0;
  display: inline-flex; align-items: center; justify-content: space-between; flex: none; gap: 20px;
  height: 56px; max-width: 100%; padding: 0 14px 0 24px;
  font: 600 16px/1 "Albert Sans", "Geist", system-ui, sans-serif; letter-spacing: -.012em; color: #F7F5FF;
  white-space: nowrap; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform .25s cubic-bezier(.2, .7, .2, 1);
}
.bd-label { position: relative; display: block; }

/* the ManaForge row: the ghost button beside it takes the same height, whatever the row's align-items
   (the page centres that row); on small phones both go full width, like nl-site.css does for .btn */
.bd--forge + .btn { align-self: stretch; }
@media (max-width: 420px) { .bd--forge { flex: 1 1 100%; } }

/* paused / reduced motion: every state change is instant */
.af-paused .bd, .af-paused .bd::before, .af-paused .bd::after,
.af-paused .bd *, .af-paused .bd *::before, .af-paused .bd *::after { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .bd, .bd::before, .bd::after, .bd *, .bd *::before, .bd *::after { transition: none !important; }
}

/* the glow it throws on the night when hot */
.bd::before {
  content: ""; position: absolute; z-index: -2; inset: 10px 10px -2px; pointer-events: none;
  background: var(--bd-glow); filter: blur(16px); opacity: 0; transition: opacity .4s;
}
/* outline (the element's own background, clipped to the stepped shape) + glass face */
.bd-fx {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--bd-line); clip-path: var(--bd-step);
}
.bd-fx::before {
  content: ""; position: absolute; inset: var(--bd-sw); clip-path: var(--bd-step);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .075), rgba(255, 255, 255, 0) 48%),
    linear-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px) 0 3px / 4px 4px,
    linear-gradient(90deg, rgba(255, 255, 255, .03) 1px, transparent 1px) 3px 0 / 4px 4px,
    linear-gradient(180deg, var(--bd-face-a), var(--bd-face-b));
}
/* the pixel charge (n3-buttons.js), on the face's 4 px grid */
.bd-cv {
  display: block; position: absolute; left: var(--bd-sw); top: var(--bd-sw);
  width: calc(100% - var(--bd-sw) * 2); height: calc(100% - var(--bd-sw) * 2); clip-path: var(--bd-step);
}
/* the cube: front face + (top & side faces in one clipped layer, split along the diagonal) */
.bd-icon {
  position: relative; display: block; flex: none; font-size: 0; line-height: 0; color: transparent;
  width: 28px; height: 28px; margin: 5px 5px 0 0; background: var(--bd-cube);
  box-shadow: inset 0 -2px 0 rgba(60, 0, 40, .16);
}
.bd-icon::before {
  content: ""; position: absolute; left: 7px; top: 7px; width: 14px; height: 14px; background: var(--bd-cube-ink);
  -webkit-mask: var(--bd-arrow-px) 0 0 / 100% 100% no-repeat; mask: var(--bd-arrow-px) 0 0 / 100% 100% no-repeat;
}
.bd-icon::after {
  content: ""; position: absolute; inset: -5px -5px 0 0;
  clip-path: polygon(0 5px, 5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, calc(100% - 5px) 5px);
  background: linear-gradient(135deg, var(--bd-cube-top) 50%, var(--bd-cube-side) 50%);
}
/* hot (hover / keyboard focus / touch press) */
.bd:is(.is-hot, :focus-visible)::before { opacity: .5; }
.bd:is(.is-hot, :focus-visible) .bd-label { text-shadow: 0 1px 2px rgba(10, 4, 30, .55); }
.bd:is(.is-hot, :focus-visible) .bd-icon { --bd-cube: #FF6CB4; --bd-cube-top: #FFF0F8; }
.bd:active { transform: translateY(1px); }
.bd:active .bd-icon { transform: translateY(1px); }
@media (prefers-reduced-motion: no-preference) {
  html:not(.af-paused) .bd:is(.is-hot, :focus-visible) .bd-icon { animation: bd-hop .6s cubic-bezier(.3, .6, .35, 1) .3s both; }
}
@keyframes bd-hop {
  0% { transform: translateY(0); }
  32% { transform: translateY(-8px); }
  56% { transform: translateY(0); }
  68% { transform: translateY(-2px); }
  80%, 100% { transform: translateY(0); }
}

/* ==========================================================================
   .bd--forge — hot outline, ember charge (palette in JS), a hot cube, and three groups of pixel
   embers drifting up off the top edge (CSS only; they run while the button is on screen and motion is on)
   ========================================================================== */
.bd--forge {
  --bd-line: linear-gradient(90deg, #FFB06B 0%, #FF5A6E 40%, #FF2F8E 70%, #C08BF0 100%);
  --bd-face-a: #22132A; --bd-face-b: #150C1C;
  --bd-cube-top: #FFD9B0; --bd-cube: #FF5A6E; --bd-cube-side: #A8135E;
  --bd-glow: linear-gradient(90deg, #FFB06B, #FF2F8E 60%, #C08BF0);
}
.bd--forge:is(.is-hot, :focus-visible) .bd-icon { --bd-cube: #FF7A6A; --bd-cube-top: #FFF1DD; }
.bd--forge::after,
.bd--forge .bd-label::before,
.bd--forge .bd-label::after {
  content: ""; position: absolute; z-index: 2; top: 0; width: 3px; height: 3px; opacity: 0; pointer-events: none;
}
.bd--forge::after { left: 14%; background: #FFB06B; box-shadow: 26px 5px 0 #FF5A6E, 51px 1px 0 #FFD08F; }
.bd--forge .bd-label::before { left: 46%; top: -20px; background: #FF2F8E; box-shadow: -17px 4px 0 #FFB06B, 22px 2px 0 #FF7A5A; }
.bd--forge .bd-label::after { left: 88%; top: -20px; background: #FF8A6A; box-shadow: 15px 6px 0 #C08BF0, 34px 0 0 #FF2F8E; }
@media (prefers-reduced-motion: no-preference) {
  html:not(.af-paused) .bd--forge.bd-vis::after { animation: bd-ember 2.6s cubic-bezier(.2, .5, .4, 1) .3s infinite; }
  html:not(.af-paused) .bd--forge.bd-vis .bd-label::before { animation: bd-ember 3.1s cubic-bezier(.2, .5, .4, 1) 1.4s infinite; }
  html:not(.af-paused) .bd--forge.bd-vis .bd-label::after { animation: bd-ember 2.2s cubic-bezier(.2, .5, .4, 1) 2.2s infinite; }
  html:not(.af-paused) .bd--forge.bd-vis:is(.is-hot, :focus-visible)::after { animation-duration: 1.5s; }
  html:not(.af-paused) .bd--forge.bd-vis:is(.is-hot, :focus-visible) .bd-label::before { animation-duration: 1.8s; }
  html:not(.af-paused) .bd--forge.bd-vis:is(.is-hot, :focus-visible) .bd-label::after { animation-duration: 1.3s; }
}
@keyframes bd-ember {
  0% { opacity: 0; transform: translate(0, 2px); }
  12% { opacity: 1; }
  70% { opacity: .8; }
  100% { opacity: 0; transform: translate(5px, -30px); }
}
