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

html {
    scrollbar-gutter: stable;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f3f4f6;
    color: #4b5563;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', system-ui, sans-serif;
}

/* Header - Glassmorphism */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.875rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 1rem;
    border-bottom: 3px solid #2f5cf9;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
    min-width: 0;
    flex-shrink: 0;
}

.header-brand > div {
    display: none;
}

.header-logo {
    display: none;
}

.header-logo-horizontal {
    display: block;
    flex-shrink: 0;
}

/* Site Nav (hidden - using pills instead) */
.site-nav {
    display: none;
}

/* Navigation Pills */
.nav-pills {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-left: auto;
}

.nav-pill {
    padding: 0.4375rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1.5px solid #e2e8f0;
    border-radius: 9999px;
    background: #fff;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
}

.nav-pill:hover {
    border-color: #2f5cf9;
    color: #2f5cf9;
}

.nav-pill.active {
    background: #2f5cf9;
    border-color: #2f5cf9;
    color: #fff;
}

/* Filter Chips (hidden in header - used via dropdown) */
.filter-chips {
    display: none;
}

.chip {
    padding: 0.375rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1.5px solid #e2e8f0;
    border-radius: 9999px;
    background: #fff;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.chip:hover {
    border-color: #2f5cf9;
    color: #2f5cf9;
}

.chip.active {
    background: #2f5cf9;
    border-color: #2f5cf9;
    color: #fff;
}

.chip:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(47, 92, 249, 0.3);
}

/* Filter Toggle Button */
.filter-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1.5px solid #2f5cf9;
    border-radius: 8px;
    background: #fff;
    color: #2f5cf9;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    flex-shrink: 0;
}

.filter-toggle:hover {
    background: rgba(47, 92, 249, 0.08);
    border-color: #2f5cf9;
    color: #2f5cf9;
}

/* Hide filter toggle on pages without filters (preserve space for layout) */
.filter-toggle--no-filters {
    visibility: hidden;
    pointer-events: none;
}

/* Filter Dropdown */
.filter-dropdown {
    position: absolute;
    top: 100%;
    right: 2rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    z-index: 200;
}

.filter-dropdown[hidden] {
    display: none;
}

.filter-dropdown .chip {
    width: 100%;
    text-align: left;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Gallery Container */
.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

/* Thumbnail Card */
.thumbnail-card {
    position: relative;
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.thumbnail-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12), 0 4px 10px rgba(0, 0, 0, 0.08);
}

.thumbnail-card:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(47, 92, 249, 0.4);
}

.thumbnail-wrapper {
    position: relative;
    width: 100%;
    padding-top: 75%;
    background-color: #e0e0e0;
    background-image: linear-gradient(135deg, #2f5cf9 0%, #172e7c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumbnail-wrapper::before {
    content: 'No thumbnail';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    text-align: center;
}

.thumbnail-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #e0e0e0;
}

.thumbnail-wrapper img[src=""],
.thumbnail-wrapper img:not([src]) {
    display: none;
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.thumbnail-card:hover .play-overlay {
    opacity: 1;
}

@media (hover: none) {
    .play-overlay {
        opacity: 0.6;
    }
}

.thumbnail-info {
    padding: 1rem 1.25rem;
}

.thumbnail-seal-number {
    font-size: 0.875rem;
    font-weight: 600;
    color: #020617;
    word-break: break-all;
    margin-bottom: 0.25rem;
}

.thumbnail-zone {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.thumbnail-zone::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #a0aec0;
    flex-shrink: 0;
}

.thumbnail-zone.ocean-carrier {
    color: #2f5cf9;
}

.thumbnail-zone.ocean-carrier::before {
    background-color: #2f5cf9;
}

.thumbnail-zone.terminal {
    color: #c05621;
}

.thumbnail-zone.terminal::before {
    background-color: #c05621;
}

.thumbnail-zone.origin {
    color: #7c3aed;
}

.thumbnail-zone.origin::before {
    background-color: #7c3aed;
}

.thumbnail-zone.areapif {
    color: #059669;
}

.thumbnail-zone.areapif::before {
    background-color: #059669;
}

/* Download Button */
.download-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    z-index: 2;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.download-btn:hover {
    background: #fff;
    color: #374151;
    transform: scale(1.1);
}

.download-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(47, 92, 249, 0.4);
}

/* Loading and Error States */
.loading,
.error,
.no-results {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.error {
    color: #cc0000;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal[hidden] {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    z-index: 2;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    z-index: 10;
    transition: opacity 0.2s ease;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.8);
}

.modal-close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.video-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Responsive: Tablet */
@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Responsive: Mobile */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .header {
        flex-wrap: wrap;
        padding: 0.625rem 3.5rem;
        gap: 0.5rem;
        position: relative;
    }

    .filter-toggle {
        position: absolute;
        top: 0.625rem;
        right: 1rem;
        margin-left: 0;
    }

    .header-brand {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .header-logo-horizontal {
        width: 140px;
        height: auto;
    }

    .filter-dropdown {
        right: 1rem;
    }

    .nav-pills {
        width: 100%;
        flex: none;
        margin-left: 0;
        justify-content: center;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
        padding-bottom: 0.25rem;
    }

    .nav-pills::-webkit-scrollbar {
        display: none;
    }

    .nav-pill {
        padding: 0.3rem 0.875rem;
        font-size: 0.8125rem;
        flex-shrink: 0;
    }

    .gallery-container {
        padding: 1rem;
    }

    .modal-content {
        width: 95%;
    }

    .modal-close {
        top: 8px;
        right: 8px;
        font-size: 1.5rem;
        width: 32px;
        height: 32px;
    }
}

/* Utility: Body scroll lock when modal is open */
body.modal-open {
    overflow: hidden;
}

/* Accessibility: Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    .thumbnail-card { transition: none; }
    .modal-close { transition: none; }
    .play-overlay { transition: none; }
    .download-btn { transition: none; }
}
