/* ==========================================================================================
   /worth - THE LIVE PRICE LIST.

   THE TOKENS ARE THE WIKI'S, COPIED, NOT INVENTED. The palette, the pixel font, the slot bevel
   and the card border below are lifted from web/wiki/wiki.css so this page reads as the same
   site. It does not LINK that file because it is not a wiki page: it needs a wider column than
   900px, a data table, a chart and a drawer, none of which the wiki has or should grow. Copying
   forty lines of custom properties is the cheaper of the two mistakes available here.

   CACHE STAMPS. Assets are served max-age=14400 (four hours) and HTML max-age=0, so every
   reference to worth.css and worth.js in index.html carries ?v=YYYYMMDD-N AND THE STAMP MUST BE
   BUMPED WHENEVER THIS FILE CHANGES. The data under data/ is exempt - _headers gives it
   max-age=0, because it is rewritten every hour and a four-hour-old price list is a wrong one.

   PHONE. The body never scrolls sideways. The table drops its 1h and 7d columns under 760px
   rather than squeezing them, and the drawer becomes a full-height sheet.
   ========================================================================================== */

:root{
  --bg:#0a0d0a; --ink:#eaf2e6; --muted:#9db197;
  --grass:#4ade5f; --grass-dim:#2fa347; --green:#22b34d; --green-dim:#188038;
  --line:rgba(255,255,255,.18);
  --slot:#141a14; --slot-edge:rgba(255,255,255,.10); --slot-inset:rgba(0,0,0,.55);
  --card:rgba(10,13,10,.55);
  --pixel:"Press Start 2P", ui-monospace, monospace;
  --sans:"Rubik", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* UP AND DOWN. Two hues that survive protanopia and deuteranopia against this background, and
     they are NEVER the only signal: every number they colour carries a + or a - in front of it,
     and the drawer says "being nerfed" or "being buffed" in words. Amber rather than red for the
     fall, because red on near-black reads as an error state and a price going down is not one. */
  --up:#4ade5f; --down:#ffa33d;
  --soon:#e0a13f;
  --grid:rgba(255,255,255,.08);
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:var(--sans); line-height:1.6;
  background-image:
    radial-gradient(1200px 600px at 50% -10%, rgba(34,179,77,.10), transparent 60%),
    linear-gradient(180deg,#0e1a16 0%, #0a0d0a 60%);
  background-attachment:fixed;
  -webkit-font-smoothing:antialiased;
}
.wrap{max-width:1180px; margin:0 auto; padding:38px 20px 90px}

/* ---------------------------------------------------------------------------- top bar and hero
   Copied verbatim from the wiki template so the two pages share a header rather than resembling
   one another. */
.bar{display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:34px}
.brand{font-family:var(--pixel); font-size:.82rem; letter-spacing:.5px; text-decoration:none; color:var(--ink)}
.brand .mc{color:var(--grass)}
.nav{display:flex; gap:10px; flex-wrap:wrap}
.lnk{
  font-family:var(--sans); font-weight:700; font-size:.74rem; letter-spacing:.3px;
  text-decoration:none; color:var(--ink);
  padding:8px 13px; border:2px solid var(--line); border-radius:9px;
  background:rgba(10,13,10,.5); transition:border-color .15s ease, transform .1s ease;
}
.lnk:hover{border-color:var(--grass); transform:translateY(-1px)}
.lnk.store{color:#08130a; background:var(--green); border-color:transparent; box-shadow:0 4px 0 0 var(--green-dim)}
.lnk.store:hover{background:var(--grass); box-shadow:0 4px 0 0 var(--grass-dim)}
a:focus-visible, button:focus-visible, [tabindex]:focus-visible, input:focus-visible, select:focus-visible{
  outline:3px solid var(--grass); outline-offset:3px; border-radius:4px;
}

header.hero{margin-bottom:26px}
.eyebrow{font-family:var(--pixel); font-size:.5rem; letter-spacing:2px; color:var(--grass); text-transform:uppercase; margin:0 0 16px}
h1{font-family:var(--pixel); font-size:clamp(1.05rem,4.4vw,1.7rem); line-height:1.55; margin:0 0 14px; text-wrap:balance}
h1 .mc{color:var(--grass)}
.lede{color:var(--muted); font-size:1.02rem; max-width:64ch; margin:0}
.lede code{font-family:var(--sans); font-weight:700; color:var(--ink)}

/* ----------------------------------------------------------------------------- the market strip
   Five stat tiles, which is the right form for five unrelated single numbers - a chart of them
   would be a bar chart of apples against oranges. The number leads, the label explains, and the
   note underneath carries the caveat that keeps the number honest. */
.strip{
  display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:12px;
  margin:26px 0 14px;
}
.tile{
  background:var(--card); border:2px solid var(--line); border-radius:14px; padding:14px 16px;
  backdrop-filter:blur(6px);
}
.tile .label{
  font-family:var(--pixel); font-size:.42rem; letter-spacing:1.4px; text-transform:uppercase;
  color:var(--grass); margin:0 0 10px;
}
.tile .value{font-size:1.42rem; font-weight:800; line-height:1.2; margin:0; letter-spacing:-.5px}
.tile .value small{font-size:.9rem; font-weight:700; color:var(--muted)}
.tile .note{margin:6px 0 0; font-size:.78rem; color:var(--muted); line-height:1.45}
.tile .note b{color:var(--ink); font-weight:700}
.tile.wide{grid-column:span 2}
@media(max-width:560px){ .tile.wide{grid-column:span 1} }

/* ------------------------------------------------------------------------------------- controls
   One row above the table, which is where a filter belongs: changing it must not move the thing
   it filters. Search is first because it is what nine visitors in ten came to do. */
.controls{
  display:flex; flex-wrap:wrap; gap:10px; align-items:center;
  margin:22px 0 14px; padding:14px; border:2px solid var(--line); border-radius:14px;
  background:var(--card);
}
.search{flex:1 1 260px; position:relative; display:flex; align-items:center}
.search input{
  width:100%; font-family:var(--sans); font-size:.95rem; color:var(--ink);
  background:var(--slot); border:2px solid var(--line); border-radius:10px;
  padding:10px 12px 10px 38px;
}
.search input::placeholder{color:var(--muted)}
.search svg{position:absolute; left:12px; width:16px; height:16px; fill:none; stroke:var(--muted); stroke-width:2}
.chips{display:flex; gap:6px; flex-wrap:wrap}
.chip{
  font-family:var(--sans); font-weight:700; font-size:.76rem; color:var(--ink); cursor:pointer;
  background:rgba(10,13,10,.5); border:2px solid var(--line); border-radius:20px; padding:7px 13px;
  transition:border-color .15s ease, color .15s ease;
}
.chip:hover{border-color:var(--grass)}
.chip[aria-pressed="true"]{border-color:var(--grass); color:var(--grass)}
.controls select{
  font-family:var(--sans); font-weight:700; font-size:.8rem; color:var(--ink);
  background:var(--slot); border:2px solid var(--line); border-radius:10px; padding:9px 11px;
}
.count{font-size:.8rem; color:var(--muted); margin-left:auto}

/* ---------------------------------------------------------------------------------- the table
   A real <table>: it is tabular data, it is sortable by column, and a screen reader should be
   able to say "row 12 of 1,411, price". The whole row is a button - a link-sized hit target is
   wrong for something the width of the page. */
.tablewrap{border:2px solid var(--line); border-radius:14px; background:var(--card); overflow:hidden}
table{width:100%; border-collapse:collapse; font-variant-numeric:tabular-nums}
thead th{
  position:sticky; top:0; z-index:2;
  background:#101610; color:var(--muted);
  font-family:var(--pixel); font-size:.42rem; letter-spacing:1.2px; text-transform:uppercase;
  text-align:right; padding:14px 12px; white-space:nowrap; border-bottom:2px solid var(--line);
}
thead th:first-child, thead th.left{text-align:left}
thead th[data-sort]{cursor:pointer; user-select:none}
thead th[data-sort]:hover{color:var(--grass)}
thead th .arrow{opacity:0; margin-left:5px; color:var(--grass)}
thead th[aria-sort] .arrow{opacity:1}
tbody tr{border-bottom:1px solid rgba(255,255,255,.06); cursor:pointer}
tbody tr:last-child{border-bottom:0}
tbody tr:hover{background:rgba(74,222,95,.06)}
tbody tr:focus-visible{outline:3px solid var(--grass); outline-offset:-3px}
tbody td{padding:9px 12px; text-align:right; white-space:nowrap; font-size:.92rem}
tbody td.item{text-align:left; width:44%}

/* The slot: the bevelled inventory square from the wiki, at row size. image-rendering:pixelated is
   what keeps a 16px sprite crisp instead of blurred when the browser scales it up to 32. */
.slot{
  display:inline-flex; align-items:center; justify-content:center; vertical-align:middle;
  width:34px; height:34px; margin-right:10px; flex:0 0 34px;
  background:var(--slot); border:2px solid var(--slot-edge); border-radius:7px;
  box-shadow:inset 0 2px 0 0 var(--slot-inset);
}
.slot img{
  /* A 16px box with object-fit:none crops rather than scales, and the crop is the top-left square.
     That matters because animated textures (lava, sea lantern, prismarine) ship as one tall strip
     of frames: cropping shows frame one, where fitting would show a squashed filmstrip. The scale
     transform then blows the 16px crop up to 24 - pixelated, so it stays sharp Minecraft art
     rather than a blur. */
  width:16px; height:16px; image-rendering:pixelated;
  object-fit:none; object-position:top left;
  transform:scale(1.5); transform-origin:center;
}
/* No sprite in the jar for it - banners, chests, heads, shields. Two letters beats a broken image
   and beats borrowing another item's picture, which would be a lie about what the row is. */
.slot .letters{font-family:var(--pixel); font-size:.5rem; color:var(--muted)}
.nameCell{display:flex; align-items:center; min-width:0}
.nameText{min-width:0}
.nameText b{display:block; font-weight:700; font-size:.95rem; overflow:hidden; text-overflow:ellipsis}
.nameText span{display:block; font-size:.72rem; color:var(--muted); overflow:hidden; text-overflow:ellipsis}
td.price{font-weight:800; font-size:1rem}
.delta{font-weight:700}
.delta.up{color:var(--up)}
.delta.down{color:var(--down)}
.delta.flat{color:var(--muted)}
td.spark{width:110px; padding-right:16px}
td.spark svg{display:block; width:96px; height:26px; overflow:visible}

/* The badges that say why a price is doing what it is doing. */
.tag{
  display:inline-block; font-family:var(--pixel); font-size:.38rem; letter-spacing:1px;
  text-transform:uppercase; padding:4px 6px; border-radius:5px; vertical-align:middle;
  margin-left:8px; white-space:nowrap;
}
.tag.nerf{background:transparent; color:var(--down); border:2px solid var(--down)}
.tag.new{background:transparent; color:var(--soon); border:2px dashed var(--soon)}
.tag.event{background:var(--green); color:#08130a; border:2px solid transparent}

.more{display:block; width:100%; padding:16px; text-align:center; cursor:pointer;
  font-family:var(--sans); font-weight:700; font-size:.85rem; color:var(--grass);
  background:rgba(74,222,95,.05); border:0; border-top:1px solid rgba(255,255,255,.06)}
.more:hover{background:rgba(74,222,95,.12)}
.empty{padding:40px 20px; text-align:center; color:var(--muted)}

/* ----------------------------------------------------------------------------------- the drawer
   One item, opened from a row. A drawer rather than a separate page because the answer to "what
   about this one instead" should be one click, not a navigation - and because the price list is
   the context the chart is read in. */
.scrim{
  position:fixed; inset:0; background:rgba(4,7,4,.72); backdrop-filter:blur(3px);
  opacity:0; pointer-events:none; transition:opacity .18s ease; z-index:40;
}
.scrim.open{opacity:1; pointer-events:auto}
.drawer{
  position:fixed; top:0; right:0; bottom:0; width:min(560px,100%);
  background:#0c110c; border-left:2px solid var(--line);
  transform:translateX(100%); transition:transform .22s ease; z-index:50;
  display:flex; flex-direction:column; overflow-y:auto; overscroll-behavior:contain;
}
.drawer.open{transform:none}
@media(max-width:600px){
  .drawer{width:100%; top:auto; height:92vh; border-left:0; border-top:2px solid var(--line);
    border-radius:18px 18px 0 0; transform:translateY(100%)}
  .drawer.open{transform:none}
}
.drawerhead{
  display:flex; align-items:flex-start; gap:14px; padding:20px 20px 14px;
  border-bottom:1px solid rgba(255,255,255,.08); position:sticky; top:0; background:#0c110c; z-index:2;
}
.drawerhead .slot{width:48px; height:48px; flex:0 0 48px}
.drawerhead .slot img{transform:scale(2)}
.drawerhead .slot .letters{font-size:.62rem}
.drawerhead h2{font-size:1.2rem; font-weight:800; margin:0; line-height:1.3}
.drawerhead .key{font-size:.76rem; color:var(--muted); font-family:ui-monospace,monospace}
.close{
  margin-left:auto; flex:0 0 auto; cursor:pointer; color:var(--ink);
  background:rgba(255,255,255,.06); border:2px solid var(--line); border-radius:9px;
  width:36px; height:36px; font-size:1.1rem; line-height:1;
}
.close:hover{border-color:var(--grass)}
.drawerbody{padding:18px 20px 40px}

.headline{display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; margin:0 0 4px}
.headline .now{font-size:2.1rem; font-weight:800; letter-spacing:-1px}
.headline .delta{font-size:1rem}
.headline + p{margin:0 0 18px; color:var(--muted); font-size:.85rem}

/* Range tabs sit above the chart, in one row, and never move it. */
.ranges{display:flex; gap:6px; margin:0 0 10px}
.ranges .chip{font-size:.72rem; padding:5px 11px}

.chartbox{position:relative; margin-bottom:6px}
.chartbox svg{display:block; width:100%; height:220px; overflow:visible; touch-action:pan-y}
.axis{fill:var(--muted); font-size:10px; font-family:var(--sans)}
.gridline{stroke:var(--grid); stroke-width:1}
.zeroline{stroke:rgba(255,255,255,.16); stroke-width:1; stroke-dasharray:3 3}
/* 2px line, no dot per point: at 168 points a marker on each is a caterpillar, not a chart. The
   single dot appears under the crosshair, on the point being read. */
.series{fill:none; stroke:var(--grass); stroke-width:2; stroke-linejoin:round; stroke-linecap:round}
.seriesfill{fill:url(#worthfade); stroke:none}
.cross{stroke:rgba(255,255,255,.35); stroke-width:1}
.dot{fill:var(--grass); stroke:#0c110c; stroke-width:2}
.tip{
  position:absolute; pointer-events:none; z-index:3; transform:translate(-50%,-100%);
  background:#141a14; border:2px solid var(--line); border-radius:9px; padding:7px 10px;
  font-size:.8rem; white-space:nowrap; opacity:0; transition:opacity .1s ease;
  box-shadow:0 8px 24px rgba(0,0,0,.5);
}
.tip.on{opacity:1}
.tip b{display:block; font-size:.95rem; font-weight:800}
.tip span{color:var(--muted); font-size:.72rem}
/* The three numbers a reader would otherwise get by dragging along the whole line themselves. */
.rangefacts{margin:8px 0 0; font-size:.82rem; color:var(--muted)}
.rangefacts b{color:var(--ink)}

.facts{list-style:none; margin:20px 0 0; padding:0; display:grid; grid-template-columns:1fr 1fr; gap:1px;
  background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.08); border-radius:12px; overflow:hidden}
.facts li{background:#0c110c; padding:12px 14px}
.facts dt{font-size:.72rem; color:var(--muted); margin:0 0 3px}
.facts dd{margin:0; font-size:.98rem; font-weight:700; font-variant-numeric:tabular-nums}
.facts dd small{font-weight:400; color:var(--muted); font-size:.76rem}

.why{
  margin:20px 0 0; padding:14px 16px; border-radius:12px;
  border:2px solid var(--line); background:rgba(10,13,10,.5);
}
.why h3{font-family:var(--pixel); font-size:.5rem; letter-spacing:1.2px; text-transform:uppercase;
  color:var(--grass); margin:0 0 10px}
.why p{margin:0 0 8px; font-size:.88rem; color:var(--muted)}
.why p:last-child{margin:0}
.why b{color:var(--ink)}

/* --------------------------------------------------------------------------------- the explainer
   The rules, in the order a pass applies them. It is at the bottom because the prices are what
   people came for, and it is on the page at all because a market whose rules are secret is one
   players assume is rigged. */
.sectionhead{margin:52px 0 18px}
.sectionhead h2{font-family:var(--pixel); font-size:.72rem; line-height:1.7; margin:0 0 10px}
.sectionhead h2 .mc{color:var(--grass)}
.sectionhead p{margin:0; color:var(--muted); max-width:70ch}
.steps{list-style:none; counter-reset:step; margin:0; padding:0; display:grid; gap:12px}
.steps li{
  counter-increment:step; position:relative; padding:16px 18px 16px 62px;
  border:2px solid var(--line); border-radius:14px; background:var(--card);
}
.steps li::before{
  content:counter(step); position:absolute; left:18px; top:16px;
  width:28px; height:28px; border-radius:8px; display:grid; place-items:center;
  background:var(--green); color:#08130a; font-family:var(--pixel); font-size:.6rem;
}
.steps h3{margin:0 0 6px; font-size:1rem; font-weight:800}
.steps p{margin:0; color:var(--muted); font-size:.9rem}
.steps b{color:var(--ink)}
.foot{margin-top:34px; color:var(--muted); font-size:.82rem}
.foot a{color:var(--grass)}

@media(max-width:760px){
  .wrap{padding:24px 14px 70px}
  .hide-s{display:none}
  tbody td.item{width:auto}
  tbody td{padding:8px 8px; font-size:.88rem}
  thead th{padding:12px 8px}
  .facts{grid-template-columns:1fr}
}
