/* Satoshi's Shield. One printed watch sheet about the shield wall.
   Two materials: ink ground (the world) and stone paper (everything you read). */

@font-face { font-family: "Cabinet"; src: url("../fonts/CabinetGrotesk-Black.woff2") format("woff2"); font-weight: 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Cabinet"; src: url("../fonts/CabinetGrotesk-Bold.woff2") format("woff2"); font-weight: 700; 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 {
  --ground: #242424;
  --ground-deep: #1b1b1a;
  --ink: #17160f;
  --paper: #e2dbcc;
  --paper-sunk: #cdc4b0;
  --stone: #8d8373;
  --bone: #ded8cb;
  --bone-dim: #9b9384;
  --ember: #e8821e;
  --alarm: #d1452a;

  --display: "Cabinet", "Arial Black", system-ui, sans-serif;
  --mono: "Sligoil", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --gutter: clamp(18px, 4.6vw, 92px);
  --band: clamp(56px, 5.4vw, 96px);      /* air between bands */
  --rule: 2px;
  --slice: 9px;                           /* the printed rule, drawn inward by border-image */
  --pad: clamp(20px, 1.7vw, 32px);        /* window body inset */
  --shadow: 8px 8px 0 #0c0c0b;
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; overflow-x: clip; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--ground);
  color: var(--bone);
  font-family: var(--mono);
  font-size: 18px;
  line-height: 1.55;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;                       /* clip, never hidden: hidden freezes sticky */
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--ember); color: var(--ink); }
:focus-visible { outline: 3px solid var(--ember); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ------------------------------------------------------------- the ground */
/* More of the world, blurred and alive: the field of shields drifting on its own clock,
   with print dust crossing it on a second clock. Nothing follows the pointer. */
.ground { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: var(--ground); }
.ground-pic {
  position: absolute; inset: -8%;
  background: url("../img/ground.jpg") center / cover no-repeat;
  filter: blur(8px) grayscale(1) brightness(0.58) contrast(1.03);
  opacity: 0.62;
  animation: drift 150s ease-in-out infinite alternate;
}
.ground-veil { position: absolute; inset: 0; background: radial-gradient(130% 85% at 50% 0%, rgba(48,48,46,0.18) 0%, rgba(38,38,36,0.7) 70%, rgba(34,34,32,0.88) 100%); }
.ground-dust { position: absolute; inset: 0; width: 100%; height: 100%; }
@keyframes drift {
  from { transform: scale(1.04) translate3d(-1.2%, -0.8%, 0); }
  to   { transform: scale(1.1) translate3d(1.2%, 0.9%, 0); }
}

/* --------------------------------------------------------------- the sheet */
.sheet {
  position: relative; z-index: 1;
  max-width: 1760px; margin: 0 auto;
  padding: 0 var(--gutter) clamp(48px, 5vw, 96px);
}

/* the printed rail along the top of the sheet */
.rail {
  display: flex; align-items: center; gap: 16px;
  padding: clamp(18px, 1.6vw, 28px) 0 clamp(14px, 1.2vw, 20px);
  font-size: 16px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--bone-dim);
}
.rail-mark { width: 42px; height: 42px; flex: none; background: var(--ink); }
.rail-mark img { width: 100%; height: 100%; }
.rail-name { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: 0.01em; text-transform: none; color: var(--bone); }
.rail-facts {
  margin: 0 0 0 auto; padding: 0; list-style: none;
  display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: flex-end;
}
.rail-facts li { white-space: nowrap; }
.rail-facts li + li::before { content: "/"; color: var(--stone); margin-right: 10px; }
.rail-facts b { font-weight: 500; color: var(--bone); }

/* the masthead */
.masthead { position: relative; padding: clamp(14px, 1.4vw, 26px) 0 clamp(26px, 2.4vw, 44px); }
.masthead-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); gap: clamp(24px, 3vw, 64px); align-items: start; }
/* the mint, on the first screen: the address and the four places it lives */
.mint { margin-top: clamp(22px, 2vw, 36px); max-width: 720px; }
.mint .win-body { padding: clamp(16px, 1.3vw, 24px); }
.mint .sunk { margin: 0; padding: 13px 18px; }
/* Copy and the launchpad on the first row (the launchpad twice as wide), the three places to look below */
.keys.keys--mint { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.keys--mint .key { padding: 0 0.6em; }
.keys--mint .key--buy { grid-column: span 2; }
.tally { padding-top: clamp(6px, 1.2vw, 26px); }
.tally-label { margin: 0 0 6px; font-size: 16px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--bone-dim); }
.tally-num { margin: 0; font-family: var(--display); font-weight: 900; font-size: clamp(44px, 6.2vw, 116px); line-height: 0.92; letter-spacing: -0.03em; color: var(--ember); font-variant-numeric: tabular-nums; }
.tally-worth { margin: 10px 0 0; font-size: 18px; letter-spacing: 0.02em; color: var(--ember); }
.tally-note { margin: 12px 0 0; max-width: 30ch; font-size: 17px; color: var(--bone-dim); }
@media (max-width: 1080px) { .masthead-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; } .tally { padding-top: 0; } .mint { max-width: none; } }
.head {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(40px, 7.6vw, 142px); line-height: 0.9; letter-spacing: -0.028em;
  margin: 0; color: var(--bone); text-wrap: balance;
}
.head em { font-style: normal; color: var(--ember); }
.sub {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(19px, 1.85vw, 34px); line-height: 1.22; letter-spacing: -0.005em;
  margin: clamp(14px, 1.2vw, 22px) 0 0; max-width: 30ch; color: var(--bone);
}
/* printed halftone circles bleed off the sheet in the air between bands, never over a line of type */
.dots-a, .dots-b { display: block; pointer-events: none; opacity: 0.42; }
.dots-a {
  width: clamp(150px, 22vw, 380px);
  margin: calc(var(--band) * -0.66) calc(var(--gutter) * -1.05) calc(var(--band) * -0.34) auto;
  animation: turn 240s linear infinite;
}
.dots-b {
  width: clamp(120px, 16vw, 280px);
  margin: calc(var(--band) * -0.6) auto calc(var(--band) * -0.3) calc(var(--gutter) * -1.05);
  opacity: 0.3;
  animation: turn 180s linear infinite reverse;
}
@keyframes turn { to { transform: rotate(360deg); } }

/* the contents line of the sheet: the nav */
.contents {
  position: relative;
  display: flex; flex-wrap: wrap; gap: clamp(18px, 3vw, 64px);
  padding: 14px 0 0; margin: 0 0 var(--band);
  list-style: none;
}
.contents::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: var(--rule); background: var(--stone); }
.contents a {
  display: flex; align-items: baseline; gap: 12px;
  min-height: 48px; padding: 6px 0; text-decoration: none; color: var(--bone-dim);
}
.contents a:hover { color: var(--bone); }
.contents .no { font-size: 16px; letter-spacing: 0.1em; color: var(--stone); }
.contents .what { font-family: var(--display); font-weight: 700; font-size: clamp(18px, 1.25vw, 23px); color: inherit; }
.contents .n { font-size: 16px; letter-spacing: 0.08em; color: var(--stone); }
.contents [aria-current="page"] { color: var(--bone); }
.contents [aria-current="page"] .no { color: var(--ember); }
.contents [aria-current="page"]::before {
  content: ""; width: 13px; height: 13px; background: var(--ember); flex: none; align-self: center;
}

/* ---------------------------------------------------------------- bands */
.band { margin: 0 0 var(--band); }
.band-label {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(23px, 2.05vw, 38px); line-height: 1.1; letter-spacing: -0.012em;
  margin: 0 0 clamp(18px, 1.6vw, 30px); color: var(--bone);
}
.caption { margin: 18px 0 0; font-size: 16px; color: var(--bone-dim); text-align: center; letter-spacing: 0.02em; }

/* ---------------------------------------------------------------- windows */
.win {
  position: relative;
  background-color: var(--paper);
  background-image: url("../img/paper.jpg");
  background-size: 420px;
  color: var(--ink);
  border: var(--slice) solid transparent;
  border-image: url("../img/rule.png") 18 / var(--slice) / 0 round;
  box-shadow: var(--shadow);
  min-width: 0;
}
.win-strip {
  display: flex; align-items: center; gap: 14px;
  background-color: var(--ink);
  background-image: url("../img/ink.jpg");
  background-size: 360px;
  color: var(--paper);
  padding: 11px 14px 11px 24px;
  min-height: 48px;
}
.win--ember .win-strip { background-color: var(--ember); background-image: none; color: #1a0f04; }
.win--ink { background-color: var(--ink); background-image: url("../img/ink.jpg"); color: var(--bone); }
.win--ink .win-strip { background-color: var(--paper); background-image: url("../img/paper.jpg"); color: var(--ink); }
.win-title {
  font-family: var(--mono); font-weight: 700; font-size: 17px; letter-spacing: 0.11em;
  text-transform: uppercase; margin: 0;
}
.win-key {
  margin-left: auto; flex: none; width: 34px; height: 34px; padding: 0;
  background: none; border: 0; cursor: pointer; display: grid; place-items: center;
}
.win-key img { width: 26px; height: 26px; }
.win-key:hover img { transform: scale(1.09); }
.win-body { padding: var(--pad); }
.win[data-open="false"] .win-body { display: none; }

/* rows inside a window */
.rows { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.rows li { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; }
.rows li::before { content: "\25B7"; color: var(--stone); }
.rows .v { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.rows .v.num { font-family: var(--display); font-weight: 700; font-size: 1.22em; letter-spacing: -0.01em; }
.rows li + li { padding-top: 10px; }
.rows li + li::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: rgba(23, 22, 15, 0.16); }
.win--ink .rows li + li::after { background: rgba(222, 216, 203, 0.2); }
.win--ink .rows li::before { color: var(--ember); }
.win p { margin: 0 0 1em; max-width: 78ch; }
.win p:last-child { margin-bottom: 0; }

/* the meter the reference uses under a value */
.meter { height: 6px; background: rgba(23, 22, 15, 0.16); grid-column: 2 / -1; }
.meter span { display: block; height: 100%; background: var(--ember); }

/* ------------------------------------------------------------- diagram row */
.flow { display: grid; grid-template-columns: minmax(0, 1.15fr) auto minmax(0, 0.8fr) auto minmax(0, 1.15fr); align-items: center; gap: clamp(10px, 1.1vw, 22px); }
.flow > .stack { display: grid; gap: clamp(14px, 1.3vw, 24px); align-content: center; }
.arrow-line { display: flex; align-items: center; justify-self: stretch; gap: 0; min-width: clamp(44px, 4vw, 86px); }
.arrow-line::before { content: ""; flex: 1; height: 2px; background: var(--stone); }
.arrow { width: clamp(20px, 1.7vw, 32px); flex: none; opacity: 0.9; }
.plate-frame {
  border: 2px dashed var(--stone); padding: clamp(14px, 1.5vw, 28px);
  display: grid; justify-items: center; gap: 12px;
}
.plate-frame img { width: min(100%, 320px); }
.plate-frame .tag {
  font-size: 16px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--bone-dim);
  border: 1px solid var(--stone); padding: 9px 18px;
}

/* ------------------------------------------------------------------ three */
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 1.5vw, 30px); align-items: stretch; }
.three .win { display: flex; flex-direction: column; }
.three .win-body { flex: 1; }

/* ------------------------------------------------------------------ today */
.today { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: clamp(10px, 1.1vw, 22px); }
.today > .arrow-line { align-self: center; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(16px, 1.5vw, 34px); align-items: start; }
@media (max-width: 1080px) { .pair { grid-template-columns: minmax(0, 1fr); } }

/* the contract */
.sunk {
  background: var(--paper-sunk);
  box-shadow: inset 2px 2px 0 rgba(23, 22, 15, 0.22);
  padding: 18px 20px;
  font-size: 17px; line-height: 1.45;
  overflow-wrap: anywhere; min-width: 0;
  user-select: all;
}
.sunk.empty { color: #6d6557; user-select: none; }
.sunk.address { word-break: break-all; }
.win p.fine + .sunk, .win .rows + .fine { margin-top: 1.1em; }
.keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.key {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 1.3em; text-decoration: none; text-align: center;
  background-color: var(--paper); background-image: url("../img/paper.jpg"); background-size: 300px;
  color: var(--ink);
  border: 7px solid transparent; border-image: url("../img/rule.png") 18 / 7px / 0 round;
  font-size: 17px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500;
  cursor: pointer;
}
.key.wide { grid-column: 1 / -1; }
.key img { width: 20px; height: 20px; flex: none; }
.key:hover { background-color: #efe9dd; }
.key:active { transform: translate(2px, 2px); }
.key[aria-disabled="true"] { color: #857c6c; cursor: not-allowed; }
.key[aria-disabled="true"] img { opacity: 0.45; }
.key .ok { color: #2f6b36; }

/* -------------------------------------------------------------- the wall */
.wall-wrap { position: relative; }
.wall-canvas { width: 100%; display: block; image-rendering: pixelated; background: var(--ground-deep); }
.wall-head { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; margin-bottom: 16px; }
.find { display: flex; gap: 10px; align-items: center; }
.find input {
  font: inherit; font-size: 17px; color: var(--ink); min-height: 52px; width: clamp(140px, 22vw, 260px);
  padding: 0 16px; border: 0; background: var(--paper-sunk); box-shadow: inset 2px 2px 0 rgba(23,22,15,0.22);
}
.legend { display: flex; gap: 20px; flex-wrap: wrap; font-size: 16px; color: var(--bone-dim); margin-left: auto; }
.legend i { display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; font-style: normal; }
.source-strip {
  position: relative; margin-top: 0;
  padding: 16px var(--pad); font-size: 16px; color: #6d6557;
}
.source-strip::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: rgba(23,22,15,0.2); }
.win--ink .source-strip { color: var(--bone-dim); }
.win--ink .source-strip::before { background: rgba(222,216,203,0.2); }

/* the detail of one output */
.detail { display: grid; gap: 10px; }

/* ----------------------------------------------------------------- the log */
.log { font-size: 17px; line-height: 1.6; margin: 0; max-height: 330px; overflow: auto; overscroll-behavior: contain; }
.log div { white-space: pre-wrap; overflow-wrap: anywhere; }
.log .t { color: var(--stone); }
.log .cursor { display: inline-block; width: 11px; height: 17px; background: var(--ember); vertical-align: -2px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* -------------------------------------------------------------- the close */
.close { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(16px, 1.5vw, 30px); align-items: stretch; }
.close > .win { display: flex; flex-direction: column; }
.close > .win > .win-body { flex: 1; display: flex; flex-direction: column; }
.band:last-of-type { margin-bottom: 0; }
.log { flex: 1; min-height: 260px; }
#feed { min-height: 180px; }
.fine { margin-top: 1.4em; font-size: 16px; color: #6d6557; }
.win--ink .fine { color: var(--bone-dim); }

/* stacked window: the reference prints the spec sheet as three sheets offset behind one */
.stacked { position: relative; padding: 0 20px 20px 0; }
.stacked::before, .stacked::after {
  content: ""; position: absolute; inset: 0 20px 20px 0; background: var(--paper-sunk);
  border: 2px solid var(--ink); z-index: -1;
}
.stacked::before { transform: translate(10px, 10px); }
.stacked::after { transform: translate(20px, 20px); }

/* state */
.state-broken { --ember: var(--alarm); }

/* ------------------------------------------------------------------ phone */
@media (max-width: 1080px) {
  .flow { grid-template-columns: minmax(0, 1fr); }
  .flow .arrow-line { transform: rotate(90deg); justify-self: center; min-width: 70px; width: 70px; margin: 6px 0; }
  .today { grid-template-columns: minmax(0, 1fr); }
  .today .arrow-line { transform: rotate(90deg); justify-self: center; min-width: 70px; width: 70px; margin: 6px 0; }
  .three { grid-template-columns: minmax(0, 1fr); }
  .close { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  body { font-size: 17px; }
  .rail { flex-wrap: wrap; row-gap: 10px; font-size: 16px; letter-spacing: 0.08em; }
  .rail-name { font-size: 18px; white-space: nowrap; }
  .rail-facts { width: 100%; margin-left: 0; justify-content: flex-start; }
  .rail-facts li:nth-child(-n+2) { display: none; }
  .rail-facts li:nth-child(3)::before { content: none; }
  .keys.keys--mint { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .keys--mint #copy { grid-column: 1 / -1; }
  .keys--mint .key--buy { grid-column: auto; }
  .keys--mint .long { display: none; }
  .contents { gap: 2px 18px; }
  .contents a { min-height: 44px; }
  .dots-a, .dots-b { display: none; }
  .sub { max-width: none; }
  .keys { grid-template-columns: minmax(0, 1fr); }
  .rows li { grid-template-columns: 20px minmax(0, 1fr); }
  .rows .v { grid-column: 2; text-align: left; }
  .legend { margin-left: 0; }
  .find { width: 100%; }
  .find input { flex: 1; width: auto; min-width: 0; }
  .find .key { min-width: 92px !important; padding: 0 0.8em; }
  /* the sheet shows the top of the wall; the whole of it is one tap away on its own page */
  .wall-wrap--preview { max-height: 460px; overflow: hidden; }
  .wall-wrap--preview::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 120px; pointer-events: none;
    background: linear-gradient(to bottom, rgba(23, 22, 15, 0), var(--ink)); }
}
@media (prefers-reduced-motion: reduce) {
  .ground-pic, .dots-a, .dots-b, .log .cursor { animation: none; }
}

/* the woken record */
.event { position: relative; }
.event + .event { margin-top: clamp(22px, 2vw, 36px); padding-top: clamp(22px, 2vw, 36px); }
.event + .event::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: rgba(23,22,15,0.18); }
.event-head { font-family: var(--display); font-weight: 700; font-size: clamp(20px, 1.5vw, 27px); margin: 0 0 14px; }
.event .keys { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .event .keys { grid-template-columns: minmax(0, 1fr); } }
.wall-band .win-body { padding-bottom: calc(var(--pad) + 6px); }
#history .rows li { grid-template-columns: minmax(0, 1fr) auto; }
#history a { text-underline-offset: 3px; }

/* the shield outputs that were already gone when the set was built */
.gone { list-style: none; margin: 1.4em 0 0; padding: 0; display: grid; gap: 2px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.gone li { display: grid; gap: 2px; padding: 14px 18px; background: rgba(222, 216, 203, 0.05); }
.gone b { font-weight: 500; font-size: 17px; color: var(--bone); }
.gone a { font-size: 16px; color: var(--ember); text-underline-offset: 3px; }
.gone span { font-size: 16px; color: var(--stone); }
