/* ============================================================================
   ffv-desktop.css — the neutral FFV DESKTOP + generic scene compositing
   (directing-desktop-scenes S3, spec Issue 14 + Issues 12/15)

   The canvas the managed windows float over: a quiet night field carrying the
   Fergi vessel's neural design language at WHISPER volume — the constellation
   is present but never competes with a window. Motion is far calmer than the
   vessel (one 90s drift, stilled under prefers-reduced-motion). Nothing here
   is interactive; clicking the desktop never closes a window (ruling R11).

   Desktop-only by construction: #view-ffv-desktop is only ever activated by
   SceneManager's desktop CP-launch path — mobile never navigates here.
   ============================================================================ */

/* The desktop is PINNED to the canvas, not laid out in it.

   It used to bleed over .main-content's padding with `margin: -32px` and take
   a viewport-derived `height: calc(100vh - --nav-height)`. Those numbers are
   right — but only at scrollTop 0. It was still a normal-flow block, so the
   moment any room made the App Panel taller than the viewport (Browse Media's
   170 tiles will do it), the page scrolled and the backdrop slid up with it,
   leaving bare grey along the bottom edge exactly `scrollY` tall. Measured on
   production 2026-07-31: desktop bottom 337 against a 397 viewport, scrollY
   60. Joe: "the black background does appear but it does not cover the whole
   canvas at the bottom."

   Fixed positioning removes the dependency on scroll entirely rather than
   correcting the arithmetic for one case — the canvas cannot be moved by
   something that scrolls above it. It also now tracks the Control Panel
   collapse and pane-maximize for free, since both already drive the two
   custom properties this is anchored to. Nothing here is interactive, so
   taking it out of flow costs the layout nothing (ruling R11). */
#view-ffv-desktop.active {
    position: fixed;
    top: var(--nav-height, 60px);
    left: var(--side-nav-width, 60px);
    right: 0;
    bottom: 0;
    margin: 0;
    overflow: hidden;
}

.ffv-desktop {
    position: relative;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(120% 90% at 18% 8%, rgba(226, 67, 159, 0.055), transparent 52%),
        radial-gradient(130% 100% at 88% 94%, rgba(56, 170, 232, 0.06), transparent 55%),
        linear-gradient(158deg, #0d0b1c 0%, #120e26 44%, #171130 78%, #131026 100%);
}

/* ── the constellation — SPEAKING volume (obeying-portrait-instructions S4/D4.2)
   Joe: "make the neural stylized background more salient and the neural patterns
   denser. Use good taste but users should be aware of the background in a good way."

   It was authored at whisper volume and the whisper was inaudible: the spine's
   EFFECTIVE opacity was 0.5 × 0.13 = 0.065 and its nodes 0.5 × 0.22 = 0.11 — a
   field you could infer but not see. The lift is roughly 3× on the spine, and the
   NEW density comes from a second, finer scale (capillaries + dendrites +
   synapses in the markup) rather than from thickening what was already there.
   That distinction is the whole taste argument: two scales read as a real neural
   field; one heavy layer reads as busy.

   The hierarchy is deliberate and must survive future edits — spine > capillary >
   dendrite, nodes > synapses. Flatten it and the field becomes wallpaper. */
.ffv-desktop-net {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.62;
}

/* The spine's stroke now lives HERE rather than as presentation attributes on the
   shape — see the <defs> note in index.html: the geometry is shared with the pulse
   overlay via <use>, and an attribute on the shape would outrank both layers' CSS. */
.ffv-desktop-traces {
    fill: none;
    stroke: url(#ffvDeskTrace);
    stroke-width: 1.1;
    stroke-linecap: round;
    opacity: 0.34;
    filter: drop-shadow(0 0 6px rgba(157, 95, 224, 0.28));
}

/* the finer scale: present, clearly subordinate to the spine */
.ffv-desktop-capillaries { opacity: 0.19; }
.ffv-desktop-dendrites   { opacity: 0.16; }

.ffv-desktop-nodes {
    opacity: 0.5;
    filter: drop-shadow(0 0 5px rgba(157, 95, 224, 0.65));
}

.ffv-desktop-synapses {
    opacity: 0.3;
    filter: drop-shadow(0 0 4px rgba(95, 216, 240, 0.5));
}

/* A slow current along the spine — the field reads as ALIVE rather than printed.
   It rides an SVG <use> OVERLAY of the spine, never the spine itself: a dasharray
   applied to the traces would erase 96% of them and call it animation. The solid
   spine stays solid; a short bright segment travels over it. ~90s to traverse,
   the glow drift's tempo — present in peripheral vision, never fast enough to
   pull an eye off a window. */
.ffv-desktop-pulse {
    opacity: 0.42;
    fill: none;
    stroke: #ffd6ee;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-dasharray: 30 900;
    filter: drop-shadow(0 0 6px rgba(255, 133, 207, 0.75));
    animation: ffv-desktop-current 90s linear infinite;
}

@keyframes ffv-desktop-current {
    from { stroke-dashoffset: 930; }
    to   { stroke-dashoffset: 0; }
}

/* two soft corner glows (the vessel's dawn-magenta / dusk-cyan poles),
   drifting almost imperceptibly so the field reads as alive, not busy */
.ffv-desktop-glow {
    position: absolute;
    width: 46vw;
    height: 46vw;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(70px);
    animation: ffv-desktop-drift 90s ease-in-out infinite alternate;
}

.ffv-desktop-glow--dawn {
    left: -14vw;
    top: -16vw;
    background: radial-gradient(circle, rgba(226, 67, 159, 0.07), transparent 68%);
}

.ffv-desktop-glow--dusk {
    right: -14vw;
    bottom: -18vw;
    background: radial-gradient(circle, rgba(95, 216, 240, 0.065), transparent 68%);
    animation-delay: -45s;
}

@keyframes ffv-desktop-drift {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(4vw, 2vw, 0) scale(1.08); }
}

/* soft vignette settles the field's edges under the window shadows */
.ffv-desktop::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(120% 105% at 50% 46%, transparent 62%, rgba(5, 4, 12, 0.42) 100%);
}

@media (prefers-reduced-motion: reduce) {
    .ffv-desktop-glow { animation: none; }
    /* the current stops AND disappears — a frozen bright stub sitting on one
       arbitrary trace would read as a rendering fault, not as stillness */
    .ffv-desktop-pulse { animation: none; display: none; }
}

/* ═══ Generic scene compositing (SceneManager, Issues 12/15) ═══════════════
   The generalization of the bio-workspace pattern (fergi-presentation.css):
   while a multi-member scene is composed, each member's fullscreen overlay
   goes pointer-transparent (its shell stays live) so clicks reach every
   window — the bio-trio keeps its bespoke ffa-bio-workspace/.ffa-ws-* dress;
   scenes without bespoke classes wear these. */
body.ffa-scene-live .ffa-scene-member {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    pointer-events: none !important;
}

body.ffa-scene-live .ffa-scene-member > * {
    pointer-events: auto;
}

/* ═══ The scene tray (directing-desktop-scenes S7) ═════════════════════════
   The reset-arrangement affordance: a quiet chip in the dock band while a
   registered multi-member scene is live (SceneManager syncTray owns its
   lifecycle). Sits just above the Activity Dock's shelf; same band, same
   pane-maximized + mobile hiding. Interactive chrome OVER the desktop —
   ruling R11 (desktop clicks never close windows) is untouched. */
.ffa-scene-tray {
    position: fixed;
    right: 18px;
    bottom: 58px;
    z-index: var(--z-activity-dock, 12000);
}
.ffa-scene-tray .ffa-scene-reset {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    font-size: calc(12px * var(--type-scale, 1));
    font-family: var(--ffv-body-font, 'Source Sans 3', 'Inter', sans-serif);
    color: rgba(228, 222, 244, 0.82);
    background: var(--ffv-glass-bg, rgba(24, 18, 40, 0.92));
    border: 1px solid rgba(157, 95, 224, 0.32);
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(6, 4, 14, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: color 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.ffa-scene-tray .ffa-scene-reset:hover {
    color: #fff;
    border-color: rgba(239, 63, 165, 0.5);
    transform: translateY(-1px);
}
.ffa-scene-tray .ffa-scene-reset:focus-visible {
    outline: 2px solid rgba(239, 63, 165, 0.6);
    outline-offset: 2px;
}
body.pane-maximized .ffa-scene-tray { display: none; }
@media (max-width: 768px) {
    .ffa-scene-tray { display: none; }
}
