/* Initial Here. A printed form: cream ground, ink text, square corners.
   Closed palette: --bg, --ink, --ink-soft, --c-earth, --c-brick, --c-sky. */

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

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

::selection {
  background: var(--c-sky);
  color: var(--ink);
}

a {
  color: var(--ink);
}

main {
  max-width: 44em;
  margin: 0 auto;
  padding: 32px 16px 48px;
}

p {
  margin: 0 0 0.8em;
  max-width: 34em;
}

/* Masthead: wordmark small, title in plum, the short brick bar under it. */
.wordmark {
  display: block;
  width: 140px;
  height: auto;
  margin-bottom: 28px;
}

h1 {
  margin: 0 0 14px;
  color: var(--c-earth);
  font-family: var(--font-display);
  font-size: 2.3em;
  font-weight: var(--fw-bold);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

h1::after {
  content: "";
  display: block;
  width: 2.4em;
  height: 6px;
  margin-top: 10px;
  background: var(--c-brick);
}

.subline {
  margin-bottom: 28px;
}

/* Native controls pinned to the palette. */
input,
textarea,
button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  border: 2px solid var(--ink);
  border-radius: 0;
  font: inherit;
}

::placeholder {
  color: var(--ink-soft);
  opacity: 1;
}

input:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

textarea,
input[type="text"] {
  display: block;
  width: 100%;
  padding: 10px 12px;
}

textarea {
  min-height: 8em;
  resize: vertical;
  font-size: 16px;
  line-height: 1.5;
}

.field-label {
  display: block;
  margin: 0 0 6px;
  font-weight: var(--fw-medium);
}

.helper {
  margin: 8px 0 24px;
  color: var(--ink-soft);
  font-size: 16px;
}

button {
  padding: 8px 20px;
  cursor: pointer;
  font-weight: var(--fw-medium);
}

button:disabled {
  color: var(--ink-soft);
  border-color: var(--ink-soft);
  cursor: default;
}

/* Text buttons read as plain underlined text; the border stays, unseen. */
button.text {
  padding: 0;
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: inherit;
}

.helper button.text {
  color: var(--ink);
  font-size: inherit;
}

#name {
  max-width: 24em;
  margin-bottom: 24px;
}

.status {
  margin-bottom: 24px;
}

.notice {
  margin: -20px 0 24px;
  color: var(--ink-soft);
  font-size: 16px;
}

.notice:empty {
  display: none;
}

/* The initial box: square, dotted until it has focus, solid when it does. */
.sign-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
}

input.initial-box {
  width: 5.2em;
  height: 2.4em;
  padding: 0 8px;
  font-size: 24px;
  font-weight: var(--fw-medium);
  letter-spacing: 0.08em;
  text-align: center;
  outline: 2px dotted var(--ink);
  outline-offset: 2px;
}

input.initial-box:focus,
input.initial-box:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.sign-row button[type="submit"] {
  height: 3.2rem;
  padding: 0 24px;
}

.footnote {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
}

#paste .footnote {
  margin-top: 24px;
}

/* Reading: one clause, then the form line under it. */
.clause-label {
  margin-bottom: 18px;
  color: var(--c-earth);
  font-size: 16px;
  font-weight: var(--fw-medium);
  letter-spacing: 0.02em;
}

.clause {
  margin: 0 0 36px;
  font-size: 21px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sign {
  padding-top: 20px;
  border-top: 1px solid var(--ink-soft);
}

.sign p {
  margin: 0;
}

#mismatch {
  min-height: 1.5em;
  margin: 10px 0 14px;
  color: var(--ink);
}

#stop {
  font-size: 17px;
}

#needs {
  margin-top: 22px;
}

#hidden-note:empty,
#mismatch:empty {
  visibility: hidden;
}

.query {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  cursor: pointer;
}

.query input {
  width: 18px;
  height: 18px;
  flex: none;
  padding: 0;
  cursor: pointer;
}

.query input:checked {
  background: var(--ink);
}

/* Receipt: a strip of mint paper, perforated above and below. */
.strip {
  width: max-content;
  max-width: 100%;
  margin: 0 0 28px;
  padding: 16px 10px;
  color: #1a1a1a;
  background: var(--c-sky);
  border: 0 solid #1a1a1a;
  border-top: 2px dotted #1a1a1a;
  border-bottom: 2px dotted #1a1a1a;
  font-family: ui-monospace, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre;
  overflow-x: auto;
}

.strip::selection {
  background: var(--ink);
  color: var(--bg);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
}

.colophon {
  margin-top: 64px;
  padding-top: 16px;
  border-top: 1px solid var(--ink-soft);
  color: var(--ink-soft);
  font-size: 14px;
}

.colophon p {
  margin-bottom: 6px;
}

[hidden] {
  display: none !important;
}

/* While reading, the page is the clause and nothing else. */
body[data-stage="reading"] .masthead,
body[data-stage="reading"] .colophon {
  display: none;
}

@media (max-width: 480px) {
  body {
    font-size: 18px;
  }

  main {
    padding-top: 24px;
  }

  h1 {
    font-size: 2em;
  }

  .clause {
    font-size: 19px;
  }
}

@media print {
  html,
  body {
    background: none;
    color: #000;
  }

  main {
    max-width: none;
    padding: 0;
  }

  .masthead,
  .colophon,
  #paste,
  #reading,
  .actions {
    display: none !important;
  }

  .strip {
    width: 40ch;
    max-width: none;
    margin: 0;
    padding: 6pt 0;
    color: #000;
    background: none;
    border-color: #000;
    font-size: 11pt;
    overflow: visible;
  }
}
