:root {
  color-scheme: light;
  --paper: #f8f7f1;
  --ink: #171713;
  --muted: #56564f;
  --rule: #6f6f68;
  --blue: #15156f;
  --purple: #551a8b;
  --maroon: #761515;
  --green: #e4ecdf;
  --terminal: #030303;
  --terminal-ink: #f3f3ee;
}

* {
  box-sizing: border-box;
}

html {
  background: #cbd3d2;
  font-size: 16px;
}

body {
  max-width: 1180px;
  margin: 14px auto;
  padding: 18px 22px 26px;
  border: 1px solid #5e615b;
  color: var(--ink);
  background: var(--paper);
  font-family: Georgia, "Times New Roman", Times, serif;
  line-height: 1.32;
  box-shadow: 0 1px 5px rgba(40, 45, 40, 0.25);
}

a {
  color: var(--blue);
  text-decoration: underline;
}

a:visited {
  color: var(--purple);
}

a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px dotted var(--maroon);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -5rem;
  left: 1rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  color: #fff;
  background: #000;
}

.skip-link:focus {
  top: 1rem;
}

.masthead {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr) 9.25rem;
  gap: 1.25rem;
  align-items: center;
  padding: 0.25rem 0 1rem;
  border-bottom: 4px double var(--ink);
}

.document-control {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.08rem 0.55rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--ink);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.64rem;
  line-height: 1.28;
}

.document-control span {
  font-weight: bold;
}

.masthead-title {
  display: flex;
  min-width: 0;
  flex-direction: column;
  text-align: center;
}

.institution {
  order: 2;
  margin: 0.28rem 0 0;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: bold;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1 {
  order: 1;
  margin: 0;
  color: var(--maroon);
  font-family: "Times New Roman", Times, serif;
  font-size: clamp(1.65rem, 2.9vw, 2.2rem);
  line-height: 1;
  letter-spacing: 0.015em;
  white-space: nowrap;
}

.masthead-name::after {
  content: ": ";
}

.masthead-purpose {
  font-size: 0.94em;
  text-transform: uppercase;
}

.subtitle {
  order: 3;
  margin: 0.48rem auto 0.25rem;
  max-width: 46rem;
  color: #29294e;
  font-size: 0.96rem;
  font-style: italic;
}

.service-line {
  order: 4;
  margin: 0;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.67rem;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.wanix-stamp {
  padding: 0.45rem 0.25rem;
  border: 4px double #2e255d;
  color: #2e255d;
  font-family: "Times New Roman", Times, serif;
  font-weight: bold;
  line-height: 1;
  text-align: center;
  transform: rotate(-0.7deg);
}

.wanix-stamp strong {
  display: block;
  font-size: 1.72rem;
  letter-spacing: 0.08em;
}

.wanix-stamp span {
  font-size: 0.88rem;
  letter-spacing: 0.06em;
}

.status {
  color: #005800;
  font-weight: bold;
}

hr {
  height: 0;
  margin: 0.85rem 0;
  border: 0;
  border-top: 2px solid var(--ink);
}

section {
  scroll-margin-top: 1rem;
}

h2 {
  margin: 0.5rem 0 0.35rem;
  color: var(--maroon);
  font-family: "Times New Roman", Times, serif;
  font-size: 1rem;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

h3 {
  margin: 0 0 0.35rem;
  color: var(--maroon);
  font-size: 0.96rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

p {
  margin: 0.35rem 0 0.68rem;
}

code,
pre,
.odometer,
.service-meter {
  font-family: "Courier New", Courier, monospace;
}

code {
  font-size: 0.94em;
}

.notice {
  padding: 0.42rem 0.6rem;
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.58);
}

.terminal-layout {
  display: grid;
  grid-template-columns: 13.1rem minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
  padding-top: 0.25rem;
  border-top: 2px solid var(--ink);
}

.terminal-abstract {
  min-height: 100%;
  padding: 0.5rem 0.85rem 0 0.2rem;
  border-right: 1px solid var(--rule);
  font-size: 0.84rem;
}

.terminal-abstract p {
  margin-bottom: 0.82rem;
}

.terminal-abstract .endpoint {
  overflow-wrap: anywhere;
  color: var(--blue);
  font-size: 0.73rem;
}

.terminal-main {
  min-width: 0;
}

.terminal-figure {
  margin: 0.3rem 0 0;
}

.operator-note {
  font-size: 0.8rem;
}

.terminal-figure figcaption {
  margin-bottom: 0.18rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-style: italic;
}

pre.terminal,
wanix-term {
  display: block;
  margin: 0;
  color: var(--terminal-ink);
  background: var(--terminal);
  font-size: clamp(0.7rem, 1.45vw, 0.88rem);
  line-height: 1.3;
  white-space: pre;
  tab-size: 4;
}

.terminal-frame {
  height: 31rem;
  padding: 13px 15px;
  border: 2px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 3px;
  background: var(--terminal);
}

pre.terminal {
  height: 100%;
  overflow: auto;
}

wanix-term {
  width: 100%;
  height: 100% !important;
  overflow: hidden;
  padding: 0;
  border: 0;
}

#mail-system[hidden] { display: none; }

#terminal-transcript[hidden] { display: none; }

#terminal-gate { position: relative; }

#terminal-input-gate {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#terminal-input-gate[hidden] { display: none; }

#terminal-input-gate[data-state="loading"],
#terminal-input-gate[data-state="connecting"] {
  cursor: progress;
}

#terminal-gate-message {
  padding: 0.28rem 0.55rem;
  border: 1px solid #8da677;
  color: #d2efbc;
  background: rgba(4, 10, 2, 0.92);
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(0.72rem, 1.75vw, 0.9rem);
  letter-spacing: 0.02em;
  box-shadow: 0 0 0 2px rgba(4, 10, 2, 0.62);
}

#terminal-input-gate:focus-visible {
  outline: 3px dotted var(--maroon);
  outline-offset: -5px;
}

.file-tree {
  overflow-x: auto;
  margin: 0.8rem 0;
  padding: 0.6rem 0.75rem;
  border-left: 4px double var(--rule);
  background: rgba(255, 255, 255, 0.58);
  font-size: 0.88rem;
  line-height: 1.35;
}

.wanix-document-grid {
  margin-top: 0.55rem;
  border: 1px solid var(--ink);
}

.source-panel {
  min-width: 0;
}

.copy-label {
  margin: 0;
  padding: 0.26rem 0.65rem;
  border-bottom: 1px solid var(--rule);
  color: var(--blue);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.72rem;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-align: right;
  text-transform: uppercase;
}

.source-example {
  overflow-x: auto;
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 0;
  color: #171713;
  background: rgba(255, 255, 255, 0.48);
  font-size: clamp(0.64rem, 1.2vw, 0.76rem);
  line-height: 1.28;
  white-space: pre;
}

.annotated-source {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13.5rem;
}

.source-notes {
  padding: 0.55rem 0.8rem;
  border-left: 1px dashed #766d59;
  color: #35436f;
  background: #f3eed5;
  font-family: "Comic Sans MS", "Bradley Hand", cursive;
  font-size: 0.76rem;
  line-height: 1.22;
}

.source-notes p {
  position: relative;
  margin: 0.25rem 0 0.85rem;
  transform: rotate(-0.5deg);
}

.source-notes p:nth-child(even) {
  transform: rotate(0.7deg);
}

.source-notes span {
  display: inline-flex;
  width: 1.35rem;
  height: 1.35rem;
  align-items: center;
  justify-content: center;
  margin-right: 0.25rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-weight: bold;
}

.source-notes code {
  font-family: inherit;
  font-weight: bold;
}

.reader-questions {
  columns: 2 22rem;
  column-gap: 2rem;
}

.reader-questions li {
  break-inside: avoid;
  margin-bottom: 0.55rem;
}

.wanix-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.65rem 0;
  padding: 0;
  counter-reset: wanix-step;
  list-style: none;
}

.wanix-steps li {
  position: relative;
  margin: 0;
  padding: 0.4rem 0.45rem 0.4rem 1.9rem;
  border-top: 1px solid var(--rule);
  font-size: 0.76rem;
  counter-increment: wanix-step;
}

.wanix-steps li::before {
  position: absolute;
  top: 0.28rem;
  left: 0.42rem;
  color: var(--maroon);
  font-family: "Times New Roman", Times, serif;
  font-size: 1.1rem;
  font-weight: bold;
  content: counter(wanix-step);
}

.system-flow {
  padding-bottom: 0.15rem;
}

.flow-row {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) auto minmax(8rem, 1fr) minmax(11rem, 1.25fr) auto minmax(11rem, 1.2fr);
  gap: 0.55rem;
  align-items: center;
  margin: 0.6rem 0;
  padding: 0.7rem 0.2rem;
}

.flow-node {
  min-height: 5.3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border: 2px solid var(--ink);
  text-align: center;
}

.flow-node strong {
  color: var(--maroon);
  font-family: "Times New Roman", Times, serif;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.flow-node span,
.flow-node code {
  margin-top: 0.3rem;
  font-size: 0.74rem;
}

.task-node {
  border-style: double;
  border-width: 4px;
}

.namespace-node {
  border-radius: 50% / 18%;
}

.namespace-node strong {
  text-transform: none;
}

.flow-arrow {
  color: var(--ink);
  font-size: 2rem;
}

.flow-wire {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  font-family: "Courier New", Courier, monospace;
  text-align: center;
}

.flow-wire::after {
  width: 100%;
  margin-top: 0.25rem;
  border-top: 2px solid var(--ink);
  content: "";
}

.flow-wire span {
  overflow-wrap: anywhere;
  font-size: 0.63rem;
}

.authority-lesson {
  margin: 0.55rem auto 0;
  max-width: 50rem;
  color: #29294e;
  font-size: 0.86rem;
  text-align: center;
}

.table-scroll {
  overflow-x: auto;
  margin: 1rem 0;
}

table {
  border-collapse: collapse;
}

caption {
  margin-bottom: 0.25rem;
  font-weight: bold;
  text-align: left;
}

.table-scroll table,
.protocol-table {
  width: 100%;
}

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

thead th,
.protocol-table th {
  color: var(--blue);
  background: rgba(255, 255, 255, 0.45);
}

dl {
  margin: 0.5rem 0;
}

dt {
  margin-top: 0.75rem;
  font-weight: bold;
}

dd {
  margin: 0.15rem 0 0.5rem 1.6rem;
}

blockquote {
  margin: 1rem 1.5rem;
  padding-left: 1rem;
  border-left: 4px solid var(--maroon);
  font-style: italic;
}

ul {
  margin-top: 0.45rem;
}

footer {
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.service-meter {
  width: min(100%, 46rem);
  margin: 0.3rem auto 0.9rem;
  color: var(--ink);
  font-size: 0.76rem;
}

.service-meter th {
  color: var(--blue);
  background: rgba(255, 255, 255, 0.42);
}

.service-meter td {
  background: rgba(255, 255, 255, 0.65);
}

.odometer {
  display: inline-flex;
  gap: 1px;
  vertical-align: middle;
}

.odometer span {
  display: inline-block;
  min-width: 1.15em;
  padding: 0.08em 0.12em;
  border: 1px inset #949494;
  color: #e7f3db;
  background: #111;
  font-weight: bold;
  line-height: 1.25;
  text-align: center;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin: 0.85rem 0 1rem;
}

.web-badge {
  display: inline-flex;
  width: 88px;
  height: 31px;
  flex: 0 0 88px;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid #111;
  color: #fff;
  background: #303060;
  box-shadow:
    1px 1px 0 #fff,
    2px 2px 0 #777;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 8px;
  font-weight: bold;
  line-height: 1;
  text-align: left;
  text-decoration: none;
  image-rendering: pixelated;
}

.web-badge:visited {
  color: #fff;
}

.badge-icon {
  display: inline-flex;
  width: 28px;
  flex: 0 0 28px;
  align-items: center;
  justify-content: center;
  border-right: 1px solid rgba(255, 255, 255, 0.55);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: bold;
  line-height: 29px;
  text-shadow: 1px 1px 0 #000;
}

.badge-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1px 2px 0;
  white-space: nowrap;
}

.badge-copy strong {
  display: block;
  font-size: 10px;
  letter-spacing: -0.04em;
  line-height: 1;
}

.badge-copy small {
  display: block;
  margin-top: 2px;
  font-size: 6px;
  font-weight: bold;
  letter-spacing: 0.01em;
  line-height: 1;
}

.badge-netscape {
  background: #dedede;
  color: #050505;
}

.badge-netscape .badge-icon {
  border-color: #070707;
  color: #fff;
  background: #006b68;
  font-style: italic;
}

.badge-netscape .badge-copy strong {
  font-family: "Times New Roman", Times, serif;
  font-size: 11px;
}

.badge-netscape:visited {
  color: #050505;
}

.badge-any-browser {
  position: relative;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 2px;
  color: #000;
  background: #e7e7e7;
  text-align: center;
}

.badge-any-browser .badge-stripes {
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background:
    linear-gradient(
      90deg,
      #c00 0 17%,
      #e89000 17% 34%,
      #d5cf00 34% 51%,
      #087d1d 51% 68%,
      #0646a8 68% 85%,
      #662282 85%
    );
}

.badge-any-browser .badge-copy {
  flex: 0 0 20px;
  padding: 0;
}

.badge-any-browser .badge-copy strong {
  font-size: 8px;
}

.badge-any-browser .badge-copy small {
  margin: 0 0 1px;
  font-size: 5px;
}

.badge-wanix {
  color: #b9ff8c;
  background: #020500;
}

.badge-wanix .badge-icon {
  color: #b9ff8c;
  border-color: #4b9c2e;
  background: #182d10;
  font-family: "Courier New", Courier, monospace;
}

.badge-wanix .badge-copy strong {
  color: #fff;
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
}

.badge-ninep {
  color: #fff49b;
  background: #111f73;
}

.badge-ninep .badge-icon {
  color: #111f73;
  border-color: #fff49b;
  background: #fff49b;
  text-shadow: none;
}

.badge-ninep .badge-copy strong {
  font-size: 14px;
}

.badge-mh {
  color: #200500;
  background: #ffc632;
}

.badge-mh .badge-icon {
  color: #fff;
  border-color: #200500;
  background: #ae1b13;
}

.badge-mh .badge-copy strong {
  font-family: "Courier New", Courier, monospace;
  font-size: 9px;
}

.badge-no-cookies {
  color: #fff;
  background: #75316f;
}

.badge-no-cookies .badge-icon {
  color: #fff;
  border-color: #fff;
  background: #260b25;
}

.badge-no-cookies .badge-copy strong {
  font-size: 12px;
}

.badge-rc {
  color: #adff95;
  background: #061306;
}

.badge-rc .badge-icon {
  color: #adff95;
  border-color: #589a45;
  background: #102b10;
  font-family: "Courier New", Courier, monospace;
}

.badge-rc .badge-copy strong {
  color: #fff;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
}

.badge-closscraft {
  color: #ffef9b;
  background: #6f151a;
}

.badge-closscraft .badge-icon {
  color: #6f151a;
  border-color: #ffef9b;
  background: #ffef9b;
  text-shadow: none;
}

.badge-closscraft .badge-copy strong {
  color: #fff;
  font-family: "Courier New", Courier, monospace;
  font-size: 8px;
}

.badge-lukec {
  color: #fff;
  background: #1d5da8;
}

.badge-lukec .badge-icon {
  position: relative;
  align-items: flex-start;
  padding-top: 5px;
  border-color: #fff;
  color: #fff;
  background: #123d72;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 8px;
  letter-spacing: -2px;
  text-shadow: none;
}

.badge-lukec .badge-icon::after {
  position: absolute;
  top: 12px;
  left: 4px;
  content: "▰▰▰";
  font-size: 8px;
  letter-spacing: -2px;
}

.badge-lukec .badge-copy strong {
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10px;
}

.noscript {
  border: 1px solid var(--maroon);
  color: var(--maroon);
  text-align: center;
}

@media (max-width: 660px) {
  html {
    font-size: 16px;
  }

  body {
    margin: 0;
    padding: 14px 13px 26px;
    border: 0;
    box-shadow: none;
  }

  h1 {
    font-size: clamp(1.55rem, 8.8vw, 2.5rem);
    line-height: 1.02;
    white-space: normal;
  }

  .masthead-name,
  .masthead-purpose {
    display: block;
  }

  .masthead-name::after {
    content: "";
  }

  .masthead {
    grid-template-columns: minmax(0, 1fr) 8.75rem;
    gap: 0.7rem;
  }

  .masthead-title {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .document-control {
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: auto 1fr;
    font-size: 0.58rem;
  }

  .wanix-stamp {
    grid-column: 2;
    grid-row: 2;
    width: 8.75rem;
    justify-self: center;
  }

  .terminal-layout {
    grid-template-columns: 1fr;
  }

  .terminal-abstract {
    padding: 0 0 0.2rem;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .terminal-frame {
    height: 24rem;
    padding: 10px 11px;
  }

  pre.terminal,
  wanix-term {
    font-size: 0.72rem;
  }

  .wanix-steps,
  .flow-row {
    grid-template-columns: 1fr;
  }

  .annotated-source {
    grid-template-columns: 1fr;
  }

  .source-notes {
    border-top: 1px dashed #766d59;
    border-left: 0;
  }

  .wanix-steps {
    gap: 0.2rem;
  }

  .flow-row {
    justify-items: stretch;
  }

  .flow-arrow {
    line-height: 0.8;
    text-align: center;
    transform: rotate(90deg);
  }

  .flow-wire {
    padding: 0.4rem 0;
  }

  dd {
    margin-left: 0.8rem;
  }

  blockquote {
    margin-right: 0.5rem;
    margin-left: 0.5rem;
  }

  .service-meter {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
