/* Petchy Catch: one liquid crystal deck face, two colours, drawn flat.
   Built to art/ref/eva-display.jpg: black ground, one mint ink, hairline outlines, seven segment
   numerals, boxed words, a rising ramp, pictogram lamps. Measures come from the teardown in NOTE.md:
   the panel is the whole column, its frame is 0.54% of the column, its radius 3% of it. */

@font-face { font-family: "Rajdhani"; src: url("fonts/Rajdhani-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Rajdhani"; src: url("fonts/Rajdhani-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Sligoil"; src: url("fonts/Sligoil-Micro.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Sligoil"; src: url("fonts/Sligoil-MicroBold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Seg7"; src: url("fonts/DSEG7Classic-Bold.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "Seg7i"; src: url("fonts/DSEG7Classic-Italic.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "Seg14"; src: url("fonts/DSEG14Classic-Bold.woff2") format("woff2"); font-display: block; }

:root {
  --black: #000000;
  --ink-hi: #2BD79F;   /* 11.3:1 on black. values, the lit lamp, the open key */
  --ink: #12B183;      /*  7.6:1. labels, outlines, body text */
  --ink-mid: #0FA87D;  /*  6.9:1. secondary text */
  --ink-mute: #0B8C6D; /*  5.0:1. rules, separators, keys that cannot be pressed yet */
  --ghost: #073A2E;    /* the unlit segments of the glass. decoration, never text */

  --page: 1120px;
  --gutter: 24px;
  --frame: 7px;
  --rule: 2px;        /* hairlines: table rows, the divider under the readout */
  --drawn: 3px;       /* the weight his own hand drawn boxes carry, on every frame of the deck */
  --radius: 32px;
  --pad: 28px;
  /* every bordered box that can carry a display numeral keeps 32 px of side air at every width:
     that is the ceiling of the kit's 1 em rule, and shots.mjs measures it on every screen. */
  --cell-pad: 20px 32px;

  --f-label: "Rajdhani", "Arial Narrow", sans-serif;
  --f-text: "Sligoil", ui-monospace, "Cascadia Mono", Menlo, monospace;
  --f-seg: "Seg7", ui-monospace, monospace;
  --f-seg-i: "Seg7i", "Seg7", ui-monospace, monospace;
  --f-word: "Seg14", "Seg7", ui-monospace, monospace;

  --t-press: .08s;
  --t-hover: .16s;
  --t-open: .26s;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html { background: var(--black); }

body {
  margin: 0;
  background: var(--black);
  color: var(--ink);
  font: 400 16px/1.6 var(--f-text);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

b, strong { font-weight: 700; color: var(--ink-hi); }

a { color: var(--ink-hi); text-decoration-thickness: 1px; text-underline-offset: 3px; }

:focus-visible { outline: 3px solid var(--ink-hi); outline-offset: 3px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink-hi); color: var(--black);
  font: 700 16px/1 var(--f-label); letter-spacing: .08em; text-transform: uppercase;
  padding: 16px 22px; z-index: 9;
}
.skip:focus { left: 16px; top: 16px; }

.noscript {
  max-width: var(--page); margin: 24px auto; padding: 20px 24px;
  border: var(--rule) solid var(--ink); font-size: 16px;
}

.page {
  width: min(100% - var(--gutter) * 2, var(--page));
  margin: 0 auto;
  padding: 48px 0 96px;
}

/* ---------------------------------------------------------------- masthead
   The reference sets its word at a cap height of 9% of the column. This word is twelve characters
   of a condensed face with ascenders and a descender, so it reaches that cap height at half the
   column; the strap takes the other half and the lockup still runs edge to edge. */

.mast {
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(0, 1fr);
  gap: 32px;
  align-items: end;
}

.mast__word {
  display: block;
  width: 100%;
  height: auto;
}

.mast__strap {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink);
}

/* ------------------------------------------------------------- the deck */

.deck {
  margin-top: 28px;
  border: var(--frame) solid var(--ink);
  border-radius: var(--radius);
  padding: var(--pad);
  position: relative;
  overflow: hidden;
}

/* the glass refreshes: one scan line crossing the panel on its own clock, with a short wash in
   front of it. A thin line rather than a fog, because the whole sheet is drawn in one flat ink. */
.deck::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: linear-gradient(to bottom,
    transparent 0,
    rgba(43, 215, 159, .05) 62%,
    rgba(43, 215, 159, .10) 92%,
    rgba(43, 215, 159, .42) 97%,
    rgba(43, 215, 159, .42) 100%);
  background-size: 100% 96px;
  background-repeat: no-repeat;
  animation: sweep 7.5s linear infinite;
  will-change: background-position;
}
@keyframes sweep { from { background-position: 0 -110px; } to { background-position: 0 calc(100% + 110px); } }

.deck__grid {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: var(--pad);
  align-items: stretch;
}

/* ------------------------------------------------- the program column (nav) */

.pgm { display: flex; flex-direction: column; min-width: 0; }

.pgm__head,
.cell__label,
.coin__label,
.lamp__cap,
.rd__label {
  margin: 0 0 10px;
  font: 700 20px/1 var(--f-label);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
}

.pgm__keys { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; }

.pgm__key {
  display: flex; align-items: center; gap: 14px;
  min-height: 54px;
  padding: 12px 22px;
  border: var(--drawn) solid var(--ink-mute);
  color: var(--ink);
  text-decoration: none;
  transition: background var(--t-hover), color var(--t-hover), border-color var(--t-hover);
}
.pgm__no { font: 400 20px/1 var(--f-seg); color: var(--ink-mid); }
.pgm__word { font: 700 20px/1 var(--f-label); letter-spacing: .08em; text-transform: uppercase; }
.pgm__key:hover { border-color: var(--ink-hi); color: var(--ink-hi); }
.pgm__key:hover .pgm__no { color: var(--ink-hi); }
.pgm__key.is-open {
  background: var(--ink-hi);
  border-color: var(--ink-hi);
  color: var(--black);
}
.pgm__key.is-open .pgm__no { color: var(--black); }

/* --------------------------------------------------------------- readout */

.readout { display: flex; flex-direction: column; gap: 18px; min-width: 0; justify-content: space-between; }

/* the values strip: the machine's own band, exactly the reference's thin rectangle */
.rd__strip {
  display: grid;
  gap: 24px;
  border: var(--drawn) solid var(--ink);
  padding: var(--cell-pad);
  align-content: start;
}
/* minmax(0, ...) on every track: without it a long readout widens its own column and pushes the
   other two cells into each other, which is exactly what a seven segment string does */
.rd__strip--3 { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr) minmax(0, 1fr); }
.rd__strip--2 { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); }
.rd__strip--1 { grid-template-columns: minmax(0, 1fr); }

.rd__cell { min-width: 0; }
.rd__label { margin-bottom: 8px; color: var(--ink-mid); }
.rd__note { margin: 8px 0 0; font-size: 16px; color: var(--ink-mid); }

/* seven segment value with its unlit glass behind it */
.segline { display: flex; align-items: baseline; gap: 0; flex-wrap: wrap; }
.seg { position: relative; display: inline-block; line-height: 1; color: var(--ink-hi); white-space: nowrap; }
.seg__ghost { position: absolute; left: 0; top: 0; color: var(--ghost); pointer-events: none; }
.seg__v { position: relative; }
.seg--xl { font: 400 96px/1 var(--f-seg); }
.seg--lg { font: 400 52px/1 var(--f-seg); }
.seg--md { font: 400 34px/1 var(--f-seg); }
.seg--i { font-family: var(--f-seg-i); }
.seg--word { font-family: var(--f-word); letter-spacing: .02em; }
.seg--mute .seg__v { color: var(--ink-mute); }

.seg__unit {
  margin-left: 10px;
  font: 700 20px/1 var(--f-label);
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-mid);
}

/* the chip and the ramp share one line, like START ID beside the ramp */
.rd__line { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: end; }

.chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px;
  padding: 10px 24px;
  border: var(--drawn) solid var(--ink);
  font: 700 20px/1 var(--f-label);
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-hi);
  white-space: nowrap;
}
.chip.is-shut { color: var(--ink-mute); border-color: var(--ink-mute); }
.chip.is-on { background: var(--ink-hi); border-color: var(--ink-hi); color: var(--black); }

.ramp {
  display: flex; align-items: flex-end; gap: 3px;
  height: 64px;
  min-width: 0;
  border-bottom: var(--rule) solid var(--ink-mute);
  padding-bottom: 4px;
}
.ramp__bar {
  flex: 1 1 0;
  min-width: 2px;
  background: var(--ink);
  height: 6%;
  transition: height .45s ease-out;
}
.ramp__bar:last-child { background: var(--ink-hi); }

/* the lamp row, and the difficulty mark in the corner. A grid, not a flex row: four equal cells so
   the lamps line up across every program whatever their readings say, and the mark closes the row. */
.rd__lamps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 16px;
  align-items: center;
}

.lamp { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lamp__ico {
  width: 34px; height: 34px; flex: 0 0 34px;
  background: var(--ink-mute);
  -webkit-mask: var(--src) center / contain no-repeat;
  mask: var(--src) center / contain no-repeat;
  transition: background var(--t-hover);
}
.lamp__cap { margin: 0; font-size: 17px; line-height: 1.25; color: var(--ink-mute); letter-spacing: .08em; min-width: 0; overflow-wrap: anywhere; }
.lamp.is-on .lamp__ico { background: var(--ink-hi); }
.lamp.is-on .lamp__cap { color: var(--ink-hi); }

.dmark { display: flex; align-items: baseline; gap: 12px; justify-self: end; }
.dmark__cap { font: 700 18px/1 var(--f-label); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-mid); }

/* ------------------------------------------------------------- coin band */

/* a divider is a rule of its own, not a border on the band: a border would make the band a box and
   press every word in it against an edge that is not really there */
.deck__rule { height: var(--rule); background: var(--ink-mute); margin: var(--pad) 0 0; }

.coin {
  margin-top: var(--pad);
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: var(--pad);
  align-items: start;
}
.coin__plate { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.coin__ticker { margin: 0; font: 700 34px/1 var(--f-label); letter-spacing: .02em; color: var(--ink-hi); }
.coin__chain { margin: 8px 0 0; font-size: 16px; color: var(--ink-mid); }
.coin__row { display: flex; gap: 12px; align-items: stretch; }
.coin__addr {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center;
  border: var(--drawn) solid var(--ink-mute);
  padding: 12px 20px;
  font: 400 16px/1.45 var(--f-text);
  color: var(--ink-hi);
  overflow-wrap: anywhere;
  user-select: all;
}
.coin__addr.is-empty { color: var(--ink-mute); user-select: none; }
.coin__note { margin: 10px 0 0; font-size: 16px; color: var(--ink-mid); }
.coin__keys { display: flex; gap: 10px; flex-wrap: wrap; }

/* ----------------------------------------------------------------- keys */

.key {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px;
  padding: 12px 22px;
  border: var(--drawn) solid var(--ink);
  background: transparent;
  color: var(--ink-hi);
  font: 700 18px/1 var(--f-label);
  letter-spacing: .08em; text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-hover), color var(--t-hover), border-color var(--t-hover), transform var(--t-press);
}
.key:hover:not(.is-off):not(:disabled) { background: var(--ink-hi); border-color: var(--ink-hi); color: var(--black); }
.key:active:not(.is-off):not(:disabled) { transform: translateY(2px); }
.key--copy { flex: 0 0 auto; }
.key--wide { padding-inline: 26px; min-height: 60px; font-size: 20px; }
.key--go { min-height: 60px; font-size: 20px; }
.key.is-off, .key:disabled {
  color: var(--ink-mute); border-color: var(--ink-mute); cursor: not-allowed; opacity: .74;
}
.key__cap { white-space: nowrap; }

/* The official marks stay the platforms' own files in their own colour: a mark key lights its
   outline and its word on hover and never fills, so nothing is ever recoloured or covered. */
.key--mark:hover:not(.is-off) { background: transparent; border-color: var(--ink-hi); color: var(--ink-hi); }
.mark { width: 22px; height: 22px; flex: 0 0 22px; display: block; object-fit: contain; }
.mark--dex { width: 24px; height: 24px; flex-basis: 24px; }

/* ---------------------------------------------------------- below the deck */

.below { margin-top: 56px; display: flex; flex-direction: column; gap: 44px; }

.band__head {
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
  margin: 0 0 18px;
  font: 700 26px/1.1 var(--f-label);
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-hi);
}
.band__head .band__no { font: 400 26px/1 var(--f-seg); color: var(--ink-mute); }

.cells { display: grid; gap: 18px; }
.cells--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cells--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.cell {
  border: var(--drawn) solid var(--ink-mute);
  padding: var(--cell-pad);
  display: flex; flex-direction: column; gap: 10px;
  min-width: 0;
}
.cell__label { margin: 0; color: var(--ink-mid); }
.cell__body { margin: 0; font-size: 16px; line-height: 1.65; color: var(--ink); min-width: 0; }
/* a hash is 64 characters and an address 44: every one of them breaks inside its own box */
code { overflow-wrap: anywhere; word-break: break-word; }
.cell__big { margin: 0; font: 400 34px/1 var(--f-seg); color: var(--ink-hi); }

.prose { max-width: 820px; font-size: 17px; line-height: 1.7; color: var(--ink); }
.prose p { margin: 0 0 14px; }
.prose p:last-child { margin-bottom: 0; }
.prose code { color: var(--ink-hi); overflow-wrap: anywhere; }

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.step { border: var(--drawn) solid var(--ink-mute); padding: var(--cell-pad); display: flex; flex-direction: column; gap: 10px; }
.step__no { font: 400 34px/1 var(--f-seg); color: var(--ink-mute); }
.step__t { margin: 0; font: 700 20px/1.15 var(--f-label); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-hi); }
.step__b { margin: 0; font-size: 16px; line-height: 1.6; }

/* tables keep the sheet's grammar: hairline rows, caps heads, mono values */
.table { width: 100%; border-collapse: collapse; font-size: 16px; }
.table th {
  text-align: left; padding: 12px 24px;
  font: 700 17px/1.2 var(--f-label); letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-mid);
  border-bottom: var(--rule) solid var(--ink-mute);
  white-space: nowrap;
}
.table td {
  padding: 14px 24px;
  border-bottom: var(--rule) solid rgba(11, 140, 109, .45);
  vertical-align: top;
  overflow-wrap: anywhere;
}
.table tr:last-child td { border-bottom: 0; }
.table .num { font-family: var(--f-seg); color: var(--ink-hi); font-size: 20px; }
.table .hash { font-size: 16px; color: var(--ink-hi); }
.wrap-x { border: var(--drawn) solid var(--ink-mute); }

/* On a narrow deck a seven column table is not squeezed, it is redrawn: the head goes away and
   every row becomes its own block of labelled lines. No sideways scroll anywhere on this site. */
@media (max-width: 860px) {
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr { border-bottom: var(--rule) solid var(--ink-mute); padding: 8px 0; }
  .table tr:last-child { border-bottom: 0; }
  .table td {
    display: grid;
    grid-template-columns: minmax(0, 11ch) minmax(0, 1fr);
    gap: 14px;
    align-items: baseline;
    padding: 8px 24px;
    border-bottom: 0;
  }
  .table td::before {
    content: attr(data-l);
    font: 700 16px/1.2 var(--f-label);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-mid);
  }
  .table td:empty { display: none; }
}

.empty {
  border: var(--drawn) solid var(--ink-mute);
  padding: 28px 32px;
  text-align: center;
  color: var(--ink-mid);
  font-size: 17px;
}

/* --------------------------------------------------------------- the hunt */

.hunt { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }

.field { display: flex; flex-direction: column; gap: 10px; }
.field__in {
  min-height: 52px;
  border: var(--drawn) solid var(--ink-mute);
  background: transparent;
  color: var(--ink-hi);
  font: 400 16px/1.4 var(--f-text);
  padding: 12px 20px;
  width: 100%;
}
.field__in::placeholder { color: var(--ink-mute); }
.field__in:focus { border-color: var(--ink-hi); }

.slider { width: 100%; accent-color: var(--ink-hi); height: 32px; }

.found {
  border: var(--drawn) solid var(--ink-hi);
  padding: var(--cell-pad);
  display: flex; flex-direction: column; gap: 12px;
}
.found.is-waiting { border-color: var(--ink-mute); }

.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.spark {
  width: 44px; height: 44px; flex: 0 0 44px;
  background: var(--ink-hi);
  -webkit-mask: url("img/spark.png") center / contain no-repeat;
  mask: url("img/spark.png") center / contain no-repeat;
}
.spark--lit { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.note { font-size: 16px; color: var(--ink-mid); margin: 0; }
.warn { font-size: 16px; color: var(--ink-hi); margin: 0; }
.risk { margin: 8px 0 0; font-size: 16px; color: var(--ink-mute); }

/* ------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .deck__grid { grid-template-columns: 1fr; }
  .pgm__keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .coin { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hunt { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .mast { grid-template-columns: 1fr; gap: 16px; }
  .mast__strap { margin-bottom: 0; }
  .cells--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rd__strip--3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .rd__line { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  /* a chip is words in a frame, and on a narrow deck the words wrap rather than run off it */
  .chip { white-space: normal; text-align: center; line-height: 1.3; }
  .rd__lamps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
  .dmark { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 640px) {
  :root { --pad: 18px; --radius: 22px; --frame: 4px; --cell-pad: 18px 32px; }
  .page { padding: 28px 0 64px; }
  .mast { grid-template-columns: 1fr; gap: 16px; }
  .mast__strap { font-size: 16px; margin-bottom: 0; }
  .cell__big, .step__no, .band__head .band__no { font-size: 28px; }
  .pgm__keys { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pgm__key { padding: 12px 20px; gap: 10px; }
  .pgm__word { font-size: 17px; }
  .rd__strip--3, .rd__strip--2 { grid-template-columns: minmax(0, 1fr); }
  .seg--xl { font-size: 48px; }
  .seg--lg { font-size: 36px; }
  .cells--3, .cells--2, .steps { grid-template-columns: 1fr; }
  .coin__keys { flex-direction: column; align-items: stretch; }
  .coin__keys .key { width: 100%; }
  /* the mint and its Copy key stack, or the key takes the row and the address is squeezed to one
     letter per line */
  .coin__row { flex-direction: column; align-items: stretch; }
  .key--copy { width: 100%; }
  .table th, .table td { padding: 12px 20px; }
  .below { margin-top: 36px; gap: 34px; }
  .band__head { font-size: 22px; }
}

@media (max-width: 400px) {
  :root { --gutter: 14px; --cell-pad: 16px 32px; }
  .pgm__key { padding: 12px 18px; gap: 8px; }
  .pgm__word { font-size: 16px; }
  .seg--xl { font-size: 40px; }
  .seg--lg { font-size: 32px; }
}

@media (max-width: 344px) {
  .pgm__keys { grid-template-columns: 1fr; }
  .pgm__key { padding: 12px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .deck::after { animation: none; background: none; }
  .spark--lit { animation: none; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
