/**
 * SWADS Surface Portal — shell (Browse & Scan) ↔ engine (Personal Dashboard)
 * Solid cover transition (no see-through morph).
 */
:root {
    --portal-shell-deep: #050505;
    --portal-shell-mid: #0c0c0c;
    --portal-shell-glow: #1a1a1a;
    --portal-engine: #111b21;
    --portal-accent: #ff6b00;
    --portal-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Early paint lock — set by boot script before body paints */
html.swads-portal-pending,
html.swads-portal-pending body {
    background: #000 !important;
}

html.swads-portal-pending body {
    overflow: hidden !important;
}

html.swads-portal-pending body > *:not(#swads-portal) {
    visibility: hidden !important;
}

html.swads-portal-pending--engine,
html.swads-portal-pending--engine body {
    background: #111b21 !important;
}

.swads-portal {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    background: #000;
}

.swads-portal.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.swads-portal__veil {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.4s var(--portal-ease);
    will-change: opacity;
}

.swads-portal__veil--shell {
    background: radial-gradient(
        ellipse 130% 95% at 50% -8%,
        var(--portal-shell-glow) 0%,
        var(--portal-shell-mid) 50%,
        var(--portal-shell-deep) 100%
    );
}

.swads-portal__veil--engine {
    background: radial-gradient(ellipse 120% 90% at 50% 0%, #1a242c 0%, var(--portal-engine) 55%, #0a0e11 100%);
}

.swads-portal__brand {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
    text-align: center;
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 0.32s var(--portal-ease), transform 0.32s var(--portal-ease);
    font-family: 'Roboto Flex', sans-serif !important;
    pointer-events: none;
}

/* Brand mark: Poppins; caption can stay Roboto Flex */
.swads-portal,
.swads-portal p,
.swads-portal span,
.swads-portal__caption {
    font-family: 'Roboto Flex', sans-serif !important;
    letter-spacing: inherit;
}

.swads-portal__mark,
.swads-portal__mark span {
    font-family: 'Poppins', sans-serif !important;
    letter-spacing: inherit;
}

.swads-portal.is-brand .swads-portal__brand {
    opacity: 1;
    transform: scale(1);
}

/* 3D orb — same language as /app Explore + dashboard Home */
.swads-portal__orb {
    --portal-orb: min(58vw, 13.25rem);
    position: relative;
    width: var(--portal-orb);
    height: var(--portal-orb);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(ellipse 38% 30% at 30% 26%, rgba(255, 255, 255, 0.28) 0%, transparent 55%),
        radial-gradient(circle at 50% 72%, rgba(0, 0, 0, 0.88) 0%, transparent 55%),
        radial-gradient(circle at 50% 48%, #2c2c2c 0%, #161616 42%, #070707 100%);
    box-shadow:
        inset 0 -16px 32px rgba(0, 0, 0, 0.78),
        inset 0 12px 24px rgba(255, 255, 255, 0.09),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1),
        0 0 0 1px rgba(255, 107, 0, 0.5),
        0 0 0 4px rgba(255, 107, 0, 0.12),
        0 22px 48px rgba(0, 0, 0, 0.65),
        0 0 42px rgba(255, 107, 0, 0.38),
        0 0 80px rgba(255, 107, 0, 0.16);
    animation: swads-portal-orb-throb 2.6s ease-in-out infinite;
}

.swads-portal__orb::before {
    content: '';
    position: absolute;
    inset: -20% -14% -30%;
    border-radius: 50%;
    background: radial-gradient(
        ellipse 70% 80% at 50% 55%,
        rgba(255, 107, 0, 0.55) 0%,
        rgba(255, 107, 0, 0.18) 42%,
        transparent 72%
    );
    filter: blur(3px);
    z-index: -1;
    pointer-events: none;
}

.swads-portal__orb-shine {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.swads-portal__orb-shine::after {
    content: '';
    position: absolute;
    top: -20%;
    left: -40%;
    width: 55%;
    height: 140%;
    background: linear-gradient(
        105deg,
        transparent 0%,
        rgba(255, 183, 125, 0.08) 32%,
        rgba(255, 255, 255, 0.5) 50%,
        rgba(255, 107, 0, 0.16) 62%,
        transparent 100%
    );
    transform: skewX(-12deg);
    animation: swads-portal-orb-glisten 4.2s ease-in-out infinite;
}

.swads-portal__orb-specular {
    position: absolute;
    width: 24%;
    height: 15%;
    top: 15%;
    left: 22%;
    border-radius: 50%;
    background: radial-gradient(
        ellipse at center,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(255, 183, 125, 0.35) 45%,
        transparent 72%
    );
    pointer-events: none;
    z-index: 1;
}

.swads-portal__orb-rim {
    position: absolute;
    inset: 7%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow:
        inset 0 0 18px rgba(0, 0, 0, 0.35),
        0 0 12px rgba(255, 107, 0, 0.08);
    pointer-events: none;
    z-index: 1;
}

.swads-portal__mark {
    position: relative;
    z-index: 2;
    margin: 0;
    font-family: 'Poppins', sans-serif !important;
    font-size: clamp(1.7rem, 7.5vw, 2.55rem);
    font-weight: 800;
    letter-spacing: -0.04em !important;
    line-height: 1;
    color: #ececec;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.38),
        0 2px 0 rgba(255, 255, 255, 0.1),
        0 -1px 1px rgba(0, 0, 0, 0.9),
        0 3px 10px rgba(0, 0, 0, 0.7),
        0 0 22px rgba(255, 107, 0, 0.22);
}

.swads-portal__mark--logo {
    display: block;
    width: min(78vw, 17.5rem);
    height: auto;
    max-height: 72vh;
    object-fit: contain;
    border-radius: 0;
    font-size: 0;
    letter-spacing: 0 !important;
    text-shadow: none;
    filter: none;
}

.swads-portal__orb:has(.swads-portal__mark--logo) {
    width: auto;
    height: auto;
    border-radius: 0;
    overflow: visible;
    background: transparent;
    box-shadow: none;
    animation: none;
}

.swads-portal__orb:has(.swads-portal__mark--logo)::before,
.swads-portal__orb:has(.swads-portal__mark--logo) .swads-portal__orb-shine,
.swads-portal__orb:has(.swads-portal__mark--logo) .swads-portal__orb-specular,
.swads-portal__orb:has(.swads-portal__mark--logo) .swads-portal__orb-rim {
    display: none;
}

.swads-portal__mark span {
    font-family: 'Poppins', sans-serif !important;
    font-weight: 800;
    color: #ff7a18;
    text-shadow:
        0 1px 0 rgba(255, 200, 140, 0.45),
        0 2px 0 rgba(255, 140, 60, 0.15),
        0 -1px 1px rgba(70, 25, 0, 0.85),
        0 0 16px rgba(255, 107, 0, 0.55),
        0 0 28px rgba(255, 107, 0, 0.3);
}

.swads-portal__caption {
    margin: 0;
    font-family: 'Roboto Flex', sans-serif !important;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.28em !important;
    text-transform: uppercase;
    color: rgba(255, 183, 125, 0.85);
    text-shadow: 0 0 18px rgba(255, 107, 0, 0.35);
}

@keyframes swads-portal-orb-throb {
    0%, 100% {
        box-shadow:
            inset 0 -16px 32px rgba(0, 0, 0, 0.78),
            inset 0 12px 24px rgba(255, 255, 255, 0.09),
            inset 0 0 0 1px rgba(255, 255, 255, 0.1),
            0 0 0 1px rgba(255, 107, 0, 0.45),
            0 0 0 4px rgba(255, 107, 0, 0.1),
            0 22px 48px rgba(0, 0, 0, 0.65),
            0 0 32px rgba(255, 107, 0, 0.3),
            0 0 64px rgba(255, 107, 0, 0.12);
    }
    50% {
        box-shadow:
            inset 0 -16px 32px rgba(0, 0, 0, 0.78),
            inset 0 12px 24px rgba(255, 255, 255, 0.09),
            inset 0 0 0 1px rgba(255, 255, 255, 0.1),
            0 0 0 1px rgba(255, 107, 0, 0.6),
            0 0 0 4px rgba(255, 107, 0, 0.16),
            0 22px 48px rgba(0, 0, 0, 0.65),
            0 0 48px rgba(255, 107, 0, 0.45),
            0 0 88px rgba(255, 107, 0, 0.2);
    }
}

@keyframes swads-portal-orb-glisten {
    0%, 35% { transform: translateX(-40%) skewX(-12deg); opacity: 0; }
    45% { opacity: 0.9; }
    55% { transform: translateX(160%) skewX(-12deg); opacity: 0; }
    100% { transform: translateX(160%) skewX(-12deg); opacity: 0; }
}

/*
 * Depart / arrive: ONE destination veil at full opacity.
 * Black .swads-portal base ensures the old page never shows through.
 */
.swads-portal[data-dir="to-shell"] .swads-portal__veil--shell,
.swads-portal[data-dir="arrive-shell"] .swads-portal__veil--shell {
    opacity: 1;
    transition: none;
}

.swads-portal[data-dir="to-shell"] .swads-portal__veil--engine,
.swads-portal[data-dir="arrive-shell"] .swads-portal__veil--engine {
    opacity: 0;
    transition: none;
}

.swads-portal[data-dir="to-engine"] .swads-portal__veil--engine,
.swads-portal[data-dir="arrive-engine"] .swads-portal__veil--engine {
    opacity: 1;
    transition: none;
}

.swads-portal[data-dir="to-engine"] .swads-portal__veil--shell,
.swads-portal[data-dir="arrive-engine"] .swads-portal__veil--shell {
    opacity: 0;
    transition: none;
}

/* Reveal: fade cover + brand only after destination is ready */
.swads-portal[data-dir="arrive-engine"].is-reveal .swads-portal__veil--engine,
.swads-portal[data-dir="arrive-shell"].is-reveal .swads-portal__veil--shell {
    opacity: 0;
    transition: opacity 0.42s var(--portal-ease);
}

.swads-portal[data-dir="arrive-engine"].is-reveal .swads-portal__brand,
.swads-portal[data-dir="arrive-shell"].is-reveal .swads-portal__brand {
    opacity: 0;
    transform: scale(1.04);
    transition: opacity 0.36s var(--portal-ease), transform 0.36s var(--portal-ease);
}

.swads-portal.is-reveal {
    background: transparent;
    transition: background 0.42s var(--portal-ease);
}

@media (prefers-reduced-motion: reduce) {
    .swads-portal__veil,
    .swads-portal__brand,
    .swads-portal__orb,
    .swads-portal__orb-shine::after {
        transition-duration: 0.01ms !important;
        animation: none !important;
    }
}

/* —— Shell footer portal chip —— */
.scan-garage-portal {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-top: 14px;
    padding: 10px 18px 9px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    text-decoration: none;
    color: var(--customer-text, #fff);
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.scan-garage-portal:active {
    transform: scale(0.97);
}

.scan-garage-portal:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 183, 125, 0.45);
}

.scan-garage-portal__row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.scan-garage-portal__row i {
    font-size: 0.85rem;
    color: var(--customer-accent-soft, #ffb77d);
}

.scan-garage-portal__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
