/* Ruleta de la Fortuna para WooCommerce — frontend.
 * Colours come from the plugin settings (--wwof-primary / --wwof-secondary,
 * Dogo Blanco by default); fonts are inherited from the theme so the wheel
 * looks native in any shop. Theme button/list styles are neutralised locally.
 */

.wwof,
.wwof-invite,
.wwof-reminder {
	--wwof-primary: #800e13;
	--wwof-secondary: #e9e2d8;
	--wwof-ink: #2e3031;
	--wwof-primary-dark: color-mix(in srgb, var(--wwof-primary) 70%, #000);
	--wwof-primary-soft: color-mix(in srgb, var(--wwof-primary) 10%, #fff);
	--wwof-radius: 22px;
}

.wwof,
.wwof-invite,
.wwof-reminder {
	/* Fixed base: some themes shrink the root font (html { font-size: 62.5% }). */
	font-size: 16px;
}

.wwof {
	position: relative;
	container-type: inline-size;
	/* A size container has no content width of its own: always take the row. */
	width: 100%;
	max-width: 1000px;
	margin: 0 auto;
	color: var(--wwof-ink);
	font-family: inherit;
	line-height: 1.5;
	box-sizing: border-box;
}

.wwof *,
.wwof *::before,
.wwof *::after {
	box-sizing: border-box;
}

.wwof__layout {
	display: grid;
	grid-template-columns: minmax(260px, 450px) minmax(260px, 1fr);
	gap: clamp(24px, 5vw, 56px);
	align-items: center;
	padding: clamp(20px, 4vw, 44px);
	border-radius: var(--wwof-radius);
	background:
		radial-gradient(circle at 18% 30%, rgba(255, 255, 255, .55), transparent 55%),
		var(--wwof-secondary);
}



/* --------------------------------- Wheel --------------------------------- */

.wwof__wheel-col {
	width: 100%;
}

.wwof__wheel {
	position: relative;
	width: 100%;
	max-width: 440px;
	margin: 0 auto;
	aspect-ratio: 1 / 1;
	filter: drop-shadow(0 18px 24px rgba(60, 10, 12, .22));
}

.wwof__rim,
.wwof__disc {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.wwof__disc {
	border-radius: 50%;
	overflow: hidden;
}

.wwof__svg {
	display: block;
	width: 100%;
	height: 100%;
	transform-origin: 50% 50%;
	will-change: transform;
}

.wwof__rim-ring { fill: var(--wwof-primary); }
.wwof__rim-inner { fill: var(--wwof-primary-dark); }

.wwof__bulb {
	fill: #fff6d5;
	animation: wwof-bulb 1.6s ease-in-out infinite;
}
.wwof__bulb.is-odd { animation-delay: .8s; }
.wwof.is-spinning .wwof__bulb { animation-duration: .35s; }

@keyframes wwof-bulb {
	0%, 100% { opacity: 1; }
	50% { opacity: .35; }
}

.wwof__sector {
	stroke: rgba(255, 255, 255, .85);
	stroke-width: 1.2;
	transition: filter .2s;
}
.wwof__sector.is-winner { animation: wwof-flash .45s ease-in-out 4; }

@keyframes wwof-flash {
	0%, 100% { filter: brightness(1); }
	50% { filter: brightness(1.45) saturate(1.2); }
}

.wwof__label {
	font-family: inherit;
	font-weight: 700;
	letter-spacing: .01em;
	pointer-events: none;
	user-select: none;
}

.wwof__pointer {
	position: absolute;
	left: 50%;
	top: -4.5%;
	width: 12%;
	transform: translateX(-50%);
	transform-origin: 50% 30%;
	z-index: 3;
	pointer-events: none;
	filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .3));
}
.wwof__pointer-svg { display: block; width: 100%; height: auto; }
.wwof__pointer-body { fill: #fff; stroke: var(--wwof-primary-dark); stroke-width: 2; }
.wwof__pointer-dot { fill: var(--wwof-primary); }

.wwof__hub {
	all: unset;
	position: absolute;
	left: 50%;
	top: 50%;
	width: 21%;
	aspect-ratio: 1 / 1;
	transform: translate(-50%, -50%);
	z-index: 2;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: #fff;
	color: var(--wwof-primary);
	box-shadow: 0 0 0 5px var(--wwof-primary), 0 6px 14px rgba(0, 0, 0, .3), inset 0 -4px 0 rgba(0, 0, 0, .08);
	cursor: pointer;
	transition: transform .2s ease;
}
.wwof__hub:hover:not(:disabled) { transform: translate(-50%, -50%) scale(1.07); }
.wwof__hub:disabled { cursor: default; }
.wwof__hub svg { width: 46%; height: auto; }

/* Original module skins (1-7): raster art of 450x731 with the disc on top. */
.wwof--legacy .wwof__wheel {
	aspect-ratio: 450 / 731;
	max-width: 360px;
	background: no-repeat top center / 100% 100%;
	filter: none;
}
.wwof--skin-1 .wwof__wheel { background-image: url(../img/wheel-bg-1.png); }
.wwof--skin-2 .wwof__wheel { background-image: url(../img/wheel-bg2.png); }
.wwof--skin-3 .wwof__wheel { background-image: url(../img/wheel-bg3.png); }
.wwof--skin-4 .wwof__wheel { background-image: url(../img/wheel-bg4.png); }
.wwof--skin-5 .wwof__wheel { background-image: url(../img/wheel-bg5.png); }
.wwof--skin-6 .wwof__wheel { background-image: url(../img/wheel-bg6.png); }
.wwof--skin-7 .wwof__wheel { background-image: url(../img/wheel-bg7.png); }
.wwof--legacy .wwof__disc {
	inset: auto;
	left: 50%;
	top: 8.96%;
	width: 90.22%;
	height: 55.54%;
	transform: translateX(-50%);
}
.wwof--legacy .wwof__pointer {
	top: -1.09%;
	width: 5.11%;
	aspect-ratio: 23 / 91;
	background: url(../img/marker.png) no-repeat center / 100% 100%;
}
.wwof--legacy .wwof__hub-img {
	position: absolute;
	left: 50%;
	top: 36.73%;
	width: 27.56%;
	height: 17.78%;
	transform: translate(-50%, -50%);
	background: url(../img/center.png) no-repeat center / 100% 100%;
	z-index: 2;
	pointer-events: none;
}

/* --------------------------------- Panel --------------------------------- */

.wwof__panel {
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;
	max-width: 460px;
}

.wwof .wwof__title {
	margin: 0;
	color: var(--wwof-primary);
	font-size: clamp(1.65em, 3.2vw, 2.4em);
	line-height: 1.12;
}

.wwof__subtitle {
	margin: 0;
	font-size: 1.05em;
	opacity: .85;
}
.wwof__subtitle p { margin: 0; }

.wwof .wwof__left {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.wwof .wwof__left:empty { display: none; }

.wwof__chip {
	margin: 0;
	padding: 6px 14px;
	border-radius: 999px;
	background: #fff;
	color: var(--wwof-primary);
	font-size: .88em;
	font-weight: 600;
	box-shadow: 0 1px 0 rgba(0, 0, 0, .06);
}
.wwof__chip::before { content: "🎯 "; }
.wwof__chip.is-empty { color: #7a7a7a; }

.wwof__consents {
	display: flex;
	flex-direction: column;
	gap: 10px;
	text-align: left;
}

.wwof .wwof__consent {
	position: relative;
	display: flex;
	gap: 10px;
	align-items: flex-start;
	margin: 0;
	font-size: .93em;
	font-weight: 400;
	cursor: pointer;
}
.wwof__consent input {
	position: absolute;
	opacity: 0;
	width: 22px;
	height: 22px;
	margin: 0;
	cursor: pointer;
}
.wwof__check {
	flex: 0 0 22px;
	height: 22px;
	border: 2px solid var(--wwof-primary);
	border-radius: 7px;
	background: #fff;
	transition: background .15s;
	position: relative;
}
.wwof__consent input:checked + .wwof__check { background: var(--wwof-primary); }
.wwof__consent input:checked + .wwof__check::after {
	content: "";
	position: absolute;
	left: 6px;
	top: 2px;
	width: 6px;
	height: 11px;
	border: solid #fff;
	border-width: 0 2.5px 2.5px 0;
	transform: rotate(45deg);
}
.wwof__consent input:focus-visible + .wwof__check { outline: 3px solid color-mix(in srgb, var(--wwof-primary) 40%, transparent); outline-offset: 2px; }
.wwof.needs-consent .wwof__check { animation: wwof-nudge 1.8s ease-in-out infinite; }
@keyframes wwof-nudge {
	0%, 70%, 100% { box-shadow: none; }
	80% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--wwof-primary) 25%, transparent); }
}
.wwof__consent-text a { color: inherit; text-decoration: underline; }

.wwof__message {
	margin: 0;
	padding: 10px 14px;
	border-radius: 12px;
	background: rgba(255, 255, 255, .7);
	font-size: .95em;
}
.wwof__message.is-error { background: #fbeaea; color: #8a1c1c; }

.wwof .wwof__play,
.wwof .wwof__btn,
.wwof-invite .wwof__btn,
.wwof .wwof__login {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 0;
	min-height: 0;
	width: auto;
	border: 0;
	border-radius: 999px;
	font-family: inherit;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: .02em;
	text-transform: none;
	text-decoration: none;
	cursor: pointer;
	transition: transform .12s ease, box-shadow .12s ease, background .15s, opacity .15s;
}

.wwof .wwof__play {
	align-self: flex-start;
	padding: 17px 40px;
	background: var(--wwof-primary);
	color: #fff;
	font-size: 1.15em;
	box-shadow: 0 6px 0 var(--wwof-primary-dark), 0 12px 20px rgba(60, 10, 12, .22);
}
.wwof .wwof__play:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 0 var(--wwof-primary-dark), 0 14px 24px rgba(60, 10, 12, .25); }
.wwof .wwof__play:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 var(--wwof-primary-dark); }
.wwof .wwof__play:disabled { opacity: .55; cursor: not-allowed; }
.wwof .wwof__play[hidden] { display: none; }
.wwof .wwof__play:focus-visible,
.wwof .wwof__btn:focus-visible { outline: 3px solid var(--wwof-ink); outline-offset: 3px; }

.wwof .wwof__login {
	align-self: flex-start;
	padding: 13px 28px;
	background: #fff;
	color: var(--wwof-primary);
	box-shadow: inset 0 0 0 2px var(--wwof-primary);
}
.wwof .wwof__login[hidden] { display: none; }

.wwof__prizes {
	width: 100%;
	text-align: left;
	font-size: .93em;
}
.wwof__prizes summary {
	display: inline-block;
	cursor: pointer;
	font-weight: 600;
	color: var(--wwof-primary);
	text-decoration: underline;
	text-underline-offset: 3px;
	list-style: none;
}
.wwof__prizes summary::-webkit-details-marker { display: none; }
.wwof__prizes summary::after { content: " ▾"; }
.wwof__prizes[open] summary::after { content: " ▴"; }
.wwof .wwof__prizes ul,
.wwof-prize-list .wwof-prize-list__items {
	display: grid;
	gap: 8px;
	margin: 12px 0 0;
	padding: 14px;
	list-style: none;
	border-radius: 14px;
	background: rgba(255, 255, 255, .75);
}
.wwof__prizes li,
.wwof-prize-list__items li {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	margin: 0;
}
.wwof__dot {
	flex: 0 0 14px;
	height: 14px;
	margin-top: 4px;
	border-radius: 50%;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);
}
.wwof__prize-desc { display: block; opacity: .8; }
.wwof__prize-desc p { margin: 0; }

.wwof.is-locked .wwof__left,
.wwof.is-locked .wwof__consents { display: none; }

/* -------------------------------- Result --------------------------------- */

.wwof__overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(30, 12, 12, .55);
	backdrop-filter: blur(3px);
	animation: wwof-fade .2s ease;
}
.wwof__overlay[hidden] { display: none; }

.wwof__dialog {
	position: relative;
	z-index: 1;
	width: min(100%, 440px);
	max-height: calc(100vh - 32px);
	overflow: auto;
	padding: 34px 28px 26px;
	border-radius: var(--wwof-radius);
	background: #fff;
	color: var(--wwof-ink);
	text-align: center;
	box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
	animation: wwof-pop .35s cubic-bezier(.2, 1.4, .4, 1);
}

@keyframes wwof-fade { from { opacity: 0; } }
@keyframes wwof-pop { from { opacity: 0; transform: scale(.85) translateY(10px); } }

.wwof .wwof__close,
.wwof-invite .wwof-invite__close {
	all: unset;
	position: absolute;
	top: 10px;
	right: 12px;
	width: 36px;
	height: 36px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	font-size: 26px;
	line-height: 1;
	color: #666;
	cursor: pointer;
}
.wwof .wwof__close:hover,
.wwof-invite .wwof-invite__close:hover { background: #f2f2f2; color: #111; }

.wwof__confetti {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 2;
}

.wwof__result-icon { font-size: 46px; line-height: 1; }
.wwof .wwof__result-title { margin: 10px 0 4px; color: var(--wwof-primary); font-size: 1.7em; line-height: 1.15; }
.wwof__result-prize { margin: 0 0 8px; font-size: 1.25em; font-weight: 700; }
.wwof__result-text { margin: 0 0 14px; }
.wwof__result-text p { margin: 0 0 6px; }
.wwof__result-text code { font-weight: 700; background: none; padding: 0; }

.wwof__code {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	justify-content: center;
	margin: 0 0 8px;
	padding: 14px;
	border: 2px dashed var(--wwof-primary);
	border-radius: 16px;
	background: var(--wwof-primary-soft);
}
.wwof__code-value {
	padding: 0;
	background: none;
	color: var(--wwof-primary);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 1.3em;
	font-weight: 700;
	letter-spacing: .06em;
	user-select: all;
}
.wwof__result-help,
.wwof__result-note { margin: 0 0 14px; font-size: .88em; opacity: .8; }
.wwof__result-help.is-applied { color: #1a7f37; font-weight: 600; opacity: 1; }
.wwof__result-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }

.wwof .wwof__btn,
.wwof-invite .wwof__btn { padding: 13px 24px; font-size: 1em; }
.wwof .wwof__btn--primary,
.wwof-invite .wwof__btn--primary {
	background: var(--wwof-primary);
	color: #fff;
	box-shadow: 0 4px 0 var(--wwof-primary-dark);
}
.wwof .wwof__btn--primary:hover,
.wwof-invite .wwof__btn--primary:hover { transform: translateY(-1px); color: #fff; }
.wwof .wwof__btn--ghost {
	background: #fff;
	color: var(--wwof-primary);
	box-shadow: inset 0 0 0 2px var(--wwof-primary);
}
.wwof .wwof__copy { padding: 8px 16px; font-size: .9em; }
.wwof .wwof__btn--link,
.wwof-invite .wwof__btn--link {
	padding: 6px;
	background: none;
	color: #666;
	font-weight: 500;
	text-decoration: underline;
	box-shadow: none;
}

/* -------------------------------- Invite --------------------------------- */

.wwof-invite {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	opacity: 0;
	transition: opacity .25s ease;
	font-family: inherit;
	color: var(--wwof-ink);
}
.wwof-invite[hidden] { display: none; }
.wwof-invite:not(.is-visible) { pointer-events: none; } /* never block the page while fading */
.wwof-invite.is-visible { opacity: 1; }

.wwof-invite__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(30, 12, 12, .5);
}

.wwof-invite__card {
	position: relative;
	width: min(100%, 400px);
	max-height: calc(100vh - 32px);
	overflow: auto;
	border-radius: var(--wwof-radius);
	background: #fff;
	box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
	transform: translateY(16px) scale(.96);
	transition: transform .3s cubic-bezier(.2, 1.3, .4, 1), width .3s ease;
}
.wwof-invite.is-visible .wwof-invite__card { transform: none; }
.wwof-invite__card.is-expanded { width: min(100%, 980px); }
.wwof-invite__card.is-expanded .wwof-invite__body { display: block; padding: 0; background: none; }
.wwof-invite__card.is-expanded .wwof-invite__close { z-index: 5; background: rgba(255, 255, 255, .85); }
.wwof-invite__card.is-expanded .wwof__layout { border-radius: var(--wwof-radius); }

.wwof-invite__body {
	display: flex;
	flex-direction: column;
	gap: 12px;
	align-items: center;
	padding: 34px 28px 22px;
	text-align: center;
	background: linear-gradient(180deg, var(--wwof-secondary) 0, var(--wwof-secondary) 92px, #fff 92px);
}

.wwof-invite__art {
	width: 120px;
	height: 120px;
	border-radius: 50%;
	box-shadow: 0 0 0 6px var(--wwof-primary), 0 10px 20px rgba(0, 0, 0, .2);
	background: #fff;
	animation: wwof-turn 9s linear infinite;
}
@keyframes wwof-turn { to { transform: rotate(360deg); } }

.wwof-invite .wwof-invite__title { margin: 8px 0 0; color: var(--wwof-primary); font-size: 1.55em; line-height: 1.15; }
.wwof-invite__text { font-size: 1em; }
.wwof-invite__text p { margin: 0 0 6px; }
.wwof-invite .wwof-invite__cta { align-self: stretch; padding: 15px 24px; font-size: 1.08em; }

/* ------------------------------ Cart reminder ---------------------------- */

.wwof-reminder {
	display: flex;
	gap: 14px;
	align-items: flex-start;
	margin: 0 0 22px;
	padding: 16px 18px;
	border-left: 5px solid var(--wwof-primary);
	border-radius: 14px;
	background: var(--wwof-secondary);
	color: var(--wwof-ink);
}
.wwof-reminder__icon { font-size: 28px; line-height: 1; }
.wwof-reminder__body { display: flex; flex-direction: column; gap: 8px; }
.wwof-reminder__title { font-size: 1.02em; }
.wwof-reminder__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.wwof-reminder__prize { font-weight: 600; }
.wwof-reminder__code {
	padding: 4px 10px;
	border: 1.5px dashed var(--wwof-primary);
	border-radius: 8px;
	background: #fff;
	color: var(--wwof-primary);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: .92em;
	font-weight: 700;
	letter-spacing: .05em;
}
a.wwof-reminder__apply {
	padding: 7px 16px;
	border-radius: 999px;
	background: var(--wwof-primary);
	color: #fff;
	font-weight: 600;
	font-size: .9em;
	text-decoration: none;
}
a.wwof-reminder__apply:hover { color: #fff; opacity: .9; }

.wwof-gift-badge {
	display: inline-block;
	margin-left: 6px;
	padding: 2px 9px;
	border-radius: 999px;
	background: #800e13;
	color: #fff;
	font-size: .78em;
	font-weight: 600;
	vertical-align: middle;
}

/* ------------------------------- Prize list ------------------------------ */

.wwof-prize-list__title { margin: 0 0 6px; }

@media (prefers-reduced-motion: reduce) {
	.wwof__bulb,
	.wwof-invite__art,
	.wwof.needs-consent .wwof__check { animation: none; }
}

/* The layout follows the room the theme gives the block, not the screen. */
@container (max-width: 700px) {
	.wwof__layout {
		grid-template-columns: 1fr;
		justify-items: center;
		text-align: center;
	}
	.wwof__wheel { max-width: 360px; }
	.wwof__panel { align-items: center; }
	.wwof .wwof__play,
	.wwof .wwof__login { align-self: center; }
	.wwof__prizes { text-align: center; }
	.wwof .wwof__prizes ul { text-align: left; }
	.wwof__consents { align-items: center; }
}
