/* Pixbatch — Bulk Image Resizer
   Light "paper" theme: one primary (deep green) + one accent (terracotta).
   System fonts only. No frameworks. */

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --ink: #171c19;
  --muted: #5d6660;
  --faint: #8a918c;
  --line: #e6e5dd;
  --line-strong: #d2d1c6;

  --brand: #0e5f4a;
  --brand-strong: #0a4a39;
  --brand-tint: #e8f2ee;
  --brand-tint-2: #d5e9e0;

  --accent: #c2410c;
  --accent-tint: #fdeee3;

  --ok: #15803d;
  --ok-bg: #e9f6ee;
  --err: #b42318;
  --err-bg: #fdecea;
  --warn: #a16207;
  --warn-bg: #fdf5e2;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgb(23 28 25 / .05), 0 10px 28px -14px rgb(23 28 25 / .14);

  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { letter-spacing: -0.015em; margin: 0; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
img, svg { display: block; }
::selection { background: var(--brand-tint-2); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; border: 0; clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ---------- top bar ---------- */
.topbar { border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--brand); flex: none; }
.brand-name { font-weight: 700; letter-spacing: -0.01em; }
.brand-sub { color: var(--faint); font-size: 13.5px; }
.topnav { display: flex; gap: 18px; }
.topnav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.topnav a:hover { color: var(--brand); }

/* ---------- tool card (first screen) ---------- */
main.wrap { padding-top: 28px; padding-bottom: 64px; }
.tool {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px 24px;
}
.tool-head { margin-bottom: 14px; }
.tool-head h1 {
  font-size: clamp(1.7rem, 1.15rem + 1.8vw, 2.35rem);
  font-weight: 780;
  line-height: 1.12;
  letter-spacing: -0.025em;
}
.tagline { color: var(--muted); margin-top: 8px; font-size: 15.5px; max-width: 60ch; }

/* dropzone */
.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 30px 20px 26px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.dropzone:hover { border-color: var(--brand); background: var(--brand-tint); }
.dropzone.is-drag { border-color: var(--brand); background: var(--brand-tint-2); transform: scale(1.004); }
.dz-icon { width: 34px; height: 34px; color: var(--brand); margin: 0 auto 12px; }
.dz-title { font-weight: 680; font-size: 18px; letter-spacing: -0.01em; }
.dz-sub { color: var(--muted); font-size: 14.5px; margin-top: 6px; }
.dz-link { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.dz-folder {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--brand); text-decoration: underline; text-underline-offset: 2px; font-size: 14.5px;
}
.dz-folder:hover { color: var(--brand-strong); }
.dz-formats { margin-top: 12px; font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--faint); }

/* ---------- controls ---------- */
.controls { margin-top: 14px; display: grid; gap: 13px; }
.ctl-block { min-width: 0; }
.ctl-label { display: block; font-size: 12.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); margin-bottom: 8px; }

.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.mode-tab {
  border: none; background: transparent; border-radius: 7px; padding: 7px 14px;
  font-size: 14px; font-weight: 550; color: var(--muted); cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.mode-tab:hover { color: var(--ink); }
.mode-tab.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(23 28 25 / .1); font-weight: 650; }

.pane { display: none; }
.pane.is-active { display: block; }
.field-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 13.5px; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }
.field-label output { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.field input[type="number"], .field select {
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 9px 11px; font-size: 15px; background: var(--surface); width: 130px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.field select { width: 190px; cursor: pointer; }
.field input[type="number"]:hover, .field select:hover { border-color: var(--faint); }
.field input[type="number"]:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.field input[type="number"].has-error { border-color: var(--err); box-shadow: 0 0 0 3px var(--err-bg); }

.lock-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 39px;
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius-sm);
  padding: 0 12px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted);
  transition: all .12s ease;
}
.lock-btn svg { width: 16px; height: 16px; }
.lock-btn.is-locked { background: var(--brand-tint); border-color: var(--brand-tint-2); color: var(--brand-strong); }
.lock-btn:hover { border-color: var(--brand); }

.field-quality { flex: 1; min-width: 200px; }
.field-quality input[type="range"] { width: 100%; accent-color: var(--brand); height: 24px; }
.field-quality.is-disabled { opacity: .45; }

.field-note { color: var(--faint); font-size: 13px; margin-top: 9px; max-width: 75ch; }

.ctl-error {
  background: var(--err-bg); border: 1px solid #f3c8c2; color: var(--err);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px;
}

.ctl-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer;
  font-weight: 650; font-size: 15px; padding: 11px 20px;
  transition: transform .1s ease, background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgb(10 74 57 / .25); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-primary:disabled { background: var(--faint); cursor: progress; }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--muted); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-small { padding: 7px 13px; font-size: 13.5px; }

/* ---------- limits strip + privacy line ---------- */
.limits-strip {
  margin-top: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border-top: 1px dashed var(--line-strong); padding-top: 13px;
}
.limits-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin-right: 4px; }
.chip {
  font-family: var(--mono); font-size: 12.5px; color: var(--brand-strong);
  background: var(--brand-tint); border: 1px solid var(--brand-tint-2);
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.privacy-line {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  color: var(--brand-strong); font-size: 14px; font-weight: 550;
}
.privacy-line svg { width: 17px; height: 17px; flex: none; }

/* ---------- files list ---------- */
.files { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.files-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.files-head h2 { font-size: 17px; font-weight: 700; }
.summary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.summary-text { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; color: var(--muted); }

.file-list { list-style: none; margin: 0; padding: 0; }
.file-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px;
  padding: 13px 2px; border-bottom: 1px solid var(--line);
}
.file-row:last-child { border-bottom: none; }
.file-main { min-width: 0; }
.file-name { font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.file-meta { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.file-meta .arrow { color: var(--faint); }
.file-meta .after { color: var(--brand-strong); font-weight: 600; }
.sizebar { width: 84px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; flex: none; }
.sizebar > span { display: block; height: 100%; background: var(--brand); border-radius: 3px; transition: width .3s ease; }
.file-row-note { font-size: 12.5px; color: var(--warn); margin-top: 3px; }
.file-side { display: flex; align-items: center; gap: 8px; }

.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.status-queued { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.status-working { background: var(--accent-tint); color: var(--accent); }
.status-working::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite;
}
.status-done { background: var(--ok-bg); color: var(--ok); }
.status-error { background: var(--err-bg); color: var(--err); }
.file-error { font-size: 13px; color: var(--err); margin-top: 3px; }

.icon-btn {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px;
  width: 32px; height: 32px; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted);
  transition: all .12s ease;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:disabled { opacity: .4; cursor: default; }
.icon-btn:disabled:hover { border-color: var(--line-strong); color: var(--muted); }

/* ---------- prose sections ---------- */
.section { margin-top: 44px; max-width: 78ch; }
.section h2 { font-size: 21px; font-weight: 720; margin-bottom: 14px; }
.prose p { color: #2a322d; margin-bottom: 12px; }
.prose strong { color: var(--ink); }
.limits-list { margin: 0; padding-left: 20px; color: #2a322d; }
.limits-list li { margin-bottom: 8px; }

/* ---------- FAQ ---------- */
.faq-list { display: grid; gap: 10px; }
.faq-list details {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  padding: 0 16px;
}
.faq-list summary {
  cursor: pointer; list-style: none; padding: 14px 0; font-weight: 620; font-size: 15px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: "+"; font-family: var(--mono); font-size: 17px; color: var(--brand); flex: none;
  transition: transform .15s ease;
}
.faq-list details[open] summary::after { transform: rotate(45deg); }
.faq-list details p { padding: 0 0 15px; color: #2a322d; font-size: 14.5px; max-width: 70ch; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-in { padding-top: 18px; padding-bottom: 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px 20px; flex-wrap: wrap; color: var(--faint); font-size: 13.5px; }
.footer-nav { display: flex; gap: 18px; }
.footer-nav a { color: var(--muted); text-decoration: none; }
.footer-nav a:hover { color: var(--brand); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(8px);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 550; opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease; z-index: 50;
  max-width: calc(100vw - 40px);
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-error { background: var(--err); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  body { font-size: 15px; }
  main.wrap { padding-top: 18px; }
  .tool { padding: 18px 14px; border-radius: 12px; }
  .topnav { display: none; }
  .dropzone { padding: 32px 12px 28px; }
  .segmented { width: 100%; }
  .mode-tab { flex: 1; text-align: center; padding: 9px 6px; }
  .field input[type="number"], .field select { width: 100%; }
  .field-row { gap: 10px; }
  .pane .field { flex: 1 1 120px; }
  .lock-btn { width: auto; align-self: center; height: 38px; }
  .ctl-actions .btn { flex: 1 1 100%; text-align: center; }
  .file-row { grid-template-columns: minmax(0, 1fr); }
  .file-side { justify-content: flex-start; flex-wrap: wrap; }
  .summary { width: 100%; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
