/*
 * blog.css — GitHub Primer-inspired aesthetic for /blog and /blog/<article>
 *
 * Design system follows Primer (github.com):
 *   - 6px border-radius constante en surfaces
 *   - Color tokens neutral-first (canvas, subtle, muted)
 *   - Buttons con subtle inset shadow
 *   - Inputs ~32-36px height con focus ring azul
 *   - Hairline borders en todo (no se confía en sombras)
 *   - Iconos outline 16-20px
 *   - Body 14px chrome, 17-18px en .article-body para reading
 *
 * Layout cambio principal:
 *   Article: TOC vertical sidebar IZQUIERDA (sticky con scroll propio)
 *            + content centro + share sidebar DERECHA (sticky)
 *
 * Secciones:
 *   1. TOKENS (light + dark)
 *   2. RESET & base
 *   3. LISTING (hero, search, categorías, tags, cards, pagination, featured, empty)
 *   4. ARTICLE HERO (back, meta, title, author)
 *   5. ARTICLE LAYOUT (3-col grid: TOC | content | share)
 *   6. TOC vertical sidebar
 *   7. ARTICLE BODY (reading column)
 *   8. ENGAGEMENT (vistas + reacciones)
 *   9. SHARE SIDEBAR (vertical sticky right)
 *  10. TAGS + RELATED (lista plana)
 *  11. COMMENTS
 *  12. RESPONSIVE
 */

/* ============================================================
 * 1. TOKENS — Primer color system + spacing/radius
 * ============================================================ */

#blog {
    /* Fonts */
    --b-font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    --b-font-display: 'Inter', var(--b-font-sans);
    --b-font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;

    /* Light theme — Primer color tokens */
    --b-canvas:           #ffffff;
    --b-canvas-subtle:    #f6f8fa;
    --b-canvas-inset:     #f6f8fa;
    --b-bg-muted:         #eaeef2;
    --b-bg-emphasis:      #1f2328;

    --b-text:             #1f2328;
    --b-text-muted:       #59636e;
    --b-text-faint:       #6e7781;
    --b-text-inverse:     #ffffff;

    --b-border:           #d0d7de;
    --b-border-muted:     #d8dee4;
    --b-border-strong:    #afb8c1;

    --b-accent:           #0969da;
    --b-accent-emphasis:  #0969da;
    --b-accent-fg:        #ffffff;
    --b-accent-subtle:    #ddf4ff;
    --b-accent-muted:     rgba(84, 174, 255, 0.4);

    --b-success:          #1f883d;
    --b-success-emphasis: #1f883d;
    --b-success-fg:       #ffffff;
    --b-danger:           #cf222e;
    --b-danger-subtle:    #ffebe9;
    --b-attention:        #9a6700;
    --b-attention-subtle: #fff8c5;

    /* Shadows (Primer signature: subtle inset on buttons + hairline below cards) */
    --b-shadow-btn-inset: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    --b-shadow-card:      0 1px 0 rgba(31, 35, 40, 0.04);
    --b-shadow-focus:     0 0 0 3px var(--b-accent-muted);

    /* Spacing scale (Primer 4px base) */
    --b-step-1: 4px;
    --b-step-2: 8px;
    --b-step-3: 12px;
    --b-step-4: 16px;
    --b-step-5: 24px;
    --b-step-6: 32px;
    --b-step-7: 48px;
    --b-step-8: 64px;
    --b-step-9: 96px;

    /* Layout widths */
    --b-content: 720px;
    --b-listing: 1024px;
    --b-toc:     220px;
    --b-actions: 56px;

    /* Radius (Primer signature: 6px constante) */
    --b-radius:       6px;
    --b-radius-sm:    4px;
    --b-radius-lg:    8px;
    --b-radius-pill:  999px;
    --b-radius-circle: 50%;

    --b-transition: 80ms cubic-bezier(0.33, 1, 0.68, 1);

    font-family: var(--b-font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--b-text);
    background: var(--b-canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Dark theme */
html[data-theme='dark'] #blog {
    --b-canvas:           #0d1117;
    --b-canvas-subtle:    #161b22;
    --b-canvas-inset:     #010409;
    --b-bg-muted:         #21262d;
    --b-bg-emphasis:      #6e7681;

    --b-text:             #e6edf3;
    --b-text-muted:       #9198a1;
    --b-text-faint:       #6e7681;
    --b-text-inverse:     #0d1117;

    --b-border:           #30363d;
    --b-border-muted:     #21262d;
    --b-border-strong:    #6e7681;

    --b-accent:           #2f81f7;
    --b-accent-emphasis:  #1f6feb;
    --b-accent-fg:        #ffffff;
    --b-accent-subtle:    rgba(56, 139, 253, 0.12);
    --b-accent-muted:     rgba(56, 139, 253, 0.4);

    --b-success:          #3fb950;
    --b-success-emphasis: #238636;
    --b-success-fg:       #ffffff;
    --b-danger:           #f85149;
    --b-danger-subtle:    rgba(248, 81, 73, 0.1);
    --b-attention:        #d29922;
    --b-attention-subtle: rgba(187, 128, 9, 0.15);

    --b-shadow-btn-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    --b-shadow-card:      0 0 transparent;
    --b-shadow-focus:     0 0 0 3px var(--b-accent-muted);
}

/* ============================================================
 * 2. RESET & BASE (scoped a #blog)
 * ============================================================ */

#blog *,
#blog *::before,
#blog *::after {
    box-sizing: border-box;
}
#blog *::selection { background: var(--b-accent-subtle); color: var(--b-text); }
#blog a {
    color: var(--b-accent);
    text-decoration: none;
}
#blog a:hover { text-decoration: underline; }
#blog button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}
#blog svg { display: inline-block; vertical-align: middle; fill: currentColor; }

/* ============================================================
 * 3. LISTING — hero, search, categorías, cards, pagination
 * ============================================================ */

/* Hero */
#blog .blog-hero {
    border-bottom: 1px solid var(--b-border);
    padding: var(--b-step-6) var(--b-step-5) var(--b-step-5);
}
#blog .blog-hero-inner {
    max-width: var(--b-listing);
    margin: 0 auto;
}
#blog .blog-hero-header {
    margin-bottom: var(--b-step-4);
}
#blog .blog-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius);
    background: var(--b-canvas-subtle);
    color: var(--b-text-muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 18px;
    margin-bottom: var(--b-step-3);
}
#blog .blog-hero-badge::before {
    content: '';
    width: 6px; height: 6px;
    background: var(--b-success);
    border-radius: var(--b-radius-circle);
}
#blog .blog-hero h1 {
    font-family: var(--b-font-display);
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 600;
    letter-spacing: -0.012em;
    line-height: 1.25;
    margin: 0 0 var(--b-step-3);
    color: var(--b-text);
    max-width: 24ch;
}
#blog .blog-hero-subtitle {
    font-size: 16px;
    line-height: 1.5;
    color: var(--b-text-muted);
    max-width: 60ch;
    margin: 0;
}

/* Search — GitHub command palette feel */
#blog .blog-search {
    margin: var(--b-step-5) 0 var(--b-step-4);
    max-width: 480px;
}
#blog .blog-search-box {
    position: relative;
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 12px;
    background: var(--b-canvas-subtle);
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius);
    transition: border-color var(--b-transition), box-shadow var(--b-transition), background var(--b-transition);
}
#blog .blog-search-box:hover {
    border-color: var(--b-border-strong);
}
#blog .blog-search-box:focus-within {
    border-color: var(--b-accent);
    background: var(--b-canvas);
    box-shadow: var(--b-shadow-focus);
    outline: none;
}
#blog .blog-search-icon {
    color: var(--b-text-faint);
    width: 16px;
    height: 16px;
    margin-right: 8px;
    flex-shrink: 0;
}
#blog .blog-search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: var(--b-text);
    outline: none;
    min-width: 0;
    -webkit-appearance: none;
}
#blog .blog-search-input::placeholder { color: var(--b-text-faint); }
#blog .blog-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
#blog .blog-search-kbd {
    display: none;
    align-items: center;
    gap: 2px;
    margin-left: 8px;
    flex-shrink: 0;
    pointer-events: none;
}
#blog .blog-search-kbd kbd {
    background: var(--b-canvas);
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius-sm);
    box-shadow: var(--b-shadow-card);
    padding: 1px 5px;
    font-family: var(--b-font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--b-text-muted);
    line-height: 1.4;
}
#blog .blog-search-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    padding: 3px 12px;
    background: var(--b-bg-emphasis);
    color: var(--b-text-inverse);
    border-radius: var(--b-radius-sm);
    font-weight: 500;
    font-size: 12px;
    line-height: 1.6;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--b-transition);
}
#blog .blog-search-box:focus-within .blog-search-btn {
    opacity: 1;
    pointer-events: auto;
}
#blog .blog-search-btn:hover { opacity: 0.85; }

@media (min-width: 768px) {
    #blog .blog-search-kbd { display: inline-flex; }
    #blog .blog-search-box:focus-within .blog-search-kbd { display: none; }
}

/* Categorías — pills outline */
#blog .blog-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: var(--b-step-5) 0 var(--b-step-3);
}
#blog .blog-cat-btn {
    padding: 3px 12px;
    background: var(--b-canvas-subtle);
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius-pill);
    color: var(--b-text-muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    transition: all var(--b-transition);
}
#blog .blog-cat-btn:hover {
    background: var(--b-bg-muted);
    border-color: var(--b-border-strong);
    color: var(--b-text);
}
#blog .blog-cat-btn.active {
    background: var(--b-text);
    color: var(--b-text-inverse);
    border-color: var(--b-text);
}

/* Tags row */
#blog .blog-tags {
    display: flex;
    align-items: baseline;
    gap: var(--b-step-3);
    flex-wrap: wrap;
}
#blog .blog-tags-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--b-text-faint);
}
#blog .blog-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
#blog .tag-link,
#blog .article-tag {
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    height: 22px;
    background: var(--b-accent-subtle);
    border: 1px solid transparent;
    border-radius: var(--b-radius-pill);
    color: var(--b-accent);
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    transition: all var(--b-transition);
}
#blog .tag-link:hover,
#blog .article-tag:hover {
    background: var(--b-accent);
    color: var(--b-accent-fg);
    text-decoration: none;
}

/* Listing section */
#blog .blog-section {
    max-width: var(--b-listing);
    margin: 0 auto;
    padding: var(--b-step-6) var(--b-step-5) var(--b-step-7);
}
#blog .blog-list-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: var(--b-step-4);
    padding-bottom: var(--b-step-3);
    border-bottom: 1px solid var(--b-border);
}
#blog .blog-list-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: var(--b-text);
}
#blog .blog-list-icon { display: none; }
#blog .blog-list-count {
    font-size: 12px;
    color: var(--b-text-muted);
    font-variant-numeric: tabular-nums;
}

/* Featured */
#blog .featured-article { margin-bottom: var(--b-step-7); }
#blog .featured-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--b-attention-subtle);
    color: var(--b-attention);
    border: 1px solid transparent;
    border-radius: var(--b-radius);
    font-size: 12px;
    font-weight: 500;
    line-height: 18px;
    margin-bottom: var(--b-step-3);
}
#blog .featured-card {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: var(--b-step-5);
    padding: var(--b-step-5);
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius);
    background: var(--b-canvas);
    box-shadow: var(--b-shadow-card);
    transition: border-color var(--b-transition);
}
#blog .featured-card:hover {
    border-color: var(--b-border-strong);
    text-decoration: none;
}
#blog .featured-image {
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius);
    background: var(--b-canvas-subtle);
    color: var(--cat-color, var(--b-text-faint));
    margin: 0;
}
#blog .featured-image-icon { transform: scale(2); opacity: 0.85; }
#blog .featured-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--b-step-2);
}
#blog .featured-category {
    align-self: flex-start;
    padding: 1px 8px;
    background: var(--b-canvas-subtle);
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius-pill);
    color: var(--cat-color, var(--b-text-muted));
    font-size: 11px;
    font-weight: 500;
    line-height: 18px;
}
#blog .featured-title {
    font-size: clamp(18px, 2.2vw, 24px);
    line-height: 1.25;
    letter-spacing: -0.01em;
    font-weight: 600;
    margin: 0;
    color: var(--b-text);
}
#blog .featured-excerpt {
    font-size: 14px;
    line-height: 1.5;
    color: var(--b-text-muted);
    margin: 0;
}
#blog .featured-meta {
    display: flex;
    gap: var(--b-step-2);
    font-size: 12px;
    color: var(--b-text-faint);
    margin-top: var(--b-step-2);
    font-variant-numeric: tabular-nums;
}

/* Card grid: 2 cols, GitHub repo-card style */
#blog .blog-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--b-step-3);
}
#blog .blog-card {
    display: flex;
    flex-direction: column;
    gap: var(--b-step-2);
    padding: var(--b-step-4);
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius);
    background: var(--b-canvas);
    transition: background var(--b-transition), border-color var(--b-transition);
}
#blog .blog-card:hover {
    background: var(--b-canvas-subtle);
    border-color: var(--b-border-strong);
    text-decoration: none;
}
#blog .blog-card-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--cat-color, var(--b-text-muted));
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    margin: 0;
}
#blog .blog-card-category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
}
#blog .blog-card-category-icon svg {
    width: 14px;
    height: 14px;
    transform: none;
    stroke-width: 2;
}
#blog .blog-card-title {
    font-size: 16px;
    line-height: 1.35;
    font-weight: 600;
    margin: 2px 0;
    color: var(--b-text);
}
#blog .blog-card-excerpt {
    font-size: 13px;
    line-height: 1.5;
    color: var(--b-text-muted);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
#blog .blog-card-meta {
    display: flex;
    gap: var(--b-step-3);
    font-size: 12px;
    color: var(--b-text-faint);
    font-variant-numeric: tabular-nums;
    margin-top: 6px;
    padding-top: var(--b-step-2);
    border-top: 1px solid var(--b-border-muted);
}
#blog .blog-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
#blog .blog-card-meta svg {
    width: 12px;
    height: 12px;
    opacity: 0.75;
}

/* Empty state */
#blog .empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--b-step-9) var(--b-step-5);
    border: 1px dashed var(--b-border);
    border-radius: var(--b-radius);
    background: var(--b-canvas-subtle);
}
#blog .empty-state-icon {
    color: var(--b-text-faint);
    margin-bottom: var(--b-step-3);
}
#blog .empty-state-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 var(--b-step-2);
}
#blog .empty-state-text {
    color: var(--b-text-muted);
    font-size: 14px;
    margin: 0;
}

/* Pagination — square buttons (Primer button style) */
#blog .blog-pagination { margin-top: var(--b-step-6); }
#blog .blog-pagination-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
}
#blog .blog-pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 12px;
    background: var(--b-canvas);
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius);
    box-shadow: var(--b-shadow-card);
    color: var(--b-text);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    transition: background var(--b-transition), border-color var(--b-transition);
}
#blog .blog-pagination-btn:hover {
    background: var(--b-canvas-subtle);
    border-color: var(--b-border-strong);
    text-decoration: none;
}
#blog .blog-pagination-btn.active {
    background: var(--b-accent);
    color: var(--b-accent-fg);
    border-color: var(--b-accent);
}
#blog .blog-pagination-dots {
    color: var(--b-text-faint);
    padding: 0 4px;
    font-size: 13px;
}

/* ============================================================
 * 4. ARTICLE HERO
 * ============================================================ */

#blog .article-hero {
    border-bottom: 1px solid var(--b-border);
    padding: var(--b-step-5);
}
#blog .article-hero-inner {
    display: grid;
    grid-template-columns: minmax(0, var(--b-content)) var(--b-actions);
    column-gap: var(--b-step-6);
    max-width: calc(var(--b-content) + var(--b-actions) + var(--b-step-6));
    margin: 0 auto;
    position: relative;
}
#blog .article-hero-inner > * {
    grid-column: 1;
    max-width: var(--b-content);
}
#blog .article-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    border-radius: var(--b-radius-sm);
    color: var(--b-text-muted);
    margin: 0 0 var(--b-step-3) -6px;
    transition: background var(--b-transition), color var(--b-transition);
    font-size: 0;
}
#blog .article-back:hover {
    background: var(--b-canvas-subtle);
    color: var(--b-text);
    text-decoration: none;
}
#blog .article-back svg { width: 16px; height: 16px; display: block; }

#blog .article-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--b-text-muted);
    margin-bottom: var(--b-step-3);
}
#blog .article-breadcrumb a {
    color: var(--b-text-muted);
    text-decoration: none;
}
#blog .article-breadcrumb a:hover {
    color: var(--b-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}
#blog .article-breadcrumb-sep {
    color: var(--b-text-faint);
    user-select: none;
}
#blog .article-breadcrumb-current {
    color: var(--b-text);
    font-weight: 500;
}

#blog .article-meta {
    display: flex;
    align-items: center;
    gap: var(--b-step-3);
    margin-bottom: var(--b-step-3);
    font-size: 12px;
}
#blog .article-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--cat-color, var(--b-text-muted));
    font-weight: 600;
    font-size: 12px;
    line-height: 1;
}
#blog .article-category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    color: inherit;
}
#blog .article-category-icon svg {
    width: 14px;
    height: 14px;
    stroke-width: 2;
}
#blog .article-category-name {
    color: inherit;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
#blog .article-reading {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--b-text-faint);
    font-variant-numeric: tabular-nums;
}
#blog .article-reading svg { width: 14px; height: 14px; }

#blog .article-title {
    font-family: var(--b-font-display);
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 600;
    letter-spacing: -0.012em;
    line-height: 1.25;
    margin: 0 0 var(--b-step-4);
    color: var(--b-text);
}
#blog .article-author {
    display: flex;
    align-items: center;
    gap: var(--b-step-2);
}
#blog .article-author-img {
    width: 24px; height: 24px;
    border-radius: var(--b-radius-circle);
    background: var(--b-canvas-subtle);
    border: 1px solid var(--b-border);
    padding: 4px;
}
#blog .article-author-info {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
#blog .article-author-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--b-text);
}
#blog .article-author-date {
    font-size: 12px;
    color: var(--b-text-faint);
    font-variant-numeric: tabular-nums;
    position: relative;
    padding-left: 10px;
}
#blog .article-author-date::before {
    content: '·';
    position: absolute;
    left: 2px;
    top: -2px;
}

/* === Author page header === */
#blog .author-header {
    display: flex;
    align-items: center;
    gap: var(--b-step-3);
    margin-bottom: var(--b-step-3);
}
#blog .author-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--b-radius-circle);
    background: var(--b-canvas-subtle);
    border: 1px solid var(--b-border);
    color: var(--b-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--b-font-display);
    font-size: 22px;
    font-weight: 600;
    flex-shrink: 0;
}
#blog .author-info { display: flex; flex-direction: column; gap: 2px; }
#blog .author-name {
    font-family: var(--b-font-display);
    font-size: clamp(20px, 2.4vw, 26px);
    font-weight: 600;
    letter-spacing: -0.012em;
    line-height: 1.2;
    margin: 0;
    color: var(--b-text);
}
#blog .author-role {
    font-size: 12px;
    color: var(--b-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}
#blog .author-bio {
    font-size: 15px;
    line-height: 1.55;
    color: var(--b-text-muted);
    margin: 0 0 var(--b-step-4);
    max-width: 60ch;
}
#blog .author-stats {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 4px 10px;
    background: var(--b-canvas-subtle);
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius);
}
#blog .author-stat-value {
    font-weight: 600;
    color: var(--b-text);
    font-variant-numeric: tabular-nums;
}
#blog .author-stat-label {
    font-size: 12px;
    color: var(--b-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Article author hero link */
#blog .article-author-link {
    display: flex;
    align-items: center;
    gap: var(--b-step-2);
    text-decoration: none;
    color: inherit;
    transition: opacity var(--b-transition);
}
#blog .article-author-link:hover {
    opacity: 0.7;
    text-decoration: none;
}
#blog .article-author-link:hover .article-author-name {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ============================================================
 * 5. ARTICLE LAYOUT — 3 columnas: TOC | content | share
 * ============================================================ */

#blog .article-layout {
    display: grid;
    grid-template-columns: minmax(0, var(--b-content)) var(--b-actions);
    grid-template-areas:
        "toc      ."
        "content  actions";
    column-gap: var(--b-step-6);
    row-gap: var(--b-step-4);
    max-width: calc(var(--b-content) + var(--b-actions) + var(--b-step-6));
    margin: 0 auto;
    padding: var(--b-step-5);
}
#blog .article-content {
    grid-area: content;
    min-width: 0;
    width: 100%;
}

/* ============================================================
 * 6. TOC — vertical sidebar sticky (con scroll propio si excede)
 * ============================================================ */

#blog .article-sidebar-left {
    grid-area: toc;
    border-bottom: 1px solid var(--b-border);
    padding-bottom: var(--b-step-3);
}
#blog .article-toc {
    display: flex;
    flex-direction: column;
    gap: var(--b-step-2);
}
#blog .article-toc-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--b-text);
    margin: 0;
}
#blog .article-toc-nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin: 0;
}
#blog .toc-link {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--b-text-muted);
    text-decoration: none;
    transition: color var(--b-transition);
}
#blog .toc-link::before {
    content: '';
    width: 12px;
    height: 12px;
    margin-top: 4px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center / contain;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center / contain;
    opacity: 0.5;
    flex-shrink: 0;
    transition: opacity var(--b-transition), transform var(--b-transition);
}
#blog .toc-link.toc-sub {
    padding-left: 18px;
    font-size: 12px;
}
#blog .toc-link.toc-sub::before {
    width: 8px;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cline x1='4' y1='12' x2='20' y2='12'/%3E%3C/svg%3E");
            mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cline x1='4' y1='12' x2='20' y2='12'/%3E%3C/svg%3E");
}
#blog .toc-link:hover {
    color: var(--b-text);
    text-decoration: underline;
    text-underline-offset: 3px;
}
#blog .toc-link:hover::before { opacity: 1; }

/* ============================================================
 * 7. ARTICLE BODY — reading column, GitHub markdown-body inspired
 * ============================================================ */

#blog .article-body {
    font-family: var(--b-font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--b-text);
}
#blog .article-body p {
    margin: 0 0 var(--b-step-4);
}
#blog .article-body > p:first-of-type::first-letter {
    font-family: var(--b-font-display);
    font-size: 3.4em;
    font-weight: 600;
    line-height: 1;
    float: left;
    margin: 0.04em 0.08em 0 -0.04em;
    color: var(--b-text);
}
#blog .article-body h1 {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.25;
    margin: 1.5em 0 var(--b-step-3);
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--b-border-muted);
    color: var(--b-text);
}
#blog .article-body h2 {
    font-family: var(--b-font-display);
    font-size: 22px;
    font-weight: 600;
    line-height: 1.3;
    margin: 1.6em 0 var(--b-step-3);
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--b-border-muted);
    color: var(--b-text);
}
#blog .article-body h3 {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.35;
    margin: 1.4em 0 var(--b-step-3);
    color: var(--b-text);
}
#blog .article-body h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 1.2em 0 var(--b-step-2);
    color: var(--b-text);
}
#blog .article-body a {
    color: var(--b-accent);
    text-decoration: none;
}
#blog .article-body a:hover {
    text-decoration: underline;
}
#blog .article-body strong { font-weight: 600; }
#blog .article-body em { font-style: italic; }
#blog .article-body blockquote {
    margin: var(--b-step-4) 0;
    padding: 0 var(--b-step-4);
    border-left: 4px solid var(--b-border);
    color: var(--b-text-muted);
}
#blog .article-body blockquote p:last-child { margin-bottom: 0; }
#blog .article-body code {
    font-family: var(--b-font-mono);
    font-size: 0.875em;
    background: var(--b-canvas-subtle);
    color: var(--b-text);
    padding: 2px 6px;
    border-radius: var(--b-radius);
    border: none;
}
#blog .article-body pre {
    position: relative;
    margin: var(--b-step-4) 0;
    padding: var(--b-step-4);
    padding-right: 44px;
    background: var(--b-canvas-subtle);
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius);
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.45;
}
#blog .article-body .code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: var(--b-canvas);
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius-sm);
    color: var(--b-text-muted);
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--b-transition), background var(--b-transition), color var(--b-transition), border-color var(--b-transition);
}
#blog .article-body pre:hover .code-copy-btn,
#blog .article-body .code-copy-btn:focus-visible {
    opacity: 1;
}
#blog .article-body .code-copy-btn:hover {
    background: var(--b-bg-muted);
    color: var(--b-text);
    border-color: var(--b-border-strong);
}
#blog .article-body .code-copy-btn.copied {
    opacity: 1;
    background: var(--b-success);
    border-color: rgba(31, 35, 40, 0.15);
    color: var(--b-success-fg);
}
@media (max-width: 768px) {
    #blog .article-body .code-copy-btn { opacity: 1; }
}
#blog .article-body pre code {
    background: transparent;
    border: none;
    padding: 0;
    font-size: inherit;
}
#blog .article-body ul,
#blog .article-body ol {
    padding-left: 2em;
    margin: 0 0 var(--b-step-4);
}
#blog .article-body li { margin: 0.25em 0; }
#blog .article-body img,
#blog .article-body picture {
    max-width: 100%;
    height: auto;
    margin: var(--b-step-5) 0;
    display: block;
    border-radius: var(--b-radius);
    border: 1px solid var(--b-border);
}
#blog .article-body hr {
    border: none;
    border-top: 1px solid var(--b-border);
    margin: var(--b-step-7) 0;
    height: 4px;
    background: var(--b-canvas-subtle);
    border-bottom: 1px solid var(--b-border);
}
#blog .article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--b-step-4) 0;
    font-size: 14px;
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius);
    overflow: hidden;
}
#blog .article-body th,
#blog .article-body td {
    padding: 6px var(--b-step-3);
    border: 1px solid var(--b-border);
    text-align: left;
}
#blog .article-body th {
    font-weight: 600;
    background: var(--b-canvas-subtle);
}
#blog .article-body tr:nth-child(even) td {
    background: var(--b-canvas-subtle);
}

/* ============================================================
 * 8. ENGAGEMENT — vistas + reacciones (debajo del body)
 * ============================================================ */

#blog .article-engagement {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--b-step-3);
    margin: var(--b-step-5) 0 var(--b-step-4);
    padding: var(--b-step-3) 0;
}
#blog .article-stats { display: flex; align-items: center; }
#blog .stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--b-text-muted);
    font-size: 13px;
}
#blog .stat-item svg { width: 16px; height: 16px; }
#blog .stat-data { display: flex; align-items: baseline; gap: 4px; }
#blog .stat-value {
    font-weight: 600;
    color: var(--b-text);
    font-variant-numeric: tabular-nums;
}
#blog .stat-label { color: var(--b-text-muted); }

#blog .article-reactions {
    display: flex;
    align-items: center;
    gap: var(--b-step-3);
}
#blog .reactions-label {
    font-size: 12px;
    color: var(--b-text-muted);
}
#blog .reactions-buttons {
    display: flex;
    gap: 4px;
}

/* GitHub-style button */
#blog .reaction-btn,
#blog .comment-submit,
#blog .blog-newsletter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 12px;
    height: 28px;
    background: var(--b-canvas-subtle);
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius);
    box-shadow: var(--b-shadow-btn-inset), var(--b-shadow-card);
    color: var(--b-text);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition: background var(--b-transition), border-color var(--b-transition);
}
#blog .reaction-btn:hover {
    background: var(--b-bg-muted);
    border-color: var(--b-border-strong);
}
#blog .reaction-btn.active {
    background: var(--b-accent-subtle);
    border-color: var(--b-accent-muted);
    color: var(--b-accent);
}
#blog .reaction-btn[data-reaction="dislike"].active {
    background: var(--b-danger-subtle);
    border-color: var(--b-danger);
    color: var(--b-danger);
}
#blog .reaction-icon {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    flex-shrink: 0;
}
#blog .reaction-count { font-weight: 500; }

/* ============================================================
 * 9. SHARE SIDEBAR — vertical sticky right
 * ============================================================ */

#blog .article-sidebar-right {
    grid-area: actions;
    position: sticky;
    /* Header del sitio = 65px (body padding-top), + 24px gap visual */
    top: 89px;
    align-self: start;
}
#blog .article-share {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
#blog .share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--b-canvas);
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius);
    box-shadow: var(--b-shadow-card);
    color: var(--b-text-muted);
    transition: background var(--b-transition), border-color var(--b-transition), color var(--b-transition);
}
#blog .share-btn svg { width: 14px; height: 14px; }
#blog .share-btn:hover {
    background: var(--b-canvas-subtle);
    border-color: var(--b-border-strong);
    color: var(--b-text);
}

/* ============================================================
 * 10. TAGS (article footer) + RELATED (lista plana)
 * ============================================================ */

#blog .article-tags {
    display: flex;
    align-items: center;
    gap: var(--b-step-3);
    margin: var(--b-step-6) 0 var(--b-step-4);
    flex-wrap: wrap;
}
#blog .article-tags-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--b-text-faint);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
#blog .article-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

#blog .article-related {
    margin: var(--b-step-6) 0 var(--b-step-5);
}
#blog .article-related-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--b-text);
    margin: 0 0 var(--b-step-3);
}
#blog .article-related-grid {
    display: flex;
    flex-direction: column;
}
#blog .related-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: var(--b-step-2) 0;
    transition: color var(--b-transition);
}
#blog .related-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    color: var(--cat-color, var(--b-text-muted));
    flex-shrink: 0;
}
#blog .related-card-icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}
#blog .related-card-title {
    font-size: 14px;
    line-height: 1.45;
    font-weight: 500;
    color: var(--b-text);
}
#blog .related-card,
#blog .related-card:hover { text-decoration: none; }
#blog .related-card:hover .related-card-title {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ============================================================
 * 11. COMMENTS
 * ============================================================ */

#blog .article-comments {
    margin-top: var(--b-step-7);
}
#blog .comments-header {
    display: flex;
    align-items: baseline;
    gap: var(--b-step-2);
    margin-bottom: var(--b-step-4);
}
#blog .comments-title {
    font-family: var(--b-font-display);
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--b-text);
}
#blog .comments-title svg {
    color: var(--b-text-muted);
    width: 18px;
    height: 18px;
}
#blog .comments-count {
    display: inline-flex;
    align-items: center;
    padding: 0 7px;
    height: 20px;
    background: var(--b-canvas-subtle);
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius-pill);
    font-size: 12px;
    color: var(--b-text-muted);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
#blog .comment-form {
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius);
    padding: var(--b-step-4);
    margin-bottom: var(--b-step-5);
    background: var(--b-canvas);
}
#blog .comment-form-user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--b-text-muted);
    margin-bottom: var(--b-step-3);
    padding-bottom: var(--b-step-2);
    border-bottom: 1px solid var(--b-border-muted);
}
#blog .comment-form-user svg { color: var(--b-text-faint); }
#blog .comment-form-user strong { color: var(--b-text); font-weight: 600; }
#blog .comment-login-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--b-step-3);
    padding: var(--b-step-6) var(--b-step-5);
    border: 1px dashed var(--b-border);
    border-radius: var(--b-radius);
    background: var(--b-canvas-subtle);
    margin-bottom: var(--b-step-5);
}
#blog .comment-login-icon {
    color: var(--b-text-faint);
}
#blog .comment-login-icon svg { width: 24px; height: 24px; }
#blog .comment-login-text {
    font-size: 14px;
    color: var(--b-text-muted);
    margin: 0;
}
#blog .comment-login-btn {
    display: inline-flex;
    align-items: center;
    padding: 5px 16px;
    height: 32px;
    background: var(--b-success);
    color: var(--b-success-fg);
    border: 1px solid rgba(31, 35, 40, 0.15);
    border-radius: var(--b-radius);
    box-shadow: var(--b-shadow-btn-inset), var(--b-shadow-card);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--b-transition);
}
#blog .comment-login-btn:hover {
    background: #1a7f37;
    text-decoration: none;
}
html[data-theme='dark'] #blog .comment-login-btn:hover { background: #2ea043; }
#blog .comment-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--b-step-3);
    margin-bottom: var(--b-step-3);
}
#blog .comment-input,
#blog .comment-textarea {
    width: 100%;
    padding: 5px 12px;
    border: 1px solid var(--b-border);
    border-radius: var(--b-radius);
    background: var(--b-canvas-subtle);
    color: var(--b-text);
    font: inherit;
    font-size: 14px;
    line-height: 20px;
    outline: none;
    transition: border-color var(--b-transition), box-shadow var(--b-transition), background var(--b-transition);
}
#blog .comment-input { height: 32px; }
#blog .comment-input:focus,
#blog .comment-textarea:focus {
    border-color: var(--b-accent);
    background: var(--b-canvas);
    box-shadow: var(--b-shadow-focus);
}
#blog .comment-textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
    padding: 8px 12px;
}
#blog .comment-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--b-step-3);
    flex-wrap: wrap;
    gap: var(--b-step-2);
}
#blog .comment-form-hint {
    font-size: 12px;
    color: var(--b-text-faint);
}
#blog .comment-submit {
    background: var(--b-success);
    color: var(--b-success-fg);
    border-color: rgba(31, 35, 40, 0.15);
    height: 32px;
    padding: 5px 16px;
    font-size: 14px;
}
#blog .comment-submit:hover {
    background: #1a7f37;
    border-color: rgba(31, 35, 40, 0.15);
}
html[data-theme='dark'] #blog .comment-submit:hover { background: #2ea043; }
#blog .comment-msg {
    margin-top: var(--b-step-2);
    font-size: 13px;
}
#blog .comments-list {
    display: flex;
    flex-direction: column;
}
#blog .comment-item {
    display: flex;
    gap: var(--b-step-3);
    padding: var(--b-step-3) 0;
    border-bottom: 1px solid var(--b-border-muted);
}
#blog .comment-item:last-child { border-bottom: none; }
#blog .comment-avatar {
    width: 32px; height: 32px;
    border-radius: var(--b-radius-circle);
    background: var(--b-canvas-subtle);
    border: 1px solid var(--b-border);
    color: var(--b-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}
#blog .comment-body {
    flex: 1;
    min-width: 0;
}
#blog .comment-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 2px;
}
#blog .comment-author {
    font-weight: 600;
    font-size: 13px;
    color: var(--b-text);
}
#blog .comment-date {
    font-size: 12px;
    color: var(--b-text-faint);
    font-variant-numeric: tabular-nums;
}
#blog .comment-content {
    font-size: 14px;
    line-height: 1.5;
    color: var(--b-text);
}
#blog .no-comments {
    padding: var(--b-step-5);
    text-align: center;
    color: var(--b-text-faint);
    border: 1px dashed var(--b-border);
    border-radius: var(--b-radius);
    background: var(--b-canvas-subtle);
}

/* ============================================================
 * 12. RESPONSIVE
 * ============================================================ */

@media (max-width: 768px) {
    #blog .article-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "toc"
            "content"
            "actions";
        padding: var(--b-step-5) var(--b-step-4);
    }
    #blog .article-hero-inner {
        grid-template-columns: 1fr;
    }
    #blog .article-hero-inner > * { max-width: 100%; }
    #blog .article-sidebar-right {
        position: static;
        padding-top: var(--b-step-4);
        border-top: 1px solid var(--b-border);
    }
    #blog .article-share {
        flex-direction: row;
        justify-content: flex-start;
    }
    #blog .blog-grid { grid-template-columns: 1fr; gap: var(--b-step-3); }
    #blog .featured-card { grid-template-columns: 1fr; }
    #blog .blog-search { max-width: 100%; }
    #blog .comment-form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    #blog .blog-hero { padding: var(--b-step-5) var(--b-step-4) var(--b-step-4); }
    #blog .blog-section { padding: var(--b-step-5) var(--b-step-4); }
    #blog .article-hero { padding: var(--b-step-4); }
    #blog .article-body { font-size: 15px; }
    #blog .article-body > p:first-of-type::first-letter { font-size: 3em; }
}
