/* =====================================================
   ROI'S OC ARCHIVE — CHARACTER GALLERY
   Designed for 200+ characters
   ===================================================== */

.gallery-intro .window-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
}

.gallery-description {
    max-width: 650px;
    color: #aaa2bd;
}

.archive-counter {
    flex: 0 0 auto;
    min-width: 105px;
    padding: 10px 13px;

    border: 1px solid #4f4964;
    background: rgba(10, 10, 20, 0.55);

    text-align: center;
    color: #ddd6ed;
}

.archive-counter span {
    font-size: 22px;
}

.archive-counter .counter-divider {
    color: #6f6880;
    margin: 0 3px;
}

.archive-counter small {
    display: block;
    color: #817a92;
    font-size: 9px;
    letter-spacing: 1px;
    text-transform: uppercase;
}


/* =====================================================
   SEARCH + FILTERS
   ===================================================== */

.filter-window {
    margin-bottom: 28px;
}

.filter-content {
    padding: 18px;
}

.search-box {
    display: flex;
    align-items: center;

    border: 1px solid #5e5774;
    background: #11111e;

    height: 42px;
}

.search-symbol {
    padding: 0 10px;
    color: #9b91b8;
}

.search-box input {
    width: 100%;
    height: 100%;
    border: 0;
    outline: 0;

    background: transparent;
    color: #eeeafa;

    font: inherit;
    font-size: 13px;
}

.search-box input::placeholder {
    color: #656078;
}

.search-box button {
    width: 35px;
    height: 100%;

    border: 0;
    background: transparent;
    color: #77708b;

    font-size: 20px;
    cursor: pointer;
}

.search-box button:hover {
    color: #eeeafa;
}

.filter-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-top: 17px;
    margin-bottom: 8px;

    color: #aaa1bf;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.clear-filters {
    border: 0;
    background: transparent;
    color: #77708d;
    font: inherit;
    font-size: 10px;
    cursor: pointer;
    text-decoration: underline;
}

.clear-filters:hover {
    color: #d9d1ea;
}

.tag-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-button {
    padding: 4px 9px;

    border: 1px solid #4d4762;
    background: #1a1929;
    color: #a9a1bb;

    font-family: "Courier New", monospace;
    font-size: 11px;

    cursor: pointer;
}

.tag-button:hover {
    border-color: #83799f;
    color: #eeeafa;
}

.tag-button.active {
    border-color: #9a8eb8;
    background: #3a3450;
    color: #fff;
}

.active-filter-line {
    margin-top: 12px;
    color: #676078;
    font-size: 10px;
}

#activeFilters {
    color: #9a91ae;
}


/* =====================================================
   GALLERY TOOLBAR
   ===================================================== */

.gallery-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 36px;
    margin-bottom: 12px;

    color: #77708c;
    font-size: 11px;
}

.toolbar-label {
    margin-right: 5px;
}

.gallery-toolbar select {
    padding: 4px 7px;

    border: 1px solid #514b68;
    background: #171624;
    color: #bdb5cc;

    font-family: "Courier New", monospace;
    font-size: 11px;
}


/* =====================================================
   CHARACTER GRID
   ===================================================== */

/*
   The grid deliberately uses auto-fill instead of fixed columns.
   This means it can comfortably grow from 20 characters to 200+
   without changing the HTML.
*/

.character-grid {
    display: grid;

    grid-template-columns:
        repeat(auto-fill, minmax(145px, 1fr));

    gap: 15px;
}

.character-card {
    min-width: 0;
}

.character-icon-button {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1.12;

    padding: 0;

    overflow: hidden;

    border: 1px solid #514b68;
    background:
        radial-gradient(
            circle at center,
            rgba(116, 96, 160, 0.12),
            rgba(12, 12, 23, 0.9)
        );

    cursor: pointer;

    box-shadow:
        inset 0 0 18px rgba(0,0,0,0.3);

    transition:
        border-color 0.15s,
        transform 0.15s,
        box-shadow 0.15s;
}

.character-icon-button:hover,
.character-icon-button:focus-visible {
    outline: none;

    border-color: #a095bf;

    transform: translateY(-2px);

    box-shadow:
        0 4px 14px rgba(0,0,0,0.4),
        0 0 12px rgba(135,115,180,0.08);
}

.character-icon {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;

    /* Keeps pixel-art icons crisp if your source art is pixel art. */
    image-rendering: auto;

    transition: transform 0.2s;
}

.character-icon-button:hover .character-icon {
    transform: scale(1.025);
}

.character-name {
    display: block;

    margin-top: 6px;

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    color: #ddd7eb;
    font-size: 13px;
    text-decoration: none;
}

.character-name:hover {
    color: #ffffff;
    text-decoration: underline;
}

.character-meta {
    display: block;

    margin-top: 1px;

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    color: #6f687f;
    font-size: 9px;
}

.character-mini-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;

    margin-top: 5px;
    min-height: 17px;
}

.mini-tag {
    padding: 1px 4px;

    border: 1px solid #3f3a51;
    color: #777087;

    font-size: 8px;
    line-height: 1.4;
}


/* =====================================================
   LOAD MORE
   ===================================================== */

.load-more-wrap {
    display: flex;
    justify-content: center;

    padding: 30px 0 10px;
}

.load-more-button {
    padding: 9px 18px;

    border: 1px solid #68607f;
    background: #242039;
    color: #dcd5ea;

    font-family: "Courier New", monospace;
    font-size: 12px;

    cursor: pointer;
}

.load-more-button:hover {
    background: #3b3452;
    border-color: #9a90b6;
}


/* =====================================================
   EMPTY STATE
   ===================================================== */

.empty-state {
    max-width: 520px;
    margin: 35px auto;
    text-align: center;
}

.error-symbol {
    color: #887da2;
    font-size: 35px;
}

.empty-state h2 {
    margin-bottom: 5px;
}

.empty-state .submit-button {
    border: 1px solid #68607f;
}


/* =====================================================
   FULL REFERENCE MODAL
   ===================================================== */

.ref-modal[hidden] {
    display: none;
}

.ref-modal {
    position: fixed;
    inset: 0;

    z-index: 1000;

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

    padding: 25px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;

    background: rgba(5, 5, 13, 0.82);
    backdrop-filter: blur(3px);
}

.ref-window {
    position: relative;
    z-index: 2;

    width: min(1100px, 96vw);
    max-height: 92vh;

    overflow: hidden;

    border: 1px solid #82799e;
    background: #141420;

    box-shadow:
        0 0 0 2px #08080e,
        0 15px 50px rgba(0,0,0,0.65);
}

.modal-titlebar {
    position: relative;
}

.modal-close {
    margin-left: auto;

    width: 25px;
    height: 21px;

    border: 1px solid #9289a9;
    background: #2b283f;
    color: #f1ecfb;

    font-family: Arial, sans-serif;
    font-size: 15px;
    line-height: 1;

    cursor: pointer;
}

.modal-close:hover {
    background: #504865;
}

.ref-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;

    max-height: calc(92vh - 34px);
    overflow: auto;
}

.ref-image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 350px;
    padding: 25px;

    background:
        radial-gradient(
            circle,
            rgba(90,75,130,0.12),
            transparent 70%
        );

    border-right: 1px solid #393447;
}

.ref-image-wrap img {
    display: block;

    max-width: 100%;
    max-height: calc(92vh - 100px);

    width: auto;
    height: auto;

    object-fit: contain;

    image-rendering: auto;
}

.ref-info {
    padding: 28px 22px;
}

.ref-info h2 {
    margin-bottom: 10px;
    font-size: 27px;
}

.modal-blurb {
    color: #9e96af;
    font-size: 12px;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;

    margin: 18px 0;
}

.modal-tag {
    padding: 3px 6px;

    border: 1px solid #504963;
    color: #9a91ad;

    font-size: 9px;
}

.modal-profile-link {
    display: inline-block;

    margin-top: 8px;

    color: #c5bbdc;
    font-size: 12px;
}

.modal-profile-link:hover {
    color: white;
}


/* =====================================================
   ACCESSIBILITY
   ===================================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}


/* =====================================================
   MOBILE
   ===================================================== */

@media (max-width: 700px) {

    .gallery-intro .window-content {
        align-items: flex-start;
        flex-direction: column;
    }

    .archive-counter {
        align-self: flex-end;
    }

    .character-grid {
        grid-template-columns:
            repeat(auto-fill, minmax(115px, 1fr));
        gap: 12px;
    }

    .character-name {
        font-size: 12px;
    }

    .gallery-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .ref-content {
        grid-template-columns: 1fr;
    }

    .ref-image-wrap {
        min-height: 250px;
        border-right: 0;
        border-bottom: 1px solid #393447;
    }

    .ref-image-wrap img {
        max-height: 58vh;
    }

    .ref-info {
        padding: 18px;
    }
}
