/* =============================================================
   BLOC RECETTE — carte + impression (Le Caribou, thème FSE)
   Port de la carte de tasks/preview/recette.html. Chargé seulement
   quand le bloc `acf/recette` est présent (front ET éditeur), via
   enqueue_assets du bloc. Les valeurs appartiennent à theme.json ;
   on ne fait qu'aliaser — mais on redéclare ici les alias car cette
   feuille peut se charger dans l'éditeur, où content.css est absent.
   ============================================================= */

.recipe {
	--terre: var(--wp--preset--color--terre);
	--spruce-900: var(--wp--preset--color--spruce-900);
	--spruce-800: var(--wp--preset--color--spruce-800);
	--bourgogne: var(--wp--preset--color--bourgogne);
	--clay: var(--wp--preset--color--clay);
	--sauge: var(--wp--preset--color--sauge);
	--bg: var(--wp--preset--color--bg);
	--surface: var(--wp--preset--color--surface);
	--ink: var(--wp--preset--color--ink);
	--ink-soft: var(--wp--preset--color--ink-soft);
	--line: var(--wp--preset--color--line);
	--line-strong: var(--wp--preset--color--line-strong);
	--on-dark: var(--wp--preset--color--on-dark);
	--grotesk: var(--wp--preset--font-family--grotesk);
	--sans: var(--wp--preset--font-family--sans);
	--step-2: var(--wp--preset--font-size--section);
	--head-h: 60px;
}

/* ================= CARTE RECETTE ================= */
.recipe {
	margin: 2.8rem auto;
	background: var(--bg);
	border: 1.5px solid var(--line-strong);
	border-radius: 18px;
	overflow: hidden;
	scroll-margin-top: calc(var(--head-h) + 1.5rem);
	box-shadow: 0 1px 2px oklch(0.2 0.02 60 / .04), 0 14px 34px oklch(0.2 0.02 60 / .06);
}
/* La carte sort de la colonne de lecture (47.5rem/760px) : alignwide lui donne wideSize,
   on la replafonne à ~900px et on la centre. !important pour battre la règle de
   layout générée par le cœur (.is-layout-constrained > .alignwide, spéc. 0,3,0). */
.recipe.alignwide, .recipe.alignfull { max-width: min(900px, 100%) !important; margin-inline: auto !important; }
/* Quand un rail de sommaire fixe occupe la marge gauche (long article, ≥1240px),
   la carte revient à la largeur de lecture pour ne pas passer sous le rail
   (toc-rail.js pose .lc-has-toc-rail sur <body>). Les articles sans rail gardent
   la largeur généreuse de 900px. */
body.lc-has-toc-rail .recipe.alignwide,
body.lc-has-toc-rail .recipe.alignfull { max-width: var(--measure, 47.5rem) !important; }

.recipe-head { padding: clamp(1.5rem, 3.5vw, 2rem) clamp(1.4rem, 3.5vw, 2rem) 0; }
.recipe-kx { font-family: var(--grotesk); font-weight: 800; font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; color: var(--bourgogne); display: flex; align-items: center; gap: .55rem; margin: 0; }
.recipe-kx::before { content: ""; width: 1.5rem; height: 2px; background: var(--bourgogne); }
.recipe-head h2 { font-family: var(--grotesk); font-weight: 800; font-size: var(--step-2); line-height: 1.08; letter-spacing: -.03em; color: var(--ink); margin: .7rem 0 0; text-wrap: balance; }
.recipe-desc { font-family: var(--sans); font-size: var(--step-0); line-height: 1.5; color: var(--ink-soft); margin: .55rem 0 0; max-width: 52ch; }

.recipe-stats { list-style: none; display: flex; flex-wrap: wrap; gap: 1.1rem 1.9rem; margin: 1.3rem 0 0; padding: 1.15rem 0; border-top: 1px solid var(--line); }
.recipe-stats li { display: flex; align-items: center; gap: .65rem; margin: 0; }
.recipe-stats .ico { width: 36px; height: 36px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); color: var(--terre); display: grid; place-items: center; flex-shrink: 0; }
.recipe-stats .ico svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.recipe-stats .stat-txt { display: flex; flex-direction: column; line-height: 1.15; }
.recipe-stats .v { font-family: var(--grotesk); font-weight: 700; font-size: 1.02rem; color: var(--ink); }
.recipe-stats .l { font-family: var(--sans); font-size: .82rem; color: var(--ink-soft); margin-top: .05rem; }

.recipe-tools { display: flex; flex-wrap: wrap; gap: .7rem; margin: 0; padding: 1.1rem 0 clamp(1.4rem, 3.5vw, 1.9rem); border-top: 1px solid var(--line); }
.rtool { font: inherit; font-family: var(--grotesk); font-weight: 700; font-size: .92rem; display: inline-flex; align-items: center; gap: .55rem; padding: .62rem 1.05rem; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--bg); color: var(--ink); cursor: pointer; transition: background .2s, border-color .2s, color .2s; min-height: 44px; }
.rtool svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.9; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.rtool:hover { border-color: var(--terre); color: var(--terre); }
.rtool.wake .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); transition: background .2s; flex-shrink: 0; }
.rtool.wake[aria-pressed="true"] { background: var(--spruce-800); border-color: var(--spruce-800); color: var(--on-dark); }
.rtool.wake[aria-pressed="true"]:hover { background: var(--spruce-900); border-color: var(--spruce-900); color: var(--on-dark); }
.rtool.wake[aria-pressed="true"] .dot { background: var(--sauge); }

.recipe-body { padding: clamp(1.4rem, 2.5vw, 1.8rem); display: grid; gap: clamp(1.5rem, 3.5vw, 2.6rem); border-top: 1px solid var(--line); }
@media (min-width: 800px) {
	.recipe-body { grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.18fr); }
	.recipe-steps { padding-left: clamp(1.6rem, 3vw, 2.6rem); border-left: 1px solid var(--line); }
}
.recipe-col h3 { font-family: var(--grotesk); font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em; color: var(--ink); margin: 0 0 1rem; padding-bottom: .55rem; border-bottom: 2px solid var(--ink); }

.ing-group + .ing-group { margin-top: 1.25rem; }
.ing-group h4 { font-family: var(--grotesk); font-weight: 700; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--clay); margin: 0 0 .35rem; }
.recipe-ingredients ul { list-style: none; margin: 0; padding: 0; }
.recipe-ingredients li { border-bottom: 1px solid var(--line); margin: 0; }
.recipe-ingredients li:last-child { border-bottom: 0; }
.recipe-ingredients label { display: flex; gap: .75rem; align-items: flex-start; cursor: pointer; padding: .6rem .2rem; min-height: 44px; font-size: var(--step-0); line-height: 1.45; color: var(--ink); }
.recipe-ingredients input { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; margin-top: .16rem; border: 1.7px solid var(--line-strong); border-radius: 5px; flex-shrink: 0; cursor: pointer; position: relative; background: var(--bg); transition: background .15s, border-color .15s; }
.recipe-ingredients input:checked { background: var(--sauge); border-color: var(--sauge); }
.recipe-ingredients input:checked::after { content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid oklch(0.26 0.03 160); border-width: 0 2.3px 2.3px 0; transform: rotate(45deg); }
.recipe-ingredients input:focus-visible { outline: 2px solid var(--bourgogne); outline-offset: 2px; }
.recipe-ingredients span { transition: color .15s; }
.recipe-ingredients input:checked ~ span { text-decoration: line-through; text-decoration-color: var(--line-strong); color: var(--ink-soft); }

.recipe-steps ol { list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 1.15rem; margin: 0; padding: 0; }
.recipe-steps li { counter-increment: s; position: relative; padding-left: 3.1rem; font-size: var(--step-0); line-height: 1.6; color: var(--ink); margin: 0; }
.recipe-steps li::before { content: counter(s); position: absolute; left: 0; top: -.1rem; width: 2.15rem; height: 2.15rem; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--line-strong); color: var(--bourgogne); font-family: var(--grotesk); font-weight: 800; font-size: .95rem; display: grid; place-items: center; }
.recipe-steps li b, .recipe-steps li strong { font-family: var(--grotesk); font-weight: 700; color: var(--ink); }

.recipe-notes { padding: clamp(1.4rem, 4vw, 1.8rem) clamp(1.3rem, 4vw, 2rem); border-top: 1px solid var(--line); background: var(--surface); }
.recipe-notes .notes-kx { font-family: var(--grotesk); font-weight: 800; font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; color: var(--terre); display: flex; align-items: center; gap: .55rem; margin: 0 0 .8rem; }
.recipe-notes .notes-kx::before { content: ""; width: 1.5rem; height: 2px; background: var(--terre); }
.recipe-notes p { font-size: var(--step-0); line-height: 1.6; color: var(--ink); margin: 0 0 .85rem; }
.recipe-notes p:last-child { margin-bottom: 0; }
.recipe-notes strong { font-family: var(--grotesk); font-weight: 700; }

.recipe-source { display: none; }

/* ================= IMPRESSION : la seule carte recette =================
   Le corps d'article vit dans .prose (post-content) ; le hero, la fiche auteur,
   « À lire ensuite », les commentaires et le chrome sont ailleurs. On masque tout
   le mobilier par son nom, puis, dans la colonne de lecture, tout sauf la carte. */
@media print {
	@page { margin: 12mm; }
	html, body { background: #fff; color: #000; margin: 0; padding: 0; }

	.progress, .site-head, .m-overlay, .signals-dialog,
	.hero, .author-card, .reads, .comments, .site-foot,
	.recipe-tools { display: none !important; }

	/* dans la prose, on ne garde que le bloc (ou son conteneur) qui porte la carte */
	.prose > *:not(:has(.recipe)):not(.recipe) { display: none !important; }

	/* on annule les marges/paddings de la chaîne d'ancêtres : sinon leur espacement
	   résiduel sous la carte pousse une 2e page blanche */
	main, article, .prose,
	main.wp-block-group, article.wp-block-group,
	article > .wp-block-group { margin: 0 !important; padding: 0 !important; }

	/* la carte reprend toute la largeur de la page (annule alignwide/max-width) */
	.recipe, .recipe.alignwide, .recipe.alignfull { max-width: none !important; width: 100% !important; margin: 0 !important; border: 1px solid #bbb; border-radius: 0; box-shadow: none; overflow: visible; }

	/* --- échelle typo compacte pour tenir sur une page --- */
	.recipe-head { padding: 0 0 .4rem; }
	.recipe-kx { font-size: 7.5pt; }
	.recipe-head h2 { font-size: 16pt; margin: .2rem 0 0; }
	.recipe-desc { font-size: 9pt; margin-top: .2rem; }
	.recipe-stats { gap: .3rem 1.2rem; padding: .45rem 0; margin-top: .5rem; }
	.recipe-stats .ico { width: 22px; height: 22px; border-radius: 6px; }
	.recipe-stats .ico svg { width: 13px; height: 13px; }
	.recipe-stats .v { font-size: 9pt; }
	.recipe-stats .l { font-size: 7pt; }

	/* deux colonnes en impression : plus compact verticalement qu'empilé */
	.recipe-body { display: grid !important; grid-template-columns: 0.72fr 1.18fr; gap: .6rem 1.3rem; padding: .5rem 0 0; border-top: 1px solid #ddd; }
	.recipe-col h3 { font-size: 11pt; margin: 0 0 .4rem; padding-bottom: .25rem; }
	.ing-group + .ing-group { margin-top: .5rem; }
	.ing-group h4 { font-size: 7.5pt; margin-bottom: .1rem; }
	.recipe-ingredients label { padding: .18rem .1rem; min-height: 0; font-size: 9pt; line-height: 1.25; gap: .5rem; }
	.recipe-ingredients input { width: 13px; height: 13px; margin-top: .12rem; border-color: #999; }
	.recipe-steps { border-left: 0 !important; padding-left: 0 !important; }
	.recipe-steps ol { gap: .5rem; }
	.recipe-steps li { font-size: 9pt; line-height: 1.3; padding-left: 1.9rem; break-inside: avoid; }
	.recipe-steps li::before { width: 1.4rem; height: 1.4rem; font-size: 7.5pt; border-color: #999; color: #000; background: #fff; }
	.recipe-ingredients li { break-inside: avoid; }
	.recipe-stats .ico { border-color: #999; color: #000; background: #fff; }
	.recipe-notes { background: #fff; border-top: 1px solid #ddd; padding: .5rem 0 0; margin-top: .5rem; }
	.recipe-notes .notes-kx { font-size: 7.5pt; margin-bottom: .35rem; }
	.recipe-notes p { font-size: 8.5pt; line-height: 1.3; margin-bottom: .35rem; }
	.recipe-source { display: block; padding: .5rem 0 0; font-family: var(--grotesk); font-size: 7.5pt; color: #555; }
	a[href] { color: #000; text-decoration: none; }
}
