/* Video out of the XRP Ledger — a projection booth for a distributed store. */

:root {
  --ink: #e8e6e3;
  --ink-soft: #a7a29b;
  --ink-faint: #75706a;
  --bg: #0e0d0c;
  --panel: #171514;
  --rule: #2a2725;
  --accent: #e0913f;
  --accent-soft: #2a1f14;
  --ok: #62b884;
  --bad: #d9604f;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --ink: #1a1613;
    --ink-soft: #57504a;
    --ink-faint: #8b847c;
    --bg: #f7f4f0;
    --panel: #ffffff;
    --rule: #e2dbd3;
    --accent: #a8621d;
    --accent-soft: #f4e7d8;
    --ok: #2f6b45;
    --bad: #a33223;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
}

html { scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }

/* ─── masthead ─── */

.masthead { border-bottom: 1px solid var(--rule); background: var(--panel); }
.masthead-inner { max-width: 1000px; margin: 0 auto; padding: 1.2rem 1.5rem 0.7rem; }

.masthead h1 { margin: 0; font-size: 1.4rem; font-weight: 600; letter-spacing: -0.01em; }
.masthead h1 span { color: var(--accent); }

.tagline { margin: 0.3rem 0 0; font-size: 0.87rem; color: var(--ink-soft); max-width: 62ch; }

.netbar {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem 0.7rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.netbar a { color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.net-node { display: inline-flex; align-items: center; gap: 0.35rem; }

.net-node select {
  font: inherit;
  font-size: 0.72rem;
  color: var(--ink-soft);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.1rem 0.3rem;
  cursor: pointer;
}
.net-sep { opacity: 0.5; }

.net-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.net-dot.is-connected { background: var(--ok); }
.net-dot.is-connecting, .net-dot.is-retrying { background: var(--accent); }
.net-dot.is-failed, .net-dot.is-disconnected { background: var(--bad); }

/* ─── stage ─── */

main { max-width: 1000px; margin: 0 auto; padding: 1.5rem; }

.player {
  position: relative;
  background: #000;
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.player video { width: 100%; height: 100%; display: block; }

.overlay[hidden] { display: none; }   /* a class beats the UA rule for [hidden] */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  background: linear-gradient(180deg, rgba(14,13,12,0.75), rgba(14,13,12,0.92));
  text-align: center;
  padding: 1.5rem;
}

.start {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7rem 1.5rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
}

.start:hover:not(:disabled) { background: var(--accent); color: #14110e; }
.start:disabled { opacity: 0.4; cursor: default; }

/* Once the clip is buffered the overlay must not swallow clicks meant for the controls. */
.overlay.is-done { background: linear-gradient(180deg, rgba(14,13,12,0.35), rgba(14,13,12,0.7)); }

.overlay-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #f1ece6;
  letter-spacing: -0.01em;
}

.overlay-note { margin: 0; font-size: 0.82rem; color: #b9b3ac; font-family: var(--mono); max-width: 46ch; }

/* ─── gauges ─── */

.gauges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.7rem;
  margin-top: 1rem;
}

.gauge {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.gauge-value { font-family: var(--mono); font-size: 1.3rem; font-weight: 600; }
.gauge-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); }

/* ─── race ─── */

.race { margin-top: 1rem; }

.race-bar {
  height: 8px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 999px;
  overflow: hidden;
}

.race-bar span { display: block; height: 100%; transition: width 0.3s ease; }
.race-bar span.is-ahead { background: var(--ok); }
.race-bar span.is-behind { background: var(--bad); }

.race-note { margin: 0.45rem 0 0; font-size: 0.8rem; color: var(--ink-soft); }

/* ─── segments ─── */

.segments { margin-top: 2.2rem; }
.segments h2, .about h2 { font-size: 1.05rem; margin: 0 0 0.7rem; }
.hint { font-weight: 400; font-size: 0.76rem; color: var(--ink-faint); font-family: var(--mono); margin-left: 0.5rem; }

.segment-list { list-style: none; margin: 0; padding: 0; }

.segment {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--ink-faint);
}

.segment-index { min-width: 1.8rem; }

.segment-bar { flex: 1; height: 6px; background: var(--panel); border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; }
.segment-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.4s ease; }

.segment.is-fetching { color: var(--accent); background: var(--accent-soft); }
.segment.is-fetching .segment-bar i { width: 60%; }
.segment.is-done { color: var(--ink-soft); }
.segment.is-done .segment-bar i { width: 100%; background: var(--ok); }

.segment-tx { min-width: 3.5rem; text-align: right; }
.segment-rate { min-width: 4.5rem; text-align: right; color: var(--ink-faint); }
.segment-link { color: var(--accent); text-decoration: none; }
.segment-link:hover { text-decoration: underline; }

/* ─── about ─── */

.about { margin-top: 2.4rem; }
.lede { font-size: 0.95rem; color: var(--ink-soft); margin: 0 0 1rem; }

.steps { padding-left: 1.2rem; color: var(--ink-soft); font-size: 0.88rem; }
.steps li { margin-bottom: 0.3rem; }
.steps code { font-family: var(--mono); font-size: 0.82em; }

.facts { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.facts th, .facts td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.facts th { width: 32%; font-weight: 600; color: var(--ink-soft); }
.facts a { color: var(--accent); }

.footnote { margin-top: 1.5rem; font-size: 0.78rem; color: var(--ink-faint); }
.fatal { max-width: 40rem; margin: 4rem auto; padding: 0 1.5rem; }

/* ─── narrow screens ─── */

@media (max-width: 720px) {
  main { padding: 1.1rem; }
  .masthead-inner { padding: 1rem 1.1rem 0.6rem; }
  .netbar { padding: 0 1.1rem 0.6rem; flex-wrap: nowrap; }
  .masthead h1 { font-size: 1.15rem; }
  .gauge-value { font-size: 1.1rem; }
  .segment-link { display: none; }
  .facts, .facts tbody, .facts tr, .facts th, .facts td { display: block; width: auto; }
  .facts tr { border-bottom: 1px solid var(--rule); padding: 0.4rem 0; }
  .facts th, .facts td { border: 0; padding: 0 0 0.15rem; }
  .facts th { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; }
  .facts td { word-break: break-word; }
}
