/**
 * Api Sens — Quiz Diagnostic de Peau (styles)
 * Aligné sur la charte du thème Aries V2 (config.json / app.css) :
 *   - Brand teal  forest-800 #194951  (texte / boutons primaires)
 *   - Accent miel honey-400  #eec227  (hover / progression / badges)
 *   - Fond crème  #faf6ee, surfaces blanches, police Poppins
 *   - Cartes rounded-[28px], boutons pills rounded-full, carte produit
 *     calquée sur template-parts/content/content-product-card.php
 * Encapsulé sous .apisens-quiz (préfixe aq-) pour ne pas fuiter dans le thème.
 * Mobile-first, contraste AA, focus-visible, cibles ≥44px.
 */

.apisens-quiz {
	/* ---- Tokens repris de la charte Aries (overridables) ---- */
	--aq-forest-900: #0f2e34;
	--aq-forest-800: #194951;
	--aq-forest-700: #1a4d56;
	--aq-forest-600: #1d525c;
	--aq-forest-200: #aac9cd;
	--aq-forest-100: #d6e6e9;
	--aq-forest-50:  #f0f6f7;
	--aq-honey-600: #a18007;
	--aq-honey-500: #c79f0e;
	--aq-honey-400: #eec227;
	--aq-honey-50:  #fdfae8;
	--aq-sage-500:  #547651;
	--aq-stone-500: #6d6d6c;
	--aq-cream:     #faf6ee;
	--aq-bark-50:   #faf6ee;
	--aq-white:     #ffffff;
	--aq-error:     #b3261e;

	/* ---- Alias sémantiques ---- */
	--aq-bg: var(--aq-cream);
	--aq-surface: var(--aq-white);
	--aq-text: var(--aq-forest-800);
	--aq-muted: var(--aq-stone-500);
	--aq-border: var(--aq-forest-100);
	--aq-border-strong: var(--aq-forest-200);
	--aq-primary: var(--aq-forest-800);
	--aq-primary-hover: var(--aq-honey-500);
	--aq-accent: var(--aq-honey-400);

	--aq-radius: 28px;
	--aq-radius-sm: 16px;
	--aq-shadow: 0 18px 40px -24px rgba(25, 73, 81, 0.35);
	--aq-shadow-sm: 0 8px 24px -18px rgba(25, 73, 81, 0.45);
	--aq-font: "Poppins", ui-sans-serif, system-ui, sans-serif;
	--aq-maxw: 820px;

	box-sizing: border-box;
	max-width: var(--aq-maxw);
	margin-inline: auto;
	color: var(--aq-text);
	font-family: var(--aq-font);
	line-height: 1.6;
	font-feature-settings: "kern" 1, "liga" 1;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

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

.apisens-quiz .aq-app {
	background: var(--aq-bg);
	border: 1px solid var(--aq-border);
	border-radius: var(--aq-radius);
	padding: clamp(1.5rem, 4.5vw, 3rem);
	box-shadow: var(--aq-shadow);
}

/* ---- Eyebrow (label commun, intro/result) ---- */
.apisens-quiz .aq-eyebrow,
.apisens-quiz .aq-result-eyebrow {
	font-size: 0.7rem;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--aq-honey-600);
	margin: 0 0 0.7rem;
}

/* ---- Loading ---- */
.apisens-quiz .aq-loading { display: flex; justify-content: center; padding: 2rem; }
.apisens-quiz .aq-spinner {
	width: 30px; height: 30px;
	border: 3px solid var(--aq-forest-100);
	border-top-color: var(--aq-honey-400);
	border-radius: 50%;
	animation: aq-spin 0.8s linear infinite;
}
@keyframes aq-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .apisens-quiz .aq-spinner { animation: none; } }

.apisens-quiz .aq-noscript {
	background: var(--aq-forest-50);
	border: 1px solid var(--aq-border);
	border-radius: var(--aq-radius-sm);
	padding: 1rem 1.25rem;
}

/* ---- Intro ---- */
.apisens-quiz .aq-intro { text-align: center; padding: clamp(1rem, 3vw, 2.25rem) 0; }
.apisens-quiz .aq-intro-title {
	/* Titre éditorial fin, calqué sur .font-display-tight du thème (Poppins 100). */
	font-size: clamp(2rem, 5vw, 3rem);
	font-weight: 100;
	letter-spacing: -0.035em;
	line-height: 1.05;
	text-wrap: balance;
	margin: 0 0 0.7rem;
	color: var(--aq-forest-800);
}
.apisens-quiz .aq-intro-text {
	color: var(--aq-muted);
	max-width: 44ch;
	margin: 0 auto 2rem;
	font-size: 1.0625rem;
	line-height: 1.65;
	text-wrap: pretty;
}

/* ---- Progress ---- */
.apisens-quiz .aq-progress { margin-bottom: 1.75rem; }
.apisens-quiz .aq-progress-label {
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	color: var(--aq-forest-700);
	opacity: 0.72;
	margin-bottom: 0.6rem;
	text-transform: uppercase;
}
.apisens-quiz .aq-progress-track {
	height: 7px;
	background: var(--aq-forest-100);
	border-radius: 999px;
	overflow: hidden;
}
.apisens-quiz .aq-progress-bar {
	height: 100%;
	background: linear-gradient(90deg, var(--aq-honey-400), var(--aq-honey-500));
	border-radius: 999px;
	transition: width 0.4s ease;
}
@media (prefers-reduced-motion: reduce) { .apisens-quiz .aq-progress-bar { transition: none; } }

/* ---- Question ---- */
.apisens-quiz .aq-question-title {
	font-size: clamp(1.4rem, 3.2vw, 1.9rem);
	font-weight: 600;
	letter-spacing: -0.015em;
	line-height: 1.15;
	text-wrap: balance;
	margin: 0 0 0.45rem;
	color: var(--aq-forest-800);
	outline: none;
}
.apisens-quiz .aq-question-help {
	color: var(--aq-muted);
	margin: 0 0 1.5rem;
	font-size: 0.975rem;
	line-height: 1.55;
	max-width: 52ch;
}

/* ---- Options (radio group) ---- */
.apisens-quiz .aq-options { display: grid; gap: 0.7rem; margin-bottom: 1.75rem; }
.apisens-quiz .aq-option {
	display: flex;
	align-items: flex-start;
	gap: 0.9rem;
	width: 100%;
	min-height: 44px;
	text-align: left;
	padding: 1rem 1.15rem;
	background: var(--aq-surface);
	border: 1.5px solid var(--aq-border);
	border-radius: var(--aq-radius-sm);
	cursor: pointer;
	color: inherit;
	font: inherit;
	transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.apisens-quiz .aq-option:hover { border-color: var(--aq-border-strong); transform: translateY(-1px); }
.apisens-quiz .aq-option.is-selected {
	border-color: var(--aq-honey-400);
	background: var(--aq-honey-50);
	box-shadow: var(--aq-shadow-sm);
}
.apisens-quiz .aq-option:focus-visible { outline: 3px solid var(--aq-forest-800); outline-offset: 2px; }
.apisens-quiz .aq-option-check {
	flex: 0 0 auto;
	width: 22px; height: 22px;
	margin-top: 1px;
	border: 2px solid var(--aq-border-strong);
	border-radius: 50%;
	background: #fff;
	position: relative;
	transition: border-color 0.15s ease;
}
.apisens-quiz .aq-option.is-selected .aq-option-check { border-color: var(--aq-forest-800); }
.apisens-quiz .aq-option.is-selected .aq-option-check::after {
	content: "";
	position: absolute;
	inset: 4px;
	border-radius: 50%;
	background: var(--aq-forest-800);
}
.apisens-quiz .aq-option-body { display: flex; flex-direction: column; gap: 0.2rem; }
.apisens-quiz .aq-option-label {
	font-weight: 500;
	font-size: 1.0625rem;
	line-height: 1.3;
	color: var(--aq-forest-800);
}
.apisens-quiz .aq-option-subtitle {
	color: var(--aq-muted);
	font-size: 0.875rem;
	line-height: 1.4;
}

/* ---- Nav ---- */
.apisens-quiz .aq-nav { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.apisens-quiz .aq-nav-spacer { flex: 1; }

/* ---- Buttons (pills, langage Aries : forest-800 → honey-500) ---- */
.apisens-quiz .aq-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 48px;
	padding: 0.8rem 1.8rem;
	border-radius: 999px;
	border: 1.5px solid transparent;
	font: inherit;
	font-weight: 500;
	font-size: 0.95rem;
	letter-spacing: 0.01em;
	cursor: pointer;
	text-decoration: none;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}
.apisens-quiz .aq-btn:focus-visible { outline: 3px solid var(--aq-forest-800); outline-offset: 2px; }
.apisens-quiz .aq-btn-primary {
	background: var(--aq-forest-800);
	color: var(--aq-cream);
	border-color: var(--aq-forest-800);
}
.apisens-quiz .aq-btn-primary:hover { background: var(--aq-honey-500); border-color: var(--aq-honey-500); }
.apisens-quiz .aq-btn-primary[disabled] { opacity: 0.4; cursor: not-allowed; }
.apisens-quiz .aq-btn-ghost {
	background: var(--aq-cream);
	color: var(--aq-forest-700);
	border-color: var(--aq-forest-200);
}
.apisens-quiz .aq-btn-ghost:hover { background: var(--aq-forest-50); }

/* ---- Result ---- */
.apisens-quiz .aq-result-header { text-align: center; margin-bottom: 1.75rem; }
.apisens-quiz .aq-result-title {
	/* Titre éditorial fin, calqué sur .font-display-tight du thème (Poppins 100). */
	font-size: clamp(2.25rem, 5.6vw, 3.5rem);
	font-weight: 100;
	letter-spacing: -0.035em;
	margin: 0 0 1.1rem;
	line-height: 1.02;
	text-wrap: balance;
	color: var(--aq-forest-800);
	outline: none;
}
.apisens-quiz .aq-result-message {
	color: var(--aq-forest-700);
	max-width: 56ch;
	margin: 0 auto;
	font-size: 1.0625rem;
	line-height: 1.7;
	text-wrap: pretty;
}

/* ---- Encart "contour des yeux" (secondaire, séparé des produits) ---- */
.apisens-quiz .aq-eye-note {
	background: var(--aq-honey-50);
	border: 1px solid var(--aq-honey-400);
	border-radius: var(--aq-radius-sm);
	padding: 1rem 1.2rem;
	margin: 0 auto 2rem;
	max-width: 60ch;
}
.apisens-quiz .aq-eye-note-label {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	margin: 0 0 0.4rem;
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--aq-honey-600);
}
.apisens-quiz .aq-eye-note-ico { display: inline-flex; }
.apisens-quiz .aq-eye-note-ico svg { width: 16px; height: 16px; }
.apisens-quiz .aq-eye-note-text {
	margin: 0;
	font-size: 0.925rem;
	line-height: 1.6;
	color: var(--aq-forest-700);
	text-wrap: pretty;
}

.apisens-quiz .aq-products-title {
	font-size: 0.95rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	margin: 0 0 1.2rem;
	text-align: center;
	color: var(--aq-forest-800);
}

/* ---- Product grid / cards (calqué sur .product-card du thème) ---- */
.apisens-quiz .aq-products {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.1rem;
}
@media (min-width: 560px) { .apisens-quiz .aq-products { grid-template-columns: repeat(2, 1fr); } }

.apisens-quiz .aq-product {
	display: flex;
	flex-direction: column;
	background: var(--aq-white);
	border: 1px solid rgba(214, 230, 233, 0.6); /* forest-100/60 */
	border-radius: var(--aq-radius);
	overflow: hidden;
	transition: transform 0.5s ease, box-shadow 0.3s ease;
}
.apisens-quiz .aq-product:hover { transform: translateY(-4px); box-shadow: var(--aq-shadow-sm); }
.apisens-quiz .aq-product.is-eye { border-color: var(--aq-honey-400); box-shadow: 0 0 0 1.5px var(--aq-honey-400); }

.apisens-quiz .aq-product-media {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	background: var(--aq-bark-50);
	overflow: hidden;
}
.apisens-quiz .aq-product-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.apisens-quiz .aq-product-img-skeleton {
	width: 100%; height: 100%;
	background: linear-gradient(100deg, var(--aq-forest-50) 30%, #ffffff 50%, var(--aq-forest-50) 70%);
	background-size: 200% 100%;
	animation: aq-shimmer 1.3s ease-in-out infinite;
}
@keyframes aq-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .apisens-quiz .aq-product-img-skeleton { animation: none; } }

.apisens-quiz .aq-product-badge {
	position: absolute;
	top: 14px; left: 14px;
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.28rem 0.6rem;
	border-radius: 999px;
	background: var(--aq-honey-400);
	color: var(--aq-forest-900);
	font-size: 0.625rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.apisens-quiz .aq-product-body { display: flex; flex-direction: column; gap: 0.35rem; padding: 1.25rem; flex: 1; }
.apisens-quiz .aq-product-eyebrow {
	font-size: 0.65rem;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.15em;
	color: rgba(26, 77, 86, 0.55); /* forest-700/55 */
	margin: 0 0 0.1rem;
}
.apisens-quiz .aq-product-name {
	font-size: 1.0625rem;
	font-weight: 600;
	letter-spacing: -0.01em;
	line-height: 1.25;
	margin: 0;
	color: var(--aq-forest-800);
}
.apisens-quiz .aq-product-name a { color: inherit; text-decoration: none; transition: color 0.15s ease; }
.apisens-quiz .aq-product-name a:hover { color: var(--aq-honey-600); }
.apisens-quiz .aq-product-benefit {
	color: var(--aq-muted);
	font-size: 0.85rem;
	line-height: 1.45;
	margin: 0;
}

.apisens-quiz .aq-product-foot {
	margin-top: auto;
	padding-top: 1.1rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
}
.apisens-quiz .aq-product-price { font-size: 1.0625rem; font-weight: 600; color: var(--aq-forest-800); }
.apisens-quiz .aq-product-price del { color: var(--aq-muted); font-weight: 400; font-size: 0.9rem; margin-right: 0.35rem; }
.apisens-quiz .aq-product-price ins { text-decoration: none; }
.apisens-quiz .aq-price-skeleton {
	display: inline-block;
	width: 64px; height: 1.1em;
	border-radius: 5px;
	background: var(--aq-forest-50);
}

/* Round add-to-cart button (calqué sur le thème, agrandi à 44px pour l'a11y) */
.apisens-quiz .aq-add {
	flex: 0 0 auto;
	width: 44px; height: 44px;
	display: grid;
	place-items: center;
	border: none;
	border-radius: 50%;
	background: var(--aq-forest-800);
	color: var(--aq-cream);
	cursor: pointer;
	transition: background-color 0.2s ease, transform 0.15s ease;
}
.apisens-quiz .aq-add:hover:not([disabled]) { background: var(--aq-honey-500); }
.apisens-quiz .aq-add:active:not([disabled]) { transform: scale(0.94); }
.apisens-quiz .aq-add:focus-visible { outline: 3px solid var(--aq-forest-800); outline-offset: 2px; }
.apisens-quiz .aq-add[disabled] { opacity: 0.45; cursor: not-allowed; }
.apisens-quiz .aq-add.is-added { background: var(--aq-sage-500); }
.apisens-quiz .aq-add svg { width: 18px; height: 18px; }

.apisens-quiz .aq-unavailable {
	flex: 0 0 auto;
	font-size: 0.78rem;
	font-weight: 500;
	color: var(--aq-stone-500);
	padding: 0.4rem 0.7rem;
	border-radius: 999px;
	background: var(--aq-forest-50);
}

.apisens-quiz .aq-product-link {
	display: inline-block;
	margin-top: 0.85rem;
	width: fit-content;
	font-size: 0.78rem;
	font-weight: 500;
	color: var(--aq-forest-700);
	text-decoration: none;
	border-bottom: 1px solid var(--aq-forest-200);
	padding-bottom: 1px;
	transition: color 0.15s ease, border-color 0.15s ease;
}
.apisens-quiz .aq-product-link:hover { color: var(--aq-honey-600); border-color: var(--aq-honey-500); }

.apisens-quiz .aq-product-feedback { min-height: 1.1em; margin-top: 0.45rem; font-size: 0.84rem; }
.apisens-quiz .aq-cart-link { color: var(--aq-sage-500); font-weight: 600; text-decoration: underline; }
.apisens-quiz .aq-error { color: var(--aq-error); }

/* ---- Result actions ---- */
.apisens-quiz .aq-result-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.75rem;
	margin-top: 2.25rem;
}

/* ---- Editor placeholder (Gutenberg) ---- */
.apisens-quiz-editor-placeholder { display: block; }

/* ---------------------------------------------------------------------------
 * Masque le titre de page redondant sur les pages qui embarquent le quiz.
 * La classe body `apisens-quiz-page` est posée par le plugin uniquement quand
 * le shortcode / bloc est présent, et seulement si le filtre
 * `apisens_quiz/hide_page_title` est vrai (défaut). Ces sélecteurs ciblent le
 * chrome du THÈME, ils vivent donc volontairement hors du scope .apisens-quiz.
 * ------------------------------------------------------------------------- */
body.apisens-quiz-page article.type-page > h1:first-child,
body.apisens-quiz-page .entry-title,
body.apisens-quiz-page .page-title { display: none; }
