/* NHSign: the NorthHead family look (paper, ink, spruce, sunflower), as the
   website and NHMail. Figtree for everything, Instrument Serif for titles; the
   font files are the ones the exported agreements use. */
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("/static/fonts/figtree-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/instrument-serif-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/instrument-serif-italic-latin.woff2") format("woff2");
}

:root {
  --paper: #f6f1e3;
  --card: #fdfbf5;
  --sheet: #ffffff;
  --ink: #13261f;
  --muted: #4b5a54;
  --quiet: #7b8782;
  --rule: #e2d9c3;
  --rule-soft: #efe8d6;
  --spruce: #2a6150;
  --spruce-hover: #1f4d3f;
  --green: #2f6b57;
  --mint: #d9ecdf;
  --butter: #fbe7b3;
  --butter-soft: #fdf3d6;
  --sun: #f2c14e;
  --sun-deep: #b97f0d;
  --error: #a8322c;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: Figtree, "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  font: 16px/1.55 var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
}

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

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-synthesis: none;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 0.5rem;
  text-wrap: balance;
}

h1 {
  font-size: 2.1rem;
}

h2 {
  font-size: 1.45rem;
}

h3 {
  font-size: 1.15rem;
  margin-top: 1.1rem;
}

code {
  font-size: 0.9em;
  background: var(--rule-soft);
  padding: 0.05em 0.35em;
  border-radius: 4px;
}

/* The top bar */

.top {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.6rem clamp(1rem, 4vw, 2.5rem);
  background: var(--ink);
  color: #fff;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font: 1.5rem/1 var(--serif);
  color: inherit;
  text-decoration: none;
}

.brand em {
  color: #a8d5c2;
}

.brand.large {
  font-size: 2.1rem;
  color: var(--ink);
  margin: 0 0 0.25rem;
}

.brand.large em {
  color: var(--green);
}

.mark {
  width: 1.2em;
  height: 1.2em;
}

.top nav {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}

.top nav a {
  color: #e9efe9;
  text-decoration: none;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  font-weight: 500;
}

.top nav a[aria-current],
.top nav a:hover {
  background: #2f4a40;
  color: #fff;
}

.top .quiet-button {
  color: #c8d4ce;
}

main {
  max-width: 62rem;
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 5rem;
}

main.bare {
  max-width: 26rem;
  padding-top: 12vh;
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.head h1 {
  margin: 0;
}

.crumbs {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
}

.lead {
  color: var(--muted);
  margin: 0 0 1rem;
}

.hint {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 400;
}

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  margin: 0 0 1.25rem;
}

.banner {
  padding: 0.7rem 1rem;
  border-radius: 8px;
  margin: 0 0 1rem;
  font-weight: 500;
}

.banner.error {
  background: #f8e3e1;
  color: var(--error);
  border: 1px solid #e9bdb9;
}

.banner.note {
  background: var(--mint);
  border: 1px solid #b9d8c5;
}

/* Buttons and fields */

button,
.button {
  font: inherit;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.95rem;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: var(--sheet);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  border-color: var(--quiet);
}

.primary {
  background: var(--spruce);
  border-color: var(--spruce);
  color: #fff;
}

.primary:hover {
  background: var(--spruce-hover);
  border-color: var(--spruce-hover);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.quiet-button {
  background: none;
  border-color: transparent;
  color: var(--muted);
  font-weight: 500;
}

:focus-visible {
  outline: 2px solid #3f8597;
  outline-offset: 2px;
}

.card label,
.sign-in label {
  display: block;
  font-weight: 600;
  margin: 0 0 0.8rem;
}

.card label .hint {
  display: block;
}

.card label input:not([type="checkbox"], [type="radio"]),
.card select {
  display: block;
  width: 100%;
  max-width: 34rem;
  margin-top: 0.25rem;
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid #cfc6ae;
  border-radius: 8px;
  background: var(--sheet);
  color: var(--ink);
}

.inline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.inline select {
  width: auto;
  margin: 0;
}

.picks {
  display: grid;
  gap: 0.1rem;
  margin: 0.5rem 0 1rem;
}

.card label.pick {
  font-weight: 500;
  margin: 0;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
}

label.pick:hover {
  background: var(--rule-soft);
}

.row-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.75rem;
}

.signer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0 1rem;
  align-items: end;
  padding: 0.75rem 0;
  border-top: 1px solid var(--rule-soft);
}

.signer h3,
.signer .row-actions {
  grid-column: 1 / -1;
  margin-top: 0;
}

/* Lists */

.tabs {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin: 0 0 0.75rem;
}

.tabs a {
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
}

.tabs a[aria-current] {
  background: var(--ink);
  color: #fff;
}

.count {
  font-weight: 500;
  opacity: 0.75;
}

.list {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.row {
  display: grid;
  grid-template-columns: minmax(9rem, 1.1fr) 2fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 1.1rem;
  color: inherit;
  text-decoration: none;
  border-top: 1px solid var(--rule-soft);
}

.row:first-child {
  border-top: 0;
}

.row:hover {
  background: var(--butter-soft);
}

.row.archived {
  color: var(--quiet);
}

.who {
  font-weight: 650;
}

.what {
  color: var(--muted);
}

.when {
  color: var(--muted);
  font-size: 0.875rem;
  white-space: nowrap;
}

.empty {
  padding: 1.5rem 1.1rem;
  color: var(--muted);
  margin: 0;
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.badge.draft {
  background: var(--butter);
}

.badge.ready {
  background: var(--mint);
  color: #1f4f40;
}

.badge.sent {
  background: #d7e7ee;
  color: #235464;
}

.badge.signed {
  background: var(--spruce);
  color: #fff;
}

.badge.expired {
  background: #f8e3e1;
  color: var(--error);
}

.send {
  border-top: 1px solid var(--rule-soft);
  padding-top: 0.75rem;
  margin-bottom: 1rem;
}

.badge.discarded {
  background: var(--rule-soft);
  color: var(--muted);
}

.documents,
.timeline,
.plain {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.documents li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 0;
  border-top: 1px solid var(--rule-soft);
}

.documents li:first-child {
  border-top: 0;
}

.documents .what {
  color: var(--ink);
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 0.4rem;
}

.left {
  font-weight: 650;
  color: var(--sun-deep);
  white-space: nowrap;
}

.left.done {
  color: var(--green);
}

.timeline li {
  padding: 0.25rem 0;
}

.timeline time {
  color: var(--muted);
  font-size: 0.875rem;
  margin-right: 0.5rem;
}

.plain li {
  padding: 0.15rem 0;
}

/* The fill-in page */

.formbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: -0.5rem calc(-1 * clamp(1rem, 4vw, 2.5rem)) 1rem;
  padding: 0.6rem clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}

.formbar .back {
  text-decoration: none;
  font-weight: 600;
}

.doc-title {
  flex: 1;
  min-width: 10rem;
}

.formfoot {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  max-width: 52rem;
  margin: 1rem auto 0;
}

.todo {
  max-width: 52rem;
  margin-inline: auto;
  padding: 0.8rem 1.1rem;
}

.todo summary {
  font-weight: 650;
  cursor: pointer;
  color: var(--sun-deep);
}

.todo ul {
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.todo a {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--butter);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.875rem;
}

/* The document itself, as a sheet of paper with holes to fill */

.doc {
  max-width: 52rem;
  margin: 0 auto;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow:
    0 1px 2px rgba(19, 38, 31, 0.05),
    0 8px 24px rgba(19, 38, 31, 0.06);
  padding: clamp(1.25rem, 5vw, 3.25rem);
  line-height: 1.75;
}

.doc h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.doc h2 {
  font-size: 1.35rem;
  margin: 1.75rem 0 0.5rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
}

.doc h3 {
  font-size: 1.1rem;
}

.doc p,
.doc ul,
.doc ol {
  margin: 0 0 0.7rem;
}

.doc ul,
.doc ol {
  padding-left: 1.3rem;
}

.doc li {
  margin-bottom: 0.3rem;
}

.doc li::marker {
  color: var(--green);
}

.doc li.option {
  list-style: none;
  margin-left: -1.3rem;
}

.doc hr {
  border: 0;
  border-top: 2px solid var(--ink);
  margin: 2rem 0 1rem;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.6rem 0 1rem;
}

.doc th,
.doc td {
  text-align: left;
  vertical-align: top;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--rule);
}

.doc th {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
  border-bottom-color: var(--ink);
}

.blank {
  font: inherit;
  color: var(--ink);
  background: var(--butter-soft);
  border: 0;
  border-bottom: 2px solid #d8c88f;
  border-radius: 4px 4px 0 0;
  padding: 0.05rem 0.35rem;
  margin: 0.1rem 0.1rem;
  max-width: 100%;
  vertical-align: baseline;
}

.blank::placeholder {
  color: #8a7f5c;
  font-style: italic;
}

.blank:focus {
  outline: 2px solid #3f8597;
  outline-offset: 1px;
  background: #fff;
}

.blank.need {
  background: var(--butter);
  border-bottom-color: var(--sun-deep);
}

.blank.quiet {
  background: #f4f2ec;
  border-bottom-color: var(--rule);
}

.blank.amount {
  text-align: right;
}

.blank.shared {
  border-bottom-style: double;
  border-bottom-width: 4px;
}

textarea.blank {
  display: block;
  width: 100%;
  margin: 0.2rem 0;
  resize: vertical;
  line-height: 1.5;
}

.bound {
  background: var(--mint);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
}

a.bound.missing {
  background: var(--butter);
  color: var(--sun-deep);
  font-weight: 600;
}

input.box {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0 0.35rem 0 0.1rem;
  vertical-align: -0.15rem;
  accent-color: var(--spruce);
}

/* A second box on a line keeps its distance from the option before it. */
.doc :not(li.option, li.option > p) > .box:not(:first-child),
.doc li.option .box:not(:first-child) {
  margin-left: 0.9rem;
}

input.box.need {
  outline: 1.5px solid var(--sun);
  outline-offset: 2px;
  border-radius: 2px;
}

.box.open {
  display: inline-block;
  width: 0.95rem;
  height: 0.95rem;
  margin: 0 0.35rem 0 0.1rem;
  vertical-align: -0.12rem;
  border: 1.5px dashed var(--quiet);
  border-radius: 3px;
}

.tools {
  display: inline-flex;
  gap: 0.3rem;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.tool {
  font-family: var(--sans);
  letter-spacing: 0;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  color: var(--muted);
  background: none;
  border: 1px dashed #cfc6ae;
}

.tool:hover {
  color: var(--ink);
  border-style: solid;
}

.left-out {
  color: var(--quiet);
  font: italic 0.9rem var(--sans);
  letter-spacing: 0;
}

/* Small screens */

@media (max-width: 40rem) {
  .top {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .top nav {
    order: 3;
    flex-basis: 100%;
  }

  .row {
    grid-template-columns: 1fr auto;
  }

  .row .what {
    grid-column: 1 / -1;
    order: 3;
  }

  .documents li {
    grid-template-columns: 1fr auto;
  }

  .documents .actions {
    grid-column: 1 / -1;
  }

  .doc table,
  .doc tbody,
  .doc tr,
  .doc td {
    display: block;
  }

  .doc thead {
    display: none;
  }

  .doc tr {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--rule);
  }

  .doc td {
    border: 0;
    padding: 0.1rem 0;
  }
}

/* What a signer sees: no navigation, a column to read, a form to sign. */

.signing main {
  max-width: 54rem;
}

.signing .top {
  justify-content: space-between;
}

.top-note {
  color: #c8d4ce;
  font-size: 0.9rem;
}

.narrow {
  max-width: 38rem;
  margin-inline: auto;
}

.contents {
  margin: 0.5rem 0 0;
  padding-left: 1.3rem;
}

.contents li {
  margin-bottom: 0.3rem;
}

.contents .hint {
  margin-left: 0.5rem;
  white-space: nowrap;
}

.sheet {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow:
    0 1px 2px rgba(19, 38, 31, 0.05),
    0 8px 24px rgba(19, 38, 31, 0.06);
  padding: clamp(1.1rem, 5vw, 3rem);
  margin: 0 auto 1.5rem;
  max-width: 54rem;
  overflow-wrap: anywhere;
}

.card textarea,
input.code {
  display: block;
  width: 100%;
  max-width: 34rem;
  margin-top: 0.25rem;
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid #cfc6ae;
  border-radius: 8px;
  background: var(--sheet);
  color: var(--ink);
}

input.code {
  max-width: 11rem;
  font-size: 1.5rem;
  letter-spacing: 0.2em;
  text-align: center;
}

.card label.check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  align-items: start;
  font-weight: 500;
}

.check input {
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.2rem;
  accent-color: var(--spruce);
}

button.big {
  font-size: 1.1rem;
  padding: 0.7rem 1.4rem;
}

.again {
  margin-top: 0.5rem;
}

.card summary {
  font-weight: 650;
  cursor: pointer;
}

.card details form,
details.card form {
  margin-top: 0.75rem;
}

.note-from-signer {
  white-space: pre-wrap;
  background: var(--butter-soft);
  border-left: 3px solid var(--sun);
  padding: 0.6rem 0.9rem;
  margin: 0.5rem 0 1rem;
  border-radius: 0 6px 6px 0;
}

.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 1rem;
  margin: 0 0 1rem;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
