/**
 * Warrior's Mindset — Boutique
 * ----------------------------
 * Chargée sur les gabarits WooCommerce uniquement (cf. functions.php) :
 * archives, fiche produit, panier, commande, compte.
 *
 * WooCommerce et Astra habillent ces pages pour un fond clair. L'essentiel du
 * travail consiste donc à reprendre les surfaces, les champs de formulaire et
 * les états, qui sinon ressortent en blanc sur le noir de la marque.
 */

/**
 * Respiration sous l'en-tête collant.
 *
 * WooCommerce place ses bandeaux et son fil d'Ariane tout en haut du contenu :
 * sans marge, ils se retrouvent collés à l'en-tête, et paraissent tronqués
 * quand celui-ci est fixé au défilement.
 */
.woocommerce .site-content .ast-container,
.woocommerce-page .site-content .ast-container {
	padding-top: var(--wm-space-5);
}

/* ==========================================================================
   1. En-tête de page
   ========================================================================== */

.woocommerce-products-header,
.woocommerce-breadcrumb {
	max-width: var(--wm-container);
	margin-inline: auto;
}

.woocommerce-breadcrumb {
	font-family: var(--wm-font-label);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.16em;
	font-size: var(--wm-text-sm);
	color: var(--wm-steel-dark);
}

.woocommerce-breadcrumb a {
	color: var(--wm-steel);
	text-decoration: none;
}

.woocommerce-breadcrumb a:hover {
	color: var(--wm-red);
}

/* Nombre de résultats et tri : information de service, pas de mise en avant */
.woocommerce .woocommerce-result-count,
.woocommerce .woocommerce-ordering select {
	font-family: var(--wm-font-label);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	font-size: var(--wm-text-sm);
	color: var(--wm-steel);
}

.woocommerce .woocommerce-ordering select {
	background: var(--wm-surface);
	color: var(--wm-white);
	border: 1px solid var(--wm-border);
	border-radius: var(--wm-radius);
	padding: 0.6em 2.2em 0.6em 0.9em;
}

/* ==========================================================================
   2. Vignette produit
   ========================================================================== */

.woocommerce ul.products li.product {
	background: var(--wm-surface);
	border: 1px solid var(--wm-border);
	border-radius: var(--wm-radius);
	overflow: hidden;
	transition: border-color var(--wm-transition);
}

.woocommerce ul.products li.product:hover {
	border-color: var(--wm-steel-dark);
}

/**
 * Cadre de l'image.
 *
 * Le catalogue n'a pas encore de photographie : l'image par défaut est le
 * monogramme, posé sur un dégradé sombre. Ce cadre reste valable une fois les
 * vraies photos en place — il donne simplement un fond aux visuels détourés.
 */
.woocommerce ul.products li.product a img {
	aspect-ratio: 4 / 5;
	object-fit: contain;
	background:
		radial-gradient(ellipse 70% 70% at 50% 40%, rgba(217, 31, 38, 0.09), transparent 70%),
		linear-gradient(160deg, #17171C, #0C0C10 60%, #1A0B0D);
	padding: var(--wm-space-5);
	margin: 0;
	border-radius: 0;
	transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.woocommerce ul.products li.product:hover a img {
	transform: scale(1.03);
}

/* Le contenu textuel reprend une gouttière propre, l'image allant bord à bord */
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product .price,
.woocommerce ul.products li.product .ast-woo-product-category,
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .added_to_cart {
	margin-inline: var(--wm-space-4);
}

.woocommerce ul.products li.product .ast-woo-product-category {
	font-family: var(--wm-font-label);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.16em;
	font-size: var(--wm-text-xs);
	color: var(--wm-steel-dark);
	margin-top: var(--wm-space-4);
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
	font-family: var(--wm-font-display);
	text-transform: uppercase;
	font-size: var(--wm-text-lg);
	line-height: 1.1;
	letter-spacing: 0.01em;
	padding: 0;
	margin-block: var(--wm-space-2);
}

.woocommerce ul.products li.product .price {
	display: block;
	font-family: var(--wm-font-label);
	font-weight: 600;
	font-size: var(--wm-h4);
	color: var(--wm-white);
	letter-spacing: 0.04em;
	font-variant-numeric: tabular-nums;
	margin-bottom: var(--wm-space-4);
}

.woocommerce ul.products li.product .button {
	display: block;
	text-align: center;
	margin-bottom: var(--wm-space-4);
}

/* Révélation au défilement — posée par shop.js, jamais au chargement initial
   pour que le contenu reste visible si le script ne s'exécute pas. */
.woocommerce ul.products li.product.wm-card {
	opacity: 0;
	transform: translateY(22px);
	transition:
		opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
		transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
		border-color var(--wm-transition);
	transition-delay: var(--wm-delay, 0ms);
}

.woocommerce ul.products li.product.wm-card.is-in {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {

	.woocommerce ul.products li.product.wm-card {
		opacity: 1;
		transform: none;
		transition: none;
	}
}

/* ==========================================================================
   3. Fiche produit
   ========================================================================== */

/**
 * Colonne visuelle collante.
 *
 * Sur une fiche vêtement, la photo est l'argument : elle doit rester visible
 * pendant qu'on lit la composition et le guide des tailles. Réservé au grand
 * écran — en dessous, la colonne unique rend l'adhérence inutile.
 */
@media (min-width: 993px) {

	.woocommerce div.product .woocommerce-product-gallery {
		position: sticky;
		top: var(--wm-space-5);
	}
}

.woocommerce div.product .product_title {
	font-size: clamp(1.9rem, 1.3rem + 2.2vw, 3.4rem);
	line-height: 1.04;
	margin-bottom: var(--wm-space-3);
}

.woocommerce div.product p.price {
	font-family: var(--wm-font-label);
	font-weight: 600;
	font-size: clamp(1.5rem, 1.2rem + 1vw, 2.1rem);
	color: var(--wm-white);
	letter-spacing: 0.04em;
	font-variant-numeric: tabular-nums;
	margin-bottom: var(--wm-space-4);
}

.woocommerce div.product .woocommerce-product-details__short-description {
	color: var(--wm-steel);
	font-size: var(--wm-text-lg);
	line-height: 1.55;
	padding-bottom: var(--wm-space-4);
	border-bottom: 1px solid var(--wm-border);
	margin-bottom: var(--wm-space-4);
}

/* Ratio imposé : sans lui, une image carrée occupe tout l'écran sur mobile.
   Le 4/5 est aussi le cadrage visé pour les futures photos portées. */
.woocommerce div.product .woocommerce-product-gallery__image img {
	aspect-ratio: 4 / 5;
	object-fit: contain;
	padding: var(--wm-space-6);
	background:
		radial-gradient(ellipse 70% 70% at 50% 40%, rgba(217, 31, 38, 0.09), transparent 70%),
		linear-gradient(160deg, #17171C, #0C0C10 60%, #1A0B0D);
	border: 1px solid var(--wm-border);
	border-radius: var(--wm-radius);
}

/* --- Sélecteur de variantes --- */

.woocommerce div.product form.cart .variations {
	margin-bottom: var(--wm-space-4);
}

.woocommerce div.product form.cart .variations th,
.woocommerce div.product form.cart .variations label {
	font-family: var(--wm-font-label);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.16em;
	font-size: var(--wm-text-sm);
	color: var(--wm-steel);
}

/**
 * Pastilles de taille.
 *
 * Le menu déroulant natif reste dans la page — c'est lui que WooCommerce lit
 * pour résoudre la variation — mais il est retiré de la vue dès que les
 * pastilles ont pu être construites. On ne masque donc jamais le select tant
 * que le script n'a pas tourné : sans lui, le choix resterait possible.
 */
.wm-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wm-space-2);
	margin-bottom: var(--wm-space-2);
}

.wm-swatch {
	min-width: 3.4rem;
	padding: var(--wm-space-3) var(--wm-space-3);
	background: transparent;
	color: var(--wm-white);
	border: 1px solid var(--wm-border);
	border-radius: var(--wm-radius);
	font-family: var(--wm-font-label);
	font-weight: 600;
	font-size: var(--wm-text-base);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	cursor: pointer;
	transition: all var(--wm-transition);
}

.wm-swatch:hover:not(:disabled) {
	border-color: var(--wm-steel);
}

.wm-swatch.is-active {
	background: var(--wm-red);
	border-color: var(--wm-red);
	color: #fff;
	box-shadow: var(--wm-glow);
}

.wm-swatch:focus-visible {
	outline: 2px solid var(--wm-red-bright);
	outline-offset: 2px;
}

/* Taille indisponible : barrée plutôt que retirée — savoir qu'une taille
   existe mais manque est une information utile. */
.wm-swatch.is-out,
.wm-swatch:disabled {
	color: var(--wm-steel-dark);
	border-color: var(--wm-border);
	cursor: not-allowed;
	position: relative;
	overflow: hidden;
}

.wm-swatch.is-out::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to top left,
		transparent calc(50% - 1px),
		var(--wm-steel-dark) calc(50% - 1px),
		var(--wm-steel-dark) calc(50% + 1px),
		transparent calc(50% + 1px)
	);
}

/**
 * Lien vers le guide des tailles.
 *
 * `clear: both` et la marge haute sont nécessaires : le lien est injecté entre
 * les pastilles de taille et le bouton d'ajout, dans un conteneur où WooCommerce
 * fait flotter ses éléments. Sans dégagement, il se collait aux pastilles.
 */
/**
 * Lien placé **avant** le formulaire de variations, par le hook
 * `woocommerce_before_variations_form`.
 *
 * Il était auparavant injecté juste avant le bouton d'ajout, dans un conteneur
 * où WooCommerce fait flotter ses éléments : le lien s'y retrouvait soit à droite
 * du bouton, soit écrasé à quelques pixels de large. Hors de ce contexte, il
 * dispose de toute la colonne — et sa place logique est de toute façon avant le
 * choix de la taille, pas après.
 */
.wm-size-guide {
	display: inline-block;
	margin-bottom: var(--wm-space-4);
	font-family: var(--wm-font-label);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	font-size: var(--wm-text-sm);
	color: var(--wm-steel);
	text-decoration: underline;
	text-decoration-color: var(--wm-border);
	text-underline-offset: 5px;
	transition: all var(--wm-transition);
}

.wm-size-guide:hover {
	color: var(--wm-white);
	text-decoration-color: var(--wm-red);
}

/* Le select natif passe hors champ une fois les pastilles en place */
.variations.wm-has-swatches select {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* « Effacer » devient inutile : recliquer la pastille active la désélectionne.
   Ciblé depuis le formulaire, le lien étant rendu hors de `.variations`. */
.wm-swatched .reset_variations {
	display: none !important;
}

/* `height: auto` et un interlignage explicite : Astra impose une hauteur au
   select, et le libellé se retrouvait tronqué en bas du champ. */
.woocommerce div.product form.cart .variations select {
	background: var(--wm-surface);
	color: var(--wm-white);
	border: 1px solid var(--wm-border);
	border-radius: var(--wm-radius);
	padding: 0.75em 2.4em 0.75em 1em;
	font-family: var(--wm-font-label);
	font-weight: 600;
	letter-spacing: 0.08em;
	min-width: 12ch;
	height: auto;
	line-height: 1.5;
}

.woocommerce div.product form.cart .variations select:focus-visible {
	border-color: var(--wm-red);
}

.woocommerce div.product .woocommerce-variation-price {
	margin-bottom: var(--wm-space-3);
}

/* Champ de quantité : aligné sur le bouton, même hauteur */
.woocommerce .quantity .qty {
	background: var(--wm-surface);
	color: var(--wm-white);
	border: 1px solid var(--wm-border);
	border-radius: var(--wm-radius);
	padding: 0.75em 0.5em;
	font-family: var(--wm-font-label);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

/* --- Onglets description / avis --- */

.woocommerce div.product .woocommerce-tabs ul.tabs {
	padding: 0;
	margin-bottom: var(--wm-space-5);
	border-bottom: 1px solid var(--wm-border);
	display: flex;
	flex-wrap: wrap;
	gap: var(--wm-space-4);
}

.woocommerce div.product .woocommerce-tabs ul.tabs::before {
	display: none;   /* filet natif de WooCommerce, remplacé ci-dessus */
}

.woocommerce div.product .woocommerce-tabs ul.tabs li {
	background: transparent;
	border: 0;
	border-radius: 0;
	margin: 0;
	padding: 0;
}

.woocommerce div.product .woocommerce-tabs ul.tabs li::before,
.woocommerce div.product .woocommerce-tabs ul.tabs li::after {
	display: none;   /* les oreilles arrondies du thème par défaut */
}

.woocommerce div.product .woocommerce-tabs ul.tabs li a {
	font-family: var(--wm-font-label);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.16em;
	font-size: var(--wm-text-sm);
	color: var(--wm-steel);
	padding: var(--wm-space-3) 0;
	display: block;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
}

.woocommerce div.product .woocommerce-tabs ul.tabs li.active a,
.woocommerce div.product .woocommerce-tabs ul.tabs li a:hover {
	color: var(--wm-white);
	border-bottom-color: var(--wm-red);
}

.woocommerce div.product .woocommerce-tabs .panel h2 {
	font-size: var(--wm-h3);
	margin-bottom: var(--wm-space-3);
}

.woocommerce div.product .woocommerce-tabs .panel p {
	color: var(--wm-steel);
	max-width: 68ch;
}

/* Produits liés */
.woocommerce .related > h2,
.woocommerce .upsells > h2,
.woocommerce .cross-sells > h2 {
	font-size: var(--wm-h3);
	margin-bottom: var(--wm-space-5);
	padding-top: var(--wm-space-6);
	border-top: 1px solid var(--wm-border);
}

/* ==========================================================================
   4. Formulaires, panier et commande
   ========================================================================== */

.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select,
.woocommerce table.cart td.actions .coupon .input-text,
.wc-block-components-text-input input {
	background: var(--wm-surface);
	color: var(--wm-white);
	border: 1px solid var(--wm-border);
	border-radius: var(--wm-radius);
	padding: 0.8em 1em;
}

.woocommerce form .form-row label,
.wc-block-components-text-input label {
	font-family: var(--wm-font-label);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	font-size: var(--wm-text-sm);
	color: var(--wm-steel);
}

/**
 * Sélecteurs Select2 (pays, région).
 *
 * WooCommerce remplace ces `<select>` par un composant Select2, qui reconstruit
 * son propre balisage et ignore donc les règles visant `select`. La liste
 * déroulante, elle, est rendue en fin de `<body>` — hors de tout conteneur
 * WooCommerce : ses sélecteurs ne peuvent pas être préfixés.
 */
.woocommerce .select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--single {
	background: var(--wm-surface);
	border: 1px solid var(--wm-border);
	border-radius: var(--wm-radius);
	height: auto;
	padding: 0.55em 0.4em;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
	color: var(--wm-white);
	line-height: 1.6;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
	border-top-color: var(--wm-steel);
}

.select2-dropdown {
	background: var(--wm-surface);
	border-color: var(--wm-border);
	border-radius: var(--wm-radius);
}

.select2-container--default .select2-results__option {
	background: var(--wm-surface);
	color: var(--wm-steel);
}

.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option[aria-selected='true'] {
	background: var(--wm-red);
	color: #fff;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
	background: var(--wm-black);
	color: var(--wm-white);
	border: 1px solid var(--wm-border);
	border-radius: var(--wm-radius);
	padding: 0.6em 0.8em;
}

.woocommerce table.shop_table,
.woocommerce table.shop_table td,
.woocommerce table.shop_table th,
.woocommerce-cart .cart-collaterals .cart_totals table td,
.woocommerce-cart .cart-collaterals .cart_totals table th {
	border-color: var(--wm-border);
	color: var(--wm-white);
}

.woocommerce table.shop_table th {
	font-family: var(--wm-font-label);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	font-size: var(--wm-text-sm);
	color: var(--wm-steel);
}

.woocommerce-cart .cart-collaterals .cart_totals,
.woocommerce-checkout #order_review,
.woocommerce .woocommerce-info,
.woocommerce .woocommerce-message,
.woocommerce .cart_totals {
	background: var(--wm-surface);
	border: 1px solid var(--wm-border);
	border-radius: var(--wm-radius);
}

/**
 * Titres des blocs « Total panier » et « Votre commande ».
 *
 * Astra leur applique un fond quasi blanc (#FBFBFB) hérité de son habillage
 * clair. Combiné à notre texte blanc, le titre devenait strictement invisible.
 */
.woocommerce-cart .cart-collaterals .cart_totals h2,
.woocommerce-page .cart-collaterals .cart_totals h2,
.woocommerce .cart_totals h2,
.woocommerce-checkout #order_review_heading,
.woocommerce-checkout #order_review h3 {
	background: transparent none;
	color: var(--wm-white);
	font-size: var(--wm-h4);
	padding: var(--wm-space-4) 0 var(--wm-space-2);
	margin: 0;
	border-bottom: 1px solid var(--wm-border);
}

.woocommerce .cart_totals,
.woocommerce-checkout #order_review {
	padding: 0 var(--wm-space-4) var(--wm-space-4);
}

/**
 * Bandeaux d'information (« article ajouté au panier », erreurs, avis).
 *
 * WooCommerce les construit avec un bouton en `float: right` et une icône en
 * position absolue calée sur son propre padding. Changer ce padding sans
 * reprendre l'icône la fait chevaucher le texte, et le flottant se disloque dès
 * que la largeur manque. On repart donc d'une mise en page flex.
 */
.woocommerce .woocommerce-info,
.woocommerce .woocommerce-message,
.woocommerce .woocommerce-error {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wm-space-3);
	border: 0;
	border-left: 3px solid var(--wm-red);
	border-radius: var(--wm-radius);
	background: var(--wm-surface);
	color: var(--wm-white);
	margin-bottom: var(--wm-space-5);
	/* La gouttière de gauche réserve la place de l'icône */
	padding: var(--wm-space-4) var(--wm-space-4) var(--wm-space-4) 3.25rem;
	line-height: 1.5;
}

.woocommerce .woocommerce-info::before,
.woocommerce .woocommerce-message::before,
.woocommerce .woocommerce-error::before {
	position: absolute;
	left: var(--wm-space-4);
	top: var(--wm-space-4);
	margin: 0;
	color: var(--wm-red);
	font-size: 1.15rem;
	line-height: 1.4;
}

/* Le bouton cesse de flotter : il se range en fin de ligne, et passe dessous
   quand la place manque — au lieu de chevaucher le texte. */
.woocommerce .woocommerce-info .button,
.woocommerce .woocommerce-message .button,
.woocommerce .woocommerce-error .button {
	float: none;
	margin: 0 0 0 auto;
	flex: 0 0 auto;
}

@media (max-width: 600px) {

	.woocommerce .woocommerce-info .button,
	.woocommerce .woocommerce-message .button,
	.woocommerce .woocommerce-error .button {
		margin-left: 0;
		width: 100%;
		text-align: center;
	}
}

.woocommerce .woocommerce-error {
	border-left-color: var(--wm-red-bright);
	background: rgba(217, 31, 38, 0.08);
}

/* ==========================================================================
   5. Compte client
   ========================================================================== */

.woocommerce-account .woocommerce-MyAccount-navigation ul {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid var(--wm-border);
	border-radius: var(--wm-radius);
	overflow: hidden;
}

.woocommerce-account .woocommerce-MyAccount-navigation li {
	border-bottom: 1px solid var(--wm-border);
}

.woocommerce-account .woocommerce-MyAccount-navigation li:last-child {
	border-bottom: 0;
}

.woocommerce-account .woocommerce-MyAccount-navigation li a {
	display: block;
	padding: var(--wm-space-3) var(--wm-space-4);
	font-family: var(--wm-font-label);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	font-size: var(--wm-text-sm);
	color: var(--wm-steel);
	text-decoration: none;
	transition: all var(--wm-transition);
}

.woocommerce-account .woocommerce-MyAccount-navigation li.is-active a,
.woocommerce-account .woocommerce-MyAccount-navigation li a:hover {
	background: var(--wm-surface);
	color: var(--wm-white);
}
