/*
Theme Name: Tercera Posición
Theme URI: https://terceraposicion.com
Author: Tercera Posición
Description: Tema a medida para el periódico digital Tercera Posición. Portada por secciones, página de noticia con bloque de análisis y fuentes, "Lo más leído" y newsletter.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: terceraposicion
*/

:root {
	--tp-accent: #4E6B1E;
	--tp-accent-dark: #3E5617;
	--tp-tint: #F1F4E8;
	--tp-img: #E3EAD2;
	--tp-ink: #1A1A17;
	--tp-ink-2: #3A3A35;
	--tp-muted: #55554E;
	--tp-rule: #E2E2DA;
	--tp-footer: #1F2A0E;
	--tp-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
	--tp-sans: 'Libre Franklin', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: #fff; color: var(--tp-ink); font-family: var(--tp-sans); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--tp-ink); text-decoration: none; }
a:hover { color: var(--tp-accent-dark); text-decoration: underline; }
.tp-wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 999; width: auto; height: auto; clip: auto; background: #fff; padding: 10px 16px; }

/* ---------- Barra superior ---------- */
.tp-topbar { border-bottom: 1px solid var(--tp-rule); }
.tp-topbar .tp-wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; font-size: 13px; color: var(--tp-muted); }
.tp-topbar-links { display: flex; gap: 20px; align-items: center; }
.tp-topbar-links a { color: var(--tp-muted); }
.tp-btn { display: inline-block; background: var(--tp-accent); color: #fff !important; padding: 8px 16px; border-radius: 3px; font-weight: 600; text-decoration: none !important; }
.tp-btn:hover { background: var(--tp-accent-dark); }

/* ---------- Cabecera ---------- */
.tp-masthead { text-align: center; padding: 28px 24px 18px; }
.tp-logo { font-family: var(--tp-serif); font-weight: 800; font-size: 76px; line-height: 1; letter-spacing: -1.5px; color: var(--tp-ink); }
.tp-logo:hover { text-decoration: none; color: var(--tp-ink); }
.tp-logo span, .tp-logo-sm span { color: var(--tp-accent); }
.tp-logo img { display: inline-block; max-height: 110px; width: auto; }
.tp-tagline { margin-top: 10px; font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: var(--tp-muted); }

.tp-nav { border-top: 1px solid var(--tp-ink); border-bottom: 3px solid var(--tp-accent); background: #fff; }
.tp-nav ul { list-style: none; margin: 0 auto; padding: 0 24px; max-width: 1240px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 36px; }
.tp-nav a { display: block; padding: 14px 0; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.tp-nav .current-menu-item > a, .tp-nav .current-cat > a, .tp-nav a[aria-current] { color: var(--tp-accent); }

/* Cabecera compacta (páginas interiores) */
.tp-header-sm { border-bottom: 3px solid var(--tp-accent); }
.tp-header-sm .tp-wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 16px; }
.tp-logo-sm { font-family: var(--tp-serif); font-weight: 800; font-size: 34px; letter-spacing: -0.5px; color: var(--tp-ink); }
.tp-logo-sm:hover { text-decoration: none; color: var(--tp-ink); }
.tp-logo-sm img { max-height: 48px; width: auto; }
.tp-header-sm .tp-nav-inline ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 28px; }
.tp-header-sm .tp-nav-inline a { display: block; padding: 12px 0; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.tp-header-sm .tp-nav-inline .current-menu-item > a, .tp-header-sm .tp-nav-inline .current-cat > a { color: var(--tp-accent); }

/* ---------- Elementos comunes ---------- */
.tp-kicker { font-size: 13px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--tp-accent); }
.tp-kicker a { color: inherit; }
.tp-kicker-sm { font-size: 12px; }
.tp-meta { font-size: 13px; color: var(--tp-muted); }
.tp-tag-analisis { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: #fff; background: var(--tp-ink); padding: 3px 7px; }
.tp-thumb { display: block; background: var(--tp-img); overflow: hidden; }
.tp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tp-thumb-16x9 { aspect-ratio: 16 / 9; }
.tp-thumb-3x2 { aspect-ratio: 3 / 2; }
.tp-serif { font-family: var(--tp-serif); }

/* ---------- Portada ---------- */
.tp-main { padding-top: 36px; }
.tp-lead { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 40px; padding-bottom: 36px; border-bottom: 1px solid var(--tp-rule); }
.tp-lead-title { margin: 8px 0 12px; font-family: var(--tp-serif); font-weight: 700; font-size: 46px; line-height: 1.08; letter-spacing: -0.5px; }
.tp-lead-excerpt { margin: 0; font-family: var(--tp-serif); font-size: 21px; line-height: 1.45; color: var(--tp-ink-2); }
.tp-lead .tp-meta { margin-top: 14px; }
.tp-lead .tp-kicker { margin-top: 18px; }
.tp-side-item { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--tp-rule); }
.tp-side-item h2 { margin: 6px 0 0; font-family: var(--tp-serif); font-weight: 600; font-size: 23px; line-height: 1.2; }

.tp-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); gap: 40px; padding-top: 36px; }
.tp-section { margin-bottom: 44px; }
.tp-section-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.tp-section-head h2 { margin: 0; font-family: var(--tp-serif); font-weight: 800; font-size: 28px; color: var(--tp-accent); white-space: nowrap; }
.tp-section-head h2 a { color: inherit; }
.tp-section-head .tp-line { flex: 1; height: 2px; background: var(--tp-accent); }
.tp-section-head .tp-more { font-size: 13px; font-weight: 600; color: var(--tp-ink-2); white-space: nowrap; }
.tp-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; }
.tp-card .tp-tag-analisis { margin-top: 12px; }
.tp-card h3 { margin: 10px 0 0; font-family: var(--tp-serif); font-weight: 600; font-size: 20px; line-height: 1.22; }

/* ---------- Barra lateral ---------- */
.tp-box-top { border-top: 3px solid var(--tp-ink); padding-top: 14px; }
.tp-box-title { margin: 0 0 8px; font-family: var(--tp-serif); font-weight: 800; font-size: 24px; }
.tp-ranking { list-style: none; margin: 0; padding: 0; }
.tp-ranking li { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--tp-rule); }
.tp-ranking .tp-num { font-family: var(--tp-serif); font-weight: 800; font-size: 34px; line-height: 1; color: var(--tp-accent); min-width: 26px; }
.tp-ranking a { font-family: var(--tp-serif); font-weight: 600; font-size: 18px; line-height: 1.25; }
.tp-opinion { margin-top: 32px; background: var(--tp-tint); padding: 24px; }
.tp-opinion .tp-kicker { color: var(--tp-accent-dark); font-size: 12px; }
.tp-opinion h3 { margin: 8px 0 6px; font-family: var(--tp-serif); font-style: italic; font-weight: 600; font-size: 22px; line-height: 1.25; }
.tp-news-box { margin-top: 32px; background: var(--tp-accent); color: #fff; padding: 24px; }
.tp-news-box h2 { margin: 0 0 8px; font-family: var(--tp-serif); font-weight: 700; font-size: 24px; }
.tp-news-box p { margin: 0 0 16px; font-size: 15px; line-height: 1.5; }
.tp-widget { margin-top: 32px; }

/* ---------- Newsletter y pie ---------- */
.tp-newsletter { background: var(--tp-accent); color: #fff; margin-top: 20px; }
.tp-newsletter .tp-wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; padding-top: 44px; padding-bottom: 44px; }
.tp-newsletter h2 { margin: 0 0 6px; font-family: var(--tp-serif); font-weight: 700; font-size: 32px; }
.tp-newsletter p { margin: 0; font-size: 16px; line-height: 1.5; }
.tp-newsletter-text, .tp-newsletter-form { flex: 1 1 380px; }
.tp-newsletter input[type=email], .tp-news-box input[type=email] { width: 100%; min-height: 48px; padding: 0 16px; border: 0; border-radius: 3px; font-size: 16px; font-family: inherit; }
.tp-newsletter button, .tp-newsletter input[type=submit], .tp-news-box button, .tp-news-box input[type=submit] { min-height: 48px; padding: 0 24px; border: 2px solid #fff; background: transparent; color: #fff; border-radius: 3px; font-size: 15px; font-weight: 700; font-family: inherit; cursor: pointer; }

.tp-footer { background: var(--tp-footer); color: #E6EBDA; }
.tp-footer a { color: #E6EBDA; }
.tp-footer-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px; padding-top: 44px; padding-bottom: 28px; }
.tp-footer-brand { flex: 1 1 280px; }
.tp-footer-brand .tp-footer-logo { font-family: var(--tp-serif); font-weight: 800; font-size: 32px; color: #fff; }
.tp-footer-brand p { margin: 10px 0 0; font-size: 14px; line-height: 1.6; color: #C9D2B6; }
.tp-footer-col { flex: 1 1 180px; font-size: 14px; }
.tp-footer-col h2 { margin: 0 0 10px; font-weight: 700; color: #fff; text-transform: uppercase; letter-spacing: 1px; font-size: 12px; }
.tp-footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tp-footer-bottom { padding-top: 18px; padding-bottom: 28px; border-top: 1px solid #3A4A20; font-size: 13px; color: #C9D2B6; }

/* ---------- Noticia ---------- */
.tp-art { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; padding-top: 40px; }
.tp-art-title { margin: 12px 0 16px; font-family: var(--tp-serif); font-weight: 700; font-size: 50px; line-height: 1.07; letter-spacing: -0.6px; }
.tp-art-excerpt { margin: 0 0 22px; font-family: var(--tp-serif); font-size: 23px; line-height: 1.45; color: var(--tp-ink-2); }
.tp-art-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-top: 1px solid var(--tp-rule); border-bottom: 1px solid var(--tp-rule); font-size: 14px; color: var(--tp-muted); }
.tp-art-bar strong { color: var(--tp-ink); }
.tp-share { display: flex; gap: 8px; }
.tp-share a, .tp-share button { width: 44px; height: 44px; border: 1px solid #D5D5CC; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--tp-ink); }
.tp-share a:hover, .tp-share button:hover { border-color: var(--tp-accent); }
.tp-share svg { width: 18px; height: 18px; }
.tp-figure { margin: 28px 0 0; }
.tp-figure figcaption { margin-top: 8px; font-size: 13px; color: var(--tp-muted); }

.tp-content { max-width: 680px; margin-top: 32px; font-family: var(--tp-serif); font-size: 20px; line-height: 1.65; color: #26261F; }
.tp-content p { margin: 0 0 22px; }
.tp-content h2 { font-size: 28px; line-height: 1.2; margin: 36px 0 14px; }
.tp-content h3 { font-size: 23px; margin: 30px 0 12px; }
.tp-content a { color: var(--tp-accent-dark); text-decoration: underline; }
.tp-content blockquote, .tp-content .wp-block-quote { margin: 32px 0; padding: 4px 0 4px 24px; border-left: 4px solid var(--tp-accent); font-style: italic; font-size: 26px; line-height: 1.35; color: var(--tp-ink); }
.tp-content blockquote p { margin: 0; }
.tp-content ul, .tp-content ol { margin: 0 0 22px; padding-left: 24px; }
.tp-content figure { margin: 28px 0; }
.tp-content figcaption { font-family: var(--tp-sans); font-size: 13px; color: var(--tp-muted); margin-top: 8px; }

/* Bloques que redacta el agente de n8n */
.tp-content .tp-analisis { margin: 36px 0 22px; padding: 24px 26px; background: var(--tp-tint); }
.tp-content .tp-analisis::before { content: "Análisis"; display: block; font-family: var(--tp-sans); font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--tp-accent-dark); margin-bottom: 10px; }
.tp-content .tp-analisis p:last-child { margin-bottom: 0; }
.tp-content .tp-fuentes { margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--tp-rule); font-family: var(--tp-sans); font-size: 15px; line-height: 1.9; }
.tp-content .tp-fuentes::before { content: "Fuentes"; display: block; font-size: 13px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 6px; color: var(--tp-ink); }
.tp-content .tp-fuentes ul { margin: 0; padding-left: 18px; }

.tp-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.tp-tags a { font-size: 13px; padding: 8px 14px; border: 1px solid #D5D5CC; border-radius: 20px; }
.tp-related { margin-top: 56px; padding: 32px 0 56px; border-top: 3px solid var(--tp-ink); }
.tp-related > h2 { margin: 0 0 22px; font-family: var(--tp-serif); font-weight: 800; font-size: 28px; }
.tp-related > h2 span { color: var(--tp-accent); }
.tp-rel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.tp-rel h3 { margin: 12px 0 0; font-family: var(--tp-serif); font-weight: 600; font-size: 21px; line-height: 1.22; }

/* ---------- Archivo de sección / búsqueda ---------- */
.tp-archive-head { padding: 36px 0 20px; border-bottom: 3px solid var(--tp-accent); margin-bottom: 32px; }
.tp-archive-head h1 { margin: 0; font-family: var(--tp-serif); font-weight: 800; font-size: 48px; color: var(--tp-accent); }
.tp-archive-head p { margin: 8px 0 0; color: var(--tp-muted); font-size: 16px; }
.tp-list-item { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; padding-bottom: 28px; margin-bottom: 28px; border-bottom: 1px solid var(--tp-rule); }
.tp-list-item h2 { margin: 6px 0 10px; font-family: var(--tp-serif); font-weight: 700; font-size: 28px; line-height: 1.15; }
.tp-list-item p { margin: 0 0 10px; font-family: var(--tp-serif); font-size: 18px; line-height: 1.45; color: var(--tp-ink-2); }
.tp-pagination { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 56px; }
.tp-pagination .page-numbers { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; border: 1px solid #D5D5CC; border-radius: 3px; font-weight: 600; }
.tp-pagination .current { background: var(--tp-accent); color: #fff; border-color: var(--tp-accent); }
.tp-page { max-width: 760px; padding: 40px 0 64px; }
.tp-page h1 { font-family: var(--tp-serif); font-weight: 700; font-size: 44px; line-height: 1.1; margin: 0 0 24px; }
.tp-search { display: flex; gap: 8px; max-width: 520px; }
.tp-search input[type=search] { flex: 1; min-height: 46px; padding: 0 14px; border: 1px solid #C9C9BF; border-radius: 3px; font-size: 16px; font-family: inherit; }
.tp-search button { min-height: 46px; padding: 0 20px; border: 0; background: var(--tp-accent); color: #fff; border-radius: 3px; font-weight: 700; font-family: inherit; cursor: pointer; }

/* ---------- Comentarios ---------- */
.tp-comments { max-width: 680px; margin-top: 40px; }
.tp-comments .comment-list { list-style: none; padding: 0; }
.tp-comments textarea, .tp-comments input[type=text], .tp-comments input[type=email], .tp-comments input[type=url] { width: 100%; padding: 10px 12px; border: 1px solid #C9C9BF; border-radius: 3px; font: inherit; }
.tp-comments input[type=submit] { min-height: 46px; padding: 0 22px; border: 0; background: var(--tp-accent); color: #fff; border-radius: 3px; font-weight: 700; cursor: pointer; }

/* ---------- Adaptación a móvil ---------- */
@media (max-width: 960px) {
	.tp-art { grid-template-columns: minmax(0, 1fr); }
	.tp-rel { grid-template-columns: minmax(0, 1fr); }
	.tp-art-title { font-size: 36px; }
}
@media (max-width: 900px) {
	.tp-lead, .tp-cols { grid-template-columns: minmax(0, 1fr); }
	.tp-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tp-logo { font-size: 44px; }
	.tp-lead-title { font-size: 34px; }
	.tp-list-item { grid-template-columns: minmax(0, 1fr); }
	.tp-nav ul { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; gap: 0 24px; }
	.tp-nav li { flex: 0 0 auto; }
}
@media (max-width: 520px) {
	.tp-cards { grid-template-columns: minmax(0, 1fr); }
	.tp-logo { font-size: 38px; }
	.tp-archive-head h1 { font-size: 36px; }
}
