/* ============================================================
   BTC Beacon — the observatory instrument.
   One stage (near-black), one light source (the lamp), SF type.
   The signature is the breathing beacon; everything else is
   hairlines, tabular numerals, and restraint.
   ============================================================ */

:root {
  color-scheme: dark;

  --stage:   #050608;
  --panel:   #0c0e13;
  --panel-2: #101319;
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-soft: rgba(255, 255, 255, 0.045);

  --ink:    #f4f5f6;
  --muted:  #9ba1a8;
  --dim:    #62666c;

  --beacon:      #f5b942;
  --beacon-core: #ffe9bd;
  --beacon-dim:  rgba(245, 185, 66, 0.55);
  --beacon-ghost: rgba(245, 185, 66, 0.12);

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Helvetica Neue", "Segoe UI", Roboto, Inter, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --w: 1020px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--stage);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  letter-spacing: 0.001em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: underline; text-decoration-color: var(--dim); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }

code { font-family: var(--mono); }

button { font-family: var(--sans); }

:focus-visible {
  outline: 2px solid var(--beacon);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--stage);
  padding: 10px 16px; z-index: 100; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------------------------------------------------------- masthead */

.masthead {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px clamp(20px, 4vw, 48px);
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-lamp {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--beacon);
  box-shadow: 0 0 10px 1px var(--beacon-dim);
}
.brand-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.pill {
  font: 500 12px/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 7px 14px;
  transition: color 0.4s, border-color 0.4s;
}
.pill.is-live { color: var(--beacon); border-color: rgba(245, 185, 66, 0.35); }
.pill.is-down { color: var(--dim); }

/* ---------------------------------------------------------- hero */

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px clamp(20px, 4vw, 48px) 90px;
}

/* The lamp — the signature. A breathing light whose brightness is the
   status: fresh = bright, lagging = ember. */
.lamp {
  position: relative;
  width: 120px; height: 120px;
  margin-bottom: 54px;
}
.lamp-core, .lamp-ring, .lamp-halo {
  position: absolute; inset: 0; margin: auto; border-radius: 50%;
}
.lamp-core {
  width: 26px; height: 26px;
  background: radial-gradient(circle at 42% 38%, var(--beacon-core), var(--beacon) 68%);
  box-shadow:
    0 0 22px 6px var(--beacon-dim),
    0 0 90px 30px var(--beacon-ghost),
    0 0 240px 90px rgba(245, 185, 66, 0.05);
  animation: breathe 6s ease-in-out infinite;
}
.lamp-ring {
  width: 74px; height: 74px;
  border: 1px solid rgba(245, 185, 66, 0.3);
  animation: breathe 6s ease-in-out infinite;
  animation-delay: 0.25s;
}
.lamp-halo {
  width: 120px; height: 120px;
  border: 1px solid rgba(245, 185, 66, 0.12);
  animation: breathe 6s ease-in-out infinite;
  animation-delay: 0.5s;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.07); opacity: 0.82; }
}
@media (prefers-reduced-motion: reduce) {
  .lamp-core, .lamp-ring, .lamp-halo { animation: none; }
}

.eyebrow {
  margin: 0 0 18px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
}

h1 {
  margin: 0 0 26px;
  font-size: clamp(40px, 6.4vw, 76px);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.022em;
}

.lede {
  max-width: 620px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 18px;
}

.degraded-note {
  margin-top: 28px;
  font-size: 14px;
  color: var(--beacon);
  border: 1px solid rgba(245, 185, 66, 0.3);
  border-radius: 8px;
  padding: 10px 18px;
}

/* the altimeter */
.instrument {
  display: flex;
  align-items: stretch;
  gap: clamp(18px, 4vw, 56px);
  margin-top: 72px;
}

.gauge { display: flex; flex-direction: column; gap: 6px; text-align: center; }
.gauge-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--dim);
}
.gauge-label-beacon { color: var(--beacon); }
.gauge-num {
  font-family: var(--mono);
  font-size: clamp(34px, 4.6vw, 54px);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  line-height: 1.1;
}
.num-beacon { color: var(--beacon); text-shadow: 0 0 34px var(--beacon-ghost); }
.gauge-sub { font-size: 12.5px; color: var(--dim); }

.gap-rail {
  display: flex; align-items: center; gap: 12px;
  padding-top: 26px;
}
.rail-line { display: block; width: clamp(20px, 4vw, 58px); height: 1px; background: var(--hairline); }
.rail-gap {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
  white-space: nowrap;
}

.tip-hash {
  margin: 64px 0 0;
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center;
  gap: 14px;
  max-width: 100%;
}
.tip-hash-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--dim);
}
.tip-hash code {
  font-size: 13.5px;
  color: var(--muted);
  word-break: break-all;
}
.tip-hash code .zeros { color: rgba(245, 185, 66, 0.38); }
.tip-hash-note {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--dim);
}

/* ---------------------------------------------------------- sections */

main { display: block; }

.section {
  max-width: var(--w);
  margin: 0 auto;
  padding: clamp(90px, 12vh, 150px) clamp(20px, 4vw, 48px) 0;
}

h2 {
  margin: 0 0 14px;
  font-size: clamp(28px, 3.6vw, 44px);
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.1;
}

.section-lede {
  max-width: 560px;
  margin: 0 0 44px;
  color: var(--muted);
}

/* ---------------------------------------------------------- jump */

.jump {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 26px;
}
.jump-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--dim);
}
.jump-input {
  width: 130px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  color: var(--ink);
  font: 500 14px/1 var(--mono);
  padding: 9px 12px;
}
.jump-input::placeholder { color: var(--dim); }
.jump-go {
  background: none;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px; font-weight: 500;
  padding: 9px 16px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.jump-go:hover { color: var(--ink); border-color: rgba(255,255,255,0.2); }
.jump-note { font-size: 13px; color: var(--dim); }

/* ---------------------------------------------------------- ledger */

.ledger { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hairline); }
.ledger-empty { padding: 22px 4px; color: var(--dim); font-size: 14px; }

.ledger-row { border-bottom: 1px solid var(--hairline); }

.ledger-line {
  display: grid;
  grid-template-columns: 96px 1fr auto auto;
  gap: 18px;
  align-items: baseline;
  width: 100%;
  padding: 17px 4px;
  background: none; border: 0; color: inherit;
  font: inherit; text-align: left;
  cursor: pointer;
}
.ledger-line:hover .ledger-what { color: var(--ink); }

.ledger-kind {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--dim);
}
.ledger-kind.is-advanced { color: var(--beacon); }

.ledger-what { font-size: 15.5px; color: var(--muted); transition: color 0.15s; }
.ledger-what strong { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }

.ledger-block { font-family: var(--mono); font-size: 12.5px; color: var(--dim); white-space: nowrap; }

.ledger-chev {
  font-size: 12px; color: var(--dim);
  transform: rotate(0deg); transition: transform 0.22s ease;
}
.ledger-row.is-open .ledger-chev { transform: rotate(90deg); }

/* the opened batch */
.batch { overflow: hidden; }
.batch-inner { padding: 4px 4px 26px; }

.batch-meta {
  display: flex; flex-wrap: wrap; gap: 18px; align-items: baseline;
  font-size: 13px; color: var(--dim);
  margin-bottom: 16px;
}
.batch-meta a { color: var(--muted); }

.batch-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
}

.hdr-cell {
  display: flex; flex-direction: column; gap: 3px;
  background: var(--panel);
  border: 1px solid var(--hairline-soft);
  border-radius: 9px;
  padding: 11px 13px;
  cursor: pointer;
  color: inherit; font: inherit; text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.hdr-cell:hover {
  border-color: rgba(245, 185, 66, 0.4);
  background: var(--panel-2);
  transform: translateY(-1px);
}
.hdr-cell-h {
  font-family: var(--mono);
  font-size: 14.5px; font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.hdr-cell.is-retarget .hdr-cell-h::after {
  content: "retarget";
  margin-left: 8px;
  font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--beacon);
}
.hdr-cell-hash { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.hdr-cell-hash .zeros { color: rgba(245, 185, 66, 0.35); }
.hdr-cell-when { font-size: 11.5px; color: var(--dim); }

.batch-note { font-size: 13px; color: var(--dim); padding: 14px 4px 0; }

/* ---------------------------------------------------------- weight */

.section-weight { text-align: center; }
.section-weight .section-lede { margin-left: auto; margin-right: auto; }

.weight-num {
  margin: 26px 0 10px;
  font-family: var(--mono);
  font-weight: 500;
  color: var(--beacon);
  text-shadow: 0 0 60px var(--beacon-ghost);
  font-size: clamp(84px, 13vw, 172px);
  line-height: 1;
  letter-spacing: -0.02em;
}
.weight-exp { font-size: 0.42em; vertical-align: 34%; margin-left: 0.06em; }
.weight-sub { max-width: 430px; margin: 0 auto; color: var(--dim); font-size: 14.5px; }

/* ---------------------------------------------------------- uses */

.uses {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 clamp(28px, 5vw, 72px);
  margin: 0;
  border-top: 1px solid var(--hairline);
}
@media (max-width: 720px) {
  .uses { grid-template-columns: 1fr; }
}
.use {
  padding: 30px 0 34px;
  border-bottom: 1px solid var(--hairline);
}
.use dt {
  font-size: 18px; font-weight: 600; letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.use dd { margin: 0; color: var(--muted); font-size: 15.5px; }

/* ---------------------------------------------------------- advance */

.tenets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(20px, 4vw, 48px);
  margin: 0 0 54px;
}
.tenet dt { font-size: 16.5px; font-weight: 600; margin-bottom: 6px; }
.tenet dd { margin: 0; color: var(--muted); font-size: 15px; }

.crank {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--hairline);
  padding-top: 30px;
}
.crank-line { margin: 0; font-size: 15.5px; }
.crank-note { margin: 4px 0 0; font-size: 13px; color: var(--dim); }
.crank-btn {
  background: var(--ink);
  color: var(--stage);
  border: 0; border-radius: 999px;
  font-size: 15px; font-weight: 600;
  padding: 13px 26px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}
.crank-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.crank-btn:disabled { opacity: 0.35; cursor: default; transform: none; }
.crank-result { margin-top: 16px; font-size: 14px; color: var(--muted); }

/* ---------------------------------------------------------- checkpoints */

.ckpt-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hairline); }
.ckpt {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px; align-items: baseline;
  padding: 17px 4px;
  border-bottom: 1px solid var(--hairline);
  font-size: 14.5px;
}
.ckpt-height { font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; }
.ckpt-mid { color: var(--dim); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ckpt-mid code { color: var(--muted); }
.ckpt a { font-family: var(--mono); font-size: 12.5px; color: var(--dim); white-space: nowrap; }
.ckpt a:hover { color: var(--muted); }

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

.footer {
  max-width: var(--w);
  margin: 0 auto;
  padding: clamp(90px, 12vh, 150px) clamp(20px, 4vw, 48px) 64px;
  text-align: center;
  color: var(--dim);
  font-size: 13.5px;
}
.footer p { margin: 0 0 8px; }
.footer-quiet { font-size: 12px; letter-spacing: 0.06em; }

/* ---------------------------------------------------------- sheet */

.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(3, 4, 6, 0.72);
  backdrop-filter: blur(6px);
  z-index: 40;
}

.sheet {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(480px, 100vw);
  background: var(--panel);
  border-left: 1px solid var(--hairline);
  z-index: 50;
  padding: 34px 30px 40px;
  overflow-y: auto;
  animation: sheet-in 0.26s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes sheet-in {
  from { transform: translateX(28px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet { animation: none; }
}

.sheet-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.sheet-eyebrow {
  margin: 0 0 6px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--dim);
}
.sheet-height {
  margin: 0;
  font-family: var(--mono);
  font-size: 34px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--beacon);
}
.sheet-when { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }

.sheet-nav { display: flex; gap: 8px; }
.sheet-nav-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: none;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.sheet-nav-btn:hover:not(:disabled) { color: var(--ink); border-color: rgba(255,255,255,0.24); }
.sheet-nav-btn:disabled { opacity: 0.3; cursor: default; }

.sheet-retarget {
  margin: 0 0 20px;
  font-size: 13.5px;
  color: var(--beacon);
  border: 1px solid rgba(245, 185, 66, 0.28);
  border-radius: 9px;
  padding: 11px 14px;
}

.fields { margin: 0; display: flex; flex-direction: column; }
.field {
  display: flex; flex-direction: column; gap: 3px;
  padding: 13px 0;
  border-top: 1px solid var(--hairline-soft);
}
.field dt {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--dim);
}
.field dd { margin: 0; font-size: 14px; color: var(--ink); }
.field dd code { font-size: 12.5px; word-break: break-all; color: var(--muted); }
.field dd code .zeros { color: rgba(245, 185, 66, 0.38); }
.field .field-note { font-size: 12px; color: var(--dim); }
.field dd button.linkish {
  background: none; border: 0; padding: 0;
  color: var(--muted); font: inherit; font-size: 12.5px;
  font-family: var(--mono);
  text-decoration: underline; text-decoration-color: var(--dim); text-underline-offset: 3px;
  cursor: pointer; word-break: break-all; text-align: left;
}
.field dd button.linkish:hover { color: var(--ink); }

.sheet-raw { margin-top: 20px; }
.raw-toggle {
  background: none;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  padding: 8px 14px;
  cursor: pointer;
}
.raw-toggle:hover { color: var(--ink); }
.raw-hex {
  display: block;
  margin-top: 12px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--dim);
  word-break: break-all;
}

.sheet-foot {
  margin-top: 26px;
  font-size: 12.5px;
  color: var(--dim);
}
.sheet-foot a { color: var(--muted); }

/* ---------------------------------------------------------- responsive */

@media (max-width: 720px) {
  .instrument { flex-direction: column; gap: 10px; }
  .gap-rail { justify-content: center; padding: 6px 0; }
  .rail-line { width: 34px; }
  .ledger-line { grid-template-columns: 76px 1fr auto; }
  .ledger-chev { display: none; }
  .ckpt { grid-template-columns: auto 1fr; }
  .ckpt-mid { display: none; }
}
