/* Base Styles */
body {
    margin: 0;
    padding: 0;
    font-family: 'Courier Prime', monospace;
    overflow-x: hidden;
    background-color: #000;
    color: #fff;
}

* {
    box-sizing: border-box;
}

/* Starfield Background */
#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.star {
    position: absolute;
    background-color: white;
    width: 2px;
    height: 2px;
    border-radius: 50%;
}

/* Landing Section */
.container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    position: relative;
    z-index: 1;
}

.ascii-art {
    white-space: pre;
    font-size: 24px;
    text-align: center;
    max-width: 100%;
    overflow-x: auto;
    margin-bottom: 20px;
    line-height: 1.2;
}

.subtitle {
    font-size: 18px;
    letter-spacing: 8px;
    margin-top: 30px;
    opacity: 0.8;
    animation: fadeIn 2s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 0.8; transform: translateY(0); }
}

#scroll-arrow {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    z-index: 1000;
    animation: arrowBounce 2s infinite;
    cursor: pointer;
}

@keyframes arrowBounce {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(10px);
    }
}

/* Gallery Section */
.gallery-section {
    min-height: 100vh;
    padding: 100px 40px;
    position: relative;
    z-index: 2;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.8) 20%, rgba(0,0,0,0.9) 100%);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery-item {
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-10px);
}

.thumbnail-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #111;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover .thumbnail-container {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
}

.thumbnail-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.gallery-item:hover .play-overlay {
    opacity: 1;
}

.play-icon {
    font-size: 48px;
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
}

.gallery-info {
    margin-top: 15px;
    padding: 0 10px;
}

.gallery-info h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: normal;
}

.gallery-meta {
    margin: 0;
    font-size: 14px;
    color: #999;
    font-family: 'Courier Prime', monospace;
}

/* Cinematic Player */
.cinematic-player {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.98);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.cinematic-player.active {
    display: flex;
    opacity: 1;
}

.video-wrapper {
    position: relative;
    width: 90%;
    max-width: 1600px;
    height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#mainVideo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
}

.close-btn {
    position: absolute;
    top: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 32px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 10001;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
    transform: rotate(90deg);
}

.player-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 10001;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-btn:disabled:hover {
    transform: scale(1);
    background: rgba(255, 255, 255, 0.1);
}

/* Project Info Card */
.project-info-card {
    position: absolute;
    bottom: 30px;
    right: 30px;
    max-width: 400px;
    z-index: 10001;
}

.info-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 24px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    margin-left: auto;
}

.info-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
}

.info-content {
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 25px;
    backdrop-filter: blur(15px);
    margin-top: 15px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s ease;
}

.info-content.active {
    max-height: 600px;
    opacity: 1;
}

.info-content h2 {
    margin: 0 0 15px 0;
    font-size: 24px;
    font-weight: normal;
}

.info-content p {
    margin: 0 0 12px 0;
    font-size: 16px;
    line-height: 1.6;
    color: #ccc;
}

.project-meta {
    font-size: 14px;
    color: #999;
    font-style: italic;
}

/* Technical HUD */
.technical-hud {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-family: 'Courier Prime', monospace;
    font-size: 14px;
}

.hud-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.hud-label {
    color: #0f0;
    font-weight: bold;
    margin-right: 10px;
}

/* Floating Buttons */
.floating-button {
    position: fixed;
    padding: 10px 20px;
    font-size: 16px;
    text-decoration: none;
    background: transparent;
    border: 2px solid;
    border-radius: 5px;
    z-index: 1000;
    transition: all 0.3s ease;
}

#portal-button {
    right: 20px;
    bottom: 20px;
}

#home-button {
    left: 20px;
    bottom: 20px;
}

#collab-button {
    top: 20px;
    right: 20px;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 30px;
        padding: 0 20px;
    }

    .video-wrapper {
        width: 95%;
        height: 80vh;
    }

    .project-info-card {
        max-width: 300px;
    }
}

@media (max-width: 768px) {
    .ascii-art {
        font-size: 16px;
    }

    .subtitle {
        font-size: 14px;
        letter-spacing: 6px;
    }

    .gallery-section {
        padding: 80px 20px;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .close-btn {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 28px;
    }

    .nav-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .player-controls {
        bottom: 20px;
        gap: 15px;
    }

    .project-info-card {
        bottom: 90px;
        right: 15px;
        left: 15px;
        max-width: none;
    }

    .floating-button {
        font-size: 14px;
        padding: 8px 16px;
    }
}

@media (max-width: 480px) {
    .ascii-art {
        font-size: 12px;
    }

    .subtitle {
        font-size: 12px;
        letter-spacing: 4px;
    }

    #scroll-arrow {
        font-size: 18px;
    }

    .floating-button {
        font-size: 12px;
        padding: 6px 12px;
    }

    .info-content h2 {
        font-size: 20px;
    }

    .info-content p {
        font-size: 14px;
    }
}

/* Accessibility: Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    #scroll-arrow {
        animation: none !important;
    }

    .gallery-item:hover {
        transform: none;
    }
}

/* Loading State */
.thumbnail-video:not([src]) {
    background: linear-gradient(45deg, #111 25%, #222 25%, #222 50%, #111 50%, #111 75%, #222 75%, #222);
    background-size: 20px 20px;
    animation: loading 1s linear infinite;
}

@keyframes loading {
    0% { background-position: 0 0; }
    100% { background-position: 20px 20px; }
}
