/* Reset and base styles */
:root {
    --navbar-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.7;
    transition: all 0.3s ease;
}

/* Theme variables */
.theme-white {
    --bg-color: #fafafa;
    --bg-color-rgb: 250, 250, 250;
    --text-color: #2c2c2c;
    --nav-bg: #fafafa;
    --border-color: #e0e0e0;
    --hover-color: #f0f0f0;
    --gap-color: #fafafa;
}

.theme-black {
    --bg-color: #000000;
    --bg-color-rgb: 0, 0, 0;
    --text-color: #e8e8e8;
    --nav-bg: #000000;
    --border-color: #333333;
    --hover-color: #1a1a1a;
    --gap-color: #000000;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Header and Navigation */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--navbar-height);
    padding: 0 2.5rem;
    background-color: rgba(var(--bg-color-rgb), 0.90);
    border-bottom: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-brand h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--text-color);
}

.theme-toggle {
    display: flex;
    align-items: center;
}

.theme-button {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-button:hover {
    background-color: var(--hover-color);
}

.theme-icon {
    font-size: 1.2rem;
}

/* Navigation - Adventure Menu */
.adventure-nav {
    position: relative;
}

/* Centered dropdown in navbar */
.adventure-nav.center-dropdown {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* Adventure title button - styled like the breadcrumb titles */
.adventure-title-button {
    background: none;
    border: none;
    color: var(--text-color);
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: opacity 0.3s ease;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.adventure-title-button:hover {
    opacity: 0.7;
}

.adventure-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) scaleY(0.95);
    background-color: var(--nav-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-top: 0.5rem;
    display: flex;
    flex-direction: row;
    gap: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform-origin: top center;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 200;
}

.adventure-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scaleY(1);
}

/* Year column in dropdown */
.adventure-year-column {
    display: flex;
    flex-direction: column;
    min-width: 220px;
    border-right: 1px solid var(--border-color);
    white-space: nowrap;
}

.adventure-year-column:last-child {
    border-right: none;
}

/* Year header - clickable link */
.adventure-year-header {
    display: block;
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    text-decoration: none;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-align: center;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.adventure-year-header:hover {
    background-color: var(--hover-color);
    opacity: 0.8;
}

.adventure-item {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.2s ease;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

.adventure-year-column .adventure-item:last-child {
    border-bottom: none;
}

.adventure-item:hover {
    background-color: var(--hover-color);
}

/* Responsive: Stack columns on mobile */
@media (max-width: 600px) {
    .adventure-menu {
        flex-direction: column;
        max-width: 90vw;
    }

    .adventure-year-column {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .adventure-year-column:last-child {
        border-bottom: none;
    }
}

.home-link {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.home-link:hover {
    opacity: 0.8;
}

/* Main content */
main {
    padding: 0;
}

/* Gallery Section */
.gallery-section,
.adventure-gallery-section {
    width: 100%;
    padding: 0;
    margin-top: 0;
    padding-top: var(--navbar-height); /* Space for fixed navbar */
}

.gallery-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Gallery Grid - Masonry layout with JavaScript positioning */
.masonry-grid {
    position: relative;
    width: 100%;
    background-color: var(--gap-color);
}

.masonry-item {
    position: absolute;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    overflow: hidden;
}

.masonry-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.2s ease, opacity 0.3s ease;
    border: none; /* Remove border for cleaner look */
    opacity: 1;
}

.gallery-photo {
    opacity: 1;
    filter: none;
    backface-visibility: hidden;
}

.masonry-item:hover img {
    transform: scale(1.03);
    opacity: 0.95;
}

.masonry-item:hover {
    z-index: 10;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
        flex-wrap: wrap;
    }

}


/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(var(--bg-color-rgb), 0.85);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 0;
}

.lightbox.active {
    display: block;
    opacity: 1;
}

.lightbox-content {
    position: absolute;
    top: 1.5vh;
    bottom: 1.5vh;
    left: 50%;
    transform: translateX(-50%);
    max-width: 95vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.lightbox-close {
    display: none;
}

.lightbox-image-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#lightbox-img {
    max-width: 95vw;
    max-height: calc(100vh - 3vh);
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    cursor: zoom-in;
    /* No transition for instant zoom */
}

#lightbox-img.zoomed {
    cursor: zoom-out;
}

/* Zoom tooltip */
.zoom-tooltip {
    display: none;
}

.lightbox-metadata {
    display: none;
}

.lightbox-metadata h3 {
    display: none;
}

.metadata-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
}

.metadata-item {
    display: inline;
}

.metadata-label {
    display: none;
}

.metadata-value {
    font-size: 0.8rem;
    font-weight: 400;
    color: #666;
}

.metadata-item:not(:last-child) .metadata-value::after {
    content: "  ·  ";
    color: #999;
}

.lightbox-nav {
    display: none;
}

.nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(128, 128, 128, 0.3);
    border: none;
    color: var(--text-color);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    z-index: 1001;
}

#prev-btn {
    left: 1.5vw;
}

#next-btn {
    right: 1.5vw;
}

.nav-btn:hover {
    background: rgba(128, 128, 128, 0.5);
}

/* Responsive lightbox */
@media (max-width: 768px) {
    .lightbox {
        padding: 1rem 0.5rem 0.5rem 0.5rem;
    }

    .lightbox-content {
        top: 1vh;
        bottom: 1vh;
        max-width: 98%;
    }

    #lightbox-img {
        max-height: calc(100vh - 2vh);
    }

    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 30px;
        height: 30px;
        font-size: 20px;
    }
}

/* Loading animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    font-size: 1.2rem;
    color: var(--text-color);
    opacity: 0.7;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 1px;
    color: var(--text-color);
    opacity: 0.6;
}

/* ============================================
   MOBILE-FRIENDLY RESPONSIVE DESIGN
   ============================================ */

/* Tablet and below (768px) */
@media (max-width: 768px) {
    /* Reduce navbar padding */
    .navbar {
        padding: 0 1.5rem;
    }

    /* Adjust brand text for smaller screens */
    .nav-brand h1 {
        font-size: 1.25rem;
        letter-spacing: 2px;
    }

    /* Make adventure dropdown full width on tablet */
    .adventure-menu {
        max-width: 90vw;
    }

    /* Larger lightbox nav buttons */
    .nav-btn {
        width: 52px;
        height: 52px;
        font-size: 30px;
    }

    #prev-btn {
        left: 10px;
    }

    #next-btn {
        right: 10px;
    }
}

/* Mobile devices (480px and below) */
@media (max-width: 480px) {
    /* Compact navbar for small screens */
    .navbar {
        padding: 0 1rem;
        height: 50px;
        justify-content: flex-end; /* Push theme toggle to right */
    }

    :root {
        --navbar-height: 50px;
    }

    /* Hide brand name on mobile to prevent overlap */
    .nav-brand {
        display: none;
    }

    /* Smaller adventure button */
    .adventure-title-button {
        font-size: 1rem;
        letter-spacing: 1px;
        padding: 0.5rem 0.75rem;
    }

    /* Theme button - ensure minimum tap target */
    .theme-button {
        min-width: 44px;
        min-height: 44px;
    }

    /* Adventure menu - full width on mobile */
    .adventure-menu {
        left: 0;
        right: 0;
        transform: translateX(0) scaleY(0.95);
        max-width: 100vw;
        max-height: 70vh;
        overflow-y: auto;
        margin-top: 0.25rem;
    }

    .adventure-menu.active {
        transform: translateX(0) scaleY(1);
    }

    .adventure-year-column {
        min-width: 100%;
    }

    /* Adjust adventure menu text size */
    .adventure-year-header {
        font-size: 0.9rem;
        letter-spacing: 2px;
        padding: 0.65rem 1.25rem;
    }

    .adventure-item {
        font-size: 0.8rem;
        letter-spacing: 1.5px;
        padding: 0.65rem 1.25rem;
    }

    /* Gallery adjustments */
    .gallery-section,
    .adventure-gallery-section {
        padding-top: 50px;
    }

    .masonry-grid {
        padding: 0 5px;
    }

    /* Lightbox mobile optimizations */
    .lightbox {
        padding: 0;
    }

    .lightbox-content {
        top: 0.5vh;
        bottom: 0.5vh;
        max-width: 100vw;
    }

    #lightbox-img {
        max-width: 100vw;
        max-height: calc(100vh - 1vh);
        border-radius: 0;
    }

    /* Show close button on mobile */
    .lightbox-close {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 10px;
        right: 10px;
        width: 44px;
        height: 44px;
        font-size: 28px;
        color: var(--text-color);
        cursor: pointer;
        z-index: 1002;
        background: rgba(128, 128, 128, 0.4);
        backdrop-filter: blur(10px);
        border-radius: 50%;
        border: none;
    }

    /* Larger, more touch-friendly nav buttons */
    .nav-btn {
        width: 56px;
        height: 56px;
        font-size: 32px;
        padding: 0.5rem;
    }

    #prev-btn {
        left: 8px;
    }

    #next-btn {
        right: 8px;
    }

    /* Metadata - stack vertically if needed */
    .metadata-grid {
        flex-wrap: wrap;
        gap: 0.25rem 0.5rem;
    }

    .metadata-value {
        font-size: 0.75rem;
    }

    /* Footer adjustments */
    .site-footer {
        padding: 1.5rem 1rem;
        font-size: 0.7rem;
    }

    /* Reduce body text size slightly */
    body {
        font-size: 15px;
        line-height: 1.6;
    }
}

/* Very small devices (360px and below) */
@media (max-width: 360px) {
    .navbar {
        padding: 0 0.75rem;
    }

    .nav-brand h1 {
        font-size: 0.8rem;
        letter-spacing: 0.5px;
    }

    .adventure-title-button {
        font-size: 0.9rem;
        letter-spacing: 0.5px;
    }

    .nav-btn {
        width: 48px;
        height: 48px;
        font-size: 28px;
    }

    #prev-btn {
        left: 5px;
    }

    #next-btn {
        right: 5px;
    }
}

/* Landscape orientation on mobile devices */
@media (max-width: 768px) and (orientation: landscape) {
    .navbar {
        height: 45px;
    }

    :root {
        --navbar-height: 45px;
    }

    .gallery-section,
    .adventure-gallery-section {
        padding-top: 45px;
    }

    /* Adjust lightbox for landscape */
    #lightbox-img {
        max-height: calc(100vh - 10px);
    }
}

/* Remove hover effects on touch devices */
@media (hover: none) and (pointer: coarse) {
    .masonry-item:hover img {
        transform: none;
        opacity: 1;
    }

    .masonry-item:hover {
        z-index: 1;
    }

    /* Add active state for touch feedback instead */
    .masonry-item:active img {
        opacity: 0.9;
    }

    .theme-button:hover,
    .adventure-title-button:hover,
    .adventure-item:hover,
    .adventure-year-header:hover {
        opacity: 1;
        background-color: transparent;
    }

    /* Active states for touch feedback */
    .theme-button:active,
    .adventure-title-button:active {
        opacity: 0.7;
    }

    .adventure-item:active,
    .adventure-year-header:active {
        background-color: var(--hover-color);
    }
}
