/* The PDF converters and page tools: PDF to pictures, Word, Excel, PowerPoint,
   EPUB and text to PDF and back, and the page tools that crop, resize, grey,
   repair, describe and add fields to a PDF.

   Sixteen pages that each want the same few things: a box to drop a file on,
   a row of settings, a strip of page thumbnails, a line saying what was done
   and a list of what could not be. Written into each page they would be
   sixteen copies of one rule, so they live here, prefixed ck-, and use only
   the tokens theme.css defines, so a colourway reaches them without being
   told. */

.ck-drop {
  border: 2px dashed var(--rule-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-5);
  text-align: center;
  background: var(--paper-inset);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}
.ck-drop.is-over { border-color: var(--accent-strong); background: var(--paper-raised); }
.ck-drop strong { font-size: var(--text-md); }
.ck-drop span { font-size: var(--text-xs); color: var(--ink-soft); }
.ck-drop .btn-secondary { margin-top: var(--space-1); }
.ck-name { font: var(--text-xs) var(--font-mono); color: var(--ink-soft); margin: var(--space-3) 0 0; word-break: break-word; }

.ck-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 var(--space-4); margin: var(--space-4) 0 0; }
.ck-opts .field { margin-bottom: var(--space-3); }
.ck-opts.ck-opts-4 { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.ck-check { display: flex; gap: var(--space-3); align-items: flex-start; font-size: var(--text-sm); color: var(--ink-soft); padding: var(--space-2) 0; cursor: pointer; min-height: 44px; }
.ck-check input { margin-top: var(--space-1); flex: none; width: 18px; height: 18px; accent-color: var(--accent-strong); }
.ck-check b { color: var(--ink); font-weight: 600; }

.ck-fieldset { border: 0; padding: 0; margin: var(--space-3) 0 0; min-width: 0; }
.ck-fieldset legend { padding: 0; margin: 0 0 var(--space-1); }

.ck-done {
  font-size: var(--text-sm);
  line-height: var(--leading-prose);
  color: var(--ink);
  border: 1px solid var(--good);
  border-left: 4px solid var(--good);
  background: var(--good-soft);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-3);
}
.ck-note {
  font-size: var(--text-xs);
  line-height: var(--leading-prose);
  color: var(--ink-soft);
  border-left: 3px solid var(--rule-strong);
  padding: var(--space-1) 0 var(--space-1) var(--space-3);
  margin: var(--space-3) 0 0;
}
.ck-note.is-warn { border-left-color: var(--warn); }
.ck-list { margin: var(--space-2) 0 0 var(--space-5); font-size: var(--text-xs); color: var(--ink-soft); line-height: var(--leading-prose); }

.ck-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

.ck-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--space-3); margin: var(--space-4) 0 0; }
.ck-thumb { margin: 0; min-width: 0; text-align: center; }
.ck-thumb canvas, .ck-thumb img { display: block; max-width: 100%; height: auto; margin: 0 auto; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--paper-raised); }
.ck-thumb figcaption { font: var(--text-2xs) var(--font-mono); color: var(--ink-soft); margin-top: var(--space-1); word-break: break-word; }
.ck-thumb .btn-secondary { margin-top: var(--space-1); padding: var(--space-1) var(--space-2); font-size: var(--text-2xs); }

/* A page drawn large enough to work on: cropping, placing a field,
   choosing the corners of a scanned sheet. The box on top of it is drawn
   by the page's own script. */
.ck-stage { position: relative; display: inline-block; max-width: 100%; margin: var(--space-3) 0 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.ck-stage canvas { display: block; max-width: 100%; height: auto; border: 1px solid var(--rule); background: var(--paper-raised); }
/* A photo is as tall as the camera made it; it is kept within the screen. */
.ck-stage.is-photo canvas { max-height: 75vh; width: auto; }
.ck-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ck-shade { fill: black; fill-opacity: .4; fill-rule: evenodd; pointer-events: none; }
.ck-box { fill: none; stroke: var(--accent-strong); stroke-width: 1.5px; vector-effect: non-scaling-stroke; pointer-events: none; }
.ck-box.is-bad { stroke: var(--danger); }
.ck-handle { fill: var(--accent-strong); stroke: var(--paper-raised); stroke-width: 1.5px; vector-effect: non-scaling-stroke; pointer-events: none; }
.ck-grip { fill: transparent; cursor: grab; touch-action: none; }
.ck-grip:active { cursor: grabbing; }
.ck-field { fill: var(--accent-strong); fill-opacity: .12; stroke: var(--accent-strong); stroke-width: 1.5px; vector-effect: non-scaling-stroke; cursor: move; }
.ck-field.is-on { fill-opacity: .3; stroke-dasharray: 4 2; }
.ck-field-label { font-family: var(--font-sans); fill: var(--accent-strong); pointer-events: none; }
.ck-video { display: block; width: 100%; max-width: 720px; border-radius: var(--radius-md); background: var(--ink); margin: var(--space-3) 0 0; }
.ck-pager { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin: var(--space-3) 0 0; font-size: var(--text-xs); color: var(--ink-soft); }
.ck-pager .btn-secondary { min-width: 44px; min-height: 44px; }

.ck-text {
  width: 100%;
  min-height: 220px;
  font: var(--text-xs)/1.6 var(--font-mono);
  padding: var(--space-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--paper-inset);
  color: var(--ink);
  resize: vertical;
}

/* The copy of a document the browser lays out before it is written into a
   PDF. It is on the page, so the browser lays it out and measures it, and
   far off to the left, out of sight; it is not hidden, because a hidden
   element's text cannot be told from text the document itself hid. */
.ck-layout-host { position: absolute; left: -200000px; top: 0; pointer-events: none; }

/* MONOTONE's page before and after. */
.ck-compare { margin: var(--space-4) 0 0; }
.ck-compare:empty { display: none; }

/* COLUMNS' offer to read a scanned page. */
.ck-scan { margin: var(--space-3) 0 0; padding: var(--space-3) var(--space-4); border-left: 3px solid var(--warn); background: var(--paper-inset); border-radius: var(--radius-sm); }
.ck-scan p { margin: 0 0 var(--space-2); font-size: var(--text-sm); color: var(--ink-soft); line-height: var(--leading-prose); }
.ck-scan button { min-height: 44px; }

/* A locked PDF's password, asked for under the box it was dropped on. */
.ck-pass { margin: var(--space-3) 0 0; padding: var(--space-3) var(--space-4); border: 1px solid var(--rule-strong); border-left: 3px solid var(--warn); border-radius: var(--radius-md); background: var(--paper-raised); }
.ck-pass-head { margin: 0 0 var(--space-2); font-size: var(--text-sm); color: var(--ink); overflow-wrap: anywhere; }
.ck-pass-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.ck-pass-row input { flex: 1 1 180px; min-width: 0; min-height: 44px; }
.ck-pass-row button { min-height: 44px; }
.ck-pass-say { margin: var(--space-2) 0 0; font-size: var(--text-xs); color: var(--ink-soft); }

/* The pages, ticked to choose which are used. */
.ck-pick { display: flex; gap: var(--space-2); overflow-x: auto; margin: 0 0 var(--space-3); padding: var(--space-1) 0 var(--space-2); overscroll-behavior-x: contain; scrollbar-width: thin; }
.ck-pick-page { flex: none; width: 74px; display: flex; flex-direction: column; align-items: center; gap: var(--space-1); cursor: pointer; }
.ck-pick-page canvas { display: block; width: 72px; height: auto; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--paper-raised); }
.ck-pick-page:has(input:not(:checked)) canvas { opacity: .35; }
.ck-pick-page span { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; font: var(--text-2xs) var(--font-mono); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.ck-pick-page input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-strong); }

@media (max-width: 600px) {
  .ck-drop { padding: var(--space-5) var(--space-4); }
  .ck-thumbs { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .ck-thumb .btn-secondary { min-height: 44px; }
}
