/*
Theme Name: BoxOffice DIY
Description: Tema su misura per boxofficediy.com, con la base grafica di DIY Ticket.
Version: 2.0.0
Requires at least: 6.6
Requires PHP: 8.1
Author: DIYTICKET S.R.L.
Text Domain: boxoffice
License: GPL-2.0-or-later
*/

/* I token (colori, font, dimensioni) sono in theme.json: qui solo i componenti. */

:root {
	color-scheme: dark;
	--bo-radius: var(--wp--custom--radius--button);
	--bo-radius-card: var(--wp--custom--radius--card);
	--bo-border: var(--wp--custom--border);
	--bo-field: var(--wp--custom--field);
	--bo-line: var(--wp--custom--line);
	--bo-focus: 2px solid var(--wp--preset--color--accent);
	--bo-heading: var(--wp--preset--font-family--space-grotesk);
	--bo-muted: var(--wp--preset--color--grey-300);
	--bo-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	--bo-speed: 0.3s;
}

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

:focus-visible { outline: var(--bo-focus); outline-offset: 2px; }
.bo-mobile-booking { display: none; }

/* Transizioni: un'unica curva e durata per tutti gli elementi interattivi. */
a, button, input, select, textarea, .wp-element-button {
	transition-property: color, background-color, border-color, box-shadow, opacity, transform;
	transition-duration: var(--bo-speed);
	transition-timing-function: var(--bo-ease);
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition-duration: 0.01ms !important; }
}

.bo-main {
	padding-block: var(--wp--preset--spacing--50) var(--wp--preset--spacing--70);
	min-height: 50vh;
}

/* Contenuti incollati con testo scuro fisso (es. Privacy Policy): sul nero non si leggerebbero. */
.wp-block-post-content :is([style*="color: #222222"], [style^="color: #000000"]) { color: inherit !important; }

/* Header */

header.wp-block-template-part { background: var(--wp--preset--color--black); }

.bo-header {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--40);
	max-width: var(--wp--style--global--content-size);
	margin-inline: auto;
	padding: 16px var(--wp--preset--spacing--50);
	color: var(--wp--preset--color--white);
}

.bo-header__logo { display: block; margin-right: auto; }
.bo-header__logo img { display: block; height: 56px; width: auto; }

.bo-header__nav ul { display: flex; gap: var(--wp--preset--spacing--40); margin: 0; padding: 0; list-style: none; }
.bo-header__nav a { color: inherit; text-decoration: none; font-weight: 500; }
.bo-header__nav a:hover,
.bo-header__nav .current-menu-item > a { color: var(--wp--preset--color--accent); }

.bo-header__toggle { display: none; padding: 8px; border: 0; background: none; color: inherit; cursor: pointer; }
.bo-header__toggle path { transform-box: fill-box; transform-origin: center; transition: transform var(--bo-speed) var(--bo-ease), opacity var(--bo-speed); }
.bo-header__toggle[aria-expanded="true"] path:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.bo-header__toggle[aria-expanded="true"] path:nth-child(2) { opacity: 0; }
.bo-header__toggle[aria-expanded="true"] path:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Ricerca nell'header: solo la lente, il campo si apre al clic. */

.bo-search { display: flex; align-items: center; }
.bo-search--header {
	border-radius: var(--bo-radius);
	transition: background-color var(--bo-speed) var(--bo-ease);
}
.bo-search--header.is-open { background: var(--wp--preset--color--grey-900); }
.bo-search--header input {
	width: 0;
	min-height: 0;
	padding: 8px 0;
	border: 0;
	background: none;
	color: inherit;
	font-size: var(--wp--preset--font-size--small);
	opacity: 0;
	visibility: hidden;
	transition: width 0.4s var(--bo-ease), padding 0.4s var(--bo-ease), opacity var(--bo-speed), visibility 0.4s;
}
.bo-search--header.is-open input { width: 240px; padding-left: 14px; opacity: 1; visibility: visible; transition-property: width, padding, opacity; }
.bo-search--header input:focus { outline: 0; }
.bo-search--header:has(input:focus-visible) { outline: var(--bo-focus); outline-offset: 2px; }
.bo-search--header input::placeholder { color: var(--bo-muted); }
.bo-search--header input::-webkit-search-cancel-button { display: none; }
.bo-search--header button {
	display: flex;
	padding: 9px;
	border: 0;
	border-radius: var(--bo-radius);
	background: none;
	color: inherit;
	cursor: pointer;
}
.bo-search--header button:hover { color: var(--wp--preset--color--accent); }

.wp-block-search.bo-search .wp-block-search__inside-wrapper { gap: 8px; }
.wp-block-search.bo-search .wp-block-search__button { margin: 0; padding: 12px 16px; }

/* Home */

.bo-hero { padding-block: var(--wp--preset--spacing--50) var(--wp--preset--spacing--60); }
.bo-hero h1 { max-width: 900px; margin-block: 0 var(--wp--preset--spacing--40); font-size: 56px; line-height: 1.1; }
.bo-highlight { background: none; color: var(--wp--preset--color--accent); }
.bo-search--hero { max-width: 750px; }
.bo-search--hero .wp-block-search__input { min-height: 48px; }
.bo-search--hero .wp-block-search__button { min-width: 48px; }

/* Senza eventi in prenotazione resta solo il messaggio, senza titolo. */
.bo-events-section:has(.wp-block-query-no-results) > h2 { display: none; }
.wp-block-query-no-results { color: var(--bo-muted); }

/* Card evento: tutta la card è cliccabile (il link del titolo la copre). */

.bo-cards { gap: var(--wp--preset--spacing--50) var(--wp--custom--gutter); }

.bo-card { position: relative; }
.bo-cards .bo-card > * { margin-block: 0; }
.bo-cards .bo-card__media {
	overflow: hidden;
	margin-bottom: 14px;
	background: var(--wp--preset--color--grey-900);
}
.bo-card__media img { transition: transform 0.6s var(--bo-ease); }
.bo-card__media.is-placeholder { display: grid; place-items: center; aspect-ratio: 1; }
.bo-card__media.is-placeholder img { width: 45%; height: auto; opacity: 0.85; }
.bo-card__title { font-size: 16px; font-weight: 500; line-height: 1.35; }
.bo-card__title a { color: inherit; text-decoration: none; }
.bo-card__title a::after { content: ""; position: absolute; inset: 0; }
.bo-card__title a:focus-visible { outline: 0; }
.bo-card__title a:focus-visible::after { outline: var(--bo-focus); outline-offset: 4px; }

/* Riga "data · luogo" sotto il titolo. */
.bo-cards .bo-card__meta { margin-top: 6px; color: var(--bo-muted); font-size: 13px; }
.bo-card__meta > p { display: inline; margin: 0; }
.bo-card__meta > p:empty { display: none; }
.bo-card__meta > p:not(:empty) ~ p:not(:empty)::before { content: "·"; margin-inline: 8px; }

.bo-card:hover .bo-card__media:not(.is-placeholder) img { transform: scale(1.05); }
.bo-card:hover .bo-card__title a { color: var(--wp--preset--color--accent); }

/* Campi dei moduli: Contact Form 7, Tickera, ricerca */

:where(input:not([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="hidden"]), select, textarea) {
	box-sizing: border-box;
	max-width: 100%;
	min-height: 48px;
	padding: 12px 24px;
	border: var(--bo-field);
	border-radius: var(--bo-radius);
	background: var(--wp--preset--color--black);
	color: var(--wp--preset--color--white);
	font: inherit;
}
:where(input, select, textarea)::placeholder { color: var(--bo-muted); opacity: 1; }
:where(input, select, textarea):focus { outline: var(--bo-focus); outline-offset: 0; border-color: transparent; }
:where(textarea) { min-height: 160px; }
/* Campi di Tickera: niente margini e descrizioni vuote che allungano i riquadri. */
.tickera .fields-wrap :is(span, input) { margin-bottom: 0; }
.tickera .fields-wrap .description:empty,
.tickera_additional_info :is(.tickera_buyer_info, .owner-info-wrap, .info_section) > :is(.tc-clearfix, :empty:not(input, .fields-wrap)) { display: none; }
/* Tickera dà ai suoi campi un bordo nero semitrasparente, invisibile sul nero. */
.tickera :is(.tickera-input-field, select, textarea) { border: var(--bo-field); }
:where(label) { font-size: var(--wp--preset--font-size--small); }
:where(input[type="checkbox"], input[type="radio"]) { accent-color: var(--wp--preset--color--accent); }

/* Pulsanti dei plugin allineati a quelli del tema */

.wpcf7-submit,
.tickera a.add_to_cart,
.tickera input[type="submit"],
.tickera button,
.tc-event-filter button {
	display: inline-block;
	padding: 14px 24px;
	border: 0;
	border-radius: var(--bo-radius);
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--black);
	font: 500 16px/24px var(--bo-heading);
	text-decoration: none;
	cursor: pointer;
}
.wpcf7-submit:hover,
.tickera a.add_to_cart:hover,
.tickera input[type="submit"]:hover,
.tickera button:hover,
.tc-event-filter button:hover { background: var(--wp--preset--color--accent); color: var(--wp--preset--color--black); }

/* Tickera: evento e tabelle */

.tc_the_content_pre { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-bottom: var(--wp--preset--spacing--40); }
.tc_event_date_title_front { color: var(--wp--preset--color--accent); }
.tc_event_location_title_front { color: var(--bo-muted); }
.tc_the_content_pre .fa { margin-right: 6px; }

.tickera table,
table.tickera {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	border: var(--bo-border);
	border-radius: var(--bo-radius-card);
	overflow: hidden;
}
.tickera th,
.tickera td { padding: 16px; border: 0; border-bottom: var(--bo-line); text-align: left; vertical-align: middle; }
.tickera tr:last-child td { border-bottom: 0; }
.tickera th { color: var(--bo-muted); font-size: var(--wp--preset--font-size--small); font-weight: 500; }

/* Tickera: carrello */

.tickera-checkout { color: inherit; font-family: inherit; }

.ticket-quantity .tickera_button {
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0;
	border-radius: var(--bo-radius);
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--black);
	font: 400 24px/1 var(--bo-heading);
	cursor: pointer;
}
.ticket-quantity .tickera_button:hover { background: var(--wp--preset--color--accent); }
.ticket-quantity .quantity { width: 48px; padding: 0; border: 0; background: none; color: inherit; font: 600 18px var(--bo-heading); text-align: center; }

.tickera input.tickera_empty,
.tickera input.tickera_update {
	background: transparent;
	box-shadow: inset 0 0 0 1px currentColor;
	color: var(--wp--preset--color--white);
}
.tickera input.tickera_empty:hover,
.tickera input.tickera_update:hover { background: var(--wp--preset--color--white); color: var(--wp--preset--color--black); }

.tickera_additional_info .info_section {
	display: flow-root;
	box-sizing: border-box;
	margin-top: var(--wp--preset--spacing--40);
	padding: var(--wp--preset--spacing--40);
	border: var(--bo-border);
	border-radius: var(--bo-radius-card);
}
.tickera_additional_info .tickera_buyer_info,
.owner-info-wrap {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 16px var(--wp--custom--gutter);
}
.tickera_buyer_info > :not(.fields-wrap),
.owner-info-wrap > :not(.fields-wrap) { grid-column: 1 / -1; }
.owner-info-wrap { margin-top: 16px; }
.tickera_additional_info h2,
.tickera_additional_info h3 { float: none; margin: 0; font-size: 22px; }
.tickera_additional_info h5 { margin: 0; font-size: 18px; }
.fields-wrap input { float: none; width: 100%; }
.proceed-to-checkout-container { margin-top: var(--wp--preset--spacing--40); text-align: right; }

/*
 * Grafica fatta a mano negli eventi Pirossigeno (#diy-hero, nel contenuto dell'evento).
 * Ha i suoi stili con !important: "body #diy-hero" serve a vincere la specificità.
 * Qui la si allinea al design senza toccare il contenuto in produzione.
 */
body #diy-hero { --diy-rosso: var(--wp--preset--color--accent) !important; }
body #diy-hero .diy-tag { font-size: 12px !important; color: var(--bo-muted) !important; }
body #diy-hero .diy-match .diy-dato .val { font-family: var(--bo-heading) !important; font-weight: 500 !important; letter-spacing: 0 !important; }
body #diy-hero .diy-dato:not(.luogo) :is(.val, time) { color: var(--wp--preset--color--accent) !important; }
body #diy-hero .diy-dato + .diy-dato { border-left-color: rgb(255 255 255 / 25%) !important; }
body #diy-hero .diy-match .diy-via { color: var(--bo-muted) !important; }
body #diy-hero .diy-mappa { font-size: 13px !important; font-weight: 500 !important; text-transform: uppercase !important; letter-spacing: 0.04em !important; }
body #diy-hero .diy-mappa:hover { color: var(--wp--preset--color--accent) !important; }
body #diy-hero .diy-azione {
	border: var(--bo-border) !important;
	border-radius: var(--bo-radius-card) !important;
	background: var(--wp--preset--color--black) !important;
	backdrop-filter: none !important;
}
body #diy-hero .diy-gratis { font-family: var(--bo-heading) !important; font-weight: 500 !important; text-shadow: none !important; }
body #diy-hero .diy-gratis::before { animation: none !important; }
body #diy-hero .diy-azione .diy-cta {
	min-height: 48px !important;
	border-radius: var(--bo-radius) !important;
	font: 500 16px/1.2 var(--bo-heading) !important;
	box-shadow: none !important;
}
body #diy-hero .diy-azione .diy-cta:hover { transform: none !important; box-shadow: none !important; background: var(--wp--preset--color--accent) !important; }
body #diy-hero .diy-azione .diy-cta.is-done { background: var(--wp--preset--color--accent) !important; color: var(--wp--preset--color--black) !important; }
body #diy-hero .diy-azione .diy-cta .diy-ripple { background: rgb(0 0 0 / 15%) !important; }

/* Footer */

footer.wp-block-template-part { border-top: var(--bo-line); background: var(--wp--preset--color--black); color: var(--wp--preset--color--white); }

.bo-footer {
	max-width: var(--wp--style--global--content-size);
	margin-inline: auto;
	padding: var(--wp--preset--spacing--60) var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
	font-size: var(--wp--preset--font-size--small);
}
.bo-footer__cols { display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: var(--wp--preset--spacing--50); }
.bo-footer__logo img { display: block; height: 64px; width: auto; }
.bo-footer p { margin: 0 0 12px; }
.bo-footer__title { font: 500 18px/1.3 var(--bo-heading); }
.bo-footer ul { margin: 0; padding: 0; list-style: none; }
.bo-footer li + li { margin-top: 10px; }
.bo-footer a { color: inherit; text-decoration: none; }
.bo-footer a:hover { color: var(--wp--preset--color--accent); }
.bo-footer .bo-footer__bottom {
	margin: var(--wp--preset--spacing--60) 0 0;
	padding-top: var(--wp--preset--spacing--40);
	border-top: var(--bo-line);
	color: var(--bo-muted);
	font-size: var(--wp--preset--font-size--x-small);
	text-align: center;
}

/* Mobile */

@media (max-width: 900px) {
	.bo-main { padding-block: var(--wp--preset--spacing--40) var(--wp--preset--spacing--60); }
	.bo-header { flex-wrap: wrap; gap: 0 8px; padding-inline: var(--wp--preset--spacing--30); }
	.bo-header__logo { max-width: 120px; transition: max-width 0.4s var(--bo-ease), opacity var(--bo-speed); }
	.bo-header__logo img { height: 48px; }
	.bo-header__toggle { display: block; }

	/* Menu a tendina: l'altezza passa da 0 al contenuto con una transizione. */
	.bo-header__nav {
		display: grid;
		grid-template-rows: 0fr;
		order: 1;
		flex: 1 0 100%;
		visibility: hidden;
		transition: grid-template-rows 0.4s var(--bo-ease), visibility 0.4s;
	}
	.bo-header__nav.is-open { grid-template-rows: 1fr; visibility: visible; transition-property: grid-template-rows; }
	.bo-header__nav ul { flex-direction: column; gap: 0; min-height: 0; overflow: hidden; }
	.bo-header__nav li:first-child { padding-top: 8px; }
	.bo-header__nav li + li { border-top: var(--bo-line); }
	.bo-header__nav a { display: block; padding: 14px 0; font: 500 18px var(--bo-heading); }

	/* Ricerca aperta: prende il posto del logo. */
	.bo-header:has(.bo-search--header.is-open) .bo-header__logo { max-width: 0; opacity: 0; visibility: hidden; }
	.bo-search--header.is-open input { width: calc(100vw - 150px); }

	.bo-hero { padding-block: var(--wp--preset--spacing--30) var(--wp--preset--spacing--50); }
	.bo-hero h1 { font-size: 36px; }
	.bo-cards { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: var(--wp--preset--spacing--40) 12px; }
	.bo-card__title { font-size: 15px; }
	.bo-footer { padding-inline: var(--wp--preset--spacing--30); }
	.bo-footer__cols { grid-template-columns: 1fr; gap: var(--wp--preset--spacing--40); }

	h1 { font-size: 32px; }
	h2 { font-size: 24px; }
}

/* Telefono: margini da 16 px come nel design, carrello che sta nello schermo, campi a tutta larghezza. */
@media (max-width: 600px) {
	.bo-mobile-booking:not([hidden]) {
		display: block;
		position: fixed;
		z-index: 100;
		inset: auto 0 0;
		padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
		background: var(--wp--preset--color--black);
		border-top: var(--bo-line);
	}
	.bo-mobile-booking button {
		width: 100%;
		min-height: 48px;
		border: 0;
		border-radius: var(--bo-radius);
		background: var(--wp--preset--color--white);
		color: var(--wp--preset--color--black);
		font: 600 16px var(--wp--preset--font-family--inter);
		cursor: pointer;
	}
	.bo-mobile-booking button:focus-visible { outline-offset: -4px; }
	body:has(.wpcc-floating) .bo-mobile-booking:not([hidden]) {
		padding-left: 72px;
	}
	body:has(.bo-mobile-booking) footer.wp-block-template-part {
		padding-bottom: calc(80px + env(safe-area-inset-bottom));
	}

	html body {
		--wp--style--root--padding-left: var(--wp--preset--spacing--30);
		--wp--style--root--padding-right: var(--wp--preset--spacing--30);
	}

	.tickera th,
	.tickera td { padding: 12px 8px; }
	.tickera td.ticket-type { overflow-wrap: anywhere; }
	.tickera td.ticket-quantity { padding-inline: 4px; }
	.ticket-quantity { white-space: nowrap; }
	.ticket-quantity .inner-wrap { display: flex; flex-wrap: nowrap; align-items: center; justify-content: center; gap: 4px; }
	.ticket-quantity .tickera_button { flex: none; width: 32px; height: 32px; font-size: 18px; }
	.ticket-quantity .quantity { width: 24px; min-height: 0; }

	.tickera .update-wrap { display: flex; gap: 8px; }
	.tickera .update-wrap input { flex: 1; min-width: 0; padding-inline: 8px; }

	.tickera_additional_info .info_section { padding: var(--wp--preset--spacing--30); }
	.tickera_additional_info .tickera_buyer_info,
	.owner-info-wrap { grid-template-columns: minmax(0, 1fr); }
	.tickera .tickera-input-field { padding-inline: 16px; }
	.proceed-to-checkout-container .tickera-button,
	.proceed-to-checkout-container input { width: 100%; }
}
