/* =================================================================
   LA BOX — STYLES DU CONFIGURATEUR (page /la-box/ uniquement)
   Écrit d'abord pour le téléphone.
   ================================================================= */

.tdc-boxpage,
.tdc-boxpage * {
	box-sizing: border-box;
}

.tdc-boxpage {
	max-width: 1000px;
	margin: 0 auto;
	padding: 40px 16px 72px;
}

/* ---------- Introduction ---------- */

.tdc-boxpage__intro {
	text-align: center;
	max-width: 620px;
	margin: 0 auto 32px;
}

.tdc-boxpage__intro h1 {
	margin: 0 0 10px;
	font-size: clamp(2.2rem, 8vw, 3.4rem);
}

.tdc-boxpage__prix {
	font-size: 0.95rem;
}

.tdc-boxpage__prix strong {
	font-family: var(--wp--preset--font-family--titre);
	font-size: 1.6rem;
	color: var(--wp--preset--color--or);
}

/* ---------- Progression ---------- */

.tdc-config__progression {
	display: none;
	margin-bottom: 24px;
}

.tdc-config--js .tdc-config__progression {
	display: block;
}

.tdc-config__barre {
	height: 4px;
	border-radius: 4px;
	background: rgba(201, 164, 92, 0.25);
	overflow: hidden;
}

.tdc-config__barre span {
	display: block;
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, #C9A45C, #F6E3A8, #C9A45C);
	box-shadow: 0 0 10px rgba(201, 164, 92, 0.8);
	transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tdc-config__compteur {
	margin: 8px 0 0;
	font-size: 0.85rem;
	text-align: center;
	opacity: 0.75;
}

/* ---------- Étapes ---------- */

.tdc-etape {
	border: 0;
	margin: 0 0 48px;
	padding: 0;
	min-width: 0;
}

/* Avec le JavaScript : une seule étape visible à la fois */
.tdc-config--js .tdc-etape {
	display: none;
	margin-bottom: 24px;
}

.tdc-config--js .tdc-etape.est-active {
	display: block;
	animation: tdc-etape-entre 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes tdc-etape-entre {
	from { opacity: 0; transform: translateY(18px); filter: blur(4px); }
	to   { opacity: 1; transform: none; filter: none; }
}

.tdc-etape legend {
	width: 100%;
	padding: 0;
	margin: 0 0 6px;
	text-align: center;
	font-family: var(--wp--preset--font-family--titre);
	font-size: clamp(1.8rem, 6vw, 2.4rem);
	font-weight: 500;
	line-height: 1.15;
	color: var(--wp--preset--color--prune);
}

body.univers-dark .tdc-etape legend,
body.univers-romantasy .tdc-etape legend {
	color: var(--wp--preset--color--or);
}

.tdc-etape__aide {
	text-align: center;
	margin: 0 0 22px;
	opacity: 0.85;
}

/* Secousse quand on essaie d'avancer sans choisir */
.tdc-etape.est-incomplete .tdc-choix {
	animation: tdc-secousse 0.45s ease;
}

@keyframes tdc-secousse {
	20%, 60% { transform: translateX(-8px); }
	40%, 80% { transform: translateX(8px); }
}

/* ---------- Cartes de choix ---------- */

.tdc-choix {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
}

/* Deux cartes par ligne sur téléphone, jusqu'à cinq sur ordinateur */
.tdc-choix > .tdc-carte-choix {
	flex: 0 1 calc(50% - 6px);
	max-width: 180px;
}

.tdc-choix--univers {
	display: grid;
	grid-template-columns: 1fr;
}

.tdc-choix--univers > .tdc-carte-choix {
	max-width: none;
}

.tdc-carte-choix {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 12px 10px 14px;
	border-radius: 14px;
	border: 1.5px solid rgba(201, 164, 92, 0.45);
	background: var(--wp--preset--color--parchemin);
	color: var(--wp--preset--color--encre);
	text-align: center;
	cursor: pointer;
	transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.35s ease, border-color 0.35s ease;
}

.tdc-carte-choix[hidden] {
	display: none;
}

/* Le vrai bouton radio est caché mais reste accessible au clavier */
.tdc-carte-choix input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.tdc-carte-choix:has(input:focus-visible) {
	outline: 2px solid var(--wp--preset--color--or);
	outline-offset: 3px;
}

.tdc-carte-choix__visuel {
	display: grid;
	place-items: center;
	width: 100%;
	aspect-ratio: 1;
	border-radius: 10px;
	overflow: hidden;
	color: #C9A45C;
}

.tdc-carte-choix__visuel img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tdc-carte-choix__visuel .tdc-etoile {
	width: 34%;
	height: 34%;
	margin: 0;
	filter: drop-shadow(0 0 10px rgba(201, 164, 92, 0.6));
}

/* Vignettes provisoires : un fond aux couleurs de l'univers */
.tdc-carte-choix--dark .tdc-carte-choix__visuel {
	background: radial-gradient(circle at 70% 25%, rgba(140, 26, 50, 0.7), transparent 60%), linear-gradient(160deg, #141014, #5C1A2B);
}

.tdc-carte-choix--romantasy .tdc-carte-choix__visuel {
	background: radial-gradient(circle at 70% 25%, rgba(180, 139, 224, 0.6), transparent 60%), linear-gradient(160deg, #2B1240, #6B3FA0);
}

.tdc-carte-choix--mixte .tdc-carte-choix__visuel {
	background: linear-gradient(135deg, #141014 0%, #5C1A2B 48%, #4B1B45 52%, #6B3FA0 100%);
}

.tdc-carte-choix__nom {
	font-family: var(--wp--preset--font-family--titre);
	font-size: 1.15rem;
	font-weight: 600;
	line-height: 1.15;
	color: var(--wp--preset--color--prune);
}

.tdc-carte-choix__texte {
	font-size: 0.9rem;
	opacity: 0.8;
}

/* Carte d'univers : en bandeau sur téléphone (vignette à gauche, nom et accroche à droite) */
.tdc-choix--univers .tdc-carte-choix {
	display: grid;
	grid-template-columns: 72px 1fr;
	grid-template-rows: auto auto;
	align-items: center;
	column-gap: 14px;
	row-gap: 2px;
	text-align: left;
	padding: 12px;
}

.tdc-choix--univers .tdc-carte-choix__visuel {
	grid-row: 1 / span 2;
	width: 72px;
}

.tdc-choix--univers .tdc-carte-choix__nom {
	align-self: end;
}

.tdc-choix--univers .tdc-carte-choix__texte {
	align-self: start;
}

.tdc-choix--univers .tdc-carte-choix__nom {
	font-size: 1.5rem;
}

.tdc-choix--univers .tdc-carte-choix__texte {
	display: block;
}

/* Au survol (ordinateur) */
@media (hover: hover) and (pointer: fine) {
	.tdc-carte-choix:not(.est-epuise):hover {
		transform: translateY(-5px);
		box-shadow: 0 16px 30px -18px rgba(75, 27, 69, 0.6);
		border-color: var(--wp--preset--color--or);
	}
}

/* Choisi : halo mauve et or, étoile qui s'illumine */
.tdc-carte-choix:has(input:checked) {
	border-color: var(--wp--preset--color--or);
	box-shadow: 0 0 0 2px var(--wp--preset--color--or), 0 0 26px 2px rgba(107, 63, 160, 0.55);
	transform: translateY(-3px);
}

.tdc-carte-choix:has(input:checked)::after {
	content: "✦";
	position: absolute;
	top: -10px;
	right: -6px;
	width: 28px;
	height: 28px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: var(--wp--preset--color--or);
	color: var(--wp--preset--color--prune);
	font-size: 0.9rem;
	animation: tdc-pastille 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes tdc-pastille {
	from { transform: scale(0) rotate(-90deg); }
	to   { transform: scale(1) rotate(0); }
}

.tdc-carte-choix:has(input:checked) .tdc-carte-choix__visuel .tdc-etoile {
	animation: tdc-etoile-choisie 0.8s ease-out;
}

@keyframes tdc-etoile-choisie {
	0%   { transform: scale(1) rotate(0); }
	50%  { transform: scale(1.5) rotate(45deg); filter: drop-shadow(0 0 22px #F6E3A8); }
	100% { transform: scale(1) rotate(90deg); }
}

/* Épuisé */
.tdc-carte-choix.est-epuise {
	cursor: not-allowed;
	opacity: 0.5;
	filter: grayscale(0.8);
}

.tdc-carte-choix__epuise {
	position: absolute;
	top: 10px;
	left: 10px;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--wp--preset--color--encre);
	color: var(--wp--preset--color--creme);
	font-size: 0.75rem;
	font-weight: 600;
}

/* ---------- Navigation ---------- */

.tdc-config__nav {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin-top: 8px;
}

.tdc-config__nav[hidden] {
	display: none;
}

.tdc-config__prec {
	background: none;
	border: 0;
	padding: 12px 4px;
	min-height: 44px;
	font: inherit;
	font-weight: 600;
	color: inherit;
	cursor: pointer;
}

.tdc-config__prec:disabled {
	visibility: hidden;
}

.tdc-config__suiv {
	margin-left: auto;
	min-height: 44px;
}

.tdc-config__suiv[hidden] {
	display: none;
}

/* ---------- Récapitulatif ---------- */

.tdc-recap {
	display: grid;
	gap: 20px;
	align-items: center;
}

.tdc-recap__coffret {
	display: flex;
	justify-content: center;
}

.tdc-recap__svg {
	width: min(100%, 260px);
	height: auto;
	overflow: visible;
}

/* Le couvercle se referme quand le récapitulatif apparaît */
.tdc-etape--recap.est-active .tdc-recap__couvercle {
	transform-origin: 48px 120px;
	animation: tdc-referme 1.1s cubic-bezier(0.3, 1.4, 0.5, 1) both;
}

.tdc-etape--recap.est-active .tdc-recap__lueur {
	transform-origin: 160px 130px;
	animation: tdc-lueur-recap 2.2s ease-in-out 0.9s infinite;
}

@keyframes tdc-referme {
	0%   { transform: rotate(-38deg) translateY(-24px); }
	100% { transform: rotate(0) translateY(0); }
}

@keyframes tdc-lueur-recap {
	0%, 100% { opacity: 0.5; transform: scale(0.95); }
	50%      { opacity: 1;   transform: scale(1.08); }
}

.tdc-recap__liste {
	list-style: none;
	margin: 0;
	padding: 0;
	border-radius: 14px;
	border: 1px solid rgba(201, 164, 92, 0.45);
	background: var(--wp--preset--color--parchemin);
	color: var(--wp--preset--color--encre);
	overflow: hidden;
}

.tdc-recap__liste li {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 2px 10px;
	padding: 12px 16px;
	border-bottom: 1px solid rgba(201, 164, 92, 0.25);
}

.tdc-recap__liste li:last-child {
	border-bottom: 0;
}

.tdc-recap__etiquette {
	grid-column: 1;
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #9A7A3A;
}

.tdc-recap__valeur {
	grid-column: 1;
	font-family: var(--wp--preset--font-family--titre);
	font-size: 1.2rem;
	font-weight: 600;
	color: var(--wp--preset--color--prune);
}

.tdc-recap__modifier {
	grid-column: 2;
	grid-row: 1 / span 2;
	align-self: center;
	background: none;
	border: 0;
	font: inherit;
	font-size: 0.85rem;
	text-decoration: underline;
	color: var(--wp--preset--color--violet);
	cursor: pointer;
	min-height: 44px;
}

.tdc-recap__prix {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: center;
	gap: 6px 12px;
	margin: 24px 0 16px;
	text-align: center;
}

.tdc-recap__prix .tdc-prix__montant {
	font-family: var(--wp--preset--font-family--titre);
	font-size: 2.6rem;
	font-weight: 600;
	line-height: 1;
	color: var(--wp--preset--color--or);
}

.tdc-etape--recap .tdc-ajout-panier {
	display: block;
	width: 100%;
	max-width: 420px;
	margin: 0 auto;
	font-size: 1.1rem;
	min-height: 52px;
}

.tdc-ajout-panier:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Sans JavaScript, le récapitulatif n'a pas de liste : on la cache */
.tdc-config:not(.tdc-config--js) .tdc-recap {
	display: none;
}

/* Note interne (visible seulement par l'administratrice) */
.tdc-a-completer {
	border: 1px dashed #C0392B;
	background: #FFF3EE;
	color: #8C1A32;
	padding: 10px 14px;
	border-radius: 8px;
	font-size: 0.9rem;
}

/* ---------- Écrans plus larges ---------- */

@media (min-width: 600px) {
	.tdc-choix {
		gap: 16px;
	}

	.tdc-choix--univers {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.tdc-choix--univers .tdc-carte-choix {
		display: flex;
		flex-direction: column;
		text-align: center;
		padding: 16px 14px 20px;
	}

	.tdc-choix--univers .tdc-carte-choix__visuel {
		width: 100%;
	}

	.tdc-choix > .tdc-carte-choix {
		flex-basis: 170px;
	}
}

@media (min-width: 900px) {
	.tdc-boxpage {
		padding-top: 64px;
	}

	.tdc-choix--univers {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		max-width: 820px;
		margin: 0 auto;
	}

	.tdc-recap {
		grid-template-columns: 1fr 1.3fr;
		gap: 36px;
	}
}

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