/* SkyyCast Image to PDF (/tools/image-to-pdf).
 *
 * Loaded by that page only, after assets/sc-public.css AND
 * assets/sc-image-checker.css: reuses the checker's shared `ic-*` shell
 * (drop zone, buttons, card list, badges, facts grid) and the shared
 * `.ic-split` two-pane workspace, and only adds the `ip-*` pieces specific
 * to this tool -- the page-option controls, the per-item reorder buttons,
 * and the page-preview grid (a genuine representative render of each PDF
 * page, not a static mockup -- see sc-image-to-pdf.js computeLayout()).
 * All scoped under `.pub-site` and built from the `--pub-*` tokens: no new
 * colours, no new fonts, nothing on :root/html/body. Motion is limited to
 * short state transitions and is switched off under prefers-reduced-motion. */

/* ---- Option controls ---- */
.pub-site .ip-field-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  margin-bottom: .85rem;
}
.pub-site .ip-label {
  font-size: .8125rem;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--pub-text-muted);
  min-width: 90px;
}
.pub-site .ip-select {
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  min-height: 40px;
  padding: .4rem .7rem;
  border: 1px solid var(--pub-border-strong);
  border-radius: var(--pub-radius-md);
  background: var(--pub-surface);
  color: var(--pub-text);
  flex: 1 1 160px;
}
.pub-site .ip-select:focus-visible { outline: none; box-shadow: var(--pub-ring); border-color: var(--pub-accent); }
.pub-site .ip-advanced { border-top: 1px solid var(--pub-border); padding-top: .85rem; }
.pub-site .ip-advanced[hidden] { display: none; }
.pub-site .ip-advanced-toggle { margin-bottom: 1rem; }

/* ---- Drop zone reused from ic-drop; just needs top margin here ---- */
.pub-site .ip-tool .ic-drop { margin-top: .25rem; }

/* ---- File list: thumbnail + reorder buttons ---- */
.pub-site .ip-card { align-items: center; }
.pub-site .ip-card-thumb-wrap {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--pub-radius-sm, 6px);
  overflow: hidden;
  background: var(--pub-bg-soft);
  border: 1px solid var(--pub-border);
}
.pub-site .ip-card-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.pub-site .ip-card-actions { display: flex; align-items: center; gap: .15rem; flex: none; }
.pub-site .ip-move-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--pub-text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--pub-radius-sm, 6px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.pub-site .ip-move-btn svg { width: 16px; height: 16px; }
.pub-site .ip-move-btn:hover:not(:disabled) { background: var(--pub-bg-soft); color: var(--pub-text); }
.pub-site .ip-move-btn:focus-visible { outline: none; box-shadow: var(--pub-ring); }
.pub-site .ip-move-btn:disabled { opacity: .3; cursor: not-allowed; }

/* ---- Progress ---- */
.pub-site .ip-progress { margin: .9rem 0 0; display: flex; align-items: center; gap: .6rem; }
.pub-site .ip-progress[hidden] { display: none; }
.pub-site .ip-progress::before {
  content: "";
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--pub-accent);
  border-right-color: transparent;
  animation: ip-spin .8s linear infinite;
  flex: none;
}
@keyframes ip-spin { to { transform: rotate(360deg); } }
.pub-site .ip-progress-label { font-size: .875rem; font-weight: 700; color: var(--pub-text-secondary); margin: 0; }

/* ---- Page preview grid (right panel) ---- */
.pub-site .ip-preview-wrap[hidden] { display: none; }
.pub-site .ip-preview-pages {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .75rem;
}
.pub-site .ip-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
}
.pub-site .ip-page canvas {
  max-width: 100%;
  height: auto;
  border-radius: 2px;
  box-shadow: var(--pub-shadow-sm);
  background: #fff;
}
.pub-site .ip-page-num {
  font-size: .75rem;
  font-weight: 700;
  color: var(--pub-text-muted);
}

@media (max-width: 640px) {
  .pub-site .ip-field-row { flex-direction: column; align-items: flex-start; gap: .35rem; }
  /* `.ip-select`'s `flex: 1 1 160px` sizes it by WIDTH in the desktop row
     layout above, but `flex-direction: column` here flips the flex main
     axis to vertical -- without resetting it, that same 160px flex-basis
     (plus flex-grow pulling in extra space) sizes the select's HEIGHT
     instead, rendering it as a ~100px+ tall box. Resetting to the row's
     natural height keeps it compact; `width: 100%` still uses the full
     row's horizontal space. */
  .pub-site .ip-select { width: 100%; flex: none; }
  .pub-site .ip-label { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .pub-site .ip-progress::before { animation: none; border-right-color: var(--pub-accent); }
}
