/* Layout : réglages à gauche, zone de travail à droite ; une colonne sur petit écran.
   Palette : papier gris froid, encre, bleu outremer (pigment) en accent. */
:root {
  --paper: #f3f4f2;
  --sheet: #ffffff;
  --ink: #1d1f23;
  --muted: #62666e;
  --line: #d9dcd8;
  --accent: #2b3d8f;
  --accent-ink: #ffffff;
  --ok: #2f7a4f;
  --warn: #9a5b12;
  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --body: "IBM Plex Sans", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --radius: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16181c; --sheet: #1f2227; --ink: #eceef1; --muted: #a0a5ae;
    --line: #33373e; --accent: #8fa2ff; --accent-ink: #10131c; --ok: #6fcf97; --warn: #f2b867;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #16181c; --sheet: #1f2227; --ink: #eceef1; --muted: #a0a5ae;
  --line: #33373e; --accent: #8fa2ff; --accent-ink: #10131c; --ok: #6fcf97; --warn: #f2b867;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--body);
  padding: 0 clamp(16px, 3vw, 40px);
}
[hidden] { display: none !important; }
h1, h2 { font-weight: 400; margin: 0; text-wrap: balance; }
h2 { font-family: var(--display); font-size: 1.45rem; line-height: 1.2; }
.mono { font-family: var(--mono); font-size: 0.8rem; font-variant-numeric: tabular-nums; }

/* En-tête */
.top {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end;
  gap: 12px 32px; padding-block: 28px 20px; border-bottom: 1px solid var(--line);
}
.brand h1 { font-family: var(--display); font-size: clamp(2.2rem, 5vw, 3.2rem); line-height: 1; }
.sub { margin: 8px 0 0; color: var(--muted); max-width: 60ch; }
.privacy { margin: 0; color: var(--muted); font-size: 0.85rem; max-width: 32ch; }

/* Grille principale */
.layout {
  display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 28px; padding-block: 24px 48px;
}
@media (max-width: 820px) { .layout { grid-template-columns: minmax(0, 1fr); } }

.panel { display: flex; flex-direction: column; gap: 28px; }
.group { display: flex; flex-direction: column; gap: 14px; }
.group h2 { padding-bottom: 6px; border-bottom: 1px solid var(--line); }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .label, .alt-label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  display: flex; justify-content: space-between; gap: 8px;
}
.field output { font-family: var(--mono); letter-spacing: 0; text-transform: none; color: var(--ink); }
input[type="text"], select {
  font: inherit; color: var(--ink); background: var(--sheet);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 9px; width: 100%;
}
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="file"] { font-size: 0.85rem; max-width: 100%; }
input:focus-visible, select:focus-visible, button:focus-visible, .drop:focus-within {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.hint { margin: 0; font-size: 0.82rem; color: var(--muted); }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 0.88rem;
  background: var(--sheet); text-transform: none; letter-spacing: 0; color: var(--ink);
}
.seg input { accent-color: var(--accent); margin: 0; }
.seg label:has(input:checked) { border-color: var(--accent); }

/* Zone de travail */
.work { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 150px; padding: 24px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line); border-radius: 10px; background: var(--sheet);
  transition: border-color .15s, background .15s;
}
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop.over, .drop:hover { border-color: var(--accent); }
.drop-title { font-family: var(--display); font-size: 1.6rem; }
.drop-sub { color: var(--muted); font-size: 0.88rem; }

.preview { display: flex; flex-direction: column; gap: 10px; }
.preview-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.preview-head .mono { color: var(--muted); }
#previewCanvas {
  display: block; max-width: 100%; max-height: 62vh; width: auto; height: auto; margin-inline: auto;
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 12px 32px rgba(0,0,0,.10);
  background: repeating-conic-gradient(var(--line) 0 25%, var(--sheet) 0 50%) 0 0 / 16px 16px;
}

.list-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.count { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

button { font: inherit; cursor: pointer; border-radius: var(--radius); }
.primary { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); padding: 7px 14px; font-weight: 500; }
.primary:disabled { opacity: .5; cursor: progress; }
.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); padding: 7px 14px; }
.link { background: none; border: 0; color: var(--accent); padding: 2px 4px; font-size: 0.85rem; text-decoration: underline; text-underline-offset: 2px; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.row {
  display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; gap: 16px; align-items: start;
  background: var(--sheet); border: 1px solid var(--line); border-radius: 10px; padding: 14px;
}
.row.active { border-color: var(--accent); }
@media (max-width: 1100px) {
  .row { grid-template-columns: 72px minmax(0, 1fr); }
  .row-actions { grid-column: 1 / -1; flex-direction: row !important; }
}
.thumb { padding: 0; border: 0; background: var(--paper); width: 100%; aspect-ratio: 1; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fields { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.line { display: grid; grid-template-columns: repeat(3, minmax(90px, 130px)) minmax(140px, 1fr); gap: 10px; }
@media (max-width: 980px) { .line { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.out { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.fname { word-break: break-all; }
.stats { color: var(--muted); }
.stats .good { color: var(--ok); }
.stats .warn { color: var(--warn); }
.alt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 0.9rem; }
.alt-text { font-style: italic; min-width: 0; }
.row-actions { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
::placeholder { color: var(--muted); opacity: .6; font-style: italic; }
@media (max-width: 820px) { .work { order: -1; } }
