/* =========================================================
   Book Spine Label Maker: widget-body styles only.
   Layered on /tools/_shared/tool.css.
   ========================================================= */

.widget-card { max-width: 1040px; }

.sl-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}
.sl-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  align-items: start;
}
@media (min-width: 640px) {
  .sl-row { grid-template-columns: repeat(3, 1fr); }
}
.sl-field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.sl-field > label,
.sl-legend {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
}
.sl-field input[type="number"],
.sl-field select,
.sl-field textarea {
  width: 100%;
  padding: 10px 14px;
  font: inherit;
  font-size: 16px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: var(--transition-colors);
}
.sl-field textarea { resize: vertical; min-height: 160px; line-height: 1.55; font-family: var(--font-mono); font-size: 14px; }
.sl-field input:focus,
.sl-field select:focus,
.sl-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.sl-hint { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.sl-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.sl-actions .btn { min-height: 44px; }

.sl-custom {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-inset);
}
@media (min-width: 640px) {
  .sl-custom { grid-template-columns: repeat(4, 1fr); }
}
.sl-custom label { font-size: 12px; font-weight: 600; color: var(--text-secondary); display: flex; flex-direction: column; gap: 4px; }
.sl-custom input { width: 100%; padding: 8px 10px; font: inherit; font-size: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); }

.sl-error { margin: 0; color: var(--danger); font-size: 14px; }

/* ---------- Preview ---------- */
.sl-preview-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.sl-preview-title { margin: 0; font-size: 18px; }
.sl-status { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.sl-stage {
  position: relative;
  overflow: hidden;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* The sheet is real letter size; screens shrink it with a transform. */
.sl-sheet {
  position: relative;
  width: 8.5in;
  height: 10.98in;
  overflow: hidden;
  background: #fff;
  color: #000;
  transform: scale(var(--sl-scale, 1));
  transform-origin: 0 0;
  font-family: var(--font-sans);
}
.sl-sheet + .sl-sheet { display: none; }

.sl-label {
  position: absolute;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.15;
  padding: 0.02in 0.05in;
  border: 1px dashed #C9C9D1;
}
.sl-label.is-skipped {
  background: repeating-linear-gradient(135deg, #fff, #fff 4px, #ECECF0 4px, #ECECF0 5px);
}
.sl-line { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-line.is-call { font-weight: 700; }
.sl-line.is-minor { font-size: 0.82em; }

/* The credit sits in the page margin, outside the label grid. */
.sl-sheet .print-credit {
  position: absolute;
  left: 1in;
  right: 1in;
  bottom: 0.2in;
  margin: 0;
  padding-top: 3px;
  font-size: 7.5pt;
}

/* ---------- Print: only the sheets ---------- */
@media print {
  @page { size: letter portrait; margin: 0; }
  html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  .tool-header,
  .tool-footer,
  .widget-header,
  .sl-controls,
  .sl-preview-head,
  .article,
  .libafile-inline,
  .skip-link { display: none !important; }
  main, .widget-wrap, .widget-card {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    width: auto !important;
    border: none !important;
    box-shadow: none !important;
    background: #fff !important;
  }
  .sl-stage { height: auto !important; overflow: visible !important; border: none !important; background: #fff !important; border-radius: 0; }
  .sl-sheet { transform: none !important; display: block !important; break-after: page; page-break-after: always; }
  .sl-sheet:last-child { break-after: auto; page-break-after: auto; }
  .sl-label { border-color: transparent !important; background: none !important; }
  .sl-label.is-skipped { visibility: hidden; }
}
