/* ============================================================================
   comment-faire.css — rubrique « Découvrez comment faire » (/comment-faire) :
   accueil de la rubrique et gabarit d'une fiche.
   Chargée après bellestone.css (tokens --blush, --encre, --rose…, .bst-eyebrow,
   .bst-title, .btn-bst). Préfixe cf-.
   Les dessins des cartes et des étapes sont des SVG en ligne
   (resources/views/comment-faire/vignettes/) : ils dessinent l'interface avec
   les jetons de la charte, sans picto.
   La mise en page suit la largeur de .cf (requêtes de conteneur) et non celle
   de la fenêtre : un compte connecté a la barre latérale, qui réduit la page.
   ============================================================================ */

.cf-page { background: var(--blush); }
.cf {
    container-type: inline-size;
    padding-block: clamp(36px, 5vw, 72px) clamp(56px, 7vw, 110px);
}

/* ---------- Accueil : en-tête ---------- */
.cf-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: clamp(32px, 6cqi, 72px); align-items: center; }
.cf-hero__text { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.cf-hero h1 { font-size: clamp(2.5rem, 1.5rem + 4cqi, 4.4rem); margin: 0; text-wrap: balance; }
.cf-lead { max-width: 54ch; margin: 0; font-size: 1.12rem; line-height: 1.65; color: var(--encre-72); text-wrap: pretty; }
.cf-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.cf-count { margin: 0; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--encre-72); }

/* la photo dans l'arche, avec l'encart des étapes qui déborde en bas à gauche */
.cf-hero__visual { position: relative; max-width: 440px; width: 100%; justify-self: end; padding: 0 0 34px 34px; }
.cf-hero__visual .bst-arch-frame { aspect-ratio: 4 / 4.6; }
.cf-float {
    position: absolute; left: 0; bottom: 0;
    display: flex; flex-direction: column; gap: 10px;
    margin: 0; padding: 18px 22px 18px 18px; list-style: none;
    background: var(--blanc); border-radius: var(--r-bst-sm); box-shadow: var(--shadow-bst);
}
.cf-float li { display: flex; align-items: center; gap: 12px; font-size: .86rem; font-weight: 500; color: var(--encre-72); white-space: nowrap; }
.cf-float span { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .08em; }
.cf-float .is-current { color: var(--encre); font-weight: 600; }
.cf-float .is-current span { color: var(--rose-deep); }

/* ---------- Accueil : familles ---------- */
.cf-family { margin-top: clamp(52px, 7cqi, 88px); scroll-margin-top: 5.5rem; }
.cf-family__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 32px; }
.cf-family__head h2 { font-size: clamp(1.9rem, 1.3rem + 2cqi, 2.8rem); margin: 12px 0 0; }
.cf-family__lead { max-width: 44ch; margin: 0; color: var(--encre-72); line-height: 1.55; text-wrap: pretty; }
.cf-grid { display: grid; grid-template-columns: repeat(var(--cf-cols, 4), minmax(0, 1fr)); gap: 26px 22px; margin-top: 28px; }

/* ---------- Carte d'une fiche : dessin, en-tête, résumé, pied ---------- */
.cf-card {
    position: relative; display: flex; flex-direction: column; overflow: hidden;
    background: var(--blanc); border-radius: var(--r-bst-sm); box-shadow: var(--shadow-bst-sm);
    transition: transform .35s var(--ease-brand), box-shadow .35s var(--ease-brand);
}
/* les quatre régions s'alignent d'une carte à l'autre sur la même rangée */
@supports (grid-template-rows: subgrid) {
    .cf-card { display: grid; grid-template-rows: subgrid; grid-row: span 4; row-gap: 0; }
}
.cf-card > header { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px 0; }
.cf-card__tag { margin: 0; font-family: var(--font-mono); font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; color: var(--encre-72); }
.cf-card h3 { margin: 0; font-family: var(--font-serif); font-weight: 500; font-size: 1.4rem; line-height: 1.18; letter-spacing: -.01em; text-wrap: pretty; }
.cf-card h3 a { color: var(--encre); text-decoration: none; }
.cf-card > p { margin: 0; padding: 10px 20px 18px; font-size: .92rem; line-height: 1.55; color: var(--encre-72); text-wrap: pretty; }
.cf-card > footer { margin: auto 20px 0; padding: 13px 0 16px; border-top: 1px solid var(--line); text-align: right; }
.cf-card__more { font-size: .86rem; font-weight: 600; color: var(--rose-deep); }

/* le lien du titre couvre toute la carte ; survol et focus se dessinent sur la carte */
.cf-card h3 a::after { content: ""; position: absolute; inset: 0; }
.cf-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-bst); }
@supports selector(:has(a)) {
    .cf-card h3 a:focus-visible { outline: none; }
    .cf-card:has(h3 a:focus-visible) { outline: 2px solid var(--rose); outline-offset: 4px; }
}
@media (prefers-reduced-motion: reduce) {
    .cf-card { transition: none; }
    .cf-card:hover { transform: none; }
}

/* ---------- Encart sombre : complète la rangée d'une famille (clé aside du catalogue) ---------- */
.cf-panel {
    grid-row: span 4;
    display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 14px;
    padding: 30px 24px; border-radius: var(--r-bst-sm);
    background: var(--encre); color: var(--blush);
}
.cf-panel .bst-eyebrow { color: rgba(251, 246, 244, .72); }
.cf-panel__title { max-width: 20ch; margin: 0; font-family: var(--font-serif); font-weight: 400; font-size: 1.6rem; line-height: 1.12; color: var(--blush); text-wrap: pretty; }
.cf-panel__title em { font-style: italic; color: var(--rose); }
.cf-panel__text { max-width: 46ch; margin: 0; line-height: 1.6; color: rgba(251, 246, 244, .72); }
.cf-panel .btn-bst { margin-top: 6px; }

/* ---------- Bandeau de fin ---------- */
.cf-help { margin-top: clamp(52px, 7cqi, 88px); padding: clamp(28px, 4cqi, 44px); border-radius: var(--r-bst); background: var(--sable); }
.cf-help h2 { margin: 0 0 10px; font-size: clamp(1.6rem, 1.2rem + 1.4cqi, 2.2rem); }
.cf-help p { max-width: 60ch; margin: 0 0 20px; line-height: 1.6; color: var(--encre-72); }
.cf-help__actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ============ Gabarit d'une fiche ============ */
.cf-fiche-head { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: clamp(32px, 6cqi, 64px); align-items: center; }
.cf-fiche-head__text { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.cf-fiche-head h1 { font-size: clamp(2.2rem, 1.4rem + 3.2cqi, 3.6rem); margin: 0; text-wrap: balance; }
.cf-fiche-head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 6px; }
.cf-fiche-head__visual { overflow: hidden; border-radius: var(--r-bst); box-shadow: var(--shadow-bst); }
.cf-back { font-family: var(--font-mono); font-size: .7rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--encre-72); text-decoration: none; }
.cf-back:hover { color: var(--rose-deep); }
.cf-back:focus-visible { outline: 2px solid var(--rose); outline-offset: 4px; border-radius: 4px; }

/* ---------- Corps : sommaire collant et étapes ---------- */
.cf-fiche-body { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: clamp(28px, 5cqi, 56px); align-items: start; margin-top: clamp(40px, 6cqi, 64px); padding-top: clamp(28px, 4cqi, 44px); border-top: 1px solid var(--line); }
.cf-toc { position: sticky; top: 5.5rem; }
.cf-toc__title { margin: 0 0 14px; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--encre-72); }
.cf-toc ol { margin: 0; padding: 0; list-style: none; counter-reset: cf-toc; display: flex; flex-direction: column; gap: 2px; scroll-target-group: auto; }
.cf-toc li { counter-increment: cf-toc; }
.cf-toc a { display: flex; gap: 10px; padding: 7px 10px 7px 12px; border-left: 2px solid transparent; font-size: .9rem; line-height: 1.4; color: var(--encre-72); text-decoration: none; text-wrap: balance; }
.cf-toc a::before { flex: none; content: counter(cf-toc, decimal-leading-zero); content: counter(cf-toc, decimal-leading-zero) / ""; font-family: var(--font-mono); font-size: .68rem; line-height: 1.85; letter-spacing: .06em; }
.cf-toc a:hover { color: var(--encre); }
.cf-toc a:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; border-radius: 4px; }
/* l'étape à l'écran : filet, graisse et couleur (jamais la couleur seule) */
.cf-toc a:is(:target-current, .is-active) { border-left-color: var(--rose); color: var(--encre); font-weight: 600; }

/* ---------- Vidéo de la fiche (facultative) : rien n'est chargé de YouTube avant le clic ---------- */
.cf-video { margin-bottom: clamp(40px, 6cqi, 56px); }
.cf-video__frame { position: relative; overflow: hidden; border-radius: var(--r-bst); background: var(--encre); }
.cf-video__frame.is-playing { aspect-ratio: 16 / 9; }
.cf-video__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cf-video__poster { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: clamp(26px, 4cqi, 40px); }
.cf-video__poster .bst-eyebrow { margin: 0; font-size: .7rem; font-weight: 500; color: rgba(251, 246, 244, .72); }
.cf-video__title { max-width: 24ch; margin: 0; font-family: var(--font-serif); font-size: clamp(1.5rem, 1.1rem + 1.6cqi, 2rem); line-height: 1.12; color: var(--blush); text-wrap: pretty; }
.cf-video__poster .btn-bst { margin-top: 10px; }
.cf-video__notice { margin: 12px 0 0; font-size: .8rem; line-height: 1.55; color: var(--encre-72); }
.cf-video__notice a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Une étape : numéro (compteur CSS), texte, dessin ---------- */
.cf-steps { margin: 0; padding: 0; list-style: none; counter-reset: cf-step; }
.cf-step { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) minmax(0, .95fr); gap: 0 28px; align-items: start; padding-bottom: 52px; counter-increment: cf-step; scroll-margin-top: 5.5rem; }
.cf-step:last-child { padding-bottom: 0; }
.cf-step::before {
    display: grid; place-items: center; width: 44px; height: 44px;
    border: 1.5px solid var(--encre); border-radius: 50%; background: var(--blanc);
    font-family: var(--font-mono); font-size: .8rem; font-weight: 500; letter-spacing: .04em; color: var(--rose-deep);
    content: counter(cf-step, decimal-leading-zero); content: counter(cf-step, decimal-leading-zero) / "";
}
/* le filet qui relie une étape à la suivante */
.cf-step:not(:last-child)::after { content: ""; position: absolute; top: 54px; bottom: 10px; left: 21.5px; width: 1px; background: var(--line); }
.cf-step:focus { outline: none; }
.cf-step:focus-visible { outline: 2px solid var(--rose); outline-offset: 10px; border-radius: 8px; }
.cf-step__text { padding-top: 6px; }
/* sans dessin, le texte prend toute la largeur */
.cf-step__text:last-child { grid-column: 2 / -1; max-width: 68ch; }
.cf-step h2 { margin: 0 0 12px; font-family: var(--font-serif); font-weight: 500; font-size: 1.7rem; line-height: 1.15; letter-spacing: -.012em; color: var(--encre); text-wrap: pretty; }
.cf-step__figure { overflow: hidden; border-radius: var(--r-bst-sm); box-shadow: var(--shadow-bst-sm); }

/* texte courant des étapes et des notes */
.cf-prose { font-size: 1rem; line-height: 1.7; color: var(--encre-72); }
.cf-prose p { margin: 0 0 12px; text-wrap: pretty; }
.cf-prose p:last-child { margin-bottom: 0; }
.cf-prose strong { color: var(--encre); font-weight: 600; }
.cf-prose a { color: var(--encre); text-decoration: underline; text-decoration-color: var(--rose); text-underline-offset: 3px; }
.cf-prose a:hover { color: var(--rose-deep); }
.cf-prose ul { margin: 0; padding-left: 1.1em; }
.cf-prose li { margin-bottom: 10px; text-wrap: pretty; }
.cf-prose li::marker { color: var(--rose); }

/* ---------- Bon à savoir ---------- */
.cf-notes { margin-top: clamp(40px, 6cqi, 56px); padding: 28px 30px 20px; border-radius: var(--r-bst); background: var(--sable); }
.cf-notes h2 { margin: 0 0 16px; font-family: var(--font-serif); font-weight: 500; font-size: 1.55rem; line-height: 1.2; color: var(--encre); }
.cf-notes .cf-prose { color: var(--encre); }

/* ---------- D'une fiche à l'autre : précédente, toutes, suivante ---------- */
.cf-pager { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin-top: clamp(52px, 7cqi, 72px); }
.cf-pager__link { grid-column: 1; display: flex; flex-direction: column; gap: 8px; padding: 22px 24px; border-radius: var(--r-bst-sm); background: var(--blanc); box-shadow: var(--shadow-bst-sm); text-decoration: none; transition: box-shadow .35s var(--ease-brand); }
.cf-pager__link:hover { box-shadow: var(--shadow-bst); }
.cf-pager__link:focus-visible { outline: 2px solid var(--rose); outline-offset: 4px; }
.cf-pager__link--all { grid-column: 2; align-items: center; text-align: center; }
.cf-pager__link--next { grid-column: 3; align-items: flex-end; text-align: right; }
.cf-pager__label { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: var(--encre-72); }
.cf-pager__title { font-family: var(--font-serif); font-size: 1.3rem; line-height: 1.2; color: var(--encre); text-wrap: pretty; }
.cf-pager__link:hover .cf-pager__title { color: var(--rose-deep); }

/* ---------- Dessins : l'interface dessinée, viewBox 320 × 200 ---------- */
.cf-vg { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; background: var(--sable); }
.cf-vg text { fill: var(--encre); font: 600 10.5px var(--font-sans); letter-spacing: -.005em; }
.cf-vg .v-sm { font-size: 8.5px; font-weight: 500; }
.cf-vg .v-mono { fill: var(--encre-72); font: 500 7px var(--font-mono); letter-spacing: .09em; }
.cf-vg .v-serif { font: 500 14px var(--font-serif); letter-spacing: -.01em; }
.cf-vg .v-serif-sm { font: 500 12px var(--font-serif); letter-spacing: -.005em; }
.cf-vg .v-code { font: 500 15px var(--font-mono); letter-spacing: .5em; }
.cf-vg .v-on { fill: var(--blush); }
.cf-vg .v-soft { fill: var(--encre-72); }
.cf-vg .v-accent { fill: var(--rose-deep); }
.cf-vg .v-shadow { fill: rgba(163, 78, 53, .14); }
.cf-vg .v-card { fill: var(--blanc); stroke: var(--line); }
.cf-vg .v-field { fill: var(--blanc); stroke: var(--encre); stroke-width: 1.5; }
.cf-vg .v-input { fill: var(--blush); stroke: var(--line); }
.cf-vg .v-ink { fill: var(--encre); }
.cf-vg .v-terra { fill: var(--rose); }
.cf-vg .v-deep { fill: var(--rose-deep); }
.cf-vg .v-sauge { fill: var(--sauge); }
.cf-vg .v-sable { fill: var(--sable); }
.cf-vg .v-poudre { fill: var(--poudre); }
.cf-vg .v-blush { fill: var(--blush); }
.cf-vg .v-blanc { fill: var(--blanc); }
.cf-vg .v-bar { fill: rgba(47, 33, 29, .16); }
.cf-vg .v-bar-strong { fill: rgba(47, 33, 29, .36); }
.cf-vg .v-hair { fill: none; stroke: var(--line); }
.cf-vg .v-line { fill: none; stroke: var(--encre); stroke-width: 1.2; stroke-linecap: round; opacity: .34; }
.cf-vg .v-road { fill: none; stroke: var(--sable); stroke-width: 5; stroke-linecap: round; }
.cf-vg .v-road-thin { fill: none; stroke: var(--sable); stroke-width: 2.4; stroke-linecap: round; }
.cf-vg .v-outline { fill: none; stroke: var(--encre); stroke-width: 1.2; }
.cf-vg .v-outline-terra { fill: none; stroke: var(--rose); stroke-width: 1.8; }
.cf-vg .v-veil { fill: var(--encre); opacity: .3; }
.cf-vg .v-dash { fill: none; stroke: var(--encre-72); stroke-width: 1.2; stroke-dasharray: 4 3; }

/* ---------- Selon la largeur de la page ---------- */
@container (max-width: 1040px) {
    .cf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cf-step { grid-template-columns: 44px minmax(0, 1fr); gap: 0 22px; }
    .cf-step__figure { grid-column: 2; max-width: 520px; margin-top: 20px; }
}
@container (max-width: 860px) {
    .cf-hero, .cf-fiche-head { grid-template-columns: minmax(0, 1fr); }
    .cf-hero__visual { justify-self: start; max-width: 380px; }
    .cf-fiche-head__visual { max-width: 560px; }
    .cf-family__lead { max-width: none; }
    .cf-fiche-body { grid-template-columns: minmax(0, 1fr); }
    .cf-toc { position: static; }
}
@container (max-width: 600px) {
    .cf-grid { grid-template-columns: minmax(0, 1fr); }
    .cf-panel { padding: 28px 22px; }
    .cf-hero__visual { padding: 0 0 30px 16px; }
    .cf-step { grid-template-columns: 36px minmax(0, 1fr); gap: 0 14px; padding-bottom: 40px; }
    .cf-step::before { width: 36px; height: 36px; font-size: .72rem; }
    .cf-step:not(:last-child)::after { top: 44px; left: 17.5px; }
    .cf-step__text { padding-top: 3px; }
    .cf-step h2 { font-size: 1.45rem; }
    .cf-notes { padding: 22px 20px 14px; }
    .cf-pager { grid-template-columns: minmax(0, 1fr); }
    .cf-pager__link, .cf-pager__link--all, .cf-pager__link--next { grid-column: auto; align-items: flex-start; text-align: left; }
}
