/* Firefly Collective — ornament: the seal, the orbit rings, the starfield,
 * constellation lines, the arched window, the wax seal and the fireflies.
 * Everything that moves here moves only transform and opacity, and only
 * when motion is allowed (.fcg-motion and no reduced-motion request). */

/* ---------- The seal (fcg_sigil() in models/util.php) ------------------ */
.fcg-sigil { position: relative; display: inline-grid; place-items: center; width: 48px; aspect-ratio: 1; flex: none; color: var(--fcg-copper); }
.fcg-sigil svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.fcg-sigil__rim circle, .fcg-sigil__rim path { fill: none; stroke: currentColor; stroke-width: 1.1; vector-effect: non-scaling-stroke; }
.fcg-sigil__rim circle:last-of-type { stroke-opacity: 0.55; }
.fcg-sigil__rim path { stroke-opacity: 0.7; }
.fcg-sigil__stars path { fill: currentColor; }
.fcg-sigil__letters { position: relative; font: italic 400 calc(var(--_s, 48px) * 0.36)/1 var(--fcg-font-display); letter-spacing: -0.04em; color: var(--fcg-vellum); }
.fcg-brand .fcg-sigil { --_s: 42px; }
.fcg-sigil--lg { --_s: clamp(128px, 22vw, 168px); width: var(--_s); }
.fcg-sigil--lg .fcg-sigil__rim circle, .fcg-sigil--lg .fcg-sigil__rim path { stroke-width: 1.4; }
.fcg-sigil--lg::before { /* the glow behind the seal */
    content: ""; position: absolute; inset: -30%; border-radius: 50%; z-index: -1;
    background: radial-gradient(circle, color-mix(in oklab, var(--fcg-copper) 30%, transparent) 0, transparent 62%);
}
.fcg-sigil--lg::after { /* the plate: blue-violet glass, so a light behind it glows through a little and blazes round the rim */
    content: ""; position: absolute; inset: 2.5%; border-radius: 50%; z-index: -1;
    --_glass: color-mix(in oklab, var(--fcg-hall) 62%, #6a58c8);
    background: radial-gradient(circle, color-mix(in oklab, var(--_glass) 72%, transparent) 0, color-mix(in oklab, var(--_glass) 80%, transparent) 64%, color-mix(in oklab, var(--_glass) 62%, transparent) 100%);
    box-shadow: 0 0 0 1px color-mix(in oklab, var(--fcg-copper) 35%, transparent), 0 0 40px 6px color-mix(in oklab, var(--fcg-copper) 28%, transparent);
}
.fcg-author .fcg-sigil { --_s: 72px; }
.fcg-signup__seal { --_s: 84px; width: 84px; }
@media (prefers-reduced-motion: no-preference) {
    .fcg-motion .fcg-sigil--lg svg { animation: fcg-turn 120s linear infinite; }
}
@keyframes fcg-turn { to { transform: rotate(360deg); } }

/* ---------- Orbits over the link tree's painting (fcg_orbits()) --------- */
.fcg-page .fcg-orbits { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; pointer-events: none; will-change: transform; } /* beats the page-wide svg { height: auto }; its own layer, so scrolling never repaints it */
.fcg-orbits path { fill: none; vector-effect: non-scaling-stroke; }
.fcg-orbit__line { stroke: color-mix(in oklab, var(--fcg-copper) 80%, #fff); stroke-width: 1.2; stroke-opacity: 0.7; }
.fcg-orbit__glow { stroke: var(--fcg-copper); stroke-width: 5; stroke-opacity: 0.1; }
.fcg-orbit--dotted .fcg-orbit__line { stroke-width: 2.2; stroke-dasharray: 0 7; stroke-linecap: round; stroke-opacity: 0.85; }
.fcg-orbit--dotted .fcg-orbit__glow, .fcg-orbit--dashed .fcg-orbit__glow { display: none; }
.fcg-orbit--faint .fcg-orbit__line { stroke-opacity: 0.4; }
.fcg-orbit--dashed .fcg-orbit__line { stroke-width: 1.2; stroke-dasharray: 12 7; stroke-opacity: 0.62; }
.fcg-orbits .fcg-orbit__moonring { stroke: color-mix(in oklab, var(--fcg-copper) 70%, #fff); stroke-width: 0.8; stroke-opacity: 0.45; }
.fcg-orbit__planet .fcg-orbit__moon { fill: #fff6dc; }
.fcg-orbit--dashed .fcg-orbit__planet circle { fill: #fff6dc; }
.fcg-orbit__planet circle { fill: color-mix(in oklab, var(--fcg-copper) 70%, #fff); }
.fcg-orbit__planet .fcg-orbit__halo { fill: var(--fcg-copper); opacity: 0.22; }

/* ---------- Starfield: a fixed pattern of tiny stars as one background - */
.fcg-stars, .fcg-sec--night, .fcg-sec--deep, .fcg-page-hero, .fcg-footer {
    background-image:
        radial-gradient(1px 1px at 12% 18%, rgba(251, 243, 220, 0.75) 50%, transparent 51%),
        radial-gradient(1px 1px at 72% 12%, rgba(251, 243, 220, 0.55) 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 38% 64%, rgba(251, 243, 220, 0.5) 50%, transparent 51%),
        radial-gradient(1px 1px at 86% 72%, rgba(251, 243, 220, 0.6) 50%, transparent 51%),
        radial-gradient(1px 1px at 55% 35%, rgba(251, 243, 220, 0.4) 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 22% 82%, rgba(240, 212, 138, 0.55) 50%, transparent 51%),
        radial-gradient(1px 1px at 93% 40%, rgba(251, 243, 220, 0.45) 50%, transparent 51%);
    background-size: 420px 380px;
}
.fcg-sec--night { background-color: var(--fcg-hall); }
.fcg-sec--deep { background-color: var(--fcg-hall-deep); }
.fcg-footer { background-color: var(--fcg-hall-deep); }

/* ---------- The arched window (the house shape) ------------------------ */
.fcg-arch { display: block; overflow: hidden; aspect-ratio: 4 / 5; border-radius: var(--fcg-arch); background: var(--fcg-hall-2); }
.fcg-arch img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- A rule with a star in the middle --------------------------- */
.fcg-rule { display: flex; align-items: center; gap: 1rem; color: var(--fcg-copper); }
.fcg-rule::before, .fcg-rule::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--fcg-hall-line)); }
.fcg-rule::after { transform: scaleX(-1); }

/* ---------- The wax seal at the foot of a broadside -------------------- */
.fcg-seal {
    position: absolute; right: clamp(16px, 4vw, 48px); bottom: calc(clamp(56px, 6vw, 72px) / -2);
    width: clamp(56px, 6vw, 72px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
    background: radial-gradient(circle at 35% 30%, color-mix(in oklab, var(--fcg-ember) 70%, #fff), var(--fcg-ember) 45%, color-mix(in oklab, var(--fcg-ember) 70%, #000));
    color: color-mix(in oklab, var(--fcg-ember) 30%, #fff);
    box-shadow: 0 6px 16px -6px rgba(60, 10, 0, 0.6), inset 0 0 0 4px color-mix(in oklab, var(--fcg-ember) 85%, #000);
    transform: rotate(-12deg);
}

/* ---------- Fireflies (_core_main.js paints them) ---------------------- *
 * Three layers per host, each a field of gradient dots; only the layers
 * move, slowly and out of step, and only while their section is on screen. */
[data-fcg-fireflies] { position: relative; }
.fcg-fireflies { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.fcg-fireflies i {
    position: absolute; inset: -40px; opacity: 0;
    background-repeat: no-repeat;
    animation-name: fcg-drift, fcg-blink; animation-timing-function: ease-in-out, ease-in-out;
    animation-iteration-count: infinite, infinite; animation-direction: alternate, alternate;
    animation-play-state: paused, paused;
    will-change: transform, opacity;
}
.is-lit > .fcg-fireflies i { animation-play-state: running, running; }
@keyframes fcg-drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(var(--dx, 20px), var(--dy, -30px), 0); } }
@keyframes fcg-blink { 0%, 100% { opacity: 0.15; } 45% { opacity: 0.95; } 70% { opacity: 0.5; } }
/* Content sits above the lights. */
[data-fcg-fireflies] > .fcg-wrap, [data-fcg-fireflies] > .fcg-profile__inner { position: relative; z-index: 2; }
