/**
 * Post components « La grue » (design-system §4 and §5b): block styles registered in inc/50-components.php and the patterns of
 * patterns/*.php. Loaded on the front end and in the editor. Values in these components always come from sources.
 */

/* ── Tables: graphite header, gris-clair zebra, tabular numbers (default for every table) ── */
.bm-prose .wp-block-table,
.editor-styles-wrapper .wp-block-table { margin-block: 1.75rem; border: 1px solid var(--bm-a6, #E6DDCB); border-radius: 4px; background: #FFFFFF; }
.bm-prose .wp-block-table table,
.editor-styles-wrapper .wp-block-table table { width: 100%; min-width: 520px; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.bm-prose .wp-block-table thead,
.editor-styles-wrapper .wp-block-table thead { border: 0; }
.bm-prose .wp-block-table th,
.editor-styles-wrapper .wp-block-table th { background: #1F2A33; color: #FFFFFF; font: 650 0.92rem/1.3 var(--wp--preset--font-family--heading); text-align: left; padding: 0.75rem 0.9rem; border: 0; }
.bm-prose .wp-block-table td,
.editor-styles-wrapper .wp-block-table td { padding: 0.7rem 0.9rem; border: 0; border-top: 1px solid #E6DDCB; vertical-align: top; }
.bm-prose .wp-block-table tbody tr:nth-child(even) td,
.editor-styles-wrapper .wp-block-table tbody tr:nth-child(even) td { background: #FAF7F1; }
.wp-block-table figcaption, .bm-table-note { color: #5A6670; font-size: 0.875rem; }

/* Two-column « Repères » table (label, value) */
.wp-block-table.is-style-bm-specs { border: 0; background: transparent; }
.wp-block-table.is-style-bm-specs table { min-width: 0; }
.wp-block-table.is-style-bm-specs td { padding: 0.6rem 0; border-top: 0; border-bottom: 1px dashed #D5C9B0; background: transparent !important; }
.wp-block-table.is-style-bm-specs td:first-child { color: #5A6670; width: 50%; padding-right: 1rem; }
.wp-block-table.is-style-bm-specs td:last-child { font: 650 1rem/1.35 var(--wp--preset--font-family--heading); text-align: right; }

/* ── Callouts ─────────────────────────────────────── */
.is-style-bm-note,
.is-style-bm-tip,
.is-style-bm-vigilance,
.is-style-bm-gain,
.bm-gain {
	position: relative;
	margin-block: 1.75rem;
	padding: 1.1rem 1.25rem 1.15rem 1.35rem;
	border-radius: 4px;
}
.is-style-bm-note > * , .is-style-bm-tip > *, .is-style-bm-vigilance > *, .is-style-bm-gain > * { margin-block: 0; }
.is-style-bm-note > * + *, .is-style-bm-tip > * + *, .is-style-bm-vigilance > * + *, .is-style-bm-gain > * + * { margin-top: 0.5rem; }
.bm-callout__title, .bm-gain__title { font-family: var(--wp--preset--font-family--heading); font-size: 1.02rem; }
.is-style-bm-note { background: #DCEBF1; border-left: 4px solid #1F2A33; }
.is-style-bm-tip { background: #FFFFFF; border: 1px solid #E6DDCB; padding-left: 3.4rem; }
.is-style-bm-tip::before {
	content: "";
	position: absolute;
	left: 1.15rem;
	top: 1.25rem;
	width: 18px;
	height: 18px;
	background: #C2452D;
	border-radius: 3px;
}
.is-style-bm-vigilance { background: #FFFFFF; border: 2px solid #1F2A33; box-shadow: 6px 6px 0 #E6DDCB; }
.is-style-bm-vigilance .bm-callout__title::before {
	content: "";
	display: inline-block;
	width: 0.9em;
	height: 0.8em;
	margin-right: 0.45em;
	vertical-align: -0.05em;
	background: #1F2A33;
	clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

/* Gain box: citron-pâle, lime left bar (« Ce que vous gagnez ») */
.is-style-bm-gain, .bm-gain { background: #F3EAD7; border-left: 6px solid #C2452D; }
.bm-gain__title { margin: 0 0 0.4rem; font-weight: 700; }
.bm-gain ul { margin: 0; padding: 0; list-style: none; }
.bm-gain li { position: relative; padding-left: 1.6rem; margin-top: 0.35rem; font-size: 1rem; line-height: 1.5; }
.bm-gain li::before { content: ""; position: absolute; left: 0; top: 0.42em; width: 0.8em; height: 0.8em; background: #C2452D; clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 86% 8%, 38% 72%); }

/* ── Spec card ────────────────────────────────────── */
.is-style-bm-spec, .bm-keys .bm-spec {
	margin-block: 1.75rem;
	padding: 1.15rem 1.25rem 0.6rem;
	border: 1px solid #E6DDCB;
	border-top: 4px solid #1F2A33;
	border-radius: 4px;
	background: #FFFFFF;
}
.is-style-bm-spec > h3, .bm-spec__heading { margin: 0 0 0.3rem; font: 700 1.05rem/1.3 var(--wp--preset--font-family--heading); }
.bm-spec__list { margin: 0; }
.bm-spec__list > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px dashed #D5C9B0; }
.bm-spec__list > div:last-child { border-bottom: 0; }
.bm-spec__list dt { color: #5A6670; font-size: 0.95rem; }
.bm-spec__list dd { margin: 0; font: 650 1rem/1.35 var(--wp--preset--font-family--heading); text-align: right; }
.bm-keys { display: grid; gap: 1rem; align-content: start; }
.bm-keys > * { margin: 0 !important; }

/* ── Performance scale: stepped bar sable → ciel → ardoise, last step brique (« avant → après ») ── */
.is-style-bm-scale { margin-block: 2rem; padding: 1.2rem 1.25rem 1rem; border: 1px solid #E6DDCB; border-radius: 4px; background: #FFFFFF; }
.is-style-bm-scale > * { margin-block: 0; }
.bm-scale__title { font: 700 1.02rem/1.3 var(--wp--preset--font-family--heading); }
.bm-scale__note { margin-top: 0.75rem !important; color: #5A6670; font-size: 0.875rem; }
.is-style-bm-scale ul,
.is-style-bm-scale ol {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(0, 1fr);
	align-items: end;
	gap: 6px;
	margin: 1rem 0 0 !important;
	padding: 0;
	list-style: none;
}
.is-style-bm-scale li { display: flex; flex-direction: column; gap: 0.45rem; margin: 0; font-size: 0.875rem; line-height: 1.3; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.is-style-bm-scale li strong { display: block; font-family: var(--wp--preset--font-family--heading); font-size: 0.92rem; }
.is-style-bm-scale li::before { content: ""; display: block; height: 18px; border-radius: 3px; background: linear-gradient(rgb(31 42 51 / 0.1) 1px, transparent 1px) 0 0 / 100% 8px, #E9D8B4; }
.is-style-bm-scale li:nth-child(2)::before { height: 30px; background-color: #DCC594; }
.is-style-bm-scale li:nth-child(3)::before { height: 42px; background-color: #8FB8C9; }
.is-style-bm-scale li:nth-child(4)::before { height: 54px; background-color: #5A6670; }
.is-style-bm-scale li:nth-child(5)::before { height: 66px; background-color: #1F2A33; }
.is-style-bm-scale li:last-child::before { background-color: #C2452D; }

/* ── Lists ────────────────────────────────────────── */
.is-style-bm-check { padding-left: 0; list-style: none; }
.is-style-bm-check li { position: relative; padding-left: 2rem; margin-top: 0.45rem; }
.is-style-bm-check li::before { content: ""; position: absolute; left: 0; top: 0.3em; width: 1.05em; height: 1.05em; background: #E9D8B4; box-shadow: inset 0 0 0 1.5px #1F2A33; border-radius: 3px; }
.is-style-bm-check li::after { content: ""; position: absolute; left: 0.3em; top: 0.48em; width: 0.42em; height: 0.24em; border-left: 2px solid #1F2A33; border-bottom: 2px solid #1F2A33; transform: rotate(-45deg); }

/* Steps: a real sequence drawn as stacked levels (counter N1, N2…). */
ol.is-style-bm-steps { counter-reset: bm-step; padding-left: 0; list-style: none; }
ol.is-style-bm-steps li { counter-increment: bm-step; position: relative; margin-top: 0.6rem; padding: 0.75rem 1rem 0.75rem 3.6rem; border: 1px solid #E6DDCB; border-left: 4px solid #C2452D; border-radius: 2px; background: #FFFFFF; }
ol.is-style-bm-steps li::before {
	content: counter(bm-step);
	position: absolute;
	left: 0.85rem;
	top: 0.78rem;
	display: grid;
	place-items: center;
	width: 1.9rem;
	height: 1.9rem;
	background: #1F2A33;
	color: #E9D8B4;
	font: 800 0.95rem/1 var(--wp--preset--font-family--heading);
	border-radius: 4px;
	font-variant-numeric: tabular-nums;
}
ol.is-style-bm-steps li:last-child { border-left-color: #A63823; }

/* ── Level marker headings: « ▽ N0 », « ▽ N1 »… automatically, in order (anchors of a guide) ── */
.bm-prose, .editor-styles-wrapper { counter-reset: bm-n -1; }
h2.is-style-bm-niveau { counter-increment: bm-n; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.25rem 0.75rem; padding-top: 0.9rem; border-top: 2px solid #1F2A33; }
h2.is-style-bm-niveau::before {
	content: "N" counter(bm-n);
	flex: none;
	padding: 0.3em 0.5em 0.28em;
	border-radius: 2px;
	background: #1F2A33;
	color: #E9D8B4;
	font: 800 0.8rem/1 var(--wp--preset--font-family--heading);
	font-variant-numeric: tabular-nums;
	transform: translateY(-0.2em);
}

/* ── Calculator forms (travaux-calculateurs engine): two fields sharing a row keep their inputs aligned.
   Labels reserve two lines at ≥ 600 px and sit at the bottom of that space, so a one-line label and a two-line label
   put their inputs on the same line. ── */
@media (min-width: 600px) {
	.tc-calc__grid > .tc-field:not(.tc-field--wide):not(.tc-field--pills) > label { display: flex; align-items: flex-end; min-height: calc(2 * 1.3em); }
	.tc-field__unit { display: flex; align-items: center; }
}
