/* Samuel Toiture · la cheminée, du conduit au solin (assets/js/cheminee3d.js, attribut data-cheminee3d, préfixe ch3d) */
:where(:root) {
  --st-red: #C4161C;
  --st-red-deep: #8E0F14;
  --st-yellow: #F2B705;
  --st-ink: #1F2421;
  --st-night: #171A18;
  --st-metal: #8D9196;
  --st-cream: #FAF6EE;
  --st-paper: #FFFDF8;
  --st-brick: #A8442E;
  --f-display: 'Bricolage Grotesque', 'Helvetica Neue', Arial, sans-serif;
  --f-text: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --f-mono: 'DM Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}
.ch3d {
  --c-line: rgba(250, 246, 238, .14);
  --c-glass: rgba(23, 26, 24, .84);
  position: relative; color: var(--st-cream); font-family: var(--f-text); padding: clamp(56px, 7vw, 112px) 0; overflow: hidden;
  background-color: var(--st-night);
  background-image:
    linear-gradient(rgba(250, 246, 238, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(250, 246, 238, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(250, 246, 238, .018) 1px, transparent 1px);
  background-size: 100% 26px, 78px 52px, 78px 52px; background-position: 0 0, 0 0, 39px 26px;
}
.ch3d *, .ch3d *::before, .ch3d *::after { box-sizing: border-box; }
.ch3d button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.ch3d :focus-visible { outline: 2px solid var(--st-yellow); outline-offset: 2px; }
.ch3d__wrap { width: min(1360px, 100% - 32px); margin-inline: auto; }
.ch3d__head { max-width: 780px; margin-bottom: clamp(22px, 3vw, 40px); }
.ch3d__kicker { display: inline-flex; align-items: center; gap: 12px; margin: 0; font: 500 12px/1.2 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--st-yellow); }
.ch3d__kicker i { width: 34px; height: 4px; background: var(--st-red); flex: none; }
.ch3d__title { margin: 16px 0 0; font: 800 clamp(30px, 4.2vw, 58px)/1.02 var(--f-display); letter-spacing: -.02em; text-wrap: balance; }
.ch3d__title em { font: italic 400 1.02em/1 var(--f-serif); letter-spacing: -.01em; color: #f0c9a8; }
.ch3d__lede { margin: 18px 0 0; max-width: 660px; font-size: clamp(16px, 1.2vw, 18px); line-height: 1.62; color: rgba(250, 246, 238, .76); text-wrap: pretty; }

/* grille : scène + carnet de chantier */
.ch3d__app { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 388px; gap: 14px; align-items: stretch; }
.ch3d__stage {
  position: relative; min-width: 0; height: clamp(560px, 80vh, 800px); overflow: hidden; border-radius: 6px; isolation: isolate;
  background: linear-gradient(180deg, #6f7a7d 0%, #99a19f 30%, #b9b6a9 52%, #6c6b63 74%, #2b2e2b 100%);
  box-shadow: inset 0 0 0 1px var(--c-line), 0 30px 60px -30px rgba(0, 0, 0, .7);
}
.ch3d__stage::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1; background: radial-gradient(120% 100% at 50% 45%, transparent 58%, rgba(10, 12, 11, .5)); }
.ch3d__stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: pan-y; cursor: grab; opacity: 0; transition: opacity .9s; }
.ch3d__stage canvas:active { cursor: grabbing; }
.ch3d__app[data-ready] canvas { opacity: 1; }
.ch3d__load { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 14px; background: #20231f; color: rgba(250, 246, 238, .8); font: 500 12px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; transition: opacity .6s, visibility .6s; }
.ch3d__load i { width: 120px; height: 3px; background: rgba(250, 246, 238, .16); position: relative; overflow: hidden; }
.ch3d__load i::after { content: ''; position: absolute; inset: 0; width: 40%; background: var(--st-red); animation: ch3d-load 1.1s ease-in-out infinite alternate; }
@keyframes ch3d-load { to { transform: translateX(150%); } }
.ch3d__app[data-ready] .ch3d__load, .ch3d__app[data-nogl] .ch3d__load { opacity: 0; visibility: hidden; }
.ch3d__nogl { display: none; position: absolute; inset: 0; z-index: 2; margin: 0; padding: 32px; place-content: center; text-align: center; background: #20231f; line-height: 1.6; }
.ch3d__app[data-nogl] .ch3d__nogl { display: grid; }
.ch3d__app[data-nogl] :is(.ch3d__pins, .ch3d__bar, .ch3d__hint) { display: none; }

/* barre : avant / chantier / après, coupe, vue éclatée, zoom */
.ch3d__bar { position: absolute; z-index: 4; left: 12px; right: 12px; top: 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.ch3d__bar > * { pointer-events: auto; }
.ch3d__views { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--c-glass); box-shadow: inset 0 0 0 1px var(--c-line); backdrop-filter: blur(8px); }
.ch3d__views button { border: 0; background: none; cursor: pointer; padding: 9px 15px; border-radius: 999px; font: 600 13px/1 var(--f-text); color: rgba(250, 246, 238, .72); transition: background .25s, color .25s; }
.ch3d__views button[aria-pressed="true"] { background: var(--st-red); color: #fff; }
.ch3d__tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ch3d__btn, .ch3d__ico { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; border: 0; border-radius: 999px; cursor: pointer; background: var(--c-glass); box-shadow: inset 0 0 0 1px var(--c-line); backdrop-filter: blur(8px); font: 600 13px/1 var(--f-text); color: var(--st-cream); transition: background .25s, color .25s; }
.ch3d__ico { width: 38px; padding: 0; justify-content: center; }
.ch3d__btn svg, .ch3d__ico svg { width: 17px; height: 17px; flex: none; }
.ch3d__btn[aria-pressed="true"] { background: var(--st-cream); color: var(--st-ink); }
.ch3d__tag { position: absolute; z-index: 3; right: 12px; bottom: 12px; padding: 6px 9px; border-radius: 3px; background: var(--c-glass); font: 500 10.5px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: rgba(250, 246, 238, .7); pointer-events: none; }
.ch3d__hint { position: absolute; z-index: 3; left: 12px; bottom: 12px; margin: 0; display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border-radius: 999px; background: var(--c-glass); font-size: 12.5px; color: rgba(250, 246, 238, .82); pointer-events: none; transition: opacity .5s; }
.ch3d__hint svg { width: 15px; height: 15px; color: var(--st-yellow); }
.ch3d__hint--touch { display: none; }
.ch3d__app.is-used .ch3d__hint, .ch3d__app.has-fiche .ch3d__hint { opacity: 0; }

/* repères numérotés */
.ch3d__pins { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .5s; }
.ch3d__app[data-ready] .ch3d__pins { opacity: 1; }
.ch3d__pin { position: absolute; left: 0; top: 0; margin: -13px 0 0 -13px; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto; display: flex; align-items: center; gap: 6px; }
.ch3d__pin b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--st-cream); color: var(--st-ink); font: 500 10.5px/1 var(--f-mono); box-shadow: 0 0 0 3px rgba(23, 26, 24, .35), 0 4px 12px rgba(0, 0, 0, .4); transition: background .25s, color .25s, transform .25s; }
.ch3d__pin span { padding: 5px 9px; border-radius: 3px; background: var(--c-glass); font: 600 12px/1 var(--f-text); color: var(--st-cream); white-space: nowrap; opacity: 0; transform: translateX(-4px); transition: opacity .25s, transform .25s; pointer-events: none; }
.ch3d__pin:hover span, .ch3d__pin:focus-visible span, .ch3d__pin.is-on span, .ch3d__pin.is-def span { opacity: 1; transform: none; }
.ch3d__pin:hover b { transform: scale(1.12); }
.ch3d__pin.is-def b { background: var(--st-yellow); animation: ch3d-pulse 1.8s ease-out infinite; }
.ch3d__pin.is-def span { box-shadow: inset 2px 0 0 var(--st-yellow); }
.ch3d__pin.is-on b { background: var(--st-red); color: #fff; animation: none; }
@keyframes ch3d-pulse { 0% { box-shadow: 0 0 0 0 rgba(242, 183, 5, .7), 0 4px 12px rgba(0, 0, 0, .4); } 100% { box-shadow: 0 0 0 14px rgba(242, 183, 5, 0), 0 4px 12px rgba(0, 0, 0, .4); } }
.ch3d__app:not([data-step="0"]) .ch3d__pin:not(.is-on):not(:hover):not(:focus-visible) span { opacity: 0; }
.ch3d__app:not([data-step="0"]) .ch3d__pin:not(.is-on) b { width: 22px; height: 22px; font-size: 9.5px; opacity: .88; animation: none; }
.ch3d__app:not([data-step="0"]) .ch3d__pin { margin: -11px 0 0 -11px; }

/* fiche d'expert */
.ch3d__fiche { position: absolute; z-index: 5; left: 12px; top: 62px; bottom: 12px; width: min(350px, calc(100% - 24px)); display: flex; flex-direction: column; border-radius: 6px; overflow: hidden; background: var(--st-paper); color: var(--st-ink); box-shadow: 0 24px 60px rgba(0, 0, 0, .5); opacity: 0; visibility: hidden; transform: translateX(-16px); transition: opacity .35s, transform .35s, visibility .35s; }
.ch3d__fiche.is-open { opacity: 1; visibility: visible; transform: none; }
.ch3d__fhead { position: relative; padding: 16px 52px 14px 18px; background: var(--st-red); color: var(--st-cream); }
.ch3d__fhead p { margin: 0; font: 500 11px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; display: flex; gap: 8px; flex-direction: row-reverse; justify-content: flex-end; opacity: .9; }
.ch3d__fhead h3 { margin: 8px 0 0; font: 700 21px/1.12 var(--f-display); letter-spacing: -.01em; }
.ch3d__fhead button { position: absolute; right: 8px; top: 8px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .18); cursor: pointer; color: #fff; }
.ch3d__fhead button svg, .ch3d__ffoot svg { width: 18px; height: 18px; }
.ch3d__fbody { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px 6px; overscroll-behavior: contain; }
.ch3d__fbody h4 { margin: 0 0 5px; font: 500 11px/1.2 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--st-brick); }
.ch3d__fbody h4.is-err { color: var(--st-red); }
.ch3d__fbody p { margin: 0 0 16px; font-size: 14.5px; line-height: 1.55; color: rgba(31, 36, 33, .88); }
.ch3d__fwarn { margin: 0 0 16px; padding: 11px 13px; border-left: 4px solid var(--st-yellow); background: #fbf0cc; border-radius: 0 4px 4px 0; }
.ch3d__fwarn h4 { color: #6d5200; }
.ch3d__fwarn p { margin: 0; }
.ch3d__ffoot { display: flex; justify-content: flex-end; gap: 6px; padding: 8px 12px 12px; }
.ch3d__ffoot button { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid rgba(31, 36, 33, .2); border-radius: 50%; background: none; cursor: pointer; }
.ch3d__ffoot button:hover { background: var(--st-ink); color: var(--st-cream); }

/* carnet de chantier */
.ch3d__panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ch3d__steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.ch3d__step { width: 100%; height: 100%; display: grid; gap: 6px; justify-items: start; padding: 10px 9px 11px; border: 0; border-radius: 4px; cursor: pointer; background: rgba(250, 246, 238, .06); box-shadow: inset 0 3px 0 rgba(250, 246, 238, .16); text-align: left; transition: background .25s, box-shadow .25s; }
.ch3d__step b { font: 500 11px/1 var(--f-mono); color: rgba(250, 246, 238, .55); }
.ch3d__step span { font: 600 12.5px/1.15 var(--f-text); color: rgba(250, 246, 238, .8); overflow-wrap: normal; hyphens: auto; }
.ch3d__step.is-done { box-shadow: inset 0 3px 0 var(--st-yellow); }
.ch3d__step.is-on { background: var(--st-cream); box-shadow: inset 0 3px 0 var(--st-red); }
.ch3d__step.is-on b { color: var(--st-red); }
.ch3d__step.is-on span { color: var(--st-ink); }
.ch3d__card { flex: 1; background: var(--st-cream); color: var(--st-ink); border-radius: 6px; padding: 0 20px 20px; overflow: hidden; }
.ch3d__band { margin: 0 -20px 16px; padding: 10px 20px; background: var(--st-red); color: var(--st-cream); display: flex; align-items: center; gap: 12px; font: 500 11.5px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; }
.ch3d__band b { font-weight: 500; }
.ch3d__band i { flex: 1; height: 2px; background: rgba(250, 246, 238, .35); }
.ch3d__card h3 { margin: 0; font: 800 clamp(22px, 2vw, 27px)/1.08 var(--f-display); letter-spacing: -.015em; }
.ch3d__cap { margin: 10px 0 0; font-size: 14.5px; line-height: 1.55; color: rgba(31, 36, 33, .8); }
.ch3d__ctl { display: none; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(31, 36, 33, .14); }
.ch3d__app[data-step="0"] .ch3d__ctl[data-show~="0"], .ch3d__app[data-step="1"] .ch3d__ctl[data-show~="1"], .ch3d__app[data-step="2"] .ch3d__ctl[data-show~="2"], .ch3d__app[data-step="3"] .ch3d__ctl[data-show~="3"] { display: block; }
.ch3d__lbl { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 0 10px; font: 500 11px/1.2 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: rgba(31, 36, 33, .66); }
.ch3d__lbl em { font-style: normal; text-align: right; color: var(--st-ink); }
.ch3d__lbl em span { color: rgba(31, 36, 33, .55); }
.ch3d__lbl b { font-weight: 500; color: var(--st-red); }
.ch3d__range { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; margin: 0; background: none; cursor: pointer; }
.ch3d__range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--st-ink), var(--st-brick)); }
.ch3d__range::-moz-range-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--st-ink), var(--st-brick)); }
.ch3d__range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: var(--st-red); border: 3px solid var(--st-paper); box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.ch3d__range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--st-red); border: 3px solid var(--st-paper); box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.ch3d__defs { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ch3d__def { padding: 6px 10px 6px 24px; border-radius: 999px; position: relative; font-size: 12.5px; line-height: 1.1; color: rgba(31, 36, 33, .45); box-shadow: inset 0 0 0 1px rgba(31, 36, 33, .16); transition: color .3s, background .3s, box-shadow .3s; }
.ch3d__def::before { content: ''; position: absolute; left: 10px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: rgba(31, 36, 33, .2); transition: background .3s; }
.ch3d__def.is-on { color: var(--st-ink); background: #fbe9a8; box-shadow: inset 0 0 0 1px var(--st-yellow); font-weight: 600; }
.ch3d__def.is-on::before { background: var(--st-red); }
.ch3d__gauge { --p: 0%; height: 14px; border-radius: 7px; overflow: hidden; background: repeating-linear-gradient(90deg, #2a2623 0 6px, #1c1a18 6px 12px); margin-bottom: 12px; }
.ch3d__gauge i { display: block; height: 100%; width: var(--p); background: linear-gradient(90deg, #b9bec2, #eef0f1); transition: width .25s; box-shadow: 2px 0 0 var(--st-red); }
.ch3d__auto { display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px 9px 14px; border: 1px solid rgba(31, 36, 33, .28); border-radius: 999px; background: none; cursor: pointer; font-weight: 600; font-size: 13px; transition: background .25s, color .25s; }
.ch3d__auto svg { width: 15px; height: 15px; }
.ch3d__auto:hover { background: var(--st-ink); color: var(--st-cream); }
.ch3d__tasks { gap: 6px; }
.ch3d__app[data-step="2"] .ch3d__tasks[data-show~="2"], .ch3d__app[data-step="3"] .ch3d__tasks[data-show~="3"] { display: grid; }
.ch3d__task { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 10px 12px 10px 10px; border: 0; border-radius: 4px; cursor: pointer; text-align: left; background: var(--st-paper); box-shadow: inset 0 0 0 1px rgba(31, 36, 33, .16); transition: box-shadow .25s, background .25s; }
.ch3d__task:hover { box-shadow: inset 0 0 0 1.5px var(--st-ink); }
.ch3d__task b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(31, 36, 33, .3); color: transparent; transition: background .3s, color .3s, box-shadow .3s; }
.ch3d__task b svg { width: 14px; height: 14px; }
.ch3d__task span { font-weight: 600; font-size: 14px; line-height: 1.2; }
.ch3d__task small { display: block; margin-top: 3px; font-weight: 400; font-size: 12px; color: rgba(31, 36, 33, .62); }
.ch3d__task i { font: 500 11px/1 var(--f-mono); font-style: normal; letter-spacing: .06em; text-transform: uppercase; color: var(--st-red); white-space: nowrap; }
.ch3d__task.is-ok b { background: var(--st-ink); color: var(--st-yellow); box-shadow: none; }
.ch3d__task.is-ok i { color: rgba(31, 36, 33, .6); }
.ch3d__task.is-ok small { display: none; }
.ch3d__nav { display: flex; gap: 8px; }
.ch3d__prev { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border: 0; border-radius: 4px; cursor: pointer; background: rgba(250, 246, 238, .08); box-shadow: inset 0 0 0 1px var(--c-line); }
.ch3d__prev:disabled { opacity: .35; cursor: default; }
.ch3d__prev svg, .ch3d__next svg { width: 18px; height: 18px; }
.ch3d__next { flex: 1; height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 16px 0 20px; border: 0; border-radius: 4px; cursor: pointer; background: rgba(250, 246, 238, .1); box-shadow: inset 0 0 0 1px var(--c-line); font: 700 15px/1 var(--f-display); transition: background .3s, color .3s; }
.ch3d__next.is-hot, .ch3d__next:hover { background: var(--st-yellow); color: var(--st-ink); box-shadow: none; }
.ch3d__safe { margin: 0; padding-left: 14px; border-left: 3px solid var(--st-red); font: italic 400 16px/1.35 var(--f-serif); color: rgba(250, 246, 238, .86); }
.ch3d__ctas { display: flex; flex-wrap: wrap; gap: 8px; }
.ch3d__cta, .ch3d__tel { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 16px; border-radius: 4px; font-weight: 700; font-size: 14.5px; text-decoration: none; white-space: nowrap; }
.ch3d__cta { background: var(--st-red); color: #fff; }
.ch3d__cta:hover { background: var(--st-red-deep); }
.ch3d__tel { color: var(--st-cream); box-shadow: inset 0 0 0 1px var(--c-line); font-family: var(--f-mono); font-weight: 500; }
.ch3d__cta svg, .ch3d__tel svg { width: 16px; height: 16px; }

/* tablette et mobile : scène puis carnet, fiche en tiroir */
@media (max-width: 1080px) {
  .ch3d__app { grid-template-columns: minmax(0, 1fr); }
  .ch3d__stage { height: clamp(480px, 72vh, 700px); }
}
@media (max-width: 700px) {
  .ch3d__wrap { width: min(100% - 20px, 1360px); }
  .ch3d__stage { height: min(74svh, 560px); min-height: 440px; }
  .ch3d__bar { left: 8px; right: 8px; top: 8px; }
  .ch3d__views button { padding: 9px 11px; font-size: 12.5px; }
  .ch3d__btn { width: 38px; padding: 0; justify-content: center; }
  .ch3d__btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ch3d__tools { gap: 4px; }
  .ch3d__ico { display: none; }
  .ch3d__tag { display: none; }
  .ch3d__hint { left: 8px; bottom: 8px; }
  .ch3d__pin span { display: none; }
  .ch3d__pin.is-def span, .ch3d__pin.is-on span { display: block; font-size: 11px; padding: 4px 7px; }
  .ch3d__fiche { left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 72%; border-radius: 14px 14px 0 0; transform: translateY(24px); }
  .ch3d__fiche::before { content: ''; position: absolute; z-index: 1; left: 50%; top: 6px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: rgba(250, 246, 238, .55); }
  .ch3d__fhead { padding-top: 20px; }
  .ch3d__card { padding: 0 16px 16px; }
  .ch3d__band { margin: 0 -16px 14px; padding: 10px 16px; }
  .ch3d__step { padding: 9px 7px 10px; }
  .ch3d__step span { font-size: 11.5px; }
}
@media (pointer: coarse) { .ch3d__hint--fine { display: none; } .ch3d__hint--touch { display: inline; } }
@media (prefers-reduced-motion: reduce) { .ch3d *, .ch3d *::before, .ch3d *::after { animation: none !important; transition: none !important; } }
