/* ==============================
   CSS Variables
   ============================== */
:root {
    /* Colors */
    --primary-bg: #ffffff;
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --background-color: #f9fafb;
    --accent-color: #4b5563;
    --error-color: #dc2626;
    --success-color: #059669;
    --warning-color: #d97706;
    --info-color: #0284c7;
    --light-gray: #f3f4f6;
    --dark-gray: #111827;
    
    /* Z-index layers - updated */
    --z-index-base: 1;
    --z-index-header: 10;
    --z-index-mobile-menu: 100;
    --z-index-mobile-menu-content: 1001;
    --z-index-lightbox: 1000;
    --z-index-lightbox-controls: 2001;
    --z-index-menu-toggle: 1001; /* New z-index for menu toggle */
    
    /* Typography */
    --font-base: "Futura", monospace;
    --font-alt: "Futura", monospace;
    --font-size-base: 16px;
    --font-size-sm: 0.875rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --line-height-base: 1.5;
    --line-height-tight: 1.25;
    --line-height-loose: 1.75;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;
    
    /* Layout */
    --container-max-width: 1280px;
    --container-padding: var(--spacing-lg);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Border radius */
    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
    --border-radius-full: 9999px;
}

/* ==============================
   Base Styles
   ============================== */
body {
    margin: 0;
    padding: 0;
    font-family: var(--font-base);
    line-height: var(--line-height-base);
    color: var(--text-color);
    background-color: var(--background-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#container {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: 2rem;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* ==============================
   Trip Home Page
   ============================== */
.trip-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
    padding: var(--spacing-xl) 0;
}

.trip-header h1 {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    margin: 0 0 var(--spacing-md) 0;
    color: var(--text-color);
    letter-spacing: -0.025em;
}

.trip-description {
    font-size: var(--font-size-lg);
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto var(--spacing-xl);
    line-height: var(--line-height-loose);
    font-family: var(--font-alt);
}

.trip-thumbnail {
    max-width: 700px;
    width: 100%;
    margin: 0 auto var(--spacing-2xl);
    background: none;
    box-shadow: none;
    text-align: center;
}

.trip-thumbnail:hover {
    transform: none;
    box-shadow: none;
}

.trip-thumbnail img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 700px;
    display: inline-block;
    margin: 0 auto;
    object-fit: contain;
}

.day-selector {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    text-align: center;
}

.day-selector h2 {
    margin: 0 0 12px 0;
    font-size: 1.4em;
    color: #333;
    text-align: center;
    font-weight: 600;
}

.day-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    list-style: none;
    padding: 0;
    margin: 0 auto 20px auto;
    max-width: 600px;
}

.back-link {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.back-link a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    transition: color var(--transition-speed);
}

.back-link a:hover {
    color: var(--primary-color);
}

.day-item {
    width: 100%;
}

.day-item a {
    display: block;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    font-size: 0.95em;
    line-height: 1.3;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    border-radius: 4px;
    background-color: transparent;
}

.day-content {
    color: #666;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    transition: color 0.2s ease;
}

.day-item a:hover {
    background-color: #f0f0f0;
    color: var(--primary-color);
    text-decoration: none;
}

.day-item a:hover .day-content {
    color: var(--primary-color);
}

/* Mobile styles */
@media (max-width: 768px) {
    #container {
        padding: 1rem;
        max-width: none;
        width: 100%;
    }

    .content-box,
    .gallery-box,
    .map-box,
    .footer-box {
        padding: 15px;
        margin-bottom: 15px;
        width: 100%;
        max-width: none;
    }

    .day-selector {
        padding: 0;
        width: 100%;
    }
}

.back-button {
    display: block;
    width: fit-content;
    margin: var(--spacing-xl) auto 0;
    background-color: var(--primary-color);
    color: white;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--border-radius-md);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--font-size-base);
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    text-align: center;
}

.back-button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.back-button:active {
    transform: translateY(0);
}

/* ==============================
   Responsive Styles
   ============================== */
@media (max-width: 768px) {
    :root {
        --container-padding: var(--spacing-md);
    }
    
    .trip-header {
        padding: var(--spacing-lg) 0;
        margin-bottom: var(--spacing-xl);
    }
    
    .trip-header h1 {
        font-size: var(--font-size-3xl);
    }
    
    .trip-description {
        font-size: var(--font-size-base);
        padding: 0 var(--spacing-md);
    }
    
    .trip-thumbnail {
        margin-bottom: var(--spacing-xl);
        border-radius: var(--border-radius-md);
    }
    
    .day-selector {
        padding: 0;
    }
    
    .day-selector h2 {
        font-size: 1.4em;
    }

    .day-list {
        max-width: none;
    }

    .day-item a {
        padding: 8px 12px;
        font-size: 0.9em;
    }

    .day-content {
        font-size: 0.9em;
    }
}

/* ==============================
   Footer
   ============================== */
#footer-box {
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
    border-top: 1px solid #e5e7eb;
    color: #6b7280;
    font-size: 0.875rem;
}

#footer-box a {
    color: #2563eb;
    text-decoration: none;
    transition: color 0.2s ease;
}

#footer-box a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* ==============================
   Gallery
   ============================== */
/* Single consolidated gallery styles */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin: 0 auto 40px;
    max-width: 1200px;
    width: 100%;
    box-sizing: border-box;
    margin-top: 40px;
}

.gallery-item {
    position: relative;
    aspect-ratio: 4/3;
    overflow: visible;
    border-radius: 8px;
    background: #333;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0;
}

.gallery-item:active {
    opacity: 0.9;
}

.gallery-item img,
.gallery-item video {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    border-radius: 8px 8px 0 0;
    flex-shrink: 0;
}

/* Video thumbnail specific styles */
.gallery-item[data-type="video"] {
    position: relative;
}

/* Video overlay styles - updated to work with Font Awesome icon */
.gallery-item .video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;  /* Removed the overlay background completely */
    border-radius: 8px 8px 0 0;
    z-index: 1;
    pointer-events: none;
}

.gallery-item .video-overlay i {
    color: white;
    font-size: 2em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.7);  /* Keep the play button background */
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item .caption {
    position: relative;
    background: #333;
    color: white;
    padding: 8px 10px;
    font-size: 0.9em;
    text-align: center;
    font-family: var(--font-alt);
    border-radius: 0 0 8px 8px;
    border: 1px solid #444;
    border-top: none;
    margin-top: -1px;
    flex-shrink: 0; /* Prevent caption from shrinking */
    min-height: 40px; /* Ensure minimum height for caption */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Gallery Box */
.gallery-box {
    background: #1a1a1a !important;
    padding: 80px 30px 30px 30px;
    width: 100%;
    max-width: none;
    margin: 0 auto 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    box-sizing: border-box;
    overflow-x: hidden;
    position: relative;
}

.gallery-section {
    position: relative;
    margin: 40px 0 40px;
    width: 100%;
}

.gallery-section h3 {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.4em;
    margin: 0;
    color: white;
    text-align: center;
    background: #1a1a1a;
    padding: 0 20px;
    z-index: 1;
    white-space: nowrap;
    width: auto;
    min-width: 0;
}

.gallery-spacer {
    height: 60px;
    width: 100%;
}

.gallery {
    margin-top: 0;
}

/* ==============================
   Lightbox
   ============================== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    height: 100dvh; /* Use dynamic viewport height */
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: var(--z-index-lightbox);
    padding: 0;
    box-sizing: border-box;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    height: 100dvh; /* Use dynamic viewport height */
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: translateX(0);
    opacity: 1;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.lightbox-content img,
.lightbox-content video {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 120px);
    width: auto;
    height: auto;
    object-fit: contain;
    background: #111;
    margin: 0 auto;
    border-radius: 12px 12px 0 0;
    position: relative;
    z-index: 1;
}

.lightbox-caption {
    position: relative;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 12px 20px;
    font-size: 14px;
    text-align: center;
    border-radius: 0 0 12px 12px;
    width: auto;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    z-index: 2;
    pointer-events: none;
    margin: 0 auto;
    margin-top: -1px;
    font-family: var(--font-alt);
}

/* Close Button */
.lightbox-close {
    position: absolute;
    top: 24px;
    right: 32px;
    z-index: 1001;
    background: rgba(30,30,30,0.95);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: #222;
}

/* Map Button (Info Icon) */
.lightbox-map {
    position: absolute;
    top: 24px;
    left: 32px;
    z-index: 1001;
    background: rgba(30,30,30,0.95);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.5em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: background 0.2s;
}

.lightbox-map i {
    font-size: 1.2em;
    color: #fff;
}

.lightbox-map:hover {
    background: #222;
}

/* Lightbox Arrows (Desktop Only) */
.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    background: rgba(30,30,30,0.95);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 2.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: background 0.2s;
    opacity: 0.85;
}

#lightbox-arrow-left {
    left: 24px;
}

#lightbox-arrow-right {
    right: 24px;
}

.lightbox-arrow:hover {
    background: #222;
    opacity: 1;
}

/* Mobile styles */
@media (max-width: 768px) {
    .lightbox {
        height: 100%;
        height: 100dvh; /* Use dynamic viewport height */
        padding: 0;
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.95);
        z-index: var(--z-index-lightbox);
    }

    .lightbox.active {
        display: flex;
    }

    .lightbox-content {
        height: 100%;
        height: 100dvh; /* Use dynamic viewport height */
        padding: 0;
        margin: 0;
    }

    .lightbox-content img,
    .lightbox-content video {
        max-height: 80vh;
        max-height: 80dvh; /* Use dynamic viewport height */
        width: auto;
        height: auto;
        margin: 0 auto;
        border-radius: 12px 12px 0 0;
    }

    .lightbox-caption {
        padding: 8px 12px;
        font-size: 13px;
        margin-top: -1px;
        width: 100%;
        box-sizing: border-box;
    }

    .lightbox-arrow {
        display: none;
    }

    .lightbox-close,
    .lightbox-map {
        top: 12px;
        width: 36px;
        height: 36px;
        font-size: 1.2em;
    }

    .lightbox-close {
        right: 12px;
    }

    .lightbox-map {
        left: 12px;
    }

    /* Prevent body scroll when lightbox is open */
    body.lightbox-open {
        position: fixed;
        width: 100%;
        height: 100%;
        height: 100dvh; /* Use dynamic viewport height */
        overflow: hidden;
    }

    /* Ensure content is centered on mobile */
    .lightbox-content {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        height: 100%;
        padding: 0;
        margin: 0;
    }

    /* Add mobile-specific video overlay icon styles */
    .gallery-item .video-overlay i {
        font-size: 1.5em;
        width: 36px;
        height: 36px;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    .lightbox {
        height: 100%;
        height: 100dvh; /* Use dynamic viewport height */
    }

    .lightbox-content {
        height: 100%;
        height: 100dvh; /* Use dynamic viewport height */
    }

    body.lightbox-open {
        position: fixed;
        width: 100%;
        height: 100%;
        height: 100dvh; /* Use dynamic viewport height */
        overflow: hidden;
    }
}

/* ==============================
   Media Queries
   ============================== */
@media (max-width: var(--mobile-breakpoint)) {
    .container {
        padding: var(--spacing-sm);
    }
    
    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 15px;
        margin-bottom: 30px;
    }
    
    .gallery-item {
        aspect-ratio: 3/2;
    }
    
    .gallery-item .caption {
        padding: 8px;
        font-size: 0.85em;
    }
    
    .nav-list {
        flex-direction: column;
        align-items: center;
    }
}

@media (min-width: calc(var(--mobile-breakpoint) + 1px)) and (max-width: var(--tablet-breakpoint)) {
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (hover: none) {
    .thumbnail:hover {
        transform: none;
    }
    
    .thumbnail:hover img {
        transform: none;
    }
}

@media print {
    .nav,
    .lightbox-close {
        display: none;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .gallery {
        display: block;
    }
    
    .thumbnail {
        break-inside: avoid;
        margin-bottom: var(--spacing-lg);
    }
}

/* ==============================
   Day View
   ============================== */
.day-header {
    text-align: center;
    margin-bottom: 40px;
}

.day-header h1 {
    font-size: 1.6em;
    margin: 0 0 10px 0;
    color: var(--text-color);
    text-align: center;
}

.day-header h2 {
    font-size: 1.4em;
    margin: 0 0 20px 0;
    color: #000000;
    text-align: center;
    font-weight: normal;
}

.day-details {
    max-width: 800px;
    margin: 0 auto 40px;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.detail-item {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.detail-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.detail-item strong {
    color: #000000;
    display: block;
    margin-bottom: 5px;
}

.detail-item .value {
    color: #000000;
}

.daily-didactic {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #e5e7eb;
}

.daily-didactic h3 {
    font-size: 1.4em;
    margin: 0 0 20px 0;
    color: #333;
    text-align: center;
}

.daily-didactic p {
    margin: 0 0 20px 0;
    line-height: 1.6;
    text-align: justify;
    text-indent: 2em;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.daily-didactic p:last-child {
    margin-bottom: 0;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin: 0 auto 40px;
    max-width: 1200px;
}

.thumbnail {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.thumbnail:hover {
    transform: translateY(-2px);
}

.thumbnail img,
.thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px;
    font-size: 0.9em;
    opacity: 1;
    text-align: center;
    transition: none;
}

.thumbnail:hover .caption {
    opacity: 1;
}

.day-navigation {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
}

.nav-link {
    display: inline;
    color: inherit;
    text-decoration: none;
    padding: 0;
    margin: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--primary-color);
}

/* End of stylesheet */

/* Base Layout */
.layout-container {
    display: grid;
    grid-template-columns: fit-content minmax(0, 1fr);
    min-height: 100vh;
    background: #ffffff;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    padding: 0;
    gap: 20px;
    box-sizing: border-box;
}

/* Sidebar */
.trip-sidebar {
    grid-column: 1;
    width: fit-content;
    min-width: 220px;
    max-width: 280px;
    background: #f5f5f5;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
    white-space: nowrap;
    z-index: var(--z-index-sticky);
    align-self: start;
    border-radius: 0 8px 8px 0;
    margin: 12px 0 12px 12px;
}

.trip-title {
    font-size: 1.3em;
    font-weight: bold;
    margin: 0 0 10px 0;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trip-title a {
    color: inherit;
    text-decoration: none;
}

.trip-sidebar .date-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    list-style: none;
    padding: 0;
    margin: 0;
}

.trip-sidebar .date-item {
    display: block;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    font-size: 0.95em;
    line-height: 1.3;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    border-radius: 4px;
    background-color: transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trip-sidebar .date-item:hover {
    background-color: #f0f0f0;
    color: var(--primary-color);
    text-decoration: none;
}

/* Active state with high specificity */
.trip-sidebar .date-item.active {
    background-color: #e5e7eb !important;
    color: #2563eb !important;
    font-weight: 600 !important;
    border: 1px solid #d1d5db !important;
}

.trip-sidebar .date-item.active:hover {
    background-color: #e5e7eb !important;
    color: #2563eb !important;
}

/* Main Content */
.main-content {
    grid-column: 2;
    padding: 20px 20px 20px 0;
    background: #ffffff;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-right: 20px;
    box-sizing: border-box;
}

/* Content Box Styles */
.content-box,
.gallery-box,
.map-box,
.footer-box {
    background: #f5f5f5;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 30px;
    margin: 0 auto 30px;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    overflow-x: hidden;
}

.content-box p,
.content-box .detail-item,
.content-box .detail-item strong,
.content-box .detail-item .value,
.content-box .daily-didactic,
.content-box .daily-didactic p,
.content-box .daily-didactic h3,
.content-box .info-item,
.content-box .info-item .label,
.content-box .info-item .value {
    color: #000000;
}

/* Trip Show Page specific content box */
.trip-show .content-box {
    width: 100%;
    max-width: none;
    margin: 0 auto 30px;
    box-sizing: border-box;
}

/* Daily Data Box specific styles */
.main-content .content-box {
    width: 100%;
    max-width: none;
    background: #f5f5f5;
}

/* Map Box */
.map-box {
    padding: 30px;
}

/* Map Section */
.map-section {
    margin: 0;
}

.map-container {
    width: 100%;
    height: 400px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

/* Footer Box */
.footer-box {
    margin-bottom: 0;
    text-align: center;
    padding: 20px 30px;
    font-size: 1.1em;
    color: var(--text-color);
}

.footer-box a {
    color: #0066cc;
    text-decoration: none;
    transition: all 0.2s ease;
}

.footer-box a:hover {
    color: #004c99;
    opacity: 0.8;
}

/* All sections inside content box should have consistent width */
.content-box > * {
    width: 100%;
    box-sizing: border-box;
}

/* Key Info Section */
.key-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 20px;
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

.info-item {
    display: block;
    padding: 2px 0;
    text-align: left;
    line-height: 1.4;
}

.info-item span {
    display: block;
    color: #000000;
    font-size: 1.05em;
    font-family: var(--font-alt);
    /* Add 3-space indent for wrapped lines */
    padding-left: 1.5em; /* 3 spaces */
    text-indent: -1.5em; /* Pull first line back */
}

.info-item strong {
    color: #000000;
    font-weight: 600;
    font-size: 0.95em;
    margin-right: 4px;
}

.section-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 30px 0;
}

/* Map Section */
.map-section {
    margin-bottom: 40px;
}

.map-section h3 {
    font-size: 1.4em;
    margin: 0 0 20px 0;
    color: #333;
    text-align: center;
}

.no-location-message {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-size: 1.1em;
    line-height: 1.6;
    font-family: var(--font-alt);
}

.no-location-message p {
    margin: 0.5rem 0;
}

.no-location-message p:first-child {
    font-weight: 500;
    color: #444;
}

/* Responsive Design */
@media (max-width: 768px) {
    .layout-container {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0;
        min-height: auto; /* Allow container to expand */
        width: 100%;
        overflow-x: hidden;
    }
    
    .trip-sidebar {
        display: none !important;
    }
    
    .main-content {
        padding: 15px;
        margin-right: 0;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .content-box,
    .gallery-box,
    .map-box,
    .footer-box {
        padding: 15px;
        margin-bottom: 15px;
        width: 100%;
        max-width: none;
        overflow-x: hidden;
    }
    
    .trip-show .content-box {
        max-width: 100%;
    }
    
    .day-header h1 {
        font-size: 1.6em;
    }
    
    .day-header h2 {
        font-size: 1.4em;
    }
    
    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px; /* Increased gap to accommodate captions */
        padding: 15px;
        margin: 0 auto 20px;
        width: 100%;
        max-width: 100%;
    }
    
    .gallery-item {
        aspect-ratio: auto; /* Remove fixed aspect ratio to allow for caption */
        min-height: 0; /* Allow item to grow with content */
        display: flex;
        flex-direction: column;
    }
    
    .gallery-item img,
    .gallery-item video {
        aspect-ratio: 3/2;
        width: 100%;
        height: auto;
    }
    
    .gallery-item .caption {
        font-size: 0.85em;
        padding: 6px 8px;
        min-height: 36px; /* Slightly smaller on mobile */
        line-height: 1.2;
    }
    
    .map-container {
        height: 300px;
        width: 100%;
        max-width: 100%;
    }
}

/* Mobile Menu */
.menu-toggle {
    display: none; /* Hidden by default, shown on mobile */
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    background: transparent;
    color: #000;
    border: none;
    border-radius: 0;
    width: 44px;
    height: 44px;
    font-size: 1.4em;
    cursor: pointer;
    box-shadow: none;
    transition: opacity 0.2s;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    line-height: 1;
    z-index: var(--z-index-mobile-menu) !important;
    pointer-events: auto !important;
}

.menu-toggle:hover {
    opacity: 0.7;
}

.menu-toggle:active {
    opacity: 0.5;
}

.menu-toggle .menu-icon {
    display: block;
    font-size: 1.2em;
    line-height: 1;
    text-align: center;
    padding: 12px 0;
    transition: opacity 0.2s;
    font-weight: 900;
}

/* Remove any active state styles that might be causing the dimming */
.menu-toggle.active,
.menu-toggle[aria-expanded="true"] {
    background: transparent;
}

.menu-toggle.active .menu-icon,
.menu-toggle[aria-expanded="true"] .menu-icon {
    opacity: 1;
}

#mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-index-mobile-menu);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    -webkit-transform: translateZ(0); /* Force hardware acceleration */
}

#mobile-menu.active {
    opacity: 1;
    visibility: visible;
}

#mobile-menu .menu-content {
    position: fixed;
    top: 44px;
    left: -280px;
    width: 280px;
    height: calc(100% - 44px);
    background: #f5f5f5;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: scroll; /* Changed from auto to scroll for Safari */
    -webkit-overflow-scrolling: touch;
    transition: transform 0.3s ease;
    transform: translateX(0);
    z-index: var(--z-index-mobile-menu);
    border-radius: 0 8px 8px 0;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    -webkit-transform: translateZ(0); /* Force hardware acceleration */
    overscroll-behavior: contain; /* Prevent scroll chaining */
}

#mobile-menu.active .menu-content {
    transform: translateX(280px);
    overflow-y: auto;
}

#mobile-menu .mobile-day-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

#mobile-menu .mobile-day-menu li {
    margin: 0;
    padding: 0;
    width: 100%;
}

#mobile-menu .mobile-day-menu a {
    display: block;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    font-size: 0.95em;
    line-height: 1.3;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    border-radius: 4px;
    background-color: transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#mobile-menu .mobile-day-menu a:hover {
    background-color: #f0f0f0;
    color: var(--primary-color);
    text-decoration: none;
}

#mobile-menu .mobile-day-menu a.active {
    background-color: #e5e7eb !important;
    color: #2563eb !important;
    font-weight: 600 !important;
    border: 1px solid #d1d5db !important;
}

#mobile-menu .mobile-day-menu a.active:hover {
    background-color: #e5e7eb !important;
    color: #2563eb !important;
}

#mobile-menu .mobile-day-menu a.active:last-child {
    padding-bottom: 6px;
    margin-bottom: 0;
}

#mobile-menu .sidebar-homelink {
    font-weight: 600;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 6px;
    padding-bottom: 6px;
    font-size: 1em;
    display: block;
    text-decoration: none;
}

#mobile-menu .sidebar-homelink:hover {
    color: var(--primary-hover);
}

/* Show mobile menu only when day-selector is not present */
body:not(:has(.day-selector)) #mobile-menu {
    display: block;
}

/* Mobile styles */
@media (max-width: 768px) {
    .menu-toggle {
        display: none !important;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: var(--z-index-menu-toggle); /* Use new z-index */
        background: none;
        border: none;
        padding: 10px;
        cursor: pointer;
        height: 44px;
        width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        -webkit-transform: translateZ(0); /* Force hardware acceleration */
    }
    
    /* Show menu toggle only when day-selector is not present */
    body:not(:has(.day-selector)) .menu-toggle {
        display: block !important;
    }
    
    /* Ensure menu is completely hidden when not active */
    #mobile-menu:not(.active) {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
    
    #mobile-menu:not(.active) .menu-content {
        transform: translateX(-280px);
    }
    
    #mobile-menu.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    
    #mobile-menu.active .menu-content {
        transform: translateX(280px);
    }
}

/* Ensure menu toggle stays below lightbox when active */
.lightbox.active ~ .menu-toggle {
    z-index: calc(var(--z-index-lightbox) - 1);
}

/* Link styles */
a {
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
}

a:hover {
    color: #0066cc;
    opacity: 0.8;
}

/* Keep specific link styles */
.footer-box a {
    color: #0066cc;
    transition: all 0.2s ease;
}

.footer-box a:hover {
    color: #004c99;
    opacity: 0.8;
}

/* Preserve specific link styles for navigation */
.trip-title a,
.date-item,
.mobile-day-menu a {
    color: inherit;
    transition: all 0.2s ease;
}

.trip-title a:hover {
    color: #0066cc;
    opacity: 0.8;
}

/* ==============================
   Home Page Styles
   ============================== */
.page-header {
    text-align: center;
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-md);
    background: none;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

.header-image {
    max-width: 100%;
    width: clamp(280px, 80vw, 500px);
    height: auto;
    display: inline-block;
    margin: 0;
    object-fit: contain;
    vertical-align: middle;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    color: #1f2937;
    letter-spacing: -0.025em;
}

.page-header p {
    font-size: 1.125rem;
    color: #6b7280;
    max-width: 600px;
    margin: 0 auto;
}

/* Main Content */
main {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Trip Links */
.trip-links {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: var(--spacing-sm) var(--spacing-sm);
    box-sizing: border-box;
}

.trip-link {
    display: block;
    padding: var(--spacing-xs) var(--spacing-sm);
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.25rem;
    text-align: center;
    transition: all var(--transition-speed);
    border: none;
    background: none;
    white-space: normal;
    word-wrap: break-word;
    position: relative;
}

.trip-link:hover {
    color: var(--primary-color);
}

.latest-trip {
    font-size: clamp(1.25rem, 4vw, 2rem);
    font-weight: clamp(700, 8vw, 800);
    color: var(--text-color);
}

.latest-trip:hover {
    color: var(--primary-color);
}

/* Legacy link specific styles */
.legacy-link {
    font-size: 1.1rem;
    font-weight: normal;
    background: none;
    padding: 0.75rem 1rem;
}

.legacy-link:hover {
    color: var(--primary-color);
}

/* Remove the link-type class since we're not using it anymore */
.link-type {
    display: none;
}

/* Mobile Responsiveness */
@media (max-width: var(--mobile-breakpoint)) {
    .trip-links {
        padding: var(--spacing-xs) var(--spacing-sm);
        gap: var(--spacing-xs);
    }
    
    .trip-link {
        font-size: 1.125rem;
        padding: var(--spacing-xs);
        line-height: 1.4;
    }

    .legacy-link {
        font-size: 1rem;
        padding: 0.5rem 0.75rem;
    }

    .latest-trip {
        font-size: 1.25rem;
        margin-bottom: var(--spacing-xs);
    }
}

/* No trips message */
.no-trips {
    text-align: center;
    color: #6b7280;
    font-size: 1.125rem;
    margin: 2rem 0;
}

/* Footer */
footer {
    padding: var(--spacing-md) var(--spacing-sm);
    text-align: center;
    margin-top: auto;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

footer .container {
    width: 100%;
    margin: 0;
    padding: 0;
}

footer p {
    font-size: clamp(0.875rem, 3vw, 1rem);
    margin: 0;
    white-space: nowrap;
}

/* Mobile Responsiveness */
@media (max-width: var(--mobile-breakpoint)) {
    .welcome-header {
        padding: var(--spacing-sm) var(--spacing-xs);
    }
    
    .welcome-header h1 {
        font-size: 1.75rem;
        letter-spacing: -0.01em;
    }
    
    .page-header {
        padding: var(--spacing-xs) var(--spacing-xs) var(--spacing-sm);
        margin-bottom: var(--spacing-sm);
    }
    
    .header-image {
        width: clamp(200px, 90vw, 280px);
    }
    
    .trip-links {
        padding: var(--spacing-xs) var(--spacing-sm);
        gap: var(--spacing-xs);
    }
    
    .trip-link {
        font-size: 1.125rem;
        padding: var(--spacing-xs);
        line-height: 1.4;
    }
    
    .latest-trip {
        font-size: 1.25rem;
        margin-bottom: var(--spacing-xs);
    }
    
    footer {
        padding: var(--spacing-sm) var(--spacing-xs);
        font-size: 0.875rem;
    }
}

/* Container adjustments for mobile */
#container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

main {
    flex: 1;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Welcome Header */
.welcome-header {
    text-align: center;
    padding: var(--spacing-md) var(--spacing-sm) var(--spacing-sm);
    background: none;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

.welcome-header h1 {
    font-size: clamp(1.25rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
    letter-spacing: -0.025em;
    line-height: 1.2;
    white-space: nowrap;
}

/* Footer */
footer {
    padding: var(--spacing-md) var(--spacing-sm);
    text-align: center;
    margin-top: auto;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

footer .container {
    width: 100%;
    margin: 0;
    padding: 0;
}

footer p {
    font-size: clamp(0.875rem, 3vw, 1rem);
    margin: 0;
    white-space: nowrap;
}

/* Container adjustments for mobile */
#container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

main {
    flex: 1;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Mobile Responsiveness */
@media (max-width: var(--mobile-breakpoint)) {
    .welcome-header {
        padding: var(--spacing-sm) var(--spacing-xs);
    }
    
    footer {
        padding: var(--spacing-sm) var(--spacing-xs);
    }
}

/* External Links */
.external-links {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.external-links h2 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 1rem;
    text-align: center;
}

.links-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.external-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.1rem;
    text-align: center;
    transition: all var(--transition-speed);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--background-color);
}

.external-link:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: var(--hover-background);
}

/* Mobile Responsiveness */
@media (max-width: var(--mobile-breakpoint)) {
    .external-links {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }

    .external-links h2 {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }

    .external-link {
        font-size: 1rem;
        padding: 0.5rem 0.75rem;
    }
}