/**
 * 2suite family backdrop (2026-11-23): faint circuit traces, node-and-edge links,
 * a fine dot grid, soft scan lines and a radial glow behind the hero.
 *
 * Markup: <div class="suite-bd" aria-hidden="true"></div> as the first child of <body>.
 * The element is absolutely positioned behind all content (z-index -1), so it never
 * takes space: no layout change and no CLS, even when this file arrives late (it is
 * loaded non-blocking).
 *
 * Tint: --bd-ink. The landing page uses brand blue; every /apps/<name>/ page passes its
 * registry gradient on <body> as --g1 / --g2, so the same pattern takes the app's accent.
 * The pattern is a mask over a flat --bd-ink fill, which is why one SVG serves every tint.
 *
 * Strength: --bd-op (pattern) and --bd-glow (hero glow + scan lines) per theme. The layout
 * gate (scripts/check-layout.mjs) reads both and checks text contrast at their worst case.
 * Density: the pattern mask fades to 30% under the center column where text sits; cards
 * (opaque) cover it entirely.
 */

body { position: relative; }

.suite-bd {
    --bd-ink: var(--g1, #60A5FA);
    --bd-op: 0.16;
    --bd-glow: 0.5;
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

[data-theme="light"] .suite-bd {
    --bd-ink: var(--g2, #2563EB);
    --bd-op: 0.1;
    /* Light glow stays low: the hero accent #3B82F6 is 3.68:1 on #F8FAFC before any backdrop. */
    --bd-glow: 0.1;
}

/* Pattern: circuit/network tile (240px) + dot grid (24px), both as masks over the ink, intersected
   with a density fade: full strength at the page edges, 30% under the center column where text sits. */
.suite-bd::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--bd-ink);
    opacity: var(--bd-op);
    -webkit-mask-image:
        linear-gradient(90deg, #000 0%, rgba(0, 0, 0, 0.3) 30%, rgba(0, 0, 0, 0.3) 70%, #000 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' fill='none' stroke='%23000'%3E%3Cpath stroke-width='1.25' d='M0 36h56l20 20h52M240 36h-40l-16 16v40M36 240v-56l18-18v-44M96 240v-40l24-24h60l20-20h40M0 156h20l16 16M150 0v24M210 240v-30l-20-20M0 96h12l14 14v30M240 96h-12M96 0v14l-12 12v14'/%3E%3Cpath stroke-width='.75' stroke-opacity='.5' stroke-dasharray='2 4' d='M128 56L184 92M184 92L190 190M54 122L128 56M54 122L120 176'/%3E%3Cg fill='%23000' stroke='none'%3E%3Ccircle cx='128' cy='56' r='3'/%3E%3Ccircle cx='184' cy='92' r='2.2'/%3E%3Ccircle cx='54' cy='122' r='2.2'/%3E%3Ccircle cx='36' cy='172' r='3'/%3E%3Ccircle cx='150' cy='24' r='2.2'/%3E%3Ccircle cx='190' cy='190' r='2.2'/%3E%3Ccircle cx='26' cy='140' r='3'/%3E%3Ccircle cx='84' cy='40' r='2.2'/%3E%3C/g%3E%3Cg stroke-width='1' stroke-opacity='.6'%3E%3Ccircle cx='128' cy='56' r='6'/%3E%3Ccircle cx='190' cy='190' r='6'/%3E%3C/g%3E%3C/svg%3E"),
        radial-gradient(circle at 1px 1px, rgba(0, 0, 0, 0.55) 1px, transparent 1.6px);
    mask-image:
        linear-gradient(90deg, #000 0%, rgba(0, 0, 0, 0.3) 30%, rgba(0, 0, 0, 0.3) 70%, #000 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' fill='none' stroke='%23000'%3E%3Cpath stroke-width='1.25' d='M0 36h56l20 20h52M240 36h-40l-16 16v40M36 240v-56l18-18v-44M96 240v-40l24-24h60l20-20h40M0 156h20l16 16M150 0v24M210 240v-30l-20-20M0 96h12l14 14v30M240 96h-12M96 0v14l-12 12v14'/%3E%3Cpath stroke-width='.75' stroke-opacity='.5' stroke-dasharray='2 4' d='M128 56L184 92M184 92L190 190M54 122L128 56M54 122L120 176'/%3E%3Cg fill='%23000' stroke='none'%3E%3Ccircle cx='128' cy='56' r='3'/%3E%3Ccircle cx='184' cy='92' r='2.2'/%3E%3Ccircle cx='54' cy='122' r='2.2'/%3E%3Ccircle cx='36' cy='172' r='3'/%3E%3Ccircle cx='150' cy='24' r='2.2'/%3E%3Ccircle cx='190' cy='190' r='2.2'/%3E%3Ccircle cx='26' cy='140' r='3'/%3E%3Ccircle cx='84' cy='40' r='2.2'/%3E%3C/g%3E%3Cg stroke-width='1' stroke-opacity='.6'%3E%3Ccircle cx='128' cy='56' r='6'/%3E%3Ccircle cx='190' cy='190' r='6'/%3E%3C/g%3E%3C/svg%3E"),
        radial-gradient(circle at 1px 1px, rgba(0, 0, 0, 0.55) 1px, transparent 1.6px);
    -webkit-mask-size: 100% 100%, 240px 240px, 24px 24px;
    mask-size: 100% 100%, 240px 240px, 24px 24px;
    -webkit-mask-repeat: no-repeat, repeat, repeat;
    mask-repeat: no-repeat, repeat, repeat;
    /* (circuit + dots) intersected with the density fade */
    -webkit-mask-composite: source-in, source-over;
    mask-composite: intersect, add;
}

/* Hero glow + scan lines: top of the page only, fading out by 760px. */
.suite-bd::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 760px;
    background:
        radial-gradient(50% 60% at 50% 18%, color-mix(in srgb, var(--bd-ink) 45%, transparent), transparent 100%),
        repeating-linear-gradient(0deg, color-mix(in srgb, var(--bd-ink) 10%, transparent) 0 1px, transparent 1px 4px);
    opacity: var(--bd-glow);
    -webkit-mask-image: linear-gradient(180deg, #000 45%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 45%, transparent 100%);
    animation: suite-bd-breathe 16s ease-in-out infinite;
}

/* The only motion: a slow opacity breath on the glow (compositor-only, no repaint). */
@keyframes suite-bd-breathe {
    0%, 100% { opacity: var(--bd-glow); }
    50% { opacity: calc(var(--bd-glow) * 0.65); }
}

/* Phones: text spans the whole width, so the pattern steps down everywhere. */
@media (max-width: 767px) {
    .suite-bd { --bd-op: 0.11; }
    [data-theme="light"] .suite-bd { --bd-op: 0.07; }
    .suite-bd::after { height: 560px; }
}

@media (prefers-reduced-motion: reduce) {
    .suite-bd::after { animation: none; }
}

@media print {
    .suite-bd { display: none !important; }
}
