/* Loading Screen Styles */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
}

#loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-container {
    position: relative;
    transform: translateZ(0);
    will-change: transform, opacity;
}

.loading-logo {
    display: flex;
    align-items: center;
    gap: 0;
    transform: scale(2);
    position: relative;
    /* Offset the entire logo to the left initially */
    margin-left: -240px; /* Half of the text width when scaled */
}

.loading-logo svg {
    width: 64px;
    height: 96px;
}

/* Dot-by-dot animation styles */
.loading-logo svg line,
.loading-logo svg circle {
    opacity: 0;
    transform: scale(0);
    transform-origin: center;
}

/* Lines animation */
.loading-logo svg line:nth-child(1) {
    animation: drawLine 0.3s ease-out 0.2s forwards;
}

.loading-logo svg line:nth-child(2) {
    animation: drawLine 0.3s ease-out 0.5s forwards;
}

.loading-logo svg line:nth-child(3) {
    animation: drawLine 0.3s ease-out 0.8s forwards;
}

/* Dots animation - appear after their connected lines */
.loading-logo svg circle:nth-child(4) {
    animation: popDot 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.3s forwards;
}

.loading-logo svg circle:nth-child(5) {
    animation: popDot 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.6s forwards;
}

.loading-logo svg circle:nth-child(6) {
    animation: popDot 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.9s forwards;
}

.loading-logo svg circle:nth-child(7) {
    animation: popDot 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) 1.2s forwards;
}

/* Add glow after all elements are drawn */
.loading-logo.animation-complete svg {
    animation: pulseGlow 2s ease-in-out infinite;
}

.loading-text {
    font-size: 48px;
    font-weight: 500;
    color: #fff;
    opacity: 0;
    transform: translateX(-100px);
    position: absolute;
    left: 80px;
    white-space: nowrap;
}

/* Animation states - Icon stays in place, only text moves */
.loading-logo.phase-1 .loading-text {
    animation: slideOut 0.8s ease-out forwards;
    animation-delay: 0.5s;
}

.loading-logo.phase-2 {
    animation: none;
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animations */
@keyframes drawLine {
    0% {
        opacity: 0;
        transform: scaleX(0) scaleY(0.5);
    }
    50% {
        opacity: 1;
        transform: scaleX(1) scaleY(0.8);
    }
    100% {
        opacity: 1;
        transform: scaleX(1) scaleY(1);
    }
}

@keyframes popDot {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        filter: drop-shadow(0 0 20px rgba(255, 107, 53, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 40px rgba(255, 107, 53, 0.8));
    }
}

@keyframes slideOut {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Header Styles */
header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 20px 50px;
    z-index: 1000;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transition: background 0.3s ease, 
                backdrop-filter 0.3s ease, 
                box-shadow 0.3s ease,
                opacity 0.6s ease-out, 
                visibility 0.6s ease-out;
}

header.visible {
    opacity: 1;
    visibility: visible;
}

/* Header Scroll Effects */
header.scrolled {
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

header.header-hidden {
    transform: translateY(-100%);
}

/* Navigation */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Logo */
.logo {
    font-size: 24px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.logo.visible {
    opacity: 1;
    transform: translateX(0);
}

.logo svg {
    width: 32px;
    height: 32px;
}

/* CTA Button */
.cta-button {
    text-decoration: none;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
}

.cta-button.visible {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.2s;
}

.cta-button:hover {
    background: #FF8C42;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255, 113, 7, 0.3);
}

/* Content visibility states */
body:not(.content-visible) > *:not(#header-section) {
    opacity: 0;
    visibility: hidden;
}

body.content-visible > * {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.6s ease-out;
}

/* Hide scroll indicator until content is visible */
body:not(.content-visible) .section-scroll-indicator {
    opacity: 0;
    visibility: hidden;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .loading-logo {
        transform: scale(1.5);
        margin-left: -135px; /* Adjusted for better centering on tablet */
    }
    
    .loading-logo svg {
        width: 48px;
        height: 72px;
    }
    
    .loading-text {
        font-size: 36px;
        left: 60px;
    }
    
    header {
        padding: 15px 20px;
    }
    
    .logo {
        font-size: 20px;
    }
    
    .logo svg {
        width: 28px;
        height: 28px;
    }
    
    .cta-button {
        padding: 10px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .loading-logo {
        transform: scale(1.2);
        margin-left: -110px; /* Adjusted for better mobile centering */
    }
    
    .loading-logo svg {
        width: 40px;
        height: 60px;
    }
    
    .loading-text {
        font-size: 28px;
        left: 50px;
    }
    
    header {
        padding: 12px 16px;
    }
    
    .logo {
        font-size: 18px;
        gap: 8px;
    }
    
    .logo svg {
        width: 24px;
        height: 24px;
    }
    
    .cta-button {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* Small mobile devices */
@media (max-width: 375px) {
    .loading-logo {
        transform: scale(1.1);
        margin-left: -95px; /* Adjusted for better centering on small phones */
    }
    
    .loading-text {
        font-size: 24px;
        left: 45px;
    }
}