/*
 * login.splendor.org
 *
 * Splendor monochrome: pure black, Cloud, and the brand greys. Red is kept
 * for refusals only. Manrope for words; monospace only for machine strings
 * (addresses, hashes, references, times). One bold moment per level: your
 * key drawn bit by bit when you sign in, the card arriving when the room opens.
 */

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/manrope-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/manrope-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/fonts/manrope-latin-800-normal.woff2') format('woff2');
}

:root {
  --black: #000000;
  --cloud: #fafbff;
  --smoke: #d3d6e0;
  --space: #9da2b3;
  --graphite: #6e7180;
  --arsenic: #40424d;
  --phantom: #1e1e24;
  --red: #ef4343;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --gutter: clamp(20px, 4vw, 40px);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--black);
  color: var(--cloud);
  font: 400 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:focus-visible {
  outline: 2px solid var(--cloud);
  outline-offset: 3px;
}

:focus:not(:focus-visible) {
  outline: none;
}

a {
  color: inherit;
}

/* ------------------------------- header ------------------------------- */

.top {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px var(--gutter);
  border-bottom: 1px solid var(--arsenic);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--cloud);
  text-decoration: none;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.host {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--space);
}

/* ------------------------------- layout ------------------------------- */

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  flex: 1;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: 'stage' 'docs' 'proof';
  gap: 56px;
  padding: 40px 0 72px;
}

@media (min-width: 1040px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 330px;
    grid-template-areas: 'stage proof' 'docs proof';
    column-gap: 64px;
  }
  .proof {
    position: sticky;
    top: 24px;
    align-self: start;
    max-height: calc(100vh - 48px);
    overflow: auto;
    scrollbar-width: thin;
  }
}

/* ------------------------------- ladder ------------------------------- */

.ladder {
  list-style: none;
  margin: 0;
  padding: 28px 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ladder li {
  border-top: 2px solid var(--arsenic);
  padding-top: 12px;
  transition: border-color 400ms ease;
}

.ladder-name {
  display: block;
  font-weight: 800;
  font-size: 15px;
  color: var(--graphite);
  transition: color 400ms ease;
}

.ladder-how {
  display: block;
  font-size: 13px;
  color: var(--graphite);
}

body[data-level='0'] .ladder li[data-step='0'],
body[data-level='1'] .ladder li:is([data-step='0'], [data-step='1']),
body[data-level='2'] .ladder li {
  border-top-color: var(--cloud);
}

body[data-level='0'] .ladder li[data-step='0'] :is(.ladder-name, .ladder-how),
body[data-level='1'] .ladder li:is([data-step='0'], [data-step='1']) :is(.ladder-name, .ladder-how),
body[data-level='2'] .ladder li :is(.ladder-name, .ladder-how) {
  color: var(--space);
}

.ladder li[aria-current='step'] .ladder-name {
  color: var(--cloud);
}

@media (max-width: 560px) {
  .ladder-how {
    display: none;
  }
}

/* -------------------------------- stage ------------------------------- */

.stage {
  grid-area: stage;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 36px;
  align-items: start;
  min-height: 380px;
}

@media (min-width: 760px) {
  .stage {
    grid-template-columns: minmax(0, 1fr) 272px;
    gap: 48px;
  }
}

.stage-text {
  max-width: 34rem;
}

h1 {
  margin: 0 0 18px;
  font-size: clamp(32px, 4.4vw, 46px);
  line-height: 1.06;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

h1.loading {
  color: var(--arsenic);
}

.lede {
  margin: 0 0 28px;
  font-size: 18px;
  line-height: 1.55;
  color: var(--smoke);
  max-width: 32em;
}

.meta {
  margin: 0 0 22px;
  font-size: 15px;
  color: var(--space);
}

.count {
  font-family: var(--mono);
  color: var(--cloud);
  font-variant-numeric: tabular-nums;
}

.hint {
  margin: 0;
  font-size: 14px;
  color: var(--space);
  max-width: 30em;
}

.steps {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  counter-reset: step;
  display: grid;
  gap: 10px;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  font-size: 17px;
  color: var(--smoke);
}

.steps li::before {
  content: counter(step);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.75;
  color: var(--space);
}

.address {
  margin: 0 0 8px;
  padding: 12px 14px;
  border-radius: 6px;
  background: var(--phantom);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  word-break: break-all;
}

.chain {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--space);
}

.next {
  margin-top: 32px;
  padding-top: 26px;
  border-top: 1px solid var(--arsenic);
}

.next h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.next p {
  margin: 0 0 20px;
  color: var(--smoke);
}

.working {
  height: 2px;
  max-width: 320px;
  background: linear-gradient(90deg, transparent, var(--cloud), transparent) no-repeat;
  background-size: 40% 100%;
  animation: sweep 1.2s linear infinite;
}

@keyframes sweep {
  from {
    background-position: -40% 0;
  }
  to {
    background-position: 140% 0;
  }
}

/* ------------------------------- buttons ------------------------------ */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: 600 16px/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 150ms ease,
    border-color 150ms ease;
}

.btn-primary {
  background: var(--cloud);
  color: var(--black);
}

.btn-primary:hover {
  background: var(--smoke);
}

.btn-secondary {
  background: transparent;
  color: var(--cloud);
  border-color: var(--arsenic);
}

.btn-secondary:hover {
  border-color: var(--space);
}

.btn-quiet {
  min-height: 0;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--space);
  font-weight: 400;
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-quiet:hover {
  color: var(--cloud);
}

.btn[aria-busy='true'] {
  opacity: 0.55;
  cursor: progress;
}

/* ------------------------ credential slot (right) ---------------------- */

.object {
  width: 100%;
  max-width: 420px;
}

@media (min-width: 760px) {
  .object {
    max-width: 272px;
  }
}

.nw {
  white-space: nowrap;
}

.object-caption {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--space);
}

.qr {
  width: 100%;
  aspect-ratio: 1;
  padding: 6px;
  border-radius: 12px;
  background: #ffffff;
}

.qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

.key {
  display: block;
  width: 100%;
  aspect-ratio: 128 / 122;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.key.ghost {
  border: 1px dashed var(--arsenic);
  background-image: radial-gradient(circle, rgb(157 162 179 / 0.2) 0.8px, transparent 1.1px);
  background-size: 6px 6px;
}

canvas.key {
  outline: 1px solid var(--arsenic);
  outline-offset: 6px;
}

.ecdsa {
  width: 18.75%;
  aspect-ratio: 24 / 11;
  margin-top: 22px;
  border: 1px solid var(--space);
}

.size-label {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--space);
}

/* phone mirror: what the wallet shows for this request */

.phone {
  padding: 22px 20px 20px;
  border: 1px solid var(--arsenic);
  border-radius: 28px;
  background: var(--phantom);
}

.phone p {
  margin: 0;
}

.phone-caption {
  margin-bottom: 16px !important;
  text-align: center;
  font-size: 12px;
  color: var(--space);
}

.phone-title {
  font-weight: 800;
  font-size: 18px;
  line-height: 1.25;
}

.phone-site {
  margin-top: 4px !important;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--space);
}

.phone-lines {
  display: grid;
  gap: 10px;
  margin: 16px 0;
  padding-top: 14px;
  border-top: 1px solid var(--arsenic);
}

.phone-lines dt {
  font-size: 12px;
  color: var(--space);
}

.phone-lines dd {
  margin: 0;
  font-weight: 600;
  font-size: 14px;
}

.phone-lines dd.mono {
  font-family: var(--mono);
  font-weight: 400;
}

.phone-hash-label {
  padding-top: 12px;
  border-top: 1px solid var(--arsenic);
  font-size: 12px;
  color: var(--space);
}

.phone-hash {
  margin-top: 4px !important;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  word-break: break-all;
  color: var(--smoke);
}

.phone-hash span {
  display: block;
}

.phone-tap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px !important;
  font-weight: 600;
  font-size: 14px;
}

.phone-tap .contactless {
  flex: none;
  animation: wave 1.8s ease-in-out infinite;
}

@keyframes wave {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

/* the card, once the room is open */

.card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  aspect-ratio: 85.6 / 53.98;
  padding: 16px 18px;
  border: 1px solid var(--arsenic);
  border-radius: 14px;
  background: linear-gradient(140deg, var(--phantom) 0%, var(--black) 62%);
  overflow: hidden;
}

.card-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 14px;
}

.card-mid {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-chip {
  position: relative;
  width: 40px;
  height: 30px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--smoke), var(--graphite));
}

.card-chip::before,
.card-chip::after {
  content: '';
  position: absolute;
  background: rgb(0 0 0 / 0.35);
}

.card-chip::before {
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
}

.card-chip::after {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
}

.card .contactless {
  color: var(--space);
}

.card-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.card-number {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.06em;
}

.card-kind {
  font-size: 12px;
  color: var(--space);
}

.arrive {
  animation: arrive 560ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(16px) rotate(-2deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.bar {
  height: 3px;
  margin-top: 16px;
  border-radius: 2px;
  background: var(--arsenic);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--cloud);
  transform-origin: left center;
}

/* ------------------------------ documents ----------------------------- */

.docs {
  grid-area: docs;
}

.docs h2,
.proof h2 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.section-sub {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--space);
}

.doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--arsenic);
}

.doc {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 4px 18px;
  align-items: baseline;
  width: 100%;
  padding: 18px 2px;
  border: 0;
  border-bottom: 1px solid var(--arsenic);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.doc-label {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--space);
}

.doc-main {
  display: grid;
  gap: 2px;
}

.doc-title {
  font-weight: 600;
}

.doc:hover .doc-title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.doc-summary {
  font-size: 14px;
  color: var(--space);
}

.doc-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  white-space: nowrap;
  color: var(--space);
}

.doc[data-open='true'] .doc-state {
  color: var(--cloud);
  font-weight: 600;
}

.doc[data-open='false'] .doc-title {
  color: var(--smoke);
}

.doc.refused {
  animation: refuse 340ms ease;
}

.doc.refused .doc-state {
  color: var(--red);
}

@keyframes refuse {
  0%,
  100% {
    transform: none;
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

@media (max-width: 620px) {
  .doc {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .doc-label {
    grid-column: 1 / -1;
  }
}

/* -------------------------------- proof ------------------------------- */

.proof {
  grid-area: proof;
}

.proof-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--arsenic);
}

.proof-empty {
  padding: 14px 0;
  font-size: 14px;
  color: var(--space);
}

.entry {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 6px 12px 0;
  border-bottom: 1px solid var(--arsenic);
}

.entry-glyph {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.45;
  color: var(--space);
}

.entry[data-kind='ok'] .entry-glyph {
  color: var(--cloud);
}

.entry:is([data-kind='refused'], [data-kind='error']) .entry-glyph,
.entry[data-kind='refused'] .entry-title {
  color: var(--red);
}

.entry-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.entry-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.45;
}

.entry time {
  flex: none;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--space);
}

.entry-lines {
  display: grid;
  gap: 2px;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--space);
  overflow-wrap: anywhere;
}

.entry.new {
  animation: flash 1600ms ease-out;
}

@keyframes flash {
  from {
    background: rgb(250 251 255 / 0.1);
  }
  to {
    background: transparent;
  }
}

/* -------------------------------- toast ------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 30;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(92vw, 520px);
  padding: 12px 16px 12px 14px;
  border: 1px solid var(--arsenic);
  border-left: 3px solid var(--cloud);
  border-radius: 8px;
  background: var(--phantom);
  color: var(--cloud);
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.6);
}

.toast:is([data-kind='refused'], [data-kind='error']) {
  border-left-color: var(--red);
}

/* ------------------------------- viewer ------------------------------- */

.viewer {
  width: min(780px, 94vw);
  max-height: 88vh;
  padding: 0;
  border: 1px solid var(--arsenic);
  border-radius: 12px;
  background: var(--black);
  color: var(--cloud);
  overflow: hidden;
}

.viewer[open] {
  display: flex;
  flex-direction: column;
}

.viewer::backdrop {
  background: rgb(0 0 0 / 0.8);
  backdrop-filter: blur(3px);
}

.viewer-mark {
  position: absolute;
  inset: -60%;
  z-index: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 56px 72px;
  transform: rotate(-24deg);
  pointer-events: none;
  user-select: none;
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
  color: rgb(250 251 255 / 0.05);
}

.viewer[data-level='2'] .viewer-mark {
  color: rgb(239 67 67 / 0.07);
}

.viewer-head,
.viewer-scroll,
.viewer-foot {
  position: relative;
  z-index: 1;
}

.viewer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--arsenic);
}

.viewer-label {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--space);
}

.badge {
  padding: 2px 10px;
  border: 1px solid var(--arsenic);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--smoke);
}

.viewer[data-level='2'] .badge {
  border-color: var(--red);
  color: var(--red);
}

#viewer-close {
  margin-left: auto;
}

.viewer-scroll {
  flex: 1;
  overflow: auto;
  padding: 28px 28px 36px;
}

#viewer-title {
  margin: 0 0 22px;
  font-size: 30px;
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.viewer-body {
  max-width: 64ch;
}

.viewer-body p {
  margin: 0 0 14px;
  color: var(--smoke);
}

.viewer-body h3 {
  margin: 28px 0 8px;
  font-size: 17px;
  font-weight: 800;
}

.viewer-body ul {
  margin: 0 0 16px;
  padding-left: 20px;
  color: var(--smoke);
}

.viewer-body li + li {
  margin-top: 4px;
}

.viewer-body .checks {
  list-style: none;
  padding: 0;
}

.viewer-body .checks li {
  position: relative;
  padding-left: 26px;
}

.viewer-body .checks li::before {
  content: '✓';
  position: absolute;
  left: 0;
  font-family: var(--mono);
  color: var(--cloud);
}

.mono-block {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--phantom);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--cloud);
}

.kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 20px;
  margin: 0 0 16px;
  font-size: 14px;
}

.kv dt {
  color: var(--space);
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.kv dd.mono {
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
}

.table-wrap {
  margin: 0 0 16px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 9px 14px 9px 0;
  border-bottom: 1px solid var(--arsenic);
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 600;
  color: var(--space);
}

td {
  color: var(--smoke);
}

.viewer-foot {
  padding: 12px 24px;
  border-top: 1px solid var(--arsenic);
  background: var(--black);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--space);
  overflow-wrap: anywhere;
}

@media (max-width: 620px) {
  .viewer {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
  }
  .viewer-scroll {
    padding: 22px 20px 28px;
  }
  .kv {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  .kv dd {
    margin-bottom: 8px;
  }
}

/* ------------------------------- footer ------------------------------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 20px var(--gutter) max(28px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--arsenic);
  font-size: 13px;
  color: var(--space);
}

.foot a {
  color: var(--smoke);
}

.noscript {
  padding: 0 var(--gutter);
  color: var(--space);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
