/* Folnaro sign link pages. System font, quiet surfaces, the sender's accent applied only to the main action,
   links and focus. Phone first; one column. No endless animation; motion respects Reduce Motion. */

@font-face {
  font-family: "Folnaro Signature";
  src: url("/vendor/dancing-script/dancing-script-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Folnaro Signature";
  src: url("/vendor/dancing-script/dancing-script-latin-ext-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-sunken: #fafafa;
  --ink: #1d1d1f;
  --ink-2: #424245;
  --ink-3: #5e5e63;
  --hairline: rgba(0, 0, 0, 0.1);
  --hairline-strong: rgba(0, 0, 0, 0.18);
  --paper-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.06);
  --error: #b3261e;
  /* Neutral graphite until the manifest brings the sender's accent. */
  --accent-control: #2c2c2e;
  --accent-text-light: #2c2c2e;
  --accent-text-dark: #e5e5ea;
  --accent-text: var(--accent-text-light);
  --on-accent: #ffffff;
  --radius: 14px;
  --radius-small: 10px;
  --column: 680px;
  --gutter: 20px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", system-ui, "Segoe UI", "Helvetica Neue",
    Helvetica, Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro", system-ui, "Segoe UI",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161618;
    --surface: #232325;
    --surface-sunken: #1c1c1e;
    --ink: #f5f5f7;
    --ink-2: #d1d1d6;
    --ink-3: #a1a1a6;
    --hairline: rgba(255, 255, 255, 0.1);
    --hairline-strong: rgba(255, 255, 255, 0.2);
    --paper-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 10px 30px rgba(0, 0, 0, 0.45);
    --error: #ff8a80;
    --accent-control: #e5e5ea;
    --on-accent: #1d1d1f;
    --accent-text: var(--accent-text-dark);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.shell {
  max-width: calc(var(--column) + 2 * var(--gutter));
  margin: 0 auto;
  padding: max(40px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 48px
    max(var(--gutter), env(safe-area-inset-left));
  outline: none;
}

@media (min-width: 720px) {
  :root {
    --gutter: 32px;
  }
  .shell {
    padding-top: 72px;
  }
}

/* Reading progress: a hairline at the very top, filled by scrolling. */
.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 10;
  pointer-events: none;
}
.progress__bar {
  height: 100%;
  background: var(--accent-control);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* MARK: States */

.state {
  min-height: 60vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 20px;
  text-align: center;
}
.state__text {
  max-width: 30ch;
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.35;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink);
  outline: none;
  text-wrap: balance;
}
#view-loading .state__text {
  color: var(--ink-3);
  font-size: 17px;
  font-weight: 400;
}

/* MARK: Masthead */

.masthead {
  margin-bottom: 40px;
}
.masthead__business {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--accent-text);
}
.masthead__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(30px, 7.4vw, 40px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
.masthead__lead {
  margin: 14px 0 0;
  max-width: 36em;
  font-size: 19px;
  line-height: 1.45;
  color: var(--ink-2);
  text-wrap: pretty;
}
.masthead__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* MARK: Pages */

.pages {
  display: grid;
  gap: 28px;
  margin: 0 0 64px;
}
.page {
  margin: 0;
}
.page__sheet {
  aspect-ratio: var(--aspect, 210 / 297);
  background: #ffffff;
  border-radius: 6px;
  box-shadow: var(--paper-shadow);
  overflow: hidden;
}
.page__sheet canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.page__sheet.is-failed {
  display: grid;
  place-content: center;
  padding: 24px;
  color: #5e5e63;
  font-size: 15px;
  text-align: center;
}
.page__caption {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* MARK: Signing form */

.signing {
  display: grid;
  gap: 28px;
}
.section-title {
  margin: 0 0 -8px;
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.018em;
}

.group {
  margin: 0;
  padding: 0;
  min-width: 0;
  border: 0;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 0 0 0.5px var(--hairline);
}
.group__legend {
  float: left;
  width: 100%;
  margin: 0;
  padding: 18px 20px 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.group__legend + * {
  clear: both;
}
.group__hint {
  margin: 0;
  padding: 4px 20px 16px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-3);
}

.field {
  padding: 14px 20px 14px;
}
.field + .field {
  border-top: 0.5px solid var(--hairline);
}
.field__label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
}
.field__input {
  display: block;
  width: 100%;
  margin: 0;
  padding: 6px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  line-height: 1.4;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.field__input::placeholder {
  color: var(--ink-3);
}
.field:focus-within {
  box-shadow: inset 3px 0 0 var(--accent-control);
}
.field__input[aria-invalid="true"] {
  color: var(--error);
}
.field__input--area {
  min-height: 96px;
  padding: 12px 14px;
  border-radius: var(--radius-small);
  background: var(--surface-sunken);
  box-shadow: inset 0 0 0 0.5px var(--hairline-strong);
  resize: vertical;
}
.field__input--area:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent-control);
}
.field__error {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--error);
}
.group > .field__error,
.consents .field__error {
  margin: 0;
  padding: 0 20px 16px;
}

/* Choices: native radios and checkboxes in the accent color, generous hit areas. */
.choice,
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.choice input,
.check input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent-control);
  cursor: pointer;
}
.check {
  align-items: flex-start;
  padding: 14px 20px;
  font-size: 16px;
  line-height: 1.45;
}
.check + .check {
  border-top: 0.5px solid var(--hairline);
}
.check input {
  margin-top: 1px;
}

.signature__modes {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 8px 20px 4px;
  font-size: 16px;
}
.signature__clear {
  margin-left: auto;
}
.signature__field {
  position: relative;
  margin: 8px 20px 0;
  border-radius: var(--radius-small);
  background: #ffffff;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.16);
}
@media (prefers-color-scheme: dark) {
  .signature__field {
    box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.14);
  }
}
.signature__canvas {
  display: block;
  width: 100%;
  height: 176px;
  touch-action: none;
  cursor: crosshair;
  border-radius: inherit;
}
.signature__canvas.is-typing {
  cursor: default;
}
.signature__canvas:focus-visible {
  outline: 3px solid var(--accent-control);
  outline-offset: 2px;
}
.signature__line {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 30%;
  height: 1px;
  background: rgba(0, 0, 0, 0.14);
  pointer-events: none;
}
.signature__line::before {
  content: "×";
  position: absolute;
  left: 0;
  bottom: 6px;
  font-size: 15px;
  line-height: 1;
  color: rgba(0, 0, 0, 0.38);
}
.signature .group__hint {
  padding-top: 10px;
}
.signature .field__error {
  margin: -8px 0 0;
}

.consent {
  margin: 0;
  padding: 14px 20px 10px;
  border: 0;
  border-top: 0.5px solid var(--hairline);
  min-width: 0;
}
.consent__title {
  float: left;
  width: 100%;
  padding: 0;
  font-size: 16px;
  font-weight: 600;
}
.consent__text {
  clear: both;
  margin: 4px 0 6px;
  padding-top: 2px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
}
.consent__choices {
  display: flex;
  gap: 28px;
  font-size: 16px;
}
.consent[aria-invalid="true"] .consent__title {
  color: var(--error);
}

/* The statutory instruction: complete, readable, visibly quieter than the action below it. */
.instruction {
  padding: 4px 2px 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
}
.instruction__title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}
.instruction__body h4 {
  margin: 18px 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.instruction__body h4:first-child {
  margin-top: 0;
}
.instruction__body p {
  margin: 0 0 8px;
  text-wrap: pretty;
}
.instruction__note {
  margin: 12px 0 0;
  color: var(--ink-3);
}

/* § 312j BGB: the essentials sit directly above the button. */
.essentials {
  margin-bottom: -12px;
  padding: 18px 20px 6px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 0 0 0.5px var(--hairline);
}
.essentials__title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-3);
}
.essentials__list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
}
.essentials__list dt {
  font-size: 13px;
  color: var(--ink-3);
}
.essentials__list dd {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
@media (min-width: 560px) {
  .essentials__list {
    grid-template-columns: 9.5em minmax(0, 1fr);
    column-gap: 16px;
  }
  .essentials__list dt {
    padding-top: 2px;
    font-size: 15px;
  }
}

.summary {
  margin: 0 0 -12px;
  font-size: 15px;
  color: var(--error);
  text-align: center;
}

/* MARK: Buttons */

.button {
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.button:focus-visible,
.link:focus-visible,
.choice input:focus-visible,
.check input:focus-visible {
  outline: 3px solid var(--accent-control);
  outline-offset: 3px;
}
.button--primary {
  width: 100%;
  min-height: 56px;
  padding: 14px 20px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent-control);
  color: var(--on-accent);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: filter 160ms ease, transform 160ms ease;
}
.button--primary:hover {
  filter: brightness(1.08);
}
.button--primary:active {
  transform: scale(0.99);
}
.button--primary:disabled {
  cursor: progress;
  filter: saturate(0.6) brightness(1.1);
}
.button--secondary {
  min-height: 48px;
  padding: 12px 20px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  box-shadow: 0 0 0 0.5px var(--hairline-strong);
}
.button--plain {
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 500;
}
.button--link,
.link {
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font-size: 15px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
}
.decline-link {
  justify-self: center;
  margin-top: -12px;
  color: var(--ink-3);
}

/* MARK: Done */

.done {
  display: grid;
  gap: 18px;
  padding-top: 8vh;
  outline: none;
  animation: arrive 360ms ease-out both;
}
.done__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(34px, 8vw, 44px);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.024em;
}
.done__time {
  margin: -8px 0 0;
  font-size: 15px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.done__signature {
  margin: 8px 0;
  padding: 18px 22px 14px;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--paper-shadow);
}
.done__signature img {
  display: block;
  max-width: 100%;
  height: 112px;
  object-fit: contain;
  object-position: left center;
}
.done__signature figcaption {
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  font-size: 13px;
  color: #5e5e63;
}
.done__text {
  margin: 0 0 6px;
  font-size: 19px;
  line-height: 1.45;
  color: var(--ink-2);
  text-wrap: pretty;
}
.done__withdraw {
  padding-top: 18px;
  border-top: 0.5px solid var(--hairline);
  font-size: 15px;
  color: var(--ink-3);
}
.done__withdraw p {
  margin: 0;
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* MARK: Decline sheet */

.sheet {
  width: min(520px, calc(100vw - 24px));
  margin: auto auto 12px;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
}
@media (min-width: 720px) {
  .sheet {
    margin: auto;
  }
}
.sheet::backdrop {
  background: rgba(0, 0, 0, 0.32);
}
@media (prefers-color-scheme: dark) {
  .sheet::backdrop {
    background: rgba(0, 0, 0, 0.6);
  }
  .sheet {
    box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.12), 0 24px 80px rgba(0, 0, 0, 0.5);
  }
}
.sheet__form {
  display: grid;
  gap: 12px;
  padding: 24px;
}
.sheet__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.014em;
}
.sheet__text {
  margin: 0 0 6px;
  color: var(--ink-2);
  font-size: 16px;
}
.sheet__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.sheet__actions .button--primary {
  min-height: 48px;
  font-size: 16px;
}
.sheet[open] {
  animation: arrive 220ms ease-out both;
}

/* MARK: Footer */

.footer {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 0.5px solid var(--hairline);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-3);
}
.footer p {
  margin: 0 0 8px;
  max-width: 60ch;
}
.footer__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 20px;
}
.footer__link {
  padding: 4px 0;
  font-size: 13px;
  color: var(--ink-2);
}
.footer__made {
  font-weight: 500;
}

.sheet--reading {
  overflow: hidden;
}
/* Heading and Close stay in place; only the text scrolls, so the sheet always opens at its heading. */
.sheet--reading .sheet__form {
  max-height: min(86vh, 760px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding-bottom: 20px;
}
.sheet--reading .sheet__actions {
  margin-top: 0;
  padding-top: 14px;
  border-top: 0.5px solid var(--hairline);
}
.sheet__body {
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-2);
}
.sheet__body h3 {
  margin: 16px 0 2px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.sheet__body h3:first-child {
  margin-top: 0;
}
.sheet__body p {
  margin: 0;
  text-wrap: pretty;
}
.sheet__actions--single {
  grid-template-columns: 1fr;
}

/* MARK: Withdrawal page */

.statement {
  margin: 0;
  padding: 16px 20px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
}
.statement__label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .button--primary {
    border: 2px solid ButtonText;
  }
  .group,
  .essentials {
    border: 1px solid CanvasText;
  }
}

@media print {
  .progress,
  .signing,
  .footer {
    display: none !important;
  }
  body {
    background: #ffffff;
  }
}
