/* Ransom Coin. The page is one head-up display glass over a night approach, painted.
   Every colour, stroke and proportion here was measured off art/ref/hud.jpg (see NOTE.md). */

@font-face {
  font-family: "Routed";
  src: url("../assets/fonts/routed-gothic.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "RoutedN";
  src: url("../assets/fonts/routed-gothic-narrow.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "B612";
  src: url("../assets/fonts/B612-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "B612";
  src: url("../assets/fonts/B612-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  /* measured off the painting: ground #101610, ink mean #84c665, hottest strokes near #c9ff9a */
  --ground: #101610;
  --ground-deep: #080c08;
  --ink-hot: #e2ffc4;   /* the display and the lit values */
  --ink: #c9ff9a;       /* values */
  --ink-mid: #84c665;   /* labels, 9.0:1 on the ground */
  --ink-dim: #5f9144;   /* separators and disabled controls, 4.9:1 on the ground */

  --face: "Routed", "RoutedN", system-ui, sans-serif;
  --faceN: "RoutedN", "Routed", system-ui, sans-serif;
  /* the value face: B612, drawn for cockpit screens, tabular figures */
  --mono: "B612", ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* one scale, nothing off it */
  --t-display: 60px;
  --t-value: 26px;
  --t-title: 20px;
  --t-mono: 16px;
  --t-body: 15px;
  --t-label: 14px;

  --page: 1120px;
  --gut: 24px;
  --rail: 232px;
  --row: 44px;
  --band: 56px;
  --tape-deg: 22px;     /* one degree of heading = 34 px of tape */
}

* { box-sizing: border-box; }
/* every display rule in this file would otherwise beat the hidden attribute */
[hidden] { display: none !important; }

html { background: var(--ground-deep); }

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink-mid);
  font-family: var(--mono);
  font-size: var(--t-body);
  line-height: 1.6;
  background-color: var(--ground);
  background-image: url("../assets/img/glass.webp");
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ---- the approach: the painted field the whole page stands on ------------- */
.field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 30%, #000 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 30%, #000 100%);
}
.field img {
  position: absolute;
  left: 50%; bottom: -14%;
  width: min(1460px, 112vw);
  transform: translateX(-50%);
  opacity: .64;
  animation: approach 48s linear infinite;
  transform-origin: 50% 36%;
}
/* the only motion on the page, and it is the thing the page is about: the glass is closing on
   the date, so the scene behind it creeps nearer and starts again */
@keyframes approach {
  from { transform: translateX(-50%) scale(1); }
  to { transform: translateX(-50%) scale(1.075); }
}
.field canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.field::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(116% 74% at 50% 80%,
    rgba(8, 12, 8, 0) 0%, rgba(8, 12, 8, .28) 40%, rgba(8, 12, 8, .80) 64%, rgba(8, 12, 8, .95) 100%);
}

/* ---- the glass: everything the instrument prints ------------------------- */
.glass {
  position: relative;
  z-index: 1;
  width: min(100%, calc(var(--page) + var(--gut) * 2));
  margin: 0 auto;
  padding: 28px var(--gut) 64px;
}

/* masthead: one line, the page's own lettering, name left, ident right */
.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
}

/* the rule under the masthead is a rule, not a frame: the name above it is a line of lettering
   on the glass and it starts at the column's own edge, the way the painting's does */
.hr {
  height: 1px;
  background: color-mix(in srgb, var(--ink-dim) 55%, transparent);
}
.masthead .name {
  font-family: var(--face);
  font-size: var(--t-title);
  letter-spacing: .06em;
  color: var(--ink);
}
.masthead .ident {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: .04em;
  color: var(--ink-mid);
  white-space: nowrap;
}

/* ---- the heading tape: the navigation ------------------------------------ */
.tape {
  position: relative;
  margin-top: 18px;
  height: 118px;
  overflow: hidden;
}
.tape-window { position: absolute; inset: 0; overflow: hidden; }
.tape-strip {
  position: absolute;
  left: 50%;
  top: 0;
  height: 100%;
  transition: transform .42s cubic-bezier(.22, .61, .36, 1);
  will-change: transform;
}
.tape-ticks {
  position: absolute;
  left: 0; right: 0; bottom: 18px;
  height: 34px;
  background-image: url("../assets/img/tape.png");
  background-repeat: repeat-x;
  background-size: auto 34px;
  opacity: .9;
}
.hdg {
  position: absolute;
  bottom: 56px;
  transform: translateX(-50%);
  display: block;
  padding: 6px 12px;
  font-family: var(--face);
  font-size: var(--t-label);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mid);
  text-decoration: none;
  white-space: nowrap;
  transition: color .18s ease, transform .18s ease;
}
.hdg .deg {
  display: block;
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: .02em;
  color: var(--ink-mid);
  text-align: center;
}
.hdg:hover, .hdg:focus-visible { color: var(--ink-hot); }
.hdg[aria-current="page"] { color: var(--ink-hot); }
.hdg[aria-current="page"] .deg { color: var(--ink); }

/* the fixed index the tape runs under */
.tape-index { transition: transform .42s cubic-bezier(.22,.61,.36,1);
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 26px;
  height: 52px;
  transform: translateX(-50%);
  background: url("../assets/img/caret.png") no-repeat center bottom / contain;
  pointer-events: none;
}

/* ---- the instrument body ------------------------------------------------- */
.body {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr) var(--rail);
  gap: 20px;
  margin-top: var(--band);
  align-items: stretch;
}

/* a rail is a ladder plus the box that rides it */
.rail { position: relative; min-height: 420px; }
.rail .rail-head {
  text-shadow: 0 0 2px rgba(6, 10, 6, 1), 0 0 6px rgba(6, 10, 6, 1), 0 0 12px rgba(6, 10, 6, .98), 0 0 20px rgba(6, 10, 6, .9);
  font-family: var(--face);
  font-size: var(--t-label);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mid);
  margin-bottom: 12px;
}
.rail-right .rail-head { text-align: right; }
.ladder {
  position: absolute;
  top: 34px; bottom: 0;
  width: 36px;
  background-image: url("../assets/img/ladder.png");
  background-repeat: repeat-y;
  background-size: 36px auto;
  opacity: .92;
}
.rail-left .ladder { right: 0; }
.rail-right .ladder { left: 0; }

.ride {
  position: absolute;
  top: 50%;
  width: auto;
  min-width: 168px;
  max-width: calc(var(--rail) - 24px);
  height: 62px;
  display: flex;
  align-items: center;
  transition: top .5s cubic-bezier(.22, .61, .36, 1);
}
.rail-left .ride { right: 24px; justify-content: flex-end; padding: 0 38px 0 18px; background: url("../assets/img/box-right.png") no-repeat center / 100% 100%; }
.rail-right .ride { left: 24px; justify-content: flex-start; padding: 0 18px 0 38px; background: url("../assets/img/box-left.png") no-repeat center / 100% 100%; }
.ride .v {
  font-family: var(--mono);
  font-size: var(--t-value);
  line-height: 1;
  color: var(--ink-hot);
  white-space: nowrap;
}
.ride .u { font-size: var(--t-label); color: var(--ink); margin-left: 8px; }

/* the small marks printed up the ladder */
.rail .mark {
  position: absolute;
  text-shadow: 0 0 2px rgba(6, 10, 6, 1), 0 0 6px rgba(6, 10, 6, 1), 0 0 12px rgba(6, 10, 6, .98), 0 0 20px rgba(6, 10, 6, .9);
  font-family: var(--mono);
  font-size: var(--t-label);
  color: var(--ink-mid);
  transform: translateY(-50%);
}
.rail-left .mark { right: 44px; }
.rail-right .mark { left: 44px; }

.rail .foot {
  position: absolute;
  text-shadow: 0 0 2px rgba(6, 10, 6, 1), 0 0 6px rgba(6, 10, 6, 1), 0 0 12px rgba(6, 10, 6, .98), 0 0 20px rgba(6, 10, 6, .9);
  left: 0; right: 0; bottom: -46px;
  line-height: 1.4;
  font-family: var(--mono);
  font-size: var(--t-label);
  color: var(--ink-mid);
}
.rail-right .foot { text-align: right; left: 46px; }
.rail-left .foot { right: 46px; }

/* ---- the centre: the state of the thing ---------------------------------- */
.centre { display: flex; flex-direction: column; gap: 26px; }

.note {
  position: relative;
  background-color: rgba(9, 13, 9, .74);
  padding: 26px 34px 28px;
  border-image: url("../assets/img/note.png") 70 110 86 110 fill / 35px 55px 43px 55px / 0 stretch;
}
.note .k {
  font-family: var(--face);
  font-size: var(--t-label);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mid);
  margin: 0 0 10px;
}
.note .demand .mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0; }
.note .demand {
  font-family: var(--face);
  font-size: var(--t-title);
  line-height: 1.35;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-hot);
  margin: 0;
}
.note .sub { margin: 12px 0 0; font-size: var(--t-body); color: var(--ink-mid); }

.display { text-align: center; padding: 10px 0 4px; }
.display .k {
  text-shadow: 0 0 2px rgba(6, 10, 6, 1), 0 0 8px rgba(6, 10, 6, .9);
  font-family: var(--face);
  font-size: var(--t-label);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mid);
  margin: 0 0 10px;
}
.display .t {
  font-family: var(--mono);
  font-size: var(--t-display);
  line-height: 1;
  letter-spacing: .02em;
  color: var(--ink-hot);
  margin: 0;
  text-shadow: 0 0 22px rgba(146, 230, 110, .42);
}
.display .sub { margin: 12px 0 0; font-size: var(--t-body); color: var(--ink-mid); text-shadow: 0 0 2px rgba(6, 10, 6, 1), 0 0 8px rgba(6, 10, 6, .9); }

/* a row of the instrument: a painted frame with a label column and a value column */
.rows { display: flex; flex-direction: column; gap: 10px; }
.row {
  background-color: rgba(9, 13, 9, .80);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: var(--row);
  padding: 10px 24px;
  border-image: url("../assets/img/plate.png") 48 70 48 70 fill / 24px 35px 24px 35px / 0 stretch;
}
.row .k {
  font-family: var(--face);
  font-size: var(--t-label);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mid);
  min-width: 0;
}
.row .v {
  font-family: var(--mono);
  font-size: var(--t-mono);
  color: var(--ink);
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}
.row .v.hot { color: var(--ink-hot); }
.row .v.off { color: var(--ink-dim); }

.title {
  font-family: var(--face);
  font-size: var(--t-title);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 16px;
}
p { margin: 0 0 14px; max-width: 72ch; }
a { color: var(--ink); }
a:focus-visible, button:focus-visible, .hdg:focus-visible, input:focus-visible {
  outline: 2px solid var(--ink-hot);
  outline-offset: 3px;
}

/* ---- the two stacks under the body --------------------------------------- */
.stacks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: var(--band);
}
.stack .title { font-size: var(--t-label); color: var(--ink-mid); text-shadow: 0 0 2px rgba(6, 10, 6, 1), 0 0 6px rgba(6, 10, 6, 1), 0 0 12px rgba(6, 10, 6, .98), 0 0 20px rgba(6, 10, 6, .9); }

/* ---- the floor of the glass ---------------------------------------------- */
.floor {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: 24px;
  margin-top: var(--band);
  align-items: end;
}
.clock .k {
  font-family: var(--face);
  font-size: var(--t-label);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mid);
  margin: 0 0 6px;
}
.clock .t {
  font-family: var(--mono);
  font-size: var(--t-value);
  line-height: 1.15;
  color: var(--ink);
  margin: 0;
}
.clock .sub { font-size: var(--t-label); color: var(--ink-mid); margin: 6px 0 0; }

/* the station block: the call sign of this token and the four keys that reach it */
.station { padding: 0; }
.station .k {
  font-family: var(--face);
  font-size: var(--t-label);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mid);
  margin: 0 0 10px;
}
.ca-line { display: flex; gap: 12px; align-items: stretch; }
.ca {
  background-color: rgba(9, 13, 9, .80);
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 12px 24px;
  font-family: var(--mono);
  font-size: var(--t-mono);
  color: var(--ink-hot);
  overflow-wrap: anywhere;
  user-select: all;
  border-image: url("../assets/img/plate.png") 48 70 48 70 fill / 24px 35px 24px 35px / 0 stretch;
}
.ca.empty { color: var(--ink-dim); user-select: none; }

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 22px;
  background: url("../assets/img/key.png") no-repeat center / 100% 100%;
  font-family: var(--face);
  font-size: var(--t-label);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border: 0;
  cursor: pointer;
  transition: transform .08s ease, color .18s ease, filter .18s ease;
}
.key:hover, .key:focus-visible { color: var(--ink-hot); filter: brightness(1.12); }
.key:active { transform: translateY(2px); }
.key[aria-disabled="true"], .key:disabled { opacity: .74; cursor: default; color: var(--ink-mid); }
.key[aria-disabled="true"]:active { transform: none; }
/* the marks are matched by optical size, not by box size */
.key img { height: 18px; width: auto; display: block; }
.key img.m-dex { height: 20px; }
.key img.m-scan { height: 19px; }
.key img.m-x { height: 21px; }
.keys .key { padding: 0 18px; gap: 8px; }
.key.copy { flex: 0 0 auto; min-width: 128px; }

/* minmax(0, 1fr) or the longest platform name sets the width of the whole block and pushes the
   page sideways on a phone */
.keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }

/* ---- lists (locks, payouts) ---------------------------------------------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  background-color: rgba(9, 13, 9, .80);
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) minmax(0, 150px) minmax(0, 160px) 108px;
  gap: 16px;
  align-items: center;
  min-height: var(--row);
  padding: 12px 24px;
  border-image: url("../assets/img/plate.png") 48 70 48 70 fill / 24px 35px 24px 35px / 0 stretch;
  font-family: var(--mono);
  font-size: var(--t-mono);
  color: var(--ink);
}
.item .n { color: var(--ink-hot); }
.item .d { color: var(--ink-mid); white-space: nowrap; }
.item .a { text-align: right; }
.item .link { text-align: right; }
.list-head {
  display: grid;
  grid-template-columns: 40px 124px minmax(0, 1fr) minmax(0, 1fr) 92px;
  gap: 12px;
  padding: 0 24px 8px;
  font-family: var(--face);
  font-size: var(--t-label);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mid);
}
.list-head .a, .list-head .link { text-align: right; }
.empty-state {
  background-color: rgba(9, 13, 9, .80);
  padding: 26px 30px;
  font-size: var(--t-body);
  color: var(--ink-mid);
  border-image: url("../assets/img/plate.png") 48 70 48 70 fill / 24px 35px 24px 35px / 0 stretch;
}

/* ---- forms (check an address) -------------------------------------------- */
.ask { display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; }
.ask input {
  background-color: rgba(9, 13, 9, .80);
  flex: 1 1 320px;
  min-width: 0;
  padding: 12px 22px;
  background: transparent;
  color: var(--ink-hot);
  font-family: var(--mono);
  font-size: var(--t-mono);
  border: 0;
  border-image: url("../assets/img/plate.png") 48 70 48 70 fill / 24px 35px 24px 35px / 0 stretch;
}
.ask input::placeholder { color: var(--ink-dim); }

.steps { counter-reset: step; display: flex; flex-direction: column; gap: 16px; }
.step {
  background-color: rgba(9, 13, 9, .80);
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 20px;
  padding: 20px 28px;
  border-image: url("../assets/img/plate.png") 48 70 48 70 fill / 24px 35px 24px 35px / 0 stretch;
}
.step .n { font-family: var(--mono); font-size: var(--t-value); color: var(--ink-hot); line-height: 1.1; }
.step h3 {
  font-family: var(--face);
  font-size: var(--t-label);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 8px;
}
.step p { margin: 0; color: var(--ink-mid); }

.caution { margin-top: 22px; font-size: var(--t-label); color: var(--ink-mid); }
.caution:empty { display: none; margin: 0; }
.title.after { margin-top: 40px; }
.rows.tight { margin-top: 16px; }
.after-sm { margin-top: 22px; }
form.ask { margin-bottom: 0; }

.cross {
  position: absolute;
  left: 50%; top: 42%;
  width: 180px; height: 190px;
  transform: translate(-50%, -50%);
  background: url("../assets/img/cross.png") no-repeat center / contain;
  opacity: .5;
  pointer-events: none;
}

/* ---- narrow screens: the instrument folds, it never shrinks --------------- */
@media (max-width: 1080px) {
  :root { --rail: 190px; --t-display: 52px; }
}
@media (max-width: 1100px) {
  :root { --t-display: 44px; --t-value: 22px; --gut: 18px; }
  /* the instrument folds into one column, and the thing the page is about comes first */
  .body { display: flex; flex-direction: column; gap: 26px; }
  .centre { order: 0; }
  .rail-left { order: 1; }
  .rail-right { order: 2; }
  .rail { min-height: 0; padding: 0; }
  .ladder { display: none; }
  .rail .ride, .rail-left .ride, .rail-right .ride {
    position: static;
    width: 100%;
    height: 56px;
    justify-content: flex-start;
    padding: 0 48px 0 26px;
    background-image: url("../assets/img/box-right.png");
  }
  .rail .mark { display: none; }
  .rail .foot { position: static; margin-top: 10px; text-align: left; }
  .rail-right .rail-head, .rail-right .foot { text-align: left; }
  .stacks { grid-template-columns: 1fr; }
  .floor { grid-template-columns: 1fr; align-items: stretch; }
  .keys { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item, .list-head { grid-template-columns: 36px minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .item .a2, .list-head .a2, .item .link, .list-head .link { display: none; }
  .cross { display: none; }
}
@media (max-width: 760px) {
  /* the sections sit closer on a phone: at 40 px apart the page grew bands of nothing */
  .title.after { margin-top: 26px; }
  .row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .row .v { text-align: left; }
}
@media (max-width: 480px) {
  /* four keys, one under another: at this width two of them cannot hold a platform's name */
  .keys { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  :root { --t-display: 38px; --gut: 18px; }
  .masthead { flex-direction: column; align-items: flex-start; gap: 4px; }
  .ca-line { flex-direction: column; }
  .key.copy { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* the tape on a narrow screen: the same ticks, the words staggered on two baselines so five
   headings still fit without any of them falling off the instrument */
@media (max-width: 1100px) {
  .tape { height: 124px; }
  .tape-strip {
    position: absolute;
    left: 0; right: 0;
    display: flex;
    justify-content: space-between;
    transform: none !important;
  }
  .hdg {
    position: static;
    transform: none !important;
    bottom: auto;
    padding: 4px 2px;
    font-family: var(--faceN);
    letter-spacing: .04em;
  }
  .tape-ticks { left: -40px !important; right: -40px; width: auto !important; bottom: 14px; height: 28px; background-size: auto 28px; }
  .tape-index { bottom: 8px; height: 38px; width: 22px; }
}
