* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Century Gothic', CenturyGothic, AppleGothic, sans-serif;
    overflow: hidden; /* Prevent scrolling until loaded */
    background-color: white;
}

/* New Loader Styles */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 2000; /* Highest Z-index */
    display: flex;
    flex-direction: column; /* Added for stacking spinner and text */
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.5s ease;
}

#loadingOverlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3; /* Light grey */
    border-top: 3px solid #3c3c3c; /* Dark grey */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px; /* Separator for the new text */
}

/* Updated style for the countdown text */
.loading-text {
    font-size: 14px;
    color: #3c3c3c;
    font-weight: bold;
    text-align: center; /* Ensures multiple lines (like "xx sec") are centered */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    z-index: 1000;
    color: black;
}

.logo {
    cursor: pointer;
}

/* Desktop Logo */
.logo-desktop {
    font-size: 15px;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: block;
}

/* Mobile Logo (Hidden by default) */
.logo-mobile {
    display: none;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.logo-top {
    font-size: 16px;
    letter-spacing: 1px;
    font-weight: bold;
}

.logo-bottom {
    font-size: 7.5px; /* Calculated to match width of J.S.FREY */
    letter-spacing: 2.8px;
    margin-right: -2.8px; /* Compensate for last letter spacing */
}

.header-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    letter-spacing: 1px;
}

/* Desktop Navigation */
nav {
    display: flex;
    gap: 40px;
    position: relative;
}

.nav-item {
    font-size: 14px;
    letter-spacing: 1px;
    cursor: pointer;
    padding: 20px 15px;
    position: relative;
    transition: background 0.3s ease;
}

.nav-item:hover {
    background: rgba(200, 200, 200, 0.5);
}

.dropdown {
    position: absolute;
    top: 60px;
    right: 0;
    background: rgba(220, 220, 220, 0.95);
    display: none;
    flex-direction: column;
    min-width: 180px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.dropdown.active {
    display: flex;
}

.dropdown-item {
    padding: 15px 20px;
    cursor: pointer;
    transition: background 0.3s ease;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.dropdown-item:hover {
    background: rgba(180, 180, 180, 0.95);
}

/* Hamburger Menu (Hidden on Desktop) */
.hamburger {
    display: none;
    width: 24px;
    height: 20px;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: black;
    transition: all 0.3s ease;
}

/* Hamburger Animation */
.hamburger.open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
.hamburger.open span:nth-child(2) {
    opacity: 0;
}
.hamburger.open span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Mobile Menu Overlay */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-menu.active {
    opacity: 1;
    pointer-events: auto;
}

.mobile-nav-item {
    font-size: 20px;
    margin: 15px 0;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.mobile-sub-menu {
    display: none;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 20px;
}

.mobile-sub-menu.active {
    display: flex;
}

.mobile-sub-item {
    font-size: 16px;
    padding: 10px;
    color: #555;
    cursor: pointer;
}

/* Stage */
.stage {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    border-top: 1px solid black;
}

.stage > * {
    animation: fadeInStage 0.5s ease;
}

@keyframes fadeInStage {
    from { opacity: 0; }
    to { opacity: 1; }
}

.landing {
    width: 100%;
    height: 100%;
    background-image: url('https://jsfrey.eu/images/landing-background.jpg');
    background-size: cover;
    background-position: center;
}

.gallery-view {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px;
    position: relative;
}

.image-container {
    display: flex;
    gap: 15px;
    align-items: center; /* Center vertically */
    justify-content: center;
    flex-grow: 1; /* Allow container to fill space */
    max-height: calc(100vh - 200px); /* Leave room for header and captions */
    width: 100%;
    opacity: 0;
    animation: fadeIn 0.6s ease forwards;
    margin: 0;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.image-container img {
    max-height: 100%;
    max-width: 100%;
    height: auto;
    width: auto;
    object-fit: contain;
    display: block;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.caption-container {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
    min-height: 40px;
}

.caption-box {
    text-align: center;
    font-size: 13px;
    letter-spacing: 0.5px;
    padding: 5px 0;
}

/* Navigation Controls */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    opacity: 0.3;
    transition: opacity 0.3s ease;
    z-index: 100;
    pointer-events: none;
}

.nav-clickable-area:hover ~ .nav-arrow {
    opacity: 0.7;
}

.nav-arrow.left { left: 20px; }
.nav-arrow.right { right: 20px; }

.nav-arrow svg {
    width: 100%;
    height: 100%;
}

.nav-clickable-area {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 20%; /* Reduced from 45% to prevent accidental clicks */
    cursor: pointer;
    z-index: 50;
}

.nav-clickable-area.left { left: 0; }
.nav-clickable-area.right { right: 0; }

/* About Page */
.about-page {
    position: relative;
    width: 100%;
    height: 100%;
    /* Let the wrapper handle scroll in wide view, but this is the fallback for narrow view */
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch;
}

.about-background-container {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
}

.about-bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

.about-bg-1 { background-image: url('images/about.jpg'); opacity: 1; }
.about-bg-2 { background-image: url('images/about2.jpg'); opacity: 0; transition: opacity 3s ease-in-out; }
.about-bg-2.visible { opacity: 1; }

/* CORRECTED: Wide Viewport Layout (starts 530px from left) */
.about-content-wrapper {
    position: absolute;
    z-index: 1;
    top: 4rem; 
    bottom: 4rem; /* Vertically constrained to enable scrolling */
    left: 530px; /* Starts 530px from the LEFT edge */
    right: 0; /* Goes to the RIGHT edge */
    min-width: 450px; /* Minimum width constraint */
    padding: 0 40px; /* 40px padding on the right (and left to keep text off the boundary) */
    
    /* Enable scrolling within this fixed box if content overflows vertically */
    overflow-y: auto; 
    
    /* Use Flexbox to CENTER the text block horizontally within this flexible container */
    display: flex; 
    justify-content: center; 
}

/* Text block itself */
.about-text {
    color: #DDDDDD;
    font-weight: 300;
    font-size: 1.0rem;
    line-height: 1.9;
    
    /* Constrain max width for readability (less than the min-width of 450px + 80px padding) */
    max-width: 700px; 
    
    /* Margin is 0 because the parent flex container centers it */
    margin: 0; 
}

.about-text p { margin-bottom: 1.5rem; }
.about-divider { width: 100%; height: 1px; background: #444; margin: 3rem 0 2rem 0; }
.about-text .concluding-paragraph { color: #ccc; font-style: italic; font-weight: 300; }

/* Contact Page */
.contact-page {
    width: 100%;
    height: 100%;
    background-image: url('https://jsfrey.eu/images/contact.jpg');
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.contact-form {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    max-width: 500px;
    width: 90%;
}

.contact-form input, .contact-form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    font-family: 'Century Gothic', sans-serif;
    font-size: 14px;
}

.contact-form button {
    background: #3c3c3c;
    color: white;
    padding: 12px 30px;
    border: none;
    cursor: pointer;
    font-family: 'Century Gothic', sans-serif;
    font-size: 14px;
    letter-spacing: 1px;
}

.hover-preview {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    animation: fadeInStage 1.2s ease;
}

/* Media Query for viewports up to 980px - Centered Layout */
@media (max-width: 980px) {
    .about-content-wrapper {
        position: relative; /* Reset position */
        left: auto; /* Remove hard left position */
        right: auto;
        top: auto;
        bottom: auto;
        min-width: 0; 
        
        /* Reset flex properties and revert to block flow */
        display: block; 
        justify-content: flex-start;
        overflow-y: visible; /* Let parent handle scroll */
        
        /* Centered Block Layout (moves left and eventually centers) */
        max-width: 750px; 
        margin: 4rem auto; /* Vertical margin and horizontal centering */
        padding: 0 40px; /* Symmetric padding */
    }
    
    .about-text {
        max-width: 100%; /* Allow text to fill the 750px max-width container */
        margin: 0; 
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    header {
        padding: 0 20px;
        height: 50px;
    }
    
    /* Toggle Logo styles */
    .logo-desktop { display: none; }
    .logo-mobile { display: flex; }
    
    .header-title { display: none; } /* Hide gallery title in header on mobile to save space */
    
    nav { display: none; } /* Hide Desktop Nav */
    .hamburger { display: flex; } /* Show Hamburger */
    
    .stage { top: 50px; }
    
    .gallery-view {
        padding: 10px; /* Minimized padding */
        justify-content: center;
    }
    
    .image-container {
        max-height: calc(100vh - 120px); /* Adjusted for mobile header + caption */
        width: 100%;
    }
    
    .caption-container {
        margin-top: 10px;
        flex-direction: column;
        align-items: center;
    }
    
    .caption-box {
        font-size: 12px;
        padding: 5px;
        width: 100% !important; /* Force full width on mobile */
    }
    
    .nav-arrow, .nav-clickable-area {
        display: none; /* Hide click zones on mobile, rely on swipe */
    }
    
    .about-content-wrapper {
        padding: 0 30px;
        margin: 2rem auto;
        transform: translateX(0);
    }
    
    .about-text {
        font-size: 0.9rem;
        line-height: 1.7;
    }
    
    .contact-form { padding: 25px; }
}