/* Global Variables */
:root {
    --cosmic-black: #050510;
    --deep-indigo: #0B022D;
    --cosmic-purple: #1D103B;
    --luminescent-white: #FFFFFF;
    --soft-gold: #FFD700;
    --serene-blue: #70C1FF;
    --dreamy-pink: #F9A8D4;
    
    --font-main: 'Inter', sans-serif;
    --font-title: 'Montserrat', sans-serif;
    
    /* Performance optimizations */
    --blur-small: blur(1px);
    --blur-medium: blur(2px);
    --blur-large: blur(4px);
}

/* Reset & Base Styles */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    height: 100%;
    overflow-x: hidden;
    background: var(--cosmic-black);
    color: var(--luminescent-white);
    font-family: var(--font-main);
    cursor: auto; /* Keep default cursor for fallback */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Hardware acceleration moved to specific elements that need it */
    backface-visibility: hidden;
    perspective: 1000;
}

/* High-Performance Custom Cursor */
.custom-cursor {
    position: fixed;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--luminescent-white) 0%, rgba(255, 255, 255, 0.8) 50%, transparent 100%);
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: difference;
    /* Optimized for 60fps animations */
    will-change: transform, opacity;
    transform: translate(-50%, -50%);
    transition: all 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Add glow effect */
    box-shadow: 
        0 0 20px rgba(255, 255, 255, 0.5),
        0 0 40px rgba(255, 255, 255, 0.3),
        0 0 60px rgba(255, 255, 255, 0.1);
}

.custom-cursor::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: inherit;
}

.custom-cursor.hover {
    width: 24px;
    height: 24px;
    background: radial-gradient(circle, var(--soft-gold) 0%, rgba(255, 215, 0, 0.8) 50%, transparent 100%);
    box-shadow: 
        0 0 30px rgba(255, 215, 0, 0.6),
        0 0 60px rgba(255, 215, 0, 0.4),
        0 0 90px rgba(255, 215, 0, 0.2);
}

.custom-cursor.hover::before {
    width: 60px;
    height: 60px;
    border-color: rgba(255, 215, 0, 0.3);
}

/* Optimized Trail System */
.trail-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9998;
    overflow: hidden;
}

.cursor-trail {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: radial-gradient(circle, currentColor 0%, transparent 70%);
    color: var(--luminescent-white);
    pointer-events: none;
    will-change: transform, opacity;
    opacity: 0;
    transform: translate(-50%, -50%);
}

/* Optimized Background Effects */
.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    overflow: hidden;
    will-change: transform;
    /* Extend to cover full document height */
    min-height: max(100vh, 3000px);
}

.star {
    position: absolute;
    background: var(--luminescent-white);
    border-radius: 50%;
    will-change: transform, opacity;
    animation: twinkle 4s infinite ease-in-out;
}

.star.small { width: 1px; height: 1px; }
.star.medium { width: 2px; height: 2px; }
.star.large { width: 3px; height: 3px; }

/* Enhanced nebula with full coverage */
.nebula-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -3;
    will-change: transform;
    transform: translateZ(0);
    /* Extend to cover full document height */
    min-height: max(100vh, 3000px);
}

.nebula-background::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 300%; /* Increased to cover more area */
    background: 
        radial-gradient(ellipse at 30% 40%, var(--cosmic-purple) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, var(--deep-indigo) 0%, transparent 50%),
        radial-gradient(ellipse at center, var(--cosmic-black) 40%, transparent 100%);
    opacity: 0.8;
    filter: var(--blur-large);
    animation: nebula-drift 60s infinite linear;
    will-change: transform;
    transform: translateZ(0);
}

.nebula-background::after {
    content: '';
    position: absolute;
    top: -30%;
    left: -30%;
    width: 160%;
    height: 260%; /* Increased to cover more area */
    background: 
        radial-gradient(circle at 25% 25%, rgba(249, 168, 212, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 75% 75%, rgba(112, 193, 255, 0.15) 0%, transparent 40%);
    filter: var(--blur-medium);
    animation: nebula-accent 40s infinite alternate ease-in-out;
    will-change: transform;
    transform: translateZ(0);
}

/* Main Layout - Optimized */
.universe {
    position: relative;
    min-height: 100vh;
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Ensure full coverage */
    min-height: max(100vh, 3000px);
}

/* Enhanced Header */
.intro {
    text-align: center;
    margin-bottom: 6rem;
    opacity: 0;
    animation: fade-in 2s forwards 0.5s;
    will-change: opacity, transform;
}

.intro h1 {
    font-family: var(--font-title);
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 300;
    letter-spacing: 0.3rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--serene-blue), var(--luminescent-white), var(--dreamy-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    will-change: transform;
}

.intro h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    width: 100px;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--soft-gold), transparent);
    transform: translateX(-50%);
    animation: pulse 3s infinite ease-in-out;
}

.intro p {
    font-size: 1.2rem;
    opacity: 0.8;
    font-weight: 300;
    letter-spacing: 0.1rem;
    margin-top: 1rem;
}

/* Timeline Container */
.timeline-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.memory-path {
    position: relative;
    min-height: 200vh;
    width: 100%;
    padding: 2rem 0;
    height: max(200vh, 1500px);
}

.memory-path::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        var(--luminescent-white) 20%,
        var(--serene-blue) 40%,
        var(--dreamy-pink) 60%,
        var(--soft-gold) 80%,
        transparent 100%
    );
    transform: translateX(-50%);
    opacity: 0.8;
    filter: var(--blur-small);
}

/* Memory Stars - Glowing Breathing Effect with Random Positioning */
.memory-star {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform, box-shadow;
    transform: translateZ(0);
    z-index: 15;
    /* Breathing glow effect */
    background: radial-gradient(circle, currentColor 30%, rgba(255, 255, 255, 0.8) 70%, transparent 100%);
    box-shadow: 
        0 0 20px currentColor,
        0 0 40px currentColor,
        0 0 60px rgba(255, 255, 255, 0.4),
        inset 0 0 10px rgba(255, 255, 255, 0.3);
    animation: stellar-breathing 3s ease-in-out infinite;
}

.memory-star::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 120%;
    border-radius: 50%;
    background: radial-gradient(circle, transparent 40%, currentColor 50%, transparent 70%);
    transform: translate(-50%, -50%);
    opacity: 0.3;
    animation: stellar-pulse 2s ease-in-out infinite alternate;
}

.memory-star::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    border: 1px solid currentColor;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.2;
    animation: stellar-ripple 4s ease-in-out infinite;
}

.memory-star:hover {
    transform: scale(1.3) translateZ(0);
    animation-play-state: paused;
    box-shadow: 
        0 0 30px currentColor,
        0 0 60px currentColor,
        0 0 100px currentColor,
        0 0 140px rgba(255, 255, 255, 0.6);
}

.memory-star:hover::before {
    opacity: 0.6;
    animation-play-state: paused;
}

.memory-star:hover::after {
    width: 300%;
    height: 300%;
    opacity: 0.4;
}

/* Star Connections */
.star-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.star-connection {
    position: absolute;
    height: 1px;
    background: linear-gradient(to right, 
        transparent 0%, 
        rgba(255, 255, 255, 0.3) 20%, 
        rgba(255, 255, 255, 0.6) 50%, 
        rgba(255, 255, 255, 0.3) 80%, 
        transparent 100%);
    transform-origin: left center;
    opacity: 0.4;
    animation: connection-pulse 6s ease-in-out infinite;
    filter: blur(0.5px);
}

/* FINAL Modal System - Completely Clean */
.new-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg,
        rgba(5, 5, 16, 0.85),
        rgba(11, 2, 45, 0.7),
        rgba(29, 16, 59, 0.6)
    );
    backdrop-filter: blur(20px) saturate(110%);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.4s ease, visibility 0.4s ease, backdrop-filter 0.4s ease;
}

.new-modal-overlay.show {
    visibility: visible;
    opacity: 1;
}

.new-modal-container {
    /* Container positioning - Even larger and more impressive */
    position: relative;
    max-width: min(98vw, 1000px);
    max-height: 90vh;
    
    /* Dreamy purple-pink cosmic glassmorphism */
    background: linear-gradient(135deg,
        rgba(29, 16, 59, 0.6),
        rgba(11, 2, 45, 0.7),
        rgba(5, 5, 16, 0.8),
        rgba(249, 168, 212, 0.08),
        rgba(29, 16, 59, 0.5)
    );
    border-radius: 32px;
    padding: 3rem;
    border: 1px solid rgba(249, 168, 212, 0.2);
    backdrop-filter: blur(30px) saturate(130%);
    box-shadow: 
        0 32px 64px rgba(5, 5, 16, 0.8),
        0 16px 32px rgba(29, 16, 59, 0.6),
        0 8px 24px rgba(249, 168, 212, 0.1),
        0 0 60px rgba(249, 168, 212, 0.05),
        inset 0 2px 0 rgba(255, 255, 255, 0.1),
        inset 0 0 40px rgba(249, 168, 212, 0.03);
    
    /* Enhanced aesthetic entrance animation */
    transform: scale(0.7) translateY(40px) rotateX(15deg);
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: cosmic-float 6s ease-in-out infinite;
    
    /* Ensure proper box model */
    box-sizing: border-box;
    overflow: hidden;
}

.new-modal-overlay.show .new-modal-container {
    transform: scale(1) translateY(0) rotateX(0deg);
    opacity: 1;
}

.new-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 45px;
    height: 45px;
    background: rgba(249, 168, 212, 0.1);
    border: 1px solid rgba(249, 168, 212, 0.25);
    border-radius: 50%;
    color: var(--luminescent-white);
    font-size: 1.4rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(15px) saturate(120%);
    transition: all 0.3s ease;
    z-index: 100001;
    box-shadow: 
        0 6px 20px rgba(5, 5, 16, 0.5),
        0 0 25px rgba(249, 168, 212, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 0 15px rgba(249, 168, 212, 0.05);
}

.new-modal-close:hover {
    background: rgba(249, 168, 212, 0.2);
    border-color: rgba(249, 168, 212, 0.4);
    transform: scale(1.15) rotate(90deg);
    box-shadow: 
        0 8px 25px rgba(5, 5, 16, 0.6),
        0 0 40px rgba(249, 168, 212, 0.25),
        0 0 80px rgba(249, 168, 212, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 0 20px rgba(249, 168, 212, 0.08);
}

.new-modal-content {
    text-align: center;
}

#modalImage {
    display: block;
    width: 100%;
    max-width: 750px;
    height: auto;
    max-height: 75vh;
    margin: 0 auto 2rem auto;
    border-radius: 20px;
    object-fit: contain;
    background: rgba(249, 168, 212, 0.05);
    border: 1px solid rgba(249, 168, 212, 0.15);
    box-shadow: 
        0 12px 30px rgba(5, 5, 16, 0.4),
        0 0 40px rgba(249, 168, 212, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: opacity 0.3s ease, filter 0.3s ease, transform 0.3s ease;
}

#modalImage:hover {
    transform: scale(1.02);
    box-shadow: 
        0 16px 40px rgba(5, 5, 16, 0.5),
        0 0 60px rgba(249, 168, 212, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.new-modal-info {
    text-align: center;
    color: var(--luminescent-white);
}

.new-modal-date {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dreamy-pink);
    margin-bottom: 0.8rem;
    text-shadow: 0 0 20px rgba(249, 168, 212, 0.5);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s;
}

.new-modal-caption {
    font-size: 1rem;
    line-height: 1.6;
    opacity: 0.9;
    max-width: 500px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.4s;
}

.new-modal-overlay.show .new-modal-date,
.new-modal-overlay.show .new-modal-caption {
    opacity: 1;
    transform: translateY(0);
}

/* Stellar Animations */
@keyframes stellar-breathing {
    0%, 100% {
        box-shadow: 
            0 0 20px currentColor,
            0 0 40px currentColor,
            0 0 60px rgba(255, 255, 255, 0.4),
            inset 0 0 10px rgba(255, 255, 255, 0.3);
        transform: scale(1) translateZ(0);
    }
    50% {
        box-shadow: 
            0 0 30px currentColor,
            0 0 60px currentColor,
            0 0 90px rgba(255, 255, 255, 0.6),
            inset 0 0 15px rgba(255, 255, 255, 0.5);
        transform: scale(1.1) translateZ(0);
    }
}

@keyframes stellar-pulse {
    0% { opacity: 0.2; transform: translate(-50%, -50%) scale(0.8); }
    100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1.2); }
}

@keyframes stellar-ripple {
    0%, 100% {
        opacity: 0.1; 
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.3; 
        transform: translate(-50%, -50%) scale(1.2);
    }
}

@keyframes connection-pulse {
    0%, 100% { 
        opacity: 0.2;
        filter: blur(0.5px);
    }
    33% { 
        opacity: 0.6;
        filter: blur(0.2px);
    }
    66% { 
        opacity: 0.3;
        filter: blur(0.8px);
    }
}

@keyframes cosmic-float {
    0%, 100% {
        transform: translateY(0px) rotateY(0deg);
    }
    33% {
        transform: translateY(-8px) rotateY(2deg);
    }
    66% {
        transform: translateY(-4px) rotateY(-1deg);
    }
}

/* Memory Tooltips */
.memory-tooltip {
    position: absolute;
    background: rgba(5, 5, 16, 0.95);
    color: var(--luminescent-white);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    white-space: nowrap;
    pointer-events: none;
        opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 100;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.memory-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    width: 0;
    height: 0;
    border: 6px solid transparent;
    border-top-color: rgba(5, 5, 16, 0.95);
    transform: translateX(-50%);
}

.memory-star:hover .memory-tooltip {
        opacity: 1;
    transform: translateY(-15px);
}



/* Hide Admin Functionality */
.admin-toggle {
    display: none !important;
}

.admin-panel {
    display: none !important;
}

/* Shooting Stars - Fixed Direction */
.shooting-star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--luminescent-white);
    border-radius: 50%;
    animation: shoot-correct 3s linear forwards;
    will-change: transform, opacity;
}

.shooting-star::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0; /* Changed from left to right */
    width: 80px;
    height: 1px;
    background: linear-gradient(to left, var(--luminescent-white), transparent); /* Reversed gradient */
    transform-origin: right center; /* Changed transform origin */
}

@keyframes shoot-correct {
    0% {
        transform: translateZ(0) translate(-100px, -100px);
        opacity: 1;
    }
    100% {
        transform: translateZ(0) translate(150vw, 150vh); /* Fixed direction */
        opacity: 0;
    }
}

/* Animations - Hardware Accelerated */
@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

@keyframes fade-in {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes slide-up {
    0% { opacity: 0; transform: translateY(50px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes gentle-pulse {
    0%, 100% { transform: scale(1) translateZ(0); }
    50% { transform: scale(1.05) translateZ(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; transform: translateX(-50%) scaleX(1); }
    50% { opacity: 1; transform: translateX(-50%) scaleX(1.2); }
}

@keyframes nebula-drift {
    0% { transform: translateZ(0) rotate(0deg); }
    100% { transform: translateZ(0) rotate(360deg); }
}

@keyframes nebula-accent {
    0% { transform: translateZ(0) translate(0, 0) scale(1); }
    100% { transform: translateZ(0) translate(5%, 3%) scale(1.1); }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .intro h1 {
        font-size: clamp(2.2rem, 7vw, 4.5rem);
    }
    
    .memory-content {
        padding: 2rem;
        margin: 2rem;
    }
    
    .new-modal-container {
        max-width: 96vw;
        padding: 2rem;
        border-radius: 24px;
    }
    
    #modalImage {
        max-width: 550px;
        max-height: 65vh;
    }
}

@media (max-width: 768px) {
    .intro {
        margin-bottom: 4rem;
    }
    
    .intro h1 {
        font-size: clamp(2rem, 8vw, 3.5rem);
        letter-spacing: 0.2rem;
    }
    
    .intro p {
        font-size: 1rem;
    }
    
    .universe {
        padding: 2rem 1rem;
    }
    
    .memory-content {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .memory-star {
        width: 18px;
        height: 18px;
    }
    
    .memory-star:hover {
        transform: scale(1.2) translateZ(0);
    }
    
    .new-modal-container {
        max-width: 96vw;
        max-height: 88vh;
        padding: 1.8rem;
        border-radius: 20px;
    }
    
    #modalImage {
        max-width: 100%;
        max-height: 60vh;
        border-radius: 15px;
    }
    
    .new-modal-close {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        top: 10px;
        right: 10px;
    }
    
    .new-modal-date {
        font-size: 1rem;
    }
    
    .new-modal-caption {
        font-size: 0.9rem;
    }
    
    .memory-tooltip {
        font-size: 0.7rem;
        padding: 6px 10px;
    }
    
    /* Keep timeline centered on mobile */
    .memory-path::before {
        left: 50%;
    }
}

@media (max-width: 480px) {
    .intro h1 {
        font-size: clamp(1.8rem, 10vw, 3rem);
        letter-spacing: 0.15rem;
    }
    
    .intro p {
        font-size: 0.9rem;
    }
    
    .universe {
        padding: 1.5rem 0.75rem;
    }
    
    .memory-star {
        width: 16px;
        height: 16px;
    }
    
    .new-modal-container {
        max-width: 98vw;
        max-height: 90vh;
        padding: 1rem;
        border-radius: 12px;
    }
    
    #modalImage {
        max-height: 45vh;
        border-radius: 8px;
    }
    
    .new-modal-close {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .new-modal-date {
        font-size: 0.95rem;
    }
    
    .new-modal-caption {
        font-size: 0.85rem;
        line-height: 1.5;
    }
    
    /* Keep timeline centered on small mobile */
    .memory-path::before {
        left: 50%;
    }
    
    .custom-cursor,
    .trail-container {
        display: none !important; /* Hide cursor and trails on mobile for performance */
    }
    
    body {
        cursor: auto !important; /* Ensure default cursor on mobile */
    }
}

/* Landscape tablet specific */
@media (max-width: 1024px) and (orientation: landscape) {
    .new-modal-container {
        max-height: 80vh;
    }
    
    #modalImage {
        max-height: 55vh;
    }
}

/* Performance optimizations for reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .custom-cursor {
        display: none;
    }
    
    body {
        cursor: auto !important;
    }
}

/* Print styles */
@media print {
    .custom-cursor,
    .trail-container,
    .admin-toggle,
    .admin-panel {
        display: none !important;
    }
    }
} 