/* Homepage hero bottle scene. Shown only on large screens with a mouse; elsewhere the hero keeps its photo. */
.rt-scena {
	display: none;
}

@media (min-width: 1025px) and (hover: hover) and (pointer: fine) {
	/* The hero section carries the global class "hero-scena": drop its static photo when the scene runs. */
	.hero-scena.rt-scena-attiva {
		background-image: none !important;
	}

	/* The text row spans the full width above the scene: let the mouse through to the bottles,
	   except on the actual text and buttons. */
	.hero-scena.rt-scena-attiva > :not(.rt-scena) {
		position: relative;
		z-index: 1;
		pointer-events: none;
	}

	.hero-scena.rt-scena-attiva > :not(.rt-scena) :is(a, button, h1, h2, h5, p) {
		pointer-events: auto;
	}

	.rt-scena {
		position: absolute;
		top: 0;
		right: 0;
		bottom: 0;
		display: block;
		width: 58%;
		overflow: hidden;
		pointer-events: none;
	}

	.rt-bottiglia {
		position: absolute;
		top: var(--y);
		left: var(--x);
		height: var(--h);
		aspect-ratio: 285 / 1100;
		pointer-events: auto;
		cursor: pointer;
		/* Depth of field: --off is this bottle's distance from the focus depth (set by hero.js, 0 = in focus).
		   Default focus is the front row, so far bottles start soft. */
		--off: calc(1 - var(--d));
		filter: blur(calc(var(--off) * 4px)) saturate(calc(1 - var(--off) * 0.25)) brightness(calc(1 + var(--off) * 0.08));
		transform: translate3d(var(--px, 0px), var(--py, 0px), 0) rotate(var(--r));
		transform-origin: 50% 85%;
		transition: filter 0.55s cubic-bezier(0.25, 0.1, 0.25, 1);
		will-change: transform;
	}

	.rt-bottiglia img {
		display: block;
		width: 100%;
		height: 100%;
		object-fit: contain;
		opacity: 0;
		transition: opacity 0.6s;
		filter: drop-shadow(0 calc(var(--d) * 28px) calc(var(--d) * 24px) rgba(29, 29, 27, calc(var(--d) * 0.28)));
	}

	.rt-bottiglia img.is-loaded {
		opacity: 1;
	}

	.rt-bottiglia.is-wobble img {
		animation: rt-wobble 0.7s cubic-bezier(0.36, 0.07, 0.19, 0.97);
	}

	.rt-bottiglia.is-nudge img {
		animation: rt-nudge 0.5s ease-out;
	}

	.rt-bottiglia__nome {
		position: absolute;
		left: 50%;
		bottom: -0.5rem;
		padding: 0.35rem 0.8rem;
		font-family: Montserrat, sans-serif;
		font-size: 0.8125rem;
		font-weight: 600;
		white-space: nowrap;
		color: #1D1D1B;
		background: #fff;
		border-radius: 999px;
		box-shadow: 0 6px 18px rgba(29, 29, 27, 0.12);
		transform: translate(-50%, 0.5rem) rotate(calc(var(--r) * -1));
		visibility: hidden; /* only marks where the scene label goes (hero.js) */
		pointer-events: none;
	}

	.rt-bottiglia:hover .rt-bottiglia__nome {
		transform: translate(-50%, 0) rotate(calc(var(--r) * -1));
	}

	/* The label actually shown, on top of every bottle. */
	.rt-scena__nome {
		position: absolute;
		z-index: 30;
		padding: 0.35rem 0.8rem;
		font-family: Montserrat, sans-serif;
		font-size: 0.8125rem;
		font-weight: 600;
		white-space: nowrap;
		color: #1D1D1B;
		background: #fff;
		border-radius: 999px;
		box-shadow: 0 6px 18px rgba(29, 29, 27, 0.12);
		transform: translate(-50%, -50%);
		opacity: 0;
		transition: opacity 0.2s;
		pointer-events: none;
	}

	.rt-scena__nome.is-visibile {
		opacity: 1;
	}

	.rt-bottiglia.rt-nome-sopra .rt-bottiglia__nome {
		top: -0.5rem;
		bottom: auto;
		transform: translate(-50%, calc(-100% - 0.5rem)) rotate(calc(var(--r) * -1));
	}

	.rt-bottiglia.rt-nome-sopra:hover .rt-bottiglia__nome {
		transform: translate(-50%, -100%) rotate(calc(var(--r) * -1));
	}

	/* Doubled class: beats the kit's global button styles. */
	.rt-scena .rt-scena__suono.rt-scena__suono {
		position: absolute;
		right: 1.5rem;
		bottom: 1.5rem;
		z-index: 20;
		width: 2.5rem;
		height: 2.5rem;
		padding: 0;
		pointer-events: auto;
		color: #1D1D1B;
		min-height: 0;
		background: rgba(255, 255, 255, 0.85) no-repeat center / 1.1rem;
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231D1D1B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4V5z'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7M19 5a10 10 0 0 1 0 14'/%3E%3C/svg%3E");
		border: 0;
		border-radius: 50%;
		box-shadow: 0 4px 14px rgba(29, 29, 27, 0.1);
		cursor: pointer;
	}

	.rt-scena .rt-scena__suono.rt-scena__suono[aria-pressed="false"] {
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231D1D1B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4V5z'/%3E%3Cpath d='m23 9-6 6M17 9l6 6'/%3E%3C/svg%3E");
	}
}

@keyframes rt-wobble {
	0% { transform: rotate(0deg); }
	18% { transform: rotate(-9deg) translateY(-6px); }
	38% { transform: rotate(7deg); }
	58% { transform: rotate(-4deg); }
	78% { transform: rotate(2deg); }
	100% { transform: rotate(0deg); }
}

@keyframes rt-nudge {
	0% { transform: rotate(0deg); }
	35% { transform: rotate(3.5deg); }
	70% { transform: rotate(-1.5deg); }
	100% { transform: rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
	.rt-bottiglia,
	.rt-bottiglia img {
		animation: none !important;
		transition: none !important;
	}
}
