/* =========================================================
   KTT Municipal — estilos del CONTENIDO
   Se cargan en el sitio público y también dentro del editor de
   bloques, para que lo que se edita se vea igual que lo publicado.
   Todo lo que va dentro de una entrada o página se estiliza aquí
   con el prefijo :is(.ktt-contenido, .editor-styles-wrapper).
   ========================================================= */

:root {
	--rojo: #cd2122;
	--rojo-osc: #a41a1b;
	--rojo-claro: #fbeaea;
	--negro: #1a1a1a;
	--gris-osc: #2b2b2b;
	--gris-med: #6b6b6b;
	--gris: #f4f4f4;
	--borde: #e3e3e3;
	--texto: #333;
	--blanco: #fff;
	--verde: #1f7244;
	--azul: #2b579a;
	--radio: 6px;
	--sombra: 0 6px 24px rgba(0, 0, 0, .08);
	--fuente-tit: "Montserrat", "Helvetica Neue", Arial, sans-serif;
	--fuente: "Open Sans", "Helvetica Neue", Arial, sans-serif;
	--ancho: 1200px;
	--escala: 1;
}

/* ---------- Base del área de contenido ---------- */
:is(.ktt-contenido, .editor-styles-wrapper) { font-family: var(--fuente); color: var(--texto); font-size: 1.02rem; line-height: 1.7; }
.editor-styles-wrapper { background: #fff; }
:is(.ktt-contenido, .editor-styles-wrapper) a { color: var(--rojo); }
:is(.ktt-contenido, .editor-styles-wrapper) a:hover { color: var(--rojo-osc); }
:is(.ktt-contenido, .editor-styles-wrapper) :is(h1, h2, h3, h4, h5, h6) { font-family: var(--fuente-tit); color: var(--negro); line-height: 1.25; }
:is(.ktt-contenido, .editor-styles-wrapper) h2 { font-size: 1.5rem; font-weight: 800; margin: 2rem 0 .8rem; }
:is(.ktt-contenido, .editor-styles-wrapper) h3 { font-size: 1.15rem; font-weight: 700; margin: 1.8rem 0 .8rem; border-left: 4px solid var(--rojo); padding-left: .7rem; }
:is(.ktt-contenido, .editor-styles-wrapper) h4 { font-size: 1rem; font-weight: 700; margin: 1.5rem 0 .6rem; text-transform: uppercase; letter-spacing: .04em; color: var(--rojo); }
:is(.ktt-contenido, .editor-styles-wrapper) :is(p, ul, ol) { margin: 0 0 1.1rem; }
:is(.ktt-contenido, .editor-styles-wrapper) :is(ul, ol):not(.ktt-docs):not(.is-style-documentos) { padding-left: 1.4rem; }
:is(.ktt-contenido, .editor-styles-wrapper) li::marker { color: var(--rojo); }
:is(.ktt-contenido, .editor-styles-wrapper) strong { color: var(--negro); }
:is(.ktt-contenido, .editor-styles-wrapper) hr, :is(.ktt-contenido, .editor-styles-wrapper) .wp-block-separator { border: 0; border-top: 2px solid var(--borde); margin: 2rem 0; }
:is(.ktt-contenido, .editor-styles-wrapper) img { max-width: 100%; height: auto; border-radius: var(--radio); }

/* Título de la entrada dentro del editor */
.editor-styles-wrapper .editor-post-title, .editor-styles-wrapper .wp-block-post-title { font-family: var(--fuente-tit); font-weight: 800; color: var(--negro); font-size: 2rem; border-bottom: 4px solid var(--rojo); padding-bottom: .4rem; }

/* Citas */
:is(.ktt-contenido, .editor-styles-wrapper) :is(blockquote, .wp-block-quote) { margin: 1.5rem 0; padding: 1rem 1.4rem; background: var(--gris); border-left: 4px solid var(--rojo); font-style: italic; border-radius: 0 var(--radio) var(--radio) 0; }
:is(.ktt-contenido, .editor-styles-wrapper) :is(blockquote, .wp-block-quote) p:last-child { margin-bottom: 0; }
:is(.ktt-contenido, .editor-styles-wrapper) .wp-block-pullquote { border-top: 4px solid var(--rojo); border-bottom: 4px solid var(--rojo); }

/* Tablas */
:is(.ktt-contenido, .editor-styles-wrapper) table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; font-size: .92rem; }
:is(.ktt-contenido, .editor-styles-wrapper) :is(th, td) { border: 1px solid var(--borde); padding: .6rem .8rem; text-align: left; }
:is(.ktt-contenido, .editor-styles-wrapper) th, :is(.ktt-contenido, .editor-styles-wrapper) thead td { background: var(--negro); color: #fff; font-weight: 700; }
:is(.ktt-contenido, .editor-styles-wrapper) tbody tr:nth-child(even) td { background: #fafafa; }

/* Imágenes y galerías */
:is(.ktt-contenido, .editor-styles-wrapper) :is(.ktt-fig, .wp-block-image) { margin: 1rem 0 1.5rem; }
:is(.ktt-contenido, .editor-styles-wrapper) :is(.ktt-fig, .wp-block-image) img { border: 1px solid var(--borde); }
:is(.ktt-contenido, .editor-styles-wrapper) figcaption { font-size: .85rem; color: var(--gris-med); text-align: center; margin-top: .4rem; }

/* Botones */
:is(.ktt-contenido, .editor-styles-wrapper) .wp-block-button__link { background: var(--rojo); color: #fff; font-family: var(--fuente-tit); font-weight: 700; font-size: .85rem; letter-spacing: .04em; text-transform: uppercase; border-radius: var(--radio); padding: .8rem 1.4rem; text-decoration: none; }
:is(.ktt-contenido, .editor-styles-wrapper) .wp-block-button__link:hover { background: var(--rojo-osc); color: #fff; }
:is(.ktt-contenido, .editor-styles-wrapper) .is-style-outline .wp-block-button__link { background: transparent; color: var(--rojo); border: 2px solid var(--rojo); }

/* Recuadros y textos pendientes */
.ktt-recuadro { background: var(--gris); border-radius: var(--radio); padding: 1.3rem 1.5rem; margin-bottom: 1.5rem; }
.ktt-recuadro p:last-child { margin-bottom: 0; }
.ktt-pendiente { background: #fff6d6; border: 1px dashed #d9a300; padding: .1rem .35rem; border-radius: 3px; }
.ktt-mapa { margin-top: 1rem; border-radius: var(--radio); overflow: hidden; aspect-ratio: 4 / 3; background: var(--gris-osc); }
.ktt-mapa iframe { width: 100%; height: 100%; border: 0; display: block; }

/* Paleta del tema (colores elegibles en el editor) */
.has-rojo-color { color: var(--rojo) !important; }
.has-rojo-oscuro-color { color: var(--rojo-osc) !important; }
.has-negro-color { color: var(--negro) !important; }
.has-gris-claro-color { color: var(--gris) !important; }
.has-blanco-color { color: #fff !important; }
.has-rojo-background-color { background-color: var(--rojo) !important; }
.has-rojo-oscuro-background-color { background-color: var(--rojo-osc) !important; }
.has-negro-background-color { background-color: var(--negro) !important; }
.has-gris-claro-background-color { background-color: var(--gris) !important; }
.has-blanco-background-color { background-color: #fff !important; }
:is(.ktt-contenido, .editor-styles-wrapper) .has-background { padding: 1.2rem 1.5rem; border-radius: var(--radio); }

/* =========================================================
   LISTA DE DOCUMENTOS
   Funciona con:
   - las listas importadas  (ul.ktt-docs)
   - listas creadas en el editor con el estilo «Lista de documentos»
     (bloque Lista › Estilos › Lista de documentos → .is-style-documentos)
   No depende de clases en cada renglón: el ícono sale de la
   extensión del enlace, así que sobrevive a cualquier edición.
   ========================================================= */
:is(.ktt-docs, .is-style-documentos) { list-style: none !important; margin-top: 0 !important; margin-bottom: 1.6rem !important; padding: 0 !important; border: 1px solid var(--borde); border-radius: var(--radio); overflow: hidden; background: #fff; }
:is(.ktt-docs, .is-style-documentos) > li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem 1rem; margin: 0 !important; padding: .8rem 1rem .8rem 3.3rem; border-bottom: 1px solid var(--borde); position: relative; background: #fff; min-height: 2.9rem; }
:is(.ktt-docs, .is-style-documentos) > li:nth-child(even) { background: #fafafa; }
:is(.ktt-docs, .is-style-documentos) > li:last-child { border-bottom: 0; }
:is(.ktt-docs, .is-style-documentos) > li::marker { content: ""; }
:is(.ktt-contenido, .editor-styles-wrapper, .ktt-adjuntos) :is(.ktt-docs, .is-style-documentos) li a { font-weight: 600; color: var(--negro); text-decoration: none; }
:is(.ktt-contenido, .editor-styles-wrapper, .ktt-adjuntos) :is(.ktt-docs, .is-style-documentos) li a:hover { color: var(--rojo); text-decoration: underline; }

/* Distintivo según el tipo de archivo */
:is(.ktt-docs, .is-style-documentos) > li::before { content: "→"; position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); width: 34px; height: 22px; border-radius: 3px; background: var(--gris-osc); color: #fff; font: 700 .58rem/22px var(--fuente-tit); text-align: center; letter-spacing: .03em; }
:is(.ktt-docs, .is-style-documentos) > li:has(a[href^="http"]:not([href*="/wp-content/uploads/"]))::before { content: "WEB"; }
:is(.ktt-docs, .is-style-documentos) > li:has(a[href$=".pdf" i])::before { content: "PDF"; background: var(--rojo); }
:is(.ktt-docs, .is-style-documentos) > li:has(a[href$=".doc" i], a[href$=".docx" i], a[href$=".odt" i])::before { content: "DOC"; background: var(--azul); }
:is(.ktt-docs, .is-style-documentos) > li:has(a[href$=".xls" i], a[href$=".xlsx" i], a[href$=".ods" i], a[href$=".csv" i])::before { content: "XLS"; background: var(--verde); }
:is(.ktt-docs, .is-style-documentos) > li:has(a[href$=".ppt" i], a[href$=".pptx" i])::before { content: "PPT"; background: #c4501f; }
:is(.ktt-docs, .is-style-documentos) > li:has(a[href$=".jpg" i], a[href$=".jpeg" i], a[href$=".png" i], a[href$=".gif" i], a[href$=".webp" i])::before { content: "IMG"; background: #2f7d4f; }
:is(.ktt-docs, .is-style-documentos) > li:has(a[href$=".zip" i], a[href$=".rar" i])::before { content: "ZIP"; background: #6d4c9f; }
:is(.ktt-docs, .is-style-documentos) > li:not(:has(a))::before { content: "N/D"; background: #b5b5b5; }
:is(.ktt-docs, .is-style-documentos) > li:not(:has(a)) { color: var(--gris-med); }

/* Tamaño / descripción a la derecha (opcional) */
:is(.ktt-docs, .is-style-documentos) .ktt-docs__meta { flex: none; font-size: .75rem; color: var(--gris-med); white-space: nowrap; }
:is(.ktt-docs, .is-style-documentos) > li:not(:has(a)) .ktt-docs__meta { white-space: normal; text-align: right; }

/* Bloque «Archivo» de WordPress con el mismo aspecto */
:is(.ktt-contenido, .editor-styles-wrapper) .wp-block-file { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-top: 0; margin-bottom: .7rem; padding: .8rem 1rem .8rem 3.3rem; border: 1px solid var(--borde); border-left: 4px solid var(--rojo); border-radius: var(--radio); background: #fff; position: relative; }
:is(.ktt-contenido, .editor-styles-wrapper) .wp-block-file::before { content: "DOC"; position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); width: 34px; height: 22px; border-radius: 3px; background: var(--gris-osc); color: #fff; font: 700 .58rem/22px var(--fuente-tit); text-align: center; }
:is(.ktt-contenido, .editor-styles-wrapper) .wp-block-file:has(a[href$=".pdf" i])::before { content: "PDF"; background: var(--rojo); }
:is(.ktt-contenido, .editor-styles-wrapper) .wp-block-file:has(a[href$=".xls" i], a[href$=".xlsx" i])::before { content: "XLS"; background: var(--verde); }
:is(.ktt-contenido, .editor-styles-wrapper) .wp-block-file:has(a[href$=".doc" i], a[href$=".docx" i])::before { content: "DOC"; background: var(--azul); }
:is(.ktt-contenido, .editor-styles-wrapper) .wp-block-file > a:not(.wp-block-file__button), :is(.ktt-contenido, .editor-styles-wrapper) .wp-block-file .wp-block-file__content-wrapper > a:not(.wp-block-file__button) { font-weight: 600; color: var(--negro); text-decoration: none; }
:is(.ktt-contenido, .editor-styles-wrapper) .wp-block-file .wp-block-file__button { background: var(--rojo); color: #fff; font-family: var(--fuente-tit); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: .45rem .9rem; border-radius: 4px; text-decoration: none; margin-left: auto; }
:is(.ktt-contenido, .editor-styles-wrapper) .wp-block-file .wp-block-file__button:hover { background: var(--rojo-osc); }
:is(.ktt-contenido, .editor-styles-wrapper) .wp-block-file .ktt-docs__meta { margin-left: auto; font-size: .75rem; color: var(--gris-med); white-space: nowrap; }
:is(.ktt-contenido, .editor-styles-wrapper) .wp-block-file:has(.ktt-docs__meta) .wp-block-file__button { margin-left: .4rem; }
:is(.ktt-contenido, .editor-styles-wrapper) .wp-block-file .wp-block-file__embed { flex-basis: 100%; border-radius: var(--radio); margin-top: .6rem; }

/* Sección automática de documentos adjuntos */
.ktt-adjuntos { margin-top: 2rem; }
.ktt-adjuntos__titulo { font-family: var(--fuente-tit); font-size: 1.15rem; color: var(--negro); border-left: 4px solid var(--rojo); padding-left: .7rem; margin: 0 0 1rem; }

@media (max-width: 600px) {
	:is(.ktt-docs, .is-style-documentos) > li { flex-direction: column; align-items: flex-start; }
	:is(.ktt-contenido, .editor-styles-wrapper) .wp-block-file .wp-block-file__button { margin-left: 0; }
}
