/* The free "Sign a PDF" tool. Everything here is client-side; the page
   promises that the file never leaves the device. */

.sign-head { padding-block: 56px 60px; display: flex; flex-direction: column; gap: 18px; max-width: 820px; }
.sign-head h1 { font-family: var(--display); font-weight: 800; font-size: clamp(36px, 4.2vw, 58px); line-height: 1.02; letter-spacing: -0.03em; }

.sign-tool { padding-block: 36px var(--section); }
.sign-wrap { max-width: calc(860px + 2 * var(--gutter)); display: flex; flex-direction: column; gap: 22px; }

/* drop zone */
.drop { border: 2px dashed #b9c6dd; border-radius: 20px; background: #fff; padding: 44px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--blue); }
.drop.over { border-color: var(--blue); background: var(--tint); }
.drop-title { font-family: var(--display); font-weight: 800; font-size: 22px; color: var(--ink); }
.drop-note { font-size: 14px; color: var(--muted); }
.drop .btn { margin-top: 6px; position: relative; overflow: hidden; }
.drop .btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.drop .btn:focus-within { outline: 3px solid var(--blue-light); outline-offset: 2px; }
.drop-small { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* toolbar */
.tool { display: flex; flex-direction: column; gap: 14px; }
.toolbar { position: sticky; top: 8px; z-index: 30; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px; border-radius: 16px; background: #fff; border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(11,22,48,0.10); }
.tb-group { display: flex; flex-wrap: wrap; gap: 8px; }
.tb-btn { height: 42px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.tb-btn[aria-pressed="true"] { background: var(--ink); color: #fff; }
.tb-btn:disabled { opacity: 0.45; cursor: default; }
.tb-btn:disabled:hover { background: transparent; color: var(--ink); }
.btn-primary.tb-btn:disabled:hover { background: var(--blue); color: #fff; }
.hint { align-self: center; padding: 8px 14px; border-radius: 999px; background: #fff4e0; color: #8a5a00; font-size: 14px; font-weight: 600; }
.file-name { font-size: 14px; color: var(--muted); word-break: break-word; }

/* pages */
.pages { display: flex; flex-direction: column; gap: 18px; }
.pages.placing .pg-box { cursor: crosshair; }
.pg { display: flex; flex-direction: column; gap: 6px; }
.pg-box { position: relative; background: #fff; box-shadow: 0 6px 24px rgba(11,22,48,0.14); line-height: 0; }
.pg-box canvas { display: block; width: 100%; height: auto; }
.pg-cap { font-size: 12.5px; color: var(--muted); text-align: center; }

/* marks */
.mark { position: absolute; touch-action: none; user-select: none; -webkit-user-select: none; cursor: move; line-height: 1; }
.mark img { display: block; width: 100%; height: 100%; pointer-events: none; }
.mark.name, .mark.date, .mark.text { width: max-content; }
.mark .txt { display: block; white-space: pre; color: #1e2a5a; font-family: Helvetica, Arial, sans-serif; line-height: 1.28; pointer-events: none; }
.mark.name .txt { font-family: Georgia, "Times New Roman", serif; font-style: italic; }
.mark::before { content: ""; position: absolute; inset: -2px; border: 1.5px dashed transparent; border-radius: 4px; }
.mark.active::before, .mark:hover::before { border-color: var(--blue); }
.mark .del, .mark .grip { position: absolute; display: none; border: 0; padding: 0; cursor: pointer; }
.mark.active .del, .mark.active .grip, .mark:hover .del, .mark:hover .grip { display: grid; }
.mark .del { right: -10px; top: -32px; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 18px; line-height: 1; place-items: center; }
.mark .grip { right: -12px; bottom: -12px; width: 22px; height: 22px; border-radius: 50%; background: var(--blue); cursor: nwse-resize; touch-action: none; }

.small-print { font-size: 13.5px; line-height: 1.55; color: var(--muted); }

/* upsell */
.upsell { margin-top: 12px; border-radius: 22px; background: var(--navy); color: #fff; padding: 32px 34px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; }
.upsell h2 { font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: -0.015em; }
.upsell p { margin-top: 8px; font-size: 15.5px; line-height: 1.6; color: var(--on-navy); }
.upsell-actions { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.upsell-link { text-align: center; color: var(--on-navy-3); font-weight: 600; font-size: 15px; }
.upsell-link:hover { color: #fff; }

/* dialogs */
.pad-dialog { border: 0; padding: 0; border-radius: 20px; background: #fff; color: var(--ink); width: min(640px, calc(100vw - 32px)); box-shadow: 0 30px 60px rgba(0,0,0,0.35); }
.pad-dialog::backdrop { background: rgba(11,22,48,0.55); }
.dlg { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dlg-head h2 { font-family: var(--display); font-weight: 800; font-size: 22px; }
.dlg-x { width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--panel); color: var(--ink); font-size: 26px; line-height: 1; cursor: pointer; }
.pad { width: 100%; height: auto; aspect-ratio: 3 / 1; border: 1px solid var(--line); border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; }
.dlg-note, .dlg-label { font-size: 13.5px; color: var(--muted); }
.dlg-label { font-weight: 600; color: var(--ink); }
.dlg-input { height: 48px; border: 1px solid #c9d3e3; border-radius: 10px; padding: 0 14px; font: inherit; font-size: 17px; color: var(--ink); }
.name-preview { min-height: 52px; padding: 6px 12px; border-radius: 10px; background: var(--panel); font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 34px; color: #1e2a5a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.dlg-foot .btn { height: 46px; }

@media (max-width: 700px) {
  .sign-head { padding-block: 36px 40px; }
  .toolbar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; border-radius: 16px 16px 0 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -12px 30px rgba(11,22,48,0.14); }
  .tb-group { width: 100%; }
  .tb-group .tb-btn { flex: 1 1 40%; padding: 0 10px; font-size: 13.5px; height: 40px; }
  .tb-end .tb-btn:not(.btn-primary) { flex: 1 1 30%; }
  .tb-end .btn-primary { flex: 1 1 100%; }
  .tool { padding-bottom: 190px; }
  .upsell { grid-template-columns: minmax(0, 1fr); padding: 26px 22px; }
  .upsell-actions .btn { width: 100%; }
  .dlg { padding: 18px; }
}
