/* MIDWATCH — nocturne.
 *
 * Navy night, one warm lamp, and nothing else coloured. The whole palette is the mark: #0A1020
 * ground, #FFB347 lamp, #2A3A57 for anything cold and structural. If something on this site is a
 * third colour it is a mistake.
 *
 * Typography: a high-contrast serif for the voice, a squared grotesque for the reading, a mono for
 * anything that is a quantity. The serif is called Instrument, which is what this thing is. */

/* ─────────────────────────────────────────────────────────────── tokens ── */
:root {
  --night: #0a1020;
  --night-deep: #060a16;
  --night-lift: #111a2e;
  --night-card: #0e1526;
  --steel: #2a3a57;
  --steel-lit: #44598a;
  --ink: #e8eef7;
  --ink-dim: #92a3c2;
  --ink-faint: #637390;
  --amber: #ffb347;
  --amber-pale: #ffd9a0;
  --amber-deep: #c97a2c;
  --bad: #ff6b5a;

  --serif: 'Instrument Serif', ui-serif, Georgia, serif;
  --sans: 'Archivo', ui-sans-serif, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --bar: 62px;
  --pad: clamp(20px, 4vw, 56px);
  --maxw: 1220px;
  --r: 4px;

  --edge: 1px solid #1c2740;
  --edge-lit: 1px solid #2f4166;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--night);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.62;
  font-weight: 400;
  letter-spacing: 0.002em;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ──────────────────────────────────────────────────────── the night sky ── */
/* Three star tiles at coprime sizes so the repeat never lines up, one lamp in the upper right the
   way it sits on the banner, and a grain pass so the flat navy has a surface. All fixed: the
   atmosphere stays put while the page moves through it. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(1.5px 1.5px at 34px 52px, #cbd8f0, transparent),
    radial-gradient(1px 1px at 180px 118px, #a9bde0, transparent),
    radial-gradient(1px 1px at 300px 44px, #cbd8f0, transparent),
    radial-gradient(1.2px 1.2px at 96px 260px, #8fa6cf, transparent),
    radial-gradient(1px 1px at 372px 214px, #cbd8f0, transparent),
    radial-gradient(1px 1px at 240px 330px, #9fb4d8, transparent),

    radial-gradient(1px 1px at 60px 90px, #b9cbea, transparent),
    radial-gradient(1.4px 1.4px at 210px 30px, #e2ecff, transparent),
    radial-gradient(1px 1px at 130px 200px, #8fa6cf, transparent),
    radial-gradient(1px 1px at 480px 150px, #cbd8f0, transparent),

    radial-gradient(1px 1px at 420px 380px, #a9bde0, transparent),
    radial-gradient(1.6px 1.6px at 560px 90px, #ffe6c2, transparent),
    radial-gradient(1px 1px at 90px 460px, #cbd8f0, transparent),

    radial-gradient(900px 620px at 88% -8%, rgba(255, 179, 71, 0.16), transparent 66%),
    radial-gradient(1100px 780px at 50% 116%, rgba(42, 58, 87, 0.34), transparent 70%),
    linear-gradient(180deg, #060a16 0%, #0a1020 42%, #0b1424 100%);
  background-size:
    420px 420px, 420px 420px, 420px 420px, 420px 420px, 420px 420px, 420px 420px,
    263px 263px, 263px 263px, 263px 263px, 263px 263px,
    617px 617px, 617px 617px, 617px 617px,
    100% 100%, 100% 100%, 100% 100%;
  opacity: 0.85;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

/* ───────────────────────────────────────────────────────────── topbar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--bar);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 var(--pad);
  border-bottom: var(--edge);
  background: rgba(6, 10, 22, 0.78);
  backdrop-filter: blur(14px) saturate(140%);
}

.mark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  flex: none;
}
.mark svg { display: block; filter: drop-shadow(0 0 9px rgba(255, 179, 71, 0.4)); }
.mark span {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.19em;
}

.tabs { display: flex; gap: 4px; margin-left: auto; }
.tabs a {
  padding: 7px 13px;
  border-radius: var(--r);
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: color 0.16s, background 0.16s;
}
.tabs a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.04); }
.tabs a.on { color: var(--amber); background: rgba(255, 179, 71, 0.09); }

.wallet { display: flex; align-items: center; gap: 9px; margin-left: 6px; }

.chainpill {
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  border: var(--edge-lit);
  color: var(--ink-dim);
  cursor: default;
  white-space: nowrap;
}
.chainpill.bad {
  color: var(--bad);
  border-color: rgba(255, 107, 90, 0.45);
  background: rgba(255, 107, 90, 0.09);
  cursor: pointer;
}

/* ────────────────────────────────────────────────────────────── buttons ── */
.btn {
  appearance: none;
  border: 1px solid var(--steel-lit);
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 9px 17px;
  border-radius: var(--r);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: border-color 0.16s, background 0.16s, color 0.16s, transform 0.1s;
}
.btn:hover { border-color: var(--amber); color: var(--amber); background: rgba(255, 179, 71, 0.07); }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--amber);
  border-color: var(--amber);
  color: #17120a;
  box-shadow: 0 0 26px rgba(255, 179, 71, 0.22);
}
.btn--primary:hover { background: var(--amber-pale); border-color: var(--amber-pale); color: #17120a; }
.btn[disabled] { opacity: 0.36; pointer-events: none; }
.btn--wallet { font-family: var(--mono); font-size: 12px; font-weight: 500; }

/* ──────────────────────────────────────────────────────────────── page ── */
main { flex: 1 0 auto; }

.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(30px, 5vw, 62px) var(--pad) 88px;
  animation: rise 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(11px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .page { animation: none; } }

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--amber);
  display: block;
  margin-bottom: 14px;
}

h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(38px, 6.2vw, 74px);
  line-height: 1.02;
  letter-spacing: -0.018em;
  margin: 0 0 18px;
}
h1 em { font-style: italic; color: var(--amber); }

h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.12;
  letter-spacing: -0.012em;
  margin: 56px 0 16px;
}

h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 34px 0 12px;
}

p { margin: 0 0 15px; color: #c3cfe4; max-width: 66ch; }
p b, strong { color: var(--ink); font-weight: 600; }
.lede { font-size: clamp(16px, 2vw, 19px); line-height: 1.58; color: var(--ink); max-width: 60ch; }
.foot { font-size: 13px; color: var(--ink-faint); max-width: 68ch; }

a { color: var(--amber); text-decoration-color: rgba(255, 179, 71, 0.35); text-underline-offset: 3px; }

code, .mono { font-family: var(--mono); font-size: 0.9em; }
code {
  background: rgba(68, 89, 138, 0.18);
  border: var(--edge);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--amber-pale);
}

pre {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.72;
  background: var(--night-deep);
  border: var(--edge);
  border-left: 2px solid var(--amber);
  border-radius: var(--r);
  padding: 16px 18px;
  overflow-x: auto;
  color: #b9c8e2;
  margin: 18px 0;
}

hr { border: 0; border-top: var(--edge); margin: 44px 0; }

/* ───────────────────────────────────────────────────────────────── hero ── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
  min-height: min(66vh, 560px);
}
.hero__dial { width: 100%; max-width: 500px; margin-inline: auto; }
.hero__dial .scene { aspect-ratio: 1 / 1; }

/* the live readout, under the glass rather than across it */
.hero__read {
  text-align: center;
  margin-top: 6px;
  padding-top: 14px;
  border-top: var(--edge);
}
.hero__watch {
  font-family: var(--serif);
  font-size: clamp(20px, 2.6vw, 27px);
  color: var(--amber);
  display: block;
  line-height: 1.1;
}
.hero__sub {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.13em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.scene {
  position: relative;
  width: 100%;
  border-radius: var(--r);
  overflow: hidden;
}
.scene canvas { display: block; width: 100% !important; height: 100% !important; }
.scene--wide { aspect-ratio: 21 / 9; border: var(--edge); background: rgba(6, 10, 22, 0.5); }
.scene--tall { aspect-ratio: 4 / 3; border: var(--edge); background: rgba(6, 10, 22, 0.5); }
.scene__cap {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  text-transform: uppercase;
  margin-top: 10px;
  display: block;
}

/* ────────────────────────────────────────────────────────── stats/cards ── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: #1c2740;
  border: var(--edge);
  border-radius: var(--r);
  overflow: hidden;
  margin: 34px 0;
}
.stat { background: var(--night-card); padding: 18px 20px; display: flex; flex-direction: column; gap: 5px; }
.stat__k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.stat__v { font-family: var(--serif); font-size: 30px; line-height: 1; color: var(--ink); }
.stat__v.amber { color: var(--amber); }
.stat__s { font-size: 12px; color: var(--ink-dim); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: 16px; margin: 26px 0; }
.card {
  background: linear-gradient(180deg, rgba(17, 26, 46, 0.75), rgba(10, 16, 32, 0.75));
  border: var(--edge);
  border-radius: var(--r);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}
.card:hover { border-color: #2f4166; }
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 179, 71, 0.55), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}
.card:hover::before { opacity: 1; }
.card__n {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--amber);
  letter-spacing: 0.15em;
  display: block;
  margin-bottom: 10px;
}
.card h4 { font-family: var(--serif); font-weight: 400; font-size: 21px; margin: 0 0 8px; letter-spacing: -0.01em; }
.card p { font-size: 13.5px; margin: 0; color: var(--ink-dim); }

/* ────────────────────────────────────────────────────────────── banner ── */
.banner {
  display: flex;
  gap: 13px;
  align-items: baseline;
  flex-wrap: wrap;
  border: 1px solid rgba(255, 179, 71, 0.3);
  background: rgba(255, 179, 71, 0.06);
  border-radius: var(--r);
  padding: 14px 18px;
  margin: 0 0 30px;
  font-size: 13.5px;
  color: var(--ink-dim);
}
.banner b { color: var(--amber); font-weight: 600; white-space: nowrap; }

/* ─────────────────────────────────────────────────────────────── table ── */
.table { width: 100%; border-collapse: collapse; margin: 22px 0; font-size: 13.5px; }
.table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 400;
  padding: 0 14px 10px 0;
  border-bottom: var(--edge);
}
.table td { padding: 14px 14px 14px 0; border-bottom: var(--edge); vertical-align: top; color: var(--ink-dim); }
.table td:first-child { color: var(--ink); font-weight: 600; white-space: nowrap; }
.table .rate { font-family: var(--mono); color: var(--amber); white-space: nowrap; }
.wrap { overflow-x: auto; }

/* ─────────────────────────────────────────────────────────── the clock ── */
.clock {
  border: var(--edge);
  border-radius: var(--r);
  background: linear-gradient(180deg, rgba(17, 26, 46, 0.8), rgba(6, 10, 22, 0.8));
  padding: 22px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px 26px;
  align-items: end;
}
/* Each cell stacks. Without this the spans are inline and the label runs into the value, which is
   how the panel first shipped and why it is spelled out here. */
.clock > div { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.clock > div > * { max-width: 100%; }

.clock__big {
  font-family: var(--serif);
  font-size: clamp(26px, 3.3vw, 36px);
  line-height: 1.05;
  color: var(--amber);
  white-space: nowrap;
}
.bells {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.28em;
  color: var(--amber);
}
.bells .off { color: var(--steel); }

.bar { width: 100%; height: 3px; background: #1c2740; border-radius: 2px; overflow: hidden; margin-top: 9px; }
.bar > i { display: block; height: 100%; background: var(--amber); box-shadow: 0 0 12px rgba(255, 179, 71, 0.6); }

/* ──────────────────────────────────────────────────────────────── docs ── */
.page--docs { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.toc { position: sticky; top: calc(var(--bar) + 26px); }
.toc__k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: block;
  margin-bottom: 14px;
}
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 13px;
  border-left: 1px solid #1c2740;
  padding-left: 13px;
  margin-left: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.toc a span { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); padding-top: 2px; }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--amber); border-left-color: var(--amber); }
.toc a.on span { color: var(--amber); }

.chapter__n {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: block;
  margin-bottom: 12px;
}
.chapter h1 { font-size: clamp(28px, 4vw, 44px); margin-bottom: 22px; }
.chapter__nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 54px; padding-top: 22px; border-top: var(--edge); font-size: 13px; }
.chapter__nav a { text-decoration: none; }
.limits { padding-left: 20px; margin: 18px 0; }
.limits li { color: var(--ink-dim); margin-bottom: 12px; max-width: 66ch; }
.limits li b { color: var(--ink); }

/* ─────────────────────────────────────────────────────────────── forms ── */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink-faint); }
.field input {
  background: var(--night-deep);
  border: var(--edge-lit);
  border-radius: var(--r);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  padding: 11px 13px;
  width: 100%;
}
.field input:focus { outline: none; border-color: var(--amber); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }

.panel {
  border: var(--edge);
  border-radius: var(--r);
  background: linear-gradient(180deg, rgba(17, 26, 46, 0.7), rgba(10, 16, 32, 0.7));
  padding: 24px;
}

.kv { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: var(--edge); font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--ink-faint); font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.06em; margin: 0; }
.kv dd { margin: 0; color: var(--ink); font-family: var(--mono); font-size: 12.5px; text-align: right; word-break: break-all; }

/* ─────────────────────────────────────────────────────────────── footer ── */
.bottombar {
  flex: none;
  border-top: var(--edge);
  padding: 15px var(--pad);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  flex-wrap: wrap;
  font-size: 11px;
  letter-spacing: 0.09em;
  color: var(--ink-faint);
  background: rgba(6, 10, 22, 0.6);
}
.bottombar a { color: var(--ink-faint); text-decoration: none; }
.bottombar a:hover { color: var(--amber); }

/* ────────────────────────────────────────────────────────────── narrow ── */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero__dial { max-width: 380px; order: -1; }
  .page--docs { grid-template-columns: 1fr; }
  .toc { position: static; }
  .toc ol { display: flex; flex-wrap: wrap; gap: 4px 0; }
  .toc a { border-left: 0; padding: 5px 11px; border: var(--edge); border-radius: var(--r); margin: 0 6px 6px 0; }
  .toc a.on { border-color: var(--amber); }
}
@media (max-width: 720px) {
  /* Five tabs have to fit 350 usable pixels or the last one hides behind a scroll nobody looks for. */
  .tabs { order: 3; width: 100%; overflow-x: auto; margin: 0; padding-bottom: 2px; gap: 2px; }
  .tabs a { padding: 6px 8px; font-size: 12px; letter-spacing: 0.01em; }
  .topbar { height: auto; flex-wrap: wrap; padding-top: 11px; padding-bottom: 9px; gap: 12px; }
  .mark { margin-right: auto; }
  .wallet { margin-left: 0; }
  .scene--wide { aspect-ratio: 4 / 3; }
}
