/*
 * Signature pad (D-08, D-15, M-03): neutral-100 field, 2px dashed neutral-400 border, radius 22px,
 * 190px tall (180px inline on training, fills the screen on phones). Clear top-right, prompt
 * centered, a baseline with an "×" mark. The canvas fills the field; touch-action none so drawing
 * never scrolls the page. Driven by the signature-pad Stimulus controller.
 */
@layer components {
  .signature {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .signature-pad {
    position: relative;
    height: 190px;
    flex: none;
    border: 2px dashed var(--color-neutral-400);
    border-radius: var(--radius-row);
    background: var(--color-neutral-100);
    touch-action: none;
  }
  .signature-pad--inline { height: 180px; }
  .signature-pad--fill { flex: 1; min-height: 300px; border-radius: 24px; }

  .signature-pad:focus-within { border-color: var(--color-blue); }
  .signature-pad.is-signed { border-style: solid; border-color: var(--color-neutral-400); }

  .signature-pad__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    cursor: crosshair;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }
  .signature-pad__canvas:focus-visible { outline-offset: -4px; }

  .signature-pad__clear {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 1;
    height: 32px;
  }

  .signature-pad__hint {
    position: absolute;
    top: 42%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: max-content;
    max-width: calc(100% - 32px);
    color: var(--color-neutral-700);
    font-size: 14px;
    text-align: center;
    pointer-events: none;
  }
  .signature-pad__hint--coarse { display: none; }
  .signature-pad.is-signed .signature-pad__hint { display: none; }

  .signature-pad__line {
    position: absolute;
    right: 28px;
    bottom: 40px;
    left: 28px;
    height: 2px;
    border-radius: 2px;
    background: var(--color-neutral-400);
    pointer-events: none;
  }

  .signature-pad__x {
    position: absolute;
    bottom: 46px;
    left: 30px;
    color: var(--color-neutral-600);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.55; /* the design's inherited body line-height: the × centre sits 18px above the line */
    pointer-events: none;
  }

  .signature__foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 4px;
  }
  .signature__note {
    flex: 1;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--color-neutral-700);
  }

  /* Recorded signature image (D-08 · done, A-15) */
  .signature-image {
    display: grid;
    place-items: center;
    height: 84px;
    padding: 8px;
    border-radius: var(--radius-row);
    background: var(--color-neutral-100);
  }
  .signature-image img { max-height: 100%; width: auto; }

  @media (pointer: coarse) {
    .signature-pad__hint--fine { display: none; }
    .signature-pad__hint--coarse { display: block; }
  }

  @media (max-width: 767px) {
    .signature-pad { height: 220px; }
    .signature-pad--fill { min-height: 300px; }
    .signature-pad__hint { top: 40%; }
    .signature-pad__line { right: 24px; bottom: 56px; left: 24px; }
    .signature-pad__x { bottom: 62px; left: 26px; }
    .signature__foot { flex-direction: column; align-items: stretch; }
    .signature__note { text-align: center; }
    .signature__foot .btn { height: 54px; width: 100%; }
  }
}
