/* The Harvester — Bitcorns house style.
   Tokens lifted from bitcorns.xyz: near-black blue ground, Bitcoin orange,
   corn gold, 8-bit display face over a mono data face. */
:root {
  --bg:      #06060a;
  --panel:   #0d0d18;
  --panel-2: #14141f;
  --line:    #1c1c2a;
  --line-2:  #2a2a3d;

  --orange:  #f7931a;
  --gold:    #f5c842;
  --green:   #3ba55d;
  --purple:  #6b4ebf;
  --red:     #cc2929;
  --text:    #e8e8de;
  --dim:     #9898b8;

  --display: 'Press Start 2P', ui-monospace, monospace;
  --mono: 'Share Tech Mono', ui-monospace, Menlo, monospace;

  --gut: clamp(14px, 2.2vw, 28px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(90% 55% at 50% -8%, #12101f 0%, transparent 70%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.mono, .num, dd { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* The pixel face is only legible in small doses — headings and chips only. */
h1, h2, .tab, .lamp, .readout dt, .field-head, .flag, .mint-pill, .mute, .mint-link {
  font-family: var(--display);
}

/* ---------- masthead ---------- */
.masthead {
  display: flex;
  align-items: center;
  gap: var(--gut);
  flex-wrap: wrap;
  padding: 20px var(--gut) 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(#0a0a12, transparent);
}

.brand { display: flex; align-items: center; gap: 14px; margin-right: auto; }

/* Wordmark: a pixel corn cob — three kernel rows on a stalk. */
.brand-mark {
  width: 24px; height: 30px;
  background-image:
    linear-gradient(var(--orange) 0 0),
    linear-gradient(var(--gold) 0 0),
    linear-gradient(var(--gold) 0 0),
    linear-gradient(var(--gold) 0 0);
  background-size: 4px 30px, 16px 6px, 24px 6px, 16px 6px;
  background-position: center, center 1px, center 11px, center 21px;
  background-repeat: no-repeat;
  image-rendering: pixelated;
}

h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--orange);
  text-shadow: 2px 2px 0 #3a1f00;
}
.brand-text p { margin: 7px 0 0; font-size: 12px; color: var(--dim); letter-spacing: 0.04em; }

.readout { display: flex; gap: 26px; margin: 0; }
.readout dt { font-size: 8px; letter-spacing: 0.04em; color: var(--dim); }
.readout dd { margin: 8px 0 0; font-size: 21px; color: var(--gold); }

.lamps { display: flex; gap: 8px; flex-wrap: wrap; }
.lamp {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--chain, var(--dim));
  font-size: 8px;
  color: var(--dim);
}
.lamp b { color: var(--text); font-weight: 400; font-family: var(--mono); font-size: 12px; }
.lamp::before {
  content: ''; width: 6px; height: 6px;
  background: var(--green); box-shadow: 0 0 6px var(--green);
}
.lamp[data-state='lagging']::before { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.lamp[data-state='down']::before { background: var(--red); box-shadow: 0 0 6px var(--red); }

/* ---------- disclaimer ----------
   Deliberately not dismissible. This tool sends people to spend money on
   irreversible mints, so the warning stays visible; the detail is folded away
   instead so it costs one line when not being read. */
.disclaimer {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px var(--gut);
  border-bottom: 1px solid var(--line);
  background: #1a1206;
  border-left: 3px solid var(--orange);
}
.disclaimer > strong {
  font-family: var(--display);
  font-size: 8px;
  color: var(--orange);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.disclaimer p {
  margin: 0;
  flex: 1 1 340px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--dim);
}
.disclaimer p b { color: var(--text); font-weight: 400; }
.disclaimer details { flex-basis: 100%; }
.disclaimer summary {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--gold);
  cursor: pointer;
}
.disclaimer summary:hover { text-decoration: underline; }
.disclaimer ul {
  margin: 8px 0 2px;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--dim);
}
.disclaimer li { margin-bottom: 4px; }
.disclaimer li b { color: var(--text); font-weight: 400; }
.disclaimer li em {
  font-style: normal;
  padding: 1px 4px;
  border: 1px dashed var(--line-2);
  color: var(--dim);
}

/* ---------- controls ---------- */
.controls {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 11px var(--gut);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.tabs { display: flex; gap: 4px; }
.tab {
  padding: 8px 12px;
  background: none; border: 1px solid var(--line-2);
  color: var(--dim);
  font-size: 8px;
  cursor: pointer;
}
.tab:hover { color: var(--text); border-color: var(--dim); }
.tab[aria-selected='true'] {
  background: var(--chain, var(--orange));
  border-color: var(--chain, var(--orange));
  color: #06060a;
}

.search {
  padding: 7px 9px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  width: 150px;
}
.search:focus { outline: none; border-color: var(--orange); }
.search::placeholder { color: var(--dim); opacity: 0.7; }

.slider, .toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--dim);
}
.slider input { width: 100px; accent-color: var(--orange); }
.slider output { color: var(--gold); min-width: 2ch; }
.toggle input { accent-color: var(--orange); }

.signed-in { margin-left: 8px; color: var(--green); border-color: var(--green); }
.signed-in:hover { background: var(--green); color: #06060a; }

.pulse {
  margin-left: auto;
  width: 7px; height: 7px;
  background: var(--orange);
  opacity: 0.25;
}
.pulse.beat { animation: beat 900ms steps(4, end); }
@keyframes beat {
  0% { opacity: 1; transform: scale(2); }
  100% { opacity: 0.25; transform: scale(1); }
}

/* ---------- layout ---------- */
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--gut);
  padding: var(--gut);
  align-items: start;
}

/* ---------- the field ---------- */
.field-head, .row {
  display: grid;
  grid-template-columns:
    46px minmax(130px, 1.4fr) 112px 62px 76px repeat(3, 44px) 62px 60px 34px;
  align-items: center;
  gap: 9px;
}

.field-head {
  padding: 0 12px 10px;
  font-size: 8px;
  color: var(--dim);
}
.field-head .num { text-align: right; }

/* Sortable headers */
.field-head button {
  padding: 0; background: none; border: none;
  color: inherit; font: inherit; cursor: pointer;
  text-align: inherit;
}
.field-head button:hover { color: var(--text); }
.field-head button[aria-sort]:not([aria-sort='none']) { color: var(--orange); }
.field-head button[aria-sort='descending']::after { content: ' \25BC'; font-size: 7px; }
.field-head button[aria-sort='ascending']::after { content: ' \25B2'; font-size: 7px; }
.field-head .num button { display: block; width: 100%; text-align: right; }

.row {
  position: relative;
  width: 100%;
  min-height: 54px;
  margin-bottom: 3px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--chain, var(--line-2));
  background: var(--panel);
  color: inherit;
  font: inherit;
  font-family: var(--mono);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}
.row:hover { background: var(--panel-2); border-color: var(--line-2); }
.row:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }

/* Supply fills the row like a granary, tinted by the chain it is on. */
.row::before {
  content: '';
  position: absolute; inset: 0 auto 0 0;
  width: var(--fill, 0%);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--chain, var(--orange)) 22%, transparent),
    color-mix(in srgb, var(--chain, var(--orange)) 7%, transparent));
  border-right: 1px solid color-mix(in srgb, var(--chain, var(--orange)) 45%, transparent);
  transition: width 600ms steps(12, end);
  pointer-events: none;
}
.row > * { position: relative; }

.row[data-urgency='critical'] { border-left-color: var(--red); }
.row[data-soldout='true'] { opacity: 0.5; }

.heat { font-size: 18px; color: var(--gold); }
.row[data-urgency='critical'] .heat { color: var(--red); }
.row[data-urgency='high'] .heat { color: var(--orange); }

.name { min-width: 0; }
.name strong {
  display: block;
  font-size: 14px; font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.name span { display: block; font-size: 11px; color: var(--dim); }
.name .chain-tag { color: var(--chain, var(--dim)); }

.supply { font-size: 11px; color: var(--dim); }
.supply b { display: block; font-size: 13px; color: var(--text); font-weight: 400; }
.supply .pct { color: var(--gold); }

.spark { display: block; width: 76px; height: 24px; overflow: visible; }
.spark polyline { fill: none; stroke: var(--chain, var(--orange)); stroke-width: 1.5; }
.spark polygon { fill: color-mix(in srgb, var(--chain, var(--orange)) 16%, transparent); }

.num { text-align: right; font-size: 13px; }
.num.dim { color: var(--dim); }
.price { font-size: 12px; }
.price em { display: block; font-style: normal; font-size: 10px; color: var(--dim); }
.eta { text-align: right; font-size: 12px; }
.eta.urgent { color: var(--red); }
.eta.soon { color: var(--gold); }
.eta.stalled { color: var(--dim); font-size: 10px; }

/* Mint link, inline on the row */
.mint-pill {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border: 1px solid var(--line-2);
  color: var(--gold);
  font-size: 8px;
  text-decoration: none;
}
.mint-pill:hover { background: var(--gold); border-color: var(--gold); color: #06060a; }
.mint-pill[data-kind='explorer'] { color: var(--dim); }
.mint-pill[data-kind='project'] { color: var(--orange); border-color: var(--orange); }
.mint-pill[data-kind='project']:hover { background: var(--orange); color: #06060a; }

/* Filtered rows recede — reference, not signal. */
.row[data-quality]:not([data-quality='ok']) { opacity: 0.4; border-left-color: var(--line-2); }
.row[data-quality]:not([data-quality='ok'])::before { display: none; }
.flag {
  display: inline-block;
  margin-left: 7px; padding: 2px 4px;
  border: 1px solid var(--line-2);
  font-size: 7px;
  color: var(--dim); vertical-align: middle;
}

/* ---------- detail drawer ---------- */
.detail {
  margin: -2px 0 8px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-top: none;
  background: #0a0a14;
  font-size: 12px;
}
.detail-grid { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 11px; }
.detail-grid dt {
  font-family: var(--display); font-size: 7px;
  color: var(--dim); margin-bottom: 5px;
}
.detail a { color: var(--gold); }
.detail ul { margin: 0; padding: 0; list-style: none; font-size: 11px; }
.detail li { display: flex; gap: 12px; padding: 3px 0; color: var(--dim); }
.detail li b { color: var(--text); font-weight: 400; }
.mint-link {
  display: inline-block;
  margin: 4px 10px 0 0; padding: 9px 13px;
  background: var(--orange); border: none;
  color: #06060a !important;
  font-size: 8px;
  text-decoration: none;
}
.mint-link:hover { background: var(--gold); }
.no-mint-link { margin: 6px 0 0; color: var(--dim); font-size: 11px; }
/* Contract-declared, unverified: deliberately quieter than the real action. */
.project-link {
  display: inline-block;
  margin: 4px 0 0; padding: 8px 11px;
  border: 1px dashed var(--line-2);
  color: var(--dim) !important;
  font-size: 11px; text-decoration: none;
}
.project-link:hover { border-color: var(--gold); color: var(--gold) !important; }
.mute {
  margin-top: 10px; padding: 7px 10px;
  background: none; border: 1px solid var(--line-2);
  color: var(--dim); font-size: 8px; cursor: pointer;
}
.mute:hover { color: var(--red); border-color: var(--red); }

/* ---------- ledger ---------- */
.ledger {
  position: sticky; top: var(--gut);
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.ledger h2 { margin: 0 0 10px; font-size: 9px; color: var(--orange); }
.ledger-note { margin: 0 0 12px; font-size: 11px; color: var(--dim); }
.ledger ol { margin: 0; padding: 0; list-style: none; max-height: 60vh; overflow-y: auto; }
.ledger li {
  padding: 8px 0 8px 10px;
  border-left: 2px solid var(--chain, var(--line-2));
  margin-bottom: 3px;
}
.ledger li[data-urgency='critical'] { border-left-color: var(--red); }
.ledger b { display: block; font-size: 12.5px; font-weight: 400; }
.ledger p { margin: 2px 0 0; font-size: 11px; color: var(--dim); line-height: 1.4; }
.ledger time { font-size: 10px; color: var(--dim); opacity: 0.7; }

.empty {
  padding: 40px 14px; color: var(--dim);
  text-align: center; max-width: 46ch; margin-inline: auto;
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  main { grid-template-columns: minmax(0, 1fr); }
  .ledger { position: static; }
}
@media (max-width: 900px) {
  .field-head { display: none; }
  .row { grid-template-columns: 40px minmax(0, 1fr) 46px 54px 30px; }
  .row .col-hide { display: none; }
  .readout { gap: 18px; }
  h1 { font-size: 12px; }
}

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