.page {
    margin-top: 11px;
    gap: 15px;
}

.gallery-toolbar {
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Search */

.search {
    position: relative;
    width: min(650px, 98%);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;

    width: 14px;
    height: 14px;

    pointer-events: none;
    transform: translateY(-50%);
}

.search-input {
    width: 100%;
    height: 45px;
    padding: 5px 36px 0 34px;

    color: var(--color-text);
    caret-color: var(--color-text);
    font-size: 16px;
    line-height: 42px;

    border: 12px solid transparent;
    border-image: var(--panel-border) 7 fill stretch;
    background: transparent;
}

.search-input:focus {
    outline: none;
    border-image-source: var(--outline-border);
}

.search-input::placeholder {
    color: var(--color-muted);
}

.search-input::selection {
    background: rgba(255, 255, 255, 0.3);
    color: var(--color-text);
}

.search-input::-webkit-search-cancel-button {
    appearance: none;
    -webkit-appearance: none;
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;

    display: none;

    color: var(--color-text);
    background: none;
    border: none;
    font-size: 18px;

    transform: translateY(-50%);
}

.search-clear:hover {
    color: var(--color-pink);
}

.search.has-text .search-clear {
    display: block;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 10;

    display: none;

    width: 100%;
    max-height: 220px;
    padding: 0 2px;
    overflow-y: auto;
    overflow-x: hidden;

    border: 10px solid transparent;
    border-image: var(--panel-border) 7 fill stretch;
    background: rgba(20, 20, 20, 0.96);

    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.search.show-results .search-results {
    display: block;
}

.search-result {
    display: block;
    width: 100%;
    padding: 8px 10px;

    color: var(--color-text);
    background: transparent;
    border: none;

    text-align: left;
    font-size: 15px;
}

.search-result:hover {
    background: rgba(255, 255, 255, 0.08);
}

.search-empty {
    padding: 8px 10px;

    color: #888;
    font-style: italic;
}
/* Mode buttons */

.mode-button {
    width: 45px;
    height: 45px;
    margin: 0;
    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: visible;

    border: 12px solid transparent;
    border-image: url("../images/ui/select-button.png") 7 fill stretch;
    background: transparent;
}

.mode-button img {
    width: 34px;
    height: auto;

    display: block;
    flex: 0 0 auto;

    max-width: none;
    max-height: none;
}

.mode-button:hover {
    border-image-source: url("../images/ui/select-button_hover.png");
}

.mode-button.is-active {
    border-image-source: url("../images/ui/select-button_selected.png");
}

.mode-button.single.is-active img {
    content: url("../images/ui/icon-single_highlight.png");
}

.mode-button.multiple.is-active img {
    content: url("../images/ui/icon-many_highlight.png");
}

/* View switching */

.gallery-views {
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-view {
    display: none;
    width: 100%;

    align-items: center;
    justify-content: center;
}

.gallery-view.is-active {
    display: flex;
}

/* Single gallery */

.gallery-panel {
    position: relative;

    width: min(90%, 850px);

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.gallery-download {
    position: absolute;
    top: 0;
    right: 0;

    width: 60px;
    height: 60px;
    z-index: 2;
}

.gallery-download-mobile {
    display: none;
    width: 100%;
    height: 60px;
    margin-top: 10px;
}

.gallery-arrow {
    width: 60px;
    height: 60px;

    background-image: url("../images/ui/large-arrow.png");
    background-repeat: no-repeat;
    background-color: transparent;
    background-size: contain;

    border: 16px solid transparent;
    border-image: url("../images/ui/nav.png") 7 fill stretch;
}

.gallery-arrow:hover {
    background-image: url("../images/ui/large-arrow_highlight.png");
}

.gallery-arrow.next {
    transform: scale(-1, -1);
}

.gallery-wrapper {
    width: 100%;
    min-width: 0;
    padding: 22px 0px;

    display: grid;
    grid-template-columns:
        minmax(0, 500px)
        minmax(0, clamp(160px, 28vw, 260px));
    align-items: center;
    justify-content: center;
    gap: 28px;
}

.gallery-info {
    min-width: 0;
    width: 100%;
    height: 100%;

    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    justify-self: stretch;
}

.gallery-caption {
    margin-top: 0;
    text-align: left;
    width: 100%;
    height: 100%;

    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.gallery-name {
    padding: 20px 0;
    font-family: var(--font-title);
    font-size: 21px;
}

.gallery-date {
    font-size: 20px;
    opacity: 0.7;
}

#asset-version {
    margin-top: auto;
}

.variant-select {
    position: relative;
    width: min(100%, 250px);
    margin-top: 8px;
}

.variant-button {
    width: 100%;
    height: 42px;
    padding: 4px 34px 0 12px;

    color: var(--color-text);
    font-size: 16px;
    text-align: left;

    border: 9px solid transparent;
    border-image: var(--dropdown-border) 5 fill stretch;
    background: transparent;
}

.variant-button::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;

    width: 16px;
    height: 16px;

    background-image: url("../images/ui/icon-dropdown.png");
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;

    transform: translateY(-50%);
    pointer-events: none;
}

.variant-options {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;

    display: none;
    width: 100%;

    border: 10px solid transparent;
    border-image: var(--panel-border) 7 fill stretch;
    background: rgba(20, 20, 20, 0.96);
}

.variant-select.is-open .variant-options {
    display: block;
}

.variant-select.is-open .variant-button::after {
    background-image: url("../images/ui/icon-dropdown-open.png");
}

.variant-select.is-open .variant-button {
    border-image: var(--dropdown-highlight-border) 5 fill stretch;
}

.variant-option {
    width: 100%;
    padding: 8px 10px;

    color: var(--color-text);
    background: transparent;
    border: none;

    text-align: left;
    font-size: 15px;
}

.variant-option.is-active {
    color: var(--color-pink);
}

.variant-option:hover {
    background: rgba(255, 255, 255, 0.08);
}

.variant-select.is-disabled .variant-button {
    cursor: default;
}

.variant-select.is-disabled .variant-button::after {
    opacity: 0.5;
}

.variant-select.is-disabled .variant-options {
    display: none;
}

.gallery-stage {
    position: relative;

    width: 500px;
    max-width: 100%;
    height: 340px;

    overflow: hidden;
    border-radius: 10px;
    background: linear-gradient(to bottom, #f6d365, #fda085);
}

.gallery-track {
    position: relative;
    z-index: 1;

    height: 100%;

    display: flex;

    transition: transform 0.45s ease;
    will-change: transform;
}

.gallery-item {
    min-width: 100%;
    height: 100%;
    padding: 20px;

    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item img {
    display: block;

    width: auto;
    height: 300px;
    max-width: 100%;

    object-fit: contain;
    user-select: none;
    pointer-events: none;
}

/* Multiple gallery */

.gallery-scroll {
    width: min(90%, 1000px);
    max-height: 54.55vh;
    margin: 0 auto;

    overflow-y: auto;
    overflow-x: hidden;

    padding-inline: 10px;
}

.gallery-grid {
    width: 100%;
    min-width: 0;

    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    justify-content: center;
    gap: 25px 20px;
}

.gallery-card {
    position: relative;
}

.gallery-card-download {
    position: absolute;
    bottom: -5px;
    z-index: 2;

    width: 100%;
    aspect-ratio: 3.8 / 1;

    opacity: 0;
    pointer-events: none;

    transition: opacity 0.12s ease;
}

.download-button.gallery-card-download img {
    width: auto;
    height: clamp(20px, 100%);
    max-width: none;
    max-height: none;
}
.gallery-card:hover .gallery-card-download,
.gallery-card:focus-within .gallery-card-download {
    opacity: 1;
    pointer-events: auto;
}

.art-card.search-highlight {
    border-image-source: var(--panel-highlight-border);
}

.download-all {
    width: min(500px, 90%);
    gap: 10px;

    border-image-source: url("../images/ui/download-button_highlight.png");

    font-size: clamp(12px, 3.6vw, 17px);
    white-space: nowrap;
    line-height: 1;

    text-decoration: none;
    font-family: var(--font-title);
}

.download-all:hover {
    border-image-source: url("../images/ui/download-button_highlight2.png");
}

.download-all img {
    position: relative;
    top: -2px;

    width: 27px;
    height: 27px;
}

@media (max-width: 980px) {
    .gallery-scroll {
        width: min(100%, 720px);
    }

    .gallery-grid {
        grid-template-columns: repeat(2, minmax(230px, 1fr));
    }
}

@media (max-width: 650px) {
    .gallery-panel {
        gap: 0;
    }
    
    .gallery-arrow {
        display: none;
    }

    .gallery-stage {
        height: 280px;
    }

    .gallery-item img {
        height: 240px;
    }

    .gallery-download {
        display: none;
    }

    .gallery-download-mobile {
        order: 3;
        display: flex;
        margin-top: 10px;
    }
}

@media (max-width: 750px) {
    .gallery-wrapper {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px 0;
    }

    .gallery-stage {
        order: 1;
        width: 100%;
    }

    .gallery-info {
        order: 2;
        align-items: center;
        text-align: center;
    }

    .gallery-caption {
        align-items: center;
        text-align: center;
    }

    .gallery-name {
        padding: 12px 0 4px;
    }

    .gallery-date {
        font-size: 16px;
    }

    #asset-version {
        margin-top: 6px;
    }

    .variant-select {
        width: min(100%, 280px);
        margin-top: 12px;
    }
}

@media (max-width: 520px) {
    .gallery-scroll {
        width: min(100%, 360px);
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }
}
