/* ==================================================================
   Reset, type, and the primitives every screen is built from.
   ================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0 solid var(--reed);
}

/* Author rules like .surface { display: grid } outrank the browser's
   own [hidden] rule, so say it once here and mean it. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + var(--px) * 8);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  background: var(--water);
  color: var(--foam);
  font-family: var(--body);
  font-size: var(--t-body);
  line-height: var(--lead-read);
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
  min-height: 100vh;
}

/* A faint horizontal scanline field over the whole page. It is two
   pixels tall and almost invisible, which is the point: it makes the
   flat panels read as a lit screen instead of flat colour. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.5) 0 1px,
    transparent 1px 3px
  );
  opacity: 0.22;
}

img {
  max-width: 100%;
  display: block;
  image-rendering: pixelated;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  background: none;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: var(--depth);
  text-decoration: none;
  border-bottom: var(--rule) solid transparent;
  transition: color var(--step-fast) var(--steps-3),
    border-color var(--step-fast) var(--steps-3);
}

a:hover {
  color: var(--depth-hi);
  border-bottom-color: var(--depth-hi);
}

ul,
ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

::selection {
  background: var(--bill);
  color: var(--on-bill);
}

:focus-visible {
  outline: calc(var(--px) * 0.75) solid var(--bill);
  outline-offset: calc(var(--px) * 0.5);
}

/* ---- scrollbar --------------------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--reed) transparent;
}
*::-webkit-scrollbar {
  width: calc(var(--px) * 2);
  height: calc(var(--px) * 2);
}
*::-webkit-scrollbar-thumb {
  background: var(--reed);
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--reed-hi);
}

/* ==================================================================
   TYPE
   ================================================================== */

.display {
  font-family: var(--display);
  font-weight: 700;
  line-height: var(--lead-flat);
  letter-spacing: 0.01em;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 700;
  line-height: var(--lead-flat);
}

h1 {
  font-size: var(--t-h1);
}
h2 {
  font-size: var(--t-h2);
}
h3 {
  font-size: var(--t-h3);
}

/* The utility face. Ten pixels, all caps, wide tracking. It does the
   job of a caption, an eyebrow and a column header everywhere on the
   site, so those three things all look like the same species. */
.label {
  font-family: var(--label);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--drift);
  line-height: 1.4;
}

.label--bill {
  color: var(--bill);
}
.label--depth {
  color: var(--depth);
}
.label--rare {
  color: var(--rare);
}

.num,
.figs {
  font-family: var(--numeric);
  font-weight: var(--numeric-w);
  font-size: var(--t-num);
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--body);
}

.prose {
  max-width: 66ch;
  color: var(--drift);
}
.prose strong {
  color: var(--foam);
  font-weight: 600;
}
.prose p + p {
  margin-top: calc(var(--px) * 4);
}

.t-foam {
  color: var(--foam);
}
.t-drift {
  color: var(--drift);
}
.t-bill {
  color: var(--bill);
}
.t-depth {
  color: var(--depth);
}
.t-rare {
  color: var(--rare);
}
.t-kill {
  color: var(--kill);
}

/* A hash, an address, a nonce. Breaks anywhere, never overflows. */
.hex {
  font-family: var(--body);
  font-size: var(--t-small);
  color: var(--depth);
  word-break: break-all;
  line-height: 1.5;
}

/* ==================================================================
   PRIMITIVES
   ================================================================== */

.page {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* A panel is a flat rectangle with a one pixel edge and a notch cut
   out of the top left corner, the way a sprite sheet cell is cut.
   No radius anywhere on this site. */
.panel {
  background: var(--silt);
  border: var(--rule) solid var(--reed);
  position: relative;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--px) * 3);
  padding: calc(var(--px) * 2.5) calc(var(--px) * 3);
  border-bottom: var(--rule) solid var(--reed);
  background: var(--abyss);
}

.panel__body {
  padding: calc(var(--px) * 4);
}

.panel__body--flush {
  padding: 0;
}

/* ---- rules ------------------------------------------------------- */
.rule {
  height: var(--rule);
  background: var(--reed);
  border: 0;
}

/* A rule made of dashes on the pixel grid. Used to separate a block
   from the next without the weight of a solid line. */
.rule--dash {
  height: var(--rule);
  background: repeating-linear-gradient(
    to right,
    var(--reed) 0 calc(var(--px) * 2),
    transparent calc(var(--px) * 2) calc(var(--px) * 4)
  );
}

/* ==================================================================
   BUTTONS
   The only radius-free, shadow-free button on the internet. Depth
   comes from a hard offset block behind it, which snaps away on
   press, so the button physically travels.
   ================================================================== */

.btn {
  --btn-fg: var(--foam);
  --btn-bg: var(--silt-hi);
  --btn-edge: var(--reed-hi);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--px) * 2);
  padding: calc(var(--px) * 2.5) calc(var(--px) * 4);
  font-family: var(--label);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: var(--rule) solid var(--btn-edge);
  box-shadow: var(--px) var(--px) 0 0 var(--abyss);
  transform: translate(0, 0);
  transition: transform var(--step-fast) var(--steps-3),
    box-shadow var(--step-fast) var(--steps-3),
    background var(--step-fast) var(--steps-3);
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: var(--reed);
  transform: translate(calc(var(--px) * -0.5), calc(var(--px) * -0.5));
  box-shadow: calc(var(--px) * 1.5) calc(var(--px) * 1.5) 0 0 var(--abyss);
}

.btn:active:not(:disabled) {
  transform: translate(var(--px), var(--px));
  box-shadow: 0 0 0 0 var(--abyss);
}

.btn:disabled {
  opacity: 0.4;
  box-shadow: none;
  transform: none;
}

.btn--bill {
  --btn-fg: var(--on-bill);
  --btn-bg: var(--bill);
  --btn-edge: var(--bill-hi);
  font-weight: 700;
}
.btn--bill:hover:not(:disabled) {
  background: var(--bill-hi);
}

.btn--depth {
  --btn-fg: var(--on-depth);
  --btn-bg: var(--depth);
  --btn-edge: var(--depth-hi);
  font-weight: 700;
}
.btn--depth:hover:not(:disabled) {
  background: var(--depth-hi);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-edge: var(--reed);
  box-shadow: none;
}
.btn--ghost:hover:not(:disabled) {
  background: var(--silt-hi);
  box-shadow: none;
  transform: none;
}

.btn--lg {
  padding: calc(var(--px) * 4) calc(var(--px) * 7);
  font-size: 13px;
}

.btn--block {
  width: 100%;
}

/* ==================================================================
   SMALL PARTS
   ================================================================== */

/* A live square that blinks on the step grid. Present wherever the
   page is showing something that is actually moving right now. */
.pulse {
  width: var(--px);
  height: var(--px);
  background: var(--depth);
  flex: none;
  animation: blink 1.1s var(--steps-3) infinite;
}
.pulse--bill {
  background: var(--bill);
}
.pulse--dead {
  background: var(--silt-text);
  animation: none;
}

@keyframes blink {
  0%,
  55% {
    opacity: 1;
  }
  56%,
  100% {
    opacity: 0.15;
  }
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--px) * 1.5);
  padding: calc(var(--px) * 0.75) calc(var(--px) * 2);
  font-family: var(--label);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  border: var(--rule) solid var(--reed);
  color: var(--drift);
}

.tag--live {
  color: var(--depth);
  border-color: var(--depth);
}
.tag--bill {
  color: var(--bill);
  border-color: var(--bill);
}
.tag--rare {
  color: var(--rare);
  border-color: var(--rare);
}
.tag--off {
  color: var(--silt-text);
  border-color: var(--reed);
}

/* Rarity is the one place a second warm colour is allowed, because
   the tier genuinely is the thing you want to read first. */
.tier {
  display: inline-block;
  padding: calc(var(--px) * 0.5) calc(var(--px) * 1.5);
  font-family: var(--label);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  border: var(--rule) solid currentColor;
}
.tier--ultra {
  color: var(--rare);
}
.tier--legendary {
  color: var(--bill);
}
.tier--epic {
  color: #b98bff;
}
.tier--rare {
  color: var(--depth);
}
.tier--uncommon {
  color: #8fc27a;
}
.tier--common {
  color: var(--drift);
}

/* ---- a stat: small label over a big number ----------------------- */
.stat {
  display: flex;
  flex-direction: column;
  gap: calc(var(--px) * 1.5);
  min-width: 0;
}
.stat__v {
  font-family: var(--numeric);
  font-weight: var(--numeric-w);
  font-size: 21px;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--foam);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat__v small {
  font-size: 11px;
  color: var(--drift);
  margin-left: calc(var(--px) * 0.75);
}
.stat__note {
  font-size: 11px;
  color: var(--silt-text);
  line-height: 1.4;
}

/* ---- a meter that fills -----------------------------------------
   Named meter, not bar: the top navigation is .bar, and two blocks
   sharing a name is how a height of eight pixels ends up collapsing
   a header. */
.meter {
  height: calc(var(--px) * 2);
  background: var(--abyss);
  border: var(--rule) solid var(--reed);
  overflow: hidden;
}
.meter__fill {
  height: 100%;
  background: var(--bill);
  width: 0%;
  transition: width var(--step-slow) var(--steps-6);
}
.meter__fill--depth {
  background: var(--depth);
}

/* ---- empty state ------------------------------------------------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--px) * 3);
  padding: calc(var(--px) * 12) calc(var(--px) * 4);
  text-align: center;
  color: var(--drift);
}
.empty h3 {
  color: var(--foam);
}
.empty p {
  max-width: 46ch;
  font-size: var(--t-small);
}

/* ---- utility ----------------------------------------------------- */
.row {
  display: flex;
  align-items: center;
  gap: calc(var(--px) * 3);
}
.row--wrap {
  flex-wrap: wrap;
}
.row--between {
  justify-content: space-between;
}
.col {
  display: flex;
  flex-direction: column;
}
.grow {
  flex: 1 1 auto;
  min-width: 0;
}
.hide {
  display: none !important;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.tier--genesis {
  color: var(--on-bill);
  background: var(--bill);
  border-color: var(--bill);
}
