/**
 * YWH – Fiche produit
 *
 * Toutes les valeurs sont des variables CSS déclarées sur .ywh-product.
 * Pour aligner sur ta charte, redéfinis-les dans le thème plutôt que
 * de modifier ce fichier.
 */

.ywh-product {
	--ywh-ink: #111111;
	--ywh-muted: #707070;
	--ywh-rule: #e5e5e5;
	--ywh-surface: #f5f5f5;
	--ywh-radius: 8px;
	--ywh-radius-pill: 999px;
	--ywh-gap: 1rem;
	--ywh-in: #0f7b3f;
	--ywh-low: #b45309;
	--ywh-out: #9a1f1f;
}

/* =====================================================================
   Structure
   ================================================================== */

.ywh-product__main {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 2rem;
}

@media (min-width: 1024px) {
	.ywh-product__main {
		grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
		gap: 3.5rem;
		align-items: start;
	}

	.ywh-product__summary {
		position: sticky;
		top: 2rem;
	}
}

.ywh-product__summary.summary {
	float: none;
	width: auto;
	margin: 0;
	clear: none;
}

.ywh-product__details {
	margin-top: 3.5rem;
}

/* =====================================================================
   Galerie
   ================================================================== */

/* Flex plutôt que grid : sans colonne de miniatures (produit à visuel
   unique), le bloc image occupe naturellement toute la largeur. */
.ywh-gallery {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

@media (min-width: 768px) {
	.ywh-gallery {
		flex-direction: row;
		align-items: flex-start;
	}
}

.ywh-gallery__thumbs {
	display: flex;
	flex: 0 0 auto;
	gap: 0.5rem;
	order: 2;
	overflow-x: auto;
	scrollbar-width: none;
}

.ywh-gallery__thumbs::-webkit-scrollbar {
	display: none;
}

@media (min-width: 768px) {
	.ywh-gallery__thumbs {
		width: 76px;
		flex-direction: column;
		order: 0;
		overflow: visible;
	}
}

.ywh-gallery__thumb {
	flex: 0 0 auto;
	width: 68px;
	padding: 0;
	border: 1px solid transparent;
	border-radius: var(--ywh-radius);
	background: var(--ywh-surface);
	overflow: hidden;
	cursor: pointer;
	transition: border-color 0.15s ease;
}

.ywh-gallery__thumb img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: cover;
}

.ywh-gallery__thumb.is-active,
.ywh-gallery__thumb:hover {
	border-color: var(--ywh-ink);
}

.ywh-gallery__thumb:focus-visible {
	outline: 2px solid var(--ywh-ink);
	outline-offset: 2px;
}

.ywh-gallery__stage {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	width: 100%;
	background: var(--ywh-surface);
	border-radius: var(--ywh-radius);
	overflow: hidden;
}

.ywh-gallery__track {
	position: relative;
	aspect-ratio: 1 / 1;
}

.ywh-gallery__slide {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease;
}

.ywh-gallery__slide.is-active {
	opacity: 1;
	visibility: visible;
}

.ywh-gallery__image {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.ywh-gallery__badge {
	position: absolute;
	top: 1rem;
	left: 1rem;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.5rem 1rem;
	border-radius: var(--ywh-radius-pill);
	background: #ffffff;
	color: var(--ywh-ink);
	font-size: 0.875rem;
	font-weight: 600;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
}

.ywh-gallery__nav {
	position: absolute;
	right: 1rem;
	bottom: 1rem;
	z-index: 2;
	display: flex;
	gap: 0.5rem;
}

.ywh-gallery__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #ffffff;
	color: var(--ywh-ink);
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
}

.ywh-gallery__arrow:hover {
	background: #f0f0f0;
}

/* =====================================================================
   Résumé produit
   ================================================================== */

.ywh-brand {
	margin: 0 0 0.25rem;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ywh-muted);
}

.ywh-product .product_title {
	margin: 0;
	font-size: 1.6rem;
	line-height: 1.25;
	font-weight: 700;
}

/* Catégorie + disponibilité : une seule ligne, retour à la ligne si
   la colonne est trop étroite (mobile). */
.ywh-summary-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.375rem 0.75rem;
	margin: 0.5rem 0 0;
}

.ywh-subtitle {
	color: var(--ywh-muted);
	font-size: 1rem;
	line-height: 1.4;
}

.ywh-product .summary > .price {
	display: block;
	margin: 1rem 0 0;
	font-size: 1.125rem;
	font-weight: 600;
	color: var(--ywh-ink);
}

.ywh-product .summary > .price del {
	margin-right: 0.5rem;
	color: var(--ywh-muted);
	font-weight: 400;
}

/* Disponibilité */

.ywh-stock {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1.4;
}

.ywh-stock__dot {
	flex: 0 0 auto;
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 50%;
	background: currentColor;
}

.ywh-stock--instock { color: var(--ywh-in); }
.ywh-stock--lowstock,
.ywh-stock--onbackorder { color: var(--ywh-low); }
.ywh-stock--outofstock { color: var(--ywh-out); }

/* =====================================================================
   Variations : on neutralise le tableau natif
   ================================================================== */

.ywh-product .variations {
	width: 100%;
	margin: 1.75rem 0 0;
	border: 0;
	border-collapse: collapse;
}

.ywh-product .variations tbody,
.ywh-product .variations tr,
.ywh-product .variations td {
	display: block;
	width: auto;
	padding: 0;
	border: 0;
}

.ywh-product .variations tr + tr {
	margin-top: 1.75rem;
}

/* Le libellé natif est remplacé par celui du bloc swatches. */
.ywh-product .variations th.label {
	display: none;
}

.ywh-product .variations .reset_variations {
	display: inline-block;
	margin-top: 0.75rem;
	font-size: 0.8125rem;
	color: var(--ywh-muted);
}

/* Select natif conservé pour WooCommerce, retiré du flux visuel. */
.ywh-swatches select {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	overflow: hidden;
	white-space: nowrap;
}

.ywh-swatches__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--ywh-gap);
	margin-bottom: 0.75rem;
}

.ywh-swatches__label {
	font-size: 1rem;
	font-weight: 600;
}

.ywh-swatches__guide {
	font-size: 0.9375rem;
	color: var(--ywh-ink);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.ywh-swatches__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.ywh-swatches--button .ywh-swatches__list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
}

.ywh-swatch {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 1px solid var(--ywh-rule);
	border-radius: var(--ywh-radius);
	background: #ffffff;
	color: inherit;
	cursor: pointer;
	transition: border-color 0.15s ease;
}

.ywh-swatch:hover:not(:disabled) {
	border-color: var(--ywh-ink);
}

.ywh-swatch.is-selected {
	border-color: var(--ywh-ink);
	box-shadow: inset 0 0 0 1px var(--ywh-ink);
}

.ywh-swatch:focus-visible {
	outline: 2px solid var(--ywh-ink);
	outline-offset: 2px;
}

.ywh-swatch.is-unavailable {
	opacity: 0.35;
	cursor: not-allowed;
}

.ywh-swatch--label {
	min-height: 3.25rem;
	padding: 0.75rem 1rem;
	font-size: 1rem;
}

/* Vignettes image : une seule ligne, défilement horizontal si elles
   dépassent la largeur de la colonne. Le padding/marge négative laisse
   de la place à l'outline de focus, sinon rognée par l'overflow. */
.ywh-product .ywh-swatches--image .ywh-swatches__list {
	flex-wrap: nowrap;
	overflow-x: auto;
	margin: -3px;
	padding: 3px;
	scrollbar-width: thin;
}

/* Sélecteurs préfixés par .ywh-product : le style.css du thème enfant
   déclare un .ywh-swatch { width: auto; height: auto } non scopé, chargé
   après ce fichier, qui laissait l'image s'afficher à sa taille native. */
.ywh-product .ywh-swatch--image {
	flex: 0 0 auto;
	width: 4.5rem;
	height: 4.5rem;
	overflow: hidden;
}

.ywh-product .ywh-swatch--image img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

@media (max-width: 767px) {
	.ywh-product .ywh-swatch--image {
		width: 4rem;
		height: 4rem;
	}
}

.ywh-swatch--color {
	width: 3rem;
	height: 3rem;
	padding: 0.25rem;
}

.ywh-swatch__color {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: calc(var(--ywh-radius) - 3px);
	background: var(--ywh-swatch-color, #ffffff);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* =====================================================================
   Boutons d'action
   ================================================================== */

.ywh-product .single_add_to_cart_button,
.ywh-favorite {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	width: 100%;
	min-height: 3.5rem;
	padding: 0.9rem 1.5rem;
	border-radius: var(--ywh-radius-pill);
	font-size: 1rem;
	font-weight: 500;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.ywh-product .single_add_to_cart_button {
	margin-top: 1.75rem;
	border: 1px solid var(--ywh-ink);
	background: var(--ywh-ink);
	color: #ffffff;
}

.ywh-product .single_add_to_cart_button:hover {
	background: #333333;
	border-color: #333333;
}

.ywh-product .single_add_to_cart_button.disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.ywh-favorite {
	margin-top: 0.75rem;
	border: 1px solid var(--ywh-rule);
	background: #ffffff;
	color: var(--ywh-ink);
}

.ywh-favorite:hover {
	border-color: var(--ywh-ink);
}

.ywh-favorite.is-active .ywh-favorite__icon path {
	fill: currentColor;
}

/* Quantité masquée par défaut : décommenter pour la réafficher. */
.ywh-product .quantity {
	display: none;
}

/* =====================================================================
   Accordéons
   ================================================================== */

.ywh-accordions {
	border-top: 1px solid var(--ywh-rule);
}

.ywh-accordion {
	border-bottom: 1px solid var(--ywh-rule);
}

.ywh-accordion__summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--ywh-gap);
	padding: 1.35rem 0;
	font-size: 1.0625rem;
	font-weight: 600;
	cursor: pointer;
	list-style: none;
}

.ywh-accordion__summary::-webkit-details-marker {
	display: none;
}

.ywh-accordion__summary:focus-visible {
	outline: 2px solid var(--ywh-ink);
	outline-offset: 2px;
}

.ywh-accordion__chevron {
	flex: 0 0 auto;
	transition: transform 0.2s ease;
}

.ywh-accordion[open] .ywh-accordion__chevron {
	transform: rotate(180deg);
}

.ywh-accordion__body {
	padding: 0 0 1.75rem;
	max-width: 46rem;
	line-height: 1.65;
}

.ywh-accordion__body > h2:first-child {
	margin-top: 0;
}

/* Le titre de l'onglet fait doublon avec l'intitulé de l'accordéon. */
.ywh-accordion__body > h2 {
	display: none;
}

.ywh-accordion__body .shop_attributes {
	width: 100%;
	border-collapse: collapse;
}

.ywh-accordion__body .shop_attributes th,
.ywh-accordion__body .shop_attributes td {
	padding: 0.65rem 0;
	border-bottom: 1px solid var(--ywh-rule);
	text-align: left;
	vertical-align: top;
}

.ywh-accordion__body .shop_attributes th {
	width: 40%;
	font-weight: 500;
	color: var(--ywh-muted);
}

.ywh-accordion__body .shop_attributes p {
	margin: 0;
}

/* =====================================================================
   Paiement express Stripe
   ================================================================== */

/* Retiré côté PHP (filtre wc_stripe_hide_payment_request_on_product_page) ;
   ce masquage n'est qu'un filet de sécurité si un réglage Stripe le réinjecte. */
.ywh-product__summary #wc-stripe-express-checkout-element,
.ywh-product__summary #wc-stripe-express-checkout-button-separator,
.ywh-product__summary .wc-stripe-express-checkout-element {
	display: none !important;
}

/* =====================================================================
   Retours : mention + fenêtre de détail
   ================================================================== */

.ywh-returns {
	margin: 0.75rem 0 0;
	font-size: 0.875rem;
	color: var(--ywh-muted);
}

.ywh-returns__link {
	color: var(--ywh-ink);
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
	cursor: pointer;
}

.ywh-returns__link:hover,
.ywh-returns__link:focus-visible {
	color: var(--ywh-muted);
}

.ywh-dialog {
	--ywh-ink: #111111;
	--ywh-muted: #707070;
	--ywh-rule: #e5e5e5;

	width: min(640px, calc(100vw - 2rem));
	max-height: min(80vh, 760px);
	margin: auto;
	padding: 0;
	border: 0;
	border-radius: var(--ywh-radius, 8px);
	background: #ffffff;
	color: var(--ywh-ink);
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
	overflow: hidden;
}

.ywh-dialog::backdrop {
	background: rgba(17, 17, 17, 0.45);
}

.ywh-dialog__inner {
	display: flex;
	flex-direction: column;
	max-height: inherit;
}

.ywh-dialog__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid var(--ywh-rule);
}

.ywh-dialog__title {
	margin: 0;
	font-size: 1.125rem;
	font-weight: 500;
	line-height: 1.3;
}

.ywh-dialog__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid var(--ywh-rule);
	border-radius: 50%;
	background: transparent;
	color: var(--ywh-ink);
	cursor: pointer;
}

.ywh-dialog__close:hover {
	border-color: var(--ywh-ink);
	background: transparent;
	color: var(--ywh-ink);
}

.ywh-dialog__body {
	padding: 1.25rem 1.5rem 1.5rem;
	overflow-y: auto;
	font-size: 0.875rem;
	line-height: 1.65;
}

.ywh-dialog__body p {
	margin: 0 0 0.75rem;
}

.ywh-dialog__body h3 {
	margin: 1.5rem 0 0.5rem;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.ywh-dialog__body ul {
	margin: 0 0 0.75rem;
	padding-left: 1.25rem;
}

.ywh-dialog__footer {
	padding: 1rem 1.5rem;
	border-top: 1px solid var(--ywh-rule);
	font-size: 0.875rem;
}

.ywh-dialog__footer a {
	color: var(--ywh-ink);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Empêche la page de défiler derrière la fenêtre ouverte. */
html.ywh-dialog-open {
	overflow: hidden;
}

/* =====================================================================
   Accessibilité et confort
   ================================================================== */

@media (prefers-reduced-motion: reduce) {
	.ywh-gallery__slide,
	.ywh-accordion__chevron,
	.ywh-swatch,
	.ywh-product .single_add_to_cart_button {
		transition: none;
	}
}
