/* Module Matériaux — s'appuie sur les variables du site :
   --brand, --brand-deep, --accent, --ink, --muted, --paper, --mist, --line, --wa, --wa-ink, --r, --r-lg, --f-display, --f-body */
#materiaux { --tile: clamp(132px, 22vw, 180px); }
.mx-steps { display: grid; gap: clamp(28px, 5vw, 56px); }
.mx-step { scroll-margin-top: 80px; }
#etape-surfaces { margin-top: clamp(28px, 5vw, 56px); }
.mx-step__head { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: baseline; margin-bottom: 18px; }
.mx-step__head h2 { font-family: var(--f-display); font-size: clamp(24px, 3.2vw, 36px); line-height: 1.1; margin: 0; letter-spacing: -0.01em; }
.mx-step__head p { grid-column: 2; margin: 6px 0 0; color: var(--muted); font-size: 16px; }
.mx-step__n { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--brand-deep); font-family: var(--f-display); font-weight: 700; font-size: 16px; align-self: center; }

/* Étape 1 — tuiles projet */
.mx-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr)); gap: 12px; }
.mx-tile { appearance: none; border: 2px solid var(--line); background: var(--paper); border-radius: var(--r-lg); padding: 18px 14px 16px; text-align: left; cursor: pointer; display: grid; gap: 4px; color: var(--ink); font: inherit; transition: border-color .2s, transform .2s var(--ease, ease), box-shadow .2s; }
.mx-tile:hover { border-color: var(--brand); transform: translateY(-2px); }
.mx-tile:focus-visible, .mx-swatch:focus-visible, .mx-card__open:focus-visible, .mx-fav:focus-visible, .mx-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.mx-tile[aria-pressed="true"] { border-color: var(--brand); background: var(--brand); color: #fff; box-shadow: 0 10px 30px -12px var(--brand); }
.mx-tile__icon { width: 44px; height: 44px; color: var(--brand); margin-bottom: 6px; }
.mx-tile[aria-pressed="true"] .mx-tile__icon { color: var(--accent); }
.mx-tile__icon svg { width: 100%; height: 100%; }
.mx-tile__label { font-family: var(--f-display); font-weight: 700; font-size: 17px; }
.mx-tile__hint { font-size: 13px; color: var(--muted); }
.mx-tile[aria-pressed="true"] .mx-tile__hint { color: rgba(255,255,255,.75); }

/* Étape 2 — nuancier */
.mx-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px; }
.mx-swatch { appearance: none; border: 0; background: none; padding: 0; cursor: pointer; display: grid; grid-template-rows: auto auto auto; align-content: start; gap: 2px; text-align: left; color: var(--ink); font: inherit; }
.mx-swatch__img { display: block; width: 100%; aspect-ratio: 1; border-radius: 50%; background-size: cover; background-position: center; border: 4px solid var(--paper); box-shadow: 0 0 0 2px var(--line), inset 0 0 0 1px rgba(0,0,0,.08); transition: box-shadow .2s, transform .2s var(--ease, ease); margin-bottom: 8px; }
.mx-swatch:hover .mx-swatch__img { transform: scale(1.04); box-shadow: 0 0 0 2px var(--brand); }
.mx-swatch[aria-pressed="true"] .mx-swatch__img { box-shadow: 0 0 0 4px var(--brand); }
.mx-swatch__label { font-family: var(--f-display); font-weight: 700; font-size: 16px; }
.mx-swatch[aria-pressed="true"] .mx-swatch__label { color: var(--brand); }
.mx-swatch__hint { font-size: 12.5px; color: var(--muted); line-height: 1.3; }

/* Étape 3 — grille */
.mx-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 0 0 16px; }
.mx-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mx-chip { appearance: none; border: 0; background: var(--brand); color: #fff; border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.mx-chip span { opacity: .7; margin-left: 4px; }
.mx-search { display: flex; align-items: center; gap: 8px; border: 2px solid var(--line); border-radius: 999px; padding: 8px 14px; background: var(--paper); color: var(--muted); flex: 1 1 220px; max-width: 320px; }
.mx-search:focus-within { border-color: var(--brand); }
.mx-search input { border: 0; outline: 0; background: none; font: inherit; width: 100%; color: var(--ink); }
.mx-count { color: var(--muted); }
.mx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
@media (min-width: 720px) { .mx-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; } }
.mx-card { position: relative; background: var(--paper); border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); }
.mx-card__open { appearance: none; border: 0; padding: 0; background: var(--mist); display: block; width: 100%; cursor: zoom-in; }
.mx-card__open img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; transition: transform .4s var(--ease, ease); }
.mx-card:hover .mx-card__open img { transform: scale(1.03); }
.mx-card__body { padding: 12px 14px 14px; }
.mx-card__body h3 { margin: 0; font-family: var(--f-display); font-size: 16px; font-weight: 700; line-height: 1.2; }
.mx-card__body p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.mx-fav { appearance: none; border: 0; cursor: pointer; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.92); color: var(--brand); position: absolute; top: 10px; right: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.mx-fav svg { fill: none; stroke: currentColor; stroke-width: 2; }
.mx-fav[aria-pressed="true"] svg { fill: var(--accent); stroke: var(--accent); }
.mx-fav--inline { position: static; width: auto; height: auto; border-radius: 999px; padding: 10px 16px; gap: 8px; grid-auto-flow: column; background: var(--mist); box-shadow: none; font: inherit; font-weight: 600; color: var(--ink); }
.mx-empty { background: var(--mist); border-radius: var(--r-lg); padding: 22px; color: var(--muted); }
.mx-link { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; }

/* Sélection flottante */
.mx-tray[hidden] { display: none; }
.mx-tray { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 14px; background: var(--brand-deep); color: #fff; padding: 10px 12px 10px 10px; border-radius: 999px; box-shadow: 0 16px 40px -10px rgba(0,0,0,.45); max-width: calc(100vw - 24px); }
.mx-tray__thumbs { display: flex; }
.mx-tray__thumbs button { appearance: none; border: 2px solid var(--brand-deep); padding: 0; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; margin-left: -10px; cursor: pointer; background: #fff; }
.mx-tray__thumbs button:first-child { margin-left: 0; }
.mx-tray__thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mx-tray__txt { display: grid; line-height: 1.2; font-size: 13px; }
.mx-tray__txt strong { font-family: var(--f-display); font-size: 15px; white-space: nowrap; }
.mx-tray__txt span { opacity: .8; }
@media (max-width: 600px) { .mx-tray__txt span { display: none; } .mx-tray { left: 12px; right: 12px; transform: none; max-width: none; justify-content: space-between; } }

/* Boutons */
.mx-btn { appearance: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 22px; border-radius: 999px; font: inherit; font-weight: 700; font-size: 16px; text-decoration: none; transition: transform .15s, filter .15s; }
.mx-btn:active { transform: scale(.98); }
.mx-btn--wa { background: var(--wa); color: var(--wa-ink); }
.mx-btn--wa:hover { filter: brightness(1.05); }
.mx-btn--ghost { background: var(--mist); color: var(--ink); }
.mx-btn--ghost:hover { background: var(--line); }
.mx-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 20px; }

/* Fiche (feuille) */
body.mx-lock { overflow: hidden; }
.mx-sheet, .mx-form { position: fixed; inset: 0; z-index: 90; display: grid; align-items: end; }
@media (min-width: 900px) { .mx-sheet, .mx-form { align-items: center; justify-items: center; } }
.mx-sheet__scrim { position: absolute; inset: 0; background: rgba(1, 20, 40, .55); opacity: 0; transition: opacity .25s; }
.mx-sheet.is-open .mx-sheet__scrim, .mx-form.is-open .mx-sheet__scrim { opacity: 1; }
.mx-sheet__panel, .mx-form__panel { position: relative; background: var(--paper); color: var(--ink); width: 100%; max-height: 94vh; overflow: auto; border-radius: var(--r-lg) var(--r-lg) 0 0; transform: translateY(30px); opacity: 0; transition: transform .3s var(--ease, ease), opacity .25s; }
@media (min-width: 900px) { .mx-sheet__panel { width: min(1080px, 94vw); max-height: 90vh; border-radius: var(--r-lg); display: grid; grid-template-columns: 1fr 1.15fr; } .mx-form__panel { width: min(640px, 94vw); border-radius: var(--r-lg); } }
.mx-sheet.is-open .mx-sheet__panel, .mx-form.is-open .mx-form__panel { transform: none; opacity: 1; }
.mx-sheet__close { position: sticky; top: 10px; float: right; margin: 10px 10px 0 0; z-index: 2; appearance: none; border: 0; width: 42px; height: 42px; border-radius: 50%; background: var(--paper); color: var(--ink); font-size: 26px; line-height: 1; cursor: pointer; box-shadow: 0 2px 12px rgba(0,0,0,.2); }
@media (min-width: 900px) { .mx-sheet__panel .mx-sheet__close { position: absolute; top: 14px; right: 14px; float: none; margin: 0; } }
.mx-sheet__media { background: var(--mist); padding: 14px; }
.mx-gallery { position: relative; border-radius: var(--r); overflow: hidden; background: #ddd; }
.mx-gallery img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
@media (min-width: 900px) { .mx-gallery img { aspect-ratio: 4 / 5; height: calc(90vh - 130px); } }
.mx-zoom { position: absolute; right: 10px; bottom: 10px; appearance: none; border: 0; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.9); font-size: 20px; cursor: pointer; }
.mx-thumbs { display: flex; gap: 8px; margin-top: 10px; }
.mx-thumbs button { appearance: none; border: 2px solid transparent; padding: 0; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; cursor: pointer; background: #fff; }
.mx-thumbs button:focus-visible { border-color: var(--brand); }
.mx-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mx-sheet__body { padding: 22px clamp(16px, 3vw, 34px) 28px; }
.mx-kicker { margin: 0; color: var(--muted); font-weight: 600; font-size: 14px; }
.mx-sheet__body h2 { font-family: var(--f-display); font-size: clamp(26px, 3vw, 34px); margin: 2px 0 14px; line-height: 1.1; }
.mx-sheet__body h3 { font-family: var(--f-display); font-size: 17px; margin: 22px 0 8px; }
.mx-finishes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.mx-finishes button { appearance: none; border: 2px solid var(--line); background: var(--paper); border-radius: 999px; padding: 4px 12px 4px 4px; display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; }
.mx-finishes button img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.mx-finishes button[aria-selected="true"] { border-color: var(--brand); background: var(--brand); color: #fff; }
.mx-desc p { margin: 0 0 8px; line-height: 1.5; }
.mx-uses { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mx-uses li { display: grid; gap: 1px; background: var(--mist); border-radius: var(--r); padding: 10px 12px; font-size: 14.5px; }
.mx-uses strong { font-weight: 700; }
.mx-uses span { color: var(--muted); }
.mx-facts { margin: 0; display: grid; gap: 6px; }
.mx-facts div { display: grid; grid-template-columns: 130px 1fr; gap: 10px; font-size: 14.5px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.mx-facts dt { color: var(--muted); }
.mx-facts dd { margin: 0; }
.mx-pair { margin: 16px 0 0; color: var(--muted); font-size: 14px; }
.mx-zoomer { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.92); display: grid; place-items: center; cursor: zoom-out; }
.mx-zoomer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.mx-zoomer .mx-sheet__close { position: fixed; top: 14px; right: 14px; float: none; }

/* Formulaire */
.mx-form__panel { padding: 22px clamp(16px, 3vw, 32px) 26px; }
.mx-form__panel h2 { font-family: var(--f-display); font-size: 26px; margin: 0 40px 6px 0; }
.mx-form__lead { color: var(--muted); margin: 0 0 14px; }
.mx-picks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.mx-picks span { display: inline-flex; align-items: center; gap: 8px; background: var(--mist); border-radius: 999px; padding: 4px 12px 4px 4px; font-size: 14px; font-weight: 600; }
.mx-picks img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.mx-picks__none { padding: 8px 12px !important; font-weight: 500 !important; color: var(--muted); }
.mx-form fieldset { border: 0; padding: 0; margin: 0 0 16px; }
.mx-form legend { font-family: var(--f-display); font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.mx-radios { display: flex; flex-wrap: wrap; gap: 8px; }
.mx-radios label { position: relative; }
.mx-radios input { position: absolute; opacity: 0; inset: 0; }
.mx-radios span { display: inline-block; border: 2px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.mx-radios input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.mx-radios input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.mx-row { display: grid; gap: 10px; }
@media (min-width: 560px) { .mx-row { grid-template-columns: 1fr 1fr; } }
.mx-form label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.mx-form input:not([type="radio"]), .mx-form textarea, .mx-form select { font: inherit; font-weight: 400; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--paper); color: var(--ink); width: 100%; }
.mx-form input:focus, .mx-form textarea:focus, .mx-form select:focus { outline: 0; border-color: var(--brand); }
.mx-form__err { color: #B42318; font-weight: 600; margin: 0 0 8px; }
.mx-form__note { font-size: 13px; color: var(--muted); margin: 14px 0 0; }

/* Toast */
.mx-toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 10px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; transition: .3s; z-index: 70; max-width: 90vw; }
.mx-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { #materiaux *, .mx-sheet *, .mx-form * { transition: none !important; } }
@media (max-width: 700px) { .mx-swatches { grid-template-columns: repeat(3, 1fr); gap: 8px; } .mx-swatch__hint { font-size: 11.5px; } .mx-tile { padding: 14px 12px 12px; } .mx-tile__icon { width: 36px; height: 36px; } .mx-tile__label { font-size: 15.5px; } .mx-tile__hint { font-size: 12.5px; } }
