/*
Theme Name:   Biblioteca Comunale Taurianova
Description:  Tema child di Twenty Twenty-Five per il sito della Biblioteca Comunale di Taurianova.
Template:     twentytwentyfive
Version:      2.20.0
Requires at least: 7.0
Requires PHP: 7.2
License:      GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  bct-2025
*/

/* ---------------------------------------------------------------------------
 * Header sticky
 *
 * La posizione sticky va sull'elemento <header> della template part: un
 * gruppo sticky dentro di lui resterebbe confinato alla sua altezza.
 * Con la barra di amministrazione, che sotto i 600px non e' fissa, l'header
 * si aggancia sotto di lei solo dove la barra resta visibile.
 * ------------------------------------------------------------------------ */

header.wp-block-template-part {
	position: sticky;
	top: 0;
	z-index: 100;
}

@media (min-width: 601px) {
	.admin-bar header.wp-block-template-part {
		top: var(--wp-admin--admin-bar--height, 0px);
	}
}

.bct-header {
	border-bottom: 1px solid var(--wp--preset--color--accent-6);
}

.bct-header .wp-block-navigation-item__content {
	padding-block: 0.25em;
	border-bottom: 2px solid transparent;
}

.bct-header .wp-block-navigation-item__content:hover,
.bct-header .wp-block-navigation-item__content:focus-visible,
.bct-header .current-menu-item > .wp-block-navigation-item__content {
	border-bottom-color: var(--wp--preset--color--accent-1);
}

/* Le ancore del menu atterrano sotto l'header sticky, non dietro. */
html {
	scroll-padding-top: 6rem;
}

/* ---------------------------------------------------------------------------
 * Menu mobile (overlay di navigazione)
 * ------------------------------------------------------------------------ */

/* Con un overlay personalizzato il core non colora il contenitore: senza
 * sfondo la pagina si vedrebbe sotto il menu. */
.wp-block-navigation__responsive-container.is-menu-open {
	background-color: var(--wp--preset--color--base);
}

/* La barra di amministrazione copre la parte alta dell'overlay. */
.admin-bar .wp-block-navigation__responsive-container.is-menu-open {
	padding-top: var(--wp-admin--admin-bar--height, 0px);
}

.bct-overlay__menu {
	font-size: clamp(1.5rem, 6vw, 2rem);
}

.bct-overlay .wp-block-navigation-overlay-close {
	padding: 0.5rem;
	background: none;
	border: 0;
	color: var(--wp--preset--color--contrast);
	cursor: pointer;
}

.bct-overlay .wp-block-navigation-overlay-close:hover,
.bct-overlay .wp-block-navigation-overlay-close:focus-visible {
	color: var(--wp--preset--color--accent-2);
}

.bct-overlay__menu .wp-block-navigation-item__content:hover,
.bct-overlay__menu .wp-block-navigation-item__content:focus-visible {
	color: var(--wp--preset--color--accent-2);
}

/* Il menu mobile usa lo stesso menu dell'header: i sottomenu restano sempre
 * aperti, rientrati sotto la voce, invece di aprirsi a tendina. */
.bct-overlay__menu.wp-block-navigation .has-child {
	flex-direction: column;
	align-items: flex-start;
}

.bct-overlay__menu.wp-block-navigation .has-child .wp-block-navigation__submenu-container {
	position: static;
	z-index: auto;
	width: auto;
	min-width: 0;
	height: auto;
	overflow: visible;
	opacity: 1;
	visibility: visible;
	gap: 0.35em;
	padding: 0.4em 0 0 1rem;
	border: 0;
	background: transparent;
	box-shadow: none;
	font-size: 0.62em;
	font-weight: 600;
	letter-spacing: 0;
}

/* Il sottomenu dentro un sottomenu non rimpicciolisce ancora. */
.bct-overlay__menu.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container {
	font-size: 1em;
}

.bct-overlay__menu.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 0;
}

.bct-overlay__menu.wp-block-navigation .wp-block-navigation__submenu-icon {
	display: none;
}

/* ---------------------------------------------------------------------------
 * Tipografia ricorrente
 * ------------------------------------------------------------------------ */

.bct-eyebrow,
.bct-eyebrow a {
	margin: 0;
	color: var(--wp--preset--color--accent-2);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-decoration: none;
}

.bct-red {
	color: var(--wp--preset--color--accent-1);
}

.bct-hero__title {
	max-width: 14ch;
	line-height: 1.05;
}

/* La barretta rossa sopra i titoli di sezione richiama il dorso del libro
 * del logo. */
.bct-section-title {
	margin: 0;
}

.bct-section-title::before,
.bct-page-title::before {
	content: "";
	display: block;
	width: 3rem;
	height: 0.3rem;
	margin-bottom: 0.75rem;
	background: var(--wp--preset--color--accent-1);
}

.bct-more,
.bct-back {
	margin: 0;
	font-weight: 700;
}

.bct-more a,
.bct-back a {
	text-decoration: none;
}

.bct-more a::after {
	content: " →";
}

.bct-back a::before {
	content: "← ";
}

/* ---------------------------------------------------------------------------
 * Card dei loop
 * ------------------------------------------------------------------------ */

.bct-card {
	height: 100%;
	border-radius: 4px;
}

.bct-card .wp-block-post-title {
	margin: 0;
}

.bct-card .wp-block-post-featured-image {
	margin: 0;
	overflow: hidden;
	border-radius: 4px;
}

.bct-card--bordered {
	padding: var(--wp--preset--spacing--40);
	border: 1px solid var(--wp--preset--color--accent-6);
}

.bct-card__meta,
.bct-card__meta a {
	margin: 0;
	color: var(--wp--preset--color--accent-4);
	text-decoration: none;
}

/* ---------------------------------------------------------------------------
 * Scheda del libro (blocco bcc/book-content del plugin)
 *
 * Il plugin stampa un div per ogni campo, con dentro <label> e valore.
 * Qui diventano una griglia etichetta / valore.
 * ------------------------------------------------------------------------ */

.bct-book-meta > div {
	display: grid;
	gap: 0;
	border-top: 1px solid var(--wp--preset--color--accent-6);
}

.bct-book-meta > div > div:not(:first-child) {
	display: grid;
	grid-template-columns: minmax(9rem, 1fr) 2fr;
	gap: var(--wp--preset--spacing--30);
	padding-block: 0.75rem;
	border-bottom: 1px solid var(--wp--preset--color--accent-6);
}

.wp-block-bcc-book-content.bct-book-meta label {
	color: var(--wp--preset--color--accent-4);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
}

.wp-block-bcc-book-content.bct-book-meta .book-polo {
	display: inline-block;
	margin: 0 0 var(--wp--preset--spacing--30);
	padding: 0.3rem 0.7rem;
	background: var(--wp--preset--color--accent-3);
	border-radius: 4px;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
}

@media (max-width: 600px) {
	.bct-book-meta > div > div:not(:first-child) {
		grid-template-columns: 1fr;
		gap: 0.15rem;
	}
}

/* ---------------------------------------------------------------------------
 * Footer
 * ------------------------------------------------------------------------ */

.bct-footer__accent {
	color: var(--wp--preset--color--accent-1);
}

.bct-footer__contacts {
	margin-block: 0 var(--wp--preset--spacing--30);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.6;
}

/* L'email e' lunga: su schermi stretti va a capo invece di uscire dal footer. */
.bct-footer__contacts a {
	overflow-wrap: anywhere;
}


/* ---------------------------------------------------------------------------
 * Ombre e movimento
 *
 * Due livelli d'ombra, a riposo e al passaggio del mouse, usati da tutte le
 * card. La curva di animazione e' la stessa ovunque, cosi' il sito si muove
 * in modo coerente.
 * ------------------------------------------------------------------------ */

:root {
	--bct-shadow: 0 1px 2px rgb(31 23 23 / 0.06), 0 4px 14px rgb(31 23 23 / 0.07);
	--bct-shadow-hover: 0 2px 4px rgb(31 23 23 / 0.06), 0 14px 32px rgb(31 23 23 / 0.13);
	--bct-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	--bct-radius: 8px;
}

/* ---------------------------------------------------------------------------
 * Card degli eventi: locandina a sinistra, data, titolo ed estratto a destra
 *
 * Le locandine sono tutte verticali (3:4): in una card verticale diventerebbe
 * tutta immagine. Qui la locandina occupa una colonna, ritagliata a 3:4, e il
 * testo l'altra. Tutta la card e' cliccabile: il link del titolo si estende
 * sull'intera card. Un evento senza immagine ha un riquadro della stessa
 * proporzione, cosi' la griglia resta allineata.
 * ------------------------------------------------------------------------ */

.bct-event-card {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
	height: 100%;
	overflow: hidden;
	background: var(--wp--preset--color--base);
	border-radius: var(--bct-radius);
	box-shadow: var(--bct-shadow);
	transition: transform 0.35s var(--bct-ease), box-shadow 0.35s var(--bct-ease);
}

.bct-event-card:hover,
.bct-event-card:focus-within {
	transform: translateY(-4px);
	box-shadow: var(--bct-shadow-hover);
}

/* Il gap del layout "default" del gruppo non deve spostare le colonne. */
.bct-event-card > * {
	margin: 0 !important;
}

.bct-event-card .wp-block-post-featured-image {
	overflow: hidden;
	background: var(--wp--preset--color--accent-3);
}

.bct-event-card .wp-block-post-featured-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.6s var(--bct-ease);
}

.bct-event-card:hover .wp-block-post-featured-image img,
.bct-event-card:focus-within .wp-block-post-featured-image img {
	transform: scale(1.05);
}

.bct-event-card:not(:has(.wp-block-post-featured-image))::before {
	content: "";
	display: block;
	aspect-ratio: 3 / 4;
	background:
		linear-gradient(var(--wp--preset--color--accent-1), var(--wp--preset--color--accent-1)) left bottom / 3rem 0.3rem no-repeat,
		var(--wp--preset--color--accent-3);
}

.bct-event-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	padding: clamp(1rem, 3cqi, 1.75rem);
}

.bct-event-card__body > * {
	margin: 0 !important;
}

.bct-event-card__date {
	color: var(--wp--preset--color--accent-2);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	letter-spacing: 0.04em;
}

.bct-event-card__date:empty {
	display: none;
}

.bct-event-card__title {
	line-height: 1.25;
}

.bct-event-card__title a {
	text-decoration: none;
}

/* Link esteso: l'intera card porta all'evento. */
.bct-event-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.bct-event-card__title a:focus-visible {
	outline: none;
}

.bct-event-card:has(.bct-event-card__title a:focus-visible) {
	outline: 2px solid var(--wp--preset--color--accent-2);
	outline-offset: 3px;
}

.bct-event-card__excerpt {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 4;
	color: var(--wp--preset--color--accent-4);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.55;
}

/* "Scopri" in fondo alla card, allineato in basso in tutte le card della riga. */
.bct-event-card__body::after {
	content: "Scopri l’evento →";
	margin-top: auto;
	padding-top: 0.25rem;
	color: var(--wp--preset--color--accent-2);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	transition: transform 0.35s var(--bct-ease);
}

.bct-event-card:hover .bct-event-card__body::after {
	transform: translateX(4px);
}

/* Su schermi molto stretti la locandina si stringe un po'. */
@media (max-width: 420px) {
	.bct-event-card {
		grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
	}

	.bct-event-card__excerpt {
		-webkit-line-clamp: 3;
	}
}

/* ---------------------------------------------------------------------------
 * Card delle notizie
 *
 * Stessa famiglia delle card eventi: foto 16:9 in alto, data, titolo ed
 * estratto sotto, tutta la card cliccabile. Negli archivi la notizia piu'
 * recente, solo in prima pagina, occupa l'intera riga con foto e testo
 * affiancati: anche con poche notizie la pagina non resta vuota.
 * ------------------------------------------------------------------------ */

.bct-news-card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	background: var(--wp--preset--color--base);
	border-radius: var(--bct-radius);
	box-shadow: var(--bct-shadow);
	transition: transform 0.35s var(--bct-ease), box-shadow 0.35s var(--bct-ease);
}

.bct-news-card:hover,
.bct-news-card:focus-within {
	transform: translateY(-4px);
	box-shadow: var(--bct-shadow-hover);
}

.bct-news-card > * {
	margin: 0 !important;
}

.bct-news-card .wp-block-post-featured-image {
	overflow: hidden;
	background: var(--wp--preset--color--accent-3);
}

.bct-news-card .wp-block-post-featured-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.6s var(--bct-ease);
}

.bct-news-card:hover .wp-block-post-featured-image img,
.bct-news-card:focus-within .wp-block-post-featured-image img {
	transform: scale(1.05);
}

.bct-news-card:not(:has(.wp-block-post-featured-image))::before {
	content: "";
	display: block;
	aspect-ratio: 16 / 9;
	background:
		linear-gradient(var(--wp--preset--color--accent-1), var(--wp--preset--color--accent-1)) left bottom / 3rem 0.3rem no-repeat,
		var(--wp--preset--color--accent-3);
}

.bct-news-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.6rem;
	padding: clamp(1.1rem, 3cqi, 1.75rem);
}

.bct-news-card__body > * {
	margin: 0 !important;
}

.bct-news-card__date {
	color: var(--wp--preset--color--accent-2);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	letter-spacing: 0.04em;
}

.bct-news-card__title {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.25;
	text-wrap: balance;
}

.bct-news-card__title a {
	text-decoration: none;
}

/* Link esteso: l'intera card porta alla notizia. */
.bct-news-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.bct-news-card__title a:focus-visible {
	outline: none;
}

.bct-news-card:has(.bct-news-card__title a:focus-visible) {
	outline: 2px solid var(--wp--preset--color--accent-2);
	outline-offset: 3px;
}

.bct-news-card__excerpt p {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	color: var(--wp--preset--color--accent-4);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.55;
}

.bct-news-card__body::after {
	content: "Leggi la notizia →";
	margin-top: auto;
	padding-top: 0.25rem;
	color: var(--wp--preset--color--accent-2);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	transition: transform 0.35s var(--bct-ease);
}

.bct-news-card:hover .bct-news-card__body::after {
	transform: translateX(4px);
}

/* La notizia in apertura dell'archivio. */
body:not(.paged) .bct-news-list > :first-child {
	grid-column: 1 / -1;
}

@media (min-width: 782px) {
	body:not(.paged) .bct-news-list > :first-child .bct-news-card {
		display: grid;
		grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
	}

	/* Con l'altezza della riga e il 16:9 la foto si allargherebbe oltre la
	 * sua colonna: la larghezza resta quella della colonna. */
	body:not(.paged) .bct-news-list > :first-child .wp-block-post-featured-image {
		width: 100%;
		height: 100%;
	}

	body:not(.paged) .bct-news-list > :first-child .bct-news-card__body {
		justify-content: center;
		padding: var(--wp--preset--spacing--60);
	}

	body:not(.paged) .bct-news-list > :first-child .bct-news-card__body::after {
		margin-top: var(--wp--preset--spacing--20);
	}

	body:not(.paged) .bct-news-list > :first-child .bct-news-card__title {
		font-size: clamp(1.5rem, 1rem + 1.5vw, 2.25rem);
	}

	body:not(.paged) .bct-news-list > :first-child .bct-news-card__excerpt p {
		-webkit-line-clamp: 5;
		font-size: var(--wp--preset--font-size--medium);
	}
}

@media (prefers-reduced-motion: reduce) {
	.bct-news-card,
	.bct-news-card .wp-block-post-featured-image img {
		transition: none;
	}
}

/* Le card dei libri usano la stessa ombra. */
.bct-card.has-background {
	box-shadow: var(--bct-shadow);
	transition: transform 0.35s var(--bct-ease), box-shadow 0.35s var(--bct-ease);
}

.bct-card.has-background:hover,
.bct-card.has-background:focus-within {
	transform: translateY(-3px);
	box-shadow: var(--bct-shadow-hover);
}

/* ---------------------------------------------------------------------------
 * Singolo evento
 *
 * Su desktop due colonne: titolo, data e testo a sinistra, locandina a destra,
 * intera e non ritagliata, che resta visibile scorrendo il testo. Su mobile
 * l'ordine e' quello del markup: titolo, locandina, testo.
 * ------------------------------------------------------------------------ */

.bct-event-single {
	display: grid;
	gap: var(--wp--preset--spacing--50);
}

.bct-event-single > * {
	margin: 0 !important;
}

.bct-event-single__date {
	margin-top: var(--wp--preset--spacing--30);
	color: var(--wp--preset--color--accent-2);
	font-weight: 700;
	letter-spacing: 0.04em;
}

.bct-event-single__date:empty,
.bct-event-single__subtitle:empty {
	display: none;
}

.bct-event-single__subtitle {
	line-height: 1.4;
}

.bct-event-single__poster {
	justify-self: center;
	width: 100%;
	max-width: 30rem;
}

.bct-event-single__poster img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: var(--bct-radius);
	box-shadow: var(--bct-shadow-hover);
}

a.bct-zoom {
	display: block;
	cursor: zoom-in;
}

/* Galleria dell'evento (blocco Contenuto Evento): miniature quadrate che si
 * aprono nel lightbox. */
.bcc-event-gallery {
	margin-top: var(--wp--preset--spacing--60);
}

.bcc-event-gallery__title {
	margin: 0 0 var(--wp--preset--spacing--40);
	font-size: var(--wp--preset--font-size--large);
}

.bcc-event-gallery__list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
	gap: var(--wp--preset--spacing--30);
	margin: 0;
	padding: 0;
	list-style: none;
}

.bcc-event-gallery__item {
	margin: 0;
	overflow: hidden;
	border-radius: var(--bct-radius);
	aspect-ratio: 1;
	background: var(--wp--preset--color--accent-3);
}

.bcc-event-gallery__item a {
	height: 100%;
}

.bcc-event-gallery__item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.bcc-event-gallery__item a:hover img,
.bcc-event-gallery__item a:focus-visible img {
	transform: scale(1.05);
}

.bcc-event-gallery__item a:focus-visible {
	outline: 3px solid var(--wp--preset--color--accent-1);
	outline-offset: -3px;
}

@media (prefers-reduced-motion: reduce) {
	.bcc-event-gallery__item img {
		transition: none;
	}
}

@media (min-width: 782px) {
	.bct-event-single {
		grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
		grid-template-rows: auto 1fr;
		grid-template-areas:
			"head poster"
			"body poster";
		column-gap: var(--wp--preset--spacing--70);
		align-items: start;
	}

	.bct-event-single__head {
		grid-area: head;
	}

	.bct-event-single__body {
		grid-area: body;
	}

	.bct-event-single__poster {
		grid-area: poster;
		position: sticky;
		top: calc(var(--wp-admin--admin-bar--height, 0px) + 7rem);
		max-width: none;
	}
}

/* ---------------------------------------------------------------------------
 * Testate con foto (Catalogo, Eventi) e immagini delle pagine
 *
 * Le foto delle testate sono decorative: sfondi CSS, senza testo alternativo.
 * ------------------------------------------------------------------------ */

.bct-page-header {
	display: grid;
	gap: var(--wp--preset--spacing--50);
	align-items: center;
}

.bct-page-header > * {
	margin: 0 !important;
}

/* Blocco Immagine modificabile dall'Editor del sito: qualunque foto si
 * scelga viene ritagliata alle stesse proporzioni. */
.bct-photo {
	overflow: hidden;
	border-radius: var(--bct-radius);
	box-shadow: var(--bct-shadow);
	background: var(--wp--preset--color--accent-3);
}

.bct-photo img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 21 / 9;
	object-fit: cover;
}

@media (min-width: 782px) {
	.bct-page-header {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	}

	.bct-photo img {
		aspect-ratio: 16 / 9;
	}
}

/* Solo il testo si restringe: il gruppo resta allineato al resto della pagina. */
.bct-page-intro > p:not(.bct-eyebrow) {
	max-width: 52rem;
}

/* ---------------------------------------------------------------------------
 * Pagina Le Sale: la mappa interattiva (Mapplic) a tutta larghezza
 * ------------------------------------------------------------------------ */

.bct-map {
	overflow: hidden;
	padding: clamp(0.5rem, 2vw, 1.5rem);
	border-radius: var(--bct-radius);
	background: var(--wp--preset--color--accent-3);
	box-shadow: var(--bct-shadow);
}

.bct-map mapplic-map {
	display: block;
}

/* Griglia delle sale: foto (o miniatura grafica) 16:9, come gli scatti
 * delle sale (1857x1044), e nome sotto. Le card
 * non sono link: la pagina presenta le sale, non le prenota. Una sala senza
 * immagine ha un riquadro della stessa proporzione, come le card degli eventi. */
.bct-sala-card {
	position: relative;
	height: 100%;
	overflow: hidden;
	background: var(--wp--preset--color--base);
	border-radius: var(--bct-radius);
	box-shadow: var(--bct-shadow);
	transition: transform 0.35s var(--bct-ease), box-shadow 0.35s var(--bct-ease);
}

/* Come le card degli eventi: la card si alza e la foto si avvicina appena. */
.bct-sala-card:hover,
.bct-sala-card:focus-within {
	transform: translateY(-4px);
	box-shadow: var(--bct-shadow-hover);
}

.bct-sala-card > * {
	margin: 0 !important;
}

.bct-sala-card .wp-block-post-featured-image {
	overflow: hidden;
	background: var(--wp--preset--color--accent-3);
}

.bct-sala-card .wp-block-post-featured-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 0;
	transition: transform 0.6s var(--bct-ease);
}

.bct-sala-card:hover .wp-block-post-featured-image img,
.bct-sala-card:focus-within .wp-block-post-featured-image img {
	transform: scale(1.05);
}

.bct-sala-card:not(:has(.wp-block-post-featured-image))::before {
	content: "";
	display: block;
	aspect-ratio: 16 / 9;
	background:
		linear-gradient(var(--wp--preset--color--accent-1), var(--wp--preset--color--accent-1)) left bottom / 3rem 0.3rem no-repeat,
		var(--wp--preset--color--accent-3);
}

.bct-sala-card__title {
	padding: 1rem 1.25rem 1.15rem;
	line-height: 1.25;
}

.bct-sala-card__title a {
	text-decoration: none;
}

/* Link esteso: l'intera card porta alla scheda della sala. */
.bct-sala-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.bct-sala-card__title a:focus-visible {
	outline: none;
}

.bct-sala-card:has(.bct-sala-card__title a:focus-visible) {
	outline: 2px solid var(--wp--preset--color--accent-2);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.bct-sala-card,
	.bct-sala-card .wp-block-post-featured-image img {
		transition: none;
	}

	.bct-sala-card:hover,
	.bct-sala-card:focus-within,
	.bct-sala-card:hover .wp-block-post-featured-image img,
	.bct-sala-card:focus-within .wp-block-post-featured-image img {
		transform: none;
	}
}

/* Pulsante Prenota: in fondo alla card, solo sulle sale prenotabili (il
 * plugin toglie il pulsante dalle altre, il contenitore vuoto sparisce). */
.bct-sala-card {
	display: flex;
	flex-direction: column;
}

.bct-sala-card__actions {
	/* Sopra il link esteso: Prenota resta un link a parte. */
	position: relative;
	z-index: 2;
	margin-top: auto !important;
	padding: 0 1.25rem 1.25rem;
}

.bct-sala-card__actions:not(:has(.wp-block-button)) {
	display: none;
}

/* Scheda della singola sala: testo e foto affiancati da tablet in su. */
.bct-sala-single {
	display: grid;
	gap: var(--wp--preset--spacing--50);
}

.bct-sala-single > * {
	margin: 0 !important;
}

.bct-sala-single .wp-block-buttons:not(:has(.wp-block-button)) {
	display: none;
}

.bct-sala-single__image {
	overflow: hidden;
	border-radius: var(--bct-radius);
	box-shadow: var(--bct-shadow);
}

@media (min-width: 782px) {
	.bct-sala-single {
		grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
		grid-template-rows: auto 1fr;
		grid-template-areas:
			"head image"
			"body image";
		column-gap: var(--wp--preset--spacing--70);
		align-items: start;
	}

	.bct-sala-single__head {
		grid-area: head;
	}

	.bct-sala-single__image {
		grid-area: image;
	}

	.bct-sala-single__body {
		grid-area: body;
	}
}

/* ---------------------------------------------------------------------------
 * Singolo articolo
 *
 * Un'unica colonna di lettura: titolo, immagine e testo condividono gli
 * stessi margini, cosi' l'immagine non sborda rispetto al testo.
 * ------------------------------------------------------------------------ */

.bct-post-single__title {
	font-size: clamp(1.75rem, 1rem + 3vw, 2.75rem);
	text-wrap: balance;
}

.bct-post-single__image {
	overflow: hidden;
	border-radius: var(--bct-radius);
	box-shadow: var(--bct-shadow);
}

.bct-post-single__body {
	line-height: 1.7;
}

.bct-post-single__body > :first-child {
	margin-top: 0;
}

/* Senza articoli vicini resterebbe solo il filetto. */
.bct-post-single__nav:not(:has(a)) {
	display: none;
}

/* Immagine in evidenza delle pagine (La Biblioteca, il Palazzo). */
.wp-block-post-featured-image:not(.bct-event-single__poster, .bct-event-card .wp-block-post-featured-image, .bct-sala-card .wp-block-post-featured-image) img {
	border-radius: var(--bct-radius);
}

/* ---------------------------------------------------------------------------
 * Hero della home con slideshow
 * ------------------------------------------------------------------------ */

/* In home lo slideshow e' una striscia a tutta larghezza, senza frecce ne'
 * pallini: resta solo un piccolo pulsante di pausa nell'angolo (chi non puo'
 * seguire il movimento deve poterlo fermare). Si naviga dal lightbox. */
.bct-strip .bct-slideshow__viewport {
	aspect-ratio: auto;
	height: clamp(16rem, 42vw, 36rem);
	border-radius: 0;
	box-shadow: none;
}

.bct-strip .bct-slideshow__controls {
	position: absolute;
	right: var(--wp--preset--spacing--50);
	bottom: var(--wp--preset--spacing--40);
	margin: 0;
}

.bct-strip .bct-slideshow__button:not([data-action="toggle"]),
.bct-strip .bct-slideshow__dots {
	display: none;
}

.bct-strip .bct-slideshow__button[data-action="toggle"] {
	border-color: transparent;
	background: rgb(31 23 23 / 0.55);
	color: #fff;
	backdrop-filter: blur(4px);
}

.bct-slideshow {
	position: relative;
}

.bct-slideshow__viewport {
	position: relative;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	border-radius: var(--bct-radius);
	background: var(--wp--preset--color--accent-3);
	box-shadow: var(--bct-shadow-hover);
}

.bct-slideshow__slide {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity 1s var(--bct-ease), visibility 0s linear 1s;
}

.bct-slideshow__slide.is-active {
	opacity: 1;
	visibility: visible;
	transition: opacity 1s var(--bct-ease), visibility 0s;
}

.bct-slideshow__open {
	display: block;
	width: 100%;
	height: 100%;
	cursor: zoom-in;
}

.bct-slideshow__open:focus-visible {
	outline: 3px solid var(--wp--preset--color--accent-2);
	outline-offset: -3px;
}

.bct-slideshow__slide img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.bct-slideshow__controls {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 0.85rem;
}

.bct-slideshow__controls[hidden] {
	display: none;
}

.bct-slideshow__button {
	display: grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border: 1px solid var(--wp--preset--color--accent-6);
	border-radius: 50%;
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.bct-slideshow__button:hover,
.bct-slideshow__button:focus-visible {
	border-color: var(--wp--preset--color--accent-2);
	background: var(--wp--preset--color--accent-2);
	color: var(--wp--preset--color--base);
}

.bct-slideshow__button[data-action="toggle"] {
	font-size: 0.75rem;
}

.bct-slideshow__play,
.bct-slideshow.is-paused .bct-slideshow__pause {
	display: none;
}

.bct-slideshow.is-paused .bct-slideshow__play {
	display: inline;
}

.bct-slideshow__dots {
	display: flex;
	flex-wrap: wrap;
	gap: 0.15rem;
	margin-left: auto;
}

/* Area cliccabile di 24px attorno a un pallino piu' piccolo. */
.bct-slideshow__dot {
	position: relative;
	width: 1.5rem;
	height: 1.5rem;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}

.bct-slideshow__dot::before {
	content: "";
	position: absolute;
	inset: 50% auto auto 50%;
	width: 0.55rem;
	height: 0.55rem;
	border-radius: 999px;
	background: var(--wp--preset--color--accent-5);
	transform: translate(-50%, -50%);
	transition: width 0.35s var(--bct-ease), background-color 0.35s;
}

.bct-slideshow__dot[aria-current="true"]::before {
	width: 1.3rem;
	background: var(--wp--preset--color--accent-2);
}

.bct-slideshow__dot:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent-2);
	border-radius: 4px;
}

/* ---------------------------------------------------------------------------
 * Lightbox
 * ------------------------------------------------------------------------ */

.bct-lightbox-open {
	overflow: hidden;
}

.bct-lightbox {
	width: 100vw;
	max-width: none;
	height: 100dvh;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgb(15 10 10 / 0.96);
	color: #fff;
}

.bct-lightbox::backdrop {
	background: rgb(15 10 10 / 0.6);
}

.bct-lightbox__stage {
	position: absolute;
	inset: 0 0 4.5rem;
	display: grid;
	place-items: center;
	overflow: hidden;
	touch-action: none;
}

.bct-lightbox__img {
	max-width: calc(100% - 2rem);
	max-height: calc(100% - 2rem);
	object-fit: contain;
	transform-origin: center;
	transition: transform 0.25s var(--bct-ease), opacity 0.3s;
	cursor: zoom-in;
	user-select: none;
}

.bct-lightbox.is-zoomed .bct-lightbox__img {
	cursor: grab;
	transition: opacity 0.3s;
}

.bct-lightbox.is-zoomed .bct-lightbox__img:active {
	cursor: grabbing;
}

.bct-lightbox__bar {
	position: absolute;
	inset: auto 0 0;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 4.5rem;
	padding: 0.5rem 1rem;
}

.bct-lightbox__caption {
	flex: 1;
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.4;
}

.bct-lightbox__counter {
	font-size: var(--wp--preset--font-size--small);
	font-variant-numeric: tabular-nums;
	opacity: 0.75;
}

.bct-lightbox__button,
.bct-lightbox__nav {
	display: grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	border: 1px solid rgb(255 255 255 / 0.3);
	border-radius: 50%;
	background: rgb(255 255 255 / 0.08);
	color: #fff;
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s, border-color 0.2s;
}

.bct-lightbox__button:hover,
.bct-lightbox__button:focus-visible,
.bct-lightbox__nav:hover,
.bct-lightbox__nav:focus-visible {
	border-color: var(--wp--preset--color--accent-1);
	background: var(--wp--preset--color--accent-2);
}

.bct-lightbox__button:disabled {
	opacity: 0.35;
	cursor: default;
}

.bct-lightbox__nav {
	position: absolute;
	top: calc(50% - 2.25rem);
	width: 3.25rem;
	height: 3.25rem;
	font-size: 2rem;
	transform: translateY(-50%);
}

.bct-lightbox__nav--prev {
	left: 1rem;
}

.bct-lightbox__nav--next {
	right: 1rem;
}

.bct-lightbox.is-zoomed .bct-lightbox__nav {
	opacity: 0;
	pointer-events: none;
}

.bct-lightbox.is-loading .bct-lightbox__counter::after {
	content: " · carico…";
}

@media (max-width: 600px) {
	.bct-lightbox__nav {
		top: auto;
		bottom: 5rem;
		transform: none;
	}

	.bct-lightbox__caption {
		display: none;
	}
}

/* ---------------------------------------------------------------------------
 * Animazioni
 *
 * Solo per chi non ha chiesto di ridurre il movimento. All'apertura entra la
 * testata; scorrendo, card e sezioni compaiono salendo leggermente, dove il
 * browser supporta le animazioni legate allo scroll. Altrove il contenuto e'
 * subito visibile: nessuna animazione nasconde qualcosa per sempre.
 * ------------------------------------------------------------------------ */

@keyframes bct-fade-up {
	from {
		opacity: 0;
		transform: translateY(1.25rem);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes bct-fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes bct-bar-grow {
	from {
		transform: scaleX(0);
	}
	to {
		transform: scaleX(1);
	}
}

@keyframes bct-ken-burns {
	from {
		transform: scale(1);
	}
	to {
		transform: scale(1.07);
	}
}

@media (prefers-reduced-motion: no-preference) {
	/* Sottolineatura del menu che cresce da sinistra. */
	.bct-header .wp-block-navigation-item__content {
		border-bottom: 0;
		background: linear-gradient(var(--wp--preset--color--accent-1), var(--wp--preset--color--accent-1)) left bottom / 0 2px no-repeat;
		transition: background-size 0.3s var(--bct-ease);
	}

	.bct-header .wp-block-navigation-item__content:hover,
	.bct-header .wp-block-navigation-item__content:focus-visible,
	.bct-header .current-menu-item > .wp-block-navigation-item__content {
		background-size: 100% 2px;
	}

	.wp-element-button {
		transition: transform 0.25s var(--bct-ease), background-color 0.25s, color 0.25s, box-shadow 0.25s;
	}

	.wp-element-button:hover {
		transform: translateY(-2px);
		box-shadow: var(--bct-shadow);
	}

	.bct-more a::after {
		display: inline-block;
		transition: transform 0.3s var(--bct-ease);
	}

	.bct-more a:hover::after {
		transform: translateX(4px);
	}

	/* Testata: testo e foto entrano in sequenza. */
	.bct-hero__text > *,
	.bct-page-intro > *,
	.bct-page-header > *,
	.bct-event-single__head > * {
		animation: bct-fade-up 0.8s var(--bct-ease) both;
	}

	.bct-hero__text > :nth-child(2),
	.bct-page-intro > :nth-child(2),
	.bct-page-header > :nth-child(2),
	.bct-event-single__head > :nth-child(2) {
		animation-delay: 0.1s;
	}

	.bct-hero__text > :nth-child(3),
	.bct-page-intro > :nth-child(3),
	.bct-event-single__head > :nth-child(3) {
		animation-delay: 0.2s;
	}

	.bct-hero__text > :nth-child(4),
	.bct-event-single__head > :nth-child(4) {
		animation-delay: 0.3s;
	}

	.bct-strip,
	.bct-event-single__poster {
		animation: bct-fade-in 1.2s var(--bct-ease) 0.2s both;
	}

	.bct-page-title::before {
		transform-origin: left;
		animation: bct-bar-grow 0.7s var(--bct-ease) 0.3s both;
	}

	/* Leggero zoom lento sulla foto attiva dello slideshow. */
	.bct-slideshow.is-ready:not(.is-paused) .bct-slideshow__slide.is-active img {
		animation: bct-ken-burns 7s linear both;
	}

	@supports (animation-timeline: view()) {
		.wp-block-post-template > .wp-block-post,
		.bct-section-title,
		.bct-footer__contacts {
			animation: bct-fade-up linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 60%;
		}

		.bct-section-title::before {
			transform-origin: left;
			animation: bct-bar-grow linear both;
			animation-timeline: view();
			animation-range: entry 20% entry 80%;
		}
	}
}

/* Libri da scoprire: arrivano 36 libri in ordine casuale, se ne vedono 9. */
.bct-random-books .wp-block-post-template > li:nth-child(n+10) {
	display: none;
}

/* ---------------------------------------------------------------------------
 * Breadcrumbs
 * ------------------------------------------------------------------------ */

.bct-breadcrumbs {
	padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50) 0;
	font-size: var(--wp--preset--font-size--small);
}

.bct-breadcrumbs ol {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.5rem;
	max-width: 1240px;
	margin: 0 auto;
	padding: 0;
	list-style: none;
}

.bct-breadcrumbs li + li::before {
	content: "›";
	margin-right: 0.5rem;
	opacity: 0.6;
}

.bct-breadcrumbs a {
	text-decoration: none;
}

.bct-breadcrumbs a:hover,
.bct-breadcrumbs a:focus-visible {
	text-decoration: underline;
}

.bct-breadcrumbs [aria-current="page"] {
	opacity: 0.75;
}

/* Le breadcrumb fanno già da distanza dall'intestazione. */
.bct-breadcrumbs + main.wp-block-group {
	padding-top: var(--wp--preset--spacing--50) !important;
}

/* ---------------------------------------------------------------------------
 * Contatore dei volumi (home)
 *
 * Sezione a tutta larghezza con la foto degli scaffali sotto un velo scuro.
 * Il numero arriva dal catalogo (binding bct/totale-volumi) e lo script in
 * functions.php lo fa contare da zero quando la sezione entra nello schermo.
 * ------------------------------------------------------------------------ */

.bct-counter {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	color: var(--wp--preset--color--base);
	text-align: center;
	background-color: var(--wp--preset--color--contrast);
	background-image:
		linear-gradient(180deg, rgb(31 23 23 / 0.78), rgb(31 23 23 / 0.9)),
		url("assets/images/scaffali-1600.jpg");
	background-image:
		linear-gradient(180deg, rgb(31 23 23 / 0.78), rgb(31 23 23 / 0.9)),
		image-set(url("assets/images/scaffali-1600.jpg") 1x, url("assets/images/scaffali-2560.jpg") 2x);
	background-position: center;
	background-size: cover;
}

@media (max-width: 781px) {
	.bct-counter {
		background-image:
			linear-gradient(180deg, rgb(31 23 23 / 0.78), rgb(31 23 23 / 0.9)),
			image-set(url("assets/images/scaffali-800.jpg") 1x, url("assets/images/scaffali-1600.jpg") 2x);
	}
}

/* Sui desktop la foto resta ferma mentre la pagina scorre. */
@media (hover: hover) and (min-width: 1024px) and (prefers-reduced-motion: no-preference) {
	.bct-counter {
		background-attachment: fixed;
	}
}

.bct-counter__claim {
	margin: 0;
	color: var(--wp--preset--color--accent-5);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.bct-counter__number {
	margin: 0;
	font-size: clamp(4.5rem, 17vw, 13rem);
	font-weight: 800;
	line-height: 0.95;
	letter-spacing: -0.045em;
	font-variant-numeric: tabular-nums;
}

/* La barretta rossa del logo, sotto al numero. */
.bct-counter__number::after {
	content: "";
	display: block;
	width: 4rem;
	height: 0.4rem;
	margin: 0.25em auto 0;
	background: var(--wp--preset--color--accent-1);
	font-size: 1rem;
}

.bct-counter__digits {
	display: inline-block;
	text-align: center;
}

.bct-counter .bct-counter__label {
	max-width: 32ch;
	margin-inline: auto !important;
	margin-top: var(--wp--preset--spacing--30);
	color: var(--wp--preset--color--accent-5);
	font-size: var(--wp--preset--font-size--large);
}

.bct-counter .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

@media (prefers-reduced-motion: no-preference) {
	/* In attesa: claim e testo nascosti, la barra chiusa. */
	.bct-counter.is-waiting .bct-counter__claim,
	.bct-counter.is-waiting .bct-counter__label {
		opacity: 0;
	}

	.bct-counter.is-waiting .bct-counter__number {
		opacity: 0.25;
		filter: blur(6px);
	}

	.bct-counter.is-waiting .bct-counter__number::after {
		transform: scaleX(0);
	}

	/* Durante il conteggio: il numero si mette a fuoco, la barra cresce
	 * insieme alle cifre, claim e testo salgono in sequenza. */
	.bct-counter.is-counting .bct-counter__number {
		transition: opacity 0.9s var(--bct-ease), filter 1.2s var(--bct-ease);
	}

	.bct-counter.is-counting .bct-counter__number::after {
		transform-origin: center;
		animation: bct-bar-grow 2.8s cubic-bezier(0.33, 1, 0.68, 1) both;
	}

	.bct-counter.is-counting .bct-counter__claim {
		animation: bct-fade-up 0.8s var(--bct-ease) both;
	}

	.bct-counter.is-counting .bct-counter__label {
		animation: bct-fade-up 0.8s var(--bct-ease) 0.9s both;
	}

	/* Arrivato: un piccolo colpo d'occhio sul numero. */
	.bct-counter.is-done .bct-counter__digits {
		animation: bct-counter-pop 0.6s var(--bct-ease);
	}
}

@keyframes bct-counter-pop {
	40% {
		transform: scale(1.04);
		color: var(--wp--preset--color--accent-1);
	}
}
