/* Every page that is not the home page. One file, because they are all the
   same shape: a page head, then hairline separated rows of data. */

/* -------------------------------------------------------------- page head -- */

/* Same scale as the home page: 34 for the page title, 13 for the lede, 11 for
   the labels. An inner page is not a smaller site. */
.page-head { padding: 56px 0 44px; }
.page-head h1 {
  font-size: var(--t-34);
  line-height: var(--lead-display);
  letter-spacing: -.02em;
  margin-bottom: 20px;
  max-width: 24ch;
  text-wrap: balance;
}
/* The count or the subtitle stays on the title's line: as a block under it,
   "(0)" reads as a label with nothing labelled. */
.page-head h1 small {
  font-size: var(--t-13);
  letter-spacing: .1em;
  color: var(--meta);
  margin-left: .7em;
  vertical-align: .2em;
}
.page-head .lede { font-size: var(--t-13); line-height: var(--lead-body); }
.page-head .state { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------------------------------------------------------------- filters -- */

/* The filter bar sticks under the floating top bar, so the set being filtered
   and the control filtering it are never at opposite ends of the scroll. */
.filters {
  position: sticky;
  top: calc(var(--bar-h) + 14px);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px 0;
  border-top: var(--rule);
  border-bottom: var(--rule);
  margin-bottom: 30px;
  background: rgba(0, 0, 0, .92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.filters button {
  border: var(--rule);
  background: transparent;
  color: var(--meta);
  font: inherit;
  font-size: var(--t-11);
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 6px 12px;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease);
}
.filters button:hover { color: var(--accent); border-color: var(--accent); }
.filters button[aria-pressed="true"] { color: #000; background: var(--accent); border-color: var(--accent); }
.filters .count { margin-left: auto; font-size: var(--t-11); letter-spacing: .14em; color: var(--meta); text-transform: uppercase; }

/* ------------------------------------------------------------- zomi grids -- */

/* A fixed column count rather than auto-fill, because the page size is chosen
   to divide by it: 48 per page fills 6, 4 or 2 columns exactly and never leaves
   a half empty last row. */
.grid-zomi {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-top: var(--rule);
  border-left: var(--rule);
}
.grid-zomi > a,
.grid-zomi > article {
  display: block;
  border-bottom: var(--rule);
  border-right: var(--rule);
  color: inherit;
}
.grid-zomi > a { position: relative; transition: background var(--t-mid) var(--ease); }
.grid-zomi > a:hover { text-decoration: none; background: var(--panel); }
.grid-zomi > a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-mid) var(--ease);
}
.grid-zomi > a:hover::after,
.grid-zomi > a:focus-visible::after { transform: scaleX(1); }
.grid-zomi canvas {
  width: 100%;
  aspect-ratio: 1;
  image-rendering: pixelated;
  background: var(--panel);
  transition: transform var(--t-mid) var(--ease);
}
.grid-zomi > a:hover canvas { transform: translateY(-1px); }
.grid-zomi .meta { padding: 11px 12px 14px; }
.grid-zomi .meta b { display: block; font-weight: 400; color: var(--text); font-size: var(--t-13); letter-spacing: .06em; transition: color var(--t-fast) var(--ease); }
.grid-zomi > a:hover .meta b { color: var(--accent); }
.grid-zomi .meta span { display: block; margin-top: 4px; font-size: var(--t-11); letter-spacing: .1em; color: var(--meta); }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 0 0;
  font-size: var(--t-11);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--meta);
}
.pager button {
  border: var(--rule);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: var(--t-11);
  letter-spacing: .16em;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.pager button:not([disabled]):hover { border-color: var(--accent); background: var(--accent); color: #000; }
.pager button[disabled] { color: var(--faint); border-color: var(--line-soft); cursor: default; }

/* -------------------------------------------------------------- data rows -- */

.rows { border-top: var(--rule); }
.row {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 16px;
  align-items: baseline;
  padding: 13px 0;
  border-bottom: var(--rule-soft);
}
.row .k { font-size: var(--t-11); letter-spacing: .16em; text-transform: uppercase; color: var(--meta); }
.row .v { color: var(--text); word-break: break-word; }
.row .n { color: var(--accent); }

/* Full field, not 900 px: the value is right aligned, so a cap turns every
   rule in the list into a hairline that stops two thirds of the way across
   while the band rules above and below it run the whole width. */
.kv { border-top: var(--rule); max-width: none; }
.kv > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: var(--rule-soft);
}
.kv .k { font-size: var(--t-11); letter-spacing: .1em; color: var(--meta); }
.kv .v { color: var(--text); font-size: var(--t-13); word-break: break-all; text-align: right; }

/* ----------------------------------------------------------------- engine -- */

/* The rule between steps is drawn on the content field, the same way the band
   dividers are, so a page of steps and a page of bands rule in the same place. */
.step { position: relative; padding: 56px 0 64px; }
.step::before {
  content: "";
  position: absolute;
  top: 0;
  left: max(var(--gutter), calc(50% - var(--wide) / 2 + var(--gutter)));
  right: max(var(--gutter), calc(50% - var(--wide) / 2 + var(--gutter)));
  height: 1px;
  background: var(--line);
}
.step-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 22px;
}
.step-head b {
  font-weight: 400;
  font-size: var(--t-11);
  letter-spacing: var(--track-eyebrow);
  color: var(--accent);
}
.step-head h2 { font-size: var(--t-18); letter-spacing: -.01em; }
.step-head .side { margin-left: auto; font-size: var(--t-11); letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }

.step-grid {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 34px 44px;
  align-items: start;
}

.stage {
  width: 100%;
  aspect-ratio: 1;
  image-rendering: pixelated;
  background: var(--panel);
  border: var(--rule);
}

.layer-list { list-style: none; margin: 18px 0 0; padding: 0; border-top: var(--rule); }
.layer-list li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  padding: 9px 0;
  border-bottom: var(--rule-soft);
  color: var(--faint);
}
.layer-list li[data-on] { color: var(--body); }
.layer-list li[data-on] em { color: var(--accent); }
.layer-list li { transition: color var(--t-mid) var(--ease); }
.layer-list li b { font-weight: 400; font-size: var(--t-11); letter-spacing: .18em; min-width: 82px; text-transform: uppercase; }
.layer-list li em { font-style: normal; margin-left: auto; color: var(--faint); }

.field { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.field label { display: block; font-size: var(--t-11); letter-spacing: .18em; text-transform: uppercase; color: var(--meta); margin-bottom: 8px; }
.field input,
.field select {
  border: var(--rule);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  min-width: 140px;
}
.field input:focus,
.field select:focus { outline: none; border-color: var(--accent); }
/* Same rule as the rest of the site: the accent border says which control is
   live, the ring says it is focused, and neither is asked to do both jobs. */
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.field .note { font-size: var(--t-11); letter-spacing: .1em; color: var(--meta); }

.terms { display: grid; grid-template-columns: repeat(3, 1fr); border-top: var(--rule); margin: 6px 0 20px; }
.terms button {
  border: 0;
  border-bottom: var(--rule);
  border-right: var(--rule);
  background: transparent;
  color: var(--body);
  font: inherit;
  text-align: left;
  padding: 14px 16px 16px;
  cursor: pointer;
}
.terms button:last-child { border-right: 0; }
.terms button { transition: background var(--t-fast) var(--ease); }
.terms button:hover { background: var(--panel); }
.terms button strong { display: block; font-weight: 400; color: var(--text); font-size: var(--t-18); margin-bottom: 4px; white-space: nowrap; }
.terms button span { font-size: var(--t-11); letter-spacing: .14em; text-transform: uppercase; color: var(--meta); }
.terms button[aria-pressed="true"] { background: var(--panel); }
.terms button[aria-pressed="true"] strong,
.terms button[aria-pressed="true"] span { color: var(--accent); }

table.weights { width: 100%; border-collapse: collapse; font-size: var(--t-13); }
table.weights caption {
  text-align: left;
  font-size: var(--t-11);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--meta);
  padding-bottom: 10px;
}
table.weights th,
table.weights td { text-align: left; padding: 10px 14px 10px 0; border-bottom: var(--rule-soft); }
/* The head stays on screen while the body scrolls under it. A weight column
   with no column name above it is a column of numbers. */
table.weights th {
  position: sticky;
  top: calc(var(--bar-h) + 14px);
  z-index: 10;
  font-weight: 400;
  font-size: var(--t-11);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--meta);
  background: var(--ground);
  border-bottom: var(--rule);
}
table.weights tbody tr { transition: background var(--t-fast) var(--ease); }
table.weights tbody tr:hover { background: var(--panel); }
/* The head of a number column right aligns with the numbers under it, or the
   name of the column and the column itself are at opposite ends of the cell. */
table.weights th.n { text-align: right; padding-right: 0; }
table.weights td.n { text-align: right; color: var(--accent); padding-right: 0; font-variant-numeric: tabular-nums; }
table.weights tr[data-here] td { color: var(--text); }
table.weights tr[data-here] td:first-child::before { content: "\203a "; color: var(--accent); }

.gate { border: var(--rule); padding: 16px 18px 18px; background: var(--panel); margin-top: 20px; }
.gate ul { list-style: none; margin: 10px 0 0; padding: 0; }
.gate li { margin: 0; padding: 5px 0; font-size: var(--t-11); }
.gate li::before { content: "ok "; color: var(--accent); letter-spacing: .1em; }
.gate li[data-bad]::before { content: "no "; color: var(--pending); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ------------------------------------------------------------- whitepaper -- */

.wp { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 0 48px; }
.wp-index {
  position: sticky;
  top: calc(var(--bar-h) + 30px);
  align-self: start;
  list-style: none;
  margin: 0;
  padding: 0 0 40px;
}
.wp-index li { margin: 0; padding: 5px 0; }
.wp-index a { color: var(--meta); font-size: var(--t-11); letter-spacing: .14em; text-transform: uppercase; transition: color var(--t-fast) var(--ease); }
.wp-index a:hover { color: var(--accent); text-decoration: none; }

.wp-body section { border-top: var(--rule); padding: 48px 0 52px; }
.wp-body section:first-child { border-top: 0; padding-top: 0; }
.wp-body h2 {
  font-size: var(--t-18);
  letter-spacing: -.01em;
  margin-bottom: 18px;
}
.wp-body h2 b { font-weight: 400; color: var(--accent); font-size: var(--t-11); letter-spacing: var(--track-eyebrow); margin-right: 14px; }
.wp-body p, .wp-body li { max-width: 78ch; }

/* ----------------------------------------------------------------- shared -- */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 30px 44px;
}

.band-note { margin-top: 24px; font-size: var(--t-11); line-height: 1.7; color: var(--meta); max-width: 78ch; }

.formula {
  margin: 20px 0;
  padding: 18px 20px;
  border: var(--rule);
  background-color: var(--panel);
  background-image: repeating-linear-gradient(to bottom, var(--line-soft) 0 1px, transparent 1px 3px);
  color: var(--accent);
  font-family: var(--mono);
  font-size: var(--t-11);
  line-height: 2;
  white-space: pre;
  overflow-x: auto;
}

.msg { margin-top: 16px; font-size: var(--t-11); color: var(--meta); }
.msg[data-bad] { color: var(--pending); }
.msg[data-ok] { color: var(--accent); }

/* ------------------------------------------------------------------- 900 -- */

@media (max-width: 960px) {
  .step-grid { grid-template-columns: 1fr; }
  /* minmax(0,1fr) rather than 1fr: an auto minimum lets the formula block,
     which scrolls sideways on purpose, push the whole column past the viewport */
  .wp { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .wp-index { position: static; border-bottom: var(--rule); margin-bottom: 26px; display: flex; flex-wrap: wrap; gap: 6px 18px; padding-bottom: 18px; }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .grid-zomi { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 720px) {
  .page-head { padding: 26px 0 26px; }
  .page-head h1 { font-size: var(--t-24); }
  .step { padding: 32px 0 36px; }
  .filters { top: calc(var(--bar-h) + 6px); }
  .wp-body section { padding: 30px 0 34px; }
  /* A five column table at 390 is a five column table nobody can read, so each
     row becomes a card and every figure carries the name of its own column. */
  table.weights thead { display: none; }
  table.weights, table.weights tbody, table.weights tr, table.weights td { display: block; width: auto; }
  table.weights tr { padding: 14px 0 16px; border-bottom: var(--rule); }
  table.weights td { border: 0; padding: 3px 0; text-align: left; }
  table.weights td.n { text-align: left; }
  table.weights td[data-k]::before {
    content: attr(data-k);
    display: inline-block;
    min-width: 15ch;
    font-size: var(--t-11);
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--meta);
  }
  table.weights td.t { white-space: normal; }
  .kv > div { padding: 10px 0; }
  .row { padding: 11px 0; }
  .grid-zomi { grid-template-columns: repeat(2, 1fr); }
  .row { grid-template-columns: 1fr; gap: 2px; }
  .kv .v { text-align: left; }
  .terms { grid-template-columns: 1fr; }
  .terms button { border-right: 0; }
  .stage { max-width: 420px; }
}

/* ------------------------------------------------------------- additions -- */

/* The eight palette slots of the Zomi on the engine page, as swatches. The
   colour is set inline because it is data, not design: it comes from the
   palette the engine drew, not from a class. */
.chip {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 3px;
  vertical-align: middle;
  border: 1px solid var(--line);
}
.chip:first-child { margin-left: 0; }

.trait-gap { height: 46px; }

.field-wide { flex: 1 1 320px; }
.field-wide input { width: 100%; }

/* A trait is a name and a picture. The sample is one real Zomi that carries it,
   the first id that does, so the table shows what the word means. */
/* Not a flex container: display:flex on a td takes the cell out of the table
   layout and the row's rule stops wherever the content does. */
table.weights td.t { color: var(--text); white-space: nowrap; }
.swatch {
  display: inline-block;
  width: 34px;
  height: 34px;
  margin-right: 12px;
  vertical-align: -11px;
  image-rendering: pixelated;
  background: var(--panel);
}

/* Explicit column widths: left to itself the table pushes the two share columns
   to opposite ends of a 1360 px row with nothing between them. */
table.weights th:first-child,
table.weights td:first-child { width: 26%; }
table.weights th:not(:first-child),
table.weights td:not(:first-child) { width: 18.5%; }
