/* ====================================================================
   TAG ARCHIVE — editorial layout for `tag.php`

   Visual hierarchy:
     - Big eyebrow + serif title with leading hash
     - Description + post count
     - Cards in a 2-column grid on desktop, single on mobile
     - Each card: featured image (optional), category eyebrow,
       serif headline, excerpt, byline meta
==================================================================== */


/* ---- LAYOUT GRID
   Tag archives use the default chrome grid (200 / 1fr / 260).
   When the sidebar widget area is empty, collapse to 2-col so
   the post grid gets the full middle width. */
.sidebar-right--tag:empty {
    display: none;
}
.layout:has(.sidebar-right--tag:empty) {
    grid-template-columns: 200px 1fr;
}
@media (max-width: 1280px) {
    .layout:has(.sidebar-right--tag:empty) {
        grid-template-columns: 180px 1fr;
    }
}


/* ---- MAIN container ---- */
.main.main-tag {
    display: block;          /* override the 4-column grid from .main in shared.css */
    background: var(--bg);
    padding: 0;
    overflow-y: auto;
    height: 100%;
    scrollbar-width: thin;
    scrollbar-color: #d4d4d4 transparent;
}
.main.main-tag::-webkit-scrollbar { width: 6px; }
.main.main-tag::-webkit-scrollbar-thumb { background: #d4d4d4; border-radius: 3px; }
@media (max-width: 1024px) {
    .main.main-tag { height: auto; overflow: visible; }
}


/* ---- HEADER ---- */
.tag-header {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 40px 32px;
    border-bottom: 1px solid var(--line);
}
.tag-eyebrow {
    font-family: "Inter", "Helvetica Neue", sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.tag-title {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: clamp(40px, 6vw, 72px);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -0.018em;
    color: var(--text-strong);
    margin: 0 0 16px;
    /* the leading # is part of the heading — keep it tight to the
       word that follows */
    word-break: break-word;
}
.tag-tagline {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 18px;
    line-height: 1.5;
    color: var(--text-strong);
    margin: 0 0 14px;
    max-width: 720px;
}
.tag-meta {
    font-family: "Inter", "Helvetica Neue", sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}


/* ---- POST GRID ---- */
.tag-grid {
    max-width: 1100px;
    margin: 0 auto;
    padding: 36px 40px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 36px 32px;
}
@media (max-width: 1024px) {
    .tag-grid {
        grid-template-columns: 1fr;
        gap: 28px;
        padding: 28px 24px;
    }
}
@media (max-width: 640px) {
    .tag-header { padding: 28px 20px 20px; }
    .tag-grid   { padding: 20px;  gap: 24px; }
}


/* ---- CARD ---- */
.tag-card {
    display: flex;
    flex-direction: column;
    background: transparent;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--line);
}
.tag-card:last-child {
    border-bottom: none;
}

.tag-card-image-link {
    display: block;
    margin-bottom: 16px;
    overflow: hidden;
    line-height: 0;
    border-radius: 2px;
}
.tag-card-image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.tag-card-image-link:hover .tag-card-image {
    transform: scale(1.02);
}

.tag-card-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

.tag-card-eyebrow {
    font-family: "Inter", "Helvetica Neue", sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.tag-card-eyebrow a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s;
}
.tag-card-eyebrow a:hover {
    border-bottom-color: var(--text-muted);
}

.tag-card-title {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.008em;
    color: var(--text-strong);
    margin: 0 0 12px;
}
.tag-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s;
}
.tag-card-title a:hover {
    color: var(--text-strong);
    opacity: 0.7;
}

/* Slightly smaller title when card has an image — image is doing
   the visual heavy lifting */
.tag-card--with-image .tag-card-title {
    font-size: 22px;
}

.tag-card-excerpt {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-strong);
    margin: 0 0 16px;
    /* Cap at 3 lines for grid alignment */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tag-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-family: "Inter", "Helvetica Neue", sans-serif;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: auto;
}
.tag-card-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex: 0 0 24px;
}
.tag-card-author {
    font-weight: 600;
    color: var(--text-strong);
}
.tag-card-sep {
    color: var(--text-faint);
}


/* ---- EMPTY state ---- */
.tag-empty {
    max-width: 600px;
    margin: 60px auto;
    padding: 40px 24px;
    text-align: center;
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 18px;
    font-style: italic;
    color: var(--text-muted);
}


/* ---- PAGINATION ----
   Uses the shared `.cat-pagination` class so the tag pagination
   matches the category paginated view styling 1-to-1. The base
   styles live in assets/css/category.css. */


/* ---- DARK / NEGATIVE themes ---- */
[data-theme="dark"] .tag-card-image,
[data-theme="negative"] .tag-card-image {
    filter: saturate(0.85) brightness(0.95);
}
