/* vault.md: one file, read top to bottom, over the live ASCII model. */

.vault-page {
  min-height: 100svh;
  background: var(--black);
}

.vault-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--black);
}

.vault-backdrop img,
.vault-live {
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100vw, 133.34svh);
  height: max(75vw, 100svh);
  max-width: none;
  transform: translate(-50%, -50%);
}

.vault-backdrop img {
  object-fit: cover;
}

.vault-live {
  aspect-ratio: auto;
  background: transparent;
}

.vault-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 40%, #05050599 0%, #050505d9 62%, #050505 100%);
}

.page-header {
  z-index: 8;
}

/* ---------------------------------------------------------------------------------------------
   The file
   --------------------------------------------------------------------------------------------- */

.vault {
  position: relative;
  z-index: 1;
  width: min(940px, 100% - 96px);
  margin: 0 auto;
  padding: 168px 0 96px;
}

.file {
  position: relative;
  border: 1px solid #deded624;
  background: #090a08f0;
}

.file-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 18px 0 0;
  border-bottom: 1px solid #deded61c;
  color: #7c7f75;
  font-size: 12px;
}

.file-name {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
  padding: 0 20px 0 18px;
  border-right: 1px solid #deded61c;
  color: #fff;
}

.file-name::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  right: 0;
  height: 2px;
  background: var(--lime);
}

.file-name i {
  width: 9px;
  height: 9px;
  background: var(--lime);
  transform: rotate(12deg);
}

.file-scroll {
  overflow-x: auto;
  scrollbar-width: none;
}

.file-scroll::-webkit-scrollbar {
  display: none;
}

.lines {
  --gutter: 68px;
  counter-reset: line;
  min-width: max-content;
  padding: 22px 28px 30px 0;
  color: var(--text);
  font: 500 15px/30px var(--mono);
  transition: filter 500ms ease, opacity 500ms ease;
}

.lines > li {
  position: relative;
  min-height: 30px;
  padding-left: calc(var(--gutter) + 22px);
  counter-increment: line;
  white-space: pre;
}

.lines > li::before {
  content: counter(line);
  position: absolute;
  top: 0;
  left: 0;
  width: var(--gutter);
  padding-right: 18px;
  border-right: 1px solid #deded614;
  color: #55584f;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.lines > li[hidden] {
  display: none;
}

.file[data-locked="true"] .lines {
  filter: blur(7px);
  opacity: 0.72;
  pointer-events: none;
  user-select: none;
}

.hash,
.bar,
.mk,
.dim,
.arrow,
.b {
  color: #6d7066;
}

.l-h1,
.l-h2 {
  color: #fff;
}

.l-h1 {
  font-size: 18px;
}

.lines b {
  color: #fff;
  font-weight: 500;
}

.path-gap {
  display: inline-block;
  width: 6ch;
}

.l-row {
  display: grid;
  grid-template-columns: 2ch 25ch 2ch 11ch 2ch;
}

.l-row .v {
  padding-right: 1ch;
  color: #fff;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.l-row .bar:last-child {
  text-align: right;
}

.v.is-new,
#p-vault.is-new {
  animation: value-in 300ms ease both;
}

@keyframes value-in {
  from {
    color: var(--lime);
  }
}

.l-quote {
  color: #c3c5bb;
}

.l-calc {
  display: grid;
  grid-template-columns: 14ch auto;
  justify-content: start;
}

.l-calc .k {
  color: #9a9d92;
}

.l-task {
  display: grid;
  grid-template-columns: 6ch 15ch 10ch auto;
  justify-content: start;
  color: #9a9d92;
}

.l-task .box i {
  color: var(--lime);
  font-style: normal;
}

.l-task.is-filled {
  color: var(--text);
}

.l-task.is-filled .t-state {
  color: var(--lime);
}

.l-task .t-amount,
.l-task .t-range {
  font-variant-numeric: tabular-nums;
}

.l-task .box.is-new {
  animation: value-in 150ms ease both;
}

/* The log: lines added at the top, in the one colour that means "bought". */

.lines > .l-log-host {
  min-height: 0;
  padding-left: 0;
  counter-increment: none;
}

.lines > .l-log-host::before {
  content: none;
}

.log > li {
  position: relative;
  display: grid;
  grid-template-columns: 2ch 12ch 13ch auto;
  justify-content: start;
  min-height: 30px;
  padding-left: calc(var(--gutter) + 22px);
  counter-increment: line;
  color: var(--lime);
  white-space: pre;
}

.log > li::before {
  content: counter(line);
  position: absolute;
  top: 0;
  left: 0;
  width: var(--gutter);
  padding-right: 18px;
  border-right: 1px solid #deded614;
  color: #55584f;
  text-align: right;
}

.log > li .tx {
  color: #6d7066;
}

.log > li.is-new {
  animation: log-in 200ms ease both;
}

@keyframes log-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.log > li.log-empty {
  display: block;
  color: #9a9d92;
}

/* Words between brackets are the buttons. */

.br {
  display: inline-block;
  color: #fff;
  transition: color 200ms ease;
}

.br + .br {
  margin-left: 2ch;
}

button.br:not(:disabled):hover,
a.br:hover {
  color: var(--lime);
}

button.br:not(:disabled):hover .b,
a.br:hover .b {
  color: var(--lime);
}

button.br:disabled {
  color: #7c7f75;
  cursor: default;
}

.field input {
  width: 13ch;
  padding: 0 1ch;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  text-align: right;
  font-variant-numeric: tabular-nums;
  caret-color: var(--lime);
}

.field:focus-within .b {
  color: var(--lime);
}

.l-acts {
  margin-top: 6px;
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  margin-left: 2px;
  background: var(--lime);
  vertical-align: -0.18em;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* Connected: the note is written in the file, as quote lines. */

.l-in {
  color: var(--lime);
}

.l-in .mk {
  color: #8fae36;
}

.lines > .l-in {
  white-space: normal;
}

.l-in-actions .br {
  color: #fff;
}

.in-addr {
  margin-left: 2ch;
  color: #9a9d92;
}

.file[data-wrong="true"] #in-read {
  display: none;
}

/* ---------------------------------------------------------------------------------------------
   The gate
   --------------------------------------------------------------------------------------------- */

.gate {
  position: absolute;
  top: 118px;
  left: 50%;
  z-index: 3;
  width: min(480px, 100% - 40px);
  transform: translateX(-50%);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 80px #000000b3;
  transition: opacity 300ms ease, transform 300ms ease;
}

.gate[hidden] {
  display: none;
}

.gate.is-leaving {
  opacity: 0;
  transform: translate(-50%, -10px);
}

.gate-prompt {
  display: flex;
  align-items: center;
  gap: 1ch;
  height: 44px;
  padding: 0 20px;
  background: #050505;
  color: var(--lime);
  font-size: 13px;
}

.gate-prompt span:first-child {
  color: #8fae36;
}

.gate-prompt .cursor {
  margin-left: -0.4ch;
}

.gate-body {
  padding: 26px 24px 22px;
}

.gate-title {
  font: 500 28px/1.2 var(--mono);
  letter-spacing: -0.04em;
}

.gate-text {
  margin-top: 10px;
  color: var(--ink-soft);
}

.gate-wallets {
  display: grid;
  gap: 6px;
  margin-top: 22px;
}

.gate-wallets:empty {
  display: none;
}

.wallet-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 56px;
  padding: 0 16px;
  background: #050505;
  color: #fff;
  font: 500 14px/1.4 var(--mono);
  text-align: left;
  transition: background-color 200ms ease, color 200ms ease;
}

.wallet-row img {
  width: 24px;
  height: 24px;
}

.wallet-row .wallet-plus {
  margin-left: auto;
  color: var(--lime);
  transition: transform 500ms var(--ease), color 200ms ease;
}

.wallet-row:hover,
.wallet-row:focus-visible {
  background: var(--lime);
  color: #050505;
}

.wallet-row:hover .wallet-plus,
.wallet-row:focus-visible .wallet-plus {
  color: #050505;
  transform: rotate(90deg);
}

.wallet-row[aria-busy="true"] {
  background: #1d1e1a;
  color: #a4a69e;
  cursor: progress;
}

.gate :focus-visible {
  outline-color: #050505;
}

.gate-none {
  margin-top: 22px;
  padding: 14px 16px;
  border: 1px solid #080a0433;
  color: var(--ink-soft);
}

.gate-foot {
  margin-top: 18px;
  font-size: 13px;
}

.gate-foot a {
  border-bottom: 1px solid currentColor;
}

.gate-foot a:hover {
  color: #4b5a12;
}

/* ---------------------------------------------------------------------------------------------
   Header, once connected
   --------------------------------------------------------------------------------------------- */

.addr-chip,
.close-file {
  display: grid;
  place-items: center;
  height: 56px;
  padding: 0 18px;
  font: 500 14px/1.4 var(--mono);
  white-space: nowrap;
}

.addr-chip {
  border: 1px solid #d2fc5266;
  color: var(--lime);
}

.close-file {
  background: #1d1e1a;
  color: #fff;
  transition: background-color 250ms ease, color 250ms ease;
}

.close-file:hover {
  background: #2b2d26;
  color: var(--lime);
}

.addr-chip[hidden],
.close-file[hidden],
#connect-top[hidden] {
  display: none;
}

.vault-links {
  display: flex;
  gap: 24px;
  margin-top: 22px;
  color: var(--text);
  font-size: 13px;
}

.vault-links a {
  transition: color 250ms ease;
}

.vault-links a:hover {
  color: var(--lime);
}

.vault-note {
  max-width: 62ch;
  margin-top: 14px;
  color: #7c7f75;
  font-size: 12px;
}

/* ---------------------------------------------------------------------------------------------
   900px wide and under
   --------------------------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .vault {
    width: auto;
    margin: 0;
    padding: 96px 20px 72px;
  }

  .lines {
    --gutter: 40px;
    padding: 16px 16px 22px 0;
    font-size: 13px;
    line-height: 27px;
  }

  .lines > li,
  .log > li {
    min-height: 27px;
    padding-left: calc(var(--gutter) + 12px);
  }

  .lines > li::before,
  .log > li::before {
    padding-right: 10px;
  }

  .l-h1 {
    font-size: 15px;
  }

  .l-row {
    grid-template-columns: 2ch 23ch 2ch 8ch 2ch;
  }

  .path-gap {
    display: block;
    width: 0;
    height: 0;
  }

  .l-calc {
    grid-template-columns: 12ch auto;
  }

  .l-task {
    grid-template-columns: 6ch 13ch 8ch auto;
  }

  .log > li {
    grid-template-columns: 2ch 10ch 11ch auto;
  }

  .field input {
    width: 11.5ch;
    padding: 0 0.5ch;
  }

  .br + .br {
    margin-left: 1ch;
  }

  .lines > .l-in {
    max-width: calc(100vw - 42px);
  }

  .gate {
    top: 88px;
  }

  .gate-body {
    padding: 22px 18px 18px;
  }

  .gate-title {
    font-size: 24px;
  }

}

@media (prefers-reduced-motion: reduce) {
  .lines,
  .gate,
  .wallet-row,
  .wallet-row .wallet-plus,
  .br,
  .close-file {
    transition: none;
  }

  .cursor,
  .v.is-new,
  #p-vault.is-new,
  .l-task .box.is-new,
  .log > li.is-new {
    animation: none;
  }
}
