.archive-filter-chip {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0.5rem 0.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: 9999px;
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    cursor: pointer;
    user-select: none;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.archive-filter-chip:hover {
    border-color: hsl(var(--gold));
    background: hsl(var(--gold) / 0.12);
    transform: translateY(-1px);
}

.archive-filter-chip[data-selected="true"] {
    border-color: hsl(var(--gold));
    background: hsl(var(--gold));
    color: hsl(var(--primary-foreground));
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--gold) / 0.55);
    font-weight: 700;
}

.archive-filter-chip[data-selected="true"]::before {
    content: "✓";
    margin-right: 0.35rem;
    font-weight: 800;
}

.archive-filter-chip:has(input:focus-visible) {
    outline: 3px solid hsl(var(--ring));
    outline-offset: 3px;
}

[data-result-card] > a:first-child {
    cursor: pointer;
}

.archive-result-title--compact,
.archive-result-metadata--compact {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    overflow-wrap: anywhere;
}

.archive-result-title--compact {
    max-height: 3rem;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.archive-result-metadata--compact {
    max-height: 4.5rem;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.archive-recently-viewed {
    margin-bottom: 1.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
    padding: 1rem;
    background: hsl(var(--card));
}

.archive-recently-viewed__heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.archive-recently-viewed__list {
    display: grid;
    grid-auto-columns: minmax(11rem, 13rem);
    grid-auto-flow: column;
    gap: 0.75rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding: 0 0 0.7rem;
    scrollbar-color: hsl(var(--gold)) hsl(var(--muted));
    scrollbar-width: thin;
}

.archive-recently-viewed__list::-webkit-scrollbar {
    height: 0.55rem;
}

.archive-recently-viewed__list::-webkit-scrollbar-track {
    border-radius: 999px;
    background: hsl(var(--muted));
}

.archive-recently-viewed__list::-webkit-scrollbar-thumb {
    border: 2px solid hsl(var(--muted));
    border-radius: 999px;
    background: hsl(var(--gold));
}

.archive-recently-viewed__list a {
    display: grid;
    grid-template-columns: 3.25rem minmax(0, 1fr);
    gap: 0.65rem;
    align-items: center;
    min-height: 4rem;
    border: 1px solid hsl(var(--border));
    border-radius: 0.55rem;
    padding: 0.4rem;
    background: hsl(var(--background));
    text-decoration: none;
}

.archive-recently-viewed__list a:hover {
    border-color: hsl(var(--gold));
}

.archive-recently-viewed__list img,
.archive-recently-viewed__placeholder {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.4rem;
    background: hsl(var(--muted));
}

/* Display the complete photograph within the existing Recently Viewed tile. */
.archive-recently-viewed__list img {
    object-fit: contain;
    object-position: center;
}

.archive-recently-viewed__placeholder {
    display: grid;
    place-items: center;
    padding: 0.25rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.62rem;
    text-align: center;
}

.archive-recently-viewed__list small,
.archive-recently-viewed__list strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.archive-recently-viewed__list small {
    color: hsl(var(--muted-foreground));
    font-size: 0.68rem;
}

/* The recently viewed selector is more specific than Tailwind's utility
   class. Explicitly preserve the red identifier on confidential items. */
.archive-recently-viewed__list small.text-destructive {
    color: hsl(var(--destructive));
    font-weight: 600;
}

.archive-recently-viewed__list strong {
    font: 600 0.86rem var(--font-heading);
}

/* Pagination has the entire footer width: no page-size control competes for it.
   The layout responds to the RESULTS COLUMN, not the viewport width. */
.archive-pagination-footer {
    container: archive-pagination / inline-size;
    min-width: 0;
    margin-top: 2rem;
}

.archive-pagination-nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: clamp(0.25rem, 1vw, 0.75rem);
    width: 100%;
    min-width: 0;
    margin: 0;
}

.archive-pagination-nav .archive-pagination-edge {
    display: flex;
    align-items: center;
    min-width: 0;
    background: transparent;
}

.archive-pagination-nav .archive-pagination-edge--previous {
    justify-content: flex-start;
}

.archive-pagination-nav .archive-pagination-edge--next {
    justify-content: flex-end;
}

.archive-pagination-nav .archive-pagination-pages {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 0;
    white-space: nowrap;
    background: transparent;
}

.archive-pagination-nav .archive-pagination-pages--medium,
.archive-pagination-nav .archive-pagination-indicator {
    display: none;
}

.archive-pagination-nav .archive-pagination-link {
    display: inline-flex;
    flex: 0 0 auto;
    min-width: 2.75rem;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 0.55rem 0.8rem;
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.archive-pagination-nav a.archive-pagination-link:hover {
    border-color: hsl(var(--gold));
    background: hsl(var(--gold) / 0.12);
}

.archive-pagination-nav .archive-pagination-link--direction {
    gap: 0.35rem;
    padding-inline: 1rem;
}

.archive-pagination-nav .archive-pagination-link--current {
    border-color: hsl(var(--gold));
    background: hsl(var(--gold));
    color: hsl(var(--primary-foreground));
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--gold) / 0.42);
    font-weight: 800;
    cursor: default;
}

.archive-pagination-nav .archive-pagination-ellipsis {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    padding-inline: 0.15rem;
    background: transparent;
    color: hsl(var(--muted-foreground));
}

.archive-pagination-nav .archive-pagination-indicator {
    white-space: nowrap;
    color: hsl(var(--foreground));
    background: transparent;
    font-weight: 600;
}

.archive-pagination-nav .archive-pagination-indicator__short {
    display: none;
}

/* The results area becomes narrower when the desktop sidebar is present.
   Eliminate extra page numbers before any controls could collide. */
@container archive-pagination (max-width: 56rem) {
    .archive-pagination-nav .archive-pagination-pages--wide {
        display: none;
    }

    .archive-pagination-nav .archive-pagination-pages--medium {
        display: flex;
    }

    .archive-pagination-nav .archive-pagination-direction-label {
        display: none;
    }

    .archive-pagination-nav .archive-pagination-link--direction {
        padding-inline: 0.75rem;
    }
}

/* On phones and at high browser zoom, use a single translated page indicator.
   The previous and next links remain in the same positions. */
@container archive-pagination (max-width: 31rem) {
    .archive-pagination-nav .archive-pagination-pages--medium {
        display: none;
    }

    .archive-pagination-nav .archive-pagination-indicator {
        display: inline-flex;
    }
}

/* At extremely narrow widths, retain the page and total without long words. */
@container archive-pagination (max-width: 23rem) {
    .archive-pagination-nav .archive-pagination-indicator__full {
        display: none;
    }

    .archive-pagination-nav .archive-pagination-indicator__short {
        display: inline;
    }

    .archive-pagination-nav .archive-pagination-link--direction {
        padding-inline: 0.5rem;
    }
}

.archive-page-size-control {
    display: inline-flex;
    grid-column: 3;
    justify-self: end;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    gap: 0.65rem;
    min-height: 2.75rem;
    padding: 0.45rem 0.5rem 0.45rem 0.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: 0.65rem;
    background: hsl(var(--card));
    box-shadow: 0 0.25rem 0.8rem hsl(var(--foreground) / 0.05);
}

/* The two groups need independent rows before their intrinsic widths
   compete for the same tracks. Pagination stays centered; page size stays
   right-aligned. Navigation links and translated labels may still wrap. */
@container archive-pagination (max-width: 46rem) {
    .archive-pagination-footer [data-keyboard-pagination] {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .archive-page-size-control {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

.archive-page-size-control label {
    margin: 0;
    color: hsl(var(--muted-foreground));
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
}

.archive-page-size-select {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 4.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.archive-page-size-select:hover {
    border-color: hsl(var(--gold));
    background: hsl(var(--gold) / 0.08);
}

.archive-page-size-select select {
    width: 100%;
    min-height: 2.15rem;
    appearance: none;
    border: 0;
    border-radius: inherit;
    outline: 0;
    background: transparent;
    color: hsl(var(--foreground));
    color-scheme: light;
    cursor: pointer;
    padding: 0.3rem 1.8rem 0.3rem 0.7rem;
    font: inherit;
    font-weight: 700;
}

.dark .archive-page-size-select select {
    color-scheme: dark;
}

.archive-page-size-select select option {
    background: hsl(var(--popover));
    color: hsl(var(--popover-foreground));
}

.archive-page-size-select select option:checked,
.archive-page-size-select select option:hover {
    background: Highlight;
    color: HighlightText;
}

.archive-page-size-select > span {
    position: absolute;
    right: 0.55rem;
    pointer-events: none;
    color: hsl(var(--gold));
}

.archive-page-size-select:focus-within {
    border-color: hsl(var(--ring));
    outline: 3px solid hsl(var(--ring));
    outline-offset: 3px;
}

.archive-page-size-select select:focus-visible {
    outline: 0;
}

.object-action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.object-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.65rem 0.9rem;
    border: 1px solid hsl(var(--gold));
    border-radius: var(--radius);
    font-weight: 700;
    cursor: pointer;
}

.object-action-link:hover {
    background: hsl(var(--gold) / 0.14);
}


.archive-results-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}

.archive-results-heading__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

.archive-compare-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0.55rem 0.8rem;
    border: 1px solid hsl(var(--gold));
    border-radius: var(--radius);
    background: hsl(var(--gold));
    color: hsl(var(--primary-foreground));
    font-weight: 700;
    text-decoration: none;
}

.archive-compare-link:hover {
    filter: brightness(1.07);
}

.archive-result-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(13rem, 100%), 1fr));
}

[data-result-card] {
    min-width: 0;
}

[data-result-card] > [data-search-result-link] {
    min-width: 0;
}

.archive-result-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
}


.archive-result-text-tile {
  display: grid;
  width: 100%;
  height: 100%;
  place-content: center;
  gap: 0.55rem;
  padding: 1.25rem;
  text-align: center;
  color: hsl(var(--foreground));
  background:
    linear-gradient(145deg, hsl(var(--gold) / 0.16), transparent 58%),
    hsl(var(--muted));
}

.archive-result-text-tile strong {
  font-family: var(--font-heading, Georgia, serif);
  font-size: clamp(1rem, 2vw, 1.45rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.archive-result-text-tile small {
  color: hsl(var(--muted-foreground));
  font-size: 0.85rem;
}

.archive-result-text-tile--mobile {
  width: 5rem;
  height: 5rem;
  flex: 0 0 5rem;
  border-radius: 0.375rem;
  padding: 0.4rem;
}

.archive-result-text-tile--mobile strong {
  font-size: 0.72rem;
}

.archive-result-text-tile--mobile small {
  font-size: 0.65rem;
}

/* Search header: section/category chips sit above the query field while the
   currently applied terms and facets sit below it as individually removable chips. */
.archive-search-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem 2rem;
}

.archive-section-nav {
    display: flex;
    flex: 0 1 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    min-width: 0;
}

.archive-query-entry {
    min-width: 8rem;
}

.archive-applied-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 0.8rem;
}

.archive-applied-chips[hidden] {
    display: none;
}

.archive-applied-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.1rem;
    margin: 0;
    border: 1px solid hsl(var(--gold) / 0.5);
    border-radius: 9999px;
    padding: 0.35rem 0.55rem 0.35rem 0.75rem;
    background: hsl(var(--gold) / 0.08);
    color: hsl(var(--foreground));
    font-size: 0.88rem;
    line-height: 1;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.archive-applied-chip:hover {
    border-color: hsl(var(--gold));
    background: hsl(var(--gold) / 0.16);
    transform: translateY(-1px);
}

.archive-applied-chip__remove {
    display: grid;
    width: 1.2rem;
    height: 1.2rem;
    place-items: center;
    border-radius: 9999px;
    background: hsl(var(--gold) / 0.2);
    color: hsl(var(--foreground));
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
}

/* Preserve the desktop title/category split but prevent an orphaned category. */
@media (min-width: 1536px) {
    .archive-search-heading-row > div:first-child {
        flex: 1 1 0;
        min-width: 0;
    }

    .archive-section-nav {
        flex: 0 0 auto;
        flex-wrap: nowrap;
    }
}

/* Give navigation a complete row when the title and seven buttons cannot coexist. */
@media (min-width: 768px) and (max-width: 1535px) {
    .archive-search-heading-row {
        flex-direction: column;
        align-items: stretch;
    }

    .archive-section-nav {
        flex: 0 0 auto;
        width: 100%;
        flex-wrap: nowrap;
        justify-content: center;
        overflow-x: visible;
    }

    .archive-section-nav > a {
        flex: 0 1 auto;
        min-width: 0;
        justify-content: center;
        text-align: center;
        overflow-wrap: anywhere;
    }
}

/* On narrower tablets, two balanced rows (4 + 3) avoid a lone Auctions chip. */
@media (min-width: 768px) and (max-width: 1199px) {
    .archive-section-nav {
        display: grid;
        grid-template-columns: repeat(12, minmax(0, 1fr));
        justify-content: stretch;
    }

    .archive-section-nav > a {
        grid-column: span 3;
        justify-content: center;
        min-width: 0;
        text-align: center;
        white-space: normal;
    }

    .archive-section-nav > a:nth-child(n + 5) {
        grid-column: span 4;
    }
}

/* Keep existing mobile navigation and horizontal scrolling unchanged. */
@media (max-width: 767px) {
    .archive-search-heading-row {
        flex-direction: column;
    }

    .archive-section-nav {
        width: 100%;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.35rem;
        overscroll-behavior-inline: contain;
    }

    .archive-section-nav > a {
        flex: 0 0 auto;
    }
}
