/* ══════════════════════════════════════════════════════════════════════════════
   PDF MARKUP (/tools/sign-pdfs/): the Hub tool (PDF brief Appendix C) re-skinned with the site tokens per §4.3.
   Items use the same font files the PDF gets, with kerning and ligatures off because pdf-lib applies neither:
   what is on screen is what is written. The @font-face URLs below are the same URLs app.js fetches
   (new URL('./fonts/…', import.meta.url) from /tools/sign-pdfs/app.js); build.py prefixes them for the /1 /2 previews.
   UNCHANGED from the Hub, on purpose: @font-face, .pdfm-font-*, .pdfm-ink-*, the .pdfm-item geometry and font
   rules, the white page. Colour pairs are measured in designs/d1/palette.py (tools/contrast.py). Fallbacks keep it
   working under Design 2, which lacks --tile, --teal-a and --r-lg.
   ══════════════════════════════════════════════════════════════════════════════ */

@font-face { font-family: 'PdfmLato'; src: url('/tools/sign-pdfs/fonts/Lato-Regular.ttf') format('truetype'); font-display: block; }
@font-face { font-family: 'PdfmGreatVibes'; src: url('/tools/sign-pdfs/fonts/GreatVibes-Regular.ttf') format('truetype'); font-display: block; }
@font-face { font-family: 'PdfmAllura'; src: url('/tools/sign-pdfs/fonts/Allura-Regular.ttf') format('truetype'); font-display: block; }
@font-face { font-family: 'PdfmSacramento'; src: url('/tools/sign-pdfs/fonts/Sacramento-Regular.ttf') format('truetype'); font-display: block; }
@font-face { font-family: 'PdfmAlexBrush'; src: url('/tools/sign-pdfs/fonts/AlexBrush-Regular.ttf') format('truetype'); font-display: block; }
@font-face { font-family: 'PdfmHomemade'; src: url('/tools/sign-pdfs/fonts/HomemadeApple-Regular.ttf') format('truetype'); font-display: block; }
@font-face { font-family: 'PdfmPinyon'; src: url('/tools/sign-pdfs/fonts/PinyonScript-Regular.ttf') format('truetype'); font-display: block; }
@font-face { font-family: 'PdfmDelafield'; src: url('/tools/sign-pdfs/fonts/MrsSaintDelafield-Regular.ttf') format('truetype'); font-display: block; }
@font-face { font-family: 'PdfmAurore'; src: url('/tools/sign-pdfs/fonts/LaBelleAurore.ttf') format('truetype'); font-display: block; }
.pdfm-font-lato { font-family: 'PdfmLato', sans-serif; }
.pdfm-font-greatvibes { font-family: 'PdfmGreatVibes', cursive; }
.pdfm-font-allura { font-family: 'PdfmAllura', cursive; }
.pdfm-font-sacramento { font-family: 'PdfmSacramento', cursive; }
.pdfm-font-alexbrush { font-family: 'PdfmAlexBrush', cursive; }
.pdfm-font-homemade { font-family: 'PdfmHomemade', cursive; }
.pdfm-font-pinyon { font-family: 'PdfmPinyon', cursive; }
.pdfm-font-delafield { font-family: 'PdfmDelafield', cursive; }
.pdfm-font-aurore { font-family: 'PdfmAurore', cursive; }
.pdfm-ink-black { color: #121217; }   /* = INK.black in app.js */
.pdfm-ink-blue { color: #1a3d9c; }    /* = INK.blue */
.pdfm-ink-red { color: #bf1a1a; }     /* = INK.red */
.pdfm-ink-green { color: #127a33; }   /* = INK.green */

.sec-tool { padding-top: clamp(.5rem, 2vw, 1.25rem); }
.pdfm { position: relative; z-index: 1; width: 100%; margin: 0 auto; padding: 12px 0 56px; }
.pdfm-drop[hidden], .pdfm-work[hidden], .pdfm-group[hidden] { display: none; }

/* drop zone */
.pdfm-drop { max-width: 825px; margin: 24px auto 40px; padding: 75px 43px; text-align: center; color: var(--teal);
  background: linear-gradient(180deg, var(--surface), var(--tile, var(--surface))); border: 2px dashed rgba(var(--teal-a, 0,185,197), .35);
  border-radius: var(--r-lg, 22px); cursor: pointer; transition: border-color .15s, background .15s; }
.pdfm-drop:hover, .pdfm-drop:focus-visible, .pdfm-drop.is-over { border-color: var(--teal);
  background: linear-gradient(rgba(var(--teal-a, 0,185,197), .07), rgba(var(--teal-a, 0,185,197), .07)), linear-gradient(180deg, var(--surface), var(--tile, var(--surface))); outline: none; }
.pdfm-drop:focus-visible { box-shadow: 0 0 0 3px var(--orange); }
.pdfm-drop svg { display: inline-block; }
.pdfm-drop-title { margin-top: 18px; font-family: var(--head); font-size: 1.8125rem; font-weight: 800; line-height: 1.2; color: var(--text); }
.pdfm-drop-sub { margin-top: 8px; font-size: 1.1875rem; color: var(--muted); }
.pdfm-link { color: var(--teal-hi); text-decoration: underline; text-underline-offset: 3px; }
.pdfm-drop-note { max-width: 36rem; margin: 29px auto 0; font-size: 1rem; color: var(--muted); }

/* toolbar: sticks just under the site's sticky header (73px) */
.pdfm-toolbar { position: sticky; top: 81px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 10px 12px;
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--r, 14px); box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.pdfm-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pdfm-actions { margin-left: auto; }
.pdfm-tool, .pdfm-btn, .pdfm-icon-btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; font-family: var(--head); font-size: 1.0625rem;
  font-weight: 800; line-height: 1.2; color: var(--text); background: transparent; border: 2px solid var(--line); border-radius: 999px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s; }
.pdfm-tool:hover, .pdfm-btn:hover, .pdfm-icon-btn:hover { border-color: var(--teal); }
.pdfm-icon-btn { padding: 9px 13px; }
.pdfm-tool.active { border-color: var(--teal); color: var(--teal-hi); background: rgba(var(--teal-a, 0,185,197), .12); }
.pdfm-primary, .pdfm-primary:hover { color: var(--on-orange); background: var(--orange); border-color: var(--orange); }
.pdfm-primary:hover { background: var(--orange-hi); border-color: var(--orange-hi); }
.pdfm-btn:disabled { cursor: progress; }
.pdfm-danger:hover { color: var(--err); border-color: var(--err); }
.pdfm-swatch { width: 29px; height: 29px; padding: 0; border: 2px solid rgba(255,255,255,.25); border-radius: 50%; cursor: pointer; }
.pdfm-swatch-black { background: #121217; }
.pdfm-swatch-blue { background: #1a3d9c; }
.pdfm-swatch-red { background: #bf1a1a; }
.pdfm-swatch-green { background: #127a33; }
.pdfm-swatch[aria-pressed="true"] { outline: 2px solid var(--teal); outline-offset: 2px; }
.pdfm-filename { max-width: 345px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; color: var(--muted); }
.pdfm-hint { min-height: 24px; margin: 12px 4px 16px; font-size: 1.0625rem; color: var(--muted); }

/* pages: white, not re-skinned */
.pdfm-pages { display: flex; flex-direction: column; align-items: center; gap: 30px; }
.pdfm-page { position: relative; width: var(--w); height: var(--h); background: #fff; border-radius: 2px; box-shadow: 0 6px 28px rgba(0,0,0,.5); }
.pdfm-page canvas { display: block; width: 100%; height: 100%; }
.pdfm-layer { position: absolute; inset: 0; overflow: visible; }
.pdfm-pages.is-placing .pdfm-layer { cursor: crosshair; }
.pdfm-page-num { position: absolute; right: 0; bottom: -24px; font-size: .9375rem; line-height: 1.2; color: var(--muted); }

/* items: geometry and font rules exactly as the Hub (WYSIWYG, brief §6.3) */
.pdfm-item { position: absolute; left: var(--x); top: var(--y); font-size: var(--fs); line-height: var(--lh); white-space: pre; cursor: move; touch-action: none; user-select: none; -webkit-user-select: none; font-kerning: none; font-variant-ligatures: none; font-feature-settings: "kern" 0, "liga" 0, "clig" 0, "calt" 0; border-radius: 2px; }
.pdfm-item-body { min-width: 2px; min-height: var(--lh); margin: 0; padding: 0; outline: none; }
.pdfm-item:hover { outline: 1px dashed rgba(0,150,150,0.6); outline-offset: 3px; }
.pdfm-item.is-selected, .pdfm-item:focus-visible { outline: 1.5px solid var(--teal); outline-offset: 3px; }
.pdfm-item.is-editing, .pdfm-item.is-editing .pdfm-item-body { cursor: text; user-select: text; -webkit-user-select: text; }
.pdfm-item.is-bad { outline: 1.5px solid #e74c3c; outline-offset: 3px; }
/* handles: Hub sizes; colours changed only for contrast (dark glyph on teal, white on a deeper red) */
.pdfm-item-grip, .pdfm-item-del { display: none; position: absolute; top: -36px; width: 29px; height: 29px; padding: 0; font-family: var(--body); font-size: 19px; font-weight: 700; line-height: 29px; text-align: center; color: var(--on-teal, #04161a); background: var(--teal); border: none; border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
.pdfm-item-grip { left: -4px; cursor: move; }
.pdfm-item-grip::before { content: '\2725'; }
.pdfm-item-del { right: -4px; color: #fff; background: #b3261e; cursor: pointer; }
.pdfm-item.is-selected .pdfm-item-grip, .pdfm-item.is-selected .pdfm-item-del { display: block; }

/* toast (site-banner.js): fixed, top centre, under the sticky header */
.pdfm-banner { position: fixed; left: 50%; top: 92px; z-index: 60; transform: translateX(-50%); width: max-content; max-width: min(640px, calc(100vw - 32px));
  padding: .8rem 1.1rem; font-weight: 700; line-height: 1.4; color: var(--teal); background: var(--surface); border: 1px solid var(--teal);
  border-left-width: 4px; border-radius: var(--r, 14px); box-shadow: 0 14px 40px rgba(0,0,0,.45); display: none; }
.pdfm-banner.is-shown { display: block; }
.pdfm-banner-success { color: var(--ok); border-color: var(--ok); }
.pdfm-banner-error { color: var(--err); border-color: var(--err); }

/* signature dialog */
.pdfm-dialog { width: min(745px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 32px; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-top: 4px solid var(--teal); border-radius: var(--r-lg, 22px); box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.pdfm-dialog::backdrop { background: rgba(2,10,12,.78); }
.pdfm-dialog h2 { margin: 0 0 4px; font-family: var(--head); font-weight: 800; font-size: 1.6875rem; }
.pdfm-label { display: block; margin: 18px 0 8px; font: 600 .9375rem/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pdfm-input { width: 100%; padding: 14px 16px; font-family: var(--body); font-size: 1.25rem; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; outline: none; }
.pdfm-input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(var(--teal-a, 0,185,197), .3); }
.pdfm-styles { display: grid; gap: 8px; max-height: 46vh; overflow-y: auto; }
.pdfm-style { display: flex; align-items: center; gap: 14px; padding: 10px 18px; background: #fbfbfd; border: 2px solid transparent; border-radius: 10px; cursor: pointer; }
.pdfm-style:has(input:checked) { border-color: var(--teal); }
.pdfm-style input { flex: none; accent-color: #007f87; }
.pdfm-style-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 40px; line-height: 1.35; color: #1a3d9c; font-kerning: none; font-variant-ligatures: none; font-feature-settings: "kern" 0, "liga" 0, "clig" 0, "calt" 0; }
.pdfm-style-name { flex: none; max-width: 40%; font-size: .9375rem; color: #5e6373; text-align: right; }
/* a style that cannot write the name: dashed red edge, name in dark red (the Hub dimmed it to 55%, which fails contrast) */
.pdfm-style.is-bad { border-style: dashed; border-color: #b3261e; }
.pdfm-style.is-bad .pdfm-style-name { color: #a11d16; font-weight: 700; }
.pdfm-dialog-note { margin-top: 14px; font-size: 1rem; color: var(--muted); }
.pdfm-dialog-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }

@media (max-width: 640px) {
  .pdfm { padding: 8px 0 48px; }   /* the side padding is the site gutter: 16px at phone widths */
  .pdfm-drop { margin: 16px auto; padding: 53px 24px; }
  .pdfm-actions { margin-left: 0; }
  .pdfm-filename { display: none; }
  .pdfm-dialog { padding: 20px 16px; }
  .pdfm-style { padding: 8px 12px; gap: 10px; }
}
