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

/* Note: font-display=swap is set in the URL to prevent blocking */

/* ==========================================================================
   Variables & Reset
   ========================================================================== */
:root {
    --bg-color: #fafafa;
    --text-color: #333;

    /* Typography Scale - Fluid responsive sizing */
    --font-size-base: clamp(0.875rem, 1vw + 0.5rem, 1rem);
    /* 14px - 16px */
    --font-size-lg: clamp(1rem, 1.5vw + 0.5rem, 1.25rem);
    /* 16px - 20px */
    --font-size-xl: clamp(1.25rem, 2vw + 0.5rem, 1.5rem);
    /* 20px - 24px */
    --font-size-xxl: clamp(1.75rem, 3vw + 0.5rem, 2.25rem);
    /* 28px - 36px */

    --line-height-base: 1.6;
    --line-height-heading: 1.2;

    /* Spacing Scale */
    --space-xs: 0.5rem;
    /* 8px */
    --space-sm: 1rem;
    /* 16px */
    --space-md: 1.5rem;
    /* 24px */
    --space-lg: 2rem;
    /* 32px */
    --space-xl: 3rem;
    /* 48px */
    --space-xxl: 4rem;
    /* 64px */

    /* Focus ring color */
    --focus-color: #175c0e;

    --header-height: 60px;
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Improved focus states for accessibility */
*:focus-visible {
    outline: 2px solid var(--focus-color);
    outline-offset: 2px;
    border-radius: 2px;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--focus-color);
    outline-offset: 3px;
}



/* ==========================================================================
   Base Styles
   ========================================================================== */
html,
body {
    font-family: 'Noto Serif', serif;
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    background-color: var(--bg-color);
    height: 100vh;
    /* Use viewport height */
    margin: 0;
    padding: 0;
    scroll-behavior: smooth;
    display: flex;
    /* Flex layout for sticky header */
    flex-direction: column;
    overflow: hidden;
    /* Prevent body scroll */
}

/* Touch Actions */
[touch-action="none"] {
    touch-action: none;
}

[touch-action="auto"] {
    touch-action: auto;
}

[touch-action="pan-x"] {
    touch-action: pan-x;
}

[touch-action="pan-y"] {
    touch-action: pan-y;
}

[touch-action="pan-x pan-y"],
[touch-action="pan-y pan-x"] {
    touch-action: pan-x pan-y;
}

/* ==========================================================================
   Layout Components
   ========================================================================== */
/* 2) Fixed header with gradient */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    padding-inline: var(--space-xl);
    /* keep your horizontal padding */
    padding-block: 0;
    /* vertical padding handled by height */
    z-index: 9999;
    display: flex;
    align-items: center;
    font-size: 18px;

    background: linear-gradient(to bottom,
            #fafafa,
            rgba(250, 250, 250, 0.0) 100%);
}

.title {
    position: absolute;
    top: 10px;
    right: 20px;
    color: var(--text-color);
    font-weight: bold;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    animation: fadeIn 0.6s ease-out;
    margin-top: 0px;
    /* <— prevents overlap */
}

/* Text Area */
.text-area {
    padding: var(--space-lg);
    text-align: justify;
    overflow-y: auto;
    height: 100%;
    /* Fill available height */
    max-width: 55vw;
    color: #666;
    margin-top: 10vh
        /* Lighter text for non-heading content */
}

.text-area p {
    margin-bottom: var(--space-md);
}

.text-area h1,
.text-area h2,
.text-area h3,
.text-area h4 {
    color: var(--text-color);
    line-height: var(--line-height-heading);
    margin-bottom: var(--space-sm);
    margin-top: var(--space-lg);
}

.text-area h1:first-child,
.text-area h2:first-child,
.text-area h3:first-child,
.text-area h4:first-child {
    margin-top: 0;
}

.text-area h5,
.text-area h6 {
    color: var(--text-color);
    line-height: var(--line-height-heading);
}

/* About Page Sections */
.text-area section {
    margin-bottom: var(--space-xl);
}

.text-area section:last-child {
    margin-bottom: 0;
}

.text-area section a {
    color: inherit;
    position: relative;
    transition: color 0.3s ease;
}

.text-area section a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--text-color);
    transition: width 0.3s ease;
}

.text-area section a:hover::after {
    width: 100%;
}

.text-area section a:hover {
    color: gray;
}

.text-area section p+p {
    margin-top: calc(var(--space-md) * -0.5);
}

/* Trips Menu */
.trips-menu {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: flex-start;
}

.trips-menu a {
    color: inherit;
    text-decoration: none;
    position: relative;
    transition: color 0.3s ease;
    padding: 2px 0;
    display: inline-block;
}

.trips-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--text-color);
    transition: width 0.3s ease;
}

.trips-menu a:hover::after {
    width: 100%;
}

.trips-menu a:hover {
    color: #333;
}

/* Camera Gallery */
.camera-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-lg);
}

.camera-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.camera-item img {
    width: 100%;
    height: auto;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.camera-item img:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.camera-item figcaption {
    text-align: center;
    font-style: italic;
    font-size: 0.9rem;
    color: #666;
}

/* Image Area */
.image-area {
    flex: 1;
    position: relative;
    max-width: 80vw;
    height: 100%;
    /* Fill available height */
    overflow: hidden;
    width: auto;
    align-self: flex-start;
    contain: layout style paint;
    /* Performance hint for browser */
}



/* ==========================================================================
   Navigation Component
   ========================================================================== */
.left-menu {
    width: 200px;
    background-color: var(--bg-color);
    padding: 0px;
    height: 100%;
    position: relative;
    margin-left: 20px;
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
}

nav a {
    text-decoration: none;
    color: var(--text-color);
    font-size: var(--font-size-base);
    text-shadow: rgba(0, 0, 0, 0.1) 0px 0px 5px;
    position: relative;
    transition: color 0.3s ease;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--text-color);
    transition: width 0.3s ease;
}

nav a:hover::after {
    width: 100%;
}

nav a:hover {
    color: #175c0e;
    text-shadow: rgba(0, 0, 0, 0.1) 0px 0px 5px;
    cursor: default;
}

.active-link {
    font-weight: bold;
    color: #175c0e;
}

/* Mobile Menu */
.bottom-menu {
    position: fixed;
    bottom: -100%;
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 480px;

    /* Liquid glass background */
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.5) 0%,
            rgba(255, 255, 255, 0.3) 100%);

    /* Glassmorphism */
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);

    transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
    border-radius: 24px 24px 0 0;
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 24px 20px 32px;

    /* Modern shadows and borders */
    box-shadow:
        0 -12px 48px rgba(0, 0, 0, 0.12),
        0 -2px 12px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    border-bottom: none;
}

.bottom-menu.open {
    bottom: 0;
}

.bottom-menu nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.bottom-menu nav a {
    font-size: var(--font-size-base);
    text-decoration: none;
    padding: 12px 20px;
    display: block;
    text-align: center;
    color: var(--text-color);
    position: relative;
    transition: all 0.2s ease;
    font-weight: 500;
    width: fit-content;
    margin: 0 auto;
}

.bottom-menu nav a:hover {
    color: #000;
}

.menu-toggle {
    display: none;
    position: fixed;
    bottom: 15px;
    right: 15px;

    /* Liquid glass base */
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.4) 0%,
            rgba(255, 255, 255, 0.2) 100%);

    color: var(--text-color);
    font-weight: 600;
    border: none;
    font-size: 20px;
    text-align: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 3000;
    margin: 0;

    /* Frosted glass effect */
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);

    /* Glass borders */
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);

    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-toggle:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.5) 0%,
            rgba(255, 255, 255, 0.3) 100%);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    border-color: rgba(255, 255, 255, 0.4);
}

.menu-toggle:active {
    transform: translateY(0);
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.3) 0%,
            rgba(255, 255, 255, 0.1) 100%);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ==========================================================================
   Slideshow Component
   ========================================================================== */
.slideshow-container {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    height: 100%;
    transition: opacity 0.5s ease-in-out;
    opacity: 1;
    contain: layout style;
    /* Performance hint */
}

.fade-out {
    opacity: 0 !important;
}

.mySlides {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    justify-content: center;
    /* Center image vertically */
    opacity: 0;
    /* Start invisible for fade transition */
    transition: opacity .5s ease-in-out;
    margin-top: 60px;
}

.mySlides.active {
    opacity: 1;
}

.mySlides img {
    width: 100%;
    height: 80dvh;
    /* Dynamic viewport height for mobile */
    object-fit: contain;
    display: block;
    margin: 0;
    aspect-ratio: auto;
    /* Auto-calculate from image dimensions */
}

.mySlides img:not(:first-child) {
    display: none;
}

.mySlides:first-child {
    display: block;
}

/* Controls */
.prev,
.next,
.gallery {
    cursor: pointer;
    position: absolute;
    height: 100%;
    width: 33%;
    color: transparent;
    user-select: none;
    border-radius: 10px;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    /* Prevent tap highlight flash on mobile */
    z-index: 1000;
}

.next {
    right: 0;
}

.prev {
    left: 0;
}

.gallery {
    left: 33%;
    right: 33%;
    -webkit-tap-highlight-color: transparent;
    /* Prevent black flash on mobile tap */
}

.prev:hover {
    cursor: w-resize;
}

.next:hover {
    cursor: e-resize;
}

.gallery:hover {
    cursor: n-resize;
}

/* Hide navigation overlays on touch devices, show only on devices with precise pointer (mouse) */
@media (pointer: coarse) {

    .prev,
    .next {
        pointer-events: none;
        /* Disable click/tap on touch devices */
    }

    .gallery {
        /* Keep gallery toggle functional on touch */
        pointer-events: auto;
    }
}

/* ==========================================================================
   Gallery Component
   ========================================================================== */
.gallery-grid {
    display: flex;
    flex-wrap: wrap;
    margin-left: 0px;
    margin-right: 20px;
    max-width: 75vw;
    height: 100%;
    /* Fill available height */
    overflow: auto;
    transition: opacity 0.5s ease-in-out;
    opacity: 1;
    contain: layout style;
    /* Performance hint */
}

/* 3) Make the gallery (the scrolling container) start below the opaque part */
.gallery-grid {
    /* if .gallery-grid is the element that scrolls, add padding-top here */
    padding-top: var(--header-height);
    /* add a little breathing room so images don't butt up to the header */
    padding-top: calc(var(--header-height) + 0.5rem);

    /* preserve existing rules that make it scroll */
    overflow: auto;
    height: 100%;
    /* keep your existing layout behavior */

    scroll-padding-top: calc(var(--header-height) + 0.5rem);

}

.grid-container {
    display: grid;
    align-items: center;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    padding: 10px;
}

.grid-item {
    width: 100%;
    display: block;
    height: auto;
    aspect-ratio: auto;
    object-fit: cover;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    /* Modern shadow */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.grid-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.grid-item img {
    width: 100%;
    height: auto;
}


/* ==========================================================================
   Media Queries
   ========================================================================== */

/* Tablet and mobile breakpoint */
@media (max-width: 768px) {
    body {
        overflow: auto;
        padding: 0;
        margin: 0;
    }

    /* 2) Fixed header with gradient */
    header {
        position: relative;
    }

    .slideshow-container,
    .mySlides,
    .fullscreen-media {
        height: 100dvh;
        /* Already using dvh for mobile ✓ */
        width: 100%;
    }

    .left-menu {
        position: fixed;
        top: 0px;
        left: -200px;
        width: auto;
        height: 100%;
    }

    .text-area {
        max-width: 95vw;
    }

    .main-content {
        flex-direction: column;
        margin-right: 0;
        overflow: visible;
    }

    .image-area {
        flex: 1;
        padding: 0;
        margin-right: 1%;
        margin-left: 1%;
        position: relative;
        max-width: 100vw;
        max-height: 100vh;
        overflow: hidden;
        width: auto;
        align-self: flex-start;
    }

    .gallery-grid {
        display: flex;
        flex-wrap: wrap;
        margin: 0px;
        max-width: 100vw;
        height: auto;
        /* Allow natural height so page scrolls */
        overflow: visible;
        /* Scroll the entire page, not just this container */
        padding-top: 0;
        /* Reset padding since header is relative in narrow mode */
    }

    .grid-container {
        display: grid;
        align-items: top;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
        padding: 10px;
        margin-top: 40px;
    }

    /* Mobile Slideshow Adjustments */
    #slideshow-container {
        width: 100%;
        height: 100dvh;
        margin: 0;
        padding: 0;
    }

    .prev,
    .next {
        padding: 20px;
        /* Larger touch target */
        font-size: 24px;
        background-color: transparent;
        /* Make background invisible */
        -webkit-tap-highlight-color: transparent;
        /* Prevent black tap flash on mobile */
    }

    .gallery {
        padding: 20px;
        font-size: 24px;
        background-color: transparent;
        /* Make background invisible */
        left: 10%;
        right: 10%;
        /* Wider tap area - 60% of screen width */
        width: 80%;
    }

    .menu-toggle {
        display: block;
    }

    /* Mobile Menu specific overrides already handled in component section but ensuring visibility here */
    .bottom-menu {
        display: flex;
    }

    nav a {
        text-decoration: none;
        color: var(--text-color);
        text-shadow: rgba(0, 0, 0, 0.3) 0px 0px 5px;
    }

    .active-link {
        font-weight: bold;
        color: var(--text-color);
        text-shadow: var(--text-color) 0px 0px 2px;
    }

    /* Compact menu items for portrait */
    .bottom-menu nav a {
        padding: 5px 0;
        /* Minimal padding */
        font-size: 0.9rem;
        line-height: 2;
    }

    /* Remove extra spacing from br tags */
    .bottom-menu nav br {
        display: none;
    }
}

/* Intermediate breakpoint: Small phones */
@media (max-width: 480px) {
    .grid-container {
        grid-template-columns: 1fr;
        /* Single column on very small screens */
        gap: 15px;
    }

    .camera-gallery {
        grid-template-columns: 1fr;
        /* Single column */
    }

    /* Ensure minimum touch target size */
    .menu-toggle {
        min-width: 44px;
        min-height: 44px;
        padding: 12px 16px;
    }

    .prev,
    .next,
    .gallery {
        min-width: 44px;
        /* Minimum touch target */
        min-height: 44px;
    }
}


@media (max-height: 500px) and (orientation: landscape) and (max-width: 852px) {

    header {
        display: none !important;
    }

    /* Hide desktop sidebar */
    .left-menu {
        display: none !important;
    }

    /* Show hamburger */
    .menu-toggle {
        display: block;
    }

    /* Transform Bottom Menu to Side Drawer */
    .bottom-menu {
        display: flex;
        right: -400px;
        /* Start off-screen right */
        left: auto;
        /* Reset left */
        top: 0;
        bottom: 0;
        width: 300px;
        height: 100vh;
        transform: none;
        /* Remove translateX(-50%) */
        border-radius: 20px 0 0 20px;
        /* Rounded on left */
        transition: right 0.3s ease-in-out;
        justify-content: center;
        padding-top: 0;
        flex-direction: column;
        line-height: 2;
    }

    .bottom-menu.open {
        right: 0;
        bottom: 0;
        left: auto;
    }

    /* Main Content */
    .main-content {
        align-self: center;
        width: 98%;
        height: auto;
        margin-left: 200px
    }

    .slideshow-container {
        width: 98%;
        height: auto;
    }

    .mySlides {
        width: 98%;
        height: auto;
    }

    /* Ensure content uses full width */
    .image-area {
        width: 98%;
        height: auto;
    }

    /* Compact menu items for landscape */
    .bottom-menu nav a {
        padding: 1px 0;
        /* Minimal padding */
        font-size: 0.9rem;
        line-height: 1.2;
    }

    /* Remove extra spacing from br tags */
    .bottom-menu nav br {
        display: none;
    }

    /* Force Slideshow Mode */
    .gallery {
        display: none !important;
        /* Hide toggle button */
    }

    #slideshow-container {
        display: block !important;
        /* Force slideshow visible */
    }

    .gallery-grid {
        display: none !important;
        /* Hide grid */
    }
}

@media (max-height: 500px) and (orientation: landscape) and (max-width: 768px) {

    /* Main Content */
    .main-content {
        margin-left: 0px
    }
}