@import url("fonts.css");

:root {
  --ink: #e6e1d8;
  --ink-soft: #b3ab9f;
  --ink-faint: #857d72;
  --paper: #171614;
  --paper-raised: #1e1d1a;
  --paper-sunk: #131211;
  --rule: #33302b;
  --rule-strong: #4a453d;
  --accent: #c9b085;
  --accent-second: #c98e85;
  --accent-third: #8fb9a8;
  --accent-fourth: #9fa6cc;
  --accent-fifth: #b6c78a;
  --console: #9fb6a5;
  --console-warn: #c9a76a;
  --console-fail: #c98e85;
  --console-key: #85a8c9;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --who-col: 5rem;
  --gap: 1.5rem;
  --measure: 43rem;
  --rhythm: 2.12rem;
  --step: clamp(1rem, 0.95rem + 0.32vw, 1.15rem);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-block-start: 3rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: var(--step) / 1.6 var(--serif);
  font-variant-numeric: oldstyle-nums;
  -webkit-text-size-adjust: 100%;
}

.page {
  max-width: calc(var(--who-col) + var(--gap) + var(--measure) + 5rem);
  margin-inline: auto;
  padding: clamp(1.25rem, 4vw, 3.5rem) clamp(1rem, 4vw, 2rem) 3.5rem;
}

.skip {
  position: absolute;
  inset-inline-start: -9999px;
}

.skip:focus {
  position: static;
  display: inline-block;
  margin-block-end: 1rem;
  color: var(--accent);
}

/* ---------- masthead ---------- */

.masthead {
  border-block-end: 1px solid var(--rule-strong);
  padding-block-end: 1.25rem;
  margin-block-end: 1.25rem;
}

.masthead h1 {
  font: 600 clamp(1.5rem, 1.2rem + 1.6vw, 2.2rem) / 1.15 var(--serif);
  margin-block: 0 0.35rem;
  letter-spacing: -0.01em;
}

.masthead p {
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.masthead .dateline {
  color: var(--ink-faint);
  margin-block-start: 0.2rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

/* ---------- contents ---------- */

.contents {
  margin-block-end: 3rem;
  padding: 1rem 1.25rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 2px;
}

.contents h2 {
  margin-block: 0 0.6rem;
  font: 600 0.72rem/1 var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}

.contents ol {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 2rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  line-height: 1.9;
  counter-reset: toc;
}

.contents li {
  break-inside: avoid;
  counter-increment: toc;
}

.contents li::before {
  content: counter(toc, decimal-leading-zero) "  ";
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 0.78em;
}

@media (max-width: 34rem) {
  .contents ol {
    columns: 1;
  }
}

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

/* ---------- section separators ---------- */

.sep {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-block: var(--rhythm);
  font: 600 0.72rem/1 var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

.sep .rule {
  flex: 1 1 auto;
  height: 1px;
  background: var(--rule-strong);
}

.sep .perma {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--rule-strong);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.sep:hover .perma,
.sep .perma:focus-visible,
.sep:target .perma {
  opacity: 1;
  color: var(--accent);
}

section:target > .sep {
  color: var(--accent);
}

section:target > .sep .rule {
  background: var(--accent);
}

section:first-of-type .sep {
  margin-block-start: 0;
}

/* ---------- the exchange grid ---------- */

.exchange {
  display: grid;
  grid-template-columns: var(--who-col) minmax(0, 1fr);
  column-gap: var(--gap);
  row-gap: 1.35rem;
  align-items: baseline;
}

.turn {
  display: contents;
}

.who {
  grid-column: 1;
  margin: 0;
  font: 500 0.74rem/1.7 var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--ink-faint);
  text-align: right;
  text-wrap: balance;
}

.turn-nika .who {
  color: var(--accent);
}

.turn-vlad .who {
  color: var(--accent-second);
}

.turn-machine .who {
  color: var(--accent-third);
}

.turn-costin .who {
  color: var(--accent-fourth);
}

.turn-marla .who {
  color: var(--accent-fifth);
}

.said {
  grid-column: 2;
  max-width: var(--measure);
}

.said > p {
  margin-block: 0 0.7rem;
  text-wrap: pretty;
}

.said > :first-child,
.scene > :first-child,
.doc > :first-child {
  margin-block-start: 0;
}

.said > :last-child,
.scene > :last-child,
.doc > :last-child {
  margin-block-end: 0;
}

.said em {
  color: var(--ink-soft);
}

/* ---------- scene ---------- */

.scene {
  margin-block: var(--rhythm);
  padding-inline-start: 1rem;
  border-inline-start: 2px solid var(--rule-strong);
  color: var(--ink-soft);
}

.scene.plain {
  font-style: normal;
}

/* ---------- elicitation sheets ---------- */

.doc {
  margin-block: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-inline-start: 3px solid var(--rule-strong);
  border-radius: 2px;
  font-size: 0.94em;
}

.doc .head {
  font-family: var(--sans);
  font-size: 0.78rem;
  line-height: 1.55;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-block-end: 0.65rem;
  margin-block-end: 0.85rem;
  border-block-end: 1px solid var(--rule);
}

.doc h4 {
  margin-block: 1.1rem 0.5rem;
  font: 600 0.76rem/1.4 var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

.doc p {
  margin-block: 0 0.65rem;
}

.doc .note {
  font-style: italic;
  color: var(--ink-soft);
}

.doc blockquote {
  margin: 0.6rem 0 0.65rem;
  padding-inline-start: 0.9rem;
  border-inline-start: 2px solid var(--rule-strong);
  color: var(--ink-soft);
}

.doc cite {
  display: block;
  margin-block-start: 0.4rem;
  font-family: var(--sans);
  font-size: 0.76rem;
  font-style: normal;
  color: var(--ink-faint);
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  margin-block: 0.5rem 0.9rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  line-height: 1.5;
}
.doc table:first-child {
  margin-block: 0rem 0.5rem;
}

.doc th,
.doc td {
  text-align: start;
  vertical-align: top;
  padding: 0.4rem 0.6rem 0.4rem 0;
  border-block-end: 1px solid var(--rule);
}

.doc th {
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}

.doc td:first-child {
  font-family: var(--mono);
  color: var(--ink-faint);
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
}

/* ---------- console ---------- */

.console {
  position: relative;
  margin-block: 1rem;
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  border-radius: 2px;
}

.console > summary {
  cursor: pointer;
  padding: 0.55rem 0.9rem;
  font: 500 0.74rem/1.5 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  list-style: none;
  padding-inline-end: 5.5rem;
}

.console > summary::-webkit-details-marker {
  display: none;
}

.console > summary::before {
  content: "+ ";
  font-family: var(--mono);
  color: var(--rule-strong);
}

.console[open] > summary::before {
  content: "- ";
}

.console > summary:hover,
.console > summary:focus-visible {
  color: var(--accent-third);
}

.console[open] > summary {
  border-block-end: 1px solid var(--rule);
}

.console .wrap-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.console .wrap-label {
  position: absolute;
  inset-block-start: 0;
  inset-inline-end: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  font: 500 0.74rem/1.5 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  cursor: pointer;
  user-select: none;
}

.console .wrap-label::before {
  content: "[ ]";
  font-family: var(--mono);
  letter-spacing: 0;
  color: var(--rule-strong);
}

.console .wrap-label:hover,
.console .wrap-toggle:checked ~ .wrap-label {
  color: var(--accent-third);
}

.console .wrap-toggle:checked ~ .wrap-label::before {
  content: "[x]";
  color: var(--accent-third);
}

.console .wrap-toggle:focus-visible ~ .wrap-label {
  outline: 1px solid var(--accent-third);
  outline-offset: -1px;
}

.console:not([open]) .wrap-label {
  display: none;
}

.console pre {
  margin: 0;
  padding: 0.9rem;
  white-space: pre;
  overflow-x: auto;
  font: 400 0.8rem/1.65 var(--mono);
  color: var(--console);
  font-variant-numeric: tabular-nums;
  tab-size: 2;
}

.console .wrap-toggle:checked ~ pre {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  overflow-x: visible;
}

.console pre .hr {
  display: block;
  height: 0;
  margin-block: 0.55rem;
  border-block-start: 3px double var(--rule-strong);
}

.console pre b {
  font-weight: 400;
  color: var(--console-key);
}

.console pre i {
  font-style: normal;
  color: var(--console-warn);
}

.console pre u {
  text-decoration: none;
  color: var(--console-fail);
}

.console pre .sp-nika {
  color: var(--accent);
}

.console pre .sp-costin {
  color: var(--accent-fourth);
}

.console pre .sp-marla {
  color: var(--accent-fifth);
}

/* ---------- pagination ---------- */

.pager {
  margin-block-start: 3rem;
  padding-block-start: 1.25rem;
  border-block-start: 1px solid var(--rule-strong);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--sans);
  font-size: 0.82rem;
}

.pager .spent {
  color: var(--ink-faint);
}

.pager a {
  text-decoration: none;
}

.pager a:hover {
  text-decoration: underline;
}

@media (max-width: 40rem) {
  .exchange {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.5rem;
  }

  .turn {
    display: block;
    margin-block-end: 1.1rem;
  }

  .who {
    text-align: start;
    margin-block-end: 0.15rem;
  }

  .said {
    max-width: none;
  }
}

/* ---------- the painted panel ----------

   The glyphs on the wall are drawn from several Unicode blocks and their
   advance widths differ from the ASCII around them, so a monospace <pre>
   will not hold a column. Every glyph therefore sits in a cell of fixed
   width and the frame is drawn with borders instead of characters. The
   layout then holds whatever face the reader falls back to. */

.wall {
  --cell: 1.5em;
  --cols: 24;
  margin-block: var(--rhythm);
  overflow-x: auto;
  background: var(--paper-sunk);
  border: 2px solid var(--rule-strong);
  border-radius: 2px;
  color: var(--accent);
  font: 400 0.82rem/1 var(--mono);
}

.wall .panel {
  min-width: calc(var(--cell) * var(--cols) + 2.4rem);
  padding-inline: 1.2rem;
}

.wall .band {
  padding-block: 0.85rem;
  border-block-start: 1px dashed var(--rule-strong);
}

.wall .title {
  margin: 0;
  padding-block: 0.7rem;
  text-align: center;
  letter-spacing: 0.45em;
  text-indent: 0.45em;
  color: var(--ink);
}

.wall .label {
  margin: 0 0 0.5rem;
  letter-spacing: 0.34em;
  color: var(--ink-soft);
}

.wall .prow {
  display: flex;
  align-items: center;
  height: 1.5em;
}

.wall .prow > span {
  flex: 0 0 var(--cell);
  width: var(--cell);
  text-align: center;
}

.wall .prow > span.boxed {
  flex: 0 0 auto;
  width: auto;
}

.wall .arrow,
.wall .rule-cell {
  color: var(--ink-faint);
}

.wall .boxed {
  display: inline-flex;
  align-items: center;
  height: 1.9em;
  padding-inline: 0.3em;
  border: 1px solid var(--accent);
  border-radius: 2px;
}

.wall .boxed > span {
  flex: 0 0 var(--cell);
  width: var(--cell);
  text-align: center;
}

/* ---------- figure placeholders in reproduced documents ---------- */

.fig {
  display: block;
  margin-block: 0.6rem;
  padding: 0.55rem 0.8rem;
  border: 1px dashed var(--rule-strong);
  border-radius: 2px;
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-style: normal;
  line-height: 1.5;
}

.doc h5 {
  margin-block: 1rem 0.4rem;
  font: 600 0.8rem/1.4 var(--sans);
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}

.doc hr {
  border: 0;
  border-block-start: 1px solid var(--rule);
  margin-block: 1rem;
}
