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

body {
    font-family: system-ui, sans-serif;
    background: #222;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-header {
    background: #222;
    color: white;
    padding: 1.5rem 2rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-header h1 {
    font-size: 1.3rem;
}

.header-menu {
    display: flex;
    gap: 1rem;
    color: #ccc;
    flex-wrap: wrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-menu a {
    color: #ccc;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.header-menu a {
    transition:
        background-color 0.25s ease,
        color 0.25s ease;
}

.header-menu a:hover,
.header-menu a.active {
    color: white;
}

.site-header a.instagram-link {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.site-header a.instagram-link:hover {
    opacity: 0.8;
}

.sidebar {
    width: 280px;
    background: #222;
    color: white;
    padding: 2rem 2rem 2rem;
    position: fixed;
    top: 64px;
    left: 0;
    height: calc(100vh - 64px);
    overflow-y: auto;
    z-index: 50;
}

.sidebar h1 {
    margin-bottom: 2rem;
    font-size: 1.3rem;
    padding-bottom: 0.5rem;
}

.gallery-menu {
    list-style: none;
}

.gallery-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #ccc;
    text-decoration: none;
    padding: 0.25rem;
    border-radius: 6px;
    margin-bottom: 0.3rem;
    cursor: pointer;
    transition:
        background-color 0.25s ease,
        color 0.25s ease;
}

.gallery-menu a:hover,
.gallery-menu a.active {
    background: #eee;
    color: #222;
    transition:
        background-color 0.25s ease,
        color 0.25s ease;
}

.main-content {
    background: #222;
    margin-left: 280px;
    padding: 1rem 3rem 3rem;
    margin-top: 64px;
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - 64px);
}

.header-image-container,
.story-text {
    transition: opacity 0.25s ease;
}

.header-image-container.fading,
.story-text.fading {
    opacity: 0;
}

/* Gallery page (standalone view) */
.hero-image img {
    width: 100%;
    height: clamp(180px, 40vw, 400px);
    object-fit: cover;
}

.video-player {
    text-align: center;
    margin: 2rem 0;
}

.video-player video {
    max-width: 100%;
    max-height: 80vh;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    background: #f5f5f5;
}

.gallery-item {
    background: #333;
    border-radius: 8px;
    overflow: hidden;
}

.header-image-container {
    transition: transform 0.3s ease;
}

.gallery-title {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #ddd;
}

.header-image-container {
    width: 80%;
    max-width: 1200px;
    aspect-ratio: 16/9;
    background: #222;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-image-container.portrait-mode {
    aspect-ratio: auto !important;
    height: auto !important;
    max-height: 75vh;
    background: transparent;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: none;
    width: 100%;
}

.header-image-container img,
.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.2s ease-in;
}

.header-image-container.portrait-mode img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    display: block;
}

.header-image-container img.loaded,
.gallery-item img.loaded,
.hero-image img.loaded {
    opacity: 1;
}

.header-image-container,
.gallery-grid {
    background: #222;
}

.header-image-container:hover {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

.story-section {
    width: 100%;
    max-width: 1200px;
    margin-top: 2rem;
    padding: 2rem;
    color: #ddd;
    background: #222;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.story-text {
    color: #ddd;
    font-size: 1.1rem;
    line-height: 1.8;
    overflow-wrap: break-word;
    word-break: break-word;
}

.no-image-message {
    color: #666;
    font-size: 1.2rem;
    padding: 4rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Gallery menu empty state */
.gallery-menu-empty {
    color: #888;
}

/* Modal Overlay Styles */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    overflow: hidden;
    visibility: hidden;
}

.gallery-modal.active {
    visibility: visible;
}

.gallery-modal-content {
    display: flex;
    height: 100%;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.gallery-carousel {
    position: relative;
    width: calc(100% - 40px);
    max-width: 1300px;
    height: calc(100vh - 120px);
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.carousel-track {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.carousel-item.active {
    opacity: 1;
}

.carousel-item {
    background: #111;
}

.carousel-item img {
    opacity: 0;
    transition: opacity 0.15s ease-in;
}

.carousel-item img.loaded {
    opacity: 1;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 10;
}

.carousel-nav:hover {
    background: white;
    color: #222;
}

.carousel-nav.prev {
    left: 20px;
}

.carousel-nav.next {
    right: 20px;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 10;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: white;
    color: #222;
    transform: rotate(90deg);
}

.gallery-caption {
    display: none;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.dot.active {
    background: white;
}

.dot:hover {
    background: rgba(255, 255, 255, 0.7);
}

.dots-ellipsis {
    color: rgba(255, 255, 255, 0.5);
    padding: 0 4px;
}

/* Mobile gallery chips row */
.mobile-gallery-nav {
    display: none;
}

.gallery-chip {
    background: rgba(255, 255, 255, 0.08);
    color: #ccc;
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.6rem 1rem;
    border-radius: 100px;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.gallery-chip:hover {
    background: rgba(255, 255, 255, 0.14);
    color: white;
}

.gallery-chip.active {
    background: rgba(255, 255, 255, 0.95);
    color: #222;
    border-color: rgba(255, 255, 255, 0.95);
}

/* Dynamic media containers */
.gallery-media-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.gallery-video {
    max-width: 100%;
    max-height: 100%;
}

.gallery-iframe {
    width: 100%;
    height: 100%;
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100vw);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOutToRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100vw);
        opacity: 0;
    }
}

.gallery-modal.active .gallery-modal-content {
    animation: slideInFromRight 0.4s ease-out;
}

.gallery-modal.closing .gallery-modal-content {
    animation: fadeOutToRight 0.4s ease-in forwards;
}

/* Keep visible during closing animation */
.gallery-modal.closing {
    visibility: visible;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none !important;
    }

    .site-header {
        padding: 0.75rem 1rem;
        position: sticky;
        top: 0;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.75rem;
    }

    .site-header h1 {
        font-size: 1rem;
    }

    .instagram-link {
        order: 2;
    }

    .header-menu {
        order: 4;
        width: 100%;
        flex-basis: 100%;
        justify-content: center;
        padding-top: 0.5rem;
        margin-top: 0.25rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .header-menu a {
        padding: 0.3rem 0.75rem;
        font-size: 0.85rem;
        border-radius: 100px;
        background: rgba(255, 255, 255, 0.06);
        transition: all 0.2s ease;
    }

    .header-menu a:hover,
    .header-menu a.active {
        background: rgba(255, 255, 255, 0.15);
        color: white;
    }

    .mobile-gallery-nav {
        display: flex;
        overflow-x: auto;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
        scrollbar-width: none;
        -ms-overflow-style: none;
        position: sticky;
        top: 80px;
        z-index: 10;
        background: #222;
    }

    .mobile-gallery-nav::-webkit-scrollbar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        margin-top: 0;
        padding: 1rem;
        flex-wrap: wrap;
        flex: 0;
        min-height: auto;
    }

    .gallery-title {
        font-size: 1.5rem;
    }

    .header-image-container {
        max-width: 100%;
        aspect-ratio: 16/9;
        width: 100%;
    }

    .header-image-container.portrait-mode {
        aspect-ratio: auto !important;
        height: auto !important;
        width: 100% !important;
        background: transparent;
        border-radius: 16px;
        overflow: hidden;
        box-shadow: none;
    }

    .header-image-container.portrait-mode img {
        width: auto;
        max-width: 100%;
        height: auto;
        max-height: 80vh;
        object-fit: contain;
    }

    .story-section {
        padding: 1rem;
    }

    .gallery-modal {
        width: 100%;
    }

    .gallery-carousel {
        width: calc(100% - 24px);
        height: calc(100vh - 80px);
    }

    .carousel-dots {
        padding-bottom: 4px;
    }

    .carousel-nav {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .modal-close {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }

    .carousel-nav.prev {
        left: 10px;
    }

    .carousel-nav.next {
        right: 10px;
    }
}
