/*
Theme Name: UILT Puglia
Theme URI: https://www.uiltpuglia.it
Author: Mattia Leonardo Angelillo
Author URI: https://www.mattiawebdesigner.com
Description: Tema a blocchi per UILT Puglia (Unione Italiana Libero Teatro), federazione regionale del teatro amatoriale.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
Version: 2.5.1
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
Text Domain: uilt_puglia
Tags: block-patterns, full-site-editing, grid-layout, wide-blocks
*/

/* ==========================================================================
   Il design system (colori, font, spaziature, pulsanti) vive in theme.json.
   Qui solo i componenti che theme.json non può descrivere.
   Le variabili --wp--custom--* sono definite in theme.json > settings.custom
   ========================================================================== */

/* 1. Layout generale
   ========================================================================== */
.uilt-main {
	margin-block: var(--wp--preset--spacing--40) var(--wp--preset--spacing--60);
}

.uilt-page-title {
	margin-block-end: var(--wp--preset--spacing--40);
}

/* 2. Header & Menu di Navigazione
   ========================================================================== */
.uilt-header {
	border-block-start: 4px solid var(--wp--preset--color--primary);
	border-block-end: 1px solid var(--wp--preset--color--border);
	padding-block: var(--wp--preset--spacing--20);
	background: #ffffff;
	position: relative;
	z-index: 1000;
}

.uilt-header .wp-block-navigation {
	gap: 1.5rem;
}

.uilt-header .wp-block-navigation .wp-block-navigation-item__content {
	font-weight: 600;
	color: var(--wp--preset--color--contrast);
	padding: 0.5rem 0.6rem;
	transition: color 0.2s ease;
}

.uilt-header .wp-block-navigation .wp-block-navigation-item__content:hover,
.uilt-header .wp-block-navigation .wp-block-navigation-item__content:focus {
	color: var(--wp--preset--color--primary);
}

/* Sottomenu Dropdown teatrali con sfumature ed eleganza */
.uilt-header .wp-block-navigation .wp-block-navigation__submenu-container {
	background: #ffffff;
	border: 1px solid var(--wp--preset--color--border);
	border-top: 3px solid var(--wp--preset--color--primary);
	border-radius: 0 0 var(--wp--custom--radius) var(--wp--custom--radius);
	box-shadow: 0 10px 25px rgba(115, 39, 43, 0.12);
	padding: 0.6rem 0;
	min-width: 210px;
	animation: uiltDropdownFade 0.22s ease-out;
}

@keyframes uiltDropdownFade {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.uilt-header .wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	display: block;
	padding: 0.6rem 1.25rem;
	font-size: 0.92rem;
	color: var(--wp--preset--color--contrast);
	border-left: 3px solid transparent;
	transition: all 0.2s ease;
}

.uilt-header .wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover,
.uilt-header .wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item__content:focus {
	background: var(--wp--preset--color--tertiary);
	color: var(--wp--preset--color--primary);
	border-left-color: var(--wp--preset--color--accent);
	padding-left: 1.5rem;
}

.uilt-header .wp-block-navigation .wp-block-navigation__submenu-icon {
	color: var(--wp--preset--color--muted);
	transition: transform 0.2s ease;
}

.uilt-header .wp-block-navigation .has-child:hover .wp-block-navigation__submenu-icon {
	color: var(--wp--preset--color--primary);
}

.wp-block-navigation__responsive-container.is-menu-open {
	background: #ffffff;
	padding: 2rem 1.5rem;
	border-top: 4px solid var(--wp--preset--color--primary);
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
	color: var(--wp--preset--color--primary);
}

.uilt-header .wp-block-search__input {
	border-color: var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius) 0 0 var(--wp--custom--radius);
}

.uilt-header .wp-block-search__button {
	margin-inline-start: 0;
	border-radius: 0 var(--wp--custom--radius) var(--wp--custom--radius) 0;
}

/* 3. Griglia articoli (home, categorie, archivi, ricerca)
   ========================================================================== */
.wp-block-post-template.uilt-posts__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--wp--custom--card--min-width)), 1fr));
	gap: var(--wp--preset--spacing--30);
	margin-block: 0;
	padding: 0;
	list-style: none;
}

.wp-block-post-template.uilt-posts__grid > * {
	margin: 0;
}

.uilt-posts .wp-block-query-pagination {
	margin-block-start: var(--wp--preset--spacing--40);
}

/* 4. Card articolo
   ========================================================================== */
.uilt-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius);
	box-shadow: var(--wp--custom--shadow--card);
	transition: box-shadow var(--wp--custom--transition), transform var(--wp--custom--transition);
}

.uilt-card:hover,
.uilt-card:focus-within {
	box-shadow: var(--wp--custom--shadow--card-hover);
	transform: translateY(-3px);
}

.uilt-card > * {
	margin: 0;
}

.uilt-card .uilt-card__image {
	aspect-ratio: var(--wp--custom--card--image-ratio);
	margin: 0;
	overflow: hidden;
	background: var(--wp--preset--color--tertiary);
}

.uilt-card .uilt-card__image a {
	display: block;
	height: 100%;
}

.uilt-card .uilt-card__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform var(--wp--custom--transition);
}

.uilt-card:hover .uilt-card__image img {
	transform: scale(1.04);
}

.uilt-card .uilt-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.75rem;
	padding: 1.25rem 1.5rem 1.5rem;
}

.uilt-card .uilt-card__body > * {
	margin: 0;
}

.uilt-card .uilt-card__title {
	font-size: var(--wp--preset--font-size--large);
}

.uilt-card .uilt-card__excerpt p {
	margin: 0;
}

.uilt-card .uilt-card__more {
	align-self: flex-start;
	margin-block-start: auto;
	padding: 0.6em 1.2em;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	border-radius: var(--wp--custom--radius);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	text-decoration: none;
	transition: background-color var(--wp--custom--transition);
}

.uilt-card .uilt-card__more:hover,
.uilt-card .uilt-card__more:focus {
	background: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--base);
}

/* 5. Categoria Compagnie Teatrali
   ========================================================================== */
.uilt-compagnie-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
	gap: var(--wp--preset--spacing--30);
	list-style: none;
	padding: 0;
	margin: 0;
}

.uilt-compagnia-card {
	background: #ffffff;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
	transition: all 0.25s ease;
}

.uilt-compagnia-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 12px 24px rgba(115, 39, 43, 0.14);
}

.uilt-compagnia-card__media {
	background: var(--wp--preset--color--tertiary);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
	height: 180px;
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.uilt-compagnia-card__media img {
	max-height: 140px;
	max-width: 100%;
	object-fit: contain !important;
}

.uilt-compagnia-card__content {
	padding: 1.5rem;
	display: flex;
	flex-direction: column;
	flex: 1;
	gap: 0.6rem;
}

.uilt-compagnia-card__badge {
	align-self: flex-start;
	background: var(--wp--preset--color--uilt-color-1, #f9e1e3);
	color: var(--wp--preset--color--primary);
	font-size: 0.78rem;
	font-weight: 700;
	padding: 0.25em 0.75em;
	border-radius: 20px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.uilt-compagnia-card__title {
	font-family: var(--wp--preset--font-family--source-serif-pro, serif);
	font-size: 1.3rem;
	margin: 0;
}

.uilt-compagnia-card__title a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.uilt-compagnia-card__title a:hover {
	color: var(--wp--preset--color--primary);
}

.uilt-compagnia-card__excerpt p {
	font-size: 0.92rem;
	color: var(--wp--preset--color--muted);
	margin: 0;
}

.uilt-compagnia-card__btn {
	align-self: flex-start;
	margin-top: auto;
	padding-top: 0.75rem;
	font-size: 0.88rem;
	font-weight: 700;
	color: var(--wp--preset--color--primary);
	text-decoration: none;
}

.uilt-compagnia-card__btn:hover {
	color: var(--wp--preset--color--secondary);
	text-decoration: underline;
}

/* 6. Articolo / pagina singola
   ========================================================================== */
.wp-block-post-featured-image.uilt-cover {
	margin-block-end: var(--wp--preset--spacing--30);
	text-align: center;
}

.wp-block-post-featured-image.uilt-cover img {
	display: inline-block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: var(--wp--custom--cover--max-height);
	object-fit: contain;
	border-radius: var(--wp--custom--radius);
}

.uilt-entry-header .wp-block-post-title {
	margin-block-end: 0.5rem;
}

.uilt-post-meta {
	padding-block-start: var(--wp--preset--spacing--20);
	border-block-start: 1px solid var(--wp--preset--color--border);
}

/* 7. Sezione Showcase "In Cartellone" (Eventi Spettacoli)
   ========================================================================== */
.uilt-events-showcase {
	margin-block: var(--wp--preset--spacing--50, 3rem);
	padding: var(--wp--preset--spacing--40, 2rem) var(--wp--preset--spacing--30, 1.5rem);
	background: var(--wp--preset--color--tertiary, #f7f2ef);
	border: 1px solid var(--wp--preset--color--border, #eadfdb);
	border-radius: var(--wp--custom--radius, 8px);
}

.uilt-events-showcase__header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 2rem;
	padding-bottom: 1rem;
	border-bottom: 2px solid var(--wp--preset--color--primary);
}

.uilt-events-showcase__title {
	font-family: var(--wp--preset--font-family--source-serif-pro, serif);
	font-size: var(--wp--preset--font-size--x-large, 2rem);
	color: var(--wp--preset--color--primary);
	margin: 0 0 0.3rem 0;
}

.uilt-events-showcase__subtitle {
	font-size: var(--wp--preset--font-size--small, 0.95rem);
	color: var(--wp--preset--color--muted);
	margin: 0;
}

.uilt-events-showcase__btn-all {
	padding: 0.6em 1.2em;
	background: transparent;
	color: var(--wp--preset--color--primary);
	border: 2px solid var(--wp--preset--color--primary);
	border-radius: var(--wp--custom--radius);
	font-weight: 700;
	font-size: 0.9rem;
	text-decoration: none;
	transition: all 0.2s ease;
}

.uilt-events-showcase__btn-all:hover {
	background: var(--wp--preset--color--primary);
	color: #ffffff;
}

.uilt-events-showcase__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
	gap: 1.5rem;
}

.uilt-event-card {
	background: #ffffff;
	border: 1px solid var(--wp--preset--color--border);
	border-top: 4px solid var(--wp--preset--color--primary);
	border-radius: var(--wp--custom--radius);
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
	display: flex;
	flex-direction: column;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.uilt-event-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 10px 20px rgba(115, 39, 43, 0.12);
}

.uilt-event-card__media {
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #1f1a1b;
}

.uilt-event-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.uilt-event-card:hover .uilt-event-card__media img {
	transform: scale(1.05);
}

.uilt-event-card__body {
	padding: 1.25rem;
	display: flex;
	flex-direction: column;
	flex: 1;
	gap: 0.5rem;
}

.uilt-event-card__date {
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--wp--preset--color--primary);
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.uilt-event-card__title {
	font-family: var(--wp--preset--font-family--source-serif-pro, serif);
	font-size: 1.25rem;
	margin: 0;
	color: var(--wp--preset--color--contrast);
}

.uilt-event-card__title a {
	color: inherit;
	text-decoration: none;
}

.uilt-event-card__title a:hover {
	color: var(--wp--preset--color--primary);
}

.uilt-event-card__venue {
	font-size: 0.9rem;
	color: var(--wp--preset--color--muted);
	margin: 0;
}

.uilt-event-card__link {
	margin-top: auto;
	padding-top: 0.75rem;
	font-size: 0.88rem;
	font-weight: 700;
	color: var(--wp--preset--color--primary);
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
}

.uilt-event-card__link:hover {
	color: var(--wp--preset--color--secondary);
	text-decoration: underline;
}

/* 8. Integrazione Stili "The Events Calendar"
   ========================================================================== */

/* Colori primari calendario e tasti di ricerca */
.tribe-common .tribe-common-c-btn,
.tribe-events .tribe-events-c-search__button,
.tribe-events-c-top-bar__datepicker-button,
#tribe-events-bar .tribe-bar-submit input[type=submit] {
	background-color: var(--wp--preset--color--primary) !important;
	color: #ffffff !important;
	border-radius: var(--wp--custom--radius) !important;
	font-family: inherit !important;
	font-weight: 600 !important;
	transition: background-color 0.2s ease !important;
}

.tribe-common .tribe-common-c-btn:hover,
.tribe-events .tribe-events-c-search__button:hover,
#tribe-events-bar .tribe-bar-submit input[type=submit]:hover {
	background-color: var(--wp--preset--color--secondary) !important;
}

/* Titoli spettacoli ed eventi */
.tribe-events .tribe-events-calendar-list__event-title a,
.tribe-events .tribe-events-calendar-month__calendar-event-title a,
.tribe-events-single-event-title {
	font-family: var(--wp--preset--font-family--source-serif-pro, serif) !important;
	color: var(--wp--preset--color--contrast) !important;
	text-decoration: none !important;
}

.tribe-events .tribe-events-calendar-list__event-title a:hover,
.tribe-events-single-event-title:hover {
	color: var(--wp--preset--color--primary) !important;
}

/* Data, Badge orari e Costo biglietto in stile teatrale */
.tribe-events .tribe-events-calendar-list__event-datetime,
.tribe-events .tribe-events-c-small-cta__price {
	color: var(--wp--preset--color--primary) !important;
	font-weight: 700 !important;
}

/* Griglia Mese del Calendario */
.tribe-events-calendar-month__day--current .tribe-events-calendar-month__day-date {
	background-color: var(--wp--preset--color--primary) !important;
	color: #ffffff !important;
	border-radius: 50% !important;
}

.tribe-events-calendar-month__calendar-event {
	border-left: 3px solid var(--wp--preset--color--accent) !important;
}

/* Scheda Singola Spettacolo / Evento */
.tribe-events-single {
	padding-block: var(--wp--preset--spacing--30);
}

.tribe-events-event-meta {
	background: var(--wp--preset--color--tertiary) !important;
	border: 1px solid var(--wp--preset--color--border) !important;
	border-left: 4px solid var(--wp--preset--color--primary) !important;
	border-radius: var(--wp--custom--radius) !important;
}

/* 9. Footer
   ========================================================================== */
.uilt-footer {
	margin-block-start: var(--wp--preset--spacing--50);
	padding-block: var(--wp--preset--spacing--40);
	border-block-start: 4px solid var(--wp--preset--color--accent);
}

.uilt-footer a {
	color: inherit;
}

.uilt-footer ul.uilt-footer-list {
	list-style: none !important;
	padding-left: 0 !important;
	margin: 0 !important;
}

.uilt-footer ul.uilt-footer-list li {
	margin-bottom: 0.5rem;
}

/* 10. Accessibilità
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
	.uilt-card,
	.uilt-card .uilt-card__image img,
	.uilt-event-card,
	.uilt-compagnia-card {
		transition: none;
	}

	.uilt-card:hover,
	.uilt-card:hover .uilt-card__image img,
	.uilt-event-card:hover,
	.uilt-compagnia-card:hover {
		transform: none;
	}
}
