/* Falden — document of record. One paper ground. No dark mode. */

:root {
  color-scheme: light only;
  --paper: #f1e9dc;
  --ink: #1c1814;
  --muted: #5e574e;
  --hairline: #cfc3b1;
  --rule: #b7aa96;
  --partial: #9a3a1c;
  --metal-deep: #3f3b36;
  --metal-mid: #9a948c;
  --metal-light: #ece6dc;
  --measure: 38em;
  --display: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

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

html {
  font-size: 112.5%; /* 18px */
  background: var(--paper);
}

body {
  margin: 0 auto;
  max-width: var(--measure);
  padding: 2.25rem 1.25rem 4.5rem;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: #e0d4c2;
  color: var(--ink);
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  transform: translateY(-200%);
  background: var(--paper);
  color: var(--ink);
  padding: 0.35em 0.6em;
  z-index: 2;
}

.skip:focus-visible {
  transform: none;
}

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.fact,
.serial,
.ledger,
.hex,
.countersign,
.cta a,
.seal-kicker,
.verify-result,
button {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums slashed-zero;
  font-feature-settings: "tnum" 1, "zero" 1;
}

.fact,
.hex {
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
}

/* Masthead */

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--ink);
  box-shadow: 0 3px 0 -2px var(--ink);
}

.wordmark {
  margin: 0;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
}

.serial {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

/* Type */

h1 {
  margin: 2.35rem 0 0.9rem;
  font-size: 2.05rem;
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.018em;
}

.lede {
  margin: 0 0 0.25rem;
  font-size: 1.2rem;
  line-height: 1.38;
}

h2 {
  margin: 0 0 0.9rem;
  font-size: 1.28rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

section {
  margin-top: 2.6rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--hairline);
}

p {
  margin: 0 0 0.9rem;
}

p:last-child {
  margin-bottom: 0;
}

.footnote {
  margin-top: 0.85rem;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.45;
}

.partial {
  color: var(--partial);
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-style: normal;
  letter-spacing: 0.04em;
}

/* Ruled tabular panel — text left, numerals right. Never a card. */

.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  line-height: 1.3;
}

.ledger caption {
  text-align: left;
}

.ledger th,
.ledger td {
  border-bottom: 1px solid var(--hairline);
  padding: 0.58em 0;
  font-weight: 400;
  vertical-align: baseline;
}

.ledger tbody tr:first-child th,
.ledger tbody tr:first-child td {
  border-top: 1px solid var(--ink);
  padding-top: 0.7em;
}

.ledger tbody tr:last-child th,
.ledger tbody tr:last-child td {
  border-bottom: 1px solid var(--ink);
  padding-bottom: 0.7em;
}

.ledger th {
  text-align: left;
  padding-right: 1.25em;
}

.ledger td {
  text-align: right;
  white-space: nowrap;
}

.ledger.pack tbody tr:last-child th,
.ledger.pack tbody tr:last-child td {
  border-bottom-color: var(--ink);
}

.ledger tr.total th,
.ledger tr.total td {
  border-top: 1px solid var(--ink);
  padding-top: 0.7em;
}

/* Assessment list: hairlines, not boxes */

.ruled {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  border-top: 1px solid var(--hairline);
}

.ruled li {
  margin: 0;
  padding: 0.55em 0;
  border-bottom: 1px solid var(--hairline);
}

/* Receipt physics */

.receipt {
  margin-top: 0.2rem;
}

.perforation {
  height: 10px;
  background-image: radial-gradient(
    circle at center,
    var(--paper) 2.15px,
    var(--rule) 2.25px,
    var(--rule) 2.5px,
    transparent 2.6px
  );
  background-size: 10px 10px;
  background-repeat: repeat-x;
  background-position: center;
}

.perforation-foot {
  background-position: center;
}

.receipt-body {
  padding: 1.15rem 0 1.25rem;
  border-top: 1px dashed var(--rule);
  border-bottom: 1px dashed var(--rule);
  animation: tear-off 180ms ease-out both;
}

.receipt-body > p {
  margin-bottom: 0.75rem;
}

.receipt-body .ledger {
  margin: 1.15rem 0 0;
}

/* Countersignature: two actors, hairline between, no avatars */

.countersign {
  margin-top: 1.15rem;
  border-top: 1px dashed var(--rule);
  font-size: 0.6875rem;
  letter-spacing: 0.01em;
}

.cs-row {
  display: grid;
  grid-template-columns: 5.4em minmax(0, 1fr) auto auto;
  gap: 0.55rem 0.85rem;
  align-items: baseline;
  padding: 0.7em 0;
}

.cs-row + .cs-row {
  border-top: 1px solid var(--hairline);
}

.cs-role {
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.62rem;
}

.cs-name {
  min-width: 0;
}

.cs-row time {
  white-space: nowrap;
  color: var(--ink);
}

.cs-mark {
  letter-spacing: 0.08em;
  min-width: 3.2em;
  text-align: right;
}

/* Seal foot: totals + seal */

.seal-foot {
  display: flex;
  gap: 1.15rem 1.4rem;
  align-items: flex-start;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--rule);
}

.seal-host {
  flex: 0 0 auto;
  width: 5.6rem;
  height: 5.6rem;
}

.seal-host svg,
.seal-mini svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.seal-host svg {
  animation: seal-resolve 180ms ease-out both;
}

.seal-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.seal-kicker {
  margin: 0 0 0.4rem;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.hex {
  margin: 0 0 0.7rem;
  font-size: 0.6875rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.verify-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
}

.seal-mini {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--ink);
  padding: 0.15em 0 0.12em;
  margin: 0;
  color: var(--ink);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 0;
}

button:hover {
  border-bottom-width: 2px;
}

.verify-result {
  margin: 0;
  font-size: 0.75rem;
}

.verify-result.is-ok {
  color: var(--ink);
}

.verify-result.is-bad {
  color: var(--partial);
}

/* CTA is a text link, not a pill */

.cta {
  margin: 2.6rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--hairline);
}

.cta a {
  font-size: 0.8125rem;
  letter-spacing: 0.03em;
}

.cta a::after {
  content: " →";
  font-family: var(--mono);
}

.colophon {
  margin-top: 2.4rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--ink);
  font-size: 0.92rem;
  color: var(--muted);
}

.colophon p {
  margin: 0;
}

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

@keyframes tear-off {
  from {
    transform: translateY(-0.4rem);
    opacity: 0.35;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes seal-resolve {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .receipt-body,
  .seal-host svg {
    animation: none;
  }
}

@media (max-width: 36em) {
  h1 {
    font-size: 1.7rem;
  }

  .cs-row {
    grid-template-columns: 5.4em 1fr auto;
    grid-template-areas:
      "role name mark"
      "role time mark";
  }

  .cs-role { grid-area: role; }
  .cs-name { grid-area: name; }
  .cs-row time { grid-area: time; }
  .cs-mark { grid-area: mark; align-self: center; }

  .seal-foot {
    flex-direction: column;
  }
}

@media print {
  body {
    max-width: none;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
  }

  .skip,
  .cta a::after {
    display: none;
  }

  .receipt-body,
  .seal-host svg {
    animation: none;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-family: var(--mono);
    font-size: 0.7em;
  }
}
