/*
Theme Name: Iñaki Olaizola
Theme URI: https://www.inakiolaizola.com
Author: Bcomunicación
Description: Tema sin builder para inakiolaizola.com. Mantiene el diseño de la web y añade la lectura de las publicaciones (índice, notas al margen y ficha de cada obra). Necesita JetEngine (CPT publicaciones) y WPML.
Version: 1.0.0
Requires at least: 6.5
Requires PHP: 8.0
Text Domain: inakiolaizola
*/

/* ---------- Variables ---------- */

:root {
	--verde: #44cd69;
	--verde-oscuro: #2f9e4d;
	--gris: #54595f;
	--texto: #7a7a7a;
	--rojo: #f75959;
	--tinta: #333;
	--lectura: #1d1d1f;
	--menu: #1c244b;
	--tarjeta: #f0f0f0;
	--linea: #e2e2e2;
	--fondo: #fff;

	--sans: "Montserrat", system-ui, sans-serif;
	--menu-fuente: "Poppins", var(--sans);
	--serif: "Source Serif 4", Georgia, serif;

	--ancho: 1440px;
	--margen: max(2%, 16px);
	--alto-cabecera: 60px;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--alto-cabecera) + 24px); }

@media (prefers-reduced-motion: no-preference) {
	html { scroll-behavior: smooth; }
}

body {
	margin: 0;
	background: var(--fondo);
	color: var(--tinta);
	font-family: var(--sans);
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; height: auto; }

a { color: var(--verde); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5em; color: var(--tinta); font-family: var(--sans); line-height: 1.15; }
h3 { font-size: 18px; font-weight: 700; }

:focus-visible { outline: 2px solid var(--verde); outline-offset: 3px; }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

.saltar { position: absolute; left: -9999px; top: 8px; z-index: 200; padding: 8px 16px; background: var(--tinta); color: #fff; }
.saltar:focus { left: 8px; }

/* ---------- Botones ---------- */

.boton {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 22px;
	border: 2px solid var(--verde);
	border-radius: 99px;
	background: transparent;
	color: var(--verde);
	font: 700 14px/1.2 var(--sans);
	cursor: pointer;
	transition: background-color .2s, color .2s, border-color .2s;
}
.boton:hover { background: var(--verde); color: #fff; text-decoration: none; }

.boton--oscuro { border-color: var(--tinta); color: var(--tinta); }
.boton--oscuro:hover { background: var(--tinta); border-color: var(--tinta); }

.boton--negro { border-color: #000; background: #000; color: #fff; font-weight: 500; }
.boton--negro:hover { background: var(--tinta); border-color: var(--tinta); }
.boton svg { width: 14px; height: 14px; }

.etiqueta {
	display: inline-block;
	color: var(--rojo);
	font: 700 12px/1.3 var(--sans);
	letter-spacing: .7px;
	text-transform: uppercase;
}

.fecha { margin: 4px 0 0; color: #747474; font-size: 12px; font-weight: 700; }

/* ---------- Cabecera ---------- */

.cabecera {
	position: sticky;
	top: 0;
	z-index: 95;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	min-height: var(--alto-cabecera);
	padding: 0 var(--margen);
	background: #fff;
}
.admin-bar .cabecera { top: 32px; }

.cabecera__marca { display: flex; align-items: center; gap: 18px; min-width: 0; }

.cabecera__nombre {
	color: var(--tinta);
	font-size: clamp(1.2rem, 3vw, 2.5rem);
	font-weight: 600;
	letter-spacing: -.01em;
	white-space: nowrap;
}
.cabecera__nombre:hover { text-decoration: none; }

.idiomas { display: flex; gap: 16px; }
.idiomas a { color: var(--gris); font-size: 14px; font-weight: 700; }
.idiomas a:hover, .idiomas a[aria-current] { color: #bdbdbd; text-decoration: none; }

.cabecera__menu .menu { display: flex; gap: 30px; margin: 0; padding: 0; list-style: none; }
.cabecera__menu a { display: block; padding: 5px 0; color: var(--menu); font: 400 16px/1 var(--menu-fuente); }
.cabecera__menu a:hover,
.cabecera__menu .current-menu-item > a,
.cabecera__menu .current-menu-ancestor > a { color: var(--verde); text-decoration: none; }

.cabecera__boton { display: none; padding: 8px; border: 0; background: none; color: var(--gris); cursor: pointer; }
.cabecera__boton svg { width: 22px; height: 22px; }

@media (max-width: 1024px) {
	.cabecera { padding: 0 5%; }
	.cabecera__menu a { font-size: 14px; }
}

@media (max-width: 860px) {
	:root { --alto-cabecera: 50px; }
	.cabecera__boton { display: block; }
	.cabecera__menu {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		display: none;
		background: #f3f5f8;
	}
	.cabecera__menu.abierto { display: block; }
	.cabecera__menu .menu { flex-direction: column; gap: 0; }
	.cabecera__menu a { padding: 14px 5%; font-size: 16px; }
	.cabecera__menu a:hover { background: #f9fafd; }
}

@media (max-width: 782px) {
	.admin-bar .cabecera { top: 46px; }
}

/* ---------- Pie ---------- */

.pie {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 54px;
	padding: 12px var(--margen);
	background: var(--gris);
	color: #fff;
	text-align: center;
}
.pie p { margin: 0; }

/* ---------- Portada: banda de palabras ---------- */

.palabras { overflow: hidden; background: var(--verde); }

.palabras__fila { overflow: hidden; white-space: nowrap; }

.palabras__pista { display: inline-flex; animation: palabras 400s linear infinite; }
.palabras__fila--inversa .palabras__pista { animation-direction: reverse; }

.palabras__pista span {
	color: rgba(255, 255, 255, .25);
	font-size: 9vh;
	font-weight: 900;
	line-height: .95;
	letter-spacing: -.01em;
}

@keyframes palabras {
	from { transform: translateX(0); }
	to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
	.palabras__pista { animation: none; }
}

@media (max-width: 767px) {
	.palabras__pista span { font-size: 6vh; }
}

/* ---------- Listados ---------- */

.listado { max-width: var(--ancho); margin: 3% auto; padding: 2% var(--margen); }

.listado__cabecera { margin-bottom: 32px; }
.listado__cabecera h1 { font-size: clamp(2rem, 4vw, 3.5rem); font-weight: 700; }
.listado__descripcion { max-width: 70ch; color: var(--texto); }

.rejilla {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(325px, 100%), 1fr));
	gap: 20px;
}

.tarjeta {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 24px;
	min-height: 230px;
	padding: clamp(16px, 5%, 24px);
	background: var(--tarjeta);
}

.tarjeta__titulo { margin: 6px 0 0; font-size: 18px; line-height: 1.1; }
.tarjeta__titulo a { color: var(--tinta); }
.tarjeta__titulo a:hover { color: var(--verde-oscuro); text-decoration: none; }

.tarjeta__acciones { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

/* ---------- Páginas (Sobre mí) ---------- */

.portadilla {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 50vh;
	padding: 48px var(--margen);
	background: #000 var(--fondo, none) top left / cover no-repeat;
	text-align: center;
}
.portadilla::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .62); }
.portadilla h1 { position: relative; margin: 0; color: #fff; font-size: clamp(3rem, 7vw, 7.5rem); font-weight: 700; }

.pagina { max-width: 900px; margin: 0 auto; padding: 100px var(--margen); }

.texto { color: var(--tinta); font-size: 1.0625rem; line-height: 1.75; }
.texto p { margin: 0 0 1.2em; }
.texto a { font-size: inherit; font-weight: 600; }

.no-encontrada { text-align: center; }

/* ---------- Publicación ---------- */

.obra {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 0 56px;
	max-width: var(--ancho);
	margin: 0 auto;
	padding: 28px var(--margen) 96px;
}

.migas { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 40px; color: #6b6b6b; font-size: 13px; }
.migas a { color: var(--tinta); font-size: 13px; font-weight: 500; }
.migas [aria-current] { overflow: hidden; max-width: 50ch; text-overflow: ellipsis; white-space: nowrap; }

.obra__cuerpo { min-width: 0; }

.obra__barra { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 40px; }
.obra__fecha { margin: 0; color: #6b6b6b; font-size: 13px; }

.obra__titulo { margin: 10px 0 12px; font-size: clamp(2rem, 4.2vw, 3.25rem); font-weight: 600; line-height: 1.1; letter-spacing: -.015em; }
.obra__autor { margin: 0 0 40px; color: var(--texto); font-weight: 600; }

/* Ficha */

.ficha { display: grid; gap: 32px; padding: 28px 0; border-top: 1px solid var(--linea); border-bottom: 1px solid var(--linea); }
.ficha__resumen { font-family: var(--serif); font-size: 1.125rem; line-height: 1.6; color: var(--lectura); }
.ficha__resumen p { margin: 0 0 1em; }

.ficha dl { display: grid; gap: 14px; margin: 0; }
.ficha dl > div { display: grid; grid-template-columns: 160px 1fr; gap: 16px; }
.ficha dt { color: #6b6b6b; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.ficha dd { margin: 0; font-size: 15px; }
.cita { margin: 0 0 8px; font-family: var(--serif); font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.copiar { padding: 0; border: 0; background: none; color: var(--verde-oscuro); font: 600 13px var(--sans); cursor: pointer; }
.copiar:hover { text-decoration: underline; }

.ficha__portada { display: block; justify-self: start; max-width: 360px; border: 1px solid #ccc; }
.ficha__portada img { width: 100%; }

.obra--ficha .ficha { grid-template-columns: minmax(0, 1fr); }

@media (min-width: 900px) {
	.obra--ficha .ficha:has(.ficha__portada) { grid-template-columns: minmax(0, 1fr) minmax(240px, 360px); }
	.obra--ficha .ficha__portada { grid-column: 2; grid-row: 1; justify-self: end; }
}

@media (max-width: 600px) {
	.ficha dl > div { grid-template-columns: 1fr; gap: 2px; }
}

/* Índice */

.indice { font-size: 13px; }
.indice summary {
	padding: 12px 0;
	color: var(--tinta);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .5px;
	cursor: pointer;
}
.indice ol { margin: 0; padding: 0; list-style: none; }
.indice li { margin: 0; }
.indice a { display: block; padding: 6px 0; color: #6b6b6b; font-size: 13px; font-weight: 500; line-height: 1.35; }
.indice a:hover { color: var(--tinta); text-decoration: none; }
.indice a[aria-current] { color: #000; font-weight: 700; }
.indice__nivel-3 a { padding-left: 16px; }

/* Texto de lectura */

.prosa {
	max-width: 68ch;
	margin-top: 48px;
	color: var(--lectura);
	font-family: var(--serif);
	font-size: 1.1875rem;
	font-optical-sizing: auto;
	line-height: 1.65;
	hyphens: auto;
	hanging-punctuation: first;
}
.prosa p { margin: 0 0 1.1em; }
.prosa a { color: inherit; font-size: inherit; font-weight: inherit; text-decoration: underline; text-decoration-color: #bbb; text-underline-offset: 3px; }
.prosa a:hover { text-decoration-color: currentColor; }

.prosa h2, .prosa h3, .prosa h4 { position: relative; font-family: var(--sans); color: #000; hyphens: manual; }
.prosa h2 { margin: 2.6em 0 .8em; font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 600; letter-spacing: -.01em; }
.prosa h3 { margin: 2em 0 .6em; font-size: 1.3rem; font-weight: 600; }
.prosa h4 { margin: 1.6em 0 .5em; font-size: 1.05rem; font-weight: 700; }
.prosa h2 strong, .prosa h3 strong { font-weight: inherit; }

.ancla { position: absolute; right: calc(100% + 8px); top: .15em; opacity: 0; color: #999; transition: opacity .15s; }
.ancla svg { width: 18px; height: 18px; }
.prosa h2:hover .ancla, .prosa h3:hover .ancla, .ancla:focus-visible { opacity: 1; }

.prosa blockquote { margin: 1.5em 0; padding-left: 1.2em; border-left: 3px solid var(--verde); font-style: italic; }
.prosa ul, .prosa ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.prosa li { margin-bottom: .35em; }
.prosa figure { margin: 2em 0; }
.prosa figcaption { margin-top: 8px; color: #6b6b6b; font-family: var(--sans); font-size: 13px; }
.prosa table { width: 100%; margin: 1.5em 0; border-collapse: collapse; font-family: var(--sans); font-size: 14px; }
.prosa th, .prosa td { padding: 8px 10px; border-bottom: 1px solid var(--linea); text-align: left; vertical-align: top; }
.prosa hr { margin: 3em 0; border: 0; border-top: 1px solid var(--linea); }

.prosa sup { line-height: 0; }
.prosa .nota-ref a { padding: 0 2px; color: var(--verde-oscuro); font-family: var(--sans); font-size: .7em; font-weight: 700; text-decoration: none; }

.notas { margin-top: 4em; padding-top: 1.5em; border-top: 1px solid var(--linea); color: #444; font-size: .85rem; line-height: 1.55; }
.notas ol { padding-left: 1.6em; }
.notas li:target { background: #f2fbf4; }
.notas .volver { margin-left: 4px; text-decoration: none; }

/* Notas al margen */

.margen { position: relative; display: none; }
.nota-margen { position: absolute; left: 0; right: 0; color: #555; font-family: var(--serif); font-size: 13px; line-height: 1.45; }
.nota-margen p { margin: 0 0 .5em; }
.nota-margen__numero { margin-right: 6px; color: var(--verde-oscuro); font-family: var(--sans); font-size: 11px; font-weight: 700; }

/* Anterior / siguiente */

.vecinas { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 72px; padding-top: 28px; border-top: 1px solid var(--linea); }
.vecinas a { display: block; color: var(--tinta); font-size: 15px; font-weight: 600; line-height: 1.3; }
.vecinas a:hover { color: var(--verde-oscuro); text-decoration: none; }
.vecinas span { display: block; margin-bottom: 6px; color: #6b6b6b; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.vecinas__siguiente { grid-column: 2; text-align: right; }

/* Rejilla de lectura */

@media (max-width: 1099px) {
	.obra--lectura .indice { order: 2; margin-bottom: 8px; border-bottom: 1px solid var(--linea); }
	.obra--lectura .obra__cuerpo { order: 3; }
}

@media (min-width: 1100px) {
	.obra--lectura { grid-template-columns: 230px minmax(0, 1fr); }
	.obra--lectura .indice { grid-column: 1; grid-row: 2; }
	.obra--lectura .indice__plegable { position: sticky; top: calc(var(--alto-cabecera) + 24px); max-height: calc(100vh - var(--alto-cabecera) - 48px); overflow-y: auto; }
	.obra--lectura .indice summary { pointer-events: none; list-style: none; }
	.obra--lectura .indice summary::-webkit-details-marker { display: none; }
	.obra--lectura .obra__cuerpo { grid-column: 2; grid-row: 2; }
	.obra--ficha .obra__cuerpo { max-width: 1000px; }
}

@media (min-width: 1280px) {
	.obra--lectura { grid-template-columns: 230px minmax(0, 720px) 220px; justify-content: space-between; }
	.obra--lectura .margen { display: block; grid-column: 3; grid-row: 2; }
	.con-margen .notas { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); }
}

/* ---------- Impresión ---------- */

@media print {
	.cabecera, .pie, .indice, .margen, .migas, .vecinas, .obra__barra .boton, .copiar { display: none !important; }
	.obra { display: block; padding: 0; }
	.prosa { max-width: none; font-size: 11pt; }
	.con-margen .notas { position: static !important; width: auto; height: auto; clip: auto; }
}
