/* ===== READER — layout editorial moderno ===== */

.rd-page {
    max-width: 1160px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem 4rem;
}

/* --- Header del artículo --- */
.rd-header {
    max-width: 760px;
    margin: 0 auto 2rem;
}

.rd-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .6rem;
    min-height: 1.5rem;
}

.rd-category {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #01a982;
    text-decoration: none;
    margin-bottom: .75rem;
}
.rd-category:hover { text-decoration: underline; }

.rd-title {
    font-size: clamp(1.7rem, 4vw, 2.6rem);
    font-weight: 800;
    line-height: 1.18;
    color: #0f172a;
    margin-bottom: 1rem;
    letter-spacing: -.02em;
}

.rd-title-sep {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: .75rem 0 0;
}

.rd-article-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.rd-article-date {
    font-size: .8rem;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.rd-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem 1.4rem;
    color: #64748b;
    font-size: .84rem;
    margin-bottom: .75rem;
}

.rd-meta-item { display: inline-flex; align-items: center; gap: .35rem; }
.rd-meta-item i { opacity: .6; font-size: .78rem; }

.rd-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    padding: .28rem .75rem;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    color: #64748b;
    text-decoration: none;
    transition: all .15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.rd-edit-btn:hover { border-color: #01a982; color: #01a982; background: #f0fdf4; }

/* --- Hero image --- */
.rd-hero {
    max-width: 860px;
    margin: 0 auto 2.5rem;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(15,23,42,.10);
}

.rd-hero-img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 480px;
    object-fit: cover;
}

/* --- Layout principal (artículo + sidebar) --- */
.rd-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 2.5rem;
    align-items: start;
}

/* --- Contenido del artículo --- */
.rd-main { min-width: 0; }

.rd-body {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.08rem;
    line-height: 1.85;
    color: #1e293b;
}

.rd-body h1, .rd-body h2, .rd-body h3, .rd-body h4 {
    font-family: system-ui, -apple-system, sans-serif;
    font-weight: 700;
    color: #0f172a;
    margin-top: 2.2rem;
    margin-bottom: .8rem;
    line-height: 1.25;
}
.rd-body h1 { font-size: 1.9rem; }
.rd-body h2 { font-size: 1.5rem; border-bottom: 1px solid #e2e8f0; padding-bottom: .4rem; }
.rd-body h3 { font-size: 1.2rem; }
.rd-body h4 { font-size: 1rem; }

.rd-body p { margin-bottom: 1.2rem; }

.rd-body a { color: #01a982; text-decoration: underline; }
.rd-body a:hover { color: #007a5e; }

.rd-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,.07);
}

.rd-body blockquote {
    border-left: 4px solid #01a982;
    margin: 1.8rem 0;
    padding: .8rem 1.2rem;
    background: #f0fdf4;
    border-radius: 0 8px 8px 0;
    color: #374151;
    font-style: italic;
}

.rd-body ul, .rd-body ol {
    padding-left: 1.5rem;
    margin-bottom: 1.2rem;
}
.rd-body li { margin-bottom: .4rem; }

.rd-body pre, .rd-body code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: .9rem;
    background: #f1f5f9;
    border-radius: 6px;
}
.rd-body pre { padding: 1rem 1.2rem; overflow-x: auto; margin: 1.2rem 0; }
.rd-body :not(pre) > code { padding: .15rem .45rem; }

.rd-body table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: .9rem; }
.rd-body th, .rd-body td { border: 1px solid #e2e8f0; padding: .55rem .8rem; text-align: left; }
.rd-body th { background: #f8fafc; font-weight: 600; }
.rd-body tr:nth-child(even) td { background: #fafafa; }

.rd-body hr { border: none; border-top: 1px solid #e2e8f0; margin: 2rem 0; }

/* --- Galería --- */
.rd-gallery { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid #e2e8f0; }

.rd-gallery-title {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #64748b;
    margin-bottom: 1rem;
}

.rd-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .6rem;
}

.rd-gallery-item { margin: 0; border-radius: 8px; overflow: hidden; }

.rd-gallery-link { display: block; }
.rd-gallery-link img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    transition: transform .2s, opacity .2s;
}
.rd-gallery-link:hover img { transform: scale(1.05); opacity: .9; }

/* --- Sidebar --- */
.rd-sidebar { position: sticky; top: 100px; }

.rd-widget {
    background: #fff;
    border: 1px solid #e9eef5;
    border-radius: 12px;
    padding: 1rem 1.1rem;
    margin-bottom: 1.1rem;
    box-shadow: 0 2px 8px rgba(15,23,42,.04);
}

.rd-widget-title {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: .75rem;
}

/* TOC */
.rd-toc { max-height: 320px; overflow-y: auto; }
.rd-toc::-webkit-scrollbar { width: 3px; }
.rd-toc::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 999px; }

.rd-toc-item {
    display: block;
    font-size: .83rem;
    color: #475569;
    text-decoration: none;
    padding: .3rem .5rem;
    border-radius: 6px;
    margin-bottom: 2px;
    line-height: 1.35;
    transition: color .12s, background .12s;
}
.rd-toc-item.rd-toc-sub { font-size: .78rem; padding-left: 1.1rem; color: #64748b; }
.rd-toc-item:hover { color: #0f172a; background: #f1f5f9; }
.rd-toc-item.active { color: #01a982; background: #f0fdf4; font-weight: 600; }

/* Relacionados */
.rd-related { list-style: none; padding: 0; margin: 0; }
.rd-related li { margin-bottom: .5rem; }
.rd-related a { font-size: .85rem; color: #01a982; text-decoration: none; line-height: 1.35; }
.rd-related a:hover { text-decoration: underline; }

/* Categorías */
.rd-cats { display: flex; flex-direction: column; gap: .3rem; }
.rd-cat-link { font-size: .84rem; color: #475569; text-decoration: none; display: flex; align-items: center; gap: .4rem; transition: color .12s; }
.rd-cat-link i { font-size: .7rem; color: #01a982; }
.rd-cat-link:hover { color: #01a982; }

/* --- Responsive --- */
@media (max-width: 900px) {
    .rd-layout { grid-template-columns: 1fr; }
    .rd-sidebar { position: static; }
    .rd-hero { border-radius: 8px; }
}

@media (max-width: 600px) {
    .rd-page { padding: 1.5rem .75rem 3rem; }
    .rd-title { font-size: 1.6rem; }
    .rd-gallery-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
