/* ==========================================================================
   ROHN8 Auto & Smart — Atmospheric Dimmable Ambient Footer (IMP-003)
   Layered blurred atmosphere, boundary-overflowing luminous waves & comets,
   frosted glass card elevation, and 3-mode dimmer (ambient | dim | calm).
   ========================================================================== */

.site-footer.contact-footer.r8-footer-ambient {
    --footer-blur: 14px;
    --footer-img-opacity: .22;
    --footer-img-bright: .72;
    --footer-dim-top: rgba(6, 16, 11, .84);
    --footer-dim-mid: rgba(6, 15, 11, .78);
    --footer-dim-bot: rgba(4, 11, 8, .96);
    --footer-aurora-opacity: .26;
    --footer-wave-opacity: .28;
    --footer-particle-opacity: 0;
    --footer-spot-opacity: 0;
    --footer-card-top: rgba(11, 28, 19, .60);
    --footer-card-bot: rgba(6, 16, 11, .78);
    --footer-fx: 50%;
    --footer-fy: 35%;

    position: relative;
    z-index: 3;
    overflow: visible;
    padding-block-start: 0;
    border-block-start: 0;
    background: #060e0a;
}

/* Mode 2: Dimmed deep-emerald night atmosphere */
.site-footer.r8-footer-ambient[data-footer-ambient="dim"] {
    --footer-blur: 18px;
    --footer-img-opacity: .26;
    --footer-img-bright: .66;
    --footer-dim-top: rgba(5, 13, 9, .88);
    --footer-dim-mid: rgba(5, 12, 9, .84);
    --footer-dim-bot: rgba(3, 9, 6, .96);
    --footer-aurora-opacity: .34;
    --footer-wave-opacity: .46;
    --footer-particle-opacity: .36;
    --footer-spot-opacity: .42;
    --footer-card-top: rgba(9, 22, 15, .74);
    --footer-card-bot: rgba(5, 13, 9, .88);
}

/* Mode 3: Calm focus (deepest dim + all motion paused) */
.site-footer.r8-footer-ambient[data-footer-ambient="calm"] {
    --footer-blur: 22px;
    --footer-img-opacity: .18;
    --footer-img-bright: .58;
    --footer-dim-top: rgba(5, 12, 9, .93);
    --footer-dim-mid: rgba(4, 11, 8, .91);
    --footer-dim-bot: rgba(3, 8, 6, .98);
    --footer-aurora-opacity: .20;
    --footer-wave-opacity: .24;
    --footer-particle-opacity: 0;
    --footer-spot-opacity: 0;
    --footer-card-top: rgba(9, 21, 15, .82);
    --footer-card-bot: rgba(5, 12, 9, .92);
}

/* Illuminated hairline horizon seam along top footer edge */
.r8-footer-ambient::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(
        90deg,
        rgba(41, 62, 50, .18) 0%,
        rgba(72, 146, 104, .52) 18%,
        rgba(199, 247, 149, .82) 52%,
        rgba(103, 232, 249, .54) 76%,
        rgba(41, 62, 50, .18) 100%
    );
    box-shadow: 0 0 22px rgba(134, 239, 172, .28);
    opacity: var(--footer-wave-opacity);
    transition: opacity .45s ease;
}

/* 1. Clipped Atmospheric Backdrop Layer (strictly inside footer rectangle) */
.r8-footer-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.r8-footer-bg-img {
    position: absolute;
    inset: -12% -6%;
    width: 112%;
    height: 124%;
    max-width: none;
    object-fit: cover;
    object-position: 62% 64%;
    opacity: var(--footer-img-opacity);
    filter: blur(var(--footer-blur)) saturate(1.18) brightness(var(--footer-img-bright));
    transform: translate3d(0, 0, 0) scale(1.04);
    transition: opacity .5s ease, filter .5s ease;
    animation: none;
    will-change: auto;
}

.r8-footer-dimmer {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 72% 85% at 78% 18%, rgba(21, 94, 62, .24) 0%, transparent 64%),
        radial-gradient(ellipse 64% 72% at 16% 88%, rgba(16, 74, 49, .26) 0%, transparent 66%),
        linear-gradient(180deg, var(--footer-dim-top) 0%, var(--footer-dim-mid) 48%, var(--footer-dim-bot) 100%);
    transition: opacity .45s ease;
}

.r8-footer-aurora {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    opacity: var(--footer-aurora-opacity);
    filter: blur(62px);
    transition: opacity .5s ease;
    will-change: transform, opacity;
}

.r8-footer-aurora--a {
    width: clamp(280px, 38vw, 560px);
    height: clamp(190px, 24vw, 340px);
    left: -6%;
    top: -18%;
    background: radial-gradient(circle, rgba(34, 197, 94, .34) 0%, rgba(16, 185, 129, .14) 48%, transparent 74%);
    animation: r8-footer-orb-a 17s ease-in-out infinite alternate;
}

.r8-footer-aurora--b {
    width: clamp(300px, 42vw, 620px);
    height: clamp(200px, 26vw, 360px);
    right: -4%;
    bottom: -24%;
    background: radial-gradient(circle, rgba(199, 247, 149, .26) 0%, rgba(56, 189, 248, .12) 48%, transparent 74%);
    animation: r8-footer-orb-b 21s ease-in-out infinite alternate;
}

/* Subtle pointer-following radial ambient glow on desktop hover */
.r8-footer-spotlight {
    position: absolute;
    inset: 0;
    opacity: 0;
    background: radial-gradient(
        480px circle at var(--footer-fx) var(--footer-fy),
        rgba(199, 247, 149, .12) 0%,
        rgba(52, 211, 153, .06) 38%,
        transparent 72%
    );
    transition: opacity .45s ease;
}

.site-footer.r8-footer-ambient.is-hovered .r8-footer-spotlight {
    opacity: var(--footer-spot-opacity);
}

/* 2. Boundary-Overflowing Luminous Curves, Waves, Comets & Particles */
.r8-footer-overflow-fx {
    position: absolute;
    top: -96px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, .55) 14%, #000 30%, #000 100%);
    mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, .55) 14%, #000 30%, #000 100%);
}

.r8-footer-waves {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: var(--footer-wave-opacity);
    transition: opacity .45s ease;
}

.r8-footer-wave-group {
    transform-origin: 50% 24%;
    animation: r8-footer-wave-sway 15s ease-in-out infinite alternate;
}

.r8-footer-wave-group--alt {
    transform-origin: 50% 28%;
    animation: r8-footer-wave-sway-alt 19s ease-in-out infinite alternate;
}

.r8-footer-comet {
    opacity: 0;
    transition: opacity .4s ease;
}

.r8-footer-waves.is-live .r8-footer-comet {
    opacity: 1;
}

.site-footer.r8-footer-ambient[data-footer-ambient="dim"] .r8-footer-waves.is-live .r8-footer-comet {
    opacity: .56;
}

.site-footer.r8-footer-ambient[data-footer-ambient="calm"] .r8-footer-waves.is-live .r8-footer-comet {
    opacity: 0;
}

.r8-footer-particles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: var(--footer-particle-opacity);
    transition: opacity .45s ease;
}

/* Pause ALL ambient animations cleanly when user selects Calm mode */
.site-footer.r8-footer-ambient[data-footer-ambient="calm"] .r8-footer-bg-img,
.site-footer.r8-footer-ambient[data-footer-ambient="calm"] .r8-footer-aurora,
.site-footer.r8-footer-ambient[data-footer-ambient="calm"] .r8-footer-wave-group,
.site-footer.r8-footer-ambient[data-footer-ambient="calm"] .r8-footer-wave-group--alt {
    animation-play-state: paused !important;
}

/* Slower tranquil cadence in Dim mode */
.site-footer.r8-footer-ambient[data-footer-ambient="dim"] .r8-footer-bg-img {
    animation-duration: 40s;
}
.site-footer.r8-footer-ambient[data-footer-ambient="dim"] .r8-footer-aurora--a {
    animation-duration: 28s;
}
.site-footer.r8-footer-ambient[data-footer-ambient="dim"] .r8-footer-aurora--b {
    animation-duration: 34s;
}
.site-footer.r8-footer-ambient[data-footer-ambient="dim"] .r8-footer-wave-group {
    animation-duration: 26s;
}
.site-footer.r8-footer-ambient[data-footer-ambient="dim"] .r8-footer-wave-group--alt {
    animation-duration: 32s;
}

/* 3. Elevated Frosted-Glass Footer Cards & Directory */
.r8-footer-ambient .footer-contact-grid,
.r8-footer-ambient .footer-base {
    position: relative;
    z-index: 2;
}

.r8-footer-ambient .footer-contact-grid {
    gap: 18px clamp(16px, 2.2vw, 24px);
    padding-block: clamp(32px, 4.4vw, 56px) 20px;
}

.r8-footer-ambient .footer-contact-grid > .footer-contact-column,
.r8-footer-ambient .footer-contact-grid > .footer-identity {
    position: relative;
    padding: clamp(18px, 2.1vw, 24px);
    border-radius: 18px;
    border: 1px solid rgba(77, 126, 97, .36);
    background: linear-gradient(165deg, var(--footer-card-top) 0%, var(--footer-card-bot) 100%);
    box-shadow:
        0 18px 40px rgba(2, 9, 6, .42),
        inset 0 1px 0 rgba(199, 247, 149, .13);
    transition: border-color .24s ease, transform .24s ease, box-shadow .24s ease, background .45s ease;
}

@supports (backdrop-filter: blur(12px)) {
    .r8-footer-ambient .footer-contact-grid > .footer-contact-column,
    .r8-footer-ambient .footer-contact-grid > .footer-identity,
    .r8-footer-ambient .footer-directory,
    .r8-footer-ambient .r8-footer-ambient-btn {
        backdrop-filter: blur(14px) saturate(1.12);
        -webkit-backdrop-filter: blur(14px) saturate(1.12);
    }
}

.r8-footer-ambient .footer-contact-grid > .footer-contact-column:hover,
.r8-footer-ambient .footer-contact-grid > .footer-identity:hover {
    border-color: rgba(199, 247, 149, .46);
    transform: translateY(-2px);
    box-shadow:
        0 22px 46px rgba(2, 9, 6, .52),
        0 0 26px rgba(72, 213, 140, .10),
        inset 0 1px 0 rgba(199, 247, 149, .24);
}

.r8-footer-ambient .footer-contact-column h2 {
    margin-block-end: 10px;
}

.r8-footer-ambient .footer-contact-column p,
.r8-footer-ambient .footer-identity p {
    color: #c2d4c7;
}

.r8-footer-ambient .footer-directory {
    margin-block-start: 4px;
    border: 1px solid rgba(77, 126, 97, .34);
    border-radius: 16px;
    background: linear-gradient(165deg, var(--footer-card-top) 0%, var(--footer-card-bot) 100%);
    box-shadow:
        0 12px 28px rgba(2, 9, 6, .34),
        inset 0 1px 0 rgba(199, 247, 149, .10);
    transition: border-color .24s ease, box-shadow .24s ease;
}

.r8-footer-ambient .footer-directory:hover,
.r8-footer-ambient .footer-directory[open] {
    border-color: rgba(145, 224, 168, .44);
}

.r8-footer-ambient .footer-directory summary {
    width: 100%;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    list-style: none;
}

.r8-footer-ambient .footer-directory summary::-webkit-details-marker {
    display: none;
}

.r8-footer-ambient .footer-directory-summary-lead {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.r8-footer-ambient .footer-directory-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(77, 126, 97, .38);
    background: rgba(11, 29, 20, .65);
    color: var(--signal);
    flex: none;
    transition: transform .24s ease, border-color .24s ease;
}

.r8-footer-ambient .footer-directory[open] .footer-directory-chevron {
    transform: rotate(180deg);
    border-color: rgba(199, 247, 149, .55);
}

.r8-footer-ambient .footer-directory-content {
    padding: 4px 20px 20px;
    border-top: 1px solid rgba(77, 126, 97, .24);
}

.r8-footer-ambient .footer-directory-content .footer-contact-column {
    padding: 8px 0 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.r8-footer-ambient .footer-qr {
    padding-top: 8px;
    gap: 8px;
}

.r8-footer-ambient .footer-qr img {
    padding: 6px;
    border-radius: 11px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .42), 0 0 0 1px rgba(199, 247, 149, .32);
}

/* 4. Footer Base Bar & Interactive Dimmable Atmosphere Pill */
.r8-footer-ambient .footer-base {
    border-block-start: 1px solid rgba(77, 126, 97, .28);
    padding-block: 14px 18px;
    gap: 10px 18px;
    color: #b7cbbd;
}

.r8-footer-base-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
}

.r8-footer-ambient-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 13px;
    border-radius: 999px;
    border: 1px solid rgba(84, 138, 105, .44);
    background: rgba(10, 26, 18, .72);
    color: #d9ebdd;
    font-size: .78rem;
    font-weight: 680;
    letter-spacing: .01em;
    white-space: nowrap;
    transition: border-color .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
}

.r8-footer-ambient-btn:hover {
    border-color: rgba(199, 247, 149, .62);
    background: rgba(18, 44, 30, .86);
    color: var(--text);
    box-shadow: 0 0 18px rgba(134, 239, 172, .16);
}

.r8-footer-ambient-btn [data-footer-ambient-icon] {
    display: inline-flex;
    align-items: center;
}

.r8-footer-ambient-btn [data-footer-ambient-label] {
    color: var(--signal);
    font-weight: 760;
}

.site-footer.r8-footer-ambient[data-footer-ambient="calm"] .r8-footer-ambient-btn [data-footer-ambient-label] {
    color: #9fb7a6;
}

/* Keyframes (GPU-composited transform & opacity only) */
@keyframes r8-footer-bg-drift {
    0%   { transform: translate3d(-1.4%, -1%, 0) scale(1.05); }
    50%  { transform: translate3d(1.2%, 1.4%, 0) scale(1.08); }
    100% { transform: translate3d(-0.6%, 0.6%, 0) scale(1.05); }
}

@keyframes r8-footer-orb-a {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(7%, 10%, 0) scale(1.14); }
}

@keyframes r8-footer-orb-b {
    0%   { transform: translate3d(0, 0, 0) scale(1.04); }
    100% { transform: translate3d(-8%, -9%, 0) scale(1.16); }
}

@keyframes r8-footer-wave-sway {
    0%   { transform: translate3d(0, 0, 0) scaleY(1); }
    100% { transform: translate3d(0, 7px, 0) scaleY(1.028); }
}

@keyframes r8-footer-wave-sway-alt {
    0%   { transform: translate3d(0, 4px, 0) scaleY(1.02); }
    100% { transform: translate3d(0, -6px, 0) scaleY(.985); }
}

/* Responsive adjustments */
@media (max-width: 760px) {
    .r8-footer-overflow-fx {
        top: -68px;
    }
    .r8-footer-ambient .footer-contact-grid {
        gap: 14px;
        padding-block: 26px 16px;
    }
    .r8-footer-ambient .footer-contact-grid > .footer-contact-column,
    .r8-footer-ambient .footer-contact-grid > .footer-identity {
        padding: 18px;
        border-radius: 16px;
    }
    .r8-footer-base-tools {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 580px) {
    .r8-footer-overflow-fx {
        top: -54px;
    }
    .r8-footer-ambient .footer-contact-grid > .footer-contact-column {
        border: 1px solid rgba(77, 126, 97, .36);
        padding: 16px 18px;
    }
    .r8-footer-ambient .footer-directory summary {
        padding: 12px 15px;
    }
    .r8-footer-ambient .footer-directory-content {
        padding: 4px 15px 18px;
    }
    .r8-footer-ambient-btn {
        min-height: 40px;
    }
}

/* RDP-safe reduced-motion: calm slower drift unless user clicks Calm */
@media (prefers-reduced-motion: reduce) {
    .r8-footer-ambient .r8-footer-bg-img {
        animation-duration: 46s;
    }
    .r8-footer-ambient .r8-footer-aurora--a {
        animation-duration: 32s;
    }
    .r8-footer-ambient .r8-footer-aurora--b {
        animation-duration: 38s;
    }
    .r8-footer-ambient .r8-footer-wave-group {
        animation-duration: 28s;
    }
    .r8-footer-ambient .r8-footer-wave-group--alt {
        animation-duration: 34s;
    }
}
