/* site/shared/site.css */

/* ── Theme tokens — SINGLE source of light/dark, flipped by the `html.dark`
   class (see shared/theme.js). Neutrals are expressed as rgba(var(--fg), X):
   in dark --fg is white so every legacy color is byte-for-byte unchanged; in
   light --fg is near-black so the same opacity becomes its exact inverse.
   Accent hexes (#487CDE, #9B61C9, …) are theme-agnostic and stay literal, as
   does white button text (color:#fff). ──────────────────────────────────── */
html {
  --fg: 255, 255, 255;            /* neutral foreground triple */
  --bg: #0a0a0d;                  /* page background */
  --canvas: #0d0d11;
  --canvas2: #101015;
  --text: #f4f4f6;
  --muted: rgba(255,255,255,0.60);
  --faint: rgba(255,255,255,0.40);
  --panel: rgba(255,255,255,0.030);
  --panel2: rgba(255,255,255,0.055);
  --border: rgba(255,255,255,0.10);
  --border2: rgba(255,255,255,0.16);
  --header: rgba(25,25,28,0.85);
  --dot: rgba(255,255,255,0.07);
  /* Canvas-demo "app window" surfaces (index hero demo) — themed device frame */
  --m-frame: #19191C;
  --m-canvas: #141417;
  --m-panel: #1c1c20;
  --m-chip: rgba(38,38,42,0.97);
  --m-chip2: rgba(28,28,32,0.97);
  --m-tip: rgba(25,25,28,0.92);
  --m-tip-fg: rgba(255,255,255,0.80);
  color-scheme: dark;
}
html:not(.dark) {
  --fg: 20, 20, 26;
  --bg: #edece8;
  --canvas: #f4f3ef;
  --canvas2: #fbfaf7;
  --text: #16161a;
  --muted: rgba(20,20,26,0.66);
  --faint: rgba(20,20,26,0.46);
  --panel: rgba(20,20,26,0.025);
  --panel2: rgba(20,20,26,0.05);
  --border: rgba(20,20,26,0.11);
  --border2: rgba(20,20,26,0.18);
  --header: rgba(244,243,239,0.85);
  --dot: rgba(20,20,26,0.07);
  --m-frame: #ffffff;
  --m-canvas: #efede8;
  --m-panel: #f7f6f3;
  --m-chip: rgba(252,251,248,0.98);
  --m-chip2: rgba(245,244,240,0.98);
  --m-tip: rgba(250,249,246,0.96);
  --m-tip-fg: rgba(20,20,26,0.82);
  color-scheme: light;
}
html, body {
  background-color: var(--bg);
  transition: background-color .3s ease, color .3s ease;
}

/* The header is single-sourced in shared/header.js (injected on every site +
   /docs page, styles included). Don't redefine .wf-header here. */

/* ── Dark canvas base ────────────────────────────────────── */
.wf-canvas-bg {
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: 0px 0px;
}

/* Radial vignette — darker edges, lighter center.
   REQUIRES: host element must have position: relative (or non-static)
   so the absolute pseudo-element is contained within it. */
.wf-vignette::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(10,10,12,0.55) 100%);
  pointer-events: none;
  z-index: 0;
}

/* ── Node pill component ─────────────────────────────────── */
.wf-node-pill {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border-radius: 10px;
  border: 1.5px solid var(--node-color-mid, #487CDE99);
  background: var(--node-color-bg, #487CDE1a);
  cursor: pointer;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.wf-node-pill:hover {
  box-shadow: 0 0 28px var(--node-color-glow, #487CDE44);
  transform: scale(1.02);
}
.wf-node-pill:active {
  transform: scale(0.99);
}
.wf-node-pill__badge {
  background: var(--node-color-solid, #487CDE);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 7px 12px;
  border-radius: 8px;
  margin: 2px;
}
.wf-node-pill__label {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 0 12px 0 8px;
}
.wf-node-pill__port {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--node-color-solid, #487CDE);
  border: 2px solid #19191C;
  margin-right: 4px;
  flex-shrink: 0;
}

/* Action node color vars (used on buy button) */
.wf-node-action {
  --node-color-solid: #487CDE;
  --node-color-mid:   #487CDE99;
  --node-color-bg:    #487CDE1a;
  --node-color-glow:  #487CDE44;
}

/* ── Scroll reveal ───────────────────────────────────────── */
.wf-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.wf-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Node glow pulse (JS-triggered) ─────────────────────── */
@keyframes wf-glow-pulse {
  0%   { box-shadow: 0 0 0 0 var(--node-color-glow, #487CDE44); }
  40%  { box-shadow: 0 0 0 8px var(--node-color-glow, #487CDE44), 0 0 32px var(--node-color-glow, #487CDE33); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.wf-glow-pulse {
  animation: wf-glow-pulse 0.55s ease forwards;
}

/* ── Animated gradient background (CTA section) ─────────── */
@keyframes wf-gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.wf-gradient-animate {
  background: linear-gradient(135deg, #FF3CAC22, #9B61C922, #487CDE22, #13994822, #FF3CAC22);
  background-size: 400% 400%;
  animation: wf-gradient-shift 8s ease infinite;
}

/* ── Ambient node float animations ──────────────────────── */
@keyframes wf-float-a {
  0%, 100% { transform: translate(0, 0); }
  33%       { transform: translate(14px, -18px); }
  66%       { transform: translate(-10px, 10px); }
}
@keyframes wf-float-b {
  0%, 100% { transform: translate(0, 0); }
  33%       { transform: translate(-16px, 14px); }
  66%       { transform: translate(12px, -16px); }
}
@keyframes wf-float-c {
  0%, 100% { transform: translate(0, 0); }
  50%       { transform: translate(12px, -18px); }
}
@keyframes wf-float-d {
  0%, 100% { transform: translate(0, 0); }
  50%       { transform: translate(-14px, 18px); }
}
@keyframes wf-float-e {
  0%, 100% { transform: translate(0, 0); }
  40%       { transform: translate(16px, 12px); }
  80%       { transform: translate(-10px, -16px); }
}

/* Pair with wf-float-* animations to guarantee GPU layer promotion */
.wf-float {
  will-change: transform;
}

/* ── Accessibility: reduced motion ──────────────────────── */
@media (prefers-reduced-motion: reduce) {
  [class*="wf-float"],
  .wf-gradient-animate,
  .wf-glow-pulse {
    animation: none;
  }
  .wf-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
