/*
 * Shared primitives for the content-index pages (Documentation, Articles).
 * One source of truth so the two near-identical category/card layouts don't
 * drift. Consumes the base.html design tokens (--fmt-*). Page-specific bits
 * (e.g. the Articles cover-image header) stay local to each template.
 */

.ci-group {
    margin-bottom: 32px;
}
.ci-group:last-child {
    margin-bottom: 0;
}

/* Category heading row: mono border pill + "N pages" count */
.ci-cat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.ci-cat__label {
    font-family: var(--fmt-mono);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #475569;
    border: 1px solid var(--fmt-border);
    border-radius: 9px;
    padding: 5px 11px;
}
.ci-cat__count {
    font-size: 0.8rem;
    color: var(--fmt-muted);
    white-space: nowrap;
}

/* Responsive card grid — min(340px,100%) keeps single column at ≤375px */
.ci-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
    gap: 16px;
}

/* Card (anchor) */
.ci-card {
    display: flex;
    flex-direction: column;
    gap: 9px;
    background: var(--fmt-surface);
    border: 1px solid var(--fmt-border);
    border-radius: var(--fmt-radius);
    box-shadow: var(--fmt-card-shadow);
    padding: 20px 22px;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.ci-card:hover,
.ci-card:focus-visible {
    border-color: #cbd5e1;
    background: #f8fafc;
    color: inherit;
}
.ci-card:focus-visible {
    outline: 3px solid rgba(18, 87, 214, 0.45);
    outline-offset: 2px;
}

.ci-card__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--fmt-text);
    line-height: 1.4;
}
.ci-card__summary {
    margin: 0;
    font-size: 0.9rem;
    color: var(--fmt-muted);
    line-height: 1.55;
}
.ci-card__meta {
    /* auto bottom-pins the date/Open row so it aligns across a grid row */
    margin-top: auto;
    padding-top: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.78rem;
    color: var(--fmt-muted);
}
.ci-card__date {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.ci-card__open {
    font-weight: 500;
    color: var(--fmt-primary);
    white-space: nowrap;
}

/* Media variant (Articles): image header, then padded body */
.ci-card--media {
    padding: 0;
    gap: 0;
    overflow: hidden;
}
.ci-card__media {
    height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(18, 87, 214, 0.06), rgba(18, 87, 214, 0.12));
    border-bottom: 1px solid var(--fmt-border);
}
.ci-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.ci-card__media i {
    font-size: 2.4rem;
    color: rgba(18, 87, 214, 0.28);
}
.ci-card__body {
    flex: 1 1 auto;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

/* Empty state shared by both pages */
.ci-empty {
    border: 1px dashed #cbd5e1;
    border-radius: var(--fmt-radius);
    padding: 40px 24px;
    text-align: center;
    color: var(--fmt-muted);
    background: rgba(255, 255, 255, 0.6);
}
.ci-empty i {
    font-size: 1.8rem;
    color: rgba(18, 87, 214, 0.35);
    display: block;
    margin-bottom: 10px;
}
