/* The wall. One black field, cells divided by hairlines that touch, no gaps, no radius, no shadow:
   the structure is read off art/ref/wall.jpg and the numbers behind it are in NOTE.md.
   Inks measured off the same picture: black ground, white paper, a rust frame, and four signal
   colours that only ever carry a reading. */

@font-face {
  font-family: "Martian";
  src: url("/fonts/martian.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Spline";
  src: url("/fonts/spline.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ground: #000000;
  --cell: #07060a;
  --cell-lit: #0c0a12;
  --frame: #9e4d46;
  --frame-lit: #ca6053;

  --ink: #ece8f2;
  --ink-mid: #c0b9cf;
  --ink-low: #938ca2;

  --mag: #ff6ad5;
  --blue: #93a8ff;
  --green: #5fdc9f;
  --hot: #ff6a5c;

  --page: min(calc(100% - 32px), 1400px);
  --strip: 20px;          /* side inset of a title strip */
  --pad: 32px;            /* side inset of a cell body: the biggest type in it is the display */
  --rowgap: 8px;
  --inset: 18px;          /* the inset of a ruled row inside a cell body, pulled back by the same */

  --mast: "Martian", ui-monospace, "Courier New", monospace;
  --body: "Spline", ui-monospace, "Courier New", monospace;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  background: var(--ground);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.5 var(--body);
  font-synthesis: none;
  letter-spacing: 0.005em;
}

p, dl, dd, dt, ol, ul, figure, h1, h2, h3 { margin: 0; padding: 0; }
ol, ul { list-style: none; }

a { color: var(--ink); }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--frame-lit);
  color: #000000;
  padding: 12px 20px;
  font-family: var(--mast);
  z-index: 10;
}
.skip:focus { left: 16px; top: 16px; }

/* ---- the wall ------------------------------------------------------------------------------ */

.wall {
  width: var(--page);
  margin: 0 auto;
  padding: 1px;
  display: grid;
  gap: 1px;
  background: var(--frame);
  margin-top: 22px;
  margin-bottom: 40px;
}

.band { display: grid; gap: 1px; background: var(--frame); }
.cell { background: var(--cell); min-width: 0; position: relative; }

/* the filled title strip with knocked out text, his own detail */
.strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--frame-lit);
  color: #0b0a0f;
  font: 600 16px/1.2 var(--mast);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 11px var(--strip);
  min-height: 44px;
}
.strip-right {
  font-weight: 400;
  letter-spacing: 0.06em;
  text-align: right;
  text-transform: none;
}

.body { padding: 18px var(--pad) 20px; }

.label {
  font: 400 16px/1.2 var(--mast);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-low);
}

.value { font: 400 19px/1.3 var(--body); color: var(--ink); margin-top: 7px; }
.value.mag { color: var(--mag); }
.value.green { color: var(--green); }
.value.hot { color: var(--hot); }
.value.dim { color: var(--ink-low); }

/* ---- the mast ------------------------------------------------------------------------------ */

.mast { grid-template-columns: 1.7fr repeat(5, 1fr); }
.mast .cell { padding: 13px 20px 14px; }

.mark { display: flex; flex-direction: column; justify-content: center; }
.name {
  font: 800 20px/1.15 var(--mast);
  letter-spacing: 0.02em;
  color: var(--ink);
}
.ticker {
  font: 400 16px/1.2 var(--mast);
  letter-spacing: 0.14em;
  color: var(--mag);
  margin-top: 6px;
}

/* ---- the mind ------------------------------------------------------------------------------ */

.mind { grid-template-columns: minmax(0, 66fr) minmax(0, 34fr); }

.head { display: flex; flex-direction: column; }
.plate {
  position: relative;
  flex: 1;
  min-height: 360px;
  background: #000;
  overflow: hidden;
}
.plate img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  image-rendering: auto;
  opacity: 0;
  transition: opacity 120ms steps(2, end);
}
.plate img.on { opacity: 1; }

.rail { display: grid; gap: 1px; background: var(--frame); }
.mind .rail { grid-template-rows: auto 1fr; }
.stream .rail { grid-template-rows: 1fr auto; }

.display {
  font: 800 64px/0.92 var(--mast);
  letter-spacing: -0.02em;
  color: var(--mag);
  text-shadow: 0 0 22px rgba(255, 106, 213, 0.30);
  font-variant-numeric: tabular-nums;
}
.display.dim { color: var(--ink-low); text-shadow: none; }
/* the empty state of the two big numbers: a word, at a size a word can be read at */
.display.waiting { font-size: 28px; letter-spacing: 0.01em; line-height: 1.2; }
.big.waiting { font-size: 20px; }
.under { color: var(--ink-mid); margin-top: 8px; max-width: 42ch; }

.rows { margin-top: 14px; display: grid; gap: 0; }
.row {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 0;
}
/* the rule is drawn INSIDE the row rather than as its border: a bordered row would be a box of its
   own, and its text would have to keep an inch from a line that is only a hairline */
.row::before, .post::before, .move::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: rgba(158, 77, 70, 0.45);
}
.row dt { color: var(--ink-low); font-size: 16px; }
.row dd { color: var(--ink); font-size: 17px; text-align: right; font-variant-numeric: tabular-nums; }
.row dd.mag { color: var(--mag); }
.row dd.green { color: var(--green); }
.row dd.dim { color: var(--ink-low); }

.big {
  font: 600 26px/1.1 var(--mast);
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.big.dim { color: var(--ink-low); }

/* ---- the address ---------------------------------------------------------------------------- */

.address .body { padding-bottom: 26px; }

.mint-row { display: flex; align-items: stretch; gap: 14px; }
.mint {
  flex: 1;
  min-width: 0;
  background: #000;
  border: 1px solid rgba(158, 77, 70, 0.8);
  padding: 15px 20px;
  font: 400 17px/1.4 var(--body);
  color: var(--ink);
  overflow-wrap: anywhere;
  user-select: all;
  display: flex;
  align-items: center;
}
.mint.waiting { color: var(--ink-low); user-select: none; }

.keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(186px, 1fr)); gap: 12px; margin-top: 16px; }

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 22px;
  background: var(--cell-lit);
  border: 1px solid var(--frame);
  color: var(--ink);
  font: 600 16px/1.2 var(--mast);
  letter-spacing: 0.06em;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms linear, border-color 120ms linear, transform 80ms linear;
}
.key img { display: block; width: 24px; height: 24px; object-fit: contain; }
.key span { display: block; }
.key:hover, .key:focus-visible { background: #150f1c; border-color: var(--frame-lit); }
.key:active { transform: translateY(1px); }
.key.primary { background: var(--frame-lit); color: #0b0a0f; border-color: var(--frame-lit); }
.key.primary:hover { background: #d9655a; }
.key[disabled], .key[aria-disabled="true"] {
  opacity: 0.92;
  color: #a8a1b8;
  cursor: not-allowed;
  pointer-events: none;
}
/* a disabled primary key drops its fill rather than fading black ink into the rust, which is how
   a key ends up at 1.5:1 while looking dim on purpose */
.key.primary[disabled], .key.primary[aria-disabled="true"] {
  background: var(--cell-lit);
  border-color: var(--frame);
  color: #a8a1b8;
}

.key.copy { min-width: 128px; }
.key.brand { min-width: 0; justify-content: flex-start; }

/* ---- the stream ------------------------------------------------------------------------------ */

.stream { grid-template-columns: minmax(0, 66fr) minmax(0, 34fr); }

.posts { display: grid; gap: 18px; }
.post {
  position: relative;
  padding: 13px 0 12px;
}
.posts .post:first-child::before { display: none; }
.post-head {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: baseline;
  font: 400 16px/1.2 var(--mast);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-low);
  margin-bottom: 9px;
}
.post-head .who { color: var(--blue); text-transform: none; letter-spacing: 0.02em; }
.post-head .kind.breakdown { color: var(--hot); }
.post-head .kind.answer { color: var(--green); }
.post-text { color: var(--ink); max-width: 76ch; }
.post-text + .post-text { margin-top: 4px; }
.post-text .cursor {
  display: inline-block;
  width: 9px;
  height: 17px;
  background: var(--mag);
  margin-left: 4px;
  transform: translateY(2px);
  animation: blink 1.05s steps(2, end) infinite;
}
.post .asked { color: var(--ink-low); margin-bottom: 8px; }
.post.empty, .move.empty { color: var(--ink-low); }
.post.empty::before, .move.empty::before { display: none; }

@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.moves, .episodes, .answers { display: grid; gap: 0; }
.move {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  font-size: 16px;
}
.moves .move:first-child::before, .episodes .move:first-child::before, .answers .move:first-child::before { display: none; }
.move .what { color: var(--ink-mid); min-width: 0; overflow-wrap: anywhere; }
.move .when { display: block; color: var(--ink-low); margin-top: 3px; }
.move .what b { color: var(--ink); font-weight: 600; }
.move .points { font-variant-numeric: tabular-nums; white-space: nowrap; }
.move .points.down { color: var(--hot); }
.move .points.up { color: var(--green); }
.move .points.flat { color: var(--ink-low); }

/* ---- the floor -------------------------------------------------------------------------------- */

.floor { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: stretch; }
.section { display: flex; flex-direction: column; }
.section .strip { padding: 0; }
.strip-button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  padding: 11px var(--strip);
  min-height: 44px;
  cursor: pointer;
  text-align: left;
}
.strip-button:hover { background: rgba(0, 0, 0, 0.18); }
.section:not(.open) .strip { background: var(--cell-lit); color: var(--ink); }
.section:not(.open) .strip-right { color: var(--ink-low); }
.section:not(.open) .strip-button:hover { background: #150f1c; }

.shot { overflow: hidden; background: #000; height: 188px; }
.section:not(.open) .shot { flex: 1; height: auto; min-height: 188px; }
.shot img { display: block; width: 100%; height: 100%; object-fit: cover; }
.section.open .shot { height: 132px; }
.section-body { display: none; }
.section.open .section-body { display: block; }
.section.open { grid-column: 1; grid-row: 1 / span 2; }
.section:not(.open) { grid-column: 2; }

.lede { color: var(--ink-mid); max-width: 78ch; }

.steps { display: grid; gap: 16px; margin-bottom: 18px; }
.steps li { display: flex; gap: 18px; align-items: flex-start; }
.step-n {
  flex: none;
  width: 58px;
  height: 54px;
  display: grid;
  place-items: center;
  background: var(--cell-lit);
  border: 1px solid var(--frame);
  color: var(--mag);
  font: 600 18px/1 var(--mast);
}
.steps p { color: var(--ink-mid); max-width: 86ch; }
.steps b { color: var(--ink); font-weight: 600; }

/* the form */
.say { margin: 20px 0 6px; }
.field label {
  display: block;
  font: 400 16px/1.2 var(--mast);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-low);
  margin-bottom: 10px;
}
textarea {
  width: 100%;
  background: #000;
  border: 1px solid var(--frame);
  color: var(--ink);
  font: 400 17px/1.5 var(--body);
  padding: 16px 20px;
  resize: vertical;
  min-height: 92px;
}
textarea:focus-visible { outline: 2px solid var(--mag); outline-offset: 1px; }
.say-foot { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 16px; }
.say-state { color: var(--ink-low); font-size: 16px; flex: 1; min-width: 240px; }
.say-state.bad { color: var(--hot); }
.say-state.good { color: var(--green); }
.answers { margin-top: 22px; }

/* focus, everywhere, visible */
:focus-visible { outline: 2px solid var(--mag); outline-offset: 2px; }

/* ---- widths ------------------------------------------------------------------------------------ */

@media (max-width: 1180px) {
  .mast { grid-template-columns: repeat(3, 1fr); }
  .mast .mark { grid-column: 1 / -1; }
  .mind, .stream { grid-template-columns: 1fr; }
  .plate { min-height: 380px; }
  .mind .rail, .stream .rail { grid-template-rows: auto auto; }
}

@media (max-width: 900px) {
  :root { --strip: 18px; }
  .floor { grid-template-columns: 1fr; }
  .section.open, .section:not(.open) { grid-column: 1; grid-row: auto; }
  .display { font-size: 64px; }
}

@media (max-width: 640px) {
  :root { --page: calc(100% - 20px); --pad: 26px; --strip: 16px; --inset: 18px; }
  /* two columns of five readings: the last one spans both, so no cell is ever left empty */
  .mast .cell:last-child { grid-column: 1 / -1; }
  .mast .cell { padding: 11px 18px 12px; }
  .value { font-size: 17px; margin-top: 5px; }
  .wall { margin-top: 12px; }
  .mast { grid-template-columns: repeat(2, 1fr); }
  .name { font-size: 19px; }
  .display { font-size: 46px; }
  .plate { min-height: 260px; }
  .key.copy { min-width: 104px; }
  .mint-row { flex-direction: column; gap: 12px; }
  .key.copy { width: 100%; }
  .shot { height: 148px; }
  .steps li { gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .plate img { transition: none; }
  .post-text .cursor { animation: none; }
  * { scroll-behavior: auto; }
}

@media (max-width: 430px) {
  /* the agent's strip carries its band, which the mast already prints: at this width the word
     would wrap the strip into two lines */
  .head .strip .strip-right { display: none; }
}
