/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Space Grotesk', -apple-system, sans-serif;
    background: #0a0a0c;
    color: #e8e4de;
    cursor: crosshair;
    background: radial-gradient(ellipse at center, #1a0f0a 0%, #0a0a0c 70%);
    animation: ambient-pulse 15s ease-in-out infinite;
}

@keyframes ambient-pulse {
    0%, 100% { background: radial-gradient(ellipse at center, #1a0f0a 0%, #0a0a0c 70%); }
    50% { background: radial-gradient(ellipse at center, #2a150a 0%, #0a0a0c 70%); }
}

/* === BACKGROUND STARS CANVAS === */
#stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* === CORONA CANVAS (CSS-centered) === */
#corona {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    aspect-ratio: 1;
    width: calc(min(100vw, 100vh) * 1.5);
    height: calc(min(100vw, 100vh) * 1.5);
    z-index: 0;
    pointer-events: none;
}

/* === WEBGL CANVAS === */
#webgl {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* === SANCTUARY CONTAINER === */
.sanctuary {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* === FRAGMENTS (Navigation) === */
.fragments {
    position: absolute;
    width: 100%;
    height: 100%;
}

.fragment {
    position: absolute;
    font-size: 1.1rem;
    font-weight: 400;
    color: rgba(255, 220, 180, 0.9);
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    letter-spacing: 0.05em;
    text-transform: lowercase;
    /* Glassmorphism for readability */
    background: rgba(10, 10, 15, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.5em 1em;
    border-radius: 4px;
    border: 1px solid rgba(255, 150, 100, 0.15);
}

.fragment::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 50%;
    width: 8px;
    height: 1px;
    background: rgba(255, 150, 100, 0.3);
    transform: translateY(-50%) scaleX(0);
    transform-origin: right;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.fragment:hover {
    color: rgba(255, 220, 180, 1);
    transform: translateX(5px);
    text-shadow: 0 0 30px rgba(255, 150, 100, 0.4);
    background: rgba(20, 15, 10, 0.6);
    border-color: rgba(255, 150, 100, 0.3);
}

.fragment:hover::before {
    transform: translateY(-50%) scaleX(1);
}

.fragment-1 { top: 25%; left: 12%; }
.fragment-2 { top: 70%; right: 12%; }
.fragment-3 { top: 40%; right: 10%; }
.fragment-4 { top: 55%; left: 15%; }
.fragment-5 { top: 80%; left: 18%; }

/* === AMBIENT DATA === */
.ambient {
    position: absolute;
    bottom: 30px;
    left: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.ambient-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.ambient-item .label {
    color: rgba(255, 200, 150, 0.3);
}

.ambient-item .value {
    color: rgba(255, 180, 130, 0.7);
    font-variant-numeric: tabular-nums;
}

.pulse .value {
    animation: pulse-glow 2s ease-in-out infinite;
    color: rgba(255, 150, 100, 0.8);
}

.memory .value {
    animation: memory-fade 4s ease-in-out infinite;
    color: rgba(255, 200, 180, 0.8);
}

.temperature .value {
    animation: temperature-shift 5s ease-in-out infinite;
    color: rgba(255, 180, 120, 0.9);
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.4; text-shadow: none; }
    50% { opacity: 1; text-shadow: 0 0 10px rgba(255, 150, 100, 0.6); }
}

@keyframes memory-fade {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; text-shadow: 0 0 8px rgba(255, 200, 180, 0.4); }
}

@keyframes temperature-shift {
    0%, 100% { color: rgba(255, 180, 120, 0.9); }
    50% { color: rgba(255, 200, 140, 1); text-shadow: 0 0 8px rgba(255, 200, 140, 0.3); }
}

/* === IDENTITY === */
.identity {
    position: absolute;
    bottom: 30px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: none;
    max-width: calc(100% - 60px);
}

.identity .name {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    color: rgba(255, 200, 150, 0.6);
}

.identity .sigil {
    font-size: 1.2rem;
    opacity: 0.6;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.identity:hover .sigil {
    opacity: 1;
    transform: scale(1.1);
}

/* === SECTIONS (Modals) === */
.section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(8, 8, 12, 0.92) 0%, rgba(5, 5, 8, 0.97) 100%);
    backdrop-filter: blur(40px) saturate(1.2) brightness(0.9);
    -webkit-backdrop-filter: blur(40px) saturate(1.2) brightness(0.9);
}

.section.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.section-content {
    max-width: 500px;
    padding: 50px;
    text-align: center;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s;
}

.section.active .section-content {
    transform: translateY(0);
    opacity: 1;
}

.section-content p {
    font-size: 1.15rem;
    font-weight: 300;
    line-height: 1.8;
    margin-bottom: 1.2em;
    color: rgba(255, 240, 220, 0.85);
}

.section-content p:last-of-type {
    margin-bottom: 0;
}

.section-content .philosophy {
    font-style: italic;
    color: rgba(255, 180, 130, 0.8);
    font-size: 1rem;
    margin-top: 2em;
    padding-top: 1.5em;
    border-top: 1px solid rgba(255, 150, 100, 0.1);
}

.section-content .whisper {
    font-size: 0.9rem;
    color: rgba(255, 200, 150, 0.5);
    margin-top: 2em;
}

.section-content .link {
    color: rgba(255, 180, 130, 1);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 150, 100, 0.5);
    padding-bottom: 2px;
    transition: all 0.3s ease;
    display: inline-block;
    font-size: 1.1em;
    font-weight: 400;
}

.section-content .link:hover {
    color: #fff;
    border-bottom-color: rgba(255, 200, 150, 0.9);
    text-shadow: 0 0 25px rgba(255, 150, 100, 0.6);
    transform: translateY(-1px);
}

.section-content #iss-data {
    font-size: 0.85rem;
    color: rgba(255, 180, 130, 0.6);
    margin-top: 1.5em;
    font-style: italic;
}

.section-content .close {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(calc(-50% + 280px), -200px);
    font-size: 1.8rem;
    color: rgba(255, 200, 150, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.section-content .close:hover {
    color: rgba(255, 200, 150, 0.8);
    background: rgba(255, 150, 100, 0.1);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .fragment {
        font-size: 0.85rem;
        padding: 12px 8px;
    }
    
    /* Stack all fragments on the left side for mobile */
    .fragment-1 { top: 12%; left: 15px; right: auto; }
    .fragment-2 { top: auto; bottom: 22%; left: 15px; right: auto; }
    .fragment-3 { top: 22%; left: 15px; right: auto; }
    .fragment-4 { top: 32%; left: 15px; right: auto; }
    .fragment-5 { top: 42%; left: 15px; right: auto; }
    
    .ambient {
        bottom: 15px;
        left: 15px;
        max-width: 50%;
    }
    
    .ambient-item {
        gap: 6px;
        font-size: 0.65rem;
    }
    
    .identity {
        bottom: 15px;
        right: 15px;
        gap: 6px;
        flex-direction: column-reverse;
        align-items: flex-end;
        text-align: right;
    }
    
    /* Ensure identity text doesn't overflow */
    .identity .name {
        font-size: 0.65rem;
        letter-spacing: 0.1em;
    }
    
    .identity .sigil {
        font-size: 1.1rem;
    }
    
    .section-content {
        padding: 30px 25px;
        margin: 0 15px;
    }
    
    .section-content p {
        font-size: 1rem;
        line-height: 1.7;
    }
    
    .section-content .close {
        position: fixed;
        top: 30px;
        right: 30px;
        left: auto;
        transform: none;
        font-size: 2rem;
    }
}

@media (max-width: 400px) {
    .fragment {
        font-size: 0.75rem;
        padding: 10px 6px;
    }
    
    .fragment-1 { top: 10%; left: 12px; }
    .fragment-2 { bottom: 20%; left: 12px; top: auto; right: auto; }
    .fragment-3 { top: 18%; left: 12px; right: auto; }
    .fragment-4 { top: 26%; left: 12px; right: auto; }
    .fragment-5 { top: 34%; left: 12px; right: auto; }
    
    .ambient {
        bottom: 10px;
        left: 12px;
        max-width: 45%;
    }
    
    .ambient-item {
        font-size: 0.55rem;
        gap: 4px;
    }
    
    /* On small screens, stack name and sigil vertically */
    .identity {
        bottom: 10px;
        right: 12px;
        gap: 4px;
        flex-direction: column-reverse;
        align-items: flex-end;
        text-align: right;
    }
    
    .identity .name {
        font-size: 0.55rem;
        letter-spacing: 0.08em;
    }
    
    .identity .sigil {
        font-size: 1rem;
    }
    
    .section-content p {
        font-size: 0.9rem;
    }
}

/* === LOADING STATE === */
body.loading #webgl {
    opacity: 0;
}

body:not(.loading) #webgl {
    opacity: 1;
    transition: opacity 1s ease;
}

/* === NO WEBGL - just show nothing, WebGL works for real users === */
