/*
 * Revoria 3.7.5 · Mode glace — inspiré du Liquid Glass d'Apple (iOS 26, macOS Tahoe 26), comme l'application
 * (web/src/styles/glace279.css).
 *
 * Actif quand <html data-glace> (script d'en-tête de inc/setup.php, assets/js/site.js). Pas d'attribut data-theme :
 * le verre suit le réglage clair / sombre de l'appareil. Par défaut sur Mac, iPhone et iPad tant que le visiteur n'a
 * pas choisi de thème ; choix mémorisé (localStorage rvt_theme).
 *
 * - Fond en dégradé bleu ; en-tête, sous-menus et panneaux de préférences en verre flouté (couche de navigation) ;
 *   cartes en verre translucide SANS flou (couche de contenu, défilement fluide sur téléphone).
 * - Reflet sur le bord haut, bordure lumineuse, ombre douce, boutons en capsule.
 * - Les scènes sombres (.scene, pied de page) restent sombres : leurs cartes utilisent toujours le verre sombre.
 * - Repli opaque : navigateur sans backdrop-filter, « Réduire la transparence », « Augmenter le contraste » ;
 *   « Réduire les animations » coupe l'effet d'appui.
 * Contraste WCAG AA vérifié par web/src/lib/glace279.test.ts (pire cas du fond).
 */

/* ------------------------------------------------------------------ matériau : variante claire (défaut) */
:root[data-glace] {
	--bg: #E6EDFB; --bg-alt: #FFFFFF; --surface: #FFFFFF; --surface-2: #EEF2FB;
	--text: #0B1434; --text-soft: #46506F;
	--g-bg-1: #C4D4FB; --g-bg-2: #DCD3FB; --g-bg-3: #CFE6FB;
	--g-bar: rgba(255, 255, 255, 0.6);
	--g-pop: rgba(255, 255, 255, 0.9);
	--g-card: rgba(255, 255, 255, 0.62);
	--g-fill: rgba(255, 255, 255, 0.55);
	--g-edge: rgba(255, 255, 255, 0.75);
	--g-hi: rgba(255, 255, 255, 0.95);
	--g-sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 50%);
	--g-shadow: 0 10px 30px -10px rgba(30, 50, 110, 0.25);
	--g-blur: blur(24px) saturate(170%);
	--g-ease: cubic-bezier(0.32, 0.72, 0, 1);
	color-scheme: light;
}

/* ------------------------------------------------------------------ matériau : variante sombre */
@media (prefers-color-scheme: dark) {
	:root[data-glace] {
		--bg: #0B1A4A; --bg-alt: #14265F; --surface: #14265F; --surface-2: #1B3070;
		--text: #F3F6FF; --text-soft: #D0D8F6;
		--link: #8BE0FF; --focus: #8BE0FF;
		--btn-bg: #00BFFF; --btn-text: #080F29; --btn-hover: #5CD6FF;
		--accent: #8BE0FF; --ok: #4ADE9B; --err: #FF8A8A;
		--line: rgba(200, 215, 255, 0.16); --line-strong: rgba(200, 215, 255, 0.3);
		--samira-text: var(--samira);
		--g-bg-1: #1F3C94; --g-bg-2: #172F7C; --g-bg-3: #2C2580;
		--g-bar: rgba(16, 30, 84, 0.52);
		--g-pop: rgba(20, 36, 96, 0.9);
		--g-card: rgba(255, 255, 255, 0.1);
		--g-fill: rgba(255, 255, 255, 0.08);
		--g-edge: rgba(255, 255, 255, 0.16);
		--g-hi: rgba(255, 255, 255, 0.28);
		--g-sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 46%);
		--g-shadow: 0 10px 30px -8px rgba(2, 6, 28, 0.55);
		--g-blur: blur(24px) saturate(180%);
		color-scheme: dark;
	}
	:root[data-glace] .logo-on-light { display: none !important; }
}
@media (prefers-color-scheme: light) {
	:root[data-glace] .logo-on-dark-only { display: none !important; }
}

/* Scènes sombres et pied de page : verre sombre, quelle que soit la variante */
:root[data-glace] .scene,
:root[data-glace] .site-footer {
	--g-card: rgba(255, 255, 255, 0.08);
	--g-fill: rgba(255, 255, 255, 0.08);
	--g-edge: rgba(255, 255, 255, 0.14);
	--g-hi: rgba(255, 255, 255, 0.24);
	--g-sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 46%);
	--g-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.5);
}

/* ------------------------------------------------------------------ fond (calque fixe : marche aussi sur iOS) */
:root[data-glace] { background: var(--bg); }
:root[data-glace] body { background: transparent; }
:root[data-glace] body::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background:
		radial-gradient(70% 55% at 12% 8%, color-mix(in srgb, var(--g-bg-1) 85%, transparent), transparent 70%),
		radial-gradient(60% 50% at 92% 18%, color-mix(in srgb, var(--g-bg-3) 70%, transparent), transparent 70%),
		radial-gradient(80% 60% at 55% 100%, color-mix(in srgb, var(--g-bg-2) 80%, transparent), transparent 72%),
		var(--bg);
}
:root[data-glace] .section:not(.scene) { background: transparent; }

/* ------------------------------------------------------------------ couche de navigation : verre flouté */
:root[data-glace] .site-header { border-bottom-color: var(--g-edge); }
:root[data-glace] .site-header::before {
	background: var(--g-bar);
	-webkit-backdrop-filter: var(--g-blur);
	backdrop-filter: var(--g-blur);
	box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--g-hi) 40%, transparent);
}
:root[data-glace] .sub-menu,
:root[data-glace] .prefs-panel {
	background: var(--g-sheen), var(--g-pop);
	border-color: var(--g-edge);
	border-radius: 20px;
	-webkit-backdrop-filter: var(--g-blur);
	backdrop-filter: var(--g-blur);
	box-shadow: inset 0 1px 0 var(--g-hi), var(--g-shadow);
}

/* ------------------------------------------------------------------ couche de contenu : verre translucide */
:root:where([data-glace]) :is(.plan, .fcard, .trade, .quote, .ps-item, .rv-case, .rv-addon, .cap, .social-card, .logos li, .cmp-side, .objection) {
	background: var(--g-sheen), var(--g-card);
	border-color: var(--g-edge);
	box-shadow: inset 0 1px 0 var(--g-hi), var(--g-shadow);
}

/* Boutons : capsules en verre ; le bouton principal garde sa couleur, avec un reflet */
:root[data-glace] .btn-secondary {
	background: var(--g-sheen), var(--g-fill);
	border-color: var(--g-edge);
	box-shadow: inset 0 1px 0 var(--g-hi);
}
:root[data-glace] .btn-primary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 20px -8px rgba(0, 60, 160, 0.45); }
:root[data-glace] .btn { transition: transform .35s var(--g-ease), background-color .2s, border-color .2s, color .2s; }
:root[data-glace] .period > label,
:root[data-glace] .chip-choice { background: var(--g-fill); border-color: var(--g-edge); }
:root[data-glace] .field input,
:root[data-glace] .field select,
:root[data-glace] .field textarea { background: var(--g-fill); border-color: var(--g-edge); }

/* Aperçu dans le menu des thèmes */
.swatch-glace {
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 55%),
		radial-gradient(circle at 30% 25%, #6F9BFF, #1D3A9E 70%);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

/* ------------------------------------------------------------------ mouvement */
@media (prefers-reduced-motion: no-preference) {
	:root[data-glace] .btn:active { transform: scale(0.97); }
}
@media (prefers-reduced-motion: reduce) {
	:root[data-glace] .btn { transition: none; }
}

/* ------------------------------------------------------------------ replis opaques (lisibilité d'abord) */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	:root[data-glace][data-glace] { --g-bar: var(--bg); --g-pop: var(--surface); --g-card: var(--surface); --g-fill: var(--surface-2); --g-blur: none; }
	:root[data-glace] .scene, :root[data-glace] .site-footer { --g-card: var(--surface); --g-fill: var(--surface-2); }
}
@media (prefers-reduced-transparency: reduce) {
	:root[data-glace][data-glace] { --g-bar: var(--bg); --g-pop: var(--surface); --g-card: var(--surface); --g-fill: var(--surface-2); --g-sheen: linear-gradient(transparent, transparent); --g-blur: none; }
	:root[data-glace] .scene, :root[data-glace] .site-footer { --g-card: var(--surface); --g-fill: var(--surface-2); }
}
@media (prefers-contrast: more) {
	:root[data-glace][data-glace] { --g-bar: var(--bg); --g-pop: var(--surface); --g-card: var(--surface); --g-fill: var(--surface-2); --g-sheen: linear-gradient(transparent, transparent); --g-edge: var(--text); --g-blur: none; }
	:root[data-glace] .scene, :root[data-glace] .site-footer { --g-card: var(--surface); --g-fill: var(--surface-2); }
}
