/* Markdown to PDF tool: page-specific styles on top of tools/_shared/tools.css. */

/* options row under the main toolbar */
.pdf-opts { gap: 10px 16px; }
.pdf-field { display: inline-flex; align-items: center; gap: 7px; font-family: var(--disp); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--sub); }
.pdf-field .tool-select { text-transform: none; letter-spacing: 0; height: 36px; font-size: 14px; }
.pdf-opts .tool-opt { font-size: 14px; }

/* wider preview pane: pages are wider than text */
.pdf-tool .converter-panes { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
.pdf-tool .pane { height: 640px; }
.pdf-tool .pane.preview .pane-head { justify-content: space-between; }
#pdf-count { font-family: var(--body); font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--sub); }

/* the paginated preview: sheets on a desk, scaled to fit the pane */
#pdf-pages { flex: 1; overflow: auto; background: #e9eef4; padding: 16px 12px 4px; transition: opacity .15s; }
#pdf-pages.is-busy { opacity: .6; }
#pdf-pages .md-empty { margin-top: 32px; }
#pdf-pages .pagedjs_pages { zoom: var(--pdf-zoom, 1); display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 0 auto; }
#pdf-pages .pagedjs_page { background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .1), 0 10px 28px rgba(15, 23, 42, .08); margin: 0 auto 16px; }

/* where the next preview is laid out before it replaces the visible one.
   fixed, not absolute: Paged.js measures with getBoundingClientRect and caches
   each page box, so the staging area must not move when the page scrolls. */
.pdf-staging { position: fixed; left: -20000px; top: 0; visibility: hidden; pointer-events: none; }

.pdf-hint { font-size: 14px; color: var(--sub); margin: 10px 4px 0; }
.pdf-hint b { color: var(--mut); font-weight: 600; }

@media (max-width: 640px) {
  .pdf-tool .converter-panes { grid-template-columns: 1fr; }
  .pdf-tool .pane { height: 420px; }
  .pdf-opts .pdf-field { flex: 1 1 calc(50% - 16px); justify-content: space-between; }
  .pdf-opts .pdf-field .tool-select { flex: 1; min-width: 0; max-width: 62%; }
}

/* ── printing: only the paginated pages reach the printer / Save as PDF ──
   Works for the Save as PDF button and for Ctrl/Cmd+P. Paged.js adds its own
   print rules (@page size + zero margin, one sheet per page box). */
@media print {
  body > *:not(main) { display: none !important; }
  main.tool-main { max-width: none; padding: 0; margin: 0; }
  main.tool-main > *:not(.converter) { display: none !important; }
  .converter { margin: 0; }
  .converter > *:not(.converter-panes) { display: none !important; }
  .converter-panes { display: block; }
  .converter-panes > .pane:not(.preview) { display: none !important; }
  .pane.preview { display: block; height: auto; border: 0; border-radius: 0; overflow: visible; background: none; }
  .pane.preview > .pane-head { display: none !important; }
  #pdf-pages { overflow: visible; padding: 0; background: none; opacity: 1 !important; }
  #pdf-pages .md-empty { display: none; }
  #pdf-pages .pagedjs_pages { zoom: 1 !important; display: block; width: auto; margin: 0; }
  #pdf-pages .pagedjs_page { margin: 0 !important; box-shadow: none !important; }
}

/* ── Answer-first block, platform cards, troubleshooting (content below the tool) ── */
.tool-section.pdf-answer { max-width: 860px; margin: 56px auto 0; padding: 30px 34px 26px; background: #fff;
  border: 1px solid var(--bd); border-left: 4px solid var(--brd); border-radius: 16px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.pdf-answer h2 { text-align: left; font-size: 26px; margin: 0; }
.pdf-answer .lead { text-align: left; max-width: none; margin: 12px 0 0; }
.pdf-steps { list-style: none; counter-reset: pdfstep; margin: 22px 0 0; padding: 0; display: grid; gap: 12px; }
.pdf-steps li { counter-increment: pdfstep; position: relative; padding-left: 42px; min-height: 28px; line-height: 28px;
  color: var(--fg); font-size: 16px; }
.pdf-steps li::before { content: counter(pdfstep); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--brs, #e0f7fa); color: var(--brd); font-family: var(--disp); font-weight: 800; font-size: 14px; text-align: center; line-height: 28px; }
.pdf-byline { margin: 22px 0 0; padding-top: 14px; border-top: 1px solid var(--bd); font-size: 13.5px; color: var(--sub); }

.pdf-plat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 34px; }
.pdf-plat-card { border: 1px solid var(--bd); border-radius: 14px; padding: 22px 24px 8px; background: #fff; }
.pdf-plat-card h3 { display: flex; align-items: center; gap: 10px; font-family: var(--disp); font-size: 18px; font-weight: 800; margin: 0 0 14px; }
.pdf-plat-card h3 svg { width: 22px; height: 22px; color: var(--brd); flex: none; }
.pdf-plat-card .tool-list { margin: 0; max-width: none; }
.pdf-plat-card .tool-list li { font-size: 15px; line-height: 1.65; margin-bottom: 12px; }
.pdf-plat-card .tool-list li strong { color: var(--fg); }
.pdf-plat-card code { font-size: .88em; white-space: nowrap; }
.pdf-plat-card code.wrap { white-space: normal; word-break: break-word; }

.fidelity.pdf-trouble td:first-child { width: 32%; font-weight: 600; color: var(--fg); }

@media (max-width: 760px) {
  .tool-section.pdf-answer { margin: 40px 16px 0; padding: 22px 20px 18px; }
  .pdf-answer h2 { font-size: 22px; }
  .pdf-plat-grid { grid-template-columns: 1fr; }
  .pdf-plat-card code { white-space: normal; word-break: break-word; }
}
.pdf-answer code, .pdf-plat-card code, .pdf-trouble code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; color: var(--fg);
  background: var(--bg2); border: 1px solid var(--bd); border-radius: 5px; padding: 1px 5px; }
