/* ==========================================================================
   EmpORrium — Calculatrice d'estimation [emporrium_estimation] (inc/estimation.php)
   Variables locales reprises de la charte du thème (emp-2026.css).
   ========================================================================== */

.emp-calc {
	--c-ink: var(--emp-ink, #1c1915);
	--c-text: var(--emp-text, #4a4136);
	--c-muted: var(--emp-muted, #7b6f60);
	--c-gold: var(--emp-gold, #b8893b);
	--c-gold-dark: var(--emp-gold-dark, #8d6626);
	--c-gold-light: var(--emp-gold-light, #e4c57e);
	--c-grad: var(--emp-gold-grad, linear-gradient(135deg, #efd590 0%, #d4ab5a 45%, #b8893b 100%));
	--c-cream: var(--emp-cream, #f7eed9);
	--c-ivory: var(--emp-ivory, #fffdf8);
	--c-line: var(--emp-line, rgba(184, 137, 59, 0.22));
	--c-title: var(--emp-font-title, "Book Antiqua", "Palatino Linotype", Palatino, Georgia, serif);
	--c-radius: 14px;

	container-type: inline-size;
	color: var(--c-text);
	font-family: var(--emp-font-text, "Montserrat", system-ui, sans-serif);
	font-size: 0.95rem;
	line-height: 1.5;
}

.emp-calc *,
.emp-calc *::before,
.emp-calc *::after {
	box-sizing: border-box;
}

.emp-calc .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* ---------- En-tête ---------- */

.emp-calc__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.6rem 1rem;
	margin-bottom: 1.2rem;
}

.emp-calc .emp-calc__title {
	margin: 0;
	color: var(--c-ink);
	font-family: var(--c-title);
	font-size: 1.35rem;
	font-weight: 700;
}

.emp-calc .emp-calc__spot {
	margin: 0;
	padding: 0.4rem 0.9rem;
	background: rgba(228, 197, 126, 0.18);
	border: 1px solid var(--c-line);
	border-radius: 99px;
	font-size: 0.82rem;
}

.emp-calc__spot strong {
	color: var(--c-gold-dark);
}

/* ---------- Mise en page : formulaire + résultat ---------- */

.emp-calc__layout {
	display: grid;
	gap: 1.2rem;
}

@container (min-width: 760px) {
	.emp-calc__layout {
		grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
		align-items: start;
	}

	.emp-calc__result {
		position: sticky;
		top: 100px;
	}
}

/* ---------- Groupes et lignes ---------- */

.emp-calc__form {
	display: grid;
	gap: 1.2rem;
	margin: 0;
}

.emp-calc__group {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.emp-calc__group legend {
	display: flex;
	align-items: baseline;
	gap: 0.5rem;
	margin-bottom: 0.6rem;
	padding: 0;
	color: var(--c-gold-dark);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.emp-calc__group legend span {
	color: var(--c-muted);
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: none;
}

.emp-calc__row {
	display: grid;
	grid-template-columns: 44px minmax(0, 1fr) auto 112px;
	align-items: center;
	gap: 0.8rem;
	padding: 0.6rem 0.7rem;
	background: var(--c-ivory);
	border: 1px solid var(--c-line);
	border-radius: var(--c-radius);
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.emp-calc__row + .emp-calc__row {
	margin-top: 0.5rem;
}

.emp-calc__row:focus-within {
	border-color: var(--c-gold);
	box-shadow: 0 0 0 3px rgba(184, 137, 59, 0.15);
}

.emp-calc__row.is-filled {
	background: linear-gradient(90deg, rgba(239, 213, 144, 0.22), var(--c-ivory) 60%);
	border-color: var(--c-gold-light);
}

.emp-calc__karat {
	display: flex;
	align-items: baseline;
	justify-content: center;
	padding-top: 0.75rem;
	width: 44px;
	height: 44px;
	background: var(--c-grad);
	border-radius: 50%;
	color: var(--c-ink);
	font-family: var(--c-title);
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1;
}

.emp-calc__karat small {
	font-size: 0.6em;
}

.emp-calc__coin {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	object-fit: cover;
	box-shadow: 0 2px 6px rgba(60, 40, 10, 0.2);
}

.emp-calc__name {
	min-width: 0;
}

.emp-calc__name strong {
	display: block;
	color: var(--c-ink);
	font-weight: 600;
}

.emp-calc__name small {
	display: block;
	overflow: hidden;
	color: var(--c-muted);
	font-size: 0.75rem;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.emp-calc__price {
	color: var(--c-gold-dark);
	font-weight: 700;
	white-space: nowrap;
}

.emp-calc__price small {
	color: var(--c-muted);
	font-size: 0.75em;
	font-weight: 500;
}

.emp-calc__qty {
	display: flex;
	align-items: center;
	margin: 0;
	background: #fff;
	border: 1px solid var(--c-line);
	border-radius: 10px;
	overflow: hidden;
}

.emp-calc__qty:focus-within {
	border-color: var(--c-gold);
}

.emp-calc .emp-calc__qty input {
	width: 100%;
	min-width: 0;
	height: 42px;
	margin: 0;
	padding: 0 0.3rem 0 0.7rem;
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	color: var(--c-ink);
	font: inherit;
	font-weight: 600;
	text-align: right;
	-moz-appearance: textfield;
	appearance: textfield;
}

.emp-calc .emp-calc__qty input:focus {
	outline: none;
}

.emp-calc__qty input::-webkit-outer-spin-button,
.emp-calc__qty input::-webkit-inner-spin-button {
	margin: 0;
	-webkit-appearance: none;
}

.emp-calc__qty span {
	padding: 0 0.7rem 0 0.2rem;
	color: var(--c-muted);
	font-size: 0.8rem;
}

/* ---------- Résultat ---------- */

.emp-calc__result {
	padding: 1.4rem;
	background:
		radial-gradient(ellipse at 90% 0%, rgba(228, 197, 126, 0.18), transparent 60%),
		linear-gradient(180deg, #221e19, #15120e);
	border: 1px solid rgba(228, 197, 126, 0.25);
	border-radius: 18px;
	box-shadow: 0 18px 50px rgba(40, 25, 5, 0.18);
	color: #d9ccb4;
}

.emp-calc .emp-calc__result p {
	margin: 0;
}

.emp-calc__result-label {
	color: var(--c-gold-light);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

.emp-calc .emp-calc__total {
	margin: 0.2rem 0 0.4rem;
	color: #fff8e8;
	font-size: clamp(2rem, 1.6rem + 2cqi, 2.6rem);
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
}

.emp-calc__tax {
	display: inline-block;
	padding: 0.25rem 0.7rem;
	background: rgba(228, 197, 126, 0.15);
	border-radius: 99px;
	color: var(--c-gold-light);
	font-size: 0.75rem;
}

.emp-calc__tax[hidden],
.emp-calc__hint[hidden],
.emp-calc__reset[hidden] {
	display: none;
}

.emp-calc__lines {
	margin: 1rem 0 0;
	padding: 0;
	list-style: none;
	font-size: 0.82rem;
}

.emp-calc__lines li {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.4rem 0;
	border-top: 1px solid rgba(228, 197, 126, 0.15);
}

.emp-calc__lines li span:last-of-type {
	color: #fff8e8;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.emp-calc__tmp {
	flex-basis: 100%;
	margin-top: -0.2rem;
	color: var(--c-gold-light);
	font-size: 0.72rem;
	font-variant-numeric: tabular-nums;
}

.emp-calc .emp-calc__hint {
	margin-top: 0.8rem;
	font-size: 0.82rem;
	opacity: 0.85;
}

.emp-calc .emp-calc__reset {
	margin-top: 0.6rem;
	padding: 0;
	background: none;
	border: 0;
	color: var(--c-gold-light);
	font: inherit;
	font-size: 0.8rem;
	text-decoration: underline;
	cursor: pointer;
}

.emp-calc__cta {
	display: grid;
	gap: 0.5rem;
	margin-top: 1.3rem;
	padding-top: 1.1rem;
	border-top: 1px solid rgba(228, 197, 126, 0.2);
}

.emp-calc .emp-calc__cta p {
	font-size: 0.8rem;
}

.emp-calc .emp-calc__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0.6rem 1rem;
	border: 1px solid rgba(228, 197, 126, 0.45);
	border-radius: 10px;
	color: #f6eedd;
	font-size: 0.88rem;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	transition: background-color 0.2s ease, transform 0.2s ease;
}

.emp-calc .emp-calc__btn:hover {
	background: rgba(228, 197, 126, 0.12);
	color: #fff;
}

.emp-calc .emp-calc__btn--gold {
	background: var(--c-grad);
	border-color: transparent;
	color: var(--c-ink);
	font-size: 1rem;
}

.emp-calc .emp-calc__btn--gold:hover {
	background: var(--c-grad);
	color: var(--c-ink);
	transform: translateY(-1px);
}

/* ---------- Note légale ---------- */

.emp-calc .emp-calc__note {
	margin: 1.2rem 0 0;
	color: var(--c-muted);
	font-size: 0.75rem;
	line-height: 1.5;
}

/* ---------- Bandeau mobile (total toujours visible) ---------- */

.emp-calc__sticky {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 90;
	display: flex;
	align-items: center;
	gap: 0.8rem;
	padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom));
	background: #17140f;
	border-top: 1px solid rgba(228, 197, 126, 0.3);
	box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.2);
	color: #d9ccb4;
	font-size: 0.8rem;
}

.emp-calc__sticky[hidden] {
	display: none;
}

.emp-calc__sticky strong {
	flex: 1;
	color: #fff8e8;
	font-size: 1.2rem;
	font-variant-numeric: tabular-nums;
}

.emp-calc .emp-calc__sticky button {
	min-height: 40px;
	padding: 0 1rem;
	background: var(--c-grad);
	border: 0;
	border-radius: 10px;
	color: var(--c-ink);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

@media (min-width: 900px) {
	.emp-calc__sticky {
		display: none !important;
	}
}

/* ---------- Petits écrans ---------- */

@container (max-width: 460px) {
	.emp-calc__row {
		grid-template-columns: 40px minmax(0, 1fr) 96px;
		grid-template-areas:
			"icon name qty"
			"icon price qty";
		row-gap: 0.1rem;
	}

	.emp-calc__karat,
	.emp-calc__coin {
		grid-area: icon;
		width: 40px;
		height: 40px;
	}

	.emp-calc__name {
		grid-area: name;
	}

	.emp-calc__name small {
		display: none;
	}

	.emp-calc__price {
		grid-area: price;
		font-size: 0.85rem;
	}

	.emp-calc__qty {
		grid-area: qty;
	}
}

@media (prefers-reduced-motion: reduce) {
	.emp-calc * {
		transition: none !important;
	}
}
