:root {
  --ink: #16233a;
  --ink-soft: #4a5568;
  --paper: #faf8f3;
  --card: #ffffff;
  --rule: #ddd6c6;
  --rule-strong: #b9ae97;
  --brass: #8d6c25;
  --brass-tint: #f3ecda;

  --sound: #2c6049;
  --sound-tint: #e6efea;
  --convert: #8a6516;
  --convert-tint: #f6eeda;
  --barrier: #97382b;
  --barrier-tint: #f8e9e6;

  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
             Georgia, serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
          Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--brass); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }

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

/* --- Masthead: the register header ------------------------------------- */

.masthead {
  border-bottom: 3px double var(--rule-strong);
  background: var(--card);
}

.masthead-inner {
  max-width: 66rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: baseline;
}

.wordmark {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
.wordmark span {
  display: block;
  font-family: var(--body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  margin-top: 0.15rem;
}

.masthead nav { display: flex; gap: 1.1rem; font-size: 0.9rem; flex-wrap: wrap; }
.masthead nav a { color: var(--ink-soft); text-decoration: none; }
.masthead nav a:hover { color: var(--brass); text-decoration: underline; }

.masthead form { margin: 0; }
.linkbutton {
  background: none; border: none; padding: 0; font: inherit;
  color: var(--ink-soft); cursor: pointer; text-decoration: none;
}
.linkbutton:hover { color: var(--brass); text-decoration: underline; }

/* --- Layout ------------------------------------------------------------- */

main { max-width: 66rem; margin: 0 auto; padding: 2rem 1.25rem 5rem; }
.narrow { max-width: 44rem; }

h1 {
  font-family: var(--display);
  font-size: clamp(1.7rem, 4.5vw, 2.4rem);
  line-height: 1.15;
  font-weight: 600;
  margin: 0 0 0.4rem;
}
h2 {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 600;
  margin: 2.4rem 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}
h3 { font-size: 1rem; margin: 1.4rem 0 0.4rem; }

.standfirst {
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 42rem;
  margin: 0 0 1.6rem;
}

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--brass);
  font-weight: 600;
  margin: 0 0 0.5rem;
}

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

.muted { color: var(--ink-soft); }
.small { font-size: 0.88rem; }

/* --- The stamp: signature element --------------------------------------- */
/* A jurisdiction's status renders as a clerk's stamp on a register page.    */

.stamp {
  display: inline-block;
  border: 2px solid currentColor;
  border-radius: 2px;
  padding: 0.5rem 0.9rem 0.45rem;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  position: relative;
  background: transparent;
}
.stamp::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid currentColor;
  opacity: 0.45;
  pointer-events: none;
}
.stamp-sound { color: var(--sound); background: var(--sound-tint); }
.stamp-convert { color: var(--convert); background: var(--convert-tint); }
.stamp-barrier { color: var(--barrier); background: var(--barrier-tint); }
.stamp-unset { color: var(--ink-soft); background: #f1efe9; }

.stamp-small {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-width: 1px;
  letter-spacing: 0.1em;
}
.stamp-small::after { display: none; }

/* --- Tally: the counts on the roll-up ----------------------------------- */

.tally {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin-bottom: 1.6rem;
}
.tally > div { background: var(--card); padding: 1.1rem 1.2rem; }
.tally dt {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.35rem;
}
.tally dd {
  margin: 0;
  font-family: var(--display);
  font-size: 2.1rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.tally .note { font-size: 0.82rem; color: var(--ink-soft); margin-top: 0.4rem; }

/* --- Tables ------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
th {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule-strong);
}
tbody tr:hover { background: var(--brass-tint); }
.numeric { text-align: right; font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--rule); }

/* --- Forms -------------------------------------------------------------- */

fieldset { border: none; margin: 0 0 2rem; padding: 0; }
legend {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
  padding: 0;
  margin-bottom: 0.9rem;
  width: 100%;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule);
}

.item {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--rule-strong);
  padding: 1.05rem 1.2rem;
  margin-bottom: 0.75rem;
}
.item.restricted { border-left-color: var(--brass); }

.item .prompt { font-weight: 600; display: block; margin-bottom: 0.3rem; }
.item .help { font-size: 0.87rem; color: var(--ink-soft); margin: 0 0 0.7rem; }

.held {
  display: inline-block;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass);
  border: 1px solid var(--brass);
  padding: 0.05rem 0.35rem;
  margin-left: 0.4rem;
  vertical-align: 2px;
  white-space: nowrap;
}

.choices { display: grid; gap: 0.35rem; margin-top: 0.4rem; }
.choices label {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.35rem 0.5rem;
  border: 1px solid transparent;
  cursor: pointer;
}
.choices label:hover { background: var(--brass-tint); border-color: var(--rule); }
.choices input { margin-top: 0.28rem; flex: none; }

input[type="text"], input[type="number"], input[type="email"],
input[type="password"], textarea, select {
  width: 100%;
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--rule-strong);
  background: #fff;
  color: var(--ink);
  border-radius: 0;
}
textarea { min-height: 5rem; resize: vertical; }

.actions {
  position: sticky;
  bottom: 0;
  background: var(--paper);
  border-top: 1px solid var(--rule-strong);
  padding: 0.9rem 0;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  align-items: center;
}

button, .button {
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  border-radius: 0;
  text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover { background: #0d1728; color: #fff; }
button.secondary, .button.secondary {
  background: transparent;
  color: var(--ink);
}
button.secondary:hover, .button.secondary:hover {
  background: var(--brass-tint); color: var(--ink);
}

/* --- Findings ----------------------------------------------------------- */

.finding {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--rule-strong);
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.6rem;
}
.finding.critical, .finding.high { border-left-color: var(--barrier); }
.finding.medium { border-left-color: var(--convert); }
.finding.low { border-left-color: var(--rule-strong); }
.finding.explained { border-left-color: var(--sound); opacity: 0.85; }

.finding .severity {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-soft);
}
.finding h3 { margin: 0.25rem 0 0.3rem; font-family: var(--display);
              font-size: 1.05rem; }
.finding .do { margin: 0.5rem 0 0; }
.finding .do strong { color: var(--brass); }
.finding .code { font-family: var(--mono); font-size: 0.78rem;
                 color: var(--ink-soft); }
.finding .explanation {
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--rule);
  font-size: 0.92rem;
}

/* --- Notices ------------------------------------------------------------ */

.notice {
  border: 1px solid var(--rule-strong);
  border-left: 4px solid var(--brass);
  background: var(--brass-tint);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.2rem;
}
.notice.problem { border-left-color: var(--barrier); background: var(--barrier-tint); }
.notice.done { border-left-color: var(--sound); background: var(--sound-tint); }
.notice p { margin: 0; }

/* --- The chain: audit log ----------------------------------------------- */

.chain { list-style: none; margin: 0; padding: 0; }
.chain li {
  position: relative;
  padding: 0.6rem 0 0.6rem 1.6rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.9rem;
}
.chain li::before {
  content: "";
  position: absolute;
  left: 0.42rem; top: 0; bottom: 0;
  border-left: 2px solid var(--brass);
}
.chain li:first-child::before { top: 0.9rem; }
.chain li:last-child::before { bottom: calc(100% - 0.9rem); }
.chain li::after {
  content: "";
  position: absolute;
  left: 0.15rem; top: 0.8rem;
  width: 0.6rem; height: 0.6rem;
  background: var(--brass);
  border-radius: 50%;
}
.chain .hash { font-family: var(--mono); font-size: 0.74rem; color: var(--ink-soft); }
.chain .action { font-weight: 600; }

footer {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding-top: 1.2rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media (max-width: 40rem) {
  .masthead-inner { padding: 0.85rem 1rem; }
  main { padding: 1.4rem 1rem 4rem; }
  .tally dd { font-size: 1.7rem; }
}
