/* Archive — public search/browse page at /content/.
 * Design tokens: Oswald (inherited site-wide via *), brand green #1e8d20,
 * text #111 / #313232 / #777, sharp corners (border-radius: 0) per TSS.
 */

/* Page wrapper — match TSS marketing convention from .sg / sneaker-guide:
 * max-width + auto-centered + horizontal padding. Vertical padding comes
 * from .tss-page-container (55/40). */
.archive-page {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
}
@media (max-width: 600px) {
    .archive-page { padding-left: 16px; padding-right: 16px; }
}

.archive-header { margin-bottom: 36px; text-align: center; }
.archive-header h1 {
    /* Inherits .tss-page-container h1: 36px / 300 / uppercase / 0.5px tracking */
    margin: 0 0 12px;
}
.archive-header-desc {
    color: #313232;
    margin: 0;
    font-size: 16px;
}

.archive-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    align-items: flex-start;
}
/* When the sidebar <details> is collapsed, reflow the grid so the result
 * column claims the freed horizontal space. :has() is supported in all
 * current evergreen browsers. */
.archive-layout:has(.archive-sidebar-details:not([open])) {
    grid-template-columns: auto 1fr;
}
@media (max-width: 768px) {
    .archive-layout,
    .archive-layout:has(.archive-sidebar-details:not([open])) {
        grid-template-columns: 1fr; gap: 24px;
    }
    .archive-sidebar { order: -1; }
}

/* ----- Sidebar / filters ----- */
.archive-sidebar-details { margin: 0; }
.archive-sidebar-details > summary {
    /* Strip default browser marker; we draw our own chevron. */
    list-style: none;
    cursor: pointer;
}
.archive-sidebar-details > summary::-webkit-details-marker { display: none; }

.archive-sidebar-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    background: #fff;
    border: 1px solid #c3c3c3;
    color: #111;
    font-family: 'Oswald', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    transition: background-color .14s, color .14s, border-color .14s;
}
.archive-sidebar-summary:hover {
    background: #1e8d20;
    color: #fff;
    border-color: #1e8d20;
}
.archive-sidebar-summary::after {
    content: "";
    width: 0; height: 0;
    border-left: 5px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform .2s ease;
}
.archive-sidebar-details[open] .archive-sidebar-summary::after {
    transform: rotate(90deg);
}
.archive-sidebar-details[open] .archive-sidebar-summary {
    margin-bottom: 14px;
}

.archive-filters { display: flex; flex-direction: column; gap: 14px; }

/* Filter sections — no boxes. Each section header (legend OR summary) is
 * unified to a single typographic treatment: uppercase text on a thin
 * underline. */
.archive-filters-section,
.archive-filters-tags {
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
}
.archive-filters-section legend,
.archive-filters-tags > summary {
    width: 100%;
    box-sizing: border-box;
    padding: 0 0 6px;
    margin: 0 0 10px;
    border-bottom: 1px solid #c3c3c3;
    font-weight: 500;
    font-size: 13px;
    color: #111;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    list-style: none;
}
.archive-filters-tags > summary::-webkit-details-marker { display: none; }
/* Subtle chevron on tag-group summaries only — collapsibility cue without
 * disrupting typographic parity with legends. */
.archive-filters-tags > summary {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.archive-filters-tags > summary::after {
    content: "";
    width: 0; height: 0;
    border-left: 4px solid currentColor;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
    transition: transform .2s ease;
}
.archive-filters-tags[open] > summary::after {
    transform: rotate(90deg);
}

.archive-filters-section label {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; line-height: 1.7; color: #313232;
    font-weight: 400;
    margin-top: 2px;
}
.archive-filters-section input[type="checkbox"],
.archive-filters-section input[type="radio"] {
    accent-color: #1e8d20;
}
.archive-filters-section input[type="date"] {
    font-family: 'Oswald', sans-serif;
    font-size: 14px;
    padding: 6px 8px;
    border: 1px solid #c3c3c3;
    color: #313232;
    background: #fff;
}

.archive-filters-tag-list {
    display: flex; flex-direction: column; gap: 4px;
    padding: 4px 0 4px 4px;
}
.archive-filters-tag-list label {
    font-size: 14px; color: #313232; gap: 8px;
    display: flex; align-items: center;
}
.archive-filters-tag-list input[type="checkbox"] { accent-color: #1e8d20; }

.archive-filters-actions {
    display: flex; align-items: center; gap: 16px;
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px solid #e0e0e0;
}
.archive-filters-apply {
    /* Match TSS .form-btn-default convention */
    background: #313232;
    color: #fff;
    border: 0;
    border-radius: 0;
    padding: 10px 22px;
    height: 44px;
    font-family: 'Oswald', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
}
.archive-filters-apply:hover { background: #1e8d20; }
.archive-filters-clear { font-size: 13px; color: #777; text-decoration: underline; }
.archive-filters-clear:hover { color: #1e8d20; }

/* ----- Search + toolbar ----- */
.archive-search { display: flex; gap: 8px; margin-bottom: 20px; }
.archive-search-input {
    flex: 1;
    padding: 10px 14px;
    font-size: 16px;
    font-family: 'Oswald', sans-serif;
    border: 1px solid #c3c3c3;
    color: #111;
    background: #fff;
    height: 44px;
}
.archive-search-input:focus { outline: 0; border-color: #1e8d20; }
.archive-search-button {
    padding: 0 22px; height: 44px;
    background: #313232; color: #fff; border: 0; border-radius: 0;
    font-family: 'Oswald', sans-serif; font-size: 14px; font-weight: 500;
    text-transform: uppercase; letter-spacing: 1px; cursor: pointer;
}
.archive-search-button:hover { background: #1e8d20; }

.archive-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
    padding-bottom: 16px; border-bottom: 1px solid #e0e0e0;
}
.archive-result-count {
    font-size: 13px; color: #777;
    text-transform: uppercase; letter-spacing: 0.8px;
}
.archive-sort {
    display: inline-flex;
    border: 1px solid #c3c3c3;
}
.archive-sort-pill {
    padding: 8px 18px; font-size: 13px; color: #313232; text-decoration: none;
    text-transform: uppercase; letter-spacing: 1px;
    background: #fff;
}
.archive-sort-pill + .archive-sort-pill { border-left: 1px solid #c3c3c3; }
.archive-sort-pill.is-active { background: #1e8d20; color: #fff; }
.archive-sort-pill:hover:not(.is-active) { background: #f5f5f5; color: #111; }

/* ----- Grid ----- */
.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
}
.archive-empty {
    grid-column: 1 / -1;
    color: #777; padding: 60px 0; text-align: center;
    font-size: 16px;
}

/* ----- Card (equal heights via flex column) ----- */
.archive-card {
    background: #fff;
    border: 1px solid #e6e6e6;
    transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.archive-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(17, 17, 17, 0.10);
    border-color: #c3c3c3;
}
.archive-card-link {
    display: flex; flex-direction: column; height: 100%;
    color: inherit; text-decoration: none;
}
.archive-card-link--inert { cursor: default; }

.archive-card-media {
    position: relative;
    aspect-ratio: 1;
    background: #f5f5f5;
    overflow: hidden;
}
.archive-card-image { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ----- Text-only fallback (TSS-branded) ----- */
.archive-card-snippet {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    color: #f5f5f5;
    background:
        radial-gradient(circle at 20% 20%, rgba(30, 141, 32, 0.18), transparent 60%),
        linear-gradient(135deg, #1f1f1f 0%, #111 100%);
    overflow: hidden;
}
.archive-card-snippet::before {
    /* Quotation watermark, brand-green tinted */
    content: "\201C";
    position: absolute;
    top: -28px; left: 8px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 180px;
    line-height: 1;
    color: rgba(30, 141, 32, 0.12);
    pointer-events: none;
}
.archive-card-snippet-text {
    position: relative;
    z-index: 1;
    font-family: 'Oswald', sans-serif;
    font-weight: 300;
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: 0.3px;
    text-align: center;
    display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ----- Ribbons (more prominent) ----- */
.archive-card-ribbons {
    position: absolute; top: 12px; right: 0;
    display: flex; flex-direction: column; align-items: flex-end;
    gap: 6px;
    pointer-events: none;
    z-index: 2;
}
.archive-ribbon {
    display: inline-block;
    padding: 6px 14px;
    font-family: 'Oswald', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    /* Sharp left edge sticking out from the card */
    clip-path: polygon(8px 0, 100% 0, 100% 100%, 0 100%);
}
.archive-ribbon--ig {
    /* Iconic IG purple-pink-magenta. Avoids any orange tones so it reads
     * distinctly from Substack's solid #FF6719 at any ribbon size. */
    background: linear-gradient(45deg, #833AB4 0%, #C13584 50%, #E1306C 100%);
}
.archive-ribbon--substack {
    background: #FF6719;
}

/* ----- Card body ----- */
.archive-card-body {
    padding: 14px 16px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.archive-card-title {
    font-family: 'Oswald', sans-serif;
    font-size: 15px;
    font-weight: 500;
    margin: 0 0 6px;
    color: #111;
    text-transform: none;       /* override any inherited uppercase */
    letter-spacing: 0;
    line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.archive-card-date {
    font-size: 12px;
    color: #777;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.archive-card-tags {
    list-style: none; padding: 0; margin: auto 0 0;
    display: flex; flex-wrap: wrap; gap: 4px;
}
.archive-card-tag {
    font-size: 11px;
    padding: 3px 9px;
    background: #f0f0f0;
    color: #313232;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.archive-card-tag--more { background: transparent; color: #777; padding-left: 0; }

/* ===========================================================================
 * Detail page (/content/<pk>/)
 * Narrower 740px column matching the .sg / sneaker-guide convention.
 * =========================================================================== */
.archive-detail {
    max-width: 740px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
}
@media (max-width: 600px) {
    .archive-detail { padding-left: 16px; padding-right: 16px; }
}

.archive-detail-back {
    display: inline-block;
    margin-bottom: 24px;
    color: #777;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    text-decoration: none;
}
.archive-detail-back:hover { color: #1e8d20; }

.archive-detail-header { text-align: center; margin-bottom: 32px; }
.archive-detail-ribbons {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}
/* Detail ribbons sit free-floating above the title; remove the angular cut
 * that hugs the card image on /content/. */
.archive-detail-ribbons .archive-ribbon { clip-path: none; }

/* The h1 here lives inside .tss-page-container, whose global rule
 * (.tss-page-container h1, specificity 0,1,1) forces uppercase + 36px / 300
 * weight / 0.5px tracking. We need a higher-specificity selector to override
 * that for content-display titles where uppercase mangles long captions and
 * article headlines. .tss-page-container h1.archive-detail-title gives 0,2,1
 * which beats the global rule.
 *
 * Line-clamp keeps the full title in the DOM (good for SEO and screen
 * readers) while visually truncating to 3 lines with an ellipsis.
 */
.tss-page-container h1.archive-detail-title {
    font-size: 32px;
    font-weight: 400;
    color: #111;
    text-transform: none;
    letter-spacing: 0;
    margin: 0 0 8px;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
.archive-detail-date {
    color: #777;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0;
}

.archive-detail-images {
    display: flex; flex-direction: column; gap: 16px;
    margin-bottom: 32px;
}
.archive-detail-image { margin: 0; }
.archive-detail-image img {
    width: 100%; height: auto; display: block;
    border: 1px solid #e6e6e6;
}

.archive-detail-body {
    font-size: 16px;
    line-height: 1.7;
    color: #313232;
    margin-bottom: 32px;
}
.archive-detail-body p { margin: 0 0 16px; }
.archive-detail-body img {
    max-width: 100%; height: auto; display: block;
    margin: 16px auto;
}
.archive-detail-body a { color: #1e8d20; }

.archive-detail-tags {
    margin-bottom: 24px;
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.archive-detail-tags-label {
    font-size: 12px; color: #777;
    text-transform: uppercase; letter-spacing: 0.8px;
}
.archive-detail-tag {
    font-size: 12px;
    padding: 4px 10px;
    background: #f0f0f0;
    color: #313232;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
}
.archive-detail-tag:hover { background: #1e8d20; color: #fff; }

.archive-detail-engagement {
    display: flex; gap: 24px;
    padding: 12px 0;
    border-top: 1px solid #e6e6e6;
    border-bottom: 1px solid #e6e6e6;
    margin-bottom: 24px;
    color: #313232;
    font-size: 13px;
}

.archive-detail-originals {
    display: flex; gap: 16px; flex-wrap: wrap;
    font-size: 12px; color: #777;
}
.archive-detail-originals a {
    color: #777;
    text-decoration: underline;
}
.archive-detail-originals a:hover { color: #1e8d20; }

/* ----- Paginator (reusable) ----- */
.tss-paginator {
    display: flex; gap: 4px; align-items: center;
    margin: 32px 0; flex-wrap: wrap;
    justify-content: center;
}
.tss-paginator a, .tss-paginator span {
    padding: 8px 12px;
    font-family: 'Oswald', sans-serif;
    font-size: 13px; color: #313232; text-decoration: none;
    border: 1px solid #c3c3c3;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.tss-paginator a:hover { background: #f5f5f5; color: #1e8d20; border-color: #1e8d20; }
.tss-paginator .current { background: #1e8d20; color: #fff; border-color: #1e8d20; }
.tss-paginator-ellipsis { border: 0; color: #777; }

/* ----- Infinite scroll (tss-paginator.js) ----- */
body.js-paginator-active .tss-paginator { display: none; }
.archive-sentinel { height: 1px; }
.archive-paginator-wrapper.loading .archive-sentinel::after {
    content: "Loading…";
    display: block;
    padding: 28px 0;
    text-align: center;
    color: #777;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}
.tss-paginator-retry {
    display: block; margin: 16px auto;
    padding: 10px 22px;
    background: #313232; color: #fff; border: 0; border-radius: 0;
    font-family: 'Oswald', sans-serif;
    font-size: 13px; font-weight: 500;
    text-transform: uppercase; letter-spacing: 1px;
    cursor: pointer;
}
.tss-paginator-retry:hover { background: #1e8d20; }
