/**
 * SpiralGate Coherence Pulse Styles
 * Visual feedback for the living site system
 */

/* ========================================
   COHERENCE INDICATOR
   Positioned on RIGHT side to avoid overlap with journey map on left
   ======================================== */

#coherence-indicator {
    position: fixed;
    bottom: 100px;
    right: 30px; /* Changed from left to right */
    left: auto; /* Reset left */
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.4s ease;
}

#coherence-indicator:hover {
    opacity: 1;
}

.coherence-orb {
    --coherence-hue: 280;
    --coherence-sat: 60%;
    --coherence-light: 50%;
    --coherence-glow: 10px;
    
    position: relative;
    width: 40px;
    height: 40px;
}

.orb-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: radial-gradient(
        circle,
        hsl(var(--coherence-hue), var(--coherence-sat), calc(var(--coherence-light) + 20%)) 0%,
        hsl(var(--coherence-hue), var(--coherence-sat), var(--coherence-light)) 100%
    );
    border-radius: 50%;
    box-shadow: 
        0 0 var(--coherence-glow) hsla(var(--coherence-hue), 70%, 60%, 0.6),
        0 0 calc(var(--coherence-glow) * 2) hsla(var(--coherence-hue), 60%, 50%, 0.3);
    animation: orb-breathe 4s ease-in-out infinite;
}

@keyframes orb-breathe {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

.orb-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
}

.ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid hsla(var(--coherence-hue), 50%, 60%, 0.3);
    animation: ring-expand 3s ease-out infinite;
}

.ring-1 {
    width: 20px;
    height: 20px;
    animation-delay: 0s;
}

.ring-2 {
    width: 20px;
    height: 20px;
    animation-delay: 1s;
}

.ring-3 {
    width: 20px;
    height: 20px;
    animation-delay: 2s;
}

@keyframes ring-expand {
    0% {
        width: 20px;
        height: 20px;
        opacity: 0.6;
    }
    100% {
        width: 60px;
        height: 60px;
        opacity: 0;
    }
}

.coherence-label {
    font-family: "Cinzel", serif;
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(212, 175, 55, 0.6);
    transition: color 0.4s ease;
}

#coherence-indicator:hover .coherence-label {
    color: rgba(212, 175, 55, 1);
}

#coherence-indicator.high-coherence .orb-core {
    animation: orb-pulse-high 1s ease-in-out infinite;
}

@keyframes orb-pulse-high {
    0%, 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 20px hsla(320, 70%, 60%, 0.8), 0 0 40px hsla(45, 80%, 50%, 0.5); }
    50% { transform: translate(-50%, -50%) scale(1.2); box-shadow: 0 0 30px hsla(320, 70%, 60%, 1), 0 0 60px hsla(45, 80%, 50%, 0.8); }
}

/* ========================================
   AMBIENT WISDOM MESSAGES
   Positioned on RIGHT side to avoid overlap
   ======================================== */

#ambient-wisdom {
    position: fixed;
    bottom: 180px;
    right: 30px; /* Changed from left to right */
    left: auto; /* Reset left */
    z-index: 998;
    max-width: 280px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
    pointer-events: none;
    text-align: right; /* Align text to right */
}

#ambient-wisdom.visible {
    opacity: 1;
    transform: translateY(0);
}

.wisdom-text {
    font-family: "Cormorant Garamond", serif;
    font-size: 1.1rem;
    font-style: italic;
    color: rgba(212, 175, 55, 0.9);
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
    line-height: 1.6;
    padding: 15px 20px;
    background: rgba(5, 5, 8, 0.8);
    border-right: 2px solid rgba(155, 89, 182, 0.5); /* Changed from border-left to border-right */
    border-left: none;
    backdrop-filter: blur(10px);
}

/* ========================================
   COHERENCE WAVE (on click)
   ======================================== */

.coherence-wave {
    position: fixed;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(212, 175, 55, 0.6);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    animation: wave-expand 1.5s ease-out forwards;
}

@keyframes wave-expand {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(20);
        opacity: 0;
    }
}

/* ========================================
   PAGE TRANSITIONS
   ======================================== */

#spiral-transition {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    background: #050508;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0s 0.5s;
}

#spiral-transition.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0s;
}

.transition-spiral {
    width: 100px;
    height: 100px;
}

.transition-spiral svg {
    width: 100%;
    height: 100%;
}

.trans-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    animation: none;
}

#spiral-transition.active .trans-path {
    animation: spiral-draw 0.6s ease-in forwards;
}

@keyframes spiral-draw {
    to {
        stroke-dashoffset: 0;
    }
}

/* ========================================
   COHERENCE-RESPONSIVE ELEMENTS
   Site elements that respond to coherence level
   ======================================== */

:root {
    --site-coherence: 0.5;
}

/* Elements glow more with higher coherence */
.spiral-symbol {
    filter: drop-shadow(0 0 calc(10px + var(--site-coherence) * 20px) rgba(155, 89, 182, calc(0.3 + var(--site-coherence) * 0.4)));
}

/* Background breathes with coherence */
.mirror-layer::before {
    animation-duration: calc(12s - var(--site-coherence) * 6s);
}

/* Links pulse more with coherence */
a:hover {
    text-shadow: 0 0 calc(10px + var(--site-coherence) * 15px) currentColor;
}

/* ========================================
   MOBILE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
    #coherence-indicator {
        bottom: 80px;
        right: 15px; /* Changed from left to right */
        left: auto;
        transform: scale(0.8);
    }
    
    #ambient-wisdom {
        bottom: 140px;
        left: 15px;
        right: 15px;
        max-width: none;
        text-align: center;
    }
    
    .wisdom-text {
        font-size: 1rem;
        border-right: none;
        border-left: none;
        border-top: 2px solid rgba(155, 89, 182, 0.5);
    }
}
