/* Leftpad. The world is the one Vadim drew: an isometric voxel yard on a coral, cyan and amber
   checkerboard, where a package is a tied parcel and what stands on it is a tree. Everything the
   page says is printed on the parcel's own kraft label.
   The information design (the numbered chips, the ruled sheets, a share drawn as a run of cells)
   comes from the deck he dropped first; the world, the palette and the material come from his own art. */

@font-face {
  font-family: "Pixeloid";
  src: url("../fonts/PixeloidSans.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Pixeloid";
  src: url("../fonts/PixeloidSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Chillax";
  src: url("../fonts/Chillax-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Chillax";
  src: url("../fonts/Chillax-Semibold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --coral: #f87078;
  --cyan: #28c8d0;
  --amber: #f8b850;

  --kraft: #f3e5cf;
  --kraft-2: #e6d2b4;
  --kraft-3: #d4bc98;
  --ink: #40220f;
  --ink-2: rgba(64, 34, 15, 0.68);
  --ink-3: rgba(64, 34, 15, 0.42);

  --wood: #e09048;
  --wood-top: #f3c178;
  --wood-dark: #a4572f;
  --leaf: #4fa01f;
  --leaf-br: #90e840;

  --cell: 34px;
  --pad: 40px;
  --px: "Pixeloid", "Courier New", monospace;
  --sans: "Chillax", system-ui, sans-serif;
  --edge: 4px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* the ground before the canvas has painted, and under it at any height: his three colours,
     so there is never a flash of a flat fill */
  background-color: var(--amber);
  background-image:
    linear-gradient(45deg, var(--coral) 25%, transparent 25%, transparent 75%, var(--coral) 75%),
    linear-gradient(45deg, var(--cyan) 25%, transparent 25%, transparent 75%, var(--cyan) 75%);
  background-size: 164px 164px;
  background-position: 0 0, 82px 82px;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 19px;
  line-height: 1.6;
  font-synthesis: none;
  overflow-x: hidden;
}

/* the ground: his checkerboard, softened the way a photographed wall is, and slowly alive */
#field {
  position: fixed;
  left: -48px;
  top: -48px;
  width: calc(100vw + 96px);
  height: calc(100vh + 96px);
  z-index: 0;
  pointer-events: none;
  filter: blur(1.6px) saturate(1.02);
}
#drift { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5; }

#page { position: relative; z-index: 1; }

a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: none; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* ------------------------------------------- the label every board is printed on */

.deck {
  width: min(1340px, calc(100vw - 168px));
  margin: 0 auto;
  padding: 40px 0 88px;
  display: flex;
  flex-direction: column;
  gap: 60px;
}

.board {
  position: relative;
  padding: var(--pad);
  min-width: 0;
  background-color: var(--kraft);
  border: 18px solid transparent;
  border-image: url("/assets/img/label.png") 18 fill / 18px / 0 stretch;
  box-shadow: 12px 14px 0 rgba(64, 34, 15, 0.26);
}
.board > * { position: relative; z-index: 1; }
.board > canvas.marks { display: none; }

/* the one board that is not paper: the crate the coin itself is in, so the contract and the four
   keys stand on an object of the world rather than on a label */
.board--crate {
  background-color: var(--wood);
  background-image:
    repeating-linear-gradient(90deg, rgba(64,34,15,0.10) 0 2px, transparent 2px 34px),
    repeating-linear-gradient(0deg, rgba(64,34,15,0.07) 0 2px, transparent 2px 34px);
  border-image: none;
  border: var(--edge) solid var(--ink);
}
.board--crate .board__head em { color: var(--kraft); }
.board--crate .board__note { color: rgba(64, 34, 15, 0.8); }
.board--crate .json { color: rgba(64, 34, 15, 0.82); }
.board--crate .json b { color: #6d3720; }
.board--crate .key { background: var(--kraft); }
.board--crate .key--primary { background: var(--leaf-br); }

/* the kraft tag a parcel carries, hanging off the label's top edge */
.board__tab {
  position: absolute;
  top: -22px;
  left: 30px;
  z-index: 2;
  background: var(--ink);
  color: var(--kraft);
  padding: 9px 20px;
  font-family: var(--px);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

.board__nav { display: flex; justify-content: flex-start; margin-bottom: 30px; }
.mast .board__nav { margin-bottom: 0; }
@media (max-width: 760px) { .board__nav { margin-bottom: 22px; } }

.board__head {
  font-family: var(--px);
  font-weight: 700;
  font-size: 36px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 0 0 10px;
  color: var(--ink);
}
.board__head em { font-style: normal; color: var(--wood-dark); }
.board__note {
  font-size: 18px;
  color: var(--ink-2);
  margin: 0 0 28px;
  max-width: 68ch;
}

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

.mast { text-align: center; }

.wordmark { margin: 20px 0 0; }
.wordmark img { display: block; width: min(680px, 84%); height: auto; margin: 0 auto; }
.wordmark--text {
  font-family: var(--px);
  font-weight: 700;
  font-size: clamp(40px, 6.4vw, 92px);
  line-height: 1;
  color: var(--wood-dark);
  margin: 20px 0 0;
}
.mast__ticker {
  display: inline-block;
  margin-top: 16px;
  background: var(--ink);
  color: var(--kraft);
  font-family: var(--px);
  font-weight: 700;
  font-size: 27px;
  letter-spacing: 0.04em;
  padding: 15px 30px;
}
.mast__story { margin: 24px auto 0; max-width: 66ch; font-size: 19px; color: var(--ink-2); }
.mast__line {
  margin: 20px auto 0;
  max-width: 56ch;
  font-family: var(--px);
  font-weight: 700;
  font-size: 27px;
  line-height: 1.5;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.mast__form { margin-top: 28px; max-width: 720px; margin-left: auto; margin-right: auto; text-align: left; }

/* the yard: the live parcel and its tree, drawn as voxels */
.yard { display: block; width: 100%; height: auto; margin: 10px 0 -14px; }

/* ------------------------------------------------------------ nav chips */

.chips { display: flex; flex-wrap: wrap; gap: 12px 26px; align-items: center; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 0 14px 0 0;
  cursor: pointer;
  font-family: var(--px);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}
.chip__n {
  display: grid;
  place-items: center;
  min-width: 66px;
  height: 56px;
  padding: 0 18px;
  background: var(--wood);
  color: var(--ink);
  border: var(--edge) solid var(--ink);
  font-size: 18px;
}
.chip:hover .chip__n { background: var(--wood-top); }
.chip[aria-current="page"] .chip__n { background: var(--leaf-br); }

/* ------------------------------------------------------------- controls */

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 56px;
  padding: 13px 26px;
  text-align: center;
  border: var(--edge) solid var(--ink);
  background: var(--kraft-2);
  color: var(--ink);
  font-family: var(--px);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 5px 6px 0 rgba(64, 34, 15, 0.9);
  transition: transform 70ms linear, box-shadow 70ms linear, background 90ms linear;
}
.key:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--wood-top); }
.key:active:not(:disabled):not([aria-disabled="true"]) { transform: translate(5px, 6px); box-shadow: 0 0 0 rgba(64, 34, 15, 0.9); }
.key--primary { background: var(--leaf-br); }
.key--primary:hover:not(:disabled) { background: #a8f55e; }
.key:disabled, .key[aria-disabled="true"] {
  color: var(--ink-3);
  border-color: var(--ink-3);
  background: var(--kraft-3);
  box-shadow: none;
  cursor: not-allowed;
}
.key__mark { width: 22px; height: 22px; display: block; flex: 0 0 auto; }

.field {
  display: flex;
  min-height: 56px;
  border: var(--edge) solid var(--ink);
  background: var(--kraft);
  min-width: 0;
}
.field > span {
  display: grid;
  place-items: center;
  padding: 0 18px;
  background: var(--wood);
  border-right: var(--edge) solid var(--ink);
  font-family: var(--px);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  white-space: nowrap;
}
.field input, textarea, input[type="number"] {
  flex: 1;
  min-width: 0;
  padding: 14px 18px;
  background: transparent;
  border: none;
  color: var(--ink);
  font-family: var(--px);
  font-weight: 400;
  font-size: 20px;
  line-height: 1.5;
}
.field input::placeholder { color: var(--ink-3); }
.field input:focus, textarea:focus, input[type="number"]:focus { outline: none; }
.field:focus-within { box-shadow: 4px 5px 0 rgba(64, 34, 15, 0.9); }
textarea { resize: vertical; width: 100%; }

/* --------------------------------------------------------------- tables */

.sheet { width: 100%; border-collapse: collapse; font-family: var(--px); }
.sheet th, .sheet td {
  padding: 15px 22px;
  text-align: left;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-left: 2px solid var(--kraft-3);
  white-space: nowrap;
  color: var(--ink);
}
.sheet th:first-child, .sheet td:first-child { border-left: none; }
.sheet thead th {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0;
  color: var(--ink-2);
  text-transform: none;
  padding: 16px 22px;
  border-top: 3px solid var(--ink);
}
.sheet tbody td.num { color: var(--wood-dark); }
.sheet tbody td.pkg { font-size: 20px; }
.sheet tbody tr.row--link { cursor: pointer; }
.sheet tbody tr.row--link:hover td { background: var(--kraft-2); }
.sheet tbody tr.row--example td { color: var(--ink-3); }
.sheet--footcap thead { display: table-footer-group; }

.scrollx { overflow-x: auto; overscroll-behavior-x: contain; }

/* --------------------------------------------------------------- blocks */

.note {
  border: 3px dashed var(--ink-3);
  background: var(--kraft-2);
  padding: 26px 32px;
  text-align: center;
  font-size: 18px;
  color: var(--ink-2);
}
.note strong { color: var(--ink); font-weight: 600; }

.rows { display: flex; flex-direction: column; margin: 0; }
.rowline {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 24px;
  padding: 18px 0;
  min-width: 0;
}
.rowline::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: var(--kraft-3);
}
.rowline:first-child::before { display: none; }
.rowline dt {
  flex: 0 0 240px;
  font-family: var(--px);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.rowline dd { margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; }

.cols { display: grid; gap: 40px; grid-template-columns: 1fr 1fr; align-items: stretch; }
.cols > * { min-width: 0; }

.kicker {
  font-family: var(--px);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--wood-dark);
  margin: 0 0 14px;
}

.big { font-family: var(--px); font-weight: 700; font-size: 45px; line-height: 1.1; color: var(--ink); }

/* ------------------------------------------------------------ the split */

.split { display: flex; flex-direction: column; gap: 20px; }
.split__cells { display: flex; gap: 4px; align-items: stretch; }
.split__cells i { flex: 1 1 0; height: 34px; border: 2px solid var(--ink); }
.split__cells i.edge { margin-right: 26px; }
.split__legend { display: flex; flex-wrap: wrap; gap: 14px 34px; margin: 0; padding: 0; }
.split__legend li { display: flex; align-items: center; gap: 12px; list-style: none; }
.split__legend b { font-family: var(--px); font-weight: 700; font-size: 27px; color: var(--ink); }
.split__legend span { font-size: 17px; color: var(--ink-2); }
.split__legend u { display: block; width: 20px; height: 20px; border: 2px solid var(--ink); text-decoration: none; }

.sc { background: var(--leaf-br); }
.sc--a { background: var(--leaf-br); }
.sc--b { background: var(--leaf); }
.sc--c { background: var(--amber); }
.sc--d { background: var(--coral); }

/* ------------------------------------------------------------- the tree */

.trail { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.trail__node { padding: 20px 0 22px 0; }
.trail__node:first-child { padding-top: 0; }
.trail__rule { border: none; height: 2px; margin: 0; background: var(--kraft-3); }
.trail__node--dep { padding-left: 38px; position: relative; }
.trail__node--dep::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--wood-dark);
}
.trail__node--dep::after {
  content: "";
  position: absolute;
  left: 0; top: 30px;
  width: 24px; height: 4px;
  background: var(--wood-dark);
}

.trail__head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.trail__pkg {
  font-family: var(--px);
  font-weight: 700;
  font-size: 27px;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}
a.trail__pkg:hover { color: var(--wood-dark); text-decoration: underline; }
.trail__dl { font-size: 16px; color: var(--ink-2); }
.trail__pct { margin-left: auto; font-family: var(--px); font-weight: 700; font-size: 27px; color: var(--wood-dark); }
.trail__foot { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.trail__role {
  font-family: var(--px);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.trail__who { font-size: 17px; color: var(--leaf); font-weight: 600; text-decoration: none; }
a.trail__who:hover { text-decoration: underline; }
.trail__who--none { color: var(--ink-3); }
.trail__who--flat { color: var(--ink-2); }

/* the share, as a run of the world's own cubes */
.run { display: flex; gap: 3px; margin: 14px 0 2px; min-width: 0; }
.run i { display: block; flex: 0 1 15px; height: 18px; min-width: 3px; background: var(--leaf); border: 2px solid var(--ink); }
.run--launcher i, .run--pad i { background: var(--amber); }
.run i.h0 { background: #d8ff86; }
.run i.h1 { background: var(--leaf-br); }
.run i.h2 { background: #6fc62c; }
.run i.h3 { background: var(--leaf); }

/* ------------------------------------------------------- package.json */

.json {
  font-family: var(--px);
  font-weight: 400;
  font-size: 20px;
  line-height: 1.9;
  margin: 0;
  color: var(--ink-2);
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.json b { color: var(--wood-dark); font-weight: 700; }
.json var { color: var(--ink); font-style: normal; }
.json .pending { color: var(--ink-3); }

.keys { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 32px; }

/* --------------------------------------------------------- the steps */

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 44px; }
.steps li { display: grid; grid-template-columns: 66px 1fr 460px; gap: 24px 28px; align-items: start; }
.steps__n {
  display: grid;
  place-items: center;
  width: 66px;
  height: 56px;
  background: var(--wood);
  border: var(--edge) solid var(--ink);
  color: var(--ink);
  font-family: var(--px);
  font-weight: 700;
  font-size: 18px;
}
.steps__t { margin: 0 0 10px; font-family: var(--px); font-weight: 700; font-size: 27px; line-height: 1.25; text-transform: uppercase; }
.steps__b { margin: 0; font-size: 18px; color: var(--ink-2); }
.steps__img { display: block; width: 100%; height: auto; border: var(--edge) solid var(--ink); }

/* --------------------------------------------------------- the picture */

.badge { display: block; width: 330px; max-width: 100%; height: auto; image-rendering: pixelated; margin-bottom: 22px; }
.pic { display: block; width: 100%; max-width: 420px; height: auto; border: var(--edge) solid var(--ink); }

/* ------------------------------------------------------------- utility */

.stack { display: flex; flex-direction: column; gap: 24px; }
.stack--s { gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.grow { flex: 1 1 320px; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hr { height: 2px; background: var(--kraft-3); border: none; margin: 32px 0; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { position: relative; display: flex; align-items: baseline; gap: 18px; padding: 15px 0; min-width: 0; }
.feed li::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--kraft-3); }
.feed li:first-child::before { display: none; }
.feed__who { font-family: var(--px); font-weight: 700; font-size: 18px; color: var(--leaf); overflow-wrap: anywhere; }
.feed__what { font-size: 16px; color: var(--ink-2); overflow-wrap: anywhere; }
.feed__sol { margin-left: auto; font-family: var(--px); font-weight: 700; font-size: 18px; white-space: nowrap; }
.feed__ago { font-family: var(--px); font-size: 18px; color: var(--ink-2); width: 44px; text-align: right; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: 40;
  background: var(--ink);
  color: var(--kraft);
  font-family: var(--px);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.05em;
  padding: 16px 26px;
}

/* ------------------------------------------------------------ 1366 down */

/* a 1366 screen is only 768 tall: the yard has to be in the first screen, not under it */
@media (max-width: 1500px) {
  .deck { width: calc(100vw - 120px); padding-top: 28px; }
  .wordmark { margin-top: 14px; }
  .wordmark img { width: min(560px, 76%); }
  .mast__ticker { margin-top: 12px; padding: 13px 30px; }
  .mast__story { margin-top: 20px; }
  .mast__line { margin-top: 16px; }
  .mast__form { margin-top: 22px; }
}
@media (max-width: 1100px) {
  :root { --cell: 30px; --pad: 32px; }
  .deck { width: calc(100vw - 64px); gap: 48px; padding: 40px 0 72px; }
  .cols { grid-template-columns: 1fr; gap: 32px; }
  .rowline dt { flex-basis: 180px; }
  .steps li { grid-template-columns: 66px 1fr; }
  .steps__img { grid-column: 2; max-width: 520px; }
}
@media (max-width: 760px) {
  :root { --cell: 26px; --pad: 28px; --edge: 3px; }
  body { font-size: 18px; }
  .deck { width: calc(100vw - 28px); gap: 36px; padding: 16px 0 52px; }
  .board { box-shadow: 8px 9px 0 rgba(64, 34, 15, 0.26); border-width: 14px; border-image-slice: 18 fill; border-image-width: 14px; }
  .wordmark { margin-top: 28px; }
  .wordmark img { width: 94%; }
  .mast__story { margin-top: 26px; font-size: 18px; }
  .mast__line { font-size: 20px; margin-top: 22px; }
  .board__head { font-size: 26px; }
  /* on a phone the number sits above its word, so two chips fit a row without the word spilling */
  .chips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
  .chip { flex-direction: column; align-items: flex-start; gap: 5px; min-height: 0; padding: 0; }
  .chip__n { min-width: 50px; height: 40px; padding: 0 16px; font-size: 16px; }
  .chip { font-size: 16px; }

  .split__cells { flex-wrap: wrap; gap: 3px; }
  .split__cells i { flex: 0 0 calc((100% - 26px * 2 - 3px * 24) / 25); height: 18px; }
  .split__cells i.edge { margin-right: 26px; }
  .rowline { flex-direction: column; gap: 6px; }
  .rowline dt { flex-basis: auto; }
  .sheet th, .sheet td { padding: 13px 18px; font-size: 16px; }
  .sheet thead th { font-size: 16px; padding: 14px 18px; }
  .sheet tbody td.pkg { font-size: 17px; }
  .big { font-size: 34px; }
  .json { font-size: 17px; }
  .key { padding: 12px 20px; font-size: 16px; }
  .trail__node--dep { padding-left: 24px; }
  .trail__node--dep::after { width: 14px; }
  .trail__pkg, .trail__pct { font-size: 20px; }
  .run i { flex-basis: 8px; height: 14px; }
  .steps li { grid-template-columns: 58px 1fr; gap: 16px; }
  .steps__n { width: 58px; height: 50px; font-size: 16px; }
  .steps__t { font-size: 20px; }
  .steps__img { grid-column: 1 / -1; }
  .board__tab { top: -18px; left: 22px; padding: 8px 16px; font-size: 16px; }
}
@media (max-width: 380px) { .deck { width: calc(100vw - 18px); } }

@media (prefers-reduced-motion: reduce) {
  #drift { display: none; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
