/* ====================================================================
   ARCHIVE — historical browse by year/month
==================================================================== */

/*
 * Archive uses the default 3-column chrome grid (200 / 1fr / 260)
 * inherited from .layout — left sidebar (categories etc), main
 * timeline, right sidebar (widgets). On narrow viewports the chrome
 * stacks; the .main-archive scroll behaviour is overridden below.
 *
 * The right sidebar collapses if empty: the dynamic_sidebar() call
 * emits nothing when no widgets are active, so the <aside> renders
 * empty and the :empty CSS hides the column entirely, restoring the
 * full width to the timeline.
 */
.sidebar-right--archive:empty {
    display: none;
}
.layout:has(.sidebar-right--archive:empty) {
    /* When archive's right sidebar has no widgets, drop back to
       the 2-column variant for visual symmetry. :has() is supported
       in all evergreen browsers and gracefully no-ops elsewhere
       (the column just sits there empty, which is still fine). */
    grid-template-columns: 200px 1fr;
}
@media (max-width: 1280px) {
    .layout:has(.sidebar-right--archive:empty) {
        grid-template-columns: 180px 1fr;
    }
}

.main.archive-main {
    display: block;
    background: var(--bg);
    height: 100%;
    overflow-y: auto;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: #d4d4d4 transparent;
}
.main.archive-main::-webkit-scrollbar { width: 6px; }
.main.archive-main::-webkit-scrollbar-thumb { background: #d4d4d4; border-radius: 3px; }
@media (max-width: 1024px) {
    .main.archive-main { height: auto; overflow: visible; }
}

.arc-wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 36px 40px 80px;
}
@media (max-width: 1024px) {
    .arc-wrap { padding: 24px 22px 60px; }
}

/* ============ HEADER ============ */
.arc-header {
    border-bottom: 1px solid var(--text-strong);
    padding-bottom: 28px;
    margin-bottom: 36px;
}
.arc-eyebrow {
    font-family: "Inter", sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-muted);
    font-weight: 600;
}
.arc-title {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 56px;
    font-weight: 700;
    color: var(--text-strong);
    margin: 8px 0 12px;
    line-height: 1.0;
    letter-spacing: -0.015em;
}
.arc-tagline {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 18px;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0 0 18px;
    font-style: italic;
    max-width: 720px;
}
.arc-stats {
    display: flex;
    gap: 28px;
    font-family: "Inter", sans-serif;
    font-size: 12px;
    color: var(--text-muted);
}
.arc-stats strong {
    color: var(--text-strong);
    font-weight: 700;
    font-size: 14px;
    margin-right: 6px;
}

/* ============ ON THIS DAY ============ */
.arc-otd {
    background: linear-gradient(135deg, #fafaf5 0%, #f5f0e8 100%);
    border: 1px solid #e0d8c8;
    border-radius: 8px;
    padding: 28px 32px;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}
.arc-otd::before {
    content: "";
    position: absolute;
    top: -10px;
    right: -10px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(184,134,11,0.08), transparent 70%);
    pointer-events: none;
}
.arc-otd-eyebrow {
    font-family: "Inter", sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #8a6710;
    font-weight: 700;
    margin-bottom: 8px;
}
.arc-otd-title {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-strong);
    line-height: 1.15;
    margin: 0 0 8px;
}
.arc-otd-date {
    font-family: "Inter", sans-serif;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.arc-otd-headlines {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 16px;
}
@media (max-width: 800px) {
    .arc-otd-headlines { grid-template-columns: 1fr; }
}
.arc-otd-card {
    background: white;
    padding: 14px 16px;
    border-radius: 4px;
    border: 1px solid #e8e0d0;
    cursor: pointer;
    transition: all 0.15s ease;
}
.arc-otd-card:hover { border-color: #999; transform: translateY(-2px); }
.arc-otd-card-year {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 22px;
    font-weight: 700;
    color: #8a6710;
    margin-bottom: 4px;
}
.arc-otd-card-headline {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-strong);
    line-height: 1.3;
    margin: 0;
}

/* ============ DECADE NAV ============ */
.arc-section-header {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--text-strong);
    border-bottom: 1px solid var(--text-strong);
    padding-bottom: 10px;
    margin: 36px 0 20px;
    letter-spacing: -0.01em;
}

.arc-decades {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    margin-bottom: 36px;
}
@media (max-width: 900px) { .arc-decades { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 500px) { .arc-decades { grid-template-columns: repeat(3, 1fr); } }

.arc-decade-btn {
    padding: 16px 8px;
    background: white;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    font-family: "Source Serif 4", Georgia, serif;
}
.arc-decade-btn:hover {
    background: #f8f8f8;
    border-color: #999;
}
.arc-decade-btn.active {
    background: var(--text-strong);
    color: white;
    border-color: var(--text-strong);
}
.arc-decade-label {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    display: block;
}
.arc-decade-meta {
    font-family: "Inter", sans-serif;
    font-size: 10px;
    color: var(--text-faint);
    margin-top: 4px;
    display: block;
}
.arc-decade-btn.active .arc-decade-meta { color: rgba(255,255,255,0.65); }

/* ============ YEAR PICKER ============ */
.arc-years {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    margin-bottom: 28px;
}
@media (max-width: 900px) { .arc-years { grid-template-columns: repeat(5, 1fr); } }

.arc-year-btn {
    padding: 10px 4px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    font-family: "Inter", sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-strong);
    font-variant-numeric: tabular-nums;
}
.arc-year-btn:hover { background: #f5f5f5; border-color: #999; }
.arc-year-btn.active { background: var(--text-strong); color: white; border-color: var(--text-strong); }
.arc-year-btn.disabled { opacity: 0.3; cursor: not-allowed; }

/* ============ MONTH GRID + ARTICLES ============ */
.arc-year-view {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 28px;
    margin-top: 16px;
}
@media (max-width: 800px) { .arc-year-view { grid-template-columns: 1fr; } }

.arc-months {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    align-content: start;
}
.arc-month-btn {
    padding: 10px 6px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    font-family: "Inter", sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-strong);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.arc-month-btn:hover { background: #f5f5f5; }
.arc-month-btn.active { background: var(--text-strong); color: white; border-color: var(--text-strong); }
.arc-month-count {
    display: block;
    font-size: 10px;
    color: var(--text-faint);
    text-transform: none;
    margin-top: 2px;
    font-weight: 400;
    letter-spacing: 0;
}
.arc-month-btn.active .arc-month-count { color: rgba(255,255,255,0.7); }

.arc-articles {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    overflow: hidden;
}
.arc-articles-header {
    padding: 14px 18px;
    background: #fafafa;
    border-bottom: 1px solid #e5e5e5;
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-strong);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.arc-articles-header-meta {
    font-family: "Inter", sans-serif;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}
.arc-art-item {
    padding: 14px 18px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.15s ease;
    display: grid;
    grid-template-columns: 60px 1fr auto;
    gap: 16px;
    align-items: baseline;
    /* When the item is an <a> (real WP posts), kill the default link
       chrome and keep the row visual intact. */
    text-decoration: none;
    color: inherit;
}
.arc-art-item:hover { background: #fafafa; }
.arc-art-item:last-child { border-bottom: none; }

/* Empty state for any of the pickers (decades, years, months, art).
   Friendly note, not an error. */
.arc-empty {
    padding: 36px 18px;
    text-align: center;
    color: var(--text-muted, #666);
    font-style: italic;
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 14px;
}

/* "Showing X of Y" footer when the REST endpoint capped at 50. */
.arc-articles-truncated {
    padding: 14px 18px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
    color: var(--text-faint, #999);
    font-family: "Inter", sans-serif;
    font-size: 12px;
    font-style: italic;
}

/* On-this-day card section badge (added when card carries a category). */
.arc-otd-card-section {
    margin-top: 6px;
    font-family: "Inter", sans-serif;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--link-accent, #1f8fff);
}

/* OTD card is now an <a> — preserve hover lift but kill default link colour. */
a.arc-otd-card {
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
a.arc-otd-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}
.arc-art-day {
    font-family: "Inter", sans-serif;
    font-size: 11px;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.arc-art-info { min-width: 0; }
.arc-art-headline {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-strong);
    line-height: 1.3;
    margin: 0 0 3px;
}
.arc-art-section {
    font-family: "Inter", sans-serif;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.arc-art-byline {
    font-family: "Inter", sans-serif;
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
}

/* ============ FOOTER NOTE ============ */
.arc-note {
    margin-top: 44px;
    padding: 20px 24px;
    background: #f8f8f8;
    border-left: 3px solid #999;
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.55;
    font-style: italic;
}

/* ============ FONT/THEME OVERRIDES ============ */
body.font-serif .arc-title,
body.font-serif .arc-tagline,
body.font-serif .arc-section-header,
body.font-serif .arc-otd-title,
body.font-serif .arc-art-headline {
    font-family: "Source Serif 4", Georgia, serif !important;
}
body.font-sans .arc-title,
body.font-sans .arc-tagline,
body.font-sans .arc-section-header,
body.font-sans .arc-otd-title,
body.font-sans .arc-art-headline {
    font-family: "Inter", sans-serif !important;
}

body[data-font-scale] .arc-title { font-size: calc(56px * var(--font-scale, 1)) !important; }
body[data-font-scale] .arc-tagline { font-size: calc(18px * var(--font-scale, 1)) !important; }
body[data-font-scale] .arc-section-header { font-size: calc(26px * var(--font-scale, 1)) !important; }
body[data-font-scale] .arc-art-headline { font-size: calc(14.5px * var(--font-scale, 1)) !important; }
body[data-font-scale] .arc-otd-title { font-size: calc(28px * var(--font-scale, 1)) !important; }

/* ====================================================================
   Filtered posts list (when ?archive_date is active on the archive page)

   Appears above the historical timeline. Shows real WP posts matching
   the date filter — gives the topbar's Archive panel somewhere to
   send users after they click Apply.
==================================================================== */

.arc-filtered {
    max-width: 1080px;
    margin: 32px auto 48px;
    padding: 0 24px;
}
.arc-filtered-title {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 20px;
    color: #1a1a1a;
}
.arc-filtered-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}
.arc-filtered-pagination {
    margin-top: 28px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    font-family: "Inter", "Helvetica Neue", sans-serif;
    font-size: 13px;
}
.arc-filtered-pagination a,
.arc-filtered-pagination span {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #d4d4d4;
    border-radius: 3px;
    color: #1a1a1a;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.arc-filtered-pagination a:hover { background: #f5f5f5; border-color: #999; }
.arc-filtered-pagination .current {
    background: #1a1a1a;
    color: white;
    border-color: #1a1a1a;
    font-weight: 600;
}
.arc-filtered-empty {
    background: #f8f8f8;
    border: 1px dashed #d4d4d4;
    border-radius: 4px;
    padding: 32px;
    text-align: center;
    color: #666;
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 15px;
}
