/* Allocator. One printed allocation sheet.
   Paper, ink and vermilion are read off his reference poster; the acid green is his own, read off
   the avatar and header he made for X, and it only ever marks the coin that is taking the hour. */

@font-face {
  font-family: "Messapia";
  src: url("../fonts/Messapia-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Messapia";
  src: url("../fonts/Messapia-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sligoil";
  src: url("../fonts/Sligoil-Micro.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sligoil";
  src: url("../fonts/Sligoil-MicroMedium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sligoil";
  src: url("../fonts/Sligoil-MicroBold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #dcd8d4;
  --paper-deep: #cdc9c4;
  --ink: #0f0c0a;
  --ink-soft: #4a443f;
  --vermilion: #d8420a;
  --acid: #5eb601;
  --lime: #c8f55a;

  --display: "Messapia", Georgia, serif;
  --mono: "Sligoil", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --gutter: clamp(20px, 2.2vw, 44px);
  --cell-pad: clamp(22px, 1.6vw, 30px);
  --band: clamp(48px, 5vw, 86px);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 18px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* the paper itself: his reference is a printed sheet, so the ground is a generated paper plate,
   not a CSS gradient. It drifts very slowly, which is the only thing on the page that is not data. */
body::before {
  content: "";
  position: fixed;
  inset: -6%;
  background-image: url("../img/paper.webp");
  background-size: cover;
  opacity: 0.96;
  z-index: -2;
  animation: drift 90s linear infinite alternate;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 40%, rgba(220, 216, 212, 0) 55%, rgba(60, 54, 48, 0.14) 100%);
  z-index: -1;
  pointer-events: none;
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) }
  to { transform: translate3d(-24px, -18px, 0) }
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: inherit; }

/* ---------- the sheet ---------------------------------------------------- */

.sheet {
  position: relative;
  max-width: 1760px;
  margin: 0 auto;
  padding: clamp(22px, 2vw, 42px) clamp(26px, 2.4vw, 52px) clamp(26px, 2.4vw, 52px);
}
.sheet::before {
  content: "";
  position: absolute;
  inset: clamp(11px, 1vw, 21px) clamp(13px, 1.2vw, 26px) clamp(13px, 1.2vw, 26px);
  border: 1px solid var(--ink);
  pointer-events: none;
}

.corner {
  position: absolute;
  width: 34px;
  height: 34px;
  background-image: url("../img/mark-arrow.webp");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.9;
  pointer-events: none;
}
.corner-tr { top: clamp(22px, 2vw, 42px); right: clamp(26px, 2.4vw, 52px); }
.corner-bl { bottom: clamp(26px, 2.4vw, 52px); left: clamp(26px, 2.4vw, 52px); transform: rotate(180deg); }

/* ---------- blocks and labels ------------------------------------------- */

.label {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}
.label-accent { color: var(--vermilion); }

.rule-accent {
  display: block;
  width: 46px;
  height: 3px;
  margin-top: 18px;
  background: var(--vermilion);
}

.block { margin-bottom: clamp(18px, 1.6vw, 28px); }

/* a cell of the sheet is a printed plate, nine-sliced from a generated picture */
.cell {
  position: relative;
  padding: var(--cell-pad);
  border: 30px solid transparent;
  border-image: url("../img/cell.webp") 30 fill / 30px / 0 stretch;
}

/* ---------- 01 the hour -------------------------------------------------- */

.screen {
  position: relative;
  padding: clamp(18px, 1.6vw, 30px) 0 0;
}
.screen-sub { padding-top: clamp(56px, 5vw, 104px); }

.screen-grid {
  display: grid;
  grid-template-columns: minmax(300px, 33fr) 67fr;
  gap: clamp(26px, 2.6vw, 56px);
  align-items: start;
  padding-right: clamp(152px, 11vw, 190px);
}
.screen-grid > * { min-width: 0; }

.masthead { margin-bottom: clamp(18px, 1.6vw, 30px); }
.wordmark {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(40px, 3.9vw, 70px);
  line-height: 0.92;
  letter-spacing: 0.01em;
}
.ticker {
  margin: 10px 0 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--vermilion);
}

.round-no {
  margin: 0 0 10px;
  font-size: clamp(38px, 2.9vw, 50px);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.rows { margin: 0; }
.row {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
}
.row::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 1px;
  background: rgba(15, 12, 10, 0.26);
}
.row:first-child::before { display: none; }
.row dt { color: var(--ink-soft); font-size: 16px; letter-spacing: 0.06em; }
.row dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

.subject {
  margin: 0;
  font-size: clamp(19px, 1.35vw, 25px);
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: 0.01em;
}

.rules { margin: 0; padding: 0; list-style: none; }
.rules li {
  position: relative;
  display: flex;
  gap: 16px;
  padding: 12px 0;
  font-size: 17px;
  line-height: 1.5;
}
.rules li::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 1px;
  background: rgba(15, 12, 10, 0.26);
}
.rules li:first-child::before { display: none; }
.rules .n {
  flex: 0 0 auto;
  color: var(--vermilion);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.rules b { font-weight: 700; }

/* the diagram column */
.col-right { position: relative; }

.dial {
  position: absolute;
  top: 0;
  right: 0;
  width: clamp(104px, 9vw, 164px);
  aspect-ratio: 1;
  pointer-events: none;
}
.dial img, .dial canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.bench { position: relative; padding-right: clamp(100px, 8vw, 150px); padding-bottom: 58px; }
.bench-label { margin-bottom: 18px; }
.bench-wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.bench-row {
  position: relative;
  display: block;
  min-height: 180px;
  z-index: 1;
}
.bench-list {
  display: flex;
  align-items: flex-end;
  gap: clamp(10px, 1.1vw, 22px);
  width: 100%;
}
.bench-idle {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(10px, 1.1vw, 22px);
  width: 100%;
}
.bench-idle img {
  flex: 1 1 0;
  min-width: 0;
  max-width: 120px;
  height: clamp(100px, 9vw, 164px);
  object-fit: contain;
  object-position: bottom center;
  opacity: 0.72;
}
.bench-empty {
  margin: 10px 0 0;
  max-width: 56ch;
  color: var(--ink-soft);
  font-size: 17px;
}

.vial {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: transform 160ms ease;
}
.vial img {
  width: 100%;
  max-width: 120px;
  height: clamp(100px, 9vw, 164px);
  object-fit: contain;
  object-position: bottom center;
}
.vial .vial-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vial .vial-in {
  font-size: 16px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.vial:hover { transform: translateY(-4px) scale(1.03); }
.vial:hover img { filter: drop-shadow(0 6px 10px rgba(15, 12, 10, 0.28)); }
.vial:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 6px; }

.vial.is-leading img { filter: drop-shadow(0 0 16px rgba(94, 182, 1, 0.65)); }
.vial.is-leading .vial-name { color: #3d7a00; }
.vial.is-leading .vial-in { color: #3d7a00; font-weight: 700; }

/* the pot */
.pot {
  display: grid;
  grid-template-columns: clamp(92px, 8vw, 132px) 1fr;
  gap: clamp(20px, 2vw, 36px);
  align-items: stretch;
  margin-top: clamp(20px, 2vw, 36px);
}
.pot-glass { position: relative; min-height: 200px; }
.pot-shell {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
}
.pot-fill {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 7%;
  height: 0;
  overflow: hidden;
  z-index: 1;
  transition: height 900ms cubic-bezier(.3, .8, .4, 1);
}
.pot-fill img {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 300px;
  object-fit: cover;
  object-position: top center;
}

.pot-read { min-width: 0; }
.pot-sol {
  margin: 0 0 4px;
  font-size: clamp(42px, 3.4vw, 60px);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.pot-sol .unit {
  margin-left: 12px;
  font-size: max(16px, 0.3em);
  letter-spacing: 0.18em;
  color: var(--ink-soft);
  vertical-align: baseline;
}
.pot-note { font-size: 16px; color: var(--ink-soft); }

.ident { position: relative; margin-top: clamp(14px, 1.2vw, 20px); padding-top: 18px; }
.ident::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: rgba(15, 12, 10, 0.3); }
.mint {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.02em;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.mint.is-empty { color: var(--ink-soft); font-size: 17px; }

.keys { display: flex; flex-wrap: wrap; gap: 12px; }

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 clamp(18px, 1.3vw, 26px);
  border: 18px solid transparent;
  border-image: url("../img/key.webp") 18 fill / 18px / 0 stretch;
  background: none;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform 90ms ease;
}
.key img { height: 20px; width: auto; display: block; }
.key:hover { transform: translate(-1px, -1px); }
.key:active { transform: translate(1px, 1px); }
.key:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 4px; }
.key[disabled], .key[aria-disabled="true"] {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
}
.key-primary { color: #fff; background: var(--vermilion); border-image: none; border: 0; }
.key-primary[disabled] { background: var(--ink-soft); }

.key-state {
  margin: 10px 0 0;
  min-height: 1.4em;
  font-size: 16px;
  letter-spacing: 0.06em;
  color: var(--vermilion);
}

/* the five dots: the navigation of the sheet */
.dots {
  position: absolute;
  top: clamp(150px, 16vw, 268px);
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 3;
}
.dot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-height: 34px;
  text-decoration: none;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
.dot-mark {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: transparent;
}
.dot:hover { color: var(--ink); }
.dot:hover .dot-mark { background: rgba(15, 12, 10, 0.18); }
.dot.is-on { color: var(--ink); font-weight: 700; }
.dot.is-on .dot-mark { background: var(--vermilion); border-color: var(--vermilion); }
.dot:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 4px; }

/* the display band closes the first screen, exactly as the sheet's two words do */
.display-band {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  position: relative;
  margin-top: clamp(20px, 2vw, 38px);
  padding-top: clamp(10px, 0.9vw, 18px);
}
.display-band::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--ink); }
.display {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(46px, 6vw, 112px);
  line-height: 0.9;
  letter-spacing: 0.005em;
}

/* ---------- the later screens -------------------------------------------- */

.head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: clamp(16px, 2vw, 40px);
  margin-bottom: clamp(18px, 1.8vw, 32px);
}
.section-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(32px, 2.6vw, 46px);
  line-height: 1;
}
.head-note { margin: 0; max-width: 60ch; font-size: 17px; color: var(--ink-soft); }

.table-cell { overflow: hidden; }
.board { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.board th, .board td {
  padding: 15px 18px;
  text-align: left;
  border-bottom: 1px solid rgba(15, 12, 10, 0.22);
  font-size: 17px;
}
.board th {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom-color: var(--ink);
}
.board .num { text-align: right; }
.board tr:last-child td { border-bottom: 0; }
.board .empty-row td { color: var(--ink-soft); }
.board .mintcell { font-size: 16px; color: var(--ink-soft); }
.board .is-leading td { color: #3d7a00; font-weight: 700; }

.launch-grid, .how-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(20px, 2vw, 40px);
  align-items: stretch;
}
.how-grid .cell > p:first-child { margin-bottom: 14px; }
.how-grid p { font-size: 17px; }
.cell-risk { color: var(--ink); }

.field { margin-bottom: 20px; }
.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.field input {
  width: 100%;
  min-height: 52px;
  padding: 12px 18px;
  border: 1px solid var(--ink);
  background: rgba(255, 255, 255, 0.4);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 18px;
}
.field input::placeholder { color: rgba(15, 12, 10, 0.4); }
.field input:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 2px; }
.field-half { max-width: 280px; }

.form-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 26px; }
.form-state { margin: 18px 0 0; font-size: 16px; color: var(--ink-soft); }
.form-state.is-live { color: var(--vermilion); }

.deal { margin: 0; padding: 0; list-style: none; }
.deal li {
  position: relative;
  display: flex;
  gap: 16px;
  padding: 14px 0;
  font-size: 17px;
  line-height: 1.5;
}
.deal li::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 1px;
  background: rgba(15, 12, 10, 0.26);
}
.deal li:first-child::before { display: none; }
.deal .n { flex: 0 0 auto; color: var(--vermilion); font-weight: 700; }

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

@media (max-width: 1180px) {
  .screen-grid { grid-template-columns: 1fr; padding-right: 0; }
  /* the phone opens on the object, not on a column of text */
  .col-left { display: contents; }
  .masthead { order: 1; }
  .col-right { order: 2; }
  .block-round { order: 3; }
  .block-subject { order: 4; }
  .block-rules { order: 5; }
  .block { margin-bottom: 26px; }
  .dial { position: relative; top: auto; right: auto; width: clamp(96px, 20vw, 132px); margin: 0 0 12px auto; }
  .bench { padding-right: 0; }
  .dots {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 10px 22px;
    margin-top: 30px;
  }
  .dot { justify-content: flex-start; flex-direction: row-reverse; }
}

@media (max-width: 820px) {
  .launch-grid, .how-grid { grid-template-columns: 1fr; }
  .pot { grid-template-columns: 86px 1fr; }
  .table-cell { overflow-x: auto; }
  .board { min-width: 620px; }
}

@media (max-width: 700px) {
  .pot { grid-template-columns: 1fr; }
  .pot-glass { min-height: 190px; }
  .keys { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .key { width: 100%; }
  .key-icon { min-width: 0; }
}

@media (max-width: 560px) {
  body { font-size: 17px; }
  .sheet { padding: 18px; }
  .sheet::before { inset: 9px; }
  .corner-tr { top: 18px; right: 18px; }
  .corner-bl { bottom: 18px; left: 18px; }
  .cell { border-width: 16px; border-image-slice: 60 fill; border-image-width: 16px; padding: 22px; }
  .bench-row { gap: 8px; min-height: 150px; }
  .vial img { height: 96px; }
  .vial .vial-name, .vial .vial-in { font-size: 16px; }
  .display-band { flex-direction: column; align-items: flex-start; gap: 2px; }
  .keys { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  .pot-fill { transition: none; }
  .vial { transition: none; }
}

/* an empty board is a sentence, not a table that has to scroll sideways on a phone */
.table-cell:has(.empty-row) .board { min-width: 0; }
.table-cell:has(.empty-row) .board thead { display: none; }
.board .empty-row td { padding: 6px 18px 2px; }

/* a key that carries only an official mark */
.key-icon { min-width: 56px; padding: 0 16px; }
.key-icon img { height: 22px; }
.bench-idle { align-items: flex-end; }

/* the picture field: the browser's own file button is in the reader's language, so the page draws
   its own key and prints the file name beside it */
.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.key-file { display: inline-flex; }
.file-input:focus-visible + .key-file { outline: 2px solid var(--vermilion); outline-offset: 4px; }
.file-name {
  display: inline-block;
  margin-left: 16px;
  font-size: 16px;
  color: var(--ink-soft);
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
