/* Living backgrounds (see js/site-fx.js) */
html { --fx-ink: rgba(22, 24, 26, 0.16); }
html.ch-theme-dark { --fx-ink: rgba(255, 244, 238, 0.14); }

/* warmer canvas than flat grey or black */
html { --sv-bg: #F5F0EC; --chx-bg: #FFF8F4; }
html.ch-theme-dark { --sv-bg: #100C0A; --sv-surface: #1C1613; --chx-bg: #100C0A; }

.fx-layer { position: absolute; top: 0; bottom: 0; left: 50%; z-index: -1; width: 100vw; transform: translateX(-50%); overflow: hidden; pointer-events: none; }

.fx-dots { position: absolute; inset: 0; background-image: radial-gradient(var(--fx-ink) 1.4px, transparent 1.8px); background-size: 26px 26px; -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent); }
.fx-dots-lit { background-image: radial-gradient(#F05526 2.2px, transparent 2.8px); -webkit-mask-image: radial-gradient(190px circle at var(--fx-x, -999px) var(--fx-y, -999px), #000, transparent 75%); mask-image: radial-gradient(190px circle at var(--fx-x, -999px) var(--fx-y, -999px), #000, transparent 75%); }

.fx-threads { position: absolute; inset: 0; width: 100%; height: 100%; -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.25), #000 55%); mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.25), #000 55%); }
.fx-threads path { fill: none; stroke: #F05526; }

.fx-doodle { position: absolute; width: clamp(34px, 4vw, 58px); }
.fx-doodle svg { display: block; width: 100%; height: auto; overflow: visible; animation: fx-float 7s ease-in-out var(--delay, 0s) infinite; }
.fx-doodle path { fill: none; stroke: #F05526; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.6s ease 0.2s; }
.fx-layer.is-in .fx-doodle path { stroke-dashoffset: 0; }
@keyframes fx-float { 50% { transform: translateY(-14px) rotate(9deg); } }

/* ---------- deck card drawings ---------- */
.svx-art { position: absolute; left: clamp(26px, 4vw, 48px); bottom: 26px; width: 230px; height: 150px; pointer-events: none; }
.svx-card { position: relative; }
.svx-deck.is-stacking .svx-card { position: sticky; }
.svx-art * { fill: none; stroke: rgba(255, 255, 255, 0.55); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.svx-art .o { stroke: #F05526; }
.svx-art .f { fill: #F05526; stroke: none; }
.svx-art .draw { stroke-dasharray: 1; animation: fx-draw 4s ease-in-out infinite; }
.svx-art .flow { stroke-dasharray: 5 9; animation: fx-flow 1.4s linear infinite; }
.svx-art .pulse { transform-box: fill-box; transform-origin: center; animation: fx-pulse 2.2s ease-in-out infinite; }
.svx-art .late { animation-delay: -0.7s; }
.svx-art .later { animation-delay: -1.4s; }
.svx-art .bob { animation: fx-bob 2.6s ease-in-out infinite; }
.svx-art .spin { transform-box: fill-box; transform-origin: center; animation: fx-spin 9s linear infinite; }
@keyframes fx-draw { 0% { stroke-dashoffset: 1; } 45%, 80% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -1; } }
@keyframes fx-flow { to { stroke-dashoffset: -28; } }
@keyframes fx-pulse { 50% { transform: scale(1.6); opacity: 0.55; } }
@keyframes fx-bob { 50% { transform: translateY(-9px); } }
@keyframes fx-spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
    .svx-art { left: auto; right: 16px; top: 18px; bottom: auto; width: 110px; height: 72px; opacity: 0.8; }
    .fx-doodle { opacity: 0.55; width: 30px; }
}
@media (prefers-reduced-motion: reduce) {
    .fx-doodle svg, .svx-art * { animation: none !important; }
    .fx-doodle path { transition: none; }
}

/* outrank the page rule that sizes every svg as a 22px icon */
html .fx-layer svg.fx-threads { width: 100%; height: 100%; }
html .svx-card svg.svx-art { width: 230px; height: 150px; }
@media (max-width: 900px) { html .svx-card svg.svx-art { width: 110px; height: 72px; } }

/* ---------- live effects (see js/fx-live.js) ---------- */
html .fx-rays { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
html .fx-layer .fx-rays { z-index: -1; -webkit-mask-image: linear-gradient(#000 72%, transparent); mask-image: linear-gradient(#000 72%, transparent); }
html .ab-hero-v2 > .fx-rays { z-index: 1; }

.svx-card::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(240, 85, 38, 0.22), transparent 65%); opacity: 0; transition: opacity 0.35s; pointer-events: none; }
.svx-card:hover::after { opacity: 1; }

.svx-statement .fx-word { opacity: 0.16; transition: opacity 0.35s; }
.svx-statement .fx-word.is-lit { opacity: 1; }

.fx-spark { position: fixed; z-index: 2147482000; width: 0; height: 0; pointer-events: none; }
.fx-spark i { position: absolute; left: -1px; top: -6px; width: 2.5px; height: 12px; border-radius: 2px; background: #F05526; transform-origin: 50% 6px; animation: fx-burst 0.45s ease-out forwards; }
@keyframes fx-burst { from { transform: rotate(var(--a)) translateY(-8px); } to { transform: rotate(var(--a)) translateY(-26px) scaleY(0.1); opacity: 0; } }
