/* Upload page. Colors, fonts and scale come from /theme.css (editable in the admin). */
:root {
  --bg: #f6f4ef; --surface: #ffffff; --text: #1f2430; --accent: #2f6f5e; --accent-text: #ffffff;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-heading: var(--font-body);
  --scale-body: 1; --scale-heading: 1; --scale-sub: 1;
  --muted: color-mix(in srgb, var(--text) 62%, var(--bg));
  --line: color-mix(in srgb, var(--text) 16%, var(--surface));
  --danger: #b42318; --ok: #1a7f4b;
}
* { box-sizing: border-box; }
html { font-size: calc(100% * var(--scale-body)); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); line-height: 1.5;
}
.wrap { max-width: 640px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
h1 {
  font-family: var(--font-heading); font-weight: 700; line-height: 1.15;
  font-size: calc(1.85rem * var(--scale-heading)); margin: 0.5rem 0 1rem;
}
.lead { margin: 0 0 1rem; white-space: pre-line; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 1rem; margin-bottom: 1rem;
}
.field { display: block; font-weight: 600; margin-bottom: 0.35rem; }
input[type="text"], input[type="password"] {
  width: 100%; font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.8rem;
}
input:focus-visible, button:focus-visible, label.btn:focus-within {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn {
  display: inline-block; font: inherit; font-weight: 600; text-align: center; cursor: pointer;
  background: var(--accent); color: var(--accent-text); border: 2px solid var(--accent);
  border-radius: 10px; padding: 0.7rem 1.1rem; margin-top: 0.75rem;
}
.btn.secondary { background: transparent; color: var(--accent); }
.btn.big { width: 100%; padding: 0.95rem; font-size: 1.1rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pick { width: 100%; }
.error { color: var(--danger); margin: 0.4rem 0 0; min-height: 0; }
.error:empty { display: none; }
.summary { margin: 0.5rem 0 0; font-weight: 600; }
.summary:empty { display: none; }
.summary.ok { color: var(--ok); }
.summary.bad { color: var(--danger); }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.item {
  display: flex; gap: 0.75rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 0.75rem;
}
.item[data-state="error"] { border-color: var(--danger); }
.item[data-state="done"] { border-color: var(--ok); }
.thumb {
  flex: 0 0 72px; height: 72px; border-radius: 10px; overflow: hidden;
  background: color-mix(in srgb, var(--text) 8%, var(--surface));
  display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; color: var(--muted);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.body { flex: 1; min-width: 0; }
.meta { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.9rem; margin-bottom: 0.4rem; }
.fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.fsize { color: var(--muted); white-space: nowrap; }
.cap { font-size: 0.95rem; padding: 0.5rem 0.65rem; }
.cap:disabled { background: transparent; border-color: transparent; padding-left: 0; color: var(--muted); }
.bar {
  height: 8px; border-radius: 99px; margin-top: 0.55rem; overflow: hidden;
  background: color-mix(in srgb, var(--text) 12%, var(--surface));
}
.fill { height: 100%; width: 0; background: var(--accent); transition: width 0.15s linear; }
.status { font-size: 0.88rem; margin-top: 0.35rem; color: var(--muted); }
.status:empty { display: none; }
.item[data-state="error"] .status { color: var(--danger); }
.item[data-state="done"] .status { color: var(--ok); font-weight: 600; }
.row-actions { display: flex; gap: 1rem; margin-top: 0.3rem; }
.link {
  font: inherit; font-size: 0.9rem; background: none; border: 0; padding: 0.2rem 0; cursor: pointer;
  color: var(--accent); text-decoration: underline;
}
.link.retry { font-weight: 700; }
[hidden] { display: none !important; }

/* photo to the left of the form (heading spans both) */
.wrap.wide { max-width: 1080px; }
.layout.with-photo { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 1.5rem; align-items: start; }
.photo {
  position: sticky; top: 1rem; aspect-ratio: var(--photo-ratio, 1 / 1); border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line); background: color-mix(in srgb, var(--text) 8%, var(--surface));
}
.photo img { display: block; width: 100%; height: 100%; object-position: var(--photo-pos, 50% 50%); }
.fit-cover { object-fit: cover; }
.fit-contain { object-fit: contain; }
@media (max-width: 760px) {
  .layout.with-photo { grid-template-columns: 1fr; gap: 1rem; }
  .photo { position: static; }
}

/* subheading: sits under the heading and spans the photo + form columns */
.sub {
  margin: -0.4rem 0 1.25rem; color: var(--muted); white-space: pre-line;
  font-size: calc(1.15rem * var(--scale-sub));
}
.sub:empty { display: none; }
