/* PDF viewer filling the window: the separate PDF tab (?view=pdf) and the toolbar's fullscreen button.
   In the tab the rest of the output panel stays in the page (its scripts use it), covered by the viewer;
   with no PDF yet the viewer is hidden and the panel shows the pending state as before. */
body.page-pdf-tab:has(.pdf-viewer:not([hidden])) { overflow:hidden; }
.page-pdf-tab .pdf-viewer:not([hidden]),
.pdf-viewer:fullscreen { position:fixed; inset:0; z-index:var(--z-dropdown); display:flex; flex-direction:column; margin:0; border:0; border-radius:0; background:var(--color-neutral-250); }
.page-pdf-tab .pdf-viewer .pdf-viewer__body,
.pdf-viewer:fullscreen .pdf-viewer__body { flex:1 1 auto; min-height:0; }
.page-pdf-tab .pdf-viewer .pdf-viewer__pages,
.pdf-viewer:fullscreen .pdf-viewer__pages { height:auto; resize:none; }
.page-pdf-tab .pdf-viewer__toolbar,
.pdf-viewer:fullscreen .pdf-viewer__toolbar { font-size:var(--text-12); }

/* PDF viewer tools (latex-pdf-viewer.js): side panel, search, ⋯ menu, two pages, presentation, print. */
.pdf-viewer [hidden] { display:none!important; }
.pdf-viewer__body { position:relative; display:flex; container-type:inline-size; }
.pdf-viewer__body .pdf-viewer__pages { flex:1 1 auto; min-width:0; }
.pdf-viewer__sidebar { flex:0 0 168px; width:168px; min-width:0; overflow:hidden; display:flex; flex-direction:column; min-height:0; background:var(--color-earth-150); border-right:1px solid var(--color-earth-650); }
@container (max-width: 560px) {
  /* narrow editor panel: the side panel floats over the pages instead of squeezing them */
  .pdf-viewer__sidebar { position:absolute; inset:0 auto 0 0; z-index:var(--z-overlay); width:168px; box-shadow:4px 0 16px var(--alpha-shadow-18); }
}
.pdf-viewer__tabs { display:flex; gap:2px; padding:6px; border-bottom:1px solid var(--color-earth-650); }
.pdf-viewer__tabs button { flex:1; padding:4px 6px; border:1px solid transparent; border-radius:var(--radius-xs); background:transparent; color:var(--color-neutral-900); font-family:inherit; font-size:var(--text-11); font-weight:600; line-height:1.2; cursor:pointer; }
.pdf-viewer__tabs [aria-selected="true"] { background:var(--color-neutral-50); border-color:var(--color-earth-750); color:var(--color-blue-700); }
.pdf-viewer__thumbs,
.pdf-viewer__outline { position:relative; flex:1 1 auto; min-height:0; overflow:auto; padding:8px; }
.pdf-viewer__thumbs { display:grid; gap:10px; justify-items:center; align-content:start; }
.pdf-viewer__thumb { display:grid; gap:3px; justify-items:center; width:100%; padding:4px; border:2px solid transparent; border-radius:var(--radius-sm); background:transparent; color:var(--color-neutral-900); font-family:inherit; font-size:var(--text-11); line-height:1; cursor:pointer; }
.pdf-viewer__thumb::before { content:""; display:block; width:112px; aspect-ratio:var(--thumb-ratio, 612 / 792); background:var(--color-neutral-50); box-shadow:0 1px 3px var(--alpha-shadow-20); }
.pdf-viewer__thumb:has(canvas)::before { display:none; }
.pdf-viewer__thumb canvas { display:block; width:112px; height:auto; background:var(--color-neutral-50); box-shadow:0 1px 3px var(--alpha-shadow-20); }
.pdf-viewer__thumb:hover { background:var(--color-earth-400); }
.pdf-viewer__thumb.is-current { border-color:var(--primary); color:var(--color-blue-700); font-weight:700; }
.pdf-viewer__outline ul { margin:0; padding:0 0 0 10px; list-style:none; }
.pdf-viewer__outline > ul { padding-left:0; }
.pdf-viewer__outline button { display:block; width:100%; padding:4px 6px; border:0; border-radius:var(--radius-xs); background:transparent; color:var(--color-neutral-950); font-family:inherit; font-size:var(--text-12); line-height:1.35; text-align:left; cursor:pointer; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pdf-viewer__outline button:hover,
.pdf-viewer__outline button:focus-visible { background:var(--color-earth-400); }
.pdf-viewer__empty { margin:4px; color:var(--color-neutral-800); font-size:var(--text-12); line-height:1.45; }
.pdf-viewer__searchbar { display:flex; align-items:center; gap:5px; padding:5px 8px; background:var(--color-earth-150); border-bottom:1px solid var(--color-earth-650); font-size:var(--text-12); }
.pdf-viewer__searchbar input { flex:1 1 auto; min-width:0; height:28px; padding:0 8px; border:1px solid var(--color-earth-750); border-radius:var(--radius-xs); font-family:inherit; font-size:var(--text-12); }
.pdf-viewer__searchbar.is-empty input { border-color:var(--color-red-200); background:var(--color-red-50); }
.pdf-viewer__searchbar button { width:28px; height:28px; padding:0; color:var(--color-neutral-900); background:var(--color-neutral-50); border:1px solid var(--color-earth-750); border-radius:var(--radius-xs); font-family:inherit; font-size:var(--text-13); cursor:pointer; }
.pdf-viewer__search-count { color:var(--color-neutral-800); white-space:nowrap; }
.pdf-viewer__hit { position:absolute; z-index:var(--z-raised); background:var(--alpha-warning-45); border-radius:var(--radius-xs); mix-blend-mode:multiply; pointer-events:none; }
.pdf-viewer__hit.is-current { background:var(--alpha-danger-55); outline:2px solid var(--color-earth-850); }
.pdf-viewer__more { position:relative; display:inline-flex; }
.pdf-viewer__menu { position:absolute; top:calc(100% + 4px); right:0; z-index:var(--z-sticky); display:grid; min-width:190px; padding:5px; background:var(--color-neutral-50); border:1px solid var(--color-earth-750); border-radius:var(--radius); box-shadow:0 10px 28px var(--alpha-shadow-18); }
/* Doubled class: above the IDE toolbar rules (.pdf-viewer.pdf-viewer--ide .pdf-viewer__toolbar :is(button, a)). */

.pdf-viewer.pdf-viewer .pdf-viewer__toolbar .pdf-viewer__menu > :is(a, button):is(:hover, :focus-visible) { background:var(--color-earth-300); outline:none; }
.pdf-viewer__menu [aria-checked]::after { content:""; width:14px; text-align:center; }
.pdf-viewer__menu [aria-checked="true"]::after { content:"✓"; color:var(--primary); font-weight:700; }
.pdf-viewer__menu hr { width:100%; margin:4px 0; border:0; border-top:1px solid var(--color-earth-400); }
.pdf-viewer__pages.is-spread { display:flex; flex-wrap:wrap; justify-content:center; align-content:flex-start; gap:12px; }
.pdf-viewer__pages.is-spread .pdf-viewer__page { margin:0; }
.pdf-viewer.is-presenting { position:fixed; inset:0; z-index:var(--z-dropdown); display:flex; flex-direction:column; margin:0; border:0; border-radius:0; background:var(--color-neutral-1050); }
.pdf-viewer.is-presenting :is(.pdf-viewer__toolbar, .pdf-viewer__searchbar, .pdf-viewer__sidebar, .pdf-viewer__status) { display:none!important; }
.pdf-viewer.is-presenting .pdf-viewer__body { flex:1 1 auto; min-height:0; }
.pdf-viewer.is-presenting .pdf-viewer__pages { display:flex; align-items:center; justify-content:center; height:auto; padding:12px; overflow:hidden; background:var(--color-neutral-1050); resize:none; cursor:pointer; }
.pdf-viewer.is-presenting .pdf-viewer__page { display:none; margin:0; }
.pdf-viewer.is-presenting .pdf-viewer__page.is-shown { display:block; }
.pdf-viewer__present-hint { position:absolute; left:50%; bottom:10px; transform:translateX(-50%); padding:4px 12px; border-radius:var(--radius-pill); background:var(--alpha-shadow-55); color:var(--color-neutral-150); font-size:var(--text-12); pointer-events:none; }
.pdf-viewer__print-frame { position:fixed; right:0; bottom:0; width:1px; height:1px; border:0; opacity:0; pointer-events:none; }

/* Shared selectors and responsive variants, in original cascade order. */
.pdf-viewer__toolbar { display:flex; flex-wrap:wrap; align-items:center;   color:var(--color-neutral-900); background:var(--color-earth-150); border-bottom:1px solid var(--color-earth-650); font-size:var(--text-11); }

.pdf-viewer__toolbar button,
.pdf-viewer__toolbar a,
.pdf-viewer__toolbar select { padding:3px 6px; color:var(--color-neutral-900); background:white; border:1px solid var(--color-earth-750); border-radius:var(--radius-xs); font:inherit; font-weight:500; text-decoration:none; cursor:pointer; }

.pdf-viewer.pdf-viewer--ide .pdf-viewer__toolbar input[data-pdf-page],
.pdf-viewer.pdf-viewer--ide .pdf-viewer__toolbar select[data-pdf-zoom] {
  width:auto;
  margin:0;
  padding:3px 6px;
  font-size:var(--text-11);
  border-radius:var(--radius-xs);
}

.pdf-viewer__toolbar { gap:6px; padding:8px; }

.pdf-viewer__toolbar button,
.pdf-viewer__toolbar a,
.pdf-viewer__toolbar select {
  min-height:28px; min-width:28px; display:inline-flex; align-items:center; justify-content:center; margin:0;
}

.pdf-viewer.pdf-viewer--ide .pdf-viewer__toolbar input[data-pdf-page],
.pdf-viewer.pdf-viewer--ide .pdf-viewer__toolbar select[data-pdf-zoom] { min-height:28px; }

.pdf-viewer.pdf-viewer--ide .pdf-viewer__toolbar input[data-pdf-page] {
  display:inline-block;
  width:44px;
  padding:0 4px;
  font-size:var(--ctl-fs-sm);
  font-variant-numeric:tabular-nums;
  text-align:center;
  cursor:text;
}

.pdf-viewer.pdf-viewer--ide .pdf-viewer__toolbar select[data-pdf-zoom] {
  display:inline-block;
  width:auto;
  min-width:0;
  padding:0 4px 0 8px;
  font-size:var(--ctl-fs-sm);
  border-radius:var(--radius-sm);
}

.pdf-viewer.pdf-viewer .pdf-viewer__toolbar .pdf-viewer__menu > :is(a, button) { display:flex; align-items:center; justify-content:space-between; gap:10px; width:auto; height:auto; min-height:0; min-width:0; padding:7px 10px; border:0; border-radius:var(--radius-xs); background:transparent; color:var(--color-neutral-950); font-family:inherit; font-size:var(--text-12); font-weight:500; line-height:1.3; text-align:left; text-decoration:none; white-space:nowrap; box-shadow:none; cursor:pointer; }

@media (pointer: coarse) {
.pdf-viewer.pdf-viewer .pdf-viewer__toolbar .pdf-viewer__menu > :is(a, button) { min-height:40px; }
}
