/* ==========================================================================
   The Archive: category, tag, search and byline listings
   --------------------------------------------------------------------------
   Loaded only by the four listing views (via @push('styles')), after app.css,
   so the rules here win where they overlap without touching any other page.

   The palette deliberately mirrors the home redesign sheets, not app.css's
   tokens: the home page's bronze is the brighter #bd7e36 while app.css's
   --brass is #8a651f, and the two pages must read as one publication when a
   reader moves from the front page into an archive.

   Shape of a listing page:
     crumbs -> head band (title / stand / count / search)
            -> tabs (sub-desks)
            -> filter bar (year + tag), sticky under the condensed masthead
            -> lead story, then a three-up grid of cards
            -> pager

   The archive card (.archive-card) is a fork of the home page's .news-card
   recipe (public/css/home-hero-news.css). One deliberate difference: media is
   locked to 16:9 rather than the home card's fixed 122px height, which was
   calibrated to a ~245px column and would letterbox at this full width.
   Keep the two in sync when either recipe changes.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
    --arc-bronze: #bd7e36;
    --arc-bronze-deep: #a96c2e;
    --arc-bronze-wash: #fcf6ec;
    --arc-bronze-ink: #9c6328;
    --arc-ink: #111827;
    --arc-ink-soft: #4b5563;
    --arc-ink-faint: #6b7280;
    --arc-rule: #e5e7eb;
    --arc-rule-soft: #f3f4f6;
    --arc-radius: 6px;
    /* The condensed masthead's height; the filter bar tucks in under it. */
    --arc-masthead: 58px;
}

/* --------------------------------------------------------------------------
   2. Shell and breadcrumbs
   -------------------------------------------------------------------------- */
.archive-shell {
    padding-top: 1.5rem;
    padding-bottom: 3.5rem;
}

.archive-shell .crumbs {
    padding-top: 0.35rem;
}

.archive-shell .crumbs__list a:hover {
    color: var(--arc-bronze);
}

/* --------------------------------------------------------------------------
   3. Head band: the section's name, stand and count, closing on a heavy rule.
   -------------------------------------------------------------------------- */
.archive-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.1rem 2.5rem;
    align-items: end;
    padding: 1.1rem 0 1.3rem;
    border-bottom: 2px solid var(--ink);
}

@media (min-width: 900px) {
    .archive-head {
        grid-template-columns: minmax(0, 1fr) 20rem;
    }
}

.archive-head__title {
    font-size: clamp(2rem, 3.4vw, 2.6rem);
    font-weight: 500;
    letter-spacing: -0.022em;
    line-height: 1.06;
    color: var(--arc-ink);
}

.archive-head__stand {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--arc-ink-soft);
    margin-top: 0.6rem;
    max-width: 62ch;
}

.archive-head__count {
    font-size: 0.8125rem;
    color: var(--arc-ink-faint);
    margin-top: 0.5rem;
    font-variant-numeric: tabular-nums;
}

/* The archive search: a proper field with the glass set inside it. */
.archive-search {
    position: relative;
    display: flex;
    align-items: center;
}

.archive-search__input {
    width: 100%;
    background: #fff;
    border: 1px solid var(--arc-rule);
    border-radius: var(--arc-radius);
    padding: 0.6rem 2.6rem 0.6rem 0.85rem;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: var(--arc-ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.archive-search__input::placeholder {
    color: var(--arc-ink-faint);
}

.archive-search__input:focus {
    outline: none;
    border-color: var(--arc-bronze);
    box-shadow: 0 0 0 3px rgba(189, 126, 54, 0.14);
}

.archive-search__submit {
    position: absolute;
    right: 0.3rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2.1rem;
    height: 2.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    color: var(--arc-ink-faint);
    transition: color 0.15s ease;
}

.archive-search__submit:hover {
    color: var(--arc-bronze);
}

/* --------------------------------------------------------------------------
   4. Tabs: the sub-desks, underlined in bronze when current.
   -------------------------------------------------------------------------- */
.archive-tabs {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    border-bottom: 1px solid var(--arc-rule);
    margin-top: 0.35rem;
}

.archive-tab {
    position: relative;
    padding: 0.7rem 0.1rem 0.55rem;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--arc-ink-soft);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.archive-tab:hover {
    color: var(--arc-ink);
}

.archive-tab.is-active {
    color: var(--arc-ink);
    font-weight: 600;
}

.archive-tab.is-active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2.5px;
    background: var(--arc-bronze);
    border-radius: 2px 2px 0 0;
}

/* --------------------------------------------------------------------------
   5. Filter bar: years and tags, sticky under the condensed masthead.
   -------------------------------------------------------------------------- */
.archive-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem 1.25rem;
    padding: 0.7rem 0;
    background: #fff;
    border-bottom: 1px solid var(--arc-rule);
}

@media (min-width: 768px) {
    .archive-filters {
        position: sticky;
        top: var(--arc-masthead);
        /* Below the masthead (60) and its search panel (70). */
        z-index: 50;
    }
}

.archive-filters__group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    min-width: 0;
}

.archive-filters__label {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--arc-ink-faint);
    margin-right: 0.15rem;
}

.archive-filters__sep {
    width: 1px;
    height: 1.1rem;
    background: var(--arc-rule);
}

.archive-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.28rem 0.6rem;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--arc-ink-soft);
    background: var(--arc-rule-soft);
    border: 1px solid transparent;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.archive-filter-chip:hover {
    background: #e5e7eb;
    color: var(--arc-ink);
}

.archive-filter-chip.is-active {
    background: var(--arc-bronze);
    color: #fff;
}

.archive-filter-chip__count {
    font-size: 0.6875rem;
    font-variant-numeric: tabular-nums;
    opacity: 0.72;
}

.archive-filters__tag {
    text-decoration: none;
    transition: background 0.15s ease;
}

.archive-filters__tag:hover {
    background: #f6e8d2;
}

.archive-filters__tag-count {
    margin-left: 0.35rem;
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
}

.archive-filters__clear {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--arc-bronze-ink);
    text-decoration: none;
}

.archive-filters__clear:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* --------------------------------------------------------------------------
   6. Lead story: the first file on page one, given the room to open the desk.
   -------------------------------------------------------------------------- */
.archive-lead {
    margin: 1.6rem 0 2rem;
    background: #fff;
    border: 1px solid var(--arc-rule);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.archive-lead--text {
    border-top: 3px solid var(--arc-bronze);
}

.archive-lead__link {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    text-decoration: none;
    color: inherit;
}

@media (min-width: 900px) {
    .archive-lead__link {
        grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    }
}

.archive-lead__media {
    position: relative;
    overflow: hidden;
    background: var(--arc-rule-soft);
    min-height: 220px;
}

.archive-lead__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.archive-lead:hover .archive-lead__media img {
    transform: scale(1.03);
}

.archive-lead__body {
    display: flex;
    flex-direction: column;
    padding: 1.35rem 1.45rem 1.5rem;
}

/* Beside the picture the body can be shorter than the image; centre it rather
   than leave the call to action stranded at the foot of the card. */
@media (min-width: 900px) {
    .archive-lead__body {
        justify-content: center;
    }
}

@media (min-width: 900px) {
    .archive-lead--text .archive-lead__body {
        padding: 1.85rem 2rem 2rem;
    }
}

.archive-lead__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.archive-lead__date {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--arc-ink-faint);
}

.archive-lead__desk {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--arc-bronze);
}

.archive-lead__title {
    font-size: clamp(1.5rem, 2.6vw, 2.05rem);
    font-weight: 500;
    letter-spacing: -0.015em;
    line-height: 1.16;
    color: var(--arc-ink);
    margin: 0 0 0.7rem;
    transition: color 0.16s ease;
}

.archive-lead:hover .archive-lead__title {
    color: var(--arc-bronze);
}

.archive-lead__dek {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--arc-ink-soft);
    margin: 0 0 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.archive-lead__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-top: 0.15rem;
}

.archive-lead__cta {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 1.25rem;
    padding: 0.62rem 1.15rem;
    background: var(--arc-bronze);
    color: #fff;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 600;
    transition: background 0.16s ease, transform 0.12s ease;
}

.archive-lead:hover .archive-lead__cta {
    background: var(--arc-bronze-deep);
    transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   7. The grid: every other file, as cards.
   -------------------------------------------------------------------------- */
.archive-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.15rem;
}

.archive-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border: 1px solid var(--arc-rule);
    border-radius: var(--arc-radius);
    overflow: hidden;
    transition: box-shadow 0.18s ease, transform 0.14s ease, border-color 0.15s ease;
}

.archive-card:hover {
    box-shadow: 0 6px 18px -4px rgba(0, 0, 0, 0.07);
    transform: translateY(-2px);
    border-color: #d1d5db;
}

.archive-card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.archive-card__media-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--arc-rule-soft);
}

.archive-card__media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.archive-card:hover .archive-card__media {
    transform: scale(1.03);
}

.archive-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 0.85rem 0.95rem 1rem;
}

.archive-card--text .archive-card__body {
    padding-top: 1.1rem;
}

.archive-card__date {
    font-size: 0.775rem;
    font-weight: 500;
    color: var(--arc-ink-faint);
    margin-bottom: 0.45rem;
}

.archive-card__title {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--arc-ink);
    margin: 0 0 0.85rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.16s ease;
}

.archive-card:hover .archive-card__title {
    color: var(--arc-bronze);
}

.archive-card__cat {
    margin-top: auto;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--arc-bronze);
}

/* --------------------------------------------------------------------------
   8. Empty states
   -------------------------------------------------------------------------- */
.archive-empty {
    padding: 2.5rem 0 0;
    border-top: 1px solid var(--arc-rule);
}

/* The wrapper draws the rule; the app.css .empty box would double it. */
.archive-empty .empty {
    padding: 0;
    border-top: 0;
}

.archive-empty__clear {
    color: var(--arc-bronze-ink);
    font-weight: 600;
    text-decoration: none;
}

.archive-empty__clear:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* --------------------------------------------------------------------------
   9. Pager and ad slots on archive pages
   -------------------------------------------------------------------------- */
.archive-shell .pager {
    margin-top: 2.5rem;
    border-top: 1px solid var(--arc-rule);
}

.archive-shell .pager__link:hover {
    color: var(--arc-bronze);
    border-color: var(--arc-bronze);
}

.archive-shell .pager__current {
    background: var(--arc-bronze);
    border-color: var(--arc-bronze);
    color: #fff;
}

.archive-shell .ad {
    margin: 1.5rem 0;
}

/* --------------------------------------------------------------------------
   10. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1023px) {
    .archive-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .archive-cards {
        grid-template-columns: minmax(0, 1fr);
    }

    .archive-tabs {
        gap: 1.15rem;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .archive-tabs::-webkit-scrollbar {
        display: none;
    }

    /* The year row scrolls sideways rather than wrapping into a wall;
       the whole bar goes static under the masthead on small screens. */
    .archive-filters__group--years {
        flex-wrap: nowrap;
        overflow-x: auto;
        max-width: 100%;
        scrollbar-width: none;
    }

    .archive-filters__group--years::-webkit-scrollbar {
        display: none;
    }

    .archive-filters__sep {
        display: none;
    }

    .archive-lead__media {
        min-height: 190px;
    }
}
