/* PDF Booklet & 2-Up Imposition Maker (/tools/pdf-booklet-imposition/), 2026-11-30.
   Uses tokens from ft-shell-20261106.css and components from ft-tool-20261106.css.
   Reserves preview frame, fold diagram, and stats card dimensions on first paint so CLS = 0.000. */

.ft-tool .ft-fields {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), minmax(0, 1fr)));
}

.ft-tool .ft-field,
.ft-tool fieldset,
.ft-tool .ft-panel,
.ft-tool .ft-stack,
.ft-tool .ft-inputgroup {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.ft-tool .ft-select {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ft-tool input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.ft-tool select,
.ft-tool textarea,
.ft-tool .ft-input,
.ft-tool .ft-select {
  font-size: max(16px, 1rem);
  min-height: 44px;
}

.ft-tool .ft-btn {
  min-width: 44px;
  min-height: 44px;
  height: auto;
  padding-block: 0.48rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.bpdf-filebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ft-space-2) var(--ft-space-3);
  margin-top: calc(-1 * var(--ft-space-2));
}

.bpdf-fileinfo {
  flex: 1 1 13rem;
  min-width: 0;
  margin: 0;
  color: var(--ft-ink-2);
  font-size: var(--ft-text-sm);
  overflow-wrap: anywhere;
}

.bpdf-fileinfo strong {
  color: var(--ft-ink);
  font-weight: 650;
}

.bpdf-presets {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ft-space-2);
}

.bpdf-presets__label {
  margin: 0;
  color: var(--ft-ink);
  font-size: var(--ft-text-sm);
  font-weight: 600;
}

.bpdf-presets__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ft-space-2);
}

.bpdf-preset {
  justify-content: flex-start;
  text-align: left;
}

.bpdf-preset[aria-pressed="true"] {
  border-color: var(--ft-accent);
  background: var(--ft-accent-soft);
  color: var(--ft-ink);
  font-weight: 650;
}

.bpdf-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ft-space-3);
  min-width: 0;
  margin: 0;
  padding: var(--ft-space-4) 0 0;
  border: 0;
  border-top: 1px solid var(--ft-line);
}

.bpdf-group__legend {
  float: left;
  width: 100%;
  margin: 0 0 var(--ft-space-1);
  padding: 0;
  color: var(--ft-ink);
  font-size: var(--ft-text-md);
  font-weight: 650;
}

.bpdf-group__legend + * {
  clear: both;
}

.bpdf-unitwrap {
  display: flex;
  align-items: stretch;
  min-width: 0;
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius);
  background: var(--ft-surface);
  overflow: hidden;
}

.bpdf-unitwrap:focus-within {
  outline: 2px solid var(--ft-accent);
  outline-offset: 1px;
}

.bpdf-unitwrap .ft-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  outline: none;
  padding-inline: 0.6rem;
}

.bpdf-unitbadge {
  display: inline-flex;
  align-items: center;
  padding-inline: 0.5rem;
  border-left: 1px solid var(--ft-line);
  background: var(--ft-surface-2, var(--ft-surface));
  color: var(--ft-ink-2);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.bpdf-creep-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--ft-space-2);
}

.bpdf-creep-row .ft-field {
  flex: 1 1 10.5rem;
}

.bpdf-check {
  display: flex;
  align-items: center;
  gap: var(--ft-space-2);
  min-width: 44px;
  min-height: 44px;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius);
  background: var(--ft-surface);
  color: var(--ft-ink);
  line-height: 1.35;
  box-sizing: border-box;
}

.bpdf-check input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
}

.bpdf-check span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.bpdf-scope-note {
  margin: 0;
  color: var(--ft-ink-2);
  font-size: var(--ft-text-sm);
  line-height: 1.45;
}

.bpdf-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ft-space-2);
}

.bpdf-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
}

.bpdf-pill {
  min-width: 44px;
  min-height: 44px;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius);
  background: var(--ft-surface);
  color: var(--ft-ink-2);
  font: inherit;
  font-size: max(16px, var(--ft-text-sm));
  cursor: pointer;
}

.bpdf-pill[aria-pressed="true"] {
  border-color: var(--ft-accent);
  background: var(--ft-accent-soft);
  color: var(--ft-ink);
  font-weight: 650;
}

.bpdf-preview {
  margin: 0;
}

.bpdf-frame {
  position: relative;
  display: grid;
  place-items: center;
  height: 23.5rem;
  max-width: 100%;
  padding: var(--ft-space-3);
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius);
  background: var(--ft-surface-2, var(--ft-surface));
  overflow: hidden;
  box-sizing: border-box;
}

.bpdf-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

.bpdf-stage canvas {
  display: block;
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 841.89 / 595.28;
  border-radius: 3px;
  box-shadow: 0 6px 22px rgba(15, 23, 32, 0.14);
  background: #ffffff;
}

.bpdf-busy {
  position: absolute;
  inset: auto var(--ft-space-3) var(--ft-space-3);
  margin: 0;
  padding: 0.45rem 0.75rem;
  border-radius: var(--ft-radius);
  background: var(--ft-surface);
  border: 1px solid var(--ft-line);
  color: var(--ft-ink);
  font-size: var(--ft-text-sm);
  font-weight: 600;
  text-align: center;
}

/* Sheet-by-Sheet Front & Back Fold Diagram */
.bpdf-diagram-card,
.bpdf-checkcard {
  display: grid;
  gap: var(--ft-space-3);
  padding: var(--ft-space-3);
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius);
  background: var(--ft-surface);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.bpdf-card-head {
  display: grid;
  gap: 0.25rem;
}

.bpdf-card-title {
  margin: 0;
  color: var(--ft-ink);
  font-size: var(--ft-text-md);
  font-weight: 650;
}

.bpdf-card-sub {
  margin: 0;
  color: var(--ft-ink-2);
  font-size: var(--ft-text-sm);
}

.bpdf-diagram-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ft-space-2);
  max-height: 18.5rem;
  overflow-y: auto;
  padding-right: 0.15rem;
}

.bpdf-sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius);
  background: var(--ft-surface-2, var(--ft-surface));
  min-width: 0;
}

.bpdf-sheet__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 0.5rem;
  font-size: var(--ft-text-sm);
  color: var(--ft-ink-2);
}

.bpdf-sheet__title {
  color: var(--ft-ink);
  font-weight: 650;
}

.bpdf-sheet__sides {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  min-width: 0;
}

.bpdf-sidebtn {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.25rem;
  min-width: 44px;
  min-height: 48px;
  padding: 0.42rem 0.55rem;
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius);
  background: var(--ft-surface);
  color: var(--ft-ink);
  font: inherit;
  font-size: max(16px, var(--ft-text-sm));
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}

.bpdf-sidebtn:hover {
  border-color: var(--ft-accent);
}

.bpdf-sidebtn[aria-pressed="true"] {
  border-color: var(--ft-accent);
  background: var(--ft-accent-soft);
}

.bpdf-sidebtn__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--ft-ink-2);
}

.bpdf-sidebtn__role {
  font-weight: 650;
  color: var(--ft-ink);
}

.bpdf-sidebtn__spread {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ft-ink);
  overflow-wrap: anywhere;
}

.bpdf-sidebtn__fold {
  color: var(--ft-accent);
  font-weight: 700;
}

.bpdf-blank {
  color: var(--ft-ink-2);
  font-weight: 500;
  font-style: italic;
}

.bpdf-stats {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), minmax(0, 1fr)));
}

.bpdf-after-example {
  margin-top: var(--ft-space-3);
}

.ft-status {
  min-height: 1.35rem;
}

@media (max-width: 580px) {
  .bpdf-sheet__sides {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .bpdf-frame {
    height: 16.5rem;
    padding: var(--ft-space-2);
  }
}
