/*
 * Block states: loading, empty, error.
 *
 * Every block answers "is this thing working?" without the trader clicking anything. A
 * silent blank block is the dangerous case — it looks identical to a market that has
 * stopped moving, which is exactly when someone would decide the price is stable and
 * size up.
 */

/* Skeleton shimmer while data is on its way. */
.skeleton {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-2);
}

.skeleton__bar {
  block-size: 0.75rem;
  border-radius: var(--radius-1);
  background: linear-gradient(
    90deg,
    var(--bg-raised) 0%,
    var(--green-ghost) 50%,
    var(--bg-raised) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.1s linear infinite;
}

.skeleton__bar:nth-child(2) { inline-size: 82%; }
.skeleton__bar:nth-child(3) { inline-size: 64%; }
.skeleton__bar:nth-child(4) { inline-size: 90%; }

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* Empty and error share a centred, quiet layout — they are not the main event. */
.block__state {
  display: grid;
  place-content: center;
  gap: var(--sp-1);
  block-size: 100%;
  padding: var(--sp-3);
  text-align: center;
  font-size: var(--fs-0);
  color: var(--ink-muted);
}

.block__state--error {
  color: var(--orange);
}

.block__state-title {
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--ink);
}

.block__state--error .block__state-title {
  color: var(--orange-hot);
}

/* A block in error gets a border too — visible from across the room, not just up close. */
.block.has-error {
  border-color: var(--orange);
}

@media (prefers-reduced-motion: reduce) {
  .skeleton__bar {
    animation: none;
    background: var(--bg-raised);
  }
}

/* Footer brand links */
.footer__links {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.footer__link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--ink-muted);
  text-decoration: none;
}

.footer__link:hover,
.footer__link:focus-visible {
  color: var(--green);
}

.footer__brand {
  color: var(--ink-muted);
}

/* Dimmer than the release number and monospaced: it is a fingerprint to compare, not a
   thing to read. */
.footer__build {
  margin-inline-start: var(--sp-1);
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.footer__brand strong {
  color: var(--green);
  font-weight: var(--fw-bold);
}

/* Settings drawer — an overlay, never a page the trader has to navigate back from. */
.drawer {
  position: fixed;
  inset-block: var(--header-h) var(--footer-h);
  inset-inline-end: 0;
  inline-size: min(22rem, 100vw);
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--bg-block);
  border-inline-start: var(--border-strong);
  z-index: var(--z-overlay);
}

.drawer__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2);
  border-block-end: var(--border);
  background: var(--bg-raised);
}

.drawer__body {
  display: grid;
  align-content: start;
  gap: var(--sp-3);
  padding: var(--sp-3);
}

.field {
  display: grid;
  gap: var(--sp-1);
}

.field--row {
  grid-auto-flow: column;
  justify-content: start;
  align-items: center;
  gap: var(--sp-2);
}

.field__input {
  padding: var(--sp-1) var(--sp-2);
  background: var(--bg-inset);
  border: var(--border);
  border-radius: var(--radius-1);
  color: var(--ink);
  font: inherit;
}

.field__input:focus-visible {
  outline: var(--border-2) solid var(--green);
  outline-offset: 1px;
}

.btn {
  padding: var(--sp-2);
  background: var(--bg-raised);
  border: var(--border);
  border-radius: var(--radius-1);
  color: var(--ink);
  font: inherit;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  cursor: pointer;
}

.btn--warn {
  border-color: var(--orange-dim);
  color: var(--orange);
}

.btn--warn:hover {
  background: var(--orange-dim);
  color: var(--ink-inverse);
}

/* Key modal — the one blocking overlay on the desk, and only when keys are missing. */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg-overlay);
  z-index: var(--z-overlay);
}

.modal__card {
  display: grid;
  gap: var(--sp-2);
  inline-size: min(24rem, 92vw);
  padding: var(--sp-4);
  background: var(--bg-block);
  border: var(--border-strong);
  border-radius: var(--radius-2);
}

/*
 * The key modal.
 *
 * Taller than the other modals by nature — two venues, five fields — so it scrolls rather
 * than overflowing a short laptop viewport, which is what three stacked cards used to do.
 */
.keys {
  max-block-size: min(90vh, 44rem);
  overflow-y: auto;
}

.keys__venue {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-1);
}

.keys__head {
  display: flex;
  gap: var(--sp-2);
  align-items: baseline;
  justify-content: space-between;
  margin: 0;
}

.keys__name {
  color: var(--ink-strong);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Presence, never the key. Dim until a venue is actually configured, so the eye lands on
   the one that still needs filling in. */
.keys__state {
  color: var(--ink-faint);
  font-size: var(--fs-0);
}

.keys__state--on {
  color: var(--green);
}

.keys__note code {
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}

/*
 * The bookmark URL.
 *
 * Boxed in orange rather than presented as a neutral field, because this string is every
 * credential the desk holds and it should not look like a settings row. The warning is
 * part of the control, not a footnote under it.
 */
.keys__url {
  display: grid;
  gap: var(--sp-1);
  padding: var(--sp-2);
  border: 1px solid var(--orange-dim);
  border-radius: var(--radius-1);
}

.keys__url .row {
  gap: var(--sp-1);
}

.keys__url input {
  flex: 1 1 auto;
  min-inline-size: 0;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: var(--fs-0);
  /* Never wrapped: a URL broken across lines invites a partial copy, and half a
     credential set is a link that silently fails to authenticate. */
  white-space: nowrap;
  overflow-x: auto;
}

/*
 * The venue's own verdict on the keys.
 *
 * Two lines, weighted apart on purpose: the reason is what happened and the fix is what to
 * do, and a trader staring at a dead desk needs the second one to be the loud one.
 */
.keys__check {
  display: grid;
  gap: var(--sp-1);
  padding: var(--sp-2);
  border-inline-start: 2px solid var(--orange);
  background: var(--bg-1);
  font-size: var(--fs-0);
}

.keys__check.is-ok {
  border-inline-start-color: var(--green);
}

.keys__check-reason {
  color: var(--ink-muted);
}

.keys__check.is-ok .keys__check-reason {
  color: var(--green);
}

.keys__check-fix {
  color: var(--ink);
}

/* The live/paper line, which decides whether money is real. */
.keys__mode {
  color: var(--ink-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.keys__mode.is-live {
  color: var(--orange);
  font-weight: 700;
}
