/**
 * PSA Engineering - Logo Opener Styles
 * Industrial-themed animation with molten metal aesthetics
 */

/* ============================================
   LOGO OPENER CONTAINER
   ============================================ */

.psa-logo-opener {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0A1628 0%, #1A2D4A 50%, #0A1628 100%);
    overflow: hidden;
}

/* Exit animation */
.psa-logo-opener.opener-exit {
    animation: openerFadeOut 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes openerFadeOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.1);
        visibility: hidden;
    }
}

/* ============================================
   BACKGROUND EFFECTS
   ============================================ */

.opener-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Molten metal flow effect */
.molten-flow {
    position: absolute;
    width: 200%;
    height: 3px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(232, 93, 4, 0) 10%,
        rgba(232, 93, 4, 0.8) 30%,
        rgba(244, 140, 6, 1) 50%,
        rgba(232, 93, 4, 0.8) 70%,
        rgba(232, 93, 4, 0) 90%,
        transparent 100%
    );
    animation: moltenFlow 4s linear infinite;
    opacity: 0.6;
}

.molten-flow:nth-child(1) {
    top: 20%;
    animation-duration: 3s;
}

.molten-flow:nth-child(2) {
    top: 50%;
    animation-delay: -1s;
    animation-duration: 4s;
}

.molten-flow:nth-child(3) {
    top: 80%;
    animation-delay: -2s;
    animation-duration: 3.5s;
}

@keyframes moltenFlow {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(25%);
    }
}

/* Spark particles */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, rgba(232, 93, 4, 0.8), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(244, 140, 6, 0.6), transparent),
        radial-gradient(1px 1px at 40% 20%, rgba(255, 255, 255, 0.4), transparent),
        radial-gradient(1px 1px at 80% 50%, rgba(232, 93, 4, 0.5), transparent),
        radial-gradient(2px 2px at 10% 80%, rgba(244, 140, 6, 0.7), transparent),
        radial-gradient(1px 1px at 70% 10%, rgba(255, 255, 255, 0.3), transparent),
        radial-gradient(2px 2px at 90% 90%, rgba(232, 93, 4, 0.6), transparent),
        radial-gradient(1px 1px at 30% 60%, rgba(244, 140, 6, 0.4), transparent);
    animation: particleFloat 6s ease-in-out infinite;
}

@keyframes particleFloat {
    0%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-20px);
    }
}

/* ============================================
   CONTENT CONTAINER
   ============================================ */

.opener-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem;
}

/* ============================================
   LOGO CONTAINER
   ============================================ */

.logo-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin-bottom: 2rem;
    animation: logoContainerAppear 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes logoContainerAppear {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.logo-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 
        0 0 0 4px rgba(232, 93, 4, 0.3),
        0 0 0 8px rgba(232, 93, 4, 0.1),
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(232, 93, 4, 0.2);
    animation: logoPulse 2s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% {
        box-shadow: 
            0 0 0 4px rgba(232, 93, 4, 0.3),
            0 0 0 8px rgba(232, 93, 4, 0.1),
            0 20px 60px rgba(0, 0, 0, 0.4),
            0 0 40px rgba(232, 93, 4, 0.2);
    }
    50% {
        box-shadow: 
            0 0 0 4px rgba(232, 93, 4, 0.5),
            0 0 0 8px rgba(232, 93, 4, 0.2),
            0 20px 60px rgba(0, 0, 0, 0.4),
            0 0 60px rgba(232, 93, 4, 0.4);
    }
}

.opener-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: logoAppear 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes logoAppear {
    0% {
        filter: blur(20px) brightness(0.5);
        transform: scale(1.2);
    }
    100% {
        filter: blur(0) brightness(1);
        transform: scale(1);
    }
}

/* Logo shine effect */
.logo-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%
    );
    animation: shineEffect 2s ease-in-out infinite;
    animation-delay: 1s;
}

@keyframes shineEffect {
    0% {
        left: -100%;
    }
    50%, 100% {
        left: 200%;
    }
}

/* Expanding rings */
.logo-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border: 2px solid rgba(232, 93, 4, 0.6);
    border-radius: 50%;
    animation: ringExpand 2s ease-out infinite;
}

.logo-ring.delay-1 {
    animation-delay: 0.5s;
}

@keyframes ringExpand {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* ============================================
   BRAND TEXT
   ============================================ */

.brand-text {
    margin-bottom: 2rem;
}

.brand-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    letter-spacing: 0.15em;
    color: #FFFFFF;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.brand-name .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(30px);
    animation: letterAppear 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    text-shadow: 
        0 0 20px rgba(232, 93, 4, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.3);
}

.brand-name .space {
    width: 0.5em;
}

@keyframes letterAppear {
    0% {
        opacity: 0;
        transform: translateY(30px);
        filter: blur(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* Highlight PSA */
.brand-name .letter:nth-child(1),
.brand-name .letter:nth-child(2),
.brand-name .letter:nth-child(3) {
    color: #E85D04;
}

.tagline {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(0.875rem, 2.5vw, 1.125rem);
    font-weight: 300;
    letter-spacing: 0.3em;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    opacity: 0;
    animation: taglineAppear 0.8s cubic-bezier(0.4, 0, 0.2, 1) 1.5s forwards;
}

@keyframes taglineAppear {
    0% {
        opacity: 0;
        transform: translateY(20px);
        letter-spacing: 0.5em;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        letter-spacing: 0.3em;
    }
}

/* ============================================
   LOADING BAR
   ============================================ */

.loading-bar {
    width: min(280px, 70vw);
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    opacity: 0;
    animation: loadingBarAppear 0.5s ease 0.5s forwards;
}

@keyframes loadingBarAppear {
    0% {
        opacity: 0;
        transform: scaleX(0);
    }
    100% {
        opacity: 1;
        transform: scaleX(1);
    }
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, 
        #E85D04 0%, 
        #F48C06 50%,
        #E85D04 100%
    );
    background-size: 200% 100%;
    animation: 
        loadingProgress 2.5s cubic-bezier(0.4, 0, 0.2, 1) forwards,
        loadingShimmer 1s linear infinite;
    border-radius: 3px;
}

@keyframes loadingProgress {
    0% {
        width: 0%;
    }
    100% {
        width: 100%;
    }
}

@keyframes loadingShimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   COMPLETED STATE
   ============================================ */

body.opener-completed {
    animation: contentReveal 0.5s ease;
}

@keyframes contentReveal {
    0% {
        opacity: 0.8;
    }
    100% {
        opacity: 1;
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .logo-container {
        width: 140px;
        height: 140px;
    }
    
    .brand-name {
        letter-spacing: 0.1em;
    }
    
    .tagline {
        letter-spacing: 0.2em;
    }
    
    .molten-flow {
        height: 2px;
    }
}

@media (max-width: 480px) {
    .logo-container {
        width: 120px;
        height: 120px;
    }
    
    .opener-content {
        padding: 1rem;
    }
    
    .brand-name {
        letter-spacing: 0.05em;
    }
    
    .tagline {
        font-size: 0.75rem;
        letter-spacing: 0.15em;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .psa-logo-opener {
        animation: none !important;
        transition: opacity 0.3s ease !important;
    }
    
    .psa-logo-opener.opener-exit {
        opacity: 0;
    }
    
    .logo-container,
    .opener-logo,
    .brand-name .letter,
    .tagline,
    .loading-bar,
    .molten-flow,
    .particles,
    .logo-ring,
    .logo-shine,
    .loading-progress {
        animation: none !important;
    }
    
    .logo-container {
        opacity: 1;
        transform: none;
    }
    
    .brand-name .letter {
        opacity: 1;
        transform: none;
    }
    
    .tagline,
    .loading-bar {
        opacity: 1;
    }
    
    .loading-progress {
        width: 100%;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .psa-logo-opener {
        background: #000000;
    }
    
    .brand-name {
        color: #FFFFFF;
        text-shadow: none;
    }
    
    .loading-progress {
        background: #FFFFFF;
    }
}
