/* Outils image, suite : scènes manipulées à la main (recadrer, flouter, redimensionner), aperçus en direct, comparateur avant / après, palette, favicon. */
/* un nom de fichier très long ne doit pas élargir la boîte de l'outil sur téléphone (les colonnes de grille suivent sinon leur contenu) */
.tool-box:not(.calc), .tool-box .files, .ip-corps, .ip-apercu-bloc { grid-template-columns: minmax(0, 1fr); }
.ip-corps { display: grid; gap: 14px; }
.ip-scene { position: relative; width: 100%; margin: 0 auto; border-radius: 12px; overflow: hidden; overflow: clip; line-height: 0; touch-action: none; user-select: none; -webkit-user-select: none;
  background: repeating-conic-gradient(#ececf1 0 25%, #fff 0 50%) 0 0 / 20px 20px; box-shadow: 0 0 0 1px var(--line); }
.ip-scene canvas { display: block; width: 100%; height: auto; pointer-events: none; }
.ip-flou { cursor: crosshair; }

/* Cadre de recadrage : l'extérieur est assombri par une ombre géante, coupée par la scène */
.ip-cadre { position: absolute; box-sizing: border-box; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(12, 12, 24, .58); cursor: move; }
.ip-cadre::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(rgba(255, 255, 255, .45), rgba(255, 255, 255, .45)) 33.33% 0 / 1px 100% no-repeat, linear-gradient(rgba(255, 255, 255, .45), rgba(255, 255, 255, .45)) 66.66% 0 / 1px 100% no-repeat,
    linear-gradient(rgba(255, 255, 255, .45), rgba(255, 255, 255, .45)) 0 33.33% / 100% 1px no-repeat, linear-gradient(rgba(255, 255, 255, .45), rgba(255, 255, 255, .45)) 0 66.66% / 100% 1px no-repeat; }
/* poignées : 32 px de prise pour le doigt, 14 px visibles */
.ip-poignee { position: absolute; width: 32px; height: 32px; margin: -16px; }
.ip-poignee::after { content: ""; position: absolute; inset: 9px; border-radius: 4px; background: #fff; box-shadow: 0 0 0 2px var(--red), 0 2px 6px rgba(12, 12, 24, .4); }
.ip-poignee[data-p="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.ip-poignee[data-p="n"] { left: 50%; top: 0; cursor: ns-resize; }
.ip-poignee[data-p="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
.ip-poignee[data-p="e"] { left: 100%; top: 50%; cursor: ew-resize; }
.ip-poignee[data-p="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
.ip-poignee[data-p="s"] { left: 50%; top: 100%; cursor: ns-resize; }
.ip-poignee[data-p="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
.ip-poignee[data-p="w"] { left: 0; top: 50%; cursor: ew-resize; }
.ip-trace { position: absolute; box-sizing: border-box; border: 2px dashed #fff; background: rgba(238, 47, 59, .22); box-shadow: 0 0 0 1px rgba(12, 12, 24, .6); pointer-events: none; }

.ip-apercu { display: grid; justify-items: center; align-content: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--text); }
.ip-apercu canvas { max-width: 100%; max-height: 160px; border-radius: 8px; background: #fff; box-shadow: 0 0 0 1px var(--line); }

.ip-pastilles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ip-pastille { display: grid; padding-bottom: 8px; border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.ip-teinte { width: 100%; height: 88px; margin-bottom: 6px; cursor: pointer; box-shadow: inset 0 -1px 0 var(--line); }
.ip-code { padding: 3px 12px; text-align: left; font: 600 16px/1.3 var(--head); color: var(--ink); cursor: pointer; transition: color .2s; }
.ip-code + .ip-code { font: 500 13px/1.4 var(--body); color: var(--muted); }
.ip-code:hover { color: var(--red-deep); }

.ip-icones { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 22px; padding: 18px; border-radius: 16px; background: var(--soft); }
.ip-icones figure { display: grid; justify-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--muted); }
.ip-icones img { display: block; border-radius: 3px; background: repeating-conic-gradient(#ececf1 0 25%, #fff 0 50%) 0 0 / 8px 8px; box-shadow: 0 0 0 1px var(--line); }
.ip-code-html { min-height: 0; height: 104px; font: 500 14px/1.6 ui-monospace, Consolas, monospace; white-space: pre; overflow-x: auto; resize: none; }


/* Boutons à choix unique */
.ip-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.ip-seg button { min-height: 46px; padding: 0 14px; border-radius: 12px; background: #fff; box-shadow: 0 0 0 1px var(--line); font: 500 15px/1.2 var(--body); color: var(--ink); cursor: pointer; transition: background .2s, box-shadow .2s, color .2s; }
.ip-seg button:hover { box-shadow: 0 0 0 1px rgba(238, 47, 59, .45); }
.ip-seg button[aria-pressed="true"] { background: var(--tint); box-shadow: 0 0 0 1.5px rgba(238, 47, 59, .6); color: var(--red-deep); font-weight: 600; }
.ip-seg button:disabled { opacity: .45; cursor: default; box-shadow: 0 0 0 1px var(--line); }

/* Aperçu en direct d'un atelier : le cadre final, ou la photo avec son filigrane */
.ip-apercu-bloc { display: grid; gap: 10px; }
.ip-vue { position: relative; width: 100%; margin: 0 auto; border-radius: 12px; overflow: hidden; line-height: 0; background: var(--soft); box-shadow: 0 0 0 1px var(--line); user-select: none; -webkit-user-select: none; }
.ip-vue canvas { display: block; width: 100%; height: auto; pointer-events: none; }
.ip-damier { background: repeating-conic-gradient(#ececf1 0 25%, #fff 0 50%) 0 0 / 20px 20px; }
.ip-glisse { cursor: grab; touch-action: none; }
.ip-tenu { cursor: grabbing; }
.ip-legende { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 12px; min-height: 1.45em; font-size: 14px; line-height: 1.45; text-align: center; color: var(--muted); }
.ip-legende b { font-weight: 600; color: var(--ink); }
.ip-choix { cursor: pointer; }
.ip-actif { background: var(--tint); box-shadow: 0 0 0 1.5px rgba(238, 47, 59, .55); }
.ip-forme-cote { grid-template-columns: 1fr 150px; align-items: end; }
.ip-bas { grid-template-columns: 1fr auto; align-items: center; }
.ip-rang { display: flex; flex-wrap: wrap; gap: 12px 28px; }

/* Flouter : les zones posées restent des objets que l'on déplace, étire ou retire */
.ip-flou { overflow: visible; }
.ip-flou canvas { border-radius: 12px; }
.ip-zones { position: absolute; inset: 0; }
.ip-zone { position: absolute; box-sizing: border-box; border: 1.5px dashed rgba(255, 255, 255, .95); box-shadow: 0 0 0 1px rgba(12, 12, 24, .5); cursor: move; }
.ip-zone.actif { border-style: solid; }
.ip-zone:not(.actif) .ip-poignee, .en-geste .ip-poignee, .en-geste .ip-zone-x { display: none; }
.ip-zone-x { position: absolute; right: -15px; top: -15px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--red-deep); cursor: pointer; box-shadow: 0 0 0 1px var(--line), 0 3px 8px rgba(12, 12, 24, .35); }
.ip-zone-x svg { width: 15px; height: 15px; stroke-width: 2.4; pointer-events: none; }
.ip-zone-x:hover { background: var(--red); color: #fff; }

/* Redimensionner : l'image dans le contour de sa taille d'origine, avec trois poignées */
.ip-rz { position: relative; width: 100%; margin: 0 auto 6px; touch-action: none; user-select: none; -webkit-user-select: none; }
.ip-rz-origine { position: absolute; left: 0; top: 0; border-radius: 6px; overflow: hidden; background: var(--soft); outline: 2px dashed rgba(12, 12, 24, .22); outline-offset: -2px; }
.ip-rz-origine canvas { display: block; width: 100%; height: 100%; opacity: .2; }
.ip-rz-image { position: absolute; left: 0; top: 0; line-height: 0; box-shadow: 0 0 0 2px var(--red), 0 10px 24px -12px rgba(12, 12, 24, .5); }
.ip-rz-image canvas { display: block; width: 100%; height: 100%; pointer-events: none; }
.ip-rz-dim { position: absolute; left: 8px; bottom: 8px; padding: 5px 9px; border-radius: 8px; background: rgba(12, 12, 24, .78); font: 600 13px/1.2 var(--body); color: #fff; white-space: nowrap; pointer-events: none; }
.ip-rz-champs { display: grid; grid-template-columns: 1fr auto 1fr 1fr; align-items: end; gap: 8px; }
.ip-rz-champs .inp { padding: 0 10px; }
.ip-verrou { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: #fff; color: var(--muted); cursor: pointer; box-shadow: 0 0 0 1px var(--line); transition: background .2s, color .2s, box-shadow .2s; }
.ip-verrou[aria-pressed="true"] { background: var(--tint); color: var(--red-deep); box-shadow: 0 0 0 1.5px rgba(238, 47, 59, .55); }

/* Agrandir : comparateur avant / après et progression */
.ip-cmp { position: relative; width: 100%; margin: 0 auto; border-radius: 12px; overflow: hidden; line-height: 0; box-shadow: 0 0 0 1px var(--line); user-select: none; -webkit-user-select: none; }
.ip-cmp-plan { position: absolute; inset: 0; overflow: hidden; }
.ip-cmp-plan canvas { display: block; max-width: none; transform-origin: 0 0; pointer-events: none; }
.ip-cmp-barre { position: absolute; top: 0; bottom: 0; width: 44px; margin-left: -22px; cursor: ew-resize; }
.ip-cmp-barre::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 0 1px rgba(12, 12, 24, .35); }
.ip-cmp-barre span { position: absolute; left: 50%; top: 50%; width: 38px; height: 38px; margin: -19px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--red), 0 4px 10px rgba(12, 12, 24, .4); }
.ip-cmp-barre span::before, .ip-cmp-barre span::after { content: ""; position: absolute; top: 50%; width: 7px; height: 7px; margin-top: -4px; border: solid var(--red-deep); border-width: 0 0 2.5px 2.5px; }
.ip-cmp-barre span::before { left: 9px; transform: rotate(45deg); }
.ip-cmp-barre span::after { right: 9px; transform: rotate(-135deg); }
.ip-cmp-nom { position: absolute; left: 10px; top: 10px; padding: 5px 9px; border-radius: 8px; background: rgba(12, 12, 24, .78); font: 600 13px/1.2 var(--body); color: #fff; pointer-events: none; }
.ip-cmp-droite { left: auto; right: 10px; }
.ip-progres { display: grid; gap: 10px; padding: 14px 16px; border-radius: 16px; background: var(--soft); }
.ip-jauge { height: 10px; border-radius: 6px; overflow: hidden; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.ip-jauge i { display: block; width: 0; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #ff6a70, var(--red-deep)); transition: width .25s; }
.ip-progres-bas { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 15px; color: var(--text); }

@media (max-width: 600px) {
  .ip-pastilles { grid-template-columns: 1fr 1fr; }
  .ip-seg button { padding: 0 12px; }
  .ip-forme-cote, .ip-bas { grid-template-columns: 1fr; }
  .ip-rz-champs .inp { padding: 0 8px; }
  .ip-unite { display: none; }
}
