/* Public signing page — readable on a phone, a laptop, and a reverse-proxied
   deploy. The workspace chrome (dark glass, 480px centered card) is the wrong
   surface for a document the recipient has to review and stamp. */

.sign-body,
.sign-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 420px at 12% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 55%),
    var(--bg);
  color: var(--ink);
}

.sign-shell {
  display: block;
  padding: 20px 16px 40px;
  box-sizing: border-box;
}

.sign-frame {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.sign-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 400px);
  gap: 20px;
  align-items: start;
}

.sign-doc-col,
.sign-form-col {
  min-width: 0;
}

.sign-doc-head h1,
.sign-doc-head h2 {
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  margin: 0 0 6px;
}

.sign-doc-board {
  margin-top: 12px;
}

.sign-doc {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-3) 70%, #d7deea);
  box-shadow: var(--elev-1);
}

.sign-doc-status {
  margin: 0 0 10px;
  color: var(--ink-3);
}

.sign-pages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: min(78vh, 920px);
  overflow: auto;
  padding: 4px;
}

.sign-page {
  position: relative;
  margin: 0 auto;
  width: 100%;
  max-width: 720px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .12);
  overflow: hidden;
}

.sign-page-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

.sign-page-fallback {
  width: 100%;
  background:
    linear-gradient(#fff, #fff),
    repeating-linear-gradient(0deg, transparent, transparent 27px, #eef2f7 28px);
  min-height: 360px;
}

.sign-page-label {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  pointer-events: none;
}

.sign-stamp {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  padding: 6px 10px 18px;
  box-sizing: border-box;
  border: 1.5px dashed #4f46e5;
  border-radius: 8px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 6px 16px rgba(79, 70, 229, .18);
  cursor: grab;
  touch-action: none;
  user-select: none;
  color: #1e1b4b;
  overflow: hidden;
  container-type: size;
}

.sign-stamp.is-dragging {
  cursor: grabbing;
  border-style: solid;
  background: rgba(255, 255, 255, .96);
}

.sign-stamp-label {
  flex: 0 0 auto;
  font-size: clamp(.72rem, 12cqi, 1.2rem);
  line-height: 1.15;
  text-align: center;
  pointer-events: none;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sign-stamp-img {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
}

.sign-stamp.has-drawing-and-name .sign-stamp-img {
  flex: 1 1 56%;
  max-height: 56%;
}

.sign-stamp.has-drawing-and-name .sign-stamp-label {
  padding-top: 2px;
}

.sign-stamp-hint {
  position: absolute;
  right: 6px;
  bottom: 3px;
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #4f46e5;
  pointer-events: none;
}

.sign-form-card {
  overflow: visible;
}

.sign-form-card .sign-pad {
  max-width: 100%;
}

.sign-form-card .sign-pad canvas {
  width: 100% !important;
  max-width: 100%;
  height: 160px;
}

.sign-open-doc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

@media (max-width: 900px) {
  .sign-layout {
    grid-template-columns: 1fr;
  }
  .sign-form-col {
    order: 2;
  }
  .sign-pages {
    max-height: min(58vh, 640px);
  }
  .sign-shell {
    padding: 12px 10px 28px;
  }
}

/* The signature faces.
   These are the SAME files the server embeds into the PDF, served locally so
   the preview and the signed document cannot disagree — a mark that looks one
   way on screen and another in the file is the first thing anyone disputing a
   signature will point at. SIL OFL 1.1; licence beside the fonts. */
@font-face {
  font-family: 'SigSignature';
  src: url('/assets/fonts/signature/great-vibes.woff2') format('woff2'),
       url('/assets/fonts/signature/great-vibes.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'SigHandwritten';
  src: url('/assets/fonts/signature/caveat.woff2') format('woff2'),
       url('/assets/fonts/signature/caveat.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'SigFlowing';
  src: url('/assets/fonts/signature/dancing-script.woff2') format('woff2'),
       url('/assets/fonts/signature/dancing-script.woff') format('woff');
  font-display: swap;
}
