/* Loamwright — a dark survey map of the road to market. Gradient-mesh ground, one amber accent, a serif for the
   field note, a mono for every figure. The CA rides a vertical survey stake fixed to the left margin. */
:root {
  --ground: #150F0B; --ink: #EADFCF; --amber: #E6953A; --dim: #9A8470; --faint: #5E4E41;
  --line: #3A2C22; --panel: #1E1612; --panel2: #241A14; --umber: #5C3A25; --loam: #3B2418; --clay: #6B4126;
  --serif: 'Instrument Serif', Georgia, serif; --sans: 'Mulish', system-ui, sans-serif; --mono: 'DM Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { background: var(--ground); }
body {
  margin: 0; min-height: 100vh; color: var(--ink); background-color: var(--ground);
  background-image: radial-gradient(60% 40% at 88% 4%, rgba(107,65,38,.34), transparent 70%),
                    radial-gradient(45% 35% at 8% 96%, rgba(92,58,37,.30), transparent 70%),
                    radial-gradient(30% 24% at 60% 60%, rgba(59,36,24,.35), transparent 70%);
  background-attachment: fixed;
  font: 400 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
  padding: 18px 16px 40px 62px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; overflow-x: hidden;
}
a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
button:disabled { cursor: default; }
.serif { font-family: var(--serif); font-weight: 400; }
.fig { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dim { color: var(--dim); }

/* ---- the survey stake ------------------------------------------------------------------------------------ */
#stake {
  position: fixed; left: 0; top: 50%; transform: translateY(-50%); z-index: 30; width: 46px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0 12px;
  background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-left: 0;
  border-radius: 0 14px 14px 0; box-shadow: 6px 0 24px rgba(0,0,0,.35);
}
#stakeCopy {
  width: 34px; height: 34px; border-radius: 9px; border: 0; background: var(--amber); color: var(--ground);
  font: 700 10px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; transition: background .2s, transform .1s;
}
#stakeCopy:disabled { background: var(--faint); color: var(--panel); }
#stakeCopy[data-done="1"] { background: var(--ink); transform: scale(1.06); }
#stakeAddr {
  writing-mode: vertical-rl; font: 500 11.5px/1 var(--mono); letter-spacing: .02em; color: var(--ink);
  white-space: nowrap; user-select: all; -webkit-user-select: all; max-height: 330px; overflow: hidden;
}
#stakeAddr[data-empty="1"] { color: var(--dim); font-family: var(--sans); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; max-height: 300px; white-space: normal; width: 22px; }
#stakeGm { writing-mode: vertical-rl; font: 600 10.5px/1 var(--sans); color: var(--dim); }
.stake-tag { writing-mode: vertical-rl; font: 700 8.5px/1 var(--sans); letter-spacing: .16em; color: var(--faint); }

/* ---- the field note -------------------------------------------------------------------------------------- */
.fieldnote {
  font-size: 16px; line-height: 1.55; padding: 4px 0 0; max-width: 62ch;
}
.note-head { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 10px; }
.note-mark { font: italic 400 26px/1 var(--serif); color: var(--ink); letter-spacing: .01em; }
.note-no { font: 600 10.5px/1.3 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.fieldnote p { margin: 0 0 8px; }
.fieldnote p:last-child { margin-bottom: 0; }
.fieldnote b { font-weight: 600; color: var(--amber); font-family: var(--mono); font-size: .94em; }
.fieldnote i { font-family: var(--serif); font-style: italic; font-size: 1.08em; }

/* ---- the plat (the map) ---------------------------------------------------------------------------------- */
.plat { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px 12px 10px; position: relative; overflow: hidden; }
.plat::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(50% 60% at 100% 100%, rgba(107,65,38,.28), transparent 70%), radial-gradient(40% 50% at 0% 0%, rgba(92,58,37,.22), transparent 70%); }
.plat-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 2px 6px; position: relative; }
.plat-head span:first-child { font: italic 400 20px/1 var(--serif); }
.plat-head span:last-child { font: 600 11px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.plat svg { width: 100%; height: auto; display: block; position: relative; }
.plat-key { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 2px 0; font: 600 10.5px/1.3 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--dim); position: relative; }
.plat-key span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; background: var(--faint); }
.plat-key [data-k="load"]::before { background: var(--amber); }
.plat-key [data-k="open"]::before { background: transparent; border: 1px solid var(--faint); }
.plat-key [data-k="price"]::before { background: var(--ink); height: 2px; border-radius: 0; vertical-align: 2px; }
.plat-key [data-k="cap"]::before { background: var(--clay); height: 2px; border-radius: 0; vertical-align: 2px; }
.plat-key [data-k="stake"]::before { background: var(--dim); width: 2px; height: 10px; border-radius: 0; }
.plot { fill: none; stroke: var(--faint); stroke-width: .8; transition: fill .3s; }
.plot[data-s="load"] { fill: var(--amber); stroke: var(--amber); }
.plot[data-s="fresh"] { fill: var(--ink); stroke: var(--ink); }
.plot[data-s="dud"] { fill: var(--umber); stroke: var(--clay); }
.contour { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.capline { fill: none; stroke: var(--clay); stroke-width: 1.2; stroke-dasharray: 3 2; }
.paidfill { fill: rgba(230,149,58,.14); }
.stakeline { stroke: var(--dim); stroke-width: .9; stroke-dasharray: 2 2; }
.road { fill: var(--loam); }
.plat text { font-family: var(--mono); fill: var(--dim); font-size: 8px; }
.plat text.lbl { font-family: var(--sans); font-weight: 700; font-size: 7px; letter-spacing: .08em; text-transform: uppercase; }
.plat text.here { fill: var(--amber); font-weight: 500; font-size: 9px; }
.plat .square { fill: var(--panel2); stroke: var(--line); }
.pin { fill: var(--amber); stroke: var(--ground); stroke-width: 1.2; }
.pin-halo { fill: none; stroke: var(--amber); stroke-width: .8; opacity: .45; }

/* ---- the cart shed (the action) -------------------------------------------------------------------------- */
.cartshed { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 12px; }
.shed-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.shed-head span:first-child { font: italic 400 20px/1 var(--serif); }
.shed-quote { font: 600 12px/1.3 var(--sans); color: var(--dim); }
.shed-quote b { color: var(--ink); font-family: var(--mono); font-weight: 500; }
.haul-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: stretch; }
.haul-steps { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--ground); }
.haul-steps button { width: 40px; border: 0; background: transparent; color: var(--ink); font: 400 22px/1 var(--sans); }
.haul-steps button:hover { background: var(--panel2); }
.haul-steps input { width: 52px; border: 0; background: transparent; color: var(--ink); text-align: center; font: 500 20px/1 var(--mono); -moz-appearance: textfield; outline: none; }
.haul-steps input::-webkit-outer-spin-button, .haul-steps input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.haul {
  border: 0; border-radius: 12px; background: var(--amber); color: var(--ground); padding: 10px 14px; min-height: 54px;
  font: 700 15px/1.15 var(--sans); text-align: left; display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.haul b { font: 500 11.5px/1 var(--mono); opacity: .8; letter-spacing: .02em; }
.haul:disabled { background: var(--panel); color: var(--dim); border: 1px solid var(--line); }
.yoke { margin-top: 10px; width: 100%; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--ink); padding: 10px; font: 600 13px/1 var(--sans); }
.yoke[data-on="1"] { color: var(--amber); font-family: var(--mono); font-weight: 500; }
.shed-note { margin: 10px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--dim); }
.shed-note b { color: var(--ink); font-family: var(--mono); font-weight: 500; }

/* ---- the marginalia (tape · ledger · survey) ------------------------------------------------------------- */
.marginalia { display: grid; gap: 12px; }
.ledge { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 13px; }
.ledge-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.ledge-head span:first-child { font: italic 400 19px/1 var(--serif); }
.ledge-head span:last-child { font: 600 10.5px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); text-align: right; }
.ledge p.quiet { margin: 0; font-size: 13px; color: var(--dim); line-height: 1.5; }
.tape-line { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding: 5px 0; border-top: 1px dashed var(--line); font-size: 13px; }
.tape-line:first-child { border-top: 0; }
.tape-line i { font: 500 12px/1 var(--mono); font-style: normal; color: var(--amber); }
.tape-line[data-k="cleared"] i { color: var(--ink); }
.tape-line[data-k="cried"] i { color: var(--dim); }
.tape-line em { font-style: normal; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tape-line u { text-decoration: none; font: 400 11px/1 var(--mono); color: var(--dim); }
.carry-fig { font: 500 30px/1 var(--mono); color: var(--amber); margin: 2px 0 4px; }
.carry-fig small { font: 600 11px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-left: 6px; }
.led-line { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding: 6px 0; border-top: 1px dashed var(--line); font-size: 13px; }
.led-line:first-of-type { border-top: 0; }
.led-line i { font: 500 12px/1 var(--mono); font-style: normal; color: var(--dim); }
.led-line em { font-style: normal; color: var(--ink); }
.led-line u { text-decoration: none; font: 500 12.5px/1 var(--mono); color: var(--amber); }
.led-line[data-glut="1"] u { color: var(--dim); }
.survey { margin: 0; padding: 0 0 0 18px; font-size: 13.5px; line-height: 1.5; color: var(--dim); }
.survey li { margin-bottom: 6px; }
.survey b { color: var(--ink); font-weight: 600; }
.survey .fig { color: var(--amber); }

/* ---- leaves (markets · cart · how) ----------------------------------------------------------------------- */
.leaf { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px 16px 14px; }
.leaf h2 { font: italic 400 30px/1.1 var(--serif); margin: 0 0 10px; }
.leaf p { margin: 0 0 10px; line-height: 1.6; color: var(--ink); font-size: 15.5px; }
.leaf p b { font-weight: 600; }
.leaf p .fig { color: var(--amber); }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 8px; }
.sheetrows { width: 100%; border-collapse: collapse; font-size: 13px; }
.sheetrows th { text-align: left; font: 600 10.5px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sheetrows td { padding: 7px 8px; border-bottom: 1px dashed var(--line); white-space: nowrap; }
.sheetrows td.fig { color: var(--ink); }
.takebtn { border: 0; border-radius: 8px; background: var(--amber); color: var(--ground); font: 700 12px/1 var(--sans); padding: 7px 10px; }
.takebtn:disabled { background: var(--faint); }
.backline { margin: 0; font-size: 14px; color: var(--dim); }

/* ---- the colophon ---------------------------------------------------------------------------------------- */
.colophon { border-top: 1px solid var(--line); padding-top: 14px; font-size: 12.5px; color: var(--dim); display: grid; gap: 6px; }
.colophon code { font: 400 11.5px/1.4 var(--mono); color: var(--ink); word-break: break-all; }
.colo-nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 4px; }
.colo-nav a { font: 600 12px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.colo-nav a[aria-current="page"] { color: var(--amber); }

/* ---- the hatch (dialog) + the nudge (flash) -------------------------------------------------------------- */
.hatch { display: none; position: fixed; inset: 0; z-index: 60; background: rgba(8,5,3,.72); align-items: flex-end; justify-content: center; padding: 12px; }
.hatch.open { display: flex; }
.hatch-box { width: min(520px, 100%); background: var(--panel2); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.hatch-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.hatch-head span { font: italic 400 24px/1 var(--serif); }
.hatch-shut { border: 0; background: transparent; color: var(--dim); font-size: 24px; line-height: 1; padding: 4px 8px; }
.hatch-body p { margin: 0 0 10px; font-size: 15px; line-height: 1.55; }
.hatch-body p b { font-family: var(--mono); font-weight: 500; color: var(--amber); }
.hatch-body .dim { font-size: 13px; }
.golong { width: 100%; border: 0; border-radius: 12px; background: var(--amber); color: var(--ground); padding: 14px; font: 700 15px/1 var(--sans); margin-top: 4px; }
.golong:disabled { background: var(--faint); color: var(--panel); }
.wallets { display: grid; gap: 8px; }
.wallets button { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 12px; padding: 10px 12px; font: 600 14px/1 var(--sans); text-align: left; }
.wallets img { width: 24px; height: 24px; border-radius: 6px; }
.nudge { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 70; background: var(--ink); color: var(--ground); padding: 10px 16px; border-radius: 999px; font: 600 13px/1 var(--sans); box-shadow: 0 8px 30px rgba(0,0,0,.4); max-width: calc(100vw - 80px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- the measure widens ---------------------------------------------------------------------------------- */
@media (min-width: 720px) {
  body { padding: 26px 28px 48px 82px; gap: 20px; font-size: 17px; }
  .fieldnote { font-size: 19px; line-height: 1.6; max-width: 66ch; }
  .fieldnote p { margin-bottom: 10px; }
  .note-head { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 12px; }
  .note-no { white-space: nowrap; }
  .note-mark { font-size: 32px; }
  .plat { padding: 16px 16px 12px; }
  .plat-head span:first-child, .shed-head span:first-child { font-size: 23px; }
  .haul { font-size: 16px; min-height: 58px; }
  .haul-steps button { width: 46px; }
  .haul-steps input { width: 64px; font-size: 22px; }
  .marginalia { grid-template-columns: 1fr 1fr; }
  .marginalia .ledge:last-child { grid-column: 1 / -1; }
  .hatch { align-items: center; }
  #stake { width: 52px; }
  #stakeAddr { font-size: 12.5px; max-height: 360px; }
  #stakeCopy { width: 38px; height: 38px; }
}

/* ---- the page recomposes --------------------------------------------------------------------------------- */
@media (min-width: 1000px) {
  body {
    max-width: 1220px; margin: 0 auto; padding: 30px 32px 56px 96px; gap: 22px 26px;
    grid-template-columns: minmax(0, 1fr) 372px; grid-template-rows: auto auto auto auto; align-items: start;
  }
  .fieldnote { grid-column: 1; grid-row: 1; font-size: 19.5px; max-width: none; }
  .plat { grid-column: 1; grid-row: 2; padding: 18px 18px 14px; }
  .cartshed { grid-column: 1; grid-row: 3; padding: 18px 18px 16px; }
  .marginalia { grid-column: 2; grid-row: 1 / 4; position: sticky; top: 24px; grid-template-columns: 1fr; }
  .marginalia .ledge:last-child { grid-column: auto; }
  .colophon { grid-column: 1 / -1; grid-row: 4; }
  .note-mark { font-size: 36px; }
  .plat-head span:first-child, .shed-head span:first-child { font-size: 25px; }
  .plat text { font-size: 7px; }
  .plat text.lbl { font-size: 6.5px; }
  .plat text.here { font-size: 8px; }
  .haul-row { grid-template-columns: auto minmax(0, 1fr); }
  .haul { font-size: 17px; min-height: 62px; }
  .leaf { grid-column: 1; }
  .leaf h2 { font-size: 36px; }
}
@media (min-width: 1400px) {
  body { max-width: 1280px; grid-template-columns: minmax(0, 1fr) 400px; }
  .fieldnote { font-size: 20.5px; }
  .carry-fig { font-size: 34px; }
}
