/* PDF Page Numbers and PDF Watermark (pdf-stamp.js). Loaded after tool.css and pdf-engine.css. */

/* the preview stays in view while the settings scroll */
.ps-main .pp-side { position: static; }
.ps-view { position: sticky; top: 0; }
.ps-area { display: grid; gap: 10px; margin-top: 12px; }
.ps-stage { position: relative; display: grid; place-items: center; min-height: 240px; padding: 14px; border-radius: 12px; background: var(--stage); touch-action: pan-y pinch-zoom; }
.ps-stage:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.ps-stage canvas { display: block; max-width: 100%; background: #fff; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35); }
.ps-stage.is-loading canvas { opacity: 0.55; }
.ps-stage .tk-note { position: absolute; inset-inline: 14px; bottom: 8px; margin: 0; text-align: center; }
.ps-nav { display: flex; align-items: center; justify-content: center; gap: 10px; }
.ps-nav .tk-btn { width: 36px; padding: 0; }
[dir="rtl"] .ps-nav svg { transform: scaleX(-1); }
.ps-navl { min-width: 9em; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.ps-stagenote { margin: 0; text-align: center; }
.ps-stagenote:empty { display: none; }

/* the position: a small page with a spot for each place */
.ps-pos { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: auto minmax(26px, 1fr) auto; width: 150px; aspect-ratio: 0.72; padding: 5px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--panel-2); }
.ps-pos.is-9 { grid-template-rows: repeat(3, 1fr); width: 128px; }
.ps-lines { grid-column: 1 / -1; grid-row: 2; align-self: center; height: 60%; margin: 0 14px; background: repeating-linear-gradient(to bottom, var(--line-strong) 0 2px, transparent 2px 9px); opacity: 0.7; }
.ps-pos.is-tile .ps-cell i { background: var(--accent); opacity: 0.45; border-color: transparent; }
.ps-cell { position: relative; display: grid; place-items: center; min-height: 34px; border-radius: 5px; cursor: pointer; }
.ps-cell[data-u="l"] { justify-items: start; padding-left: 3px; }
.ps-cell[data-u="r"] { justify-items: end; padding-right: 3px; }
.ps-cell[data-v="t"] { align-items: start; padding-top: 3px; }
.ps-cell[data-v="b"] { align-items: end; padding-bottom: 3px; }
.ps-cell input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ps-cell i { width: 24px; height: 9px; border: 1.5px solid var(--text-3); border-radius: 3px; pointer-events: none; }
.ps-cell:hover i { border-color: var(--text); }
.ps-cell:has(input:checked) i { background: var(--accent); border-color: var(--accent); }
.ps-cell:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.ps-posrow { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.ps-posrow .pp-radio { flex: 1 1 150px; }
.ps-posname { color: var(--text-2); font-size: 12.5px; }

/* two fields side by side */
.ps-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: end; }
.ps-two-r { grid-template-columns: 1fr 1fr; }
.ps-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ps-chips .tk-btn { font-variant-numeric: tabular-nums; }
.ps-color { width: 100%; height: 34px; padding: 2px 3px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel-2); cursor: pointer; }
.ps-color::-webkit-color-swatch-wrapper { padding: 0; }
.ps-color::-webkit-color-swatch { border: 0; border-radius: 5px; }
.ps-color::-moz-color-swatch { border: 0; border-radius: 5px; }
.ps-warn { margin: 0; color: var(--msg-warn); }
.ps-warn[hidden] { display: none; }
.ps-deg { display: flex; flex-wrap: wrap; gap: 6px; }
.ps-deg .tk-btn { min-width: 46px; font-variant-numeric: tabular-nums; }
.ps-pic { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 6px 6px 10px; border-radius: 9px; background: var(--panel-2); }
[dir="rtl"] .ps-pic { padding: 6px 10px 6px 6px; }
.ps-picname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.ps-group { display: grid; gap: 14px; }
.ps-group[hidden] { display: none; }
#notes { display: grid; gap: 8px; }
#notes[hidden] { display: none; }
#notes .tk-msg { margin: 0; }

@media (max-width: 900px) {
  .ps-view { position: static; }
}
@media (max-width: 520px) {
  .ps-stage { min-height: 200px; padding: 10px; }
}
@media (forced-colors: active) {
  .ps-cell:has(input:checked) i { background: Highlight; border-color: Highlight; }
  .ps-cell i { border-color: CanvasText; }
}
.ps-lab { color: var(--text-2); font-size: 13px; }
