/* =========================================
   SPA STRUCTURE
   ========================================= */

/* By default, hide all sections */
.page-section {
    display: none;
    width: 100%;
    animation: fadeIn 0.5s ease; /* Smooth transition */
}

/* Only show the active section */
.page-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- RESET & BASIC STYLES --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    width: 100%;
    height: 100%;
    background-color: #F0EFE6; /* The cream background */
    font-family: 'Cinzel', serif;
    color: #1a1a1a;
    overflow: hidden; 
}

/* --- ANIMATION CONTAINER OVERRIDES --- */
/* We need to position the container Animate created */
#animation_container {
    position: absolute !important; /* Force it to stay in place */
    z-index: 1; /* Background layer */
    
    /* NPerfect Centering Trick */
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    
    /* Reset old positioning values to avoid conflicts */
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
}

/* Ensure the canvas is transparent so the cream background shows */
canvas {
    background-color: transparent !important;
}

/* --- NAVIGATION --- */
nav {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10; 
}

.logo {
    width: 50px;
    height: 50px;
    background-color: #2b2b2b;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.logo-circle {
    width: 25px;
    height: 25px;
    border: 1px solid #f6a136;
    border-radius: 50%;
}

.menu-btn {
    width: 40px;
    height: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    z-index: 20; 
}

.menu-line {
    width: 100%;
    height: 4px;
    background-color: #2b2b2b;
    border-radius: 2px;
}

/* --- HERO TEXT --- */
.hero-text {
    position: absolute;
    top: 10%; /* Text is positioned here */
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    text-align: center;
    width: 100%;
    pointer-events: none; /* Let clicks pass through text */
}

h1 {
    font-size: 3.5rem;
    letter-spacing: 2px;
    font-weight: 400;
    color: #2b2b2b;
    text-transform: uppercase;
}

/* Mobile Tweaks */
@media (max-width: 768px) {
    h1 { font-size: 2rem; padding: 0 20px; }
    nav { padding: 20px; }
    /* On mobile, you might want to push it down even further */
    #animation_container { top: 50% !important; }
}

/* --- NAVIGATION OVERLAY --- */
#nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 50%; /* Half screen */
    height: 100%;
    background-color: #0f0f0f; /* Dark charcoal */
    z-index: 100;
    padding: 60px;
    
    /* Animation State: Slide out to the left by default */
    transform: translateX(-100%);
    
    /* FIX: Shadow is transparent (invisible) by default */
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); 
    
    /* Smooth transition for both the slide AND the shadow fade */
    transition: transform 0.5s cubic-bezier(0.77, 0, 0.175, 1), box-shadow 0.5s ease;
    
    display: flex;
    flex-direction: column;
}

/* Class to show the menu */
#nav-overlay.active {
    transform: translateX(0%); /* Slide in */
    
    /* FIX: The shadow only appears when active */
    box-shadow: 0 0 0 100vw rgba(0, 0, 0, 0.8); /* Darkens the rest of the screen */
}

/* --- NAV HEADER --- */
.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    color: #f6a136;
}

.nav-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    opacity: 0.7;
}

/* Close Button Box */
.close-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #f6a136;
    cursor: pointer;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease;
}

.close-btn:hover {
    background-color: rgba(197, 160, 89, 0.1);
}

.close-line {
    position: absolute;
    width: 20px;
    height: 2px;
    background-color: #f6a136;
}

.rotate-45 { transform: rotate(45deg); }
.rotate-minus-45 { transform: rotate(-45deg); }


/* --- NAV CONTENT --- */
.nav-content {
    display: flex;
    flex: 1;
    height: 100%;
    flex-direction: column; 
    justify-content: space-between;
}

/* Left Column (Links) */
.nav-left {
    flex: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.main-links {
    list-style: none;
}

.main-links li {
    margin-bottom: 25px;
}

.main-links a {
    text-decoration: none;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 200;
    transition: color 0.3s ease;
    font-family: 'Cinzel', serif;
}

.main-links a:hover {
    color: #f6a136;
    padding-left: 10px;
}

/* Horizontal Line */
.nav-separator {
    width: 100%;
    height: 1px;
    background-color: #f6a136;
    opacity: 0.3;
    margin: 30px 0;
}

/* Right Column (Previews) */
.nav-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.nav-preview-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.nav-preview-item:hover {
    opacity: 1;
}

/* Container for the icon */
.nav-icon-placeholder {
    width: 50px;
    height: 50px;
    /* Optional: Keep the gold background if you want a box behind the logo. 
       If you want JUST the logo, change this to 'transparent' */
    background-color: #f6a136;
    border-radius: 4px;
    margin-right: 15px;
    
    /* Center the image inside the box */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* NEW RULE: This forces the image to fit the box */
.nav-icon-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Ensures the logo scales without stretching */
    display: block;      /* Removes extra spacing below image */
}

.nav-preview-text {
    font-size: 1rem;
    color: #f6a136;
    font-weight: 400;
}

/* --- RESPONSIVE --- */
@media (min-width: 1200px) {
    .nav-content { flex-direction: row; }
    .nav-separator { width: 1px; height: 100%; margin: 0 30px; }
    .nav-left { align-items: flex-start; }
    .nav-right { justify-content: center; }
}

@media (max-width: 768px) {
    #nav-overlay { width: 100%; } 
    .main-links a { font-size: 2rem; }
}

/* =========================================
   PAGE: LABYRINTH
   ========================================= */

/* Specific Body Style for Labyrinth Page */
body.page-labyrinth {
    /* Set the background image */
    background-image: url('images/lab-full.png');
    background-size: contain;   /* Ensure entire image is visible */
    background-position: center center; /* Center it */
    background-repeat: no-repeat; /* Do not tile the image */
    background-attachment: fixed;
    
    /* --- CHANGE THIS LINE --- */
    /* Set the color that fills the empty space around the image */
    background-color: #132039; 
    /* ------------------------ */
    
    /* Use flexbox to easily position the corner buttons */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px;
    
    /* Ensure body takes full height so flexbox works */
    min-height: 100vh; 
}

/* --- TOP LEFT CLOSE BUTTON --- */
.lab-close-btn {
    width: 50px;
    height: 50px;
    border: 2px solid #f6a136; /* New Orange */
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    position: fixed; /* Fix to corner */
    top: 40px;
    left: 40px;
    z-index: 20;
}

.lab-close-btn:hover {
    background-color: rgba(246, 161, 54, 0.1); /* Subtle orange tint */
    box-shadow: 0 0 15px rgba(246, 161, 54, 0.3);
}

/* The 'X' inside the button using pure CSS */
.x-mark {
    width: 20px;
    height: 20px;
    position: relative;
}

.x-mark::before,
.x-mark::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: #f6a136; /* New Orange */
    top: 50%;
    left: 0;
    transition: transform 0.3s ease;
}

.x-mark::before { transform: rotate(45deg); }
.x-mark::after { transform: rotate(-45deg); }

/* Rotate animation on hover */
.lab-close-btn:hover .x-mark::before { transform: rotate(135deg); }
.lab-close-btn:hover .x-mark::after { transform: rotate(45deg); }


/* --- BOTTOM RIGHT NEXT BUTTON --- */
.lab-next-btn {
    position: fixed;
    bottom: 40px;
    right: 40px;
    
    padding: 12px 40px;
    background-color: #f6a136; /* New Orange */
    color: #fff; /* White text looks cleaner on orange */
    
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: 1px;
    
    border-radius: 30px; /* Pill shape */
    transition: all 0.3s ease;
    z-index: 20;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.lab-next-btn:hover {
    background-color: #e58e25; /* Slightly darker orange on hover */
    transform: translateY(-3px); /* Float up effect */
    box-shadow: 0 8px 20px rgba(246, 161, 54, 0.4);
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    .lab-close-btn {
        top: 20px;
        left: 20px;
        width: 40px;
        height: 40px;
    }
    
    .lab-next-btn {
        bottom: 30px;
        right: 20px; /* Center it or keep right? Keep right is standard */
        font-size: 1rem;
        padding: 10px 30px;
    }
}

/* =========================================
   PAGE: THE FLIGHT (Sunset Theme)
   ========================================= */

body.page-flight {
    /* Ensure your image is named 'flight-full.png' in the images folder */
    /* background-image: url('images/flight-full.png'); */
    
    background-size: cover; /* Cover usually works best for landscapes/clouds */
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    
    /* Fallback color (Warm Orange) */
    background-color: #d88c4b; 
    
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px;
    min-height: 100vh;
}

/* --- OVERRIDES FOR FLIGHT PAGE COLORS --- */

/* 1. Close Button: Change from Orange to Dark Brown for contrast */
.flight-close-override {
    border-color: #3b2618 !important; /* Dark Coffee Brown */
}

.flight-close-override .x-mark::before,
.flight-close-override .x-mark::after {
    background-color: #3b2618 !important; /* Dark X */
}

.flight-close-override:hover {
    background-color: rgba(59, 38, 24, 0.1) !important;
}

/* 2. Next Button: Change to the Terracotta/Rose color from image */
.flight-next-override {
    background-color: #bd8366 !important; /* Dusty Terracotta */
    color: #fff !important;
    box-shadow: 0 4px 15px rgba(59, 38, 24, 0.3) !important;
}

.flight-next-override:hover {
    background-color: #a36e53 !important; /* Slightly darker on hover */
    transform: translateY(-3px);
}

/* =========================================
   PAGE: THE FALL (Night Mountain Theme)
   ========================================= */

body.page-fall {
    /* Ensure your image is named 'fall-full.png' in the images folder */
    /* background-image: url('images/fall-full.png'); */
    
    background-size: cover; /* Cover works best for this landscape */
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    
    /* Fallback color (Muted Blue-Grey from the sky) */
    background-color: #5d7293; 
    
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px;
    min-height: 100vh;
}

/* --- OVERRIDES FOR FALL PAGE COLORS --- */

/* 1. Close Button: Bright Orange to pop against the dark blue sky */
.fall-close-override {
    border-color: #f6a136 !important; /* Your Orange */
}

.fall-close-override .x-mark::before,
.fall-close-override .x-mark::after {
    background-color: #f6a136 !important;
}

.fall-close-override:hover {
    background-color: rgba(246, 161, 54, 0.1) !important;
    box-shadow: 0 0 15px rgba(246, 161, 54, 0.3);
}

/* 2. Next Button: Terracotta/Rose to match your screenshot */
.fall-next-override {
    background-color: #bd8366 !important; /* Dusty Terracotta */
    color: #fff !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

.fall-next-override:hover {
    background-color: #a36e53 !important;
    transform: translateY(-3px);
}

/* =========================================
   PAGE: REFLECTION (The Labyrinth Theme)
   ========================================= */

body.page-reflection {
    background-color: #F0EFE6; /* Cream background */
    width: 100%;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden; /* No scrolling */
    
    display: flex;
    justify-content: center; /* Center horizontally */
    align-items: center;     /* Center vertically */
    font-family: "Garamond", "Baskerville", "Playfair Display", serif; /* Serif font matches image */
}

/* The Container - Holds the box in the center */
.reflection-container {
    width: 100%;
    height: 100%;
    /* Reduced side padding so the banner is wider like the screenshot */
    padding: 0 40px; 
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

/* The Terracotta Box (The Banner) */
.reflection-box {
    background-color: #c08b6e; /* Muted Terracotta */
    width: 100%;
    
    /* HEIGHT CHANGE: 
       Instead of fixed height (90%), we use 'auto' and padding 
       to create the wide banner strip look. */
    height: 90%;
    padding: 100px 60px; /* Large vertical padding creates the banner height */
    
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    
    color: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

/* Typography */

.reflection-box h2 {
    font-size: 4.5rem; /* Large Title */
    font-weight: 700; /* Bold */
    margin: 0 0 30px 0; /* Spacing below title */
    letter-spacing: 2px;
    text-transform: uppercase; /* Forces "THE LABYRINTH" */
    line-height: 1.1;
}

.reflection-box p {
    font-size: 2.4rem; /* Reduced slightly to match hierarchy in image */
    font-weight: 400;
    line-height: 1.6;
    max-width: 1600px; /* Limits line length for readability */
    margin: 0;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .reflection-container { 
        padding: 20px; 
    }
    
    .reflection-box { 
        padding: 60px 30px; /* Smaller banner on phone */
    }

    .reflection-box h2 { 
        font-size: 2.2rem; 
        margin-bottom: 20px;
    }
    
    .reflection-box p { 
        font-size: 1.1rem; 
    }
}

/* =========================================
   PAGE: ABOUT ME (Updated Layout)
   ========================================= */

body.page-about {
    background-color: #F0EFE6;
    width: 100%;
    min-height: 100vh;
    color: #1a1a1a;
}

.about-container {
    display: flex;
    height: 100vh;
    padding-top: 80px; /* Space for navbar */
    box-sizing: border-box;
}

/* --- Left Column (Image) --- */
.about-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

/* The wrapper allows us to control the image aspect ratio */
.image-wrapper {
    width: 100%;
    max-width: 750px; /* Limits size on big screens */
    height: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); /* Subtle shadow for depth */
}

.about-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* --- Right Column (Text) --- */
.about-text {
    flex: 1;
    padding: 60px 80px 60px 40px; /* Extra padding on right */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.about-text h1 {
    font-family: 'Montserrat', sans-serif; /* Clean thin header */
    font-size: 3.5rem;
    font-weight: 300; /* Thin font weight */
    margin-bottom: 20px;
    color: #1a1a1a;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* The Horizontal Line */
.about-separator {
    width: 100%;
    max-width: 100%;
    border: none;
    height: 1px;
    background-color: #1a1a1a; /* Dark line */
    margin-bottom: 40px;
}

.about-body p {
    font-family: 'Montserrat', sans-serif; /* Clean sans-serif like the image */
    font-size: 1.1rem;
    font-weight: 600; /* Bold/Heavy weight as shown in screenshot */
    line-height: 1.6;
    margin-bottom: 25px;
    color: #1a1a1a;
    max-width: 850px;
}

/* --- Mobile Responsive --- */
@media (max-width: 1024px) {
    .about-container {
        flex-direction: column;
        height: auto;
        padding-top: 100px;
    }

    .about-image {
        padding: 20px;
        order: -1; /* Image stays on top on mobile */
    }
    
    .about-text {
        padding: 40px;
        text-align: left;
    }
    
    .about-text h1 { font-size: 2.5rem; }
}

/* =========================================
   PAGE: BEHIND THE WINGS (Gallery)
   ========================================= */

body.page-behind {
    background-color: #F0EFE6;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.behind-container {
    display: flex;
    height: 100vh;
}

/* --- Left Side: The Grid --- */
.behind-grid {
    margin-top: 120px; /* Space for nav */
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    
    /* CSS Grid Layout */
    display: grid;
    
    /* --- CHANGED TO FIXED 3 COLUMNS --- */
    grid-template-columns: repeat(3, 1fr); 
    /* ---------------------------------- */
    
    /* Keep the rows a fixed height so they look uniform */
    grid-auto-rows: 150px; /* I increased this slightly from 120px to look better */
    gap: 20px;
    align-content: start;
}

/* The Grid Item Box */
.grid-item {
    background-color: #fff;
    border: 2px solid #2b2b2b; /* Dark border like screenshot */
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: all 0.2s ease;
    
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.grid-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.grid-item:hover {
    transform: scale(1.05);
}

/* The Active State (Selected Item) */
.grid-item.active {
    border-color: #f6a136; /* Match the right side color */
    box-shadow: 0 0 0 2px #f6a136; /* Double border effect */
}

/* --- Right Side: The Preview --- */
.behind-preview {
    flex: 1; /* 50% width */
    background-color: #f6a136; /* Mustard/Gold from design */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
    position: relative;
}

.preview-box {
    background-color: #fff; /* White paper background */
    width: 100%;
    max-width: 1200px;
    height: auto;
    aspect-ratio: 4/3; /* Keeps it rectangular like an artboard */
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#main-preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .behind-container { flex-direction: column; }
    .behind-grid { height: 40%; padding: 20px; }
    .behind-preview { height: 60%; padding: 20px; }
}

/* =========================================
   SOUND CONTROL (Bottom Left)
   ========================================= */
#sound-control {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 1000; /* Above everything */
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

#sound-control:hover {
    opacity: 1;
}

/* The Speaker Icon (Pure CSS) */
.speaker-icon {
    width: 6px;
    height: 10px;
    background: #C5A059; /* Gold */
    position: relative;
}

.speaker-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -4px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-right: 4px solid #C5A059;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
}

.speaker-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -8px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid #C5A059;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

/* Sound Waves (Animation) */
.sound-wave {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 15px;
}

.bar {
    width: 2px;
    background-color: #C5A059;
    height: 100%;
    animation: wave 1s infinite ease-in-out;
}

/* Animation Keyframes */
@keyframes wave {
    0%, 100% { height: 20%; }
    50% { height: 100%; }
}

.bar:nth-child(1) { animation-delay: 0s; }
.bar:nth-child(2) { animation-delay: 0.2s; }
.bar:nth-child(3) { animation-delay: 0.4s; }

/* MUTED STATE STYLES */
#sound-control.muted .sound-wave {
    display: none; /* Hide waves when muted */
}

#sound-control.muted .speaker-icon {
    opacity: 0.5; /* Dim the icon */
}

#sound-control.muted::after {
    /* Optional: Add a strikethrough line or text saying OFF */
    content: 'OFF';
    font-family: 'Cinzel', serif;
    font-size: 10px;
    color: #C5A059;
    margin-left: 5px;
}