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

:root {
    --bg: #ffffff;
    --text: #000000;
    --text-light: #999999;
    --border: #e0e0e0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'JetBrains Mono', monospace;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
    letter-spacing: normal;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg);
}

/* Grid Toggle */
.grid-toggle {
    justify-self: start;
    display: flex;
    align-items: center;
    gap: 10px;
}

.grid-option {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    opacity: 0.25;
    transition: opacity 0.2s ease;
}

.grid-option:hover {
    opacity: 0.6;
}

.grid-option.active {
    opacity: 0.9;
}

.grid-icon {
    display: flex;
    gap: 1.5px;
    height: 10px;
    align-items: stretch;
}

.grid-icon i {
    display: block;
    width: 2px;
    background-color: var(--text);
    border-radius: 0.5px;
}

.grid-icon.grid-2 i {
    width: 4px;
}

.grid-icon.grid-3 i {
    width: 3px;
}

.grid-icon.grid-5 i {
    width: 2px;
}

.grid-icon.grid-1 i {
    width: 6px;
}

/* Hide 1-column option on desktop */
.grid-option.mobile-only {
    display: none;
}

/* Logo */
.logo {
    font-size: 15px;
    font-weight: 400;
    letter-spacing: normal;
    color: var(--text);
    text-transform: uppercase;
}

/* Full Pack Button */
.full-pack-btn {
    justify-self: end;
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 400;
    letter-spacing: normal;
    color: var(--text);
    text-decoration: none;
    text-transform: uppercase;
    padding: 6px 0;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.full-pack-btn:hover {
    opacity: 1;
}

/* Main Content */
.main {
    padding: 70px 30px 40px;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-columns, 6), 1fr);
    gap: 20px 16px;
}

/* Asset Card */
.asset-card {
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.asset-card:hover .asset-image {
    transform: scale(1.02);
}

.asset-image-wrapper {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    margin-bottom: 8px;
}

.asset-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.asset-name {
    font-size: 15px;
    font-weight: 400;
    letter-spacing: normal;
    color: var(--text);
    text-align: center;
    text-transform: uppercase;
}

/* Transition Image for shared element animation */
.transition-image {
    position: fixed;
    pointer-events: none;
    z-index: 2000;
    object-fit: contain;
    will-change: transform;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: var(--bg);
    z-index: 1000;
    display: none;
}

.modal-overlay.active {
    display: block;
}

/* Modal Header */
/* Modal Header */
.modal-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 18px 28px;
    z-index: 10;
    pointer-events: none;
    /* Allow clicking through on empty areas */
}

.modal-header>* {
    pointer-events: auto;
    /* Re-enable clicks on children */
}

.modal-back-group {
    justify-self: start;
}

.modal-full-pack {
    justify-self: end;
}

.modal-back-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-back {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    opacity: 0.7;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.modal-back:hover {
    opacity: 1;
}

.esc-hint {
    font-size: 15px;
    font-weight: 400;
    letter-spacing: normal;
    color: var(--text);
    opacity: 1;
}

.modal-full-pack {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 400;
    letter-spacing: normal;
    color: var(--text);
    text-decoration: none;
    text-transform: uppercase;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.modal-full-pack:hover {
    opacity: 1;
}

/* Navigation Arrows - sitting next to image */
.modal-nav {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    opacity: 0.4;
    transition: opacity 0.2s;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    flex-shrink: 0;
}

.modal-nav:hover {
    opacity: 1;
}

/* Modal Content */
.modal-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

/* Modal Center */
.modal-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: none;
    height: 100%;
    justify-content: center;
}

.modal-image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 40px;
    /* Space between image and arrows */
}

.modal-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

/* Modal Title */
/* Modal Title */
.modal-title {
    font-size: 15px;
    font-weight: 400;
    letter-spacing: normal;
    color: var(--text);
    text-transform: uppercase;
    margin: 0;
    text-align: center;
}

/* Download Icon */
.download-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    opacity: 1;
    /* Match text opacity */
    transition: opacity 0.2s, transform 0.2s;
    padding: 6px;
}

.download-icon:hover {
    opacity: 1;
    transform: scale(1.15);
}

.download-icon svg {
    width: 22px;
    height: 22px;
}

/* Pagination - at bottom */
/* Pagination / Download Footer */
.modal-pagination {
    position: absolute;
    bottom: 28px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.pagination-info {
    font-size: 15px;
    font-weight: 400;
    letter-spacing: normal;
    color: var(--text-light);
}

/* Loading State */
.asset-card.loading .asset-image {
    opacity: 0;
}

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

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

.asset-card {
    animation: fadeIn 0.4s ease backwards;
}

.asset-card:nth-child(1) {
    animation-delay: 0.02s;
}

.asset-card:nth-child(2) {
    animation-delay: 0.04s;
}

.asset-card:nth-child(3) {
    animation-delay: 0.06s;
}

.asset-card:nth-child(4) {
    animation-delay: 0.08s;
}

.asset-card:nth-child(5) {
    animation-delay: 0.1s;
}

.asset-card:nth-child(6) {
    animation-delay: 0.12s;
}

.asset-card:nth-child(n+7) {
    animation-delay: 0.14s;
}

/* Selection */
::selection {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--text);
}

/* Responsive */
@media (max-width: 1200px) {
    .modal-content {
        padding: 80px 80px;
    }
}

@media (max-width: 768px) {
    /* Grid uses CSS variable - controlled by JS */

    .main {
        padding: 60px 16px 40px;
    }

    .modal-header {
        padding: 18px 18px;
    }

    .logo {
        font-size: 15px;
        letter-spacing: normal;
    }

    .full-pack-btn {
        font-size: 15px;
    }

    .modal-content {
        padding: 30px 20px;
    }

    .modal-prev {
        left: 8px;
    }

    .modal-next {
        right: 8px;
    }

    .modal-nav {
        padding: 16px;
    }

    .esc-hint {
        display: none;
    }

    /* Show 1-column option on mobile, hide 3 and 5 column options */
    .grid-option.mobile-only {
        display: block;
    }

    .grid-option[data-columns="3"],
    .grid-option[data-columns="5"] {
        display: none;
    }
}