/* Galería: rueda 3D de trabajos (adaptada de "Works Wheel" de 21st.dev, sin React). */

.yc-wheel {
	--yc-wheel-gold: var(--wp--preset--color--dorado, #D4A960);
	--yc-wheel-cream: #F6F3EE;
	background: #0A0A0A;
	color: var(--yc-wheel-cream);
	margin-block: 2.5rem 0;
	overflow: hidden;
}

/* Sin JavaScript: cuadrícula sencilla con las mismas fotos. */
.yc-wheel__stage {
	position: relative;
	padding: 2.5rem 1rem;
}
.yc-wheel__label {
	margin: 0 0 1.5rem;
	text-align: center;
	font-family: var(--yc-serif);
	font-size: clamp(1.5rem, 1rem + 2vw, 2.25rem);
	line-height: 1.15;
	color: #fff;
}
.yc-wheel__title,
.yc-wheel__index,
.yc-wheel__nav { display: none; }
.yc-wheel__wheel {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(14rem, 100%), 1fr));
	gap: 1rem;
	max-width: 80rem;
	margin: 0 auto;
}
.yc-wheel__card { aspect-ratio: 4 / 5; overflow: hidden; }
.yc-wheel__card img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	user-select: none;
	-webkit-user-drag: none;
}

/* Con JavaScript: escenario de altura fija desde el CSS (sin saltos de diseño). */
@media (scripting: enabled) {
	.yc-wheel__stage {
		--card-w: 13rem;
		--card-h: 16.25rem;
		--lens: 44rem;
		height: 80svh;
		min-height: 26rem;
		max-height: 56rem;
		padding: 0;
		overflow: hidden;
		user-select: none;
		-webkit-user-select: none;
	}
	.yc-wheel__label {
		position: absolute;
		inset: 50% auto auto 50%;
		z-index: 1;
		width: calc(var(--card-h) * 1.3);
		margin: 0;
		transform: translate(-50%, -50%);
		font-size: calc(var(--card-h) * .124);
		pointer-events: none;
	}
	/* Fundidos arriba y abajo en modo tambor (--yc-wheel-m lo escribe wheel.js: 0 anillo, 1 tambor). */
	.yc-wheel__stage::before,
	.yc-wheel__stage::after {
		content: "";
		position: absolute;
		left: 0;
		right: 0;
		z-index: 150;
		height: 22%;
		pointer-events: none;
		opacity: var(--yc-wheel-m, 0);
	}
	.yc-wheel__stage::before { top: 0; background: linear-gradient(#0A0A0A, rgba(10, 10, 10, 0)); }
	.yc-wheel__stage::after { bottom: 0; background: linear-gradient(rgba(10, 10, 10, 0), #0A0A0A 80%); }
	.yc-wheel__title {
		display: block;
		position: absolute;
		left: clamp(1rem, 4vw, 3.5rem);
		bottom: clamp(1.25rem, 5svh, 3.5rem);
		z-index: 200;
		max-width: min(24rem, calc(50% - var(--card-w) / 2 - 3rem));
		margin: 0;
		font-family: var(--yc-serif);
		font-size: clamp(1.25rem, calc(var(--card-h) * .124), 2.75rem);
		line-height: 1.12;
		color: #fff;
		opacity: 0;
		pointer-events: none;
	}
	.yc-wheel__title::before {
		content: "";
		display: block;
		width: 2.5rem;
		height: 1px;
		margin-bottom: .9rem;
		background: var(--yc-wheel-gold);
	}
	.yc-wheel__index {
		display: block;
		position: absolute;
		top: clamp(1rem, 5svh, 3rem);
		right: clamp(1rem, 4vw, 3.5rem);
		z-index: 200;
		max-width: min(17rem, calc(50% - var(--card-w) / 2 - 3rem));
		margin: 0;
		padding: 0;
		list-style: none;
		counter-reset: yc-wheel;
	}
	.yc-wheel__index li { counter-increment: yc-wheel; }
	.yc-wheel__index button {
		display: flex;
		gap: .6em;
		width: 100%;
		padding: .28em 0;
		border: 0;
		background: none;
		color: rgba(246, 243, 238, .5);
		font-family: var(--yc-sans);
		font-size: clamp(.75rem, calc(var(--card-h) * .04), .9rem);
		line-height: 1.3;
		text-align: left;
		cursor: pointer;
		transition: color .2s;
	}
	.yc-wheel__index button::before {
		content: counter(yc-wheel, decimal-leading-zero);
		flex: none;
		font-variant-numeric: tabular-nums;
		opacity: .7;
	}
	.yc-wheel__index button:hover { color: var(--yc-wheel-cream); }
	.yc-wheel__index button[aria-current="true"] { color: var(--yc-wheel-gold); }
	.yc-wheel__viewport {
		position: absolute;
		inset: 0;
		perspective: var(--lens);
		cursor: grab;
		touch-action: pan-y;
		outline: none;
	}
	.yc-wheel__viewport.is-dragging { cursor: grabbing; }
	.yc-wheel__viewport:focus-visible {
		outline: 2px solid var(--yc-wheel-gold);
		outline-offset: -6px;
	}
	.yc-wheel__wheel {
		display: block;
		position: absolute;
		inset: 0;
		max-width: none;
		transform-style: preserve-3d;
	}
	.yc-wheel__card {
		position: absolute;
		left: calc(50% - var(--card-w) / 2);
		top: calc(50% - var(--card-h) / 2);
		width: var(--card-w);
		height: var(--card-h);
		aspect-ratio: auto;
		background: #1a1a1a;
		box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, .45);
		backface-visibility: hidden;
		will-change: transform;
		visibility: hidden; /* hasta que wheel.js coloque la tarjeta */
	}
	.yc-wheel.is-ready .yc-wheel__card { visibility: visible; }
	.yc-wheel__card[aria-selected="true"] { box-shadow: 0 0 0 1px var(--yc-wheel-gold), 0 1.5rem 3rem rgba(0, 0, 0, .45); }
	.yc-wheel__viewport:focus-visible .yc-wheel__card[aria-selected="true"] {
		box-shadow: 0 0 0 2px var(--yc-wheel-gold), 0 1.5rem 3rem rgba(0, 0, 0, .45);
	}
	.yc-wheel__card img { pointer-events: none; }

	/* Táctil: se gira deslizando en horizontal o con los botones; el desplazamiento vertical queda libre. */
	.yc-wheel__nav {
		position: absolute;
		right: clamp(1rem, 4vw, 3.5rem);
		bottom: clamp(1.25rem, 5svh, 3.5rem);
		z-index: 200;
		gap: .5rem;
	}
	.yc-wheel__nav button {
		display: grid;
		place-items: center;
		width: 2.75rem;
		height: 2.75rem;
		padding: 0;
		border: 1px solid rgba(212, 169, 96, .6);
		border-radius: 50%;
		background: rgba(10, 10, 10, .6);
		color: var(--yc-wheel-gold);
		font-size: 1.1rem;
		line-height: 1;
		cursor: pointer;
	}
	.yc-wheel__nav button:disabled { opacity: .35; cursor: default; }
	.yc-wheel__nav button:focus-visible,
	.yc-wheel__index button:focus-visible {
		outline: 2px solid var(--yc-wheel-gold);
		outline-offset: 2px;
	}
	@media (pointer: coarse), (max-width: 781px) {
		.yc-wheel__nav { display: flex; }
	}
	@media (max-width: 781px) {
		.yc-wheel__index { display: none; }
		.yc-wheel__stage::after { height: 34%; }
		.yc-wheel__title {
			right: 8rem;
			text-shadow: 0 1px 12px rgba(0, 0, 0, .8);
			max-width: none;
			font-size: clamp(1.15rem, 5vw, 1.5rem);
		}
	}
}
