@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&family=Syncopate:wght@400;700&display=swap');

html {
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
    overflow-y: scroll;
    min-height: 100vh;
    background-color: #000;
    font-family: 'Space Mono', monospace;
}

#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none; /* Allows scroll to pass through canvas */
}

/* The scroll track defines the length of the journey */
#scroll-track {
    height: 1100vh; /* Increased to ensure the bottom content is fully visible */
    width: 100%;
    pointer-events: none;
}

.hud {
    position: fixed;
    color: white;
    z-index: 10;
    pointer-events: none;
    mix-blend-mode: difference;
}

.title-hud {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    opacity: 1;
    transition: opacity 0.5s ease;
}

/* Floating Navigation Menu */
#nav-menu {
    position: fixed;
    top: 2rem;
    left: 2rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 50;
    color: white;
    border-radius: 8px;
    pointer-events: auto;
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
}

.nav-link {
    display: block;
    padding: 0.25rem 0;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.3s ease;
}

.nav-link:hover, .nav-link.active-nav {
    color: #44aaff; /* Highlight color matching the sphere */
}

/* Navigation Dropdown Styles */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropdown-arrow {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.nav-dropdown.open .dropdown-arrow {
    transform: rotate(90deg);
}

.nav-dropdown-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 1rem;
}

.nav-dropdown.open .nav-dropdown-content {
    max-height: 200px;
}

.nav-sublink {
    display: block;
    padding: 0.25rem 0;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    transition: color 0.3s ease;
}

.nav-sublink:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* Default positioning for sections - Overridden by specific IDs below */
.section-info {
    position: fixed;
    top: 20%;
    left: 10%; /* Default position (now overridden for main sections) */
    color: white;
    z-index: 20;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s ease-out;
    max-width: 400px;
    pointer-events: none;
}

/* --- Explicit Centering for Main Sections --- */

/* 1. Traveler Section (Now Centered) */
#sec-about {
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    text-align: center;
    max-width: 400px; /* Adjusted to 400px for a focused block */
}

/* 2. Artifacts Section (Ensure Centering) */
#sec-works {
    max-width: 1000px;
    left: 50%;
    top: 15%;
    transform: translateX(-50%) translateY(20px);
    text-align: center;
}

/* 3. Other Experiments Section (Now Centered) */
#sec-contact {
    left: 50%;
    top: 20%; /* Set a specific top value for consistent vertical position */
    transform: translateX(-50%) translateY(20px);
    max-width: 1000px; /* Wider to accommodate carousel */
    text-align: center;
}

/* --- End Explicit Centering --- */

/* Text shadows for Traveler section */
#sec-about h2,
#sec-about p,
#sec-about .text-xs {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.section-info.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    z-index: 25; /* Higher than default z-index: 20, brings active section to front */
}

/* --- CAROUSEL STYLES --- */

.carousel-container {
    position: relative;
    pointer-events: auto !important;
}

/* The viewport for the projects (hides non-visible cards, padding exposes neighbors) */
.project-wrapper {
    margin-top: 0px;
    overflow-x: auto;
    overflow-y: hidden;
    height: 400px;
    /* Padding exposes the neighbors and helps with centering */
    padding: 0 10%;
    scroll-behavior: smooth;
}

/* Custom scrollbar for project wrapper */
.project-wrapper::-webkit-scrollbar {
    height: 6px;
}

.project-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.project-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.project-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* The grid holds all cards */
.project-grid {
    display: flex;
    gap: 20px; /* Added gap between projects */
    padding: 0;
    width: fit-content;
}

/* Second carousel wrapper for Other Experiments */
.project-wrapper-2 {
    margin-top: 0px;
    overflow-x: auto;
    overflow-y: hidden;
    height: 400px;
    padding: 0 10%;
    scroll-behavior: smooth;
}

/* Custom scrollbar for second project wrapper */
.project-wrapper-2::-webkit-scrollbar {
    height: 6px;
}

.project-wrapper-2::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.project-wrapper-2::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.project-wrapper-2::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Second grid for Other Experiments */
.project-grid-2 {
    display: flex;
    gap: 20px;
    padding: 0;
    width: fit-content;
}

/* Project Card Styles: Responsive width */
.project-card {
    width: 80vw; /* Default: 80% of viewport width on mobile/small screens */
    max-width: 300px; /* Constraint on large screens */
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s ease;
    cursor: default;
    box-sizing: border-box;
    text-align: left;
}

/* Ensure card width respects max-width on larger screens */
@media (min-width: 768px) {
    .project-card {
        width: 300px; /* Fixed width for desktop view */
    }
}

.project-card:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
}

/* Carousel Button Styling */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 30;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: white;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    pointer-events: auto;
}

.carousel-btn.left-0 {
    left: 0;
    margin-left: -24px;
}

.carousel-btn.right-0 {
    right: 0;
    margin-right: -24px;
}

.carousel-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-50%) scale(1.05);
}

.carousel-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: translateY(-50%);
}

/* --- END CAROUSEL STYLES --- */

h1 {
    font-family: 'Syncopate', sans-serif;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-size: clamp(2rem, 5vw, 5rem);
    margin: 0;
    text-shadow: 0 0 20px rgba(255,255,255,0.5);
}

p {
    font-size: 1rem;
    line-height: 1.6;
    margin-top: 1rem;
}

.scroll-hint {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 0.8rem;
    animation: bounce 2s infinite;
    text-transform: uppercase;
    letter-spacing: 2px;
    z-index: 10;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateX(-50%) translateY(0);}
    40% {transform: translateX(-50%) translateY(-10px);}
    60% {transform: translateX(-50%) translateY(-5px);}
}

.vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 50%, black 150%);
    pointer-events: none;
    z-index: 5;
}

.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 6;
}

/* Loading Screen */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #111;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    transition: opacity 1s ease;
}

.btn {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 20px;
    border: 1px solid white;
    color: white;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.8rem;
    transition: background 0.3s, color 0.3s;
    pointer-events: auto;
    cursor: pointer;
    border-radius: 4px;
}

.btn:hover {
    background: white;
    color: black;
}

.card-img-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: linear-gradient(45deg, #222, #333);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    letter-spacing: 2px;
    color: #555;
    border: 1px dashed #444;
}

#debug-scroll {
    color: #d4af37;
    text-shadow: 0 0 5px rgba(212, 175, 55, 0.5);
    font-weight: bold;
    font-size: 0.75rem;
    mix-blend-mode: normal;
}

/* Scene Debug Panel */
#scene-debug-panel {
    position: fixed;
    top: 80px;
    right: 1rem;
    width: 280px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    z-index: 100;
    color: white;
    font-size: 0.85rem;
    pointer-events: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.debug-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.toggle-btn:hover {
    transform: scale(1.2);
}

#scene-debug-panel.collapsed .toggle-btn {
    transform: rotate(180deg);
}

#scene-debug-panel.collapsed #debug-content {
    display: none;
}

#debug-content {
    padding: 16px;
    max-height: 70vh;
    overflow-y: auto;
}

.debug-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.debug-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.debug-section h4 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: #44aaff;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.control-group {
    margin-bottom: 12px;
}

.control-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
}

.control-group label span {
    color: #d4af37;
    font-weight: bold;
    float: right;
}

.control-group input[type="range"] {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #44aaff;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #66bbff;
    transform: scale(1.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #44aaff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.control-group input[type="range"]::-moz-range-thumb:hover {
    background: #66bbff;
    transform: scale(1.2);
}

.control-group input[type="color"] {
    width: 60px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
}

.reset-btn, .action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.action-btn {
    width: 100%;
    margin: 8px 0 0 0;
    padding: 8px 12px;
}

.reset-btn:hover, .action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.reset-btn:active, .action-btn:active {
    transform: scale(0.95);
}

/* Custom scrollbar for debug panel */
#debug-content::-webkit-scrollbar {
    width: 6px;
}

#debug-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

#debug-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#debug-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
