/* Direction artistique : éditorial print — papier crème, encre charbon,
   capitales lourdes, blocs pleins, filets fins, monochrome assumé. */

:root {
  --paper: #f2f0eb;
  --card: #fbfaf7;
  --ink: #1e1d1b;
  --ink-soft: #56524a;
  --muted: #807b71;
  --line: #d9d5cc;
  --line-strong: #1e1d1b;
  --ok: #2e7d4f;
  --warn: #a8731b;
  --err: #b3402f;
  --radius: 2px;
  --font: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14.5px/1.55 var(--font);
}

::selection { background: var(--ink); color: var(--paper); }

/* ---- entête ---- */

header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 34px;
  background: var(--paper);
  border-bottom: 1px solid var(--line-strong);
}

.brand { display: flex; align-items: stretch; gap: 16px; }

.brand-rule { width: 5px; background: var(--ink); }

.brand-text { display: flex; flex-direction: column; justify-content: center; }

.brand-kicker {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.brand-title {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.15;
}

main { max-width: 1280px; margin: 0 auto; padding: 30px 34px 90px; }

/* ---- pastille d'état + panneau modèles ---- */

.pill {
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
}
.pill:hover { background: var(--ink); color: var(--paper); }
.pill::before {
  content: "";
  width: 8px; height: 8px;
  background: var(--muted);
  flex: none;
}
.pill.ok::before { background: var(--ok); }
.pill.warn::before { background: var(--warn); }
.pill.loading::before {
  background: var(--ink);
  animation: pulse 1.1s ease-in-out infinite;
}
.pill:hover::before { background: var(--paper); }
@keyframes pulse { 50% { opacity: 0.2; } }

.panel {
  position: fixed;
  top: 78px; right: 34px;
  z-index: 30;
  width: 400px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 8px 8px 0 rgba(30, 29, 27, 0.08);
}
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.panel h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.model-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.model-row:last-child { border-bottom: 0; }
.model-row code {
  font-size: 12px;
  background: none;
  color: var(--ink);
  font-weight: 600;
}
.model-row .grow { flex: 1; min-width: 0; }
.model-row .detail { color: var(--muted); font-size: 11.5px; display: block; overflow-wrap: anywhere; }

.chip {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--radius);
  white-space: nowrap;
  border: 1px solid transparent;
}
.chip.ready   { background: var(--ink); color: var(--paper); }
.chip.missing { border-color: var(--err); color: var(--err); }
.chip.error   { background: var(--err); color: var(--paper); }
.chip.loading { border-color: var(--ink); color: var(--ink); }
.chip.opt     { border-color: var(--line); color: var(--muted); }

/* ---- zone de dépôt ---- */

#dropzone {
  border: 1.5px dashed var(--ink-soft);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-soft);
  cursor: pointer;
  background: transparent;
  transition: background .15s, border-color .15s;
}
#dropzone:hover, #dropzone.drag {
  border-color: var(--ink);
  background: rgba(30, 29, 27, 0.04);
}
#dropzone.compact { padding: 18px 20px; }
#dropzone.compact svg { display: none; }
.dz-inner p { margin: 8px 0 0; }
.dz-inner strong {
  color: var(--ink);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 13.5px;
}
.dz-inner .muted { font-size: 12.5px; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 22px 2px 4px;
}
.toolbar .muted {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---- grille de cartes ---- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 22px;
  margin-top: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  animation: rise .25s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.card-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--ink);
  border-bottom: 1px solid var(--line-strong);
}
.card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.card-head .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}
.card-head .dims {
  color: var(--muted);
  white-space: nowrap;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 7px;
  border-radius: var(--radius);
  line-height: 1.4;
}
.icon-btn:hover { color: var(--paper); background: var(--err); }

.card.invalid { border-color: var(--err); }
.card.invalid .invalid-body { padding: 16px; color: var(--ink-soft); font-size: 13px; }
.card.invalid .invalid-body b {
  color: var(--err);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
}

/* ---- étapes ---- */

.steps { padding: 4px 16px 16px; counter-reset: step; }

.step { border-bottom: 1px solid var(--line); padding: 12px 0; }
.step:last-child { border-bottom: 0; padding-bottom: 4px; }

.step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.step-head::before {
  counter-increment: step;
  content: "0" counter(step);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
}
.step-head .meta {
  margin-left: auto;
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: none;
  font-variant-numeric: tabular-nums;
}

.dot {
  width: 16px; height: 16px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 10px;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink-soft);
}
.dot.done    { background: var(--ink);  color: var(--paper); }
.dot.paused  { background: var(--warn); color: var(--paper); }
.dot.error   { background: var(--err);  color: var(--paper); }
.dot.running {
  background: transparent;
  border: 2px solid var(--line);
  border-top-color: var(--ink);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.step-body { margin: 10px 0 2px 26px; font-size: 13px; }
.step-body .muted, .muted { color: var(--muted); }

.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.badge.photo { background: var(--ink); color: var(--paper); }
.badge.other { border: 1px solid var(--ink); color: var(--ink); }

.bar-row {
  display: grid;
  grid-template-columns: 76px 1fr 48px;
  align-items: center;
  gap: 10px;
  margin: 5px 0;
  font-size: 11.5px;
  color: var(--muted);
}
.bar { height: 5px; background: rgba(30, 29, 27, 0.09); }
.bar-fill { height: 100%; background: var(--ink); opacity: 0.35; }
.bar-row.top { color: var(--ink); font-weight: 700; }
.bar-row.top .bar-fill { opacity: 1; }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; }

.notice {
  background: transparent;
  border: 1px solid var(--ink);
  border-left: 4px solid var(--warn);
  border-radius: var(--radius);
  padding: 10px 13px;
  margin-top: 8px;
  font-size: 13px;
}

/* ---- boutons ---- */

button.primary {
  background: var(--ink);
  border: 1px solid var(--ink);
  color: var(--paper);
  font-family: var(--font);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  margin-top: 10px;
}
button.primary:hover { background: var(--paper); color: var(--ink); }

button.ghost {
  background: none;
  border: 1px solid var(--ink);
  color: var(--ink);
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 7px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  margin-top: 9px;
}
button.ghost:hover { background: var(--ink); color: var(--paper); }
button.ghost.small { margin: 0; padding: 5px 12px; }

button.link {
  background: none; border: 0; padding: 0;
  color: var(--ink); cursor: pointer; font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
button:disabled { opacity: 0.45; pointer-events: none; }

.noise-line { margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.arrow { color: var(--ok); font-weight: 700; }

/* ---- comparateur avant / après zoomable ---- */

.compare { margin-top: 10px; user-select: none; }

.c-stage {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  aspect-ratio: 1;
  background: var(--ink);
  cursor: ew-resize;
  touch-action: none;
}
.c-stage.zoomed { cursor: grab; }
.c-stage.zoomed:active { cursor: grabbing; }
.c-stage.pixelated .c-img { image-rendering: pixelated; }

.c-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  pointer-events: none;
}

.c-clip { position: absolute; inset: 0; }

.c-divider {
  position: absolute;
  top: 0; bottom: 0;
  width: 18px;
  margin-left: -9px;
  cursor: ew-resize;
  z-index: 2;
}
.c-divider::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: var(--paper);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.7);
}
.c-handle {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 13px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}
.c-handle::after { content: "↔"; font-weight: 700; }

.compare .tag {
  position: absolute;
  bottom: 8px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--radius);
  background: rgba(30, 29, 27, 0.78);
  color: var(--paper);
  pointer-events: none;
  z-index: 2;
}
.compare .tag.left { left: 8px; }
.compare .tag.right { right: 8px; }

.c-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
}
.c-bar button {
  background: var(--card);
  border: 1px solid var(--ink);
  color: var(--ink);
  width: 28px; height: 26px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.c-bar button:hover { background: var(--ink); color: var(--paper); }
.c-zoom {
  min-width: 46px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
}
.c-hint { margin-left: auto; font-size: 10.5px; }

.small-note { font-size: 12px; margin-top: 8px; line-height: 1.5; }

.caption-text {
  background: transparent;
  border-left: 3px solid var(--ink);
  padding: 8px 14px;
  font-style: italic;
  font-size: 14px;
  margin: 0 0 6px;
}

.error-text { color: var(--err); font-weight: 600; }

/* ---- pied de page ---- */

.page-footer {
  margin-top: 60px;
  text-align: right;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- lightbox ---- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(20, 19, 17, 0.92);
  display: grid;
  place-items: center;
}
.lightbox > #lightboxContent > img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: var(--radius);
}
.lightbox .compare { margin: 0; }
.lightbox .c-stage { width: min(86vh, 92vw); border-color: rgba(242, 240, 235, 0.25); }
.lightbox .c-bar { justify-content: center; }
.lightbox .c-bar button { background: transparent; border-color: var(--paper); color: var(--paper); }
.lightbox .c-bar button:hover { background: var(--paper); color: var(--ink); }
.lightbox .c-zoom, .lightbox .c-hint { color: rgba(242, 240, 235, 0.7); }
#lightboxClose {
  position: absolute;
  top: 18px; right: 24px;
  background: none;
  border: 0;
  color: var(--paper);
  font-size: 22px;
  cursor: pointer;
  z-index: 2;
}

.hidden { display: none !important; }
