/*
Theme Name: Archimedes' Tub
Theme URI: https://www.archimedestub.com/
Author: Archimedes' Tub
Description: Tema de bloques propio de Archimedes' Tub. Rojo, negro y papel cuadriculado; vídeos que solo cargan YouTube al pulsar «play»; biblioteca de libros recomendados.
Version: 1.0.4
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: archimedes
*/

/* ---------- Base ---------- */
html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img { height: auto; }
:where(.wp-site-blocks) > * { margin-block-start: 0; }
:focus-visible { outline: 3px solid var(--wp--preset--color--rojo); outline-offset: 3px; }

/* Papel cuadriculado */
.is-style-papel,
.at-papel {
	background-color: var(--wp--preset--color--papel);
	background-image:
		linear-gradient(rgba(20,20,20,.055) 1px, transparent 1px),
		linear-gradient(90deg, rgba(20,20,20,.055) 1px, transparent 1px);
	background-size: 28px 28px;
}

/* Rotulador rojo (resaltado del titular) */
mark.at-rotulador,
.at-rotulador {
	background: var(--wp--preset--color--rojo);
	color: var(--wp--preset--color--blanco);
	padding: 0 .12em;
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
}

/* Antetítulo */
.at-antetitulo {
	font-family: var(--wp--preset--font-family--archivo);
	font-weight: 600;
	font-size: .875rem;
	letter-spacing: .12em;
	text-transform: uppercase;
}

/* ---------- Cabecera ---------- */
.at-cabecera { border-bottom: 2px solid var(--wp--preset--color--tinta); }
.at-cabecera .wp-block-site-logo img { border-radius: 50%; }
.at-cabecera .wp-block-navigation a:where(:not(.wp-element-button)) { text-decoration: none; font-weight: 600; padding-block: .6em; }
.at-cabecera .wp-block-navigation a:where(:not(.wp-element-button)):hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; text-decoration-color: var(--wp--preset--color--rojo); }
.at-cabecera .wp-block-navigation .current-menu-item > a { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; text-decoration-color: var(--wp--preset--color--rojo); }

/* ---------- Botones ---------- */
.wp-element-button, .wp-block-button__link {
	transition: transform .12s ease, box-shadow .12s ease;
}
.wp-element-button:hover, .wp-block-button__link:hover {
	transform: translate(-2px, -2px);
	box-shadow: 4px 4px 0 var(--wp--preset--color--tinta);
}
.is-style-outline > .wp-block-button__link {
	background: var(--wp--preset--color--blanco);
	color: var(--wp--preset--color--tinta);
	border: 2px solid var(--wp--preset--color--tinta);
}
.has-tinta-background-color .is-style-outline > .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--blanco);
	border-color: var(--wp--preset--color--blanco);
}
.has-tinta-background-color .wp-element-button:hover,
.has-tinta-background-color .wp-block-button__link:hover { box-shadow: 4px 4px 0 var(--wp--preset--color--blanco); }

/* ---------- Tarjetas ---------- */
.at-tarjeta { position: relative; height: 100%; }
.at-tarjeta .wp-block-post-featured-image,
.at-tarjeta .at-miniatura {
	border: 2px solid var(--wp--preset--color--tinta);
	border-radius: 14px;
	overflow: hidden;
	transition: transform .15s ease, box-shadow .15s ease;
	background: var(--wp--preset--color--tinta);
}
.at-tarjeta:hover .wp-block-post-featured-image,
.at-tarjeta:hover .at-miniatura { transform: translateY(-3px); box-shadow: 6px 6px 0 var(--wp--preset--color--rojo); }
.at-tarjeta .wp-block-post-featured-image img,
.at-tarjeta .at-miniatura img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; display: block; }
.at-tarjeta .wp-block-post-title a { text-decoration: none; }
.at-tarjeta .wp-block-post-title a:hover { text-decoration: underline; text-decoration-color: var(--wp--preset--color--rojo); text-decoration-thickness: 3px; }
/* Toda la tarjeta es clicable a través del título */
.at-tarjeta .wp-block-post-title a::after { content: ""; position: absolute; inset: 0; }

.at-marco {
	border: 2px solid var(--wp--preset--color--tinta);
	border-radius: 18px;
	background: var(--wp--preset--color--blanco);
}
.at-sombra-roja { box-shadow: 10px 10px 0 var(--wp--preset--color--rojo); }
.at-sombra-tinta { box-shadow: 10px 10px 0 var(--wp--preset--color--tinta); }

/* Cursos (sección oscura) */
.at-curso {
	border: 2px solid var(--wp--preset--color--blanco);
	border-radius: 18px;
	transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
	position: relative;
}
.at-curso:hover { transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--wp--preset--color--rojo); }
.at-curso a { color: inherit; text-decoration: none; }
.at-curso a::after { content: ""; position: absolute; inset: 0; }
.at-curso .at-simbolo { font-family: var(--wp--preset--font-family--newsreader); font-style: italic; color: var(--wp--preset--color--rojo-claro); line-height: 1; }

/* ---------- Vídeo de YouTube que solo carga al pulsar ---------- */
.at-video { margin-block: var(--wp--preset--spacing--40); }
.at-video__boton {
	position: relative; display: block; width: 100%; padding: 0; border: 2px solid var(--wp--preset--color--tinta);
	border-radius: 14px; overflow: hidden; cursor: pointer; background: var(--wp--preset--color--tinta);
	aspect-ratio: 16 / 9;
}
.at-video__boton img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .92; transition: opacity .15s ease, transform .3s ease; }
.at-video__boton:hover img { opacity: 1; transform: scale(1.02); }
.at-video__play {
	position: absolute; inset: 0; margin: auto; width: 84px; height: 84px; border-radius: 50%;
	background: var(--wp--preset--color--rojo); box-shadow: 0 6px 24px rgba(0,0,0,.35);
	display: grid; place-items: center; transition: transform .15s ease;
}
.at-video__play::before { content: ""; margin-left: 6px; border-style: solid; border-width: 15px 0 15px 25px; border-color: transparent transparent transparent #fff; }
.at-video__boton:hover .at-video__play { transform: scale(1.08); }
.at-video__titulo {
	position: absolute; left: 0; right: 0; bottom: 0; padding: 2.5rem 1rem .9rem; text-align: left;
	background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff;
	font-family: var(--wp--preset--font-family--archivo); font-weight: 700; font-size: 1rem;
}
.at-video__aviso { font-size: .8125rem; color: var(--wp--preset--color--gris); margin: .5rem 0 0; font-family: var(--wp--preset--font-family--archivo); }
.at-video iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 2px solid var(--wp--preset--color--tinta); border-radius: 14px; display: block; }

/* Últimos vídeos del canal */
.at-yt { display: grid; gap: var(--wp--preset--spacing--50); grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.at-yt--destacado { grid-template-columns: 1fr; }
@media (min-width: 900px) {
	.at-yt--destacado { grid-template-columns: 1.6fr 1fr; grid-template-rows: auto auto; }
	.at-yt--destacado > :first-child { grid-row: span 2; }
	.at-yt--destacado > :first-child .at-yt__titulo { font-size: clamp(1.4rem, 2.2vw, 2rem); }
}
.at-yt__item { display: flex; flex-direction: column; gap: .7rem; }
.at-yt__titulo { font-family: var(--wp--preset--font-family--archivo); font-weight: 800; font-size: 1.2rem; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
.at-yt__titulo a { color: inherit; text-decoration: none; }
.at-yt__titulo a:hover { text-decoration: underline; text-decoration-color: var(--wp--preset--color--rojo); text-decoration-thickness: 3px; }
.at-yt__meta { font-family: var(--wp--preset--font-family--archivo); font-size: .875rem; color: var(--wp--preset--color--gris); margin: 0; }
.at-yt__desc { margin: 0; font-size: 1.05rem; line-height: 1.5; color: var(--wp--preset--color--gris-oscuro); }
.at-yt .at-video { margin: 0; }

/* ---------- Libros ---------- */
.at-libro { position: relative; display: flex; flex-direction: column; gap: .6rem; height: 100%; }
.at-libro .wp-block-post-featured-image, .at-libro .at-portada {
	border: 2px solid var(--wp--preset--color--tinta); border-radius: 4px 12px 12px 4px; overflow: hidden; background: var(--wp--preset--color--blanco);
	transition: transform .15s ease, box-shadow .15s ease;
}
.at-libro:hover .wp-block-post-featured-image, .at-libro:hover .at-portada { transform: translateY(-3px) rotate(-1deg); box-shadow: 6px 6px 0 var(--wp--preset--color--rojo); }
.at-libro img { aspect-ratio: 2 / 3; object-fit: cover; width: 100%; display: block; }
.at-libro .wp-block-post-title a, .at-libro h3 a { text-decoration: none; color: inherit; }
.at-libro .wp-block-post-title a::after, .at-libro h3 a::after { content: ""; position: absolute; inset: 0; }
.at-estanterias { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 0; list-style: none; }
.at-estanterias a, .wp-block-post-terms.at-chips a {
	display: inline-flex; align-items: center; min-height: 40px; padding: 0 .9rem; border: 2px solid var(--wp--preset--color--tinta);
	border-radius: 999px; text-decoration: none; font-family: var(--wp--preset--font-family--archivo); font-weight: 600; font-size: .9rem;
	background: var(--wp--preset--color--blanco); color: var(--wp--preset--color--tinta);
}
.at-estanterias a:hover, .at-estanterias .is-actual a, .wp-block-post-terms.at-chips a:hover { background: var(--wp--preset--color--tinta); color: var(--wp--preset--color--blanco); }
.wp-block-post-terms.at-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.wp-block-post-terms.at-chips .wp-block-post-terms__separator { display: none; }
.at-comprar .wp-block-button__link::after { content: " ↗"; }
.at-afiliado { font-size: .875rem; color: var(--wp--preset--color--gris); font-family: var(--wp--preset--font-family--archivo); }

/* Enlace a reel de Instagram */
.at-reel {
	display: inline-flex; align-items: center; gap: .6rem; padding: .6rem 1rem; border: 2px solid var(--wp--preset--color--tinta);
	border-radius: 12px; text-decoration: none; font-family: var(--wp--preset--font-family--archivo); font-weight: 700; color: var(--wp--preset--color--tinta); background: var(--wp--preset--color--blanco);
}
.at-reel:hover { box-shadow: 4px 4px 0 var(--wp--preset--color--rojo); transform: translate(-2px,-2px); }

/* ---------- Contenido de entradas antiguas ---------- */
.wp-block-post-content :where(img) { border-radius: 10px; }
.wp-block-post-content .wp-caption { max-width: 100%; }
.wp-block-post-content .wp-caption-text { font-size: .9rem; color: var(--wp--preset--color--gris); font-family: var(--wp--preset--font-family--archivo); }
.wp-block-post-content a:where(:not(.wp-element-button)) { text-decoration-color: var(--wp--preset--color--rojo); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.at-vc-columna { margin-block: 0 1.2em; }

/* Paginación y comentarios */
.wp-block-query-pagination a, .wp-block-query-pagination .page-numbers {
	display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0 .6rem; border: 2px solid var(--wp--preset--color--tinta);
	border-radius: 999px; text-decoration: none; font-family: var(--wp--preset--font-family--archivo); font-weight: 700; background: var(--wp--preset--color--blanco);
}
.wp-block-query-pagination .page-numbers.current { background: var(--wp--preset--color--tinta); color: var(--wp--preset--color--blanco); }
.wp-block-comment-template { padding-left: 0; }
.wp-block-comment-template li { list-style: none; }
.wp-block-comments input[type="text"], .wp-block-comments input[type="email"], .wp-block-comments input[type="url"], .wp-block-comments textarea,
.wp-block-search__input {
	border: 2px solid var(--wp--preset--color--tinta); border-radius: 10px; padding: .7rem .9rem; font: inherit; background: var(--wp--preset--color--blanco);
}

/* Pie */
.at-pie a { color: inherit; }
.at-pie .wp-block-social-links .wp-social-link { color: var(--wp--preset--color--blanco); }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* Imágenes redondeadas y avatares */
.at-imagen-redondeada { overflow: hidden; }
.at-imagen-redondeada img { display: block; width: 100%; }
.at-avatar img { width: 120px; height: 120px; object-fit: cover; border-radius: 50%; border: 2px solid var(--wp--preset--color--tinta); }

/* Ficha de libro */
.atb-ficha { display: flex; flex-direction: column; gap: 1rem; }
.atb-dato { margin: 0; }
.at-antetitulo a { color: inherit; text-decoration: none; }
.at-antetitulo a:hover { text-decoration: underline; }
.at-estanterias li span { opacity: .6; font-weight: 500; }
/* La lista de categorías de «Artículos» como chips */
.wp-block-categories.at-estanterias { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }

/* Robustez de las rejillas: nada puede desbordar */
.wp-block-post-template > li { min-width: 0; }
.at-tarjeta .wp-block-post-featured-image, .at-libro .wp-block-post-featured-image { width: 100%; }
.wp-block-post-featured-image img { max-width: 100%; }

/* Cabecera en móvil: logo, menú y botón en una sola línea */
@media (max-width: 640px) {
	.at-cabecera > .alignwide { flex-wrap: nowrap; }
	.at-cabecera .wp-block-site-title { font-size: 1.05rem; }
	.at-cabecera .wp-block-site-logo img { width: 40px; height: 40px; }
	.at-cabecera .wp-block-button__link { padding: .5rem .85rem !important; }
}
@media (max-width: 380px) {
	.at-cabecera .wp-block-site-title { display: none; }
}

.at-lista-limpia { list-style: none; padding-left: 0; font-family: var(--wp--preset--font-family--archivo); line-height: 2; }
@media (max-width: 640px) {
	.at-cabecera .alignwide > .wp-block-group { flex-wrap: nowrap; align-items: center; gap: .6rem; }
	.at-cabecera .wp-block-site-title { white-space: nowrap; }
	/* Libros: dos por fila en el móvil */
	.wp-block-post-template.is-layout-grid:has(.at-libro) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 1.25rem; }
}
.at-cabecera .wp-block-button__link { white-space: nowrap; }
@media (max-width: 640px) { .at-cabecera .wp-block-button__link { font-size: .85rem !important; } }

/* Póster interactivo sobre fondo oscuro */
.at-seccion-poster .atpo { margin-top: var(--wp--preset--spacing--50); }
.at-seccion-poster .atpo__ayuda, .at-seccion-poster .atpo__barra::after { color: var(--wp--preset--color--gris-claro); }
.at-seccion-poster .atpo__lienzo { border-color: var(--wp--preset--color--gris-oscuro); }
.at-seccion-poster .atpo__ficha { color: var(--wp--preset--color--tinta); }
.at-seccion-poster .atpo__ficha a:not(.atpo__boton) { color: var(--wp--preset--color--tinta); }
