/* ==========================================================================
   Ambient background selector.

   Both canvases are rendered by the same partial. The active variant is chosen
   from the theme (set before first paint by theme.js) and the route marker on
   <body>, so switching themes or navigating never paints the wrong layer:

     - light + any public page     -> binary 0/1 field (unchanged)
     - dark  + About page          -> binary 0/1 field
     - dark  + any other page      -> faint blurred C#/TypeScript snippets
     - admin                       -> binary 0/1 field (admin layout has no
                                      code canvas at all)
   ========================================================================== */

.code-field {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    direction: ltr;
    opacity: 0;
    transition: opacity 420ms ease;
    -webkit-mask-image: radial-gradient(ellipse 78% 82% at 50% 44%, #000 26%, rgba(0, 0, 0, 0.78) 56%, transparent 100%);
    mask-image: radial-gradient(ellipse 78% 82% at 50% 44%, #000 26%, rgba(0, 0, 0, 0.78) 56%, transparent 100%);
}

.code-field.is-ready {
    opacity: 0;
}

:root[data-theme="dark"] body[data-ambient-page="default"] .code-field.is-ready {
    opacity: 1;
}

:root[data-theme="dark"] body[data-ambient-page="default"] .binary-field.is-ready {
    opacity: 0;
}

/* The binary layer keeps its existing light-theme look and hover spotlight. */
:root[data-theme="light"] .code-field {
    opacity: 0 !important;
}

@media (prefers-reduced-motion: reduce) {
    .code-field,
    .binary-field {
        transition: none;
    }
}
