/* ───────────────────────────────────────────────────────────────────────
   Sherwood Brokers.

   Direction: the page matches the goods. The brokers are 48-colour pixel
   portraits, so the interface is built from the same material - hard edges,
   zero radius, offset block shadows, a tapestry-pixel display face, dithered
   light instead of smooth gradients. Still a ledger underneath: near-black
   with a green cast, bone ink, one gold signal, monospaced numbers.
   ─────────────────────────────────────────────────────────────────────── */
:root {
  --ground:    oklch(0.145 0.014 150);
  --ground-2:  oklch(0.108 0.012 150);
  --panel:     oklch(0.196 0.016 150);
  --panel-2:   oklch(0.238 0.018 150);
  --line:      oklch(0.300 0.020 150);
  --line-soft: oklch(0.248 0.016 150);

  --ink:       oklch(0.960 0.008 95);
  --ink-2:     oklch(0.790 0.012 110);
  --ink-3:     oklch(0.660 0.014 130);

  --gold:      oklch(0.800 0.145 88);
  --gold-hi:   oklch(0.885 0.125 92);
  --gold-lo:   oklch(0.560 0.100 86);
  --on-gold:   oklch(0.150 0.030 90);

  --danger:    oklch(0.660 0.180 25);
  --good:      oklch(0.760 0.150 150);

  --shadow:    oklch(0.05 0 0 / 0.75);
  --e:    cubic-bezier(0.22, 1, 0.36, 1);

  --pixel: "Jacquard 24", "Archivo", system-ui, sans-serif;
  --display: Archivo, system-ui, sans-serif;
  --mono: "Roboto Mono", ui-monospace, Consolas, monospace;

  /* stepped corner, cut like a sprite */
  --notch: polygon(
    0 8px, 4px 8px, 4px 4px, 8px 4px, 8px 0,
    calc(100% - 8px) 0, calc(100% - 8px) 4px, calc(100% - 4px) 4px, calc(100% - 4px) 8px, 100% 8px,
    100% calc(100% - 8px), calc(100% - 4px) calc(100% - 8px), calc(100% - 4px) calc(100% - 4px), calc(100% - 8px) calc(100% - 4px), calc(100% - 8px) 100%,
    8px 100%, 8px calc(100% - 4px), 4px calc(100% - 4px), 4px calc(100% - 8px), 0 calc(100% - 8px)
  );
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

html, body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2 {
  margin: 0; font-family: var(--pixel); font-weight: 400;
  line-height: 0.94; letter-spacing: 0; text-wrap: balance;
}
h3 { margin: 0; line-height: 1.1; letter-spacing: -0.02em; font-weight: 800; text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
img { image-rendering: pixelated; }

.wrap { width: min(1180px, calc(100% - 2.5rem)); margin-inline: auto; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--gold-hi); outline-offset: 3px;
}

/* ── Background: dithered light, not smooth light ───────────────────── */
.bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: var(--ground);
}
/* Bayer-ish dither of gold falling from the canopy */
.bg::before {
  content: ""; position: absolute; inset: 0; opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect x='0' y='0' width='2' height='2' fill='%23c9a437'/%3E%3Crect x='4' y='4' width='2' height='2' fill='%23c9a437' opacity='.5'/%3E%3C/svg%3E");
  background-size: 8px 8px;
  mask-image: radial-gradient(720px 560px at 50% -6%, oklch(0 0 0 / 0.9), transparent 70%);
}
/* coarse checker grain over everything, like quantised film */
.bg::after {
  content: ""; position: absolute; inset: 0; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect width='2' height='2' fill='white'/%3E%3Crect x='2' y='2' width='2' height='2' fill='white'/%3E%3C/svg%3E");
  background-size: 4px 4px;
  mix-blend-mode: overlay;
}
/* the forest itself: two ranks of pines along the bottom of the viewport */
.bg .trees {
  position: absolute; inset: auto 0 0 0; height: 200px;
  background:
    url('/art/treeline-near.svg') repeat-x bottom / auto 132px,
    url('/art/treeline-far.svg') repeat-x bottom 44px center / auto 84px;
  image-rendering: pixelated;
  opacity: 0.9;
}
/* a few fireflies over the treeline */
.bg .fly {
  position: absolute; bottom: 90px; width: 3px; height: 3px;
  background: var(--gold); opacity: 0;
  animation: fly 7s infinite;
}
.bg .fly:nth-child(2) { left: 12%; animation-delay: 0s; }
.bg .fly:nth-child(3) { left: 46%; bottom: 130px; animation-delay: 2.4s; }
.bg .fly:nth-child(4) { left: 78%; bottom: 70px; animation-delay: 4.8s; }
@keyframes fly {
  0%, 100% { opacity: 0; transform: translate(0, 0); }
  35%      { opacity: .8; transform: translate(4px, -7px); }
  70%      { opacity: .15; transform: translate(9px, -12px); }
}
@media (prefers-reduced-motion: reduce) {
  .bg .fly { animation: none; opacity: .3; }
}
body > *:not(.bg) { position: relative; z-index: 1; }

/* ── Nav ────────────────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1.5rem;
  height: 68px; padding: 0 clamp(20px, 5vw, 44px);
  background: oklch(0.108 0.012 150 / 0.92);
  border-bottom: 2px solid transparent;
  transition: border-color .25s var(--e);
}
.nav.stuck { border-bottom-color: var(--line-soft); }
/* the body>* reset outguns .nav's z-index - the id wins over both, so the
   sticky bar and the open phone menu always paint above page content */
#nav { z-index: 40; }
.brand {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--pixel); font-size: 1.5rem; font-weight: 400;
  letter-spacing: .01em; text-decoration: none;
}
.brand img { width: 36px; height: 36px; border: 2px solid var(--line); }
.nav-links { display: flex; gap: 1.4rem; margin-left: auto; }
.nav-links a {
  color: var(--ink-3); text-decoration: none; font-size: .94rem; font-weight: 600;
  transition: color .2s var(--e);
}
.nav-links a:hover, .nav-links a.on { color: var(--ink); }
.nav .btn { margin-left: auto; }
.nav-links + .btn { margin-left: 0; }

/* ── Buttons: sprite buttons - hard border, block shadow, real press ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 24px;
  border: 2px solid var(--ground-2);
  background: var(--gold); color: var(--on-gold);
  font: inherit; font-weight: 800; letter-spacing: -.01em;
  text-decoration: none; cursor: pointer;
  box-shadow: 4px 4px 0 var(--shadow);
  transition: transform .12s var(--e), box-shadow .12s var(--e), background .12s var(--e);
}
.btn:hover:not(:disabled) { background: var(--gold-hi); transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--shadow); }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--shadow); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { background: var(--panel-2); border-color: var(--ink-3); }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: .88rem; box-shadow: 3px 3px 0 var(--shadow); }
.btn.sm:hover:not(:disabled) { box-shadow: 5px 5px 0 var(--shadow); }
@media (prefers-reduced-motion: reduce) {
  .btn, .btn:hover:not(:disabled), .btn:active:not(:disabled) { transform: none; }
}

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center; gap: clamp(2rem, 5vw, 4rem);
  padding: clamp(2.5rem, 7vh, 5rem) 0 clamp(3rem, 8vh, 5.5rem);
}
.tagline {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 14px; border: 2px solid var(--line);
  background: var(--panel);
  color: var(--ink-2); font-size: .74rem; font-weight: 700;
  letter-spacing: 1.6px; text-transform: uppercase;
}
.tagline i { width: 8px; height: 8px; background: var(--good); flex: none; }
.hero h1 {
  margin: 22px 0 0; font-size: clamp(3.4rem, 9vw, 6rem);
  text-transform: none;
}
.hero h1 .a { color: var(--ink); display: block; }
.hero h1 .b { color: var(--gold); display: block; }
.lede { max-width: 42ch; margin-top: 20px; color: var(--ink-2); font-size: 1.08rem; text-wrap: pretty; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.fine { margin-top: 18px; color: var(--ink-3); font-size: .82rem; }

/* Card fan of real broker art, framed like sprites */
.fan { position: relative; height: min(460px, 52vw); }
.fan img {
  position: absolute; width: 46%;
  border: 3px solid var(--ink);
  outline: 2px solid var(--ground-2);
  box-shadow: 8px 8px 0 var(--shadow);
}
.fan img:nth-child(1) { left: 2%;  top: 16%; transform: rotate(-8deg); }
.fan img:nth-child(2) { left: 27%; top: 4%;  transform: rotate(-1deg); z-index: 2; }
.fan img:nth-child(3) { left: 52%; top: 15%; transform: rotate(7deg); }

/* ── Sections ───────────────────────────────────────────────────────── */
.sec { padding: clamp(3rem, 7vh, 5rem) 0; border-top: 2px solid var(--line-soft); }
.sec h2 { font-size: clamp(2.2rem, 5vw, 3.2rem); color: var(--ink); }
.sec-lede { max-width: 62ch; margin-top: 12px; color: var(--ink-2); text-wrap: pretty; }

/* Steps as a ledger */
.steps { max-width: 900px; margin-top: 26px; border-top: 2px solid var(--line-soft); }
.step {
  display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: 18px;
  padding: 22px 4px; border-bottom: 2px solid var(--line-soft);
}
.step-n { font-family: var(--pixel); font-size: 2.6rem; color: var(--gold); line-height: 1; }
.step h3 { font-size: 1.3rem; margin-bottom: 6px; }
.step p { color: var(--ink-2); max-width: 62ch; }

/* Routes + tiers tables */
.routes { width: 100%; margin-top: 26px; border-collapse: collapse; }
.routes th {
  padding: 0 0 12px; border-bottom: 2px solid var(--line);
  color: var(--ink-3); font-size: .72rem; font-weight: 800;
  letter-spacing: 1.6px; text-transform: uppercase; text-align: left;
}
.routes td { padding: 16px 0; border-bottom: 2px solid var(--line-soft); }
.routes .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.routes .rname { font-weight: 700; }
.routes tbody tr { transition: background .18s var(--e); }
.routes tbody tr:hover { background: oklch(0.196 0.016 150 / 0.4); }
.risk { font-family: var(--mono); }
.risk.lo { color: var(--good); }
.risk.mid { color: var(--gold); }
.risk.hi { color: var(--danger); }

.tiers-note { margin-top: 34px; }
.tiers-note h3 { font-size: 1.15rem; }
.tiers-note > p { margin-top: 8px; color: var(--ink-2); max-width: 68ch; }

/* Route cards on the home page: the art leads */
.route-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px; margin-top: 26px;
}
.route-card {
  border: 2px solid var(--line-soft); background: var(--ground-2);
  box-shadow: 4px 4px 0 var(--shadow); overflow: hidden;
}
.route-card img { display: block; width: 100%; border-bottom: 2px solid var(--line-soft); }
.route-card .body { padding: 14px 16px 16px; }
.route-card h3 { font-size: 1.1rem; }
.route-card p { margin-top: 5px; color: var(--ink-3); font-size: .85rem; }
.route-card .nums {
  display: flex; justify-content: space-between; margin-top: 10px;
  font-family: var(--mono); font-size: .9rem;
}
.route-card .nums .mult { color: var(--gold); font-weight: 700; }

/* Mint page: the sealed broker, shown at sprite scale */
.sealed-show { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: center; margin-top: 26px; }
.sealed-show img { width: 100%; max-width: 300px; border: 3px solid var(--ink); outline: 2px solid var(--ground-2); box-shadow: 8px 8px 0 var(--shadow); }
.sealed-show p { color: var(--ink-2); max-width: 52ch; }
.sealed-show p + p { margin-top: 12px; }
@media (max-width: 700px) { .sealed-show { grid-template-columns: 1fr; } .sealed-show img { max-width: 220px; } }

.wave-line {
  display: inline-flex; align-items: center; gap: 9px; margin-top: 18px;
  padding: 8px 14px; border: 2px solid var(--gold-lo);
  font-family: var(--mono); font-size: .85rem; color: var(--gold);
}

/* Coin page: two trade panels side by side */
.trade-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.trade-grid .panel h3 { font-size: 1.2rem; }
.amt {
  flex: 1 1 160px; min-width: 0; min-height: 48px; padding: 0 14px;
  border: 2px solid var(--line); background: var(--ground-2); color: var(--ink);
  font-size: 1rem;
}
.amt:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.trade-grid .mint-row .btn { flex: 0 1 auto; }

/* ── Game panel ─────────────────────────────────────────────────────── */
.panel {
  margin-top: 26px; padding: 26px;
  border: 2px solid var(--line-soft);
  background: oklch(0.196 0.016 150 / 0.55);
  clip-path: var(--notch);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.stat-row { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 20px; }
.stat .k { font-size: .7rem; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; color: var(--ink-3); }
.stat .v { font-family: var(--mono); font-size: 1.55rem; font-weight: 700; color: var(--ink); }
.stat .v.gold { color: var(--gold); }

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px; margin-top: 22px;
}
.card {
  border: 2px solid var(--line-soft); overflow: hidden;
  background: var(--ground-2);
  box-shadow: 4px 4px 0 var(--shadow);
  transition: border-color .15s var(--e), transform .15s var(--e), box-shadow .15s var(--e);
}
.card:hover { border-color: var(--gold-lo); transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--shadow); }
@media (prefers-reduced-motion: reduce) { .card:hover { transform: none; } }
.card img { display: block; width: 100%; border-bottom: 2px solid var(--line-soft); }
.card .ph {
  display: grid; place-items: center; aspect-ratio: 1;
  border-bottom: 2px solid var(--line-soft); background: var(--panel);
  font-family: var(--pixel); font-size: 3rem; color: var(--ink-3);
}
.card .meta { padding: 10px 12px 12px; }
.card .id-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card .id { font-family: var(--mono); font-weight: 700; font-size: .95rem; }
.card .tier {
  font-family: var(--mono); font-size: .68rem; font-weight: 700;
  padding: 2px 6px; border: 1px solid var(--gold-lo); color: var(--gold);
}
.card .st { font-size: .75rem; color: var(--ink-3); margin-top: 4px; }
.card .st.out { color: var(--gold); }
.card .st.win { color: var(--good); }

.empty {
  padding: 42px 24px; text-align: center;
  border: 2px dashed var(--line); color: var(--ink-3);
}

/* ── Notice ─────────────────────────────────────────────────────────── */
.notice {
  margin-top: 26px; padding: 22px 24px;
  border: 2px solid var(--line-soft);
  background: oklch(0.108 0.012 150 / 0.7);
  clip-path: var(--notch);
}
.notice h3 { font-size: 1.05rem; margin-bottom: 8px; }
.notice p { color: var(--ink-2); font-size: .95rem; max-width: 70ch; }

.foot { padding: 40px 0 56px; border-top: 2px solid var(--line-soft); color: var(--ink-3); font-size: .86rem; }
.foot a { color: var(--ink-2); }
.foot .cas { margin-bottom: 8px; font-size: .8rem; }
.foot .cas a { color: var(--gold); text-decoration: none; }
.foot .cas a:hover { text-decoration: underline; }

/* contract address table */
.ca-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 0; border-bottom: 2px solid var(--line-soft);
}
.ca-row:last-child { border-bottom: 0; }
.ca-label { flex: 0 0 140px; font-weight: 700; }
.ca-addr {
  flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere;
  color: var(--gold); text-decoration: none; font-size: .9rem;
}
.ca-addr:hover { text-decoration: underline; }

/* ── Toast ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 90;
  padding: 13px 22px;
  border: 2px solid var(--ground-2);
  background: var(--gold); color: var(--on-gold); font-weight: 700;
  box-shadow: 5px 5px 0 var(--shadow);
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  transition: opacity .25s var(--e), transform .25s var(--e);
  max-width: min(560px, 90vw); text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--danger); color: var(--ink); }

/* burger: hidden on desktop, the menu on phones */
.nav-burger {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 44px; height: 44px; padding: 0 10px; margin-left: auto;
  border: 2px solid var(--line); background: var(--panel); cursor: pointer;
}
.nav-burger span { display: block; height: 3px; background: var(--ink); }

@media (max-width: 940px) {
  .hero { grid-template-columns: 1fr; }
  .fan { order: -1; height: 300px; }
  .nav-burger { display: flex; }
  .nav { gap: 0.75rem; }
  /* one auto margin only, on the burger - it and Connect group at the right
     edge instead of the burger floating mid-bar */
  .nav .btn.sm { min-height: 40px; padding: 0 12px; font-size: .82rem; margin-left: 0; }
  .nav-links {
    display: none; position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 8px 0;
    background: var(--ground-2); border-bottom: 2px solid var(--line);
    box-shadow: 0 8px 0 var(--shadow);
  }
  .nav.open .nav-links { display: flex; }
  .nav-links a { padding: 14px clamp(20px, 5vw, 44px); font-size: 1.05rem; }
  .nav-links a.on { color: var(--gold); }
}
@media (max-width: 560px) {
  .wrap { width: calc(100% - 2rem); }
  .stat-row { gap: 18px; }
  .hero-cta .btn { width: 100%; }
  .brand span { display: none; }  /* logo only - room for burger + connect */
}

/* ── Mint ───────────────────────────────────────────────────────────── */
.dim { color: var(--ink-3); font-size: .8em; }

/* segmented pixel bar - fills in blocks, not smoothly */
.bar {
  height: 14px; margin-top: 22px;
  background: var(--ground-2); border: 2px solid var(--line-soft); overflow: hidden;
  padding: 2px;
}
.bar span {
  display: block; height: 100%; width: 0%;
  background: repeating-linear-gradient(90deg,
    var(--gold) 0, var(--gold) 6px,
    var(--gold-lo) 6px, var(--gold-lo) 8px);
  transition: width .6s var(--e);
}

.mint-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 22px; }
.qty {
  display: inline-flex; align-items: center; gap: 4px;
  border: 2px solid var(--line); background: var(--ground-2);
}
.qty button {
  width: 44px; height: 46px; border: 0; background: none; color: var(--ink);
  font: inherit; font-size: 1.2rem; cursor: pointer;
}
.qty button:hover { background: var(--panel-2); }
.qty strong { min-width: 2.2ch; text-align: center; font-size: 1.05rem; }
.mint-row .btn { flex: 1 1 260px; }

/* ── Route dialog ───────────────────────────────────────────────────── */
.dlg {
  width: min(560px, calc(100% - 2rem));
  padding: 0; border: 2px solid var(--line);
  background: var(--ground-2); color: var(--ink);
  box-shadow: 8px 8px 0 var(--shadow);
}
.dlg::backdrop { background: oklch(0.05 0 0 / 0.78); }
.dlg form { padding: 26px; }
.dlg h3 { font-family: var(--pixel); font-weight: 400; font-size: 1.7rem; }
.dlg-sub { margin-top: 8px; color: var(--ink-2); font-size: .94rem; }
.dlg-routes { display: grid; gap: 10px; margin-top: 20px; }
.dlg-route {
  display: grid; grid-template-columns: 96px minmax(0,1fr) auto auto; gap: 14px; align-items: center;
  width: 100%; padding: 14px 16px; text-align: left; cursor: pointer;
  border: 2px solid var(--line-soft);
  background: oklch(0.196 0.016 150 / 0.5); color: inherit; font: inherit;
  transition: border-color .15s var(--e), background .15s var(--e);
}
.dlg-route img { display: block; width: 96px; border: 1px solid var(--line-soft); }
.dlg-route:hover { border-color: var(--gold-lo); }
@media (max-width: 560px) {
  .dlg-route { grid-template-columns: 64px minmax(0,1fr) auto; }
  .dlg-route img { width: 64px; }
  .dlg-route .rm { display: none; }
}
.dlg-route[aria-pressed="true"] { border-color: var(--gold); background: oklch(0.800 0.145 88 / 0.12); }
.dlg-route .rn { display: block; font-weight: 700; }
.dlg-route .rf { display: block; font-size: .82rem; color: var(--ink-3); margin-top: 3px; line-height: 1.4; }
.dlg-route .rr { font-family: var(--mono); font-size: .9rem; }
.dlg-route .rm { font-family: var(--mono); font-weight: 700; color: var(--gold); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* card actions */
.card .acts { display: flex; gap: 6px; padding: 0 12px 12px; }
.card .acts .btn { flex: 1; min-height: 32px; padding: 0 8px; font-size: .78rem; box-shadow: 2px 2px 0 var(--shadow); }
