/* PeerHarness: the project page. One stylesheet, no build step, nothing loaded from
   anywhere else. The fonts are the ones the reader's system has. */

:root {
  color-scheme: light dark;
  --paper: #f4f1e8;
  --card: #fcfbf6;
  --ink: #191814;
  --soft: #45433b;
  --muted: #66635a;
  --line: #d6d0bf;
  --pen: #2440c4;
  --pen-wash: rgba(36, 64, 196, 0.07);
  --on-pen: #ffffff;
  --term-bg: #17171a;
  --term-ink: #e9e5d9;
  --term-dim: #99968b;
  --term-band: #2a2a2f;
  --term-id: #a9b9ff;
  --shadow: rgba(25, 24, 20, 0.16);
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151410;
    --card: #1e1d17;
    --ink: #ece8db;
    --soft: #cfcbbd;
    --muted: #a39f91;
    --line: #38362c;
    --pen: #a3b4ff;
    --pen-wash: rgba(163, 180, 255, 0.09);
    --on-pen: #12121a;
    --term-bg: #0d0d0b;
    --term-band: #22221f;
    --shadow: rgba(0, 0, 0, 0.5);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p,
ul,
ol,
figure,
pre {
  margin: 0;
}

p,
li {
  text-wrap: pretty;
}

a {
  color: var(--pen);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 0.12em;
}

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

code {
  font: 0.86em var(--mono);
  background: var(--pen-wash);
  padding: 0.1em 0.32em;
  border-radius: 3px;
}

.wrap {
  width: min(100% - 2.5rem, 68rem);
  margin-inline: auto;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

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

.skip:focus {
  top: 0.75rem;
}

/* The small upper-case line that names a part of the page, like a field on a form. */
.label {
  font: 600 0.72rem/1.4 var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

/* A ballot box, with a pen mark that does not stay inside it. */
.box {
  position: relative;
  display: inline-block;
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: var(--card);
}

.box svg {
  position: absolute;
  left: -12%;
  top: -34%;
  width: 135%;
  height: 135%;
  overflow: visible;
  fill: none;
  stroke: var(--pen);
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* A rejection is on the record like an approval: it is written in ink, not in red. */
.box-no svg {
  left: -5%;
  top: -5%;
  width: 110%;
  height: 110%;
  stroke: var(--ink);
  stroke-width: 2.3;
}

/* ---------- top ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.top-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  font: 700 1.08rem var(--serif);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.top nav {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2.4vw, 1.7rem);
  font: 0.86rem var(--sans);
}

.top nav a {
  color: var(--soft);
  text-decoration: none;
}

.top nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.top nav .nav-out {
  color: var(--ink);
  font-weight: 600;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.28rem 0.85rem;
}

.top nav .nav-out:hover {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4.5rem);
  padding-block: clamp(2.75rem, 7vw, 5.5rem) clamp(3rem, 7vw, 5.5rem);
}

h1 {
  margin-top: 1.1rem;
  font: 700 clamp(2.35rem, 5.4vw, 4rem)/1.04 var(--serif);
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.pen-under {
  position: relative;
  white-space: nowrap;
}

.pen-under svg {
  position: absolute;
  left: -3%;
  bottom: -0.1em;
  width: 106%;
  height: 0.2em;
  overflow: visible;
  fill: none;
  stroke: var(--pen);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pen-under path {
  vector-effect: non-scaling-stroke;
}

.lede {
  margin-top: 1.6rem;
  max-width: 34rem;
  font-size: clamp(1.1rem, 1.5vw, 1.22rem);
  line-height: 1.55;
  color: var(--soft);
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.9rem;
}

.btn {
  display: inline-block;
  padding: 0.68rem 1.25rem;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  color: var(--ink);
  font: 600 0.95rem var(--sans);
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--line);
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

.status {
  margin-top: 1.9rem;
  max-width: 34rem;
  padding-left: 0.95rem;
  border-left: 2px solid var(--line);
  font: 0.86rem/1.55 var(--sans);
  color: var(--muted);
}

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

/* ---------- the ballot ---------- */

.ballot {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  box-shadow: 7px 7px 0 var(--line);
  padding: 1.35rem 1.5rem 1.3rem;
}

.ballot-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px dashed var(--line);
}

.ballot-rule {
  margin-top: 1.05rem;
  font: 700 clamp(1.3rem, 2.3vw, 1.6rem)/1.22 var(--serif);
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.votes {
  list-style: none;
  padding: 0;
  margin-top: 1.25rem;
  display: grid;
  gap: 0.72rem;
  font-size: 1rem;
  line-height: 1.4;
}

.vote {
  display: grid;
  grid-template-columns: 1.05rem 3.1rem minmax(0, 1fr);
  column-gap: 0.75rem;
  align-items: baseline;
}

.vote .box {
  align-self: center;
}

.who {
  font: 600 0.88rem var(--mono);
}

.count {
  padding-left: 1.8rem;
  font: 0.76rem/1.5 var(--mono);
  color: var(--muted);
}

.ballot-foot {
  position: relative;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1.5px solid var(--ink);
}

.tally {
  font: 600 0.82rem/1.5 var(--mono);
}

/* Struck next to the last ballot, above the line that closes the count. */
.stamp {
  position: absolute;
  right: 0.15rem;
  top: -3.15rem;
  padding: 0.28rem 0.7rem 0.22rem;
  border: 2.5px solid var(--pen);
  border-radius: 5px;
  color: var(--pen);
  font: 700 0.86rem var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transform: rotate(-7deg);
}

.ballot-note {
  margin-top: 0.7rem;
  font-size: 0.93rem;
  font-style: italic;
  color: var(--soft);
}

figcaption {
  margin-top: 0.9rem;
  font: 0.8rem/1.5 var(--sans);
  color: var(--muted);
}

.ballot-fig figcaption {
  margin-top: 1.25rem;
}

/* The ballots come in one after the other, once. */
@media (prefers-reduced-motion: no-preference) {
  .v1,
  .v2,
  .v3,
  .v4,
  .v5 {
    animation: cast 0.45s ease-out both;
  }

  .v1 { animation-delay: 0.5s; }
  .v2 { animation-delay: 1.15s; }
  .v3 { animation-delay: 1.6s; }
  .v4 { animation-delay: 2.35s; }
  .v5 { animation-delay: 2.95s; }

  .v6 {
    animation: stamp 0.28s cubic-bezier(0.2, 1.4, 0.4, 1) 3.45s both;
  }
}

@keyframes cast {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

@keyframes stamp {
  from {
    opacity: 0;
    transform: rotate(-7deg) scale(1.9);
  }
}

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

.sec {
  border-top: 1px solid var(--line);
  padding-block: clamp(3.25rem, 7.5vw, 5.75rem);
}

.sec-head {
  max-width: 43rem;
}

.sec-head .label {
  color: var(--pen);
}

h2 {
  margin-top: 0.7rem;
  font: 700 clamp(1.85rem, 3.6vw, 2.7rem)/1.1 var(--serif);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.sec-head > p:not(.label) {
  margin-top: 1rem;
  color: var(--soft);
  font-size: 1.1rem;
}

h3 {
  font: 700 1.14rem/1.3 var(--serif);
  letter-spacing: -0.005em;
}

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

.after {
  margin-top: 2rem;
  max-width: 46rem;
  font: 0.92rem/1.6 var(--sans);
  color: var(--soft);
}

/* ---------- § 1: try it ---------- */

.try-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(2rem, 5vw, 4rem);
  margin-top: clamp(2rem, 4vw, 3rem);
  align-items: start;
}

.steps {
  list-style: none;
  padding: 0;
  counter-reset: step;
  display: grid;
  gap: 1.7rem;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 3rem;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 1.85rem;
  height: 1.85rem;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: var(--card);
  font: 600 0.84rem var(--mono);
}

.say {
  font: 700 1.24rem/1.3 var(--serif);
  letter-spacing: -0.01em;
}

.steps li p + p {
  margin-top: 0.4rem;
  color: var(--soft);
}

.say-inline {
  font-weight: 700;
  color: var(--ink);
}

.try-side {
  display: grid;
  gap: 2rem;
}

.term {
  background: var(--term-bg);
  color: var(--term-ink);
  border-radius: 8px;
  padding: 1.05rem 1.15rem 1.2rem;
  font: 0.8rem/1.6 var(--mono);
  box-shadow: 0 16px 34px -20px var(--shadow);
}

@media (prefers-color-scheme: dark) {
  .term {
    border: 1px solid var(--line);
  }
}

.term p + p {
  margin-top: 0.95rem;
}

.t-user {
  background: var(--term-band);
  margin-inline: -1.15rem;
  padding: 0.3rem 1.15rem;
}

.t-user::before {
  content: "> ";
  color: var(--term-dim);
}

.t-tool,
.t-agent {
  position: relative;
  padding-left: 1.25rem;
}

.t-tool::before,
.t-agent::before {
  content: "●";
  position: absolute;
  left: 0;
  font-size: 0.7em;
  top: 0.22em;
  color: var(--term-dim);
}

.t-cont::before {
  content: none;
}

.t-dim {
  color: var(--term-dim);
}

.t-id {
  color: var(--term-id);
}

.demo .ln {
  margin-top: 0.95rem;
  padding-left: 3ch;
  text-indent: -3ch;
}

.demo .ln:first-child,
.demo .in {
  margin-top: 0;
}

.demo .in {
  padding-left: 4ch;
  text-indent: 0;
}

.demo .in + .in {
  margin-top: 0.3rem;
}

.win {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 22px 44px -22px var(--shadow);
  padding: 0.85rem 1.25rem 1.1rem;
  font: 0.78rem/1.5 var(--sans);
}

.win-title {
  text-align: center;
  font-weight: 700;
  color: var(--soft);
}

.win-lead {
  margin-top: 0.8rem;
  font-weight: 700;
}

.win-text {
  margin-top: 0.75rem;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--soft);
}

.win-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 1rem;
}

.win-btn {
  min-width: 5.2rem;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: center;
  font-weight: 500;
}

.win-default {
  background: var(--pen);
  border-color: var(--pen);
  color: var(--on-pen);
}

.principle {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(1.25rem, 4vw, 3.5rem);
  margin-top: clamp(2.75rem, 6vw, 4.5rem);
  padding: clamp(1.4rem, 3.5vw, 2.4rem);
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 3px;
}

.principle h3 {
  font-size: clamp(1.5rem, 2.8vw, 2.05rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.principle p + p {
  margin-top: 0.8rem;
}

.principle p {
  color: var(--soft);
}

.more {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 3.5rem);
  margin-top: clamp(2.25rem, 5vw, 3.5rem);
}

.more p {
  margin-top: 0.5rem;
  color: var(--soft);
}

/* ---------- § 2: the vote ---------- */

.vote-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(2rem, 5vw, 4rem);
  margin-top: clamp(2rem, 4vw, 3rem);
  align-items: start;
}

.rules {
  display: grid;
  gap: 1.15rem;
}

.rules li {
  padding-left: 1.2rem;
  border-left: 2px solid var(--line);
  color: var(--soft);
}

.rules strong,
.limits strong {
  color: var(--ink);
}

.rights {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  box-shadow: 7px 7px 0 var(--line);
  padding: 1.4rem 1.5rem 1.5rem;
}

.rights .label {
  color: var(--ink);
  padding-bottom: 0.85rem;
  border-bottom: 1px dashed var(--line);
}

.rights ol {
  list-style: none;
  padding: 0;
  margin-top: 1rem;
  counter-reset: right;
  display: grid;
  gap: 0.85rem;
}

.rights li {
  counter-increment: right;
  position: relative;
  padding-left: 2rem;
  font-size: 1rem;
  line-height: 1.5;
}

.rights li::before {
  content: counter(right);
  position: absolute;
  left: 0;
  top: 0.12em;
  font: 700 0.82rem/1.75 var(--mono);
  color: var(--pen);
}

/* ---------- § 3: no server ---------- */

.node-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

/* ---------- § 4: set it up ---------- */

.prompt {
  position: relative;
  margin-top: clamp(1.75rem, 4vw, 2.5rem);
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  box-shadow: 7px 7px 0 var(--line);
}

/* The prompt keeps its lines: on a narrow screen it scrolls sideways. */
.prompt pre {
  padding: 1.4rem 1.5rem;
  font: 0.84rem/1.65 var(--mono);
  white-space: pre;
  overflow-x: auto;
}

.copy {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  padding: 0.32rem 0.8rem;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 3px;
  font: 600 0.78rem var(--sans);
  cursor: pointer;
}

.copy:hover {
  background: var(--pen);
  color: var(--on-pen);
}

.notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 3.5vw, 2.75rem);
  margin-top: clamp(2.25rem, 5vw, 3.25rem);
}

.notes p {
  margin-top: 0.5rem;
  font-size: 1rem;
  color: var(--soft);
}

.notes h3 code {
  font-size: 0.9em;
}

/* ---------- § 5: limits ---------- */

.limits {
  columns: 2;
  column-gap: clamp(2rem, 5vw, 4rem);
  margin-top: clamp(1.75rem, 4vw, 2.5rem);
}

.limits li {
  break-inside: avoid;
  padding: 0.95rem 0;
  border-top: 1px solid var(--line);
  font-size: 1rem;
  color: var(--soft);
}

.why {
  box-shadow: none;
}

/* ---------- § 6: questions ---------- */

.qa {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(2rem, 5vw, 4rem);
  margin-top: clamp(1.75rem, 4vw, 2.5rem);
}

.qa > div {
  padding: 1.1rem 0 1.25rem;
  border-top: 1px solid var(--line);
}

.qa h3 {
  text-wrap: balance;
}

.qa p {
  margin-top: 0.45rem;
  font-size: 1rem;
  color: var(--soft);
}

/* ---------- foot ---------- */

.foot {
  border-top: 1.5px solid var(--ink);
  padding-block: 2.5rem 3.5rem;
  font: 0.86rem/1.6 var(--sans);
  color: var(--soft);
}

.foot-in {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr 1fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
}

.foot .label {
  margin-bottom: 0.6rem;
}

.foot p + p {
  margin-top: 0.6rem;
}

.links {
  display: grid;
  gap: 0.25rem;
}

/* ---------- narrower screens ---------- */

@media (max-width: 62rem) {
  .hero,
  .try-grid,
  .vote-grid,
  .node-grid,
  .principle {
    grid-template-columns: minmax(0, 1fr);
  }

  .notes,
  .foot-in {
    grid-template-columns: minmax(0, 1fr);
  }

  .ballot-fig {
    max-width: 34rem;
  }
}

@media (max-width: 44rem) {
  .top nav a:not(.nav-out) {
    display: none;
  }

  .more,
  .qa {
    grid-template-columns: minmax(0, 1fr);
  }

  .limits {
    columns: 1;
  }

  .ballot,
  .rights,
  .prompt {
    box-shadow: 5px 5px 0 var(--line);
  }

  .count {
    padding-left: 1.8rem;
  }

  .vote {
    grid-template-columns: 1.05rem minmax(0, 1fr);
  }

  .vote .who {
    grid-column: 2;
  }

  .vote .what {
    grid-column: 2;
  }

  .prompt pre {
    padding-top: 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn {
    transition: none;
  }
}

@media print {
  .top,
  .cta,
  .copy {
    display: none;
  }
}
