/* Preview tab. Tokens, font and buttons live in theme.css. */
* { box-sizing: border-box; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 700; font-size: 18px; letter-spacing: -.02em; color: var(--text); white-space: nowrap; }
.brand img { border-radius: 7px; flex: none; }
.brand span { overflow: hidden; text-overflow: ellipsis; }
.brand em { font-style: normal; color: var(--highlight); }
.tools { display: flex; align-items: center; gap: 10px; flex: none; }
#print, #download { min-width: 170px; } /* same size side by side */
/* zoom control: one compact group */
.zoom {
  display: flex; align-items: center; height: 40px; padding: 3px; gap: 2px;
  background: var(--surface); border-radius: var(--radius);
}
.zbtn, .ztext {
  height: 34px; border: 0; border-radius: 7px; background: none; color: var(--text); cursor: pointer;
  font: 600 14px var(--font);
}
.zbtn { width: 32px; font-size: 18px; line-height: 1; }
.ztext { padding: 0 10px; font-size: 12.5px; color: var(--muted); }
.zbtn:hover, .ztext:hover { background: var(--card); }
.zbtn:disabled { color: var(--line); cursor: default; background: none; }
.ztext[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: var(--shadow-thumb); }
.zlabel { min-width: 46px; text-align: center; font: 600 12.5px var(--font); font-variant-numeric: tabular-nums; }
/* Settings: rightmost and distinct — accent outline, tinted */
.btn.settings {
  border: 1.5px solid var(--accent); color: var(--accent); background: var(--accent-soft);
}
.btn.settings:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.settings[hidden] { display: none; }

.workspace {
  min-height: 0; min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr); /* never let a zoomed page widen the layout */
  justify-items: center; gap: 14px; padding: 20px 24px 16px;
}
.pill {
  margin: 0; max-width: 100%; box-sizing: border-box;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 16px; border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--card); font-size: 12.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pill strong { color: var(--text); font-weight: 600; }
.pill strong::after { content: "|"; margin-left: 10px; color: var(--line); font-weight: 400; }
#preview-info { overflow: hidden; text-overflow: ellipsis; }

/* the page sits on a light-blue "desk" card */
.desk {
  width: 100%; height: 100%; min-height: 0; min-width: 0; overflow: hidden;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px var(--line);
}
.stage { /* scroll container */
  width: 100%; height: 100%; overflow: auto; overscroll-behavior: contain;
}
.stage.fitting { overflow: hidden; }
.stage.pannable { cursor: grab; }
.stage.dragging { cursor: grabbing; user-select: none; }
.canvas { /* grows with the page; margin:auto on the page centres it while it fits,
             and lets it scroll fully (left/top included) once it is bigger */
  --pad: 28px;
  display: flex; box-sizing: border-box;
  min-width: 100%; min-height: 100%; width: max-content; height: max-content;
  padding: var(--pad);
}
.stage svg {
  display: block; margin: auto; flex: none; background: #fff;
  box-shadow: var(--shadow-page);
}
.hint { text-align: center; font-size: 12.5px; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  margin: 0; padding: 10px 16px; border-radius: var(--radius);
  background: var(--accent-hover); color: #fff; font-size: 13px; font-weight: 500;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
}
.toast:empty { display: none; }

@media (max-width: 1080px) {
  .brand span { display: none; }
  .tools .btn svg { display: none; }
  #print, #download { min-width: 124px; }
}
@media (max-width: 820px) {
  .brand span, .hint, .ztext .long { display: none; }
  .bar { padding: 10px 14px; }
  .workspace { padding: 12px; }
}
@media (max-width: 640px) {
  #zoom-100 { display: none; }
}
@media (max-width: 560px) {
  .brand { display: none; }
  .tools { gap: 6px; }
  .btn { padding: 0 10px; }
  .btn svg { display: none; }
  .ztext { display: none; }
  #print, #download { min-width: 0; width: 112px; padding: 0 6px; font-size: 13px; white-space: nowrap; }
}
