/* Innovation Blockchain: shared styles for index.html, standard.html, 404.html.
   No build step. No third-party requests. System fonts only.

   Type:   serif for text and headings, monospace for labels, references and data.
   Scale:  1.25 ratio on a 17px base (0.8 / 1 / 1.25 / 1.563 / 1.953 / fluid display).
   Grid:   70rem page, an 11rem reference rail plus a text column, 34rem measure
           (about 70 characters a line at the text size).
   Space:  0.5rem unit.
   Colour: paper, ink, one accent (petrol). Red, amber and green appear only
           as finding ratings and always next to the word itself. */

:root {
  color-scheme: light dark;

  --paper: #f5f3ec;
  --paper-2: #ebe8dd;
  --ink: #1a1c1b;
  --ink-2: #4a4f4c;
  --rule: #c8c4b6;
  --accent: #0e5a62;
  --red: #a3321c;
  --amber: #8a5a00;
  --green: #2f6b3a;

  --serif: Charter, "Bitstream Charter", "Iowan Old Style", "Sitka Text", Cambria, Georgia, serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --step--1: 0.8rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.563rem;
  --step-3: 1.953rem;
  --display: clamp(2rem, 1.2rem + 3.6vw, 3.5rem);

  --measure: 34rem;
  --rail: 11rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131615;
    --paper-2: #1c201f;
    --ink: #e7e4da;
    --ink-2: #a9ada6;
    --rule: #3a403e;
    --accent: #7cc7c4;
    --red: #f08a70;
    --amber: #e0b050;
    --green: #86c58f;
  }
}

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
  font-variant-numeric: lining-nums;
}

/* ---------- Basics ---------- */

h1,
h2,
h3 {
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: var(--display);
  line-height: 1.08;
  letter-spacing: -0.012em;
}

h2 {
  font-size: var(--step-3);
  letter-spacing: -0.008em;
  margin-bottom: 1.5rem;
}

h3 {
  font-size: var(--step-1);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

p,
ul,
ol,
dl,
figure,
pre,
table {
  margin: 0 0 1rem;
}

ul,
ol {
  padding-left: 1.25rem;
}

li {
  margin-bottom: 0.375rem;
}

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

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

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

strong {
  font-weight: 600;
}

code,
pre {
  font-family: var(--mono);
  font-size: 0.875em;
}

pre {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: 1rem;
  overflow-x: auto;
  line-height: 1.5;
  tab-size: 2;
}

.skip {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 0.75rem;
  z-index: 10;
}

.skip:focus {
  top: 0.5rem;
}

/* The skip link moves focus here. No ring around the whole page body. */
main:focus {
  outline: none;
}

.wrap {
  max-width: 70rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Small uppercase monospace label, used for references and captions */
.label {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.proposed {
  font-family: var(--mono);
  font-size: 0.75em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid currentColor;
  padding: 0.05em 0.35em;
  white-space: nowrap;
  vertical-align: 0.08em;
}

.measure {
  max-width: var(--measure);
}

.lead {
  font-size: var(--step-1);
  line-height: 1.5;
  max-width: 34rem;
}

.note {
  color: var(--ink-2);
  font-size: 0.9375rem;
  max-width: var(--measure);
}

/* ---------- Masthead ---------- */

.masthead {
  border-bottom: 1px solid var(--ink);
}

.masthead .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.0625rem;
}

.brand svg {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
}

.brand .mark-frame {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
}

.brand .mark-tick {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
}

.nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
}

.nav li {
  margin: 0;
}

.nav a {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  display: inline-block;
  padding-block: 0.375rem;
}

.nav a:hover,
.nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.3em;
  text-decoration-color: var(--accent);
}

/* ---------- Opening block ---------- */

.opening {
  padding-block: clamp(3rem, 8vw, 6rem) clamp(2.5rem, 6vw, 4.5rem);
}

.opening h1 {
  max-width: 18ch;
  margin-block: 1rem 1.5rem;
}

.opening .lead + .lead {
  margin-top: -0.25rem;
}

.docmeta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.docmeta li {
  margin: 0;
}

/* ---------- Status stamp ---------- */

.stamp {
  border: 2px solid var(--accent);
  outline: 1px solid var(--accent);
  outline-offset: 3px;
  margin: 2.5rem 3px 0;
}

.stamp-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  margin: 0;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--accent);
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.stamp dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
}

/* One, two or four across. Never three and one. */
@media (min-width: 34rem) {
  .stamp dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 62rem) {
  .stamp dl {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stamp dl > div {
  padding: 0.875rem 1rem 1rem;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  margin: -1px 0 0 -1px;
}

.stamp dt {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 0.25rem;
}

.stamp dd {
  margin: 0;
  font-weight: 600;
  line-height: 1.35;
}

.stamp dd small {
  display: block;
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--ink-2);
  margin-top: 0.25rem;
  line-height: 1.4;
}

.stamp-wrap {
  overflow: hidden; /* keeps the -1px cell offsets inside the frame */
}

/* ---------- Numbered sections ---------- */

.sec {
  border-top: 1px solid var(--ink);
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.sec-ref {
  margin: 0;
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
}

.sec-ref .num {
  color: var(--accent);
  font-weight: 600;
}

.sec-body > :last-child {
  margin-bottom: 0;
}

.sec-body > p,
.sec-body > ul,
.sec-body > ol,
.sec-body > dl {
  max-width: var(--measure);
}

@media (min-width: 60rem) {
  .sec {
    grid-template-columns: var(--rail) minmax(0, 1fr);
    column-gap: 3rem;
  }

  .sec-ref {
    display: block;
    position: sticky;
    top: 1.5rem;
    align-self: start;
  }

  .sec-ref .num {
    display: block;
    font-size: var(--step-2);
    letter-spacing: 0;
    line-height: 1.2;
    margin-bottom: 0.25rem;
  }
}

/* ---------- Lists with references ---------- */

/* The five questions */
.sec-body > .five {
  list-style: none;
  padding: 0;
  counter-reset: q;
  border-top: 1px solid var(--rule);
  max-width: 44rem;
}

.five li {
  counter-increment: q;
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  align-items: baseline;
  padding-block: 0.625rem;
  margin: 0;
  border-bottom: 1px solid var(--rule);
  font-size: var(--step-1);
  line-height: 1.35;
}

.five li::before {
  content: counter(q);
  font-family: var(--mono);
  font-size: var(--step-0);
  color: var(--accent);
  font-weight: 600;
}

/* Procedures and other clause lists */
.sec-body > .clauses {
  list-style: none;
  padding: 0;
  border-top: 1px solid var(--rule);
  max-width: 38rem;
}

.clauses > li {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  column-gap: 0.5rem;
  padding-block: 0.875rem;
  margin: 0;
  border-bottom: 1px solid var(--rule);
}

.clauses .ref {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 600;
  padding-top: 0.15em;
}

.clauses h3,
.clauses h4 {
  font-size: var(--step-0);
  font-weight: 600;
  margin: 0 0 0.25rem;
  line-height: 1.4;
}

.clauses p,
.clauses ul {
  margin-bottom: 0;
  color: var(--ink-2);
}

.clauses ul {
  margin-top: 0.25rem;
}

.clauses li li {
  margin-bottom: 0.25rem;
}

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

.table-scroll {
  overflow-x: auto;
  margin-bottom: 1.5rem;
  max-width: 46rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.45;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

table.wide {
  min-width: 36rem;
}

caption {
  caption-side: top;
  text-align: left;
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding-bottom: 0.5rem;
}

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

th:last-child,
td:last-child {
  padding-right: 0;
}

thead th {
  font-family: var(--mono);
  font-size: var(--step--1);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-bottom: 1px solid var(--ink);
}

tbody th {
  font-weight: 600;
}

tbody tr:last-child > * {
  border-bottom: 0;
}

td.code,
th.code {
  font-family: var(--mono);
  font-size: 0.875rem;
}

/* Finding ratings: a square mark plus the word. Colour is never the only signal. */
.rating {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  white-space: nowrap;
}

.rating::before {
  content: "";
  width: 0.7em;
  height: 0.7em;
  flex: none;
  background: currentColor;
}

.rating.red {
  color: var(--red);
}

.rating.amber {
  color: var(--amber);
}

.rating.green {
  color: var(--green);
}

/* ---------- Diagram ---------- */

.diagram {
  margin: 2rem 0;
}

.diagram svg {
  display: block;
  width: 100%;
  height: auto;
}

.diagram .dg-narrow {
  max-width: 26rem;
}

.diagram .dg-wide {
  display: none;
}

@media (min-width: 68rem) {
  .diagram .dg-wide {
    display: block;
  }

  .diagram .dg-narrow {
    display: none;
  }

  /* The wide diagram uses the full page width, across the rail */
  .sec-body > .diagram {
    margin-left: calc(-1 * (var(--rail) + 3rem));
  }
}

.diagram figcaption {
  margin-top: 1rem;
  color: var(--ink-2);
  font-size: 0.9375rem;
  max-width: var(--measure);
}

.dg-zone {
  fill: var(--paper-2);
}

.dg-box {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 1.25;
}

.dg-record {
  fill: var(--paper);
  stroke: var(--accent);
  stroke-width: 2.5;
}

.dg-dash {
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1.25;
  stroke-dasharray: 5 4;
}

.dg-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
}

.dg-head {
  fill: var(--ink);
}

.dg-t {
  fill: var(--ink);
  font-family: var(--serif);
  font-size: 14px;
}

.dg-t.dg-t-s {
  font-size: 13px;
}

.dg-l {
  fill: var(--ink-2);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
}

.dg-narrow .dg-l {
  font-size: 11px;
}

.dg-step {
  fill: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.dg-ok {
  fill: none;
  stroke: var(--green);
  stroke-width: 2;
}

.dg-no {
  fill: none;
  stroke: var(--red);
  stroke-width: 2;
}

/* ---------- Two-column facts ---------- */

.pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1.5rem 3rem;
  max-width: 46rem;
  margin-bottom: 1.5rem;
}

.pair h3 {
  margin-top: 0;
  padding-top: 0.75rem;
  border-top: 2px solid var(--ink);
}

.pair ul {
  margin-bottom: 0;
}

.plain {
  list-style: none;
  padding: 0;
}

.plain li {
  padding: 0.5rem 0;
  margin: 0;
  border-bottom: 1px solid var(--rule);
}

/* ---------- Contact ---------- */

.contact-line {
  font-size: var(--step-2);
  line-height: 1.3;
  margin-block: 1.5rem;
}

.contact-line a {
  color: var(--ink);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

/* ---------- Standard page ---------- */

.toc {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  columns: 2 14rem;
  column-gap: 3rem;
  max-width: 44rem;
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
}

.toc li {
  margin: 0;
  break-inside: avoid;
}

.toc a {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  padding-block: 0.25rem;
  color: var(--ink);
  text-decoration: none;
}

.toc a:hover span:last-child {
  text-decoration: underline;
  text-decoration-color: var(--accent);
}

.toc .ref {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--accent);
  padding-top: 0.1em;
}

.draft-flag {
  display: inline-block;
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border: 2px solid var(--accent);
  padding: 0.25rem 0.625rem;
}

/* ---------- Footer ---------- */

.colophon {
  border-top: 1px solid var(--ink);
  padding-block: 2rem 3rem;
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.colophon .wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1rem 3rem;
}

.colophon p {
  margin: 0 0 0.5rem;
  max-width: 34rem;
}

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

/* ---------- Not found ---------- */

.lost {
  padding-block: clamp(4rem, 14vw, 9rem);
}

.lost h1 {
  margin-block: 1rem 1.5rem;
}

/* ---------- Print ---------- */

@media print {
  :root {
    --paper: #fff;
    --paper-2: #f2f2f2;
    --ink: #000;
    --ink-2: #333;
    --rule: #999;
    --accent: #0e5a62;
    --red: #8f2a17;
    --amber: #6f4800;
    --green: #245a2e;
  }

  body {
    font-size: 10.5pt;
  }

  .skip,
  .nav {
    display: none;
  }

  .sec {
    display: block;
    padding-block: 1.5rem;
  }

  .sec-ref {
    position: static;
    margin-bottom: 0.5rem;
    break-after: avoid;
  }

  .stamp dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sec-body > .diagram {
    margin-left: 0;
  }

  .table-scroll {
    overflow: visible;
  }

  table.wide {
    min-width: 0;
  }

  table,
  figure,
  pre,
  .stamp,
  .clauses > li,
  .five li {
    break-inside: avoid;
  }

  h2,
  h3 {
    break-after: avoid;
  }

  a {
    color: inherit;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    word-break: break-all;
  }
}
