/* =========================================================
   Footer — End of Transmission
   Compact sign-off with reactive constellation + Connect Orb
   ========================================================= */

.site-footer {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(59, 130, 246, 0.10), transparent 55%),
        radial-gradient(ellipse at 80% 100%, rgba(120, 80, 255, 0.06), transparent 60%),
        radial-gradient(ellipse at 20% 90%, rgba(0, 200, 255, 0.05), transparent 60%),
        radial-gradient(circle at center, rgba(30, 30, 35, 1), #07070a 90%);
    padding: 3.75rem 0 1.5rem !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Top edge "kernel boundary" line — the seam between site and footer */
.site-footer::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(96, 165, 250, 0.6) 30%,
            rgba(255, 255, 255, 0.85) 50%,
            rgba(96, 165, 250, 0.6) 70%,
            transparent 100%);
    box-shadow:
        0 0 12px rgba(96, 165, 250, 0.5),
        0 0 32px rgba(59, 130, 246, 0.25);
    z-index: 4;
    animation: kernelSeam 6s ease-in-out infinite;
}

@keyframes kernelSeam {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

/* Subtle aurora layer */
.footer-aurora {
    position: absolute;
    inset: -10%;
    pointer-events: none;
    z-index: 1;
    background:
        radial-gradient(40% 30% at 30% 30%, rgba(59, 130, 246, 0.18), transparent 70%),
        radial-gradient(35% 30% at 70% 60%, rgba(120, 90, 255, 0.14), transparent 70%),
        radial-gradient(30% 30% at 50% 90%, rgba(0, 220, 255, 0.10), transparent 70%);
    filter: blur(40px);
    animation: auroraDrift 24s ease-in-out infinite alternate;
    opacity: 0.85;
}

@keyframes auroraDrift {
    0%   { transform: translate3d(-3%, -2%, 0) scale(1.05); }
    50%  { transform: translate3d(3%, 2%, 0) scale(1.15); }
    100% { transform: translate3d(-2%, 3%, 0) scale(1.08); }
}

/* Canvas — reactive constellation */
#network-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: auto;
    cursor: crosshair;
    mix-blend-mode: screen;
    -webkit-mask-image: linear-gradient(to bottom,
            transparent 0%, black 8%, black 90%, transparent 100%);
    mask-image: linear-gradient(to bottom,
            transparent 0%, black 8%, black 90%, transparent 100%);
}

/* Container — content above canvas */
.footer-container {
    position: relative;
    z-index: 10;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    pointer-events: none;
}

.footer-container > * {
    pointer-events: auto;
}

/* =========================================================
   Sign-off core: kicker + thanks + orb + hint
   ========================================================= */
.signoff-core {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
}

.signoff-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.68rem;
    letter-spacing: 0.32em;
    color: var(--accent-color);
    font-weight: 600;
    padding: 0.3rem 0.7rem;
    border: 1px solid rgba(96, 165, 250, 0.25);
    border-radius: 100px;
    background: rgba(59, 130, 246, 0.06);
}

.signoff-kicker::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-color);
    animation: kickerPulse 1.6s ease-in-out infinite;
}

@keyframes kickerPulse {
    0%, 100% { box-shadow: 0 0 6px var(--accent-color); opacity: 0.85; }
    50%      { box-shadow: 0 0 14px var(--accent-color), 0 0 24px rgba(96, 165, 250, 0.5); opacity: 1; }
}

.signoff-thanks {
    font-size: clamp(1.5rem, 3.4vw, 2.2rem);
    line-height: 1.15;
    letter-spacing: -0.015em;
    margin: 0.25rem 0 0.5rem;
    font-weight: 600;
    opacity: 0;
    transform: translateY(12px);
    filter: blur(6px);
    transition:
        opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        filter 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.signoff-thanks.is-revealed {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

.signoff-thanks-accent {
    background: linear-gradient(120deg, #6ef3ff 0%, #60a5fa 35%, #a78bfa 70%, #6ef3ff 100%);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: accentShimmer 6s ease-in-out infinite;
}

@keyframes accentShimmer {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

/* =========================================================
   Connect Orb — the hero
   ========================================================= */
.connect-orb {
    --orb-size: 150px;
    position: relative;
    width: var(--orb-size);
    height: var(--orb-size);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-primary);
    cursor: pointer;
    isolation: isolate;
    margin: 0.25rem 0 0.75rem;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.connect-orb:hover { transform: scale(1.04); }
.connect-orb:active { transform: scale(0.97); }

.orb-aura {
    position: absolute;
    inset: -40%;
    background: radial-gradient(circle, rgba(96, 165, 250, 0.5) 0%, rgba(120, 90, 255, 0.25) 30%, transparent 65%);
    filter: blur(20px);
    z-index: -1;
    opacity: 0.7;
    animation: orbAuraPulse 4s ease-in-out infinite;
}

@keyframes orbAuraPulse {
    0%, 100% { transform: scale(1);    opacity: 0.6; }
    50%      { transform: scale(1.15); opacity: 0.9; }
}

.orb-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(96, 165, 250, 0.4);
    animation: orbRingExpand 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.orb-ring-2 { animation-delay: 1s; border-color: rgba(167, 139, 250, 0.4); }
.orb-ring-3 { animation-delay: 2s; border-color: rgba(110, 243, 255, 0.4); }

@keyframes orbRingExpand {
    0%   { transform: scale(0.8); opacity: 0; }
    20%  { opacity: 0.8; }
    100% { transform: scale(1.8); opacity: 0; }
}

.orb-core {
    position: relative;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.6) 40%, transparent 60%),
        linear-gradient(135deg, var(--accent-color), #a78bfa);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.2) inset,
        0 0 40px rgba(96, 165, 250, 0.6),
        0 0 80px rgba(96, 165, 250, 0.3),
        0 20px 60px -10px rgba(59, 130, 246, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.4s ease;
    overflow: hidden;
}

.orb-core::before {
    content: "";
    position: absolute;
    inset: 0;
    background: conic-gradient(from 0deg,
            transparent 0deg, rgba(255, 255, 255, 0.4) 60deg,
            transparent 120deg, transparent 360deg);
    animation: orbSpin 4s linear infinite;
    mix-blend-mode: overlay;
}

.orb-core::after {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(13, 13, 15, 0.4), rgba(13, 13, 15, 0));
    pointer-events: none;
}

@keyframes orbSpin { to { transform: rotate(360deg); } }

.connect-orb:hover .orb-core {
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.3) inset,
        0 0 60px rgba(96, 165, 250, 0.9),
        0 0 120px rgba(167, 139, 250, 0.6),
        0 30px 80px -10px rgba(59, 130, 246, 0.7);
}

.orb-arrow {
    position: relative;
    z-index: 1;
    font-size: 2.1rem;
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.connect-orb:hover .orb-arrow { transform: translateX(4px); }

.orb-label {
    position: absolute;
    inset: auto 0 -3rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
}

.orb-label-top {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.orb-label-bot {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-secondary);
}

.connect-orb.engaged .orb-aura { animation-duration: 1.2s; }

/* =========================================================
   CTA hint
   ========================================================= */
.cta-hint {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.7;
    opacity: 0.65;
    margin: 0.25rem auto 0;
    max-width: 540px;
}

.cta-hint kbd {
    display: inline-block;
    padding: 1px 6px;
    margin: 0 1px;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.66rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-width: 2px;
    border-radius: 4px;
}

/* =========================================================
   Achievement toast (Konami unlock)
   ========================================================= */
.achievement-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translate(-50%, 200%);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.1rem;
    background: linear-gradient(135deg, rgba(15, 17, 22, 0.95), rgba(28, 22, 50, 0.95));
    border: 1px solid rgba(167, 139, 250, 0.4);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 0 60px rgba(167, 139, 250, 0.4),
        0 20px 60px -20px rgba(0, 0, 0, 0.6);
    z-index: 200;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
    pointer-events: none;
    opacity: 0;
}

.achievement-toast.is-shown {
    transform: translate(-50%, 0);
    opacity: 1;
}

.toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a78bfa, #6ef3ff);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0d0d0f;
    font-weight: 700;
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.7);
}

.toast-body { display: flex; flex-direction: column; gap: 2px; }
.toast-title { font-size: 0.78rem; font-weight: 600; color: var(--text-primary); }
.toast-desc {
    font-size: 0.66rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

/* =========================================================
   Footer bottom — meta + reboot
   ========================================================= */
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-meta {
    font-size: 0.72rem;
    color: var(--text-secondary);
    opacity: 0.5;
    line-height: 1.5;
    margin: 0;
}

.back-to-top {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.back-to-top:hover {
    color: var(--text-primary);
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.08);
    box-shadow: 0 0 20px rgba(96, 165, 250, 0.3);
}

.reboot-icon {
    display: inline-block;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.back-to-top:hover .reboot-icon {
    transform: rotate(-360deg);
}

/* =========================================================
   Footer state classes — JS toggles for macro reactions
   ========================================================= */
.site-footer[data-state="firing"] .footer-aurora { animation-duration: 6s; opacity: 1; }
.site-footer[data-state="celebrating"] { animation: footerCelebrate 1.4s ease-out; }

@keyframes footerCelebrate {
    0%   { filter: brightness(1) saturate(1); }
    30%  { filter: brightness(1.4) saturate(1.6); }
    100% { filter: brightness(1) saturate(1); }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 768px) {
    .site-footer { padding: 3rem 0 1.5rem !important; }
    .footer-container { gap: 2rem; }
    .connect-orb { --orb-size: 130px; }
    .orb-core { width: 72px; height: 72px; }
    .orb-arrow { font-size: 1.85rem; }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .cta-hint { line-height: 2; }
}

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
    .footer-aurora,
    .signoff-kicker::before,
    .signoff-thanks-accent,
    .orb-aura,
    .orb-ring,
    .orb-core::before {
        animation: none !important;
    }

    .signoff-thanks {
        opacity: 1;
        transform: none;
        filter: none;
        transition: none;
    }

    #network-canvas { opacity: 0.5; }
}
