/* IMPRINT WEB — the app's design tokens, translated to CSS.
   95% grayscale; acid appears sparingly. Hairlines, not shadows. */

@font-face {
  font-family: 'PlexMono';
  src: url('fonts/IBMPlexMono-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'PlexMono';
  src: url('fonts/IBMPlexMono-Medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'SpaceGrotesk';
  src: url('fonts/SpaceGrotesk.ttf') format('truetype');
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --bg: #111214;
  --surface: #191A1D;
  --hairline: #2A2C30;
  --ink: #E9E7E1;
  --ink2: #8B8E94;
  --acid: #B9C46A;
  --acid-dim: #6E7547;
  --on-acid: #111214;
  --signal: #C97E52;
  --check: #3A3D42;
  --sans: 'SpaceGrotesk', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --mono: 'PlexMono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 14px; }
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; }
.dim { color: var(--ink2); }
.hidden { display: none !important; }

/* ── top bar ─────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 32px;
  padding: 0 24px; height: 56px;
  border-bottom: 1px solid var(--hairline);
}
.wordmark { font-family: var(--mono); font-weight: 500; font-size: 16px; letter-spacing: 0.18em; }
.wordmark .beta { font-size: 9px; color: var(--acid); margin-left: 10px; letter-spacing: 0.12em; }
.tabs { display: flex; height: 100%; }
.tab {
  padding: 0 20px; height: 100%; font-size: 14px; color: var(--ink2);
  border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 6px;
}
.tab .sub { font-family: var(--mono); font-size: 9px; }
.tab.active { color: var(--ink); border-bottom-color: var(--acid); }
.tab.active .sub { color: var(--acid); }
.privacy { margin-left: auto; color: var(--ink2); }

/* ── layout ──────────────────────────────────────────── */
main { max-width: 1280px; margin: 0 auto; padding: 24px; }
.panel { display: none; }
.panel.active { display: block; }
.workarea { display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .workarea { grid-template-columns: 1fr; } }

/* ── dropzone ────────────────────────────────────────── */
.dropzone {
  border: 1px dashed var(--hairline); background: var(--surface);
  min-height: 140px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color 0.15s;
  text-align: center; padding: 24px;
}
.dropzone.slim { min-height: 84px; }
.dropzone:hover, .dropzone.over { border-color: var(--acid); }
.dz-title { font-size: 15px; margin-bottom: 8px; }

.listbar { margin-top: 12px; margin-bottom: 0; justify-content: space-between; }

/* ── thumbnails ──────────────────────────────────────── */
.thumbs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 2px; margin-top: 12px;
}
.thumb {
  position: relative; aspect-ratio: 1; background: var(--surface); overflow: hidden;
  border: 1px solid transparent;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .tag {
  position: absolute; left: 2px; bottom: 2px; padding: 1px 5px;
  background: rgba(17,18,20,0.72); font-family: var(--mono); font-size: 9px; color: var(--ink);
}
.thumb .rm {
  position: absolute; top: 2px; right: 2px; padding: 1px 6px;
  background: rgba(17,18,20,0.72); font-family: var(--mono); font-size: 10px; color: var(--signal);
  opacity: 0; transition: opacity 0.1s;
}
.thumb:hover .rm { opacity: 1; }
.sortable .thumb { cursor: grab; }
.sortable .thumb.dragging { opacity: 0.3; }
.sortable .thumb.dropover { border-color: var(--acid); }

/* ── vault ───────────────────────────────────────────── */
.setrow { margin-bottom: 12px; }
.setrow .seg { flex-wrap: wrap; height: auto; min-height: 28px; }
.setrow .seg button { padding: 5px 12px; }
.thumb.selected { border-color: var(--acid); }

.thumbs.vault .thumb {
  /* transparency checkerboard behind marks */
  background:
    conic-gradient(var(--check) 90deg, var(--surface) 90deg 180deg,
                   var(--check) 180deg 270deg, var(--surface) 270deg)
    0 0 / 16px 16px;
}
.thumbs.vault .thumb img, .thumbs.vault .thumb canvas { object-fit: contain !important; }
.thumb .tag.warn { color: var(--signal); }
.thumb .tag.ratio { left: auto; right: 2px; color: var(--acid); }
.thumb .badge {
  position: absolute; top: 2px; left: 2px; padding: 1px 5px;
  font-family: var(--mono); font-size: 9px;
  background: rgba(17,18,20,0.72);
}
.thumb .badge.ok { color: var(--acid); }
.thumb .badge.miss { color: var(--signal); }

/* ── STRIP file list ─────────────────────────────────── */
.filelist { margin-top: 12px; border-top: 1px solid var(--hairline); }
.filerow {
  display: flex; align-items: baseline; gap: 12px;
  padding: 10px 4px; border-bottom: 1px solid var(--hairline);
}
.filerow .name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filerow .meta { color: var(--ink2); font-family: var(--mono); font-size: 10px; }
.filerow .found { color: var(--signal); font-family: var(--mono); font-size: 10px; margin-left: auto; text-align: right; }
.filerow .found.clean { color: var(--acid); }

/* ── controls ────────────────────────────────────────── */
.right { display: flex; flex-direction: column; gap: 16px; }
.ctl-group { background: var(--surface); border: 1px solid var(--hairline); padding: 14px 16px; }
.ctl-head { color: var(--ink2); margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.row:last-child { margin-bottom: 0; }
.lbl { color: var(--ink2); flex-shrink: 0; }
.note { margin-top: 8px; line-height: 1.5; }

.seg { display: inline-flex; border: 1px solid var(--hairline); height: 28px; }
.seg button {
  padding: 0 12px; font-size: 12px; color: var(--ink2);
  border-left: 1px solid var(--hairline); white-space: nowrap;
}
.seg button:first-child { border-left: none; }
.seg button.on { background: var(--acid); color: var(--on-acid); }

.chipbtn {
  border: 1px solid var(--hairline); padding: 5px 12px; font-size: 12px; color: var(--ink2);
}
.chipbtn:hover { border-color: var(--acid); color: var(--ink); }
.chipbtn.danger:hover { border-color: var(--signal); color: var(--signal); }

.txt {
  background: none; border: none; border-bottom: 1px solid var(--hairline);
  color: var(--ink); font-family: inherit; font-size: 13px; padding: 4px 2px; width: 100%;
}
.txt:focus { outline: none; border-bottom-color: var(--acid); }
.txt.num { width: 56px; text-align: center; font-family: var(--mono); }

input[type=range] { flex: 1; min-width: 80px; accent-color: var(--acid); }

.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.toggle input { display: none; }
.toggle span {
  width: 34px; height: 20px; border: 1px solid var(--hairline); padding: 3px;
  display: inline-flex; justify-content: flex-start; transition: 0.12s;
}
.toggle span::after { content: ''; width: 12px; height: 12px; background: var(--ink2); }
.toggle input:checked + span { border-color: var(--acid); justify-content: flex-end; }
.toggle input:checked + span::after { background: var(--acid); }

/* six-slot position picker */
.pospick {
  width: 84px; height: 52px; border: 1px solid var(--hairline);
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr);
}
.pospick button { display: flex; align-items: center; justify-content: center; }
.pospick button::after { content: ''; width: 8px; height: 8px; background: var(--check); transition: 0.1s; }
.pospick button.on::after { width: 12px; height: 12px; background: var(--acid); }
.pospick button[data-p^='t'] { align-items: flex-start; padding-top: 5px; }
.pospick button[data-p^='b'] { align-items: flex-end; padding-bottom: 5px; }
.pospick button[data-p$='l'] { justify-content: flex-start; padding-left: 5px; }
.pospick button[data-p$='r'] { justify-content: flex-end; padding-right: 5px; }

/* ── big action button ───────────────────────────────── */
.bigbtn {
  height: 52px; background: var(--acid); color: var(--on-acid);
  font-size: 15px; font-weight: 500; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
}
.bigbtn .sub { font-family: var(--mono); font-size: 9px; font-weight: 400; }
.bigbtn:disabled { background: none; border: 1px solid var(--hairline); color: var(--ink2); cursor: default; }
.bigbtn:not(:disabled):hover { background: var(--acid-dim); color: var(--ink); }
.btnrow { display: flex; gap: 8px; }
.btnrow .bigbtn { flex: 1; }
.btnrow .bigbtn:last-child { flex: 1.6; }
.bigbtn.secondary:not(:disabled) { background: none; border: 1px solid var(--acid-dim); color: var(--ink); }
.bigbtn.secondary:not(:disabled) .sub { color: var(--acid); }
.bigbtn.secondary:not(:disabled):hover { border-color: var(--acid); }

/* ── progress ────────────────────────────────────────── */
.progress { position: relative; height: 28px; border: 1px solid var(--hairline); }
.progress .bar { position: absolute; inset: 0; width: 0%; background: var(--acid); transition: width 0.15s; }
.progress .count {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  mix-blend-mode: difference; color: #fff;
}

/* ── GRID preview: every page, stacked, scroll to browse ── */
#grid-previews { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
#grid-previews canvas {
  width: 100%; border: 1px solid var(--hairline); background: var(--surface);
}
#grid-previews .pagelabel { font-family: var(--mono); font-size: 10px; color: var(--ink2); margin-top: 6px; }

footer { border-top: 1px solid var(--hairline); padding: 16px 24px; margin-top: 40px; }
