/* Phase 1T.5.35 — body-level public particle portal for long-page viewport coverage. */
.pems-auth-form-panel {
    position: relative;
    isolation: isolate;
    overflow: hidden;
}

.pems-auth-particles-canvas {
    position: absolute !important;
    inset: 0 !important;
    z-index: 0 !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none;
    opacity: .82;
}

.pems-auth-particles-canvas-secondary {
    z-index: 0 !important;
    pointer-events: none !important;
}

.pems-auth-form-panel > :not(.pems-auth-particles-canvas) {
    position: relative;
    z-index: 1;
}

/*
 * Public portal layering contract.
 *
 * Phase 1T.5.35 deliberately portals the public particle canvas directly under
 * <body>.  This prevents transforms/filters/containment on long public page roots
 * from converting position:fixed into section-relative positioning.  The canvas
 * therefore remains behind the visible viewport even at the bottom of long
 * detail/archive pages.
 */
html[data-pems-public-particles-host="ready"],
body[data-pems-public-particle-body="1"] {
    background: #f6f3f0 !important;
}

body[data-pems-public-particle-body="1"] {
    position: relative;
    min-height: 100%;
}

.pems-public-shell,
.pems-public-main {
    position: relative;
    z-index: 2;
    background: transparent !important;
}

.pems-public-shell {
    isolation: isolate;
}

.pems-public-main {
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible !important;
}

.pems-public-particles-canvas,
body > .pems-public-particles-canvas[data-pems-public-particle-portal="1"] {
    position: fixed !important;
    inset: 0 !important;
    z-index: 0 !important;
    display: block !important;
    width: 100vw !important;
    width: 100dvw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    transform: none !important;
    filter: none !important;
    contain: none !important;
    pointer-events: none !important;
    opacity: .82;
}

.pems-public-particles-canvas-secondary {
    pointer-events: none !important;
}

.pems-public-main > * {
    position: relative;
    z-index: 2;
}

/* Explicit/runtime-discovered neutral wrappers become transparent only when the
 * particle controller marks them as background surfaces. Cards are deliberately
 * not blanket-cleared by CSS. */
.pems-public-main [data-pems-public-particle-surface="1"] {
    background-color: transparent !important;
}

/* The exact institutional warm-neutral page surface always reveals the fixed
 * body-level canvas. This also survives / and /standings Livewire polling. */
.pems-public-main .bg-\[\#f6f3f0\],
.pems-public-main [data-pems-public-poll-root="1"] {
    background-color: transparent !important;
}

.pems-public-main > [wire\:id],
.pems-public-main > [wire\:snapshot],
.pems-public-main > .pems-public-page,
.pems-public-main > .min-h-screen,
.pems-public-main > .bg-\[\#f6f3f0\] {
    position: relative;
    z-index: 2;
}

.pems-public-shell > header,
.pems-public-shell > footer {
    position: relative;
    z-index: 3;
}

/*
 * Authentication loader geometry.
 * Desktop loading belongs to the right authentication panel — never the PADULA
 * branding panel and never the whole viewport.  The runtime measures the exact
 * current form-panel rectangle and publishes these variables.
 */
@media (min-width: 1180px) {
    .pems-auth-transition-overlay {
        position: fixed !important;
        inset: var(--pems-auth-panel-top, 0px) auto auto var(--pems-auth-panel-left, 50vw) !important;
        width: var(--pems-auth-panel-width, 50vw) !important;
        height: var(--pems-auth-panel-height, 100vh) !important;
        max-width: none !important;
        max-height: none !important;
        border-radius: 0 !important;
        z-index: 90 !important;
    }
}

/* Keep the loader visible through the redirect/navigation hand-off.  Livewire's
 * wire:loading inline display state may end a fraction before navigation begins;
 * this explicit pending state prevents the flash back to the Login card. */
html[data-pems-auth-login-pending="1"] .pems-auth-transition-overlay,
html[data-pems-auth-login-navigating="1"] .pems-auth-transition-overlay {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Single-column/mobile auth has no stable split panel; retain full-screen feedback. */
@media (max-width: 1179px) {
    .pems-auth-transition-overlay {
        position: fixed !important;
        inset: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pems-auth-particles-canvas,
    .pems-public-particles-canvas {
        display: none !important;
    }
}
