/* PDF to Markdown converter. Builds on the Markdown to HTML tool styles in pages-base.css. */
.pdf-md-drop {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 16px; min-height: 115px; margin-top: 12px; padding: 16px 20px;
  border: 2px dashed var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--ink-2);
  text-align: left; cursor: pointer; transition: border-color .15s, background .15s;
}
.pdf-md-drop:hover, .pdf-md-drop.is-dragging { border-color: var(--link); }
.pdf-md-drop.is-dragging { background: color-mix(in oklab, var(--link) 7%, var(--surface)); }
.pdf-md-drop:focus-within { outline: 3px solid rgb(0 102 204 / .14); border-color: var(--link); }
.is-busy .pdf-md-drop { opacity: .55; pointer-events: none; }
.pdf-md-drop svg { flex: none; width: 36px; height: 36px; color: var(--ink-soft); }
.pdf-md-drop strong { display: block; color: var(--ink); font-size: 17px; font-weight: 600; }
.pdf-md-drop small { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 13px; }
.pdf-md-drop .md-html-button { flex: none; pointer-events: none; }
.pdf-md-file { position: absolute; width: 1px; height: 1px; opacity: 0; }
.pdf-md-select { margin-left: 6px; padding: 3px 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); color: var(--ink); font: inherit; font-size: 13px; }
.pdf-md-tool .md-html-options { padding: 16px 18px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); }
.pdf-md-page .footnotes-lead { text-wrap: balance; }
.pdf-md-lead-2 { margin-top: 14px; font-size: 17px; }
.pdf-md-brand { white-space: nowrap; }
.pdf-md-brand img { display: inline-block; width: 1.3em; height: 1.3em; margin-right: .3em; border-radius: .3em; vertical-align: -.3em; }
main.pdf-md-page { padding-bottom: 0; }
.pdf-md-page ~ #download { margin-top: 90px; scroll-margin-top: 112px; }
.pdf-md-page ~ #download > p:first-of-type { max-width: 780px; }
.pdf-md-option-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; margin-top: 4px; }

.pdf-md-progress { margin-top: 18px; }
.pdf-md-progress[hidden] { display: none; }
.pdf-md-progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; color: var(--ink-2); font-size: 14px; }
.pdf-md-progress-pct { margin-left: auto; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.pdf-md-spinner {
  flex: none; width: 15px; height: 15px; border: 2px solid var(--line-strong); border-top-color: var(--link); border-radius: 50%;
  animation: pdf-md-spin .8s linear infinite;
}
@keyframes pdf-md-spin { to { transform: rotate(360deg); } }
.pdf-md-bar { height: 6px; overflow: hidden; border-radius: 3px; background: var(--line-strong); }
.pdf-md-bar-fill { width: 0; height: 100%; background: var(--link); transition: width .2s ease; }

#pdf-md-output, #pdf-md-preview { display: block; width: 100%; height: 520px; margin-top: 12px; border: 1px solid var(--line-strong); border-radius: 10px; }
#pdf-md-output { resize: vertical; padding: 13px; background: var(--cta-bg); color: var(--cta-ink); font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
#pdf-md-output:focus { border-color: var(--link); outline: 3px solid rgb(0 102 204 / .14); }
#pdf-md-preview { background: #fff; }
#pdf-md-output[hidden], #pdf-md-preview[hidden] { display: none; }
.pdf-md-status-error { color: #c4271b; }

/* extracted images */
.pdf-md-images { grid-column: 1 / -1; padding: 26px 28px 30px; border-top: 1px solid var(--line-strong); }
.pdf-md-images[hidden] { display: none; }
.pdf-md-images h2 { margin: 0; font-size: 19px; font-weight: 600; }
.pdf-md-images h2 span { color: var(--ink-soft); font-weight: 400; }
.pdf-md-images .url-link-help { margin: 6px 0 16px; }
.pdf-md-x { color: #d93025; font-weight: 700; }
.md-html-button-danger { border-color: #d93025; color: #d93025; }
.pdf-md-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.pdf-md-thumb { position: relative; margin: 0; padding: 6px; border: 2px solid var(--line-strong); border-radius: 10px; background: var(--bg); transition: border-color .15s; }
.pdf-md-thumb img { display: block; width: 100%; height: 130px; object-fit: contain; border-radius: 6px; background: #fff; }
.pdf-md-thumb figcaption { display: flex; justify-content: space-between; gap: 4px; margin-top: 6px; color: var(--ink-soft); font-size: 12px; }
.pdf-md-thumb figcaption span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-md-badge { position: absolute; top: 12px; left: 12px; padding: 1px 6px; border-radius: 4px; background: #fef3c7; color: #92400e; font-size: 11px; font-weight: 600; }
.pdf-md-remove {
  position: absolute; top: -10px; right: -10px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%;
  background: #d93025; color: #fff; cursor: pointer; font-size: 17px; line-height: 26px; opacity: 0; transition: opacity .15s;
}
.pdf-md-thumb:hover, .pdf-md-thumb:focus-within { border-color: #d93025; }
.pdf-md-thumb:hover .pdf-md-remove, .pdf-md-remove:focus-visible { opacity: 1; }
@media (hover: none) { .pdf-md-remove { opacity: 1; } }

/* what gets converted, below the options */
.pdf-md-about { margin-top: 26px; }
.pdf-md-about h2.table-panel-label { margin: 0 0 8px; color: var(--ink); font-size: 18px; font-weight: 600; letter-spacing: -.01em; text-transform: none; }
.pdf-md-about-grid { display: grid; gap: 5px; margin: 0; padding: 0 0 0 18px; color: var(--ink-soft); font-size: 13px; line-height: 1.45; }
.pdf-md-about-grid li { padding-left: 2px; }
.pdf-md-about-grid h3, .pdf-md-about-grid p { display: inline; margin: 0; font-size: inherit; }
.pdf-md-about-grid h3 { margin-right: .3em; color: var(--ink); font-weight: 600; }
.pdf-md-about-grid h3::after { content: ":"; }
.pdf-md-about code { padding: .05em .3em; border-radius: 5px; background: var(--surface); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .9em; }
.pdf-md-limits { margin: 12px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.45; }

@media (max-width: 700px) {
  .pdf-md-images { padding: 22px 20px; }
  #pdf-md-output, #pdf-md-preview { height: 340px; }
  .pdf-md-drop { min-height: 90px; flex-wrap: wrap; }
}

/* the source PDF, shown after a file was dropped */
.pdf-md-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.pdf-md-filename { overflow: hidden; color: var(--ink-2); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.pdf-md-sync-toggle { display: none; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; cursor: pointer; }
.has-pdf .pdf-md-sync-toggle { display: inline-flex; }
.has-pdf .pdf-md-drop { display: none; }
.pdf-md-viewer { display: none; }
.has-pdf .pdf-md-viewer {
  display: block; height: 520px; margin-top: 12px; padding: 12px; overflow: auto; overscroll-behavior: contain;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface);
}
.pdf-md-viewer:focus-visible { outline: 3px solid rgb(0 102 204 / .14); border-color: var(--link); }
.pdf-md-sheet { position: relative; width: 100%; margin: 0 auto 12px; overflow: hidden; border-radius: 3px; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .14); }
.pdf-md-sheet:last-child { margin-bottom: 0; }
.pdf-md-sheet canvas { display: block; width: 100%; height: 100%; }
@media (max-width: 700px) { .has-pdf .pdf-md-viewer { height: 340px; } }

/* OCR language picker with SVG flags (emoji flags do not render on Windows) */
.pdf-md-lang { position: relative; display: inline-block; margin-left: 6px; }
.pdf-md-lang-native { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.pdf-md-lang-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 8px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--bg); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer;
}
.pdf-md-lang-btn:focus-visible { outline: 3px solid rgb(0 102 204 / .14); border-color: var(--link); }
.pdf-md-lang-btn svg { width: 11px; height: 11px; color: var(--ink-soft); }
.pdf-md-lang img { display: block; flex: none; width: 18px; height: 13.5px; border-radius: 2px; object-fit: cover; box-shadow: 0 0 0 1px var(--line); }
.pdf-md-lang-menu {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; width: max-content; min-width: 100%; margin: 0; padding: 4px; list-style: none;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); box-shadow: 0 10px 28px rgb(0 0 0 / .14);
}
.pdf-md-lang-menu[hidden] { display: none; }
.pdf-md-lang-menu li { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 5px; color: var(--ink); font-size: 13px; white-space: nowrap; cursor: pointer; }
.pdf-md-lang-menu li.is-active { background: var(--surface); }
.pdf-md-lang-menu li[aria-selected="true"] { font-weight: 600; }

/* error report note */
.pdf-md-report {
  display: flex; align-items: flex-start; gap: 9px; margin: 14px 0 0; padding: 10px 13px; border: 1px solid color-mix(in oklab, #f59e0b 45%, var(--bg));
  border-radius: 9px; background: color-mix(in oklab, #f59e0b 12%, var(--bg)); color: var(--ink-2); font-size: 13px; line-height: 1.45;
}
.pdf-md-report svg { flex: none; width: 16px; height: 16px; margin-top: 1px; color: #d97706; }
.pdf-md-report a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
