/* ── Gallery Page ───────────────────────────────── */

.gallery-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 3rem 2rem 5rem;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px double var(--ink);
}

.gallery-footer {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    border-top: 3px double var(--ink);
    padding-top: 1rem;
    margin-top: 2rem;
}

h1 {
    font-family: Yatra One;
    font-size: 3rem;
    font-weight: 700;
    text-transform: uppercase;
}

.gallery-header .right-side {
    display: flex;
    align-items: center;
    gap: 2rem;
}

/* ── Gallery Search (Animated) ─────────────────── */

.search-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gallery-header .search-input-wrapper {
    position: relative;
    width: 0;
    transition: width 0.4s ease;
}

.gallery-header .search-input-wrapper input {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.gallery-header .search-form.expanded .search-input-wrapper input {
    opacity: 1;
    pointer-events: auto;
}

.gallery-header .search-form.expanded .search-input-wrapper {
    width: 200px;
}

.search-input-wrapper input {
    width: 100%;
    padding: 8px 10px;
    font-family: var(--font-monospace);
    font-size: 0.8rem;
    border-radius: 0.5rem;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

/* Search button */

.search-button {
    display: flex;
    align-items: center;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    color: var(--ink);
}

.search-button:hover {
    color: var(--accent-yellow);
}

/* Autocomplete */

.autocomplete-items {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;

    width: 200px;
    max-height: 200px;
    overflow-y: auto;

    background-color: var(--ink);
    color: var(--paper-dark);

    border-radius: 0.5rem;
    z-index: 99;
}

.autocomplete-items div {
    padding: 8px 10px;
    font-family: Georama;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
}

.autocomplete-items div:hover {
    background-color: #e9e9e9;
}

/* ── Year Navigation ───────────────────────────── */

.gallery-year-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-sans);
    padding-bottom: 0.5rem;
}

.current-year {
    font-size: 1.5rem;
    font-weight: 500;
}

.year-nav-btn {
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    color: var(--accent);
    transition: opacity 0.15s;
}

.year-nav-btn:hover {
    opacity: 0.7;
}

.gallery-count {
    margin: 1rem 0 2rem;
    font-family: var(--font-sans);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ── Gallery Grid ───────────────────────────── */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    align-items: self-start;
    gap: 1.5rem;
}

/* ── Thumbnail Component ─────────────────────── */

.thumbnail {
    border: 2px solid var(--muted);
    transition: transform 0.15s, box-shadow 0.15s;
}

.thumbnail:hover {
    transform: translateY(-4px);
    box-shadow: 6px 6px 0 var(--ink);
}

.thumbnail-link {
    display: block;
}

.thumbnail-img-wrap {
    aspect-ratio: 4/5;
    background: var(--paper-dark);
    border-bottom: 2px solid var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.thumbnail-display {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
}

.thumbnail-display.left {
    background-position: left;
}

.thumbnail-display.right {
    background-position: right;
}

.thumb-number {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--ink);
    opacity: 0.12;
}

.thumbnail-meta {
    display: flex;
    flex-direction: column;
    row-gap: 0.25rem;
    padding: 0.75rem 0.9rem;
}

.thumbnail-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
}

.thumbnail-date {
    font-family: var(--font-sans);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--muted);
}

.thumbnail-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.thumbnail .tag {
    padding: 0.25rem 0.5rem;
    font-family: Georama;
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    border-radius: 0.2rem;
    white-space: nowrap;
}

.attributes {
    background-color: var(--paper-dark);
    color: var(--ink);
    border: 1px solid var(--ink);
}

.character {
    background-color: var(--accent-purple);
    color: var(--paper-dark);
}

.destination {
    background-color: var(--accent-yellow);
    color: var(--paper-dark);
}

/* ── Search Page Controls ───────────────── */

.search-controls {
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.active-tags {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-width: 50%;
}

.tag-chip {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    font-family: Georama;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 0.3rem;
}

.tag-chip button {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    background-color: var(--accent-red);
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    color: inherit;
    border-radius: 50%;
}

.tag-input-row {
    position: relative;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.tag-input-row .input-and-logic {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

.tag-input-row .search-input-wrapper {
    width: 200px;
}

.tag-input-row input {
    width: 100%;
}

.tag-input-row .input-and-logic .logic-select {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-sans);
    font-size: 0.8rem;
}

.tag-input-row .input-and-logic .logic-select label {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
}

.pagination {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    margin: 3rem 0 0 0;
    font-family: Georama;
    font-size: 0.85rem;
    font-weight: normal;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--muted);
}

.pagination a {
    font-weight: bold;
    color: var(--ink);
}

/* ── Mobile ───────────────────────── */

@media (max-width: 900px) {

    .gallery-page {
        padding: 1.5rem 2rem 3rem;
    }

    .gallery-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        border-bottom: 2px double var(--ink);
        padding-bottom: 0.75rem;
        margin-bottom: 0.5rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }

    .thumb-number {
        font-size: 2.2rem;
    }

    .thumbnail-title {
        font-size: 0.85rem;
    }

    .thumbnail-date {
        font-size: 0.6rem;
    }

    .gallery-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        border-top: 2px double var(--ink);
        padding-top: 0.75rem;
        margin-top: 1.5rem;
    }

    /* ── Search (Mobile) ───────────────────────── */

    .gallery-header .right-side {
        width: 100%;
        justify-content: space-between;
    }

    /* animated gallery search */

    .gallery-header .search-form.expanded .search-input-wrapper {
        width: 140px;
    }

    .autocomplete-items {
        width: 100%;
    }

    /* ── Active Tags ───────────────────────── */

    .active-tags {
        max-width: 100%;
        justify-content: flex-start;
        margin-top: 0.25rem;
    }

    /* ── Search Controls ───────────────────────── */

    .search-controls {
        gap: 1rem;
    }

    .tag-input-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .tag-input-row .input-and-logic {
        width: 100%;
        justify-content: space-between;
        align-items: stretch;
        gap: 0.75rem;
    }

    .tag-input-row .search-input-wrapper {
        position: relative;
        width: 200px;
    }

    .tag-input-row input {
        font-size: 0.85rem;
    }

    /* logic selector */

    .tag-input-row .input-and-logic .logic-select {
        justify-content: flex-start;
        gap: 2rem;
    }

    /* search button */

    #apply-search {
        width: 100%;
    }

    /* ── Pagination ───────────────────────── */

    .pagination {
        flex-direction: column;
        gap: 0.75rem;
    }

    .pagination a {
        font-size: 0.8rem;
    }

    /* ── Tag Chips ───────────────────────── */

    .tag-chip {
        font-size: 0.7rem;
    }

    .tag-chip button {
        width: 18px;
        height: 18px;
        font-size: 0.9rem;
    }
}