/* PDF Merger tool. Ported from the original standalone PDF Merger.html, re-pointed
   at the shared --slg-* tokens from main.css instead of its own blue accent. */
.slg-merger-layout { display: flex; flex-direction: column; gap: 2rem; max-width: 46rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.slg-merger-layout main { min-width: 0; }
@media (min-width: 980px) {
  .slg-merger-layout { flex-direction: row; max-width: 80rem; align-items: flex-start; justify-content: center; }
  .slg-rail { width: 13rem; flex: 0 0 13rem; }
  .slg-merger-layout main { flex: 1 1 26rem; max-width: 46rem; }
}
.slg-rail { display: none; flex-direction: column; gap: 1rem; }
@media (min-width: 980px) { .slg-rail { display: flex; } }
.slg-rail .slg-ad-card--video { aspect-ratio: 480 / 854; width: 100%; }
.slg-rail .slg-ad-card--image { aspect-ratio: 1 / 1; width: 100%; }

.slg-merger h1 { font-size: 2rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 0.4rem; font-family: var(--slg-font-display); }
.slg-merger .lede { color: var(--slg-muted); margin: 0 0 2rem; max-width: 34rem; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem;
  border: 2px dashed var(--slg-line); border-radius: 14px; background: var(--slg-paper);
  padding: 2rem 1rem; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--slg-maroon); }
.drop.over { background: color-mix(in srgb, var(--slg-maroon) 7%, var(--slg-paper)); }
.drop strong { font-size: 1.05rem; }
.drop span { color: var(--slg-muted); font-size: 0.9rem; }
.drop:focus-visible { outline: 3px solid var(--slg-maroon); outline-offset: 3px; }

.toolbar { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2rem 0 0.75rem; flex-wrap: wrap; }
.toolbar h2 { font-size: 1.05rem; margin: 0; font-weight: 600; }
.toolbar .meta { color: var(--slg-muted); font-size: 0.9rem; }
.linkbtn { background: none; border: 0; color: var(--slg-maroon); font: inherit; font-size: 0.9rem; cursor: pointer; padding: 0.25rem 0; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn:focus-visible { outline: 2px solid var(--slg-maroon); outline-offset: 2px; border-radius: 3px; }

ol.stack { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.item {
  display: grid; grid-template-columns: auto 3.5rem 1fr auto; align-items: center; gap: 0.9rem;
  background: var(--slg-paper); border: 1px solid var(--slg-line); border-radius: 10px; padding: 0.6rem 0.75rem 0.6rem 0.5rem;
}
.item.dragging { opacity: 0.45; }
.item.drop-before { box-shadow: 0 -3px 0 0 var(--slg-maroon); }
.item.drop-after { box-shadow: 0 3px 0 0 var(--slg-maroon); }
.grip { cursor: grab; color: var(--slg-muted); padding: 0.25rem; display: flex; touch-action: none; }
.thumb {
  width: 3.5rem; height: 4.6rem; background: var(--slg-cream); border: 1px solid var(--slg-line); border-radius: 3px;
  display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--slg-muted); font-size: 0.7rem; font-weight: 600;
}
.thumb canvas { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.info { min-width: 0; }
.name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub { color: var(--slg-muted); font-size: 0.85rem; }
.range { color: var(--slg-black); font-variant-numeric: tabular-nums; }
.warn { color: var(--slg-danger); font-size: 0.85rem; }
.actions { display: flex; gap: 0.15rem; }
.icon {
  width: 2.25rem; height: 2.25rem; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--slg-muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon:hover:not(:disabled) { background: var(--slg-cream); color: var(--slg-black); border-color: var(--slg-line); }
.icon:disabled { opacity: 0.3; cursor: default; }
.icon.remove:hover:not(:disabled) { color: var(--slg-danger); }
.icon:focus-visible { outline: 2px solid var(--slg-maroon); outline-offset: 1px; }

.empty { color: var(--slg-muted); padding: 1.25rem 0; }

.output { margin-top: 2rem; background: var(--slg-paper); border: 1px solid var(--slg-line); border-radius: 14px; padding: 1.25rem; display: grid; gap: 0.75rem; }
.output label { font-weight: 600; font-size: 0.95rem; }
.namerow { display: flex; align-items: stretch; border: 1px solid var(--slg-line); border-radius: 8px; overflow: hidden; background: var(--slg-cream); }
.namerow input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--slg-black); font: inherit; padding: 0.6rem 0.75rem; }
.namerow input:focus { outline: none; }
.namerow:focus-within { outline: 2px solid var(--slg-maroon); outline-offset: 1px; }
.namerow span { padding: 0.6rem 0.75rem; color: var(--slg-muted); border-left: 1px solid var(--slg-line); }
.primary {
  justify-self: start; background: var(--slg-maroon); color: #fff; border: 0; border-radius: 8px;
  font: inherit; font-weight: 600; padding: 0.75rem 1.4rem; cursor: pointer;
}
.primary:hover:not(:disabled) { background: var(--slg-maroon-deep); }
.primary:disabled { opacity: 0.4; cursor: default; }
.primary:focus-visible { outline: 3px solid var(--slg-maroon); outline-offset: 3px; }
.status { font-size: 0.9rem; color: var(--slg-muted); min-height: 1.35em; margin: 0; }
.status.err { color: var(--slg-danger); }
.note { color: var(--slg-muted); font-size: 0.85rem; margin: 1.5rem 0 0; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 520px) {
  .slg-merger-layout { padding-top: 1.5rem; }
  .slg-merger h1 { font-size: 1.6rem; }
  .item { grid-template-columns: 2.8rem 1fr auto; gap: 0.7rem; padding-left: 0.6rem; }
  .grip { display: none; }
  .thumb { width: 2.8rem; height: 3.7rem; }
  .actions { flex-direction: column; }
  .icon { width: 2rem; height: 2rem; }
}
