/*
Theme Name: Código Civil
Theme URI: https://codigo-civil.es/
Author: Juan Antonio García García
Author URI: https://codigo-civil.es/
Description: Tema de bloques (FSE) para el Boletín de Actualidad de Derecho Civil. Estilo "Códice": minimalista y muy legible, con paleta salvia/ocre sobre hueso y tipografías Newsreader + Inter. Incluye variaciones de estilo conmutables (Noche/oscuro, Toga, Carmesí). Portada agrupada por categorías y página de entrada cuidada para textos jurídicos.
Requires at least: 6.6
Tested up to: 7.0
Requires PHP: 7.4
Version: 1.2.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: codigo-civil
Tags: blog, news, one-column, two-columns, custom-colors, custom-menu, editor-style, featured-images, full-site-editing, block-patterns, rtl-language-support, threaded-comments, translation-ready
*/

/* ==========================================================================
   Código Civil — refinamientos sobre theme.json
   La mayor parte del estilo vive en theme.json; aquí solo lo que las
   capacidades de bloques no cubren bien (hover, grid responsivo, pills…).
   ========================================================================== */

:root {
	--cc-shadow: 0 1px 2px rgba(35, 40, 42, 0.03), 0 6px 20px rgba(35, 40, 42, 0.05);
	--cc-shadow-hover: 0 2px 4px rgba(35, 40, 42, 0.05), 0 16px 38px rgba(60, 90, 83, 0.14);
}

body {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* --- Site title / tagline en cabecera --- */
.wp-block-site-title a { text-decoration: none; }
.wp-block-site-title a:hover { text-decoration: none; opacity: 0.92; }

/* --- Navegación: subrayado animado --- */
.wp-block-navigation .wp-block-navigation-item__content {
	position: relative;
	padding-bottom: 2px;
}
.wp-block-navigation:not(.has-modal-open) .wp-block-navigation-item__content::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -2px;
	width: 0;
	height: 2px;
	background: currentColor;
	opacity: 0.85;
	transition: width 0.22s ease;
}
.wp-block-navigation .wp-block-navigation-item__content:hover::after,
.wp-block-navigation .current-menu-item .wp-block-navigation-item__content::after {
	width: 100%;
}

/* --- Buscador de la cabecera --- */
.wp-block-search__inside-wrapper { box-shadow: var(--cc-shadow); }
.wp-block-search__input {
	border: 0 !important;
	padding-left: 1rem;
	font-family: var(--wp--preset--font-family--sans);
}
.wp-block-search .wp-block-search__button {
	margin: 4px;
	border-radius: 0.4rem;
	font-family: var(--wp--preset--font-family--sans);
	font-weight: 700;
	letter-spacing: 0.01em;
	transition: background-color 0.18s ease;
}

/* --- Etiquetas de categoría tipo "pill" (className cc-terms) --- */
.wp-block-post-terms.cc-terms {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	line-height: 1;
}
.wp-block-post-terms.cc-terms a {
	display: inline-block;
	text-decoration: none;
	background: var(--wp--preset--color--accent);
	color: #fff;
	padding: 0.32em 0.7em;
	border-radius: 0.3rem;
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	transition: background-color 0.18s ease, transform 0.18s ease;
}
.wp-block-post-terms.cc-terms a:hover {
	background: var(--wp--preset--color--accent-dark);
	transform: translateY(-1px);
}

/* --- Tarjetas de entrada --- */
.wp-block-query .wp-block-post-template > li > .wp-block-group {
	overflow: hidden;
	box-shadow: var(--cc-shadow);
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
	height: 100%;
}
.wp-block-query .wp-block-post-template > li > .wp-block-group:hover {
	transform: translateY(-3px);
	box-shadow: var(--cc-shadow-hover);
	border-color: var(--wp--preset--color--primary) !important;
}
.wp-block-query .wp-block-post-template > li {
	display: flex;
}
.wp-block-post-featured-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}
.wp-block-query .wp-block-post-template > li > .wp-block-group:hover .wp-block-post-featured-image img {
	transform: scale(1.04);
}
.wp-block-post-title a { text-decoration: none; }
.wp-block-post-title a:hover { color: var(--wp--preset--color--primary-dark); text-decoration: none; }

/* --- Grid de tarjetas responsivo (sobrescribe el repeat fijo) --- */
.wp-block-post-template.is-layout-grid {
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
}

/* --- Tipografía de lectura en el artículo --- */
.wp-block-post-content { font-size: 1.0625rem; line-height: 1.78; }
.wp-block-post-content > * { margin-block: 1.2em; }
.wp-block-post-content h2 { margin-top: 1.9em; }
.wp-block-post-content h3 { margin-top: 1.5em; }
.wp-block-post-content a { text-underline-offset: 2px; }
.wp-block-post-content blockquote {
	background: rgba(60, 90, 83, 0.06);
	border-radius: 0 0.4rem 0.4rem 0;
	padding: 1rem 1.25rem;
}

/* --- Imagen destacada del artículo --- */
.single .wp-block-post-featured-image { box-shadow: var(--cc-shadow); }

/* --- Etiquetas (post_tag) al pie del artículo --- */
.single .wp-block-post-terms a {
	text-decoration: none;
	color: var(--wp--preset--color--contrast-2);
	border: 1px solid var(--wp--preset--color--border);
	padding: 0.2em 0.6em;
	border-radius: 1rem;
	font-family: var(--wp--preset--font-family--sans);
	margin-right: 0.3rem;
	transition: border-color 0.18s ease, color 0.18s ease;
}
.single .wp-block-post-terms a:hover {
	color: var(--wp--preset--color--primary);
	border-color: var(--wp--preset--color--primary);
}

/* --- Paginación --- */
.wp-block-query-pagination a,
.wp-block-query-pagination .wp-block-query-pagination-numbers .page-numbers {
	text-decoration: none;
	color: var(--wp--preset--color--contrast);
	padding: 0.4em 0.7em;
	border-radius: 0.35rem;
	transition: background-color 0.18s ease, color 0.18s ease;
}
.wp-block-query-pagination a:hover { background: rgba(60, 90, 83, 0.12); }
.wp-block-query-pagination .page-numbers.current {
	background: var(--wp--preset--color--primary);
	color: #fff;
}

/* --- Footer: enlaces y listas --- */
footer.wp-block-group a { color: #E7E2DC; text-decoration: none; }
footer.wp-block-group a:hover { color: #fff; text-decoration: underline; }
footer.wp-block-group .wp-block-categories { list-style: none; margin: 0; padding: 0; }

/* --- Navegación entre entradas --- */
.wp-block-post-navigation-link a { text-decoration: none; font-family: var(--wp--preset--font-family--sans); }
.wp-block-post-navigation-link a:hover { color: var(--wp--preset--color--primary); }

@media (max-width: 600px) {
	.wp-block-post-navigation-link { width: 100%; }
}

/* --- Variaciones de bloque registradas --- */
.wp-block-group.is-style-cc-card {
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 0.65rem;
	padding: var(--wp--preset--spacing--40);
	box-shadow: var(--cc-shadow);
}
.wp-block-separator.is-style-cc-dotted {
	border: 0;
	border-top: 2px dotted var(--wp--preset--color--border);
	background: none;
	max-width: 100%;
}

/* --- Enlace "Ver todo" de las secciones de portada --- */
.cc-verlink { margin: 0; }
.cc-verlink a {
	color: var(--wp--preset--color--primary);
	text-decoration: none;
	white-space: nowrap;
	font-size: 0.8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}
.cc-verlink a:hover { color: var(--wp--preset--color--primary-dark); text-decoration: underline; }

/* =====================================================================
   ENTRADA INDIVIDUAL — lectura cómoda y bonita
   ===================================================================== */

/* Entradilla / lead bajo el título */
.cc-lead {
	font-family: var(--wp--preset--font-family--serif);
	max-width: 40rem;
}

/* Imagen destacada del artículo */
.single .wp-block-post-featured-image {
	margin-top: 0.5rem;
	box-shadow: var(--cc-shadow);
}
.single .wp-block-post-featured-image img { width: 100%; }

/* Columna de lectura: ritmo y tamaño cómodos */
.cc-article {
	font-size: 1.09rem;
	line-height: 1.8;
	color: #26282E;
}
.cc-article > * { margin-block: 1.35em; }
.cc-article > p:first-of-type { margin-top: 0.6em; }

/* Capitular (letra capital) en el primer párrafo */
.cc-article > p:first-of-type::first-letter {
	float: left;
	font-family: var(--wp--preset--font-family--serif);
	font-weight: 600;
	font-size: 3.6em;
	line-height: 0.74;
	padding: 0.04em 0.1em 0 0;
	color: var(--wp--preset--color--primary);
}

/* Encabezados dentro del artículo */
.cc-article h2 { font-size: 1.55rem; margin-top: 1.9em; line-height: 1.25; }
.cc-article h3 { font-size: 1.25rem; margin-top: 1.5em; line-height: 1.3; }
.cc-article h2 + p, .cc-article h3 + p { margin-top: 0.6em; }

/* Enlaces del cuerpo */
.cc-article a { text-underline-offset: 2px; text-decoration-thickness: 1px; }

/* Citas destacadas */
.cc-article blockquote {
	background: rgba(60, 90, 83, 0.06);
	border-left: 3px solid var(--wp--preset--color--primary);
	border-radius: 0 0.4rem 0.4rem 0;
	padding: 1rem 1.4rem;
	font-style: italic;
}
.cc-article blockquote p { margin: 0.3em 0; }

/* Listas con buen sangrado */
.cc-article ul, .cc-article ol { padding-left: 1.4em; }
.cc-article li { margin-block: 0.4em; }

/* Imágenes e incrustaciones dentro del texto */
.cc-article img { border-radius: 0.5rem; }
.cc-article figcaption { text-align: center; }

/* Primer salto de párrafo tras la capitular: evita solaparse en móvil */
@media (max-width: 480px) {
	.cc-article > p:first-of-type::first-letter { font-size: 3em; }
}

/* --- Secciones de portada en banda: respiración del título --- */
.has-band-background-color .wp-block-query { margin-top: 1.5rem; }
