/* Contenido del editor de texto (cuerpo de noticias). Lo importan el sitio
   público (app.css) y el panel (theme.css, pestaña "Demo en vivo") para que
   ambos muestren exactamente lo mismo: color, resaltado, columnas, tablas,
   desplegables y los bloques Documento y Video. */

.rich-content {
    --rc-link: #22498f;
    --rc-accent: #f28c28;
    --rc-line: rgb(15 29 54 / 0.14);
    --rc-surface: #eef2f7;
    --rc-muted: #4f5d75;
    --rc-night: #122b57;
}

:is(.dark, [data-theme='dark']) .rich-content {
    --rc-link: #8fb0ee;
    --rc-line: rgb(255 255 255 / 0.14);
    --rc-surface: rgb(255 255 255 / 0.06);
    --rc-muted: #9eadc6;
}

/* Color de texto elegido en el editor (cada color trae su variante oscura). */
.rich-content .color {
    color: var(--color);
}

:is(.dark, [data-theme='dark']) .rich-content .color {
    color: var(--dark-color, var(--color));
}

.rich-content mark {
    background: rgb(242 140 40 / 0.3);
    color: inherit;
    padding: 0.05em 0.2em;
    border-radius: 0.2em;
}

.rich-content .lead {
    font-size: 1.2em;
    line-height: 1.55;
    color: var(--rc-muted);
}

.rich-content small {
    font-size: 0.85em;
    color: var(--rc-muted);
}

.rich-content hr {
    border: 0;
    border-top: 1px solid var(--rc-line);
    margin-block: 2em;
}

/* Columnas: en celular se apilan. */
.rich-content .grid-layout {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 48rem) {
    .rich-content .grid-layout {
        grid-template-columns: var(--cols, repeat(2, minmax(0, 1fr)));
    }
}

.rich-content .grid-layout > * > :first-child {
    margin-top: 0;
}

/* Tablas: se desplazan en horizontal antes que romper la página. */
.rich-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 0.92em;
}

.rich-content :where(th, td) {
    border: 1px solid var(--rc-line);
    padding: 0.55em 0.8em;
    text-align: start;
    vertical-align: top;
}

.rich-content th {
    background: var(--rc-surface);
    font-weight: 700;
}

.rich-content :where(th, td) > :first-child {
    margin-top: 0;
}

.rich-content :where(th, td) > :last-child {
    margin-bottom: 0;
}

/* Desplegable ("Ver más"). */
.rich-content details {
    border: 1px solid var(--rc-line);
    border-radius: 0.75rem;
    padding: 0.2rem 1rem;
}

.rich-content summary {
    cursor: pointer;
    font-weight: 700;
    padding-block: 0.6rem;
}

.rich-content details[open] > summary {
    border-bottom: 1px solid var(--rc-line);
    margin-bottom: 0.6rem;
}

.rich-content img {
    max-width: 100%;
    height: auto;
    border-radius: 1rem;
}

/* ---- Bloque Documento ---- */
.rich-content .rc-doc-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.15rem;
    border: 1px solid var(--rc-line);
    border-radius: 0.875rem;
    background: var(--rc-surface);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease;
}

.rich-content .rc-doc-link:hover {
    border-color: var(--rc-accent);
}

.rich-content .rc-doc-type {
    flex-shrink: 0;
    min-width: 3.25rem;
    padding: 0.55rem 0.4rem;
    border-radius: 0.5rem;
    background: var(--rc-night);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-align: center;
}

.rich-content .rc-doc-text {
    display: grid;
    gap: 0.1rem;
    min-width: 0;
}

.rich-content .rc-doc-title {
    font-weight: 700;
    line-height: 1.3;
}

.rich-content .rc-doc-meta {
    font-size: 0.85em;
    color: var(--rc-link);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---- Bloque Video ---- */
.rich-content .rc-video-link {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 1rem;
    background: var(--rc-night);
    color: #fff;
    text-decoration: none;
}

.rich-content .rc-video-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 0;
    opacity: 0.82;
    transition: opacity 0.2s ease;
}

.rich-content .rc-video-link:hover .rc-video-thumb {
    opacity: 1;
}

.rich-content .rc-video-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    padding: 0.7rem 1.4rem;
    border-radius: 999px;
    background: var(--rc-accent);
    color: #1b1206;
    font-weight: 800;
    white-space: nowrap;
}

.rich-content .rc-video-title {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    padding: 2rem 1rem 0.85rem;
    background: linear-gradient(transparent, rgb(0 0 0 / 0.75));
    font-weight: 700;
    line-height: 1.3;
}

@media (prefers-reduced-motion: reduce) {
    .rich-content .rc-doc-link,
    .rich-content .rc-video-thumb {
        transition: none;
    }
}
