/* dummy. The page is one sheet of a crash test kit: a grey sheet for the pad itself, black sheets for
   its insides, printed in one ink with an acid second colour, and every object on it is a wireframe.
   Built to the kit sheet in art/ref/wireframe-sheet.jpg. */

@font-face { font-family: "Grotesk"; src: url("/fonts/grotesk-gras.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Gulax"; src: url("/fonts/gulax.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "OG"; src: url("/fonts/og-medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "OG"; src: url("/fonts/og-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Proto"; src: url("/fonts/proto-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Proto"; src: url("/fonts/proto-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --paper: #b4b6b1;
  --ink: #0c0c0c;
  --chalk: #f2f2ee;
  --acid: #ede000;
  --notch: 14px;
  --sheet: 1800px;
  --gap: 12px;
  --pad: 28px;
  --bg: var(--paper);
  --fg: var(--ink);
  --line: var(--ink);
  color-scheme: dark;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--fg);
  font-family: OG, system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body { min-height: 100vh; }

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

.sheet {
  --bg: var(--paper);
  --fg: var(--ink);
  --line: var(--ink);
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  padding: 20px;
  position: relative;
  isolation: isolate;
}

.sheet.dark {
  --bg: var(--ink);
  --fg: var(--chalk);
  --line: var(--chalk);
}

/* the press grain, one tile, multiplied over the whole sheet and nothing else */
.sheet::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("/img/grain.png");
  background-size: 320px 320px;
  opacity: 0.15;
  pointer-events: none;
  z-index: 3;
}
.sheet.dark::after { opacity: 0.22; filter: invert(1); }

/* the sheet's own stroke frame, with the corners cut off, exactly as the kit sheet prints them */
.frame {
  position: relative;
  max-width: var(--sheet);
  margin: 0 auto;
  background: var(--line);
  padding: 1.5px;
  clip-path: polygon(
    0 var(--notch), var(--notch) 0,
    calc(100% - var(--notch)) 0, 100% var(--notch),
    100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%,
    var(--notch) 100%, 0 calc(100% - var(--notch))
  );
  z-index: 1;
}
.frame > .inner {
  background: var(--bg);
  clip-path: polygon(
    0 calc(var(--notch) - 1px), calc(var(--notch) - 1px) 0,
    calc(100% - var(--notch) + 1px) 0, 100% calc(var(--notch) - 1px),
    100% calc(100% - var(--notch) + 1px), calc(100% - var(--notch) + 1px) 100%,
    calc(var(--notch) - 1px) 100%, 0 calc(100% - var(--notch) + 1px)
  );
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: calc(100vh - 43px);
}

/* ------------------------------------------------------------------- type */

.label {
  font-family: OG, sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  line-height: 1.2;
}
.label.soft { font-weight: 500; opacity: 0.74; }

.value { font-family: Proto, ui-monospace, monospace; font-size: 20px; letter-spacing: -0.01em; }
.value.big { font-size: 34px; }
.value.huge { font-family: Grotesk, sans-serif; font-size: 64px; line-height: 0.9; letter-spacing: -0.02em; }

.display { font-family: Grotesk, sans-serif; font-weight: 700; letter-spacing: -0.025em; line-height: 0.86; }
.gulax { font-family: Gulax, sans-serif; font-weight: 400; letter-spacing: 0.01em; }

p { margin: 0; font-size: 18px; max-width: 62ch; }
h2 { margin: 0; font-family: Grotesk, sans-serif; font-weight: 700; font-size: 36px; line-height: 1; letter-spacing: -0.02em; }
a { color: inherit; }

/* ------------------------------------------------------------------ pieces */

.row { display: grid; gap: var(--gap); align-items: stretch; }
.row.r5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.row.r4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row.r3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row.r2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row.product { grid-template-columns: minmax(0, 30fr) minmax(0, 16fr) minmax(0, 54fr); }
.row.links { grid-template-columns: minmax(0, 58fr) minmax(0, 42fr); }
.row.lead { grid-template-columns: minmax(0, 24fr) minmax(0, 76fr); }
.row.wide-left { grid-template-columns: minmax(0, 58fr) minmax(0, 42fr); }

.pill {
  border: 1.25px solid var(--line);
  border-radius: 999px;
  padding: 16px var(--pad);
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  background: transparent;
}
.pill.block { border-radius: 26px; align-items: stretch; flex-direction: column; justify-content: center; gap: 10px; }
.pill.on { background: var(--line); color: var(--bg); }
.pill.centre { justify-content: center; text-align: center; }

button.cell, button.pill { background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }

.cell {
  border: 1.25px solid var(--line);
  border-radius: 20px;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.cell.on, button.cell.on { background: var(--line); color: var(--bg); }
.cell.on .note, .cell.on .label { color: var(--bg); opacity: 1; }

.ident {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
}

.code {
  background: var(--acid);
  color: #0c0c0c;
  border-radius: 4px;
  padding: 11px 18px;
  font-family: Proto, monospace;
  font-size: 16px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* a drawing whose alpha is the ink: CSS decides which ink it prints in */
.drawn {
  background-color: var(--line);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.drawn.acid { background-color: var(--acid); }

/* ------------------------------------------------------------------- index */

.index { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: var(--gap); }
.index a { grid-column: span 2; }
.index a {
  border: 1.25px solid var(--line);
  border-radius: 20px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  min-height: 108px;
  transition: background 0.12s linear, color 0.12s linear;
}
.index a:hover { background: color-mix(in srgb, var(--line) 12%, transparent); }
.index a:active { background: color-mix(in srgb, var(--line) 22%, transparent); }
.index a.on:active { background: color-mix(in srgb, var(--line) 86%, var(--bg)); }
.index a.on { background: var(--line); color: var(--bg); }
.index a.on:hover { background: var(--line); }
.index canvas { width: 62px; height: 62px; flex: 0 0 62px; }
.index .wrap { flex: 1 1 auto; min-width: 0; }
.index .n { font-family: Proto, monospace; font-size: 16px; opacity: 0.7; }
.index .nm { font-family: OG; font-weight: 700; font-size: 17px; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.15; }

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

.masthead {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 26%);
  align-items: stretch;
  gap: 28px;
  --bg: var(--ink);
  --line: var(--chalk);
  background: var(--ink);
  color: var(--chalk);
  border-radius: 26px;
  padding: 30px 32px 30px;
  overflow: hidden;
  isolation: isolate;
}
.masthead .word {
  font-family: Grotesk, sans-serif;
  font-weight: 700;
  color: var(--acid);
  /* the clamp is the floor before the fitter has measured: it can be too small, never too wide */
  font-size: clamp(40px, 11vw, 300px);
  line-height: 0.82;
  padding-bottom: 0.17em;
  letter-spacing: -0.03em;
  margin: 0;
  min-width: 0;
  user-select: none;
}
.masthead .word-cell { position: relative; min-width: 0; align-self: center; }
.masthead .object { position: relative; min-width: 0; display: flex; align-items: center; }
.masthead canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 200px;
  pointer-events: none;
}
.masthead .star {
  position: absolute;
  width: 26px;
  height: 26px;
  -webkit-mask-image: url("/img/star.png");
  mask-image: url("/img/star.png");
  pointer-events: none;
}

/* ------------------------------------------------------------------ links */

.marks { display: flex; gap: 10px; flex-wrap: wrap; }
.mark {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 1.25px solid var(--line);
  display: grid;
  place-items: center;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.mark img { width: 24px; height: 24px; object-fit: contain; display: block; }
.mark img.glyph { width: 19px; height: 19px; }
.mark[aria-disabled="true"] { opacity: 0.42; cursor: not-allowed; }
.mark:hover:not([aria-disabled="true"]) { background: color-mix(in srgb, var(--line) 14%, transparent); }

.key {
  border: 1.25px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-family: OG;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  min-height: 52px;
  padding: 14px 26px;
  cursor: pointer;
  white-space: normal;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.key:hover:not(:disabled) { background: color-mix(in srgb, var(--line) 14%, transparent); }
.key.solid { background: var(--acid); border-color: var(--acid); color: #0c0c0c; }
.key.solid:hover:not(:disabled) { filter: brightness(1.08); }
.key:disabled { opacity: 0.4; cursor: not-allowed; }

.mint {
  font-family: Proto, monospace;
  font-size: 20px;
  word-break: break-all;
  user-select: all;
  line-height: 1.3;
}

/* ----------------------------------------------------------------- forms */

input[type="text"], input[type="number"], textarea, select {
  font-family: Proto, monospace;
  font-size: 18px;
  color: inherit;
  background: color-mix(in srgb, var(--line) 8%, transparent);
  border: 1.25px solid color-mix(in srgb, var(--line) 45%, transparent);
  border-radius: 12px;
  padding: 12px 16px;
  width: 100%;
  min-height: 52px;
}
textarea { font-size: 17px; line-height: 1.5; min-height: 190px; resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible, .key:focus-visible, .mark:focus-visible, .index a:focus-visible, a:focus-visible {
  outline: 3px solid var(--acid);
  outline-offset: 2px;
}
input[type="range"] { width: 100%; accent-color: var(--acid); min-height: 44px; }
input[type="file"] { min-height: 48px; padding: 10px 14px; }

/* one line of the attack language: the code and what it means, side by side until a phone */
.grammar { display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr); gap: 14px; align-items: baseline; }

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field .hint { font-size: 16px; opacity: 0.72; }

/* ------------------------------------------------------------------ table */

.table { display: flex; flex-direction: column; gap: 2px; }
.trow {
  display: grid;
  gap: 16px;
  align-items: center;
  padding: 16px var(--pad);
  border: 1.25px solid color-mix(in srgb, var(--line) 42%, transparent);
  border-radius: 16px;
  min-width: 0;
}
.trow.head { border-color: transparent; padding-top: 4px; padding-bottom: 4px; }

.verdict {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 8px 18px;
  font-family: OG;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1.25px solid var(--line);
  white-space: nowrap;
}
.verdict.pass { background: var(--acid); border-color: var(--acid); color: #0c0c0c; }
.verdict.fail { background: var(--line); color: var(--bg); }

.run { width: 100%; height: 260px; display: block; }

.ticker { font-family: Gulax, sans-serif; font-size: 62px; line-height: 1; }
.sphere { width: 100%; height: 128px; display: block; }

.note { font-size: 16px; opacity: 0.74; }
.wrap { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sticker {
  -webkit-mask-image: url("/img/sticker.png");
  mask-image: url("/img/sticker.png");
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  background-color: var(--chalk);
  padding: 26px var(--pad);
  color: #0c0c0c;
}

.scroll-x { overflow-x: auto; }

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

@media (max-width: 1100px) {
  .row.product, .row.links, .row.r4, .row.r3, .row.r5 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .row.r5 > :last-child { grid-column: span 2; }
}

/* The index ladder: five cells, then three, then two, then one, and the last row always closes edge to
   edge. Every rule names the same two selectors, so the narrower breakpoint always wins the cascade. */
@media (max-width: 1199px) {
  .index { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .index a { grid-column: span 2; }
  .index a:nth-child(n + 4) { grid-column: span 3; }
}
@media (max-width: 899px) {
  .index { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .index a { grid-column: span 1; }
  .index a:nth-child(n + 4) { grid-column: span 1; }
  .index a:last-child { grid-column: span 2; }
}
@media (max-width: 619px) {
  .index { grid-template-columns: minmax(0, 1fr); }
  .index a { grid-column: span 1; }
  .index a:nth-child(n + 4) { grid-column: span 1; }
  .index a:last-child { grid-column: span 1; }
}

/* the masthead stacks before the word has to shrink into a caption */
@media (max-width: 900px) {
  .masthead { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 30px 32px 28px; }
  /* a 0.82 line box does not hold the descender of the y, and the object now sits under it */
  .masthead .word { padding-bottom: 0.16em; }
  .masthead canvas { min-height: 130px; height: 130px; }
}

@media (max-width: 900px) {
  .row.lead, .row.wide-left { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
  /* a 40 px wireframe on a phone is a speck: the index keeps its numbers and its names, on one line */
  .index canvas { display: none; }
  .index .wrap { flex-direction: row; align-items: baseline; gap: 14px; }
  .index a { min-height: 62px; }
  /* a code label is 16 px mono and nothing shrinks it: at this width it wraps instead of sticking out */
  .code { white-space: normal; }
}

@media (max-width: 680px) {
  .index a { min-height: 68px; padding: 14px 20px; gap: 12px; }
  .index canvas { width: 44px; height: 44px; flex: 0 0 44px; }
  .index .nm { font-size: 16px; letter-spacing: 0.06em; }
  :root { --pad: 20px; --gap: 10px; --notch: 11px; }
  .sheet { padding: 12px; }
  .frame > .inner { padding: 16px; min-height: calc(100vh - 27px); }
  .row.product, .row.links, .row.r4, .row.r3, .row.r2, .row.r5 { grid-template-columns: minmax(0, 1fr); }
  .grammar { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .row.r5 > :last-child { grid-column: auto; }
  /* a table row stacks on a phone: its columns are written where it is used, so they are overruled here */
  .trow { grid-template-columns: minmax(0, 1fr) !important; gap: 8px; }
  .cell { padding: 26px 32px; }
  .pill { padding: 20px var(--pad); }
  .pill.block { padding: 24px var(--pad); }
  .ticker { font-size: 44px; }
  .sphere { height: 90px; }
  .value.huge { font-size: 44px; }
  h2 { font-size: 28px; }
  .run { height: 200px; }
}

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