/*
Theme Name:   Jasmin
Template:     twentytwentyfour
Description:  Tema child di Twenty Twenty-Four per Jasmin Buijs Intervisie.
Version:      1.6.0
Requires at least: 6.7
Requires PHP: 7.4
License:      GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  jasmin
*/

/* ---------- Focus ---------- */

/*
 * Niente riquadro attorno a link e pulsanti quando si clicca col mouse o si tocca:
 * l'indicatore di focus resta solo per chi naviga da tastiera (accessibilità).
 */
:where(.wp-site-blocks) :is(a, button, summary, [tabindex]):focus:not(:focus-visible) {
	outline: none;
	box-shadow: none;
}

a,
button,
summary {
	-webkit-tap-highlight-color: transparent;
}

:where(.wp-site-blocks) :is(a, button, summary):focus-visible {
	outline: 2px solid var(--wp--preset--color--accent-2);
	outline-offset: 3px;
	border-radius: 4px;
}

/* ---------- Header ---------- */

/*
 * Header agganciato in alto: il "top" negativo pari all'altezza della barra
 * contatti la fa scorrere via, mentre logo e menu restano visibili.
 * --jb-topbar-h è misurata da assets/js/front.js.
 */
.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: calc(-1 * var(--jb-topbar-h, 0px));
	z-index: 100;
}

@media (min-width: 783px) {
	.admin-bar .wp-site-blocks > header.wp-block-template-part {
		top: calc(var(--wp-admin--admin-bar--height, 32px) - var(--jb-topbar-h, 0px));
	}
}

.wp-site-blocks > header.wp-block-template-part a {
	text-decoration: none;
}

.wp-site-blocks > header.wp-block-template-part > .wp-block-group:first-child p {
	line-height: 1.4;
}

.wp-site-blocks > header.wp-block-template-part > .wp-block-group:last-child {
	transition: box-shadow 0.35s ease, background-color 0.35s ease;
}

.wp-site-blocks > header.wp-block-template-part.is-scrolled > .wp-block-group:last-child {
	box-shadow: 0 6px 24px rgba(54, 59, 18, 0.08);
}

.wp-site-blocks > header .wp-block-site-logo img {
	transition: transform 0.35s ease;
	transform-origin: left center;
}

.wp-site-blocks > header.is-scrolled .wp-block-site-logo img {
	transform: scale(0.86);
}

/* Sotto i 600px la barra contatti va a capo centrata. */
@media (max-width: 600px) {
	.wp-site-blocks > header.wp-block-template-part > .wp-block-group:first-child > .wp-block-group {
		justify-content: center;
		column-gap: 1rem;
	}
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Sezioni della pagina una sotto l'altra, senza spazi tra gli sfondi. */
.wp-site-blocks .wp-block-post-content > .alignfull {
	margin-block-start: 0;
	margin-block-end: 0;
}

.wp-site-blocks > footer.wp-block-template-part,
.wp-site-blocks > main + footer {
	margin-block-start: 0;
}

/* ---------- Testi ---------- */

.wp-block-heading mark.has-inline-color {
	background: none;
}

/* Etichetta oro ("Wie ik ben", "Wat ik doe"...). */
p.is-style-jb-badge {
	width: fit-content;
	padding: 0.3em 0.95em;
	border-radius: 999px;
	background: var(--wp--preset--color--accent-2);
	color: var(--wp--preset--color--base-2);
	font-size: 0.72rem;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0.02em;
	text-transform: capitalize;
}

/* Tag trasparente sulle card verdi. */
p.is-style-jb-tag {
	width: fit-content;
	margin: 0;
	padding: 0.4em 0.95em;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.22);
	font-size: 0.75rem;
	line-height: 1.3;
}

/* Elenco con spunte oro. */
ul.is-style-jb-check {
	padding-left: 0;
	list-style: none;
}

ul.is-style-jb-check li {
	position: relative;
	padding-left: 1.9rem;
	margin-block: 0.45rem;
}

ul.is-style-jb-check li::before {
	content: "";
	position: absolute;
	top: 0.3em;
	left: 0;
	width: 1.15rem;
	height: 1.15rem;
	border-radius: 50%;
	background: var(--wp--preset--color--accent-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M4 8.5l2.6 2.5L12 5.5'/%3E%3C/svg%3E") center / 75% no-repeat;
}

/* ---------- Pulsanti ---------- */

.wp-block-button.is-style-jb-gold .wp-block-button__link {
	background-color: var(--wp--preset--color--accent-2);
	border-color: var(--wp--preset--color--accent-2);
	color: var(--wp--preset--color--base-2);
	border-radius: 999px;
}

.wp-block-button.is-style-jb-gold .wp-block-button__link:hover,
.wp-block-button.is-style-jb-gold .wp-block-button__link:focus {
	background-color: var(--wp--preset--color--base-2);
	border-color: var(--wp--preset--color--base-2);
	color: var(--wp--preset--color--accent);
}

/* ---------- Card con immagine ("Online" / "Italië") ---------- */

.wp-block-cover.is-style-jb-zoom {
	overflow: hidden;
}

.wp-block-cover.is-style-jb-zoom .wp-block-cover__image-background {
	transition: transform 0.6s ease;
}

.wp-block-cover.is-style-jb-zoom:hover .wp-block-cover__image-background {
	transform: scale(1.06);
}

.wp-block-cover.is-style-jb-zoom a {
	text-decoration: none;
}

/* Tutta la card è cliccabile tramite il link del titolo. */
.wp-block-cover.is-style-jb-zoom a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
}

/* ---------- Motivo "JB" leggero sulle card verdi ---------- */

.wp-block-group.is-style-jb-evento,
.wp-block-column.is-style-jb-pattern {
	position: relative;
	isolation: isolate;
	overflow: hidden;
}

.wp-block-group.is-style-jb-evento::before,
.wp-block-column.is-style-jb-pattern::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: url("assets/img/jb-monogramma-chiaro.png") repeat 0 0 / 56px 72px;
	pointer-events: none;
}

/* ---------- Righe evento (Query Loop) ---------- */

.wp-block-group.is-style-jb-evento p {
	margin: 0;
	text-align: center;
	line-height: 1.35;
}

/* Linea verticale sottile tra i campi. */
.wp-block-group.is-style-jb-evento > .wp-block-group > .wp-block-group + .wp-block-group {
	border-left: 1px solid rgba(255, 255, 255, 0.25);
}

/* Fascia dati statica (pagine viaggio): i campi sono figli diretti della griglia. */
.wp-block-group.is-style-jb-evento.is-layout-grid > .wp-block-group + .wp-block-group {
	border-left: 1px solid rgba(255, 255, 255, 0.25);
}

@media (max-width: 781px) {
	.wp-block-group.is-style-jb-evento.is-layout-grid > .wp-block-group + .wp-block-group {
		border-left: 0;
	}

	.wp-block-group.is-style-jb-evento {
		flex-wrap: wrap !important;
		justify-content: center !important;
	}

	.wp-block-group.is-style-jb-evento > .wp-block-group {
		flex-basis: 100%;
	}

	.wp-block-group.is-style-jb-evento > .wp-block-group > .wp-block-group + .wp-block-group {
		border-left: 0;
	}
}

/* ---------- Recensioni ---------- */

.wp-block-quote.is-style-jb-testimonial {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	text-align: center;
	font-size: var(--wp--preset--font-size--small);
}

.wp-block-quote.is-style-jb-testimonial cite {
	display: block;
	margin-top: var(--wp--preset--spacing--20);
	font-style: normal;
	font-weight: 500;
	opacity: 0.85;
}

/* ---------- Citazione con virgolette oro (hero pagine viaggio) ---------- */

.wp-block-quote.is-style-jb-citaat {
	position: relative;
	max-width: 32rem;
	margin: 0;
	padding: 0.25rem 0 0.25rem 2.75rem;
	border: 0;
	background: none;
	color: var(--wp--preset--color--contrast-2);
	font-size: var(--wp--preset--font-size--medium);
}

.wp-block-quote.is-style-jb-citaat::before {
	content: "“";
	position: absolute;
	top: -0.35rem;
	left: 0;
	color: var(--wp--preset--color--accent-2);
	font-family: var(--wp--preset--font-family--heading);
	font-size: 4rem;
	line-height: 1;
}

/* ---------- FAQ ---------- */

.wp-block-details.is-style-jb-faq {
	padding: 1.1rem 1.5rem;
	border: 1px solid var(--wp--preset--color--accent-4);
	border-radius: 28px;
	background: var(--wp--preset--color--base-2);
	transition: border-color 0.2s ease;
}

.wp-block-details.is-style-jb-faq[open] {
	border-color: var(--wp--preset--color--accent-2);
}

.wp-block-details.is-style-jb-faq summary {
	position: relative;
	padding-right: 2rem;
	list-style: none;
	cursor: pointer;
	color: var(--wp--preset--color--accent);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
}

.wp-block-details.is-style-jb-faq summary::-webkit-details-marker {
	display: none;
}

.wp-block-details.is-style-jb-faq summary::after {
	content: "+";
	position: absolute;
	top: 50%;
	right: 0;
	transform: translateY(-50%);
	font-size: 1.25rem;
	line-height: 1;
	transition: transform 0.2s ease;
}

.wp-block-details.is-style-jb-faq[open] summary::after {
	transform: translateY(-50%) rotate(45deg);
}

.wp-block-details.is-style-jb-faq[open] summary {
	margin-bottom: 0.75rem;
}

/* ---------- Contact Form 7 (pagina Contact) ---------- */

.wp-block-contact-form-7-contact-form-selector {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	padding: var(--wp--preset--spacing--40);
	border-radius: 16px;
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--base-2);
}

.wp-block-contact-form-7-contact-form-selector::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: url("assets/img/jb-monogramma-chiaro.png") repeat 0 0 / 56px 72px;
	pointer-events: none;
}

.wpcf7 .jb-form__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
	gap: var(--wp--preset--spacing--20);
}

.wpcf7 .jb-form__field {
	display: grid;
	gap: 0.35rem;
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
}

.wpcf7 .jb-form__field--wide {
	grid-column: 1 / -1;
}

.wpcf7 .wpcf7-form-control-wrap {
	display: block;
}

.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 input[type="tel"],
.wpcf7 textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 0.7rem 0.9rem;
	border: 1px solid transparent;
	border-radius: 8px;
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	font: inherit;
	font-size: var(--wp--preset--font-size--medium);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wpcf7 input:focus,
.wpcf7 textarea:focus {
	outline: none;
	border-color: var(--wp--preset--color--accent-2);
	box-shadow: 0 0 0 3px rgba(220, 176, 75, 0.35);
}

.wpcf7 .jb-form__check {
	margin: var(--wp--preset--spacing--20) 0 0;
	font-size: var(--wp--preset--font-size--small);
}

.wpcf7 .wpcf7-list-item {
	margin: 0;
}

.wpcf7 .wpcf7-acceptance label {
	display: flex;
	gap: 0.6rem;
	align-items: flex-start;
	cursor: pointer;
}

.wpcf7 .wpcf7-acceptance input {
	margin-top: 0.3rem;
	accent-color: var(--wp--preset--color--accent-2);
}

.wpcf7 .jb-form__check a {
	color: var(--wp--preset--color--accent-2);
}

.wpcf7 .jb-form__submit {
	position: relative;
	margin: var(--wp--preset--spacing--20) 0 0;
}

.wpcf7 .wpcf7-submit {
	width: 100%;
	padding: 0.85rem 1.25rem;
	border: 0;
	border-radius: 999px;
	background: var(--wp--preset--color--accent-2);
	color: var(--wp--preset--color--base-2);
	font: inherit;
	font-weight: 500;
	cursor: pointer;
	transition: background-color 0.25s ease, color 0.25s ease;
}

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

.wpcf7 .wpcf7-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.wpcf7 .wpcf7-spinner {
	position: absolute;
	top: 50%;
	right: 1rem;
	margin: -12px 0 0;
}

.wpcf7 .wpcf7-not-valid-tip {
	margin-top: 0.3rem;
	color: #ffd7a8;
	font-size: 0.8rem;
}

.wpcf7 form .wpcf7-response-output {
	margin: var(--wp--preset--spacing--20) 0 0;
	padding: 0.8rem 1rem;
	border: 0;
	border-radius: 8px;
	background: var(--wp--preset--color--base-2);
	color: var(--wp--preset--color--accent);
	font-size: var(--wp--preset--font-size--small);
}

.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.failed .wpcf7-response-output,
.wpcf7 form.spam .wpcf7-response-output,
.wpcf7 form.unaccepted .wpcf7-response-output {
	background: #fbe9e7;
	color: #8a1c0f;
}

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

.wp-site-blocks > footer a {
	text-decoration: none;
}

.wp-site-blocks > footer a:hover {
	text-decoration: underline;
}

/* ---------- Pannelli "chi sono" impilati ---------- */

.wp-block-media-text.is-style-jb-stack {
	position: relative;
	overflow: hidden;
	box-shadow: 0 -12px 40px rgba(31, 33, 23, 0.08);
}

.wp-block-media-text.is-style-jb-stack .wp-block-media-text__content {
	position: relative;
	z-index: 1;
	padding: var(--wp--preset--spacing--40);
}

/* Cerchi dorati decorativi sui pannelli scuri, nell'angolo del testo. */
.wp-block-media-text.is-style-jb-stack:is(.has-accent-background-color, .has-accent-3-background-color)::before {
	content: "";
	position: absolute;
	bottom: 0;
	left: 0;
	width: min(30%, 190px);
	aspect-ratio: 300 / 261;
	background: url("assets/img/cerchi-oro.png") no-repeat left bottom / contain;
	opacity: 0.85;
	pointer-events: none;
	transform: scaleX(-1);
}

.wp-block-media-text.is-style-jb-stack.has-media-on-the-right::before {
	left: auto;
	right: 50%;
	transform: none;
}

/* Su schermi stretti i pannelli sono in colonna: niente decorazione sopra il testo. */
@media (max-width: 899px) {
	.wp-block-media-text.is-style-jb-stack::before {
		display: none;
	}
}

.wp-block-media-text.is-style-jb-stack .wp-block-media-text__content > * + * {
	margin-block-start: var(--wp--preset--spacing--20);
}

@media (min-width: 900px) {
	/* Ogni pannello resta agganciato sotto l'header e il successivo gli scorre sopra. */
	.wp-block-media-text.is-style-jb-stack {
		position: sticky;
		top: calc(var(--wp-admin--admin-bar--height, 0px) + 7rem);
	}

	.wp-block-media-text.is-style-jb-stack + .wp-block-media-text.is-style-jb-stack {
		top: calc(var(--wp-admin--admin-bar--height, 0px) + 8.25rem);
	}

	.wp-block-media-text.is-style-jb-stack + .wp-block-media-text.is-style-jb-stack + .wp-block-media-text.is-style-jb-stack {
		top: calc(var(--wp-admin--admin-bar--height, 0px) + 9.5rem);
	}

	.wp-block-media-text.is-style-jb-stack .wp-block-media-text__content {
		padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
	}
}

/* Leggero zoom della foto mentre il pannello entra (browser con scroll-driven animations). */
@supports (animation-timeline: view()) {
	.jb-motion .wp-block-media-text.is-style-jb-stack .wp-block-media-text__media img {
		animation: jb-photo-settle linear both;
		animation-timeline: view();
		animation-range: entry 0% cover 45%;
	}
}

@keyframes jb-photo-settle {
	from {
		transform: scale(1.12);
	}

	to {
		transform: scale(1);
	}
}

/* ---------- Animazioni ---------- */

/* Parola che ruota nel titolo hero. */
.wp-block-heading mark.has-inline-color {
	display: inline-block;
	transition: opacity 0.45s ease, transform 0.45s ease, filter 0.45s ease;
}

.wp-block-heading mark.is-leaving {
	opacity: 0;
	transform: translateY(0.25em);
	filter: blur(4px);
}

/* Comparsa allo scroll: classi aggiunte da front.js. */
.jb-motion .jb-anim {
	opacity: 0;
	transform: translateY(28px);
	transition:
		opacity 0.8s cubic-bezier(0.2, 0.65, 0.3, 1) var(--jb-delay, 0ms),
		transform 0.8s cubic-bezier(0.2, 0.65, 0.3, 1) var(--jb-delay, 0ms);
}

/* Solo finché la riga non è entrata: poi torna esattamente al suo posto. */
.jb-motion .wp-block-post-template > li.jb-anim:not(.jb-in) {
	transform: translateX(-28px);
}

.jb-motion .wp-block-cover.jb-anim {
	transform: scale(0.96);
}

.jb-motion .jb-anim.jb-in {
	opacity: 1;
	transform: none;
}

/* Icone dei vantaggi: piccolo "pop" quando compaiono. */
.jb-motion .wp-block-column.jb-anim .wp-block-image img[width="72"],
.jb-motion .wp-block-column.jb-anim .wp-block-image img[style*="72px"] {
	transform: scale(0.7);
	transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) calc(var(--jb-delay, 0ms) + 0.15s);
}

.jb-motion .wp-block-column.jb-anim.jb-in .wp-block-image img {
	transform: none;
}

/* Hero al caricamento: testo che sale, video che si apre. */
.jb-motion .wp-block-post-content > .alignfull:first-child .wp-block-column > * {
	animation: jb-rise 0.9s cubic-bezier(0.2, 0.65, 0.3, 1) both;
}

.jb-motion .wp-block-post-content > .alignfull:first-child .wp-block-column > :nth-child(2) {
	animation-delay: 0.12s;
}

.jb-motion .wp-block-post-content > .alignfull:first-child .wp-block-column > :nth-child(3) {
	animation-delay: 0.24s;
}

.jb-motion .wp-block-post-content > .alignfull:first-child .wp-block-column + .wp-block-column > * {
	animation-delay: 0.35s;
}

.jb-motion .wp-block-post-content > .alignfull:first-child > .wp-block-cover {
	animation: jb-unveil 1.3s cubic-bezier(0.65, 0, 0.35, 1) 0.2s both;
}

@keyframes jb-rise {
	from {
		opacity: 0;
		transform: translateY(24px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes jb-unveil {
	from {
		clip-path: inset(12% 8% 0 8% round 28px);
		opacity: 0.4;
	}

	to {
		clip-path: inset(0 0 0 0 round 0);
		opacity: 1;
	}
}

/* ---------- Micro interazioni ---------- */

.wp-block-button__link {
	transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.wp-block-button__link:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 20px rgba(54, 59, 18, 0.18);
}

.wp-block-group.is-style-jb-evento {
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.wp-block-group.is-style-jb-evento:hover {
	transform: translateY(-3px);
	box-shadow: 0 14px 30px rgba(54, 59, 18, 0.22);
}

.wp-block-column.has-accent-background-color {
	transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.wp-block-column.has-accent-background-color:hover {
	transform: translateY(-4px);
	box-shadow: 0 18px 36px rgba(54, 59, 18, 0.22);
}

.wp-block-column .wp-block-image img {
	transition: transform 0.4s ease;
}

.wp-block-column:hover > .wp-block-image.aligncenter img[style*="72px"] {
	transform: translateY(-6px);
}

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

/* ---------- Hero homepage su mobile: tutto centrato ---------- */

@media (max-width: 781px) {
	.home .wp-block-post-content > .alignfull:first-child .wp-block-column {
		text-align: center;
	}

	.home .wp-block-post-content > .alignfull:first-child .wp-block-buttons {
		justify-content: center;
	}
}

/* ---------- Testo verde oliva su tutto il sito ---------- */

body {
	color: var(--wp--preset--color--accent);
}

.wp-site-blocks > footer .has-contrast-2-color {
	color: var(--wp--preset--color--accent) !important;
}
