/* Pidgin. Two inks, one container, whole pixels.
   Paper #F2EFE6, ink #111111, nothing else.
   Type scale 16 / 20 / 24 / 32 / 48 (the kit's floor is 16 px, so 12 and 14 are not used).
   Spacing scale 4 / 8 / 12 / 16 / 24 / 32 / 48.
   Every pixel object (wordmark, cards, stamps, objects, wall) is sized in JS to a whole number of DEVICE pixels per
   art pixel (js/px.js), so it stays sharp at 100%, 125% and 150% Windows scaling. */
@font-face { font-family: "Instrument Sans"; src: url(/fonts/instrumentsans.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Pixelify Sans"; src: url(/fonts/pixelifysans.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(/fonts/jetbrainsmono.woff2) format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --paper: #f2efe6;
  --ink: #111111;
  --max: 1280px;
  --pad: 32px;          /* the container's side padding: every block starts on this line */
  /* art pixel sizes in CSS px; js/px.js rounds each to whole device pixels */
  --m: 4;               /* wordmark (59 x 19 half-pixels of Pixelify Sans) */
  --s: 4;               /* cards (74 x 90) */
  --o: 2;               /* stamps (64) and field objects (45 tall) */
  --w: 3;               /* wall glyphs (8 + 3 gap) */
  --l: 1;               /* the legend's stamps (64) */
}
@media (min-width: 1600px) { :root { --max: 1440px; } }
@media (min-width: 1600px) and (min-height: 860px) { :root { --s: 5; } }
@media (min-width: 1700px) { :root { --w: 4; } }
@media (max-width: 1279px) { :root { --s: 3; } }
@media (max-width: 899px) { :root { --s: 4; } }
@media (max-width: 640px) { :root { --pad: 16px; --m: 3; --s: 3; --w: 2; } }

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); }
body {
  margin: 0; min-height: 100vh; overflow-x: hidden;
  font: 400 16px/1.5 "Instrument Sans", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; }
img.px, canvas.px { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 500; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- the head: row 1 = wordmark + tabs on one rule; row 2 = words + the CA line, one baseline ---------------- */
.head { padding-top: 32px; }
.hrow1 { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; border-bottom: 3px solid var(--ink); }
.name { margin: 0 0 12px; line-height: 0; }
.name a { display: inline-block; }
.tabs { display: grid; grid-template-columns: repeat(3, 176px); gap: 8px; }
.hrow2 { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; padding-top: 12px; }
.words { display: flex; gap: 24px; margin: 0; padding: 0; list-style: none; }
.words a {
  display: inline-block; font: 600 20px/48px "Instrument Sans", sans-serif;
  text-decoration: underline 3px transparent; text-underline-offset: 8px;
}
.words a:hover, .words a[aria-current="page"] { text-decoration-color: var(--ink); }
.words a:active { transform: translateY(1px); }
.ca { display: flex; align-items: baseline; gap: 16px; min-width: 0; }
.ca .label { font: 600 16px/48px "Instrument Sans", sans-serif; letter-spacing: 0.08em; }
.ca .field { background: var(--paper); display: inline-flex; align-items: center; height: 48px; padding: 0 16px; border: 3px solid var(--ink); min-width: 0; }
.ca .addr { font-size: 16px; line-height: 1.2; user-select: all; overflow-wrap: anywhere; }
.ca .soon { font-size: 16px; line-height: 1.2; }
.name a { position: relative; }
.cover { position: absolute; left: 0; top: 0; pointer-events: none; }

/* one control style: a 3 px ink frame on paper, 48 px tall; hover inverts, active presses, focus rings.
   A tab is the same frame with its two top corners cut: an ink shape with a paper shape 3 px inside it. */
.btn, .tab {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px;
  padding: 0 16px; color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap;
  font: 600 16px/1 "Instrument Sans", sans-serif;
}
.btn { min-width: 120px; border: 3px solid var(--ink); background: var(--paper); }
.tab { height: 51px; margin-bottom: -3px; background: var(--ink); --cut: 9px;
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%, 0 var(--cut)); }
.tab::before { content: ""; position: absolute; inset: 3px 3px 3px 3px; background: var(--paper); z-index: 0;
  clip-path: polygon(calc(var(--cut) - 2px) 0, calc(100% - var(--cut) + 2px) 0, 100% calc(var(--cut) - 2px), 100% 100%, 0 100%, 0 calc(var(--cut) - 2px)); }
.tab > * { position: relative; z-index: 1; }
.tab img { width: 20px; height: 20px; flex: none; }
.tab .short { display: none; }
.btn:hover { background: var(--ink); color: var(--paper); }
.tab:hover { color: var(--paper); }
.tab:hover::before { background: var(--ink); }
.btn:active, .tab:active { transform: translateY(1px); }
.btn[aria-disabled="true"], .tab[aria-disabled="true"] { cursor: default; }
.btn[aria-disabled="true"]:hover { background: var(--paper); color: var(--ink); }
.tab[aria-disabled="true"]:hover { color: var(--ink); }
.tab[aria-disabled="true"]:hover::before { background: var(--paper); }
.btn[aria-disabled="true"]:active, .tab[aria-disabled="true"]:active { transform: none; }

/* ---- the stage: objects | card | dots stamp dots | card | objects, centred on one axis ------------------------ */
.stage { margin-top: 32px; }
.row { display: flex; align-items: center; justify-content: center; gap: 24px; }
.objs { align-self: stretch; width: 96px; flex: none; display: flex; flex-direction: column; justify-content: space-between; align-items: center; }
.cardbox { flex: none; }
.between { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; width: 320px; flex: none; }
.between::before { content: ""; position: absolute; left: -24px; right: -24px; top: 50%; height: 4px; margin-top: -2px; background: var(--ink); }
.dots { position: relative; display: grid; grid-template-columns: repeat(8, 10px); gap: 4px; }
.dots i { width: 10px; height: 10px; border: 2px solid var(--ink); background: var(--paper); }
.dots i.on { background: var(--ink); }
.stamp { position: relative; flex: none; border-radius: 50%; background: var(--paper); }
.stamp.fall { animation: fall 240ms steps(3, end); }
@keyframes fall { from { transform: scale(1.4); } to { transform: scale(1); } }

.between { min-height: 1px; }
.packet { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; pointer-events: none; }
.dots i.run { background: var(--ink); outline: 2px solid var(--ink); outline-offset: 2px; }
.stamp.thump { animation: thump 260ms steps(3, end); }
@keyframes thump { 0% { transform: scale(1); } 40% { transform: scale(0.84) rotate(-8deg); } 100% { transform: scale(1) rotate(0); } }

/* the field objects work with the mechanic, in steps (pixel art never eases) */
.obj { transition: transform 160ms steps(2, end); }
#objPencil.busy { animation: scribble 280ms steps(2, end) infinite; }
@keyframes scribble { 0% { transform: translate(0, 0); } 50% { transform: translate(-4px, 4px); } 100% { transform: translate(0, 0); } }
#objInk.busy { animation: pulse 360ms steps(2, end) infinite; }
@keyframes pulse { 0% { transform: translateY(0); } 50% { transform: translateY(-4px); } 100% { transform: translateY(0); } }
#objLens.peek, #objLens.busy { transform: translateX(-16px); }
#objStamp.thump { animation: press 260ms steps(2, end); }
@keyframes press { 50% { transform: translateY(6px); } }

/* ---- the status line under the stage --------------------------------------------------------------------------- */
.status { background: var(--paper); display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 24px; padding: 16px 24px; border: 3px solid var(--ink); }
.status .tag { background: var(--ink); color: var(--paper); text-decoration: none; font: 700 24px/1 "Pixelify Sans", monospace; letter-spacing: 0.06em; padding: 16px 24px; }
.status .tag:hover { outline: 3px solid var(--ink); outline-offset: 3px; }
.status .mini { flex: none; }
.status .say { flex: 1 1 360px; margin: 0; font: 600 20px/1.4 "Instrument Sans", sans-serif; min-height: 28px; }
.status .actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px 16px; margin-left: auto; }
.status .next { margin: 0; font-size: 16px; max-width: 30ch; text-align: right; }
@media (max-width: 899px) { .status .actions { margin-left: 0; justify-content: flex-start; } .status .next { text-align: left; max-width: none; } }
.btn[aria-busy="true"] { cursor: progress; }

/* ---- the desk: last signs, the numbers, the legend --------------------------------------------------------------- */
.desk { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 24px; }
.block { border: 3px solid var(--ink); padding: 32px; background: var(--paper); }
.bh { font: 700 24px/1.2 "Pixelify Sans", monospace; margin: 0 0 16px; }
.ribbon { display: grid; grid-template-columns: repeat(6, max-content); gap: 8px; }
.sign { padding: 0; border: 0; background: none; cursor: pointer; line-height: 0; }
.sign:hover canvas, .sign[aria-current="true"] canvas { outline: 3px solid var(--ink); outline-offset: 2px; }
.sign:active { transform: translateY(1px); }
.stats { margin: 0; display: grid; gap: 16px; }
.stats div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.stats dt { font-size: 16px; }
.stats dd { margin: 0; font: 700 32px/1 "Pixelify Sans", monospace; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.legend li { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; font-size: 16px; }

/* page to page: a stepped wipe, the way a card is pulled from a drawer */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: wipe-out 200ms steps(4, end) both; }
::view-transition-new(root) { animation: wipe-in 240ms steps(4, end) both; }
@keyframes wipe-out { to { clip-path: inset(0 0 100% 0); } }
@keyframes wipe-in { from { clip-path: inset(100% 0 0 0); } }

/* ---- the wall --------------------------------------------------------------------------------------------- */
.wallzone { margin-top: 32px; }
.jump { position: fixed; z-index: 5; pointer-events: none; image-rendering: pixelated; }

/* ---- inner pages ------------------------------------------------------------------------------------------ */
.page { padding-bottom: 48px; }
.title { font: 700 48px/1.1 "Pixelify Sans", monospace; margin: 48px 0 16px; }
.lede { max-width: 68ch; margin: 0 0 32px; font-size: 20px; }
h2 { font: 700 32px/1.2 "Pixelify Sans", monospace; margin: 48px 0 16px; }
h3 { font: 600 20px/1.3 "Instrument Sans", sans-serif; margin: 32px 0 8px; }
.page p, .page li { max-width: 72ch; font-size: 20px; }
.ledger { width: 100%; border-collapse: collapse; }
.ledger thead tr { border-bottom: 3px solid var(--ink); }
.ledger tr { border-bottom: 1px solid var(--ink); }
.ledger th { text-align: left; font: 600 16px/1.2 "Instrument Sans", sans-serif; letter-spacing: 0.06em; padding: 12px 16px; }
.ledger td { padding: 12px 16px; vertical-align: middle; }
.ledger td.num, .ledger th.num { text-align: right; }
.ledger .g { width: 48px; height: 48px; image-rendering: pixelated; }
.mark { display: inline-block; width: 40px; height: 40px; vertical-align: middle; image-rendering: pixelated; }
.badge { display: inline-block; padding: 8px 16px; margin-left: 8px; font: 600 16px/1.3 "Instrument Sans", sans-serif; }
.badge.inv { background: var(--ink); color: var(--paper); }
.show-s { display: none; }
.more { margin-top: 32px; }
.dict { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 24px; }
.entry { border: 3px solid var(--ink); padding: 24px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.entry canvas { width: 120px; height: 120px; image-rendering: pixelated; }
.entry .n { font: 700 32px/1 "Pixelify Sans", monospace; }
.entry .t { font-size: 16px; text-align: center; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin: 24px 0 8px; }
.step { border: 3px solid var(--ink); padding: 32px; display: flex; flex-direction: column; gap: 12px; }
.step img { height: 128px; width: auto; align-self: center; image-rendering: pixelated; }
.step b { font: 700 32px/1 "Pixelify Sans", monospace; }
.step p { font-size: 16px !important; margin: 0; }
.shares { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); border-top: 3px solid var(--ink); margin: 8px 0 24px; }
.shares div { padding: 12px 24px; border-bottom: 1px solid var(--ink); display: flex; justify-content: space-between; gap: 8px; }
pre { font: 500 16px/1.6 "JetBrains Mono", monospace; white-space: pre-wrap; border: 3px solid var(--ink); padding: 24px; max-width: 900px; margin: 12px 0 24px; }
code { font: 500 max(16px, 0.9em) "JetBrains Mono", monospace; }
.lost { display: flex; gap: 48px; justify-content: center; margin: 48px 0 32px; flex-wrap: wrap; }

/* ---- tablets and phones ----------------------------------------------------------------------------------- */
@media (max-width: 1179px) { .objs { display: none; } .desk { grid-template-columns: 1fr 1fr; } .desk .block:last-child { grid-column: 1 / -1; } }
@media (max-width: 899px) {
  .desk { grid-template-columns: 1fr; }
  .desk .block:last-child { grid-column: auto; }
  .row { flex-direction: column; gap: 16px; }
  .between { width: auto; }
  .between::before { left: -16px; right: -16px; }
  .steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .hrow1 { flex-direction: column-reverse; align-items: stretch; gap: 16px; border-bottom: 0; }
  .tabs { border-bottom: 3px solid var(--ink); }
  .tabs { grid-template-columns: repeat(3, 1fr); }
  .hrow2 { flex-direction: column; align-items: stretch; gap: 0; padding-top: 4px; }
  .ca { justify-content: flex-start; }
  .ca .btn { margin-left: auto; }
}
@media (max-width: 640px) {
  .head { padding-top: 16px; }
  .tabs { gap: 4px; }
  .tab { padding: 0 16px; height: 67px; flex-direction: column; gap: 4px; }
  .tab .long { display: none; }
  .tab .short { display: inline; }
  .dots { grid-template-columns: repeat(8, 8px); gap: 3px; }
  .dots i { width: 8px; height: 8px; }
  .between { gap: 8px; }
  .ca { flex-wrap: wrap; gap: 0 12px; }
  .ca .addr { flex-basis: 100%; order: 3; line-height: 1.5; padding-bottom: 8px; }
  .title { font-size: 32px; margin-top: 32px; }
  h2 { font-size: 24px; }
  .page p, .page li, .lede { font-size: 16px; }
  .ledger .hide-s { display: none; }
  .ledger td, .ledger th { padding: 12px 4px; }
  .ledger .g { width: 40px; height: 40px; }
  .show-s { display: inline !important; }
  .steps { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .stamp.fall, .stamp.thump, .obj, .obj.busy, #objStamp.thump { animation: none !important; transition: none; }
  #objLens.peek, #objLens.busy { transform: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
