/* Traducteur PDF — interface */
@font-face { font-family: "Noto Serif App"; src: url("../fonts/NotoSerif-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Noto Sans App"; src: url("../fonts/NotoSans-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Sans App"; src: url("../fonts/NotoSans-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --desk: #edf0f4;
  --paper: #ffffff;
  --ink: #16243a;
  --muted: #5b6b80;
  --line: #cfd6df;
  --green: #0e7c66;
  --green-ink: #ffffff;
  --highlight: #ffe27a;
  --warn: #c46a00;
  --danger: #b3261e;
  --focus: #0e7c66;
  --radius-sheet: 3px;
  --radius-ctl: 8px;
  --serif: "Noto Serif App", "Noto Serif", Georgia, serif;
  --sans: "Noto Sans App", "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --desk: #121821;
    --paper: #1b2330;
    --ink: #e6ecf3;
    --muted: #9aa8b9;
    --line: #34404f;
    --green: #3cc7a6;
    --green-ink: #0c1a16;
    --highlight: #e9c54a;
    --warn: #f0a443;
    --danger: #ff8a80;
    --focus: #3cc7a6;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: var(--green); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0; }
h2 { font-size: 1.35rem; margin-bottom: 0.6rem; }
h3 { font-size: 1.08rem; margin-bottom: 0.35rem; }
p { margin: 0 0 0.6rem; }
.muted { color: var(--muted); }
.small-text { font-size: 0.86rem; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* header */
.top {
  max-width: 760px; margin: 0 auto; padding: 22px 16px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { font-size: 1.6rem; letter-spacing: -0.01em; }
.top-actions { display: flex; gap: 8px; }

main { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-top: 16px; }
.panel.quiet { background: transparent; border-style: dashed; }
.banner { max-width: 728px; margin: 4px auto 0; padding: 10px 14px; border-radius: 10px; background: var(--highlight); color: #16243a; display: flex; gap: 12px; align-items: center; justify-content: space-between; }

/* buttons & fields */
.btn {
  font: 700 0.95rem/1 var(--sans); color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--line); border-radius: var(--radius-ctl);
  padding: 12px 18px; min-height: 44px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { padding: 8px 12px; min-height: 36px; font-size: 0.86rem; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 5px; margin: 10px 0; }
.field > span:first-child { font-size: 0.9rem; font-weight: 700; }
select, input[type="text"], input[type="password"], input[type="url"], input[type="number"], textarea {
  font: 400 1rem/1.3 var(--sans); color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--line); border-radius: var(--radius-ctl); padding: 10px 12px; min-height: 44px; width: 100%;
}
textarea { resize: vertical; min-height: 70px; }
.field .row select { flex: 1; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-size: 0.95rem; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--green); }

/* the drop target: a sheet of paper */
.sheet {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end;
  gap: 4px; min-height: 250px; padding: 108px 26px 24px; cursor: pointer;
  background: var(--paper);
  border: 1.5px solid var(--line); border-radius: var(--radius-sheet);
  box-shadow: 0 1px 0 var(--line), 0 10px 22px -16px rgba(22, 36, 58, 0.45);
  clip-path: polygon(0 0, calc(100% - 34px) 0, 100% 34px, 100% 100%, 0 100%);
  transition: transform 0.15s ease;
}
.sheet::before {
  /* a few lines of "text" at the top of the sheet, like the app icon */
  content: ""; position: absolute; left: 26px; top: 30px; width: min(52%, 260px); height: 58px;
  background:
    linear-gradient(var(--highlight), var(--highlight)) 0 0 / 78% 12px no-repeat,
    linear-gradient(var(--line), var(--line)) 0 23px / 100% 7px no-repeat,
    linear-gradient(var(--line), var(--line)) 0 38px / 92% 7px no-repeat,
    linear-gradient(var(--line), var(--line)) 0 53px / 60% 5px no-repeat;
  border-radius: 2px; opacity: 0.9;
}
.sheet-fold { position: absolute; top: 0; right: 0; width: 34px; height: 34px; background: linear-gradient(225deg, var(--desk) 50%, var(--line) 50%); }
.sheet-title { font: 700 1.5rem/1.2 var(--serif); }
.sheet-sub { font-size: 1rem; }
.sheet-note { margin-top: 10px; font-size: 0.85rem; color: var(--muted); max-width: 46ch; }
.sheet.over { transform: translateY(-3px); background-color: color-mix(in srgb, var(--highlight) 35%, var(--paper)); border-color: var(--green); }
.panel:has(.sheet) { padding: 18px; background: transparent; border: none; }

/* setup */
.file-line { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.file-name { font: 700 1.15rem/1.3 var(--serif); margin: 0; word-break: break-word; }
.langs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.alert { background: color-mix(in srgb, var(--highlight) 45%, var(--paper)); border-left: 4px solid var(--warn); padding: 10px 12px; border-radius: 6px; color: var(--ink); }
.engines { border: none; padding: 0; margin: 12px 0 4px; }
.engines legend { font-weight: 700; font-size: 0.9rem; margin-bottom: 6px; padding: 0; }
.engine {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: start;
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-ctl); margin-bottom: 8px; cursor: pointer;
}
.engine input { margin-top: 5px; width: 18px; height: 18px; accent-color: var(--green); grid-row: span 2; }
.engine strong { font-size: 1rem; }
.engine small { color: var(--muted); font-size: 0.86rem; }
.engine:has(input:checked) { border-color: var(--green); box-shadow: inset 4px 0 0 var(--green); }
.engine.off { opacity: 0.62; }

/* progress: a sheet of tiny pages */
.progress-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.progress-text { font-size: 1.05rem; margin: 4px 0 14px; }
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(20px, 26px)); gap: 7px 6px; margin-bottom: 12px; }
.pg {
  display: block; aspect-ratio: 0.72; min-width: 12px; border: 1.5px solid var(--line); background: var(--paper);
  clip-path: polygon(0 0, 68% 0, 100% 24%, 100% 100%, 0 100%); border-radius: 1px; position: relative;
}
.pg.busy { background: var(--highlight); border-color: color-mix(in srgb, var(--highlight) 60%, var(--ink)); }
.pg.done { background: var(--green); border-color: var(--green); }
.pg.warn { background: var(--warn); border-color: var(--warn); }
@media (prefers-reduced-motion: no-preference) {
  .pg.busy { animation: ink 1.1s ease-in-out infinite alternate; }
  @keyframes ink { from { filter: saturate(0.6); } to { filter: saturate(1.25); } }
}
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 14px; padding: 0; margin: 0 0 8px; font-size: 0.82rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend .pg { width: 11px; min-width: 11px; }

/* result */
#result-summary { font-size: 1.02rem; }
details summary { cursor: pointer; font-weight: 700; margin-top: 10px; }
#warning-list { padding-left: 18px; font-size: 0.92rem; }
.error-panel { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); }

/* history */
.history { list-style: none; padding: 0; margin: 0; }
.history li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.history li:first-child { border-top: none; }
.history .h-name { font-weight: 700; word-break: break-word; }
.history .h-meta { font-size: 0.84rem; color: var(--muted); }
.history .h-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* settings dialog */
.settings { border: none; padding: 0; width: min(680px, 100%); max-height: 92vh; border-radius: 14px; background: var(--paper); color: var(--ink); }
.settings::backdrop { background: rgba(10, 16, 26, 0.55); }
.settings-inner { padding: 18px 20px 24px; }
.settings-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: -18px; background: var(--paper); padding: 6px 0; z-index: 1; }
.set { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }

@media (max-width: 560px) {
  body { font-size: 15.5px; }
  .langs, .two { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
  .sheet { min-height: 220px; padding-top: 100px; }
  .settings { width: 100%; max-height: 100vh; height: 100%; border-radius: 0; margin: 0; max-width: 100%; }
  .file-line { flex-direction: column; }
  .history li { flex-direction: column; align-items: flex-start; }
  .history .h-actions { justify-content: flex-start; }
}
