/* ==========================================================================
   Creator agreement signature sheet · sign.css
   Opens from "Next Steps". Bottom sheet on phones, centered card on desktop.
   Light mode only. Shared byte for byte by claimtrial.com and claimcreators.com.
   ========================================================================== */

.sign-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(20, 16, 10, 0.34);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.35s var(--ease-spring);
}
.sign-root.open .sign-backdrop { opacity: 1; }

.sign-root { display: none; }
.sign-root.mounted { display: block; }

.sign-sheet {
  position: fixed;
  z-index: 91;
  left: 50%;
  bottom: 0;
  width: min(560px, 100%);
  max-height: min(92vh, 92dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.16) transparent;
  background: var(--canvas);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.16);
  padding: 14px 24px calc(28px + env(safe-area-inset-bottom));
  transform: translate(-50%, 104%);
  transition: transform 0.55s var(--ease-spring);
}
.sign-root.open .sign-sheet { transform: translate(-50%, 0); }

@media (min-width: 810px) {
  .sign-sheet {
    top: 50%;
    bottom: auto;
    border-radius: 28px;
    padding: 28px 32px 32px;
    transform: translate(-50%, -46%) scale(0.98);
    opacity: 0;
    transition: transform 0.45s var(--ease-spring), opacity 0.3s var(--ease-spring);
  }
  .sign-root.open .sign-sheet { transform: translate(-50%, -50%); opacity: 1; }
  .sign-grabber { display: none; }
}

.sign-grabber {
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: var(--ink-12);
  margin: 0 auto 14px;
}

.sign-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 18px;
  background: var(--ink-4);
  color: var(--ink-56);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.sign-close:hover { background: var(--ink-8); color: var(--ink); }
.sign-close svg { width: 14px; height: 14px; }

.sign-head { padding: 6px 44px 0 0; }
.sign-head .eyebrow { margin-bottom: 8px; }
.sign-title {
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 110%;
  margin: 0;
}
.sign-sub {
  margin: 10px 0 0;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 145%;
  color: var(--ink-56);
}

/* ------------------------------------------------------------ the paper */

.sign-paper {
  position: relative;
  margin-top: 22px;
  background: var(--white);
  border-radius: 20px;
  padding: 22px 22px 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 8px 28px rgba(60, 40, 10, 0.08);
  overflow: hidden;
}
.paper-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.paper-top img { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.paper-top .t { display: flex; flex-direction: column; min-width: 0; }
.paper-top b {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 125%;
}
.paper-top span {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink-48);
}

.paper-label {
  margin: 18px 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-36);
}
.paper-points {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: pt;
}
.paper-points li {
  counter-increment: pt;
  display: flex;
  gap: 12px;
  padding: 9px 0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 145%;
}
.paper-points li + li { border-top: 1.5px solid var(--ink-4); }
.paper-points li::before {
  content: counter(pt);
  flex: none;
  width: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink-24);
}

.paper-full { margin-top: 10px; }
.paper-full summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink-56);
  padding: 4px 0;
}
.paper-full summary::-webkit-details-marker { display: none; }
.paper-full summary svg { width: 11px; height: 11px; transition: transform 0.25s var(--ease-spring); }
.paper-full[open] summary svg { transform: rotate(180deg); }
.paper-full ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.paper-full li {
  padding: 7px 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 150%;
  color: var(--ink-56);
}
.paper-full li + li { border-top: 1.5px solid var(--ink-4); }
.paper-full li b { color: var(--ink); font-weight: 700; }

.paper-rule {
  border: 0;
  height: 1.5px;
  background: var(--ink-8);
  margin: 18px 0 16px;
}

/* --------------------------------------------------------------- fields */

.sign-field { display: block; margin-bottom: 12px; }
.sign-field span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-56);
}
.sign-field input {
  display: block;
  width: 100%;
  height: 50px;
  border: 1.5px solid var(--ink-10);
  border-radius: 14px;
  background: #fbfaf8;
  padding: 0 16px;
  font-family: var(--font);
  font-feature-settings: var(--font-features);
  font-size: 17px;            /* 16px+ stops iOS from zooming the page */
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.sign-field input::placeholder { color: var(--ink-24); }
.sign-field input:focus { border-color: var(--blue); background: var(--white); }
.sign-field.bad input { border-color: #d92d20; }
.sign-field .err {
  display: none;
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: #b42318;
}
.sign-field.bad .err { display: block; }

/* -------------------------------------------------------- signature pad */

.pad-wrap { margin-top: 4px; }
.pad-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}
.pad-head span {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-56);
}
.pad-clear {
  border: 0;
  background: none;
  padding: 2px 0;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-48);
  cursor: pointer;
  visibility: hidden;
}
.pad-clear:hover { color: var(--ink); }
.pad.has-ink + .pad-clear,
.pad-wrap.has-ink .pad-clear { visibility: visible; }

.pad {
  position: relative;
  height: 168px;
  border-radius: 16px;
  background: #fbfaf8;
  border: 1.5px dashed var(--ink-12);
  touch-action: none;
  cursor: crosshair;
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s;
}
.pad.active { border-color: var(--ink-24); background: var(--white); }
.pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pad .line {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 42px;
  height: 1.5px;
  background: var(--ink-12);
  pointer-events: none;
}
.pad .x {
  position: absolute;
  left: 22px;
  bottom: 48px;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink-24);
  pointer-events: none;
}
.pad .hint {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-80%);
  text-align: center;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--ink-24);
  pointer-events: none;
  transition: opacity 0.2s;
}
.pad.has-ink .hint { opacity: 0; }
.pad.nudge { animation: pad-nudge 0.42s var(--ease-spring); border-color: #d92d20; }
@keyframes pad-nudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.sign-legal {
  margin: 14px 2px 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 150%;
  color: var(--ink-48);
}

.sign-actions { margin-top: 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.sign-actions .btn { width: 100%; padding: 17px 24px; font-size: 17px; }
.sign-actions .btn[disabled] { opacity: 0.38; cursor: default; transform: none; }
.sign-actions .btn.busy { opacity: 0.7; }
.sign-error {
  display: none;
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: #b42318;
  text-align: center;
}
.sign-error.show { display: block; }

/* ------------------------------------------------------------ signed state */

.signed-block { display: none; }
.sign-root.done .form-block { display: none; }
.sign-root.done .signed-block { display: block; }

/* Signed: the paper folds down to the signature (the full text lives in the copy) */
.sign-root.done .paper-label,
.sign-root.done .paper-points,
.sign-root.done .paper-full { display: none; }
.sign-root.done .paper-rule { margin: 16px 0 6px; }

.signed-sig {
  position: relative;
  height: 112px;
  margin-top: 4px;
}
.signed-sig img {
  position: absolute;
  left: 4px;
  bottom: 16px;
  max-width: 55%;
  max-height: 96px;
  object-fit: contain;
  object-position: left bottom;
}
.signed-sig .line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  height: 1.5px;
  background: var(--ink-12);
}
.signed-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 145%;
  color: var(--ink-48);
}
.signed-meta b { color: var(--ink); font-weight: 700; font-size: 15px; letter-spacing: -0.03em; }

.stamp {
  position: absolute;
  right: 18px;
  bottom: 92px;
  padding: 8px 14px 7px;
  border: 3px solid var(--blue);
  border-radius: 10px;
  color: var(--blue);
  text-align: center;
  transform: rotate(-9deg);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
}
.stamp .w {
  display: block;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 100%;
}
.stamp .d {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
}
.sign-root.done .stamp { animation: stamp-in 0.5s 0.15s var(--ease-spring) forwards; }
@keyframes stamp-in {
  0% { opacity: 0; transform: rotate(-9deg) scale(1.9); }
  55% { opacity: 0.92; transform: rotate(-9deg) scale(0.94); }
  100% { opacity: 0.88; transform: rotate(-9deg) scale(1); }
}

.copy-link {
  color: var(--ink-56);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.04em;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.copy-link:hover { color: var(--ink); }

body.sign-lock { overflow: hidden; }

@media (max-width: 809px) {
  .sign-title { font-size: 29px; }
  .sign-paper { padding: 18px 16px 16px; border-radius: 18px; }
  .stamp { right: 14px; bottom: 90px; }
  .stamp .w { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .sign-sheet, .sign-backdrop { transition: none; }
  .sign-root.done .stamp { animation: none; opacity: 0.88; }
}
