/* ===========================================================================
   Browse
   ---------------------------------------------------------------------------
   The price table is the whole page, and it has to become something else
   entirely on a phone: six columns do not survive 390px, and a
   sideways-scrolling price table hides the figures people came for. So the
   same <table> markup is re-laid-out as one card per title, which is why every
   price cell carries its own label.
   =========================================================================== */

.browse { padding-top: 18px; padding-bottom: 70px; }

/* --- Head ---------------------------------------------------------------- */

.browse-head {
  padding: 22px 0 26px; border-bottom: 2px solid var(--ink);
  display: flex; flex-wrap: wrap; gap: 24px;
  align-items: center; justify-content: space-between;
}
.browse-head > div { flex: 1 1 380px; min-width: 0; }
.browse-head h1 { margin: 0 0 10px; font-size: 36px; }
.browse-count { margin: 0; font-size: 15px; color: var(--ink-70); }
.browse-count .num { font-weight: 700; }
/* Desktop says how many titles are priced; the phone says what the prices
   include. Both are true, and neither is worth the other's line at the width
   it is hidden on. */
.browse-count-sm { display: none; }

/* --- Console plate -------------------------------------------------------
   A photograph of the machine, sitting on the rule at the foot of the header
   like an object on a shelf.

   IT KEEPS ITS WHITE BACKGROUND. The photographs are shot on seamless white
   and the page is cream (--paper), so dropped in as-is each one would show as
   a white rectangle. Cutting them out would fix that and cost two things: an
   alpha edge to get wrong on thirty-five files, and authorship — a cut-out is
   a derivative work, which is a licence to reason about where today there is
   none. multiply does it in one line instead: white multiplied by the page is
   the page, so the backdrop disappears and the soft shadow under the console
   survives, which is the part that makes it look placed rather than pasted.

   The size is a BOX, not a height. Fixed height looked wrong in a way that is
   obvious once seen: a Game Boy rendered as tall as a PlayStation 2 reads as
   a Game Boy the size of a PlayStation 2, and this audience knows the
   hardware. contain inside a fixed box lets each machine keep its proportions
   while every header keeps the same shape. Anchored bottom-right so they all
   sit on the same line regardless of how tall the object is.

   The selector needs the parent. `.browse-head > div` above also matches this
   element and is the more specific of the two, so a bare `.browse-art` loses
   whatever order they are written in — it inherited `flex: 1 1 380px` and the
   plate floated in the middle of the header instead of sitting at its end. */
.browse-head > .browse-art {
  flex: 0 0 auto;
  width: 210px; height: 124px;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: right bottom;
  mix-blend-mode: multiply;
}

/* --- Boost lines, in the header -------------------------------------------
   These were a bordered card of their own under the head, with a red bar
   across the top announcing that boosts were running. The card is gone and
   the lines have moved up beside the title.

   What the red bar was for was ATTENTION, and the lines now get that from
   position instead: directly under the h1, first thing on the page, in the
   slot the item count used to hold. A seller reads the figure before they
   read anything else, which is what the bar was buying and it no longer has
   to be bought in red.

   Still a list, because several promotions still stack. One category can run
   a different rate on its games than on its hardware — they merge into one
   line only when the figure, the conditions and the end date all match, so
   two lines is a real state and the fixed figure column is what makes two
   rates legible as two rates rather than as noise. */

/* A GRID, AND THE ROWS ARE display:contents.

   The figure column has to be as wide as the widest figure ON THIS PAGE and
   no wider, which a fixed min-width cannot do: every live promotion today is
   a percentage, so "+10%" and "+25%" are identical widths under tabular-nums
   and any guess works — but the matcher also supports a flat dollar boost,
   and "+$10.00" beside "+10%" would leave the second row's text hanging two
   characters off the first. max-content measures it instead of guessing.

   Each column is named explicitly rather than left to auto-placement. A
   promotion with no end date emits no third cell, and under plain
   auto-placement the next row's figure would slide up into the gap and land
   in the date column. */
.browse-boost {
  margin: 10px 0 0; padding: 0; list-style: none;
  display: grid;
  grid-template-columns: max-content minmax(0, auto) max-content;
  justify-content: start; align-items: baseline;
  column-gap: 14px; row-gap: 3px;
}
.browse-boost li { display: contents; }

.bb-num {
  grid-column: 1;
  font-size: 20px; font-weight: 700; color: var(--red);
  font-variant-numeric: tabular-nums;
}
.bb-what { grid-column: 2; font-size: 14.5px; color: var(--ink-70); }
/* The label, where staff wrote a customer-facing one, owns the line; the
   measured coverage follows it in the reading colour. */
.bb-what strong { display: block; font-size: 15px; color: var(--ink); font-weight: 600; }
.bb-when {
  grid-column: 3;
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-55);
  white-space: nowrap;
}
.browse-boost-foot {
  margin: 7px 0 0; font-size: 13px; color: var(--ink-55); max-width: 62ch;
}

/* --- Columns ------------------------------------------------------------- */

.browse-cols { display: flex; flex-wrap: wrap; gap: 36px; padding-top: 28px; }
.results { flex: 999 1 600px; min-width: 0; }

/* --- Filters -------------------------------------------------------------
   A <details> so the phone gets a disclosure for free. On desktop the marker
   is hidden and the panel is forced open, which keeps one set of controls and
   one set of ids rather than two forms to keep in step. */

.filters { flex: 1 1 232px; min-width: 0; }
/* Desktop: no disclosure — but only once browse.js has confirmed it can force
   the panel open. A closed <details> hides its content through an internal
   slot, not through `display` on its children, so CSS alone cannot reveal it;
   hiding the summary without the script would leave an empty column and no way
   to get the filters back. With scripting off the class never arrives and the
   disclosure button stays, which is a working page rather than a broken one. */
.filters.js > summary { display: none; }

.f-label, .filters legend {
  display: block; padding: 0;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-55); margin-bottom: 8px;
}
.f-text {
  width: 100%; border: 2px solid var(--ink); background: var(--card);
  padding: 11px 13px; font-family: var(--font-body); font-size: 15px;
  color: var(--ink); margin-bottom: 26px;
}
.f-text:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.filters fieldset {
  border: 0; border-top: 1px solid var(--line-2);
  margin: 0 0 22px; padding: 18px 0 0;
  /* Contains the floated legend below, so the checkboxes do not wrap around it. */
  display: flow-root;
}
/* A <legend> renders INSIDE the top border by default, which left the rule
   running out of the end of each heading. Floating it drops it into normal
   flow underneath, which is where the board draws it.
   
   Everything after it then has to clear: a float is out of flow, so the first
   checkbox of each group was laying itself out BESIDE the legend and spilling
   out of the column into the results table. */
.filters legend { float: left; width: 100%; padding: 0; margin-bottom: 10px; }
.filters fieldset > *:not(legend) { clear: both; }

.f-check {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 0; font-size: 15px; cursor: pointer;
}
.f-check input { width: 17px; height: 17px; accent-color: var(--red); cursor: pointer; }

.f-min { display: flex; gap: 10px; align-items: baseline; margin: 0 0 7px; }
.f-min .num { font-size: 22px; font-weight: 700; }
.f-min span:last-child { font-size: 13px; color: var(--ink-55); }
.f-range { width: 100%; accent-color: var(--red); cursor: pointer; }
.f-scale {
  display: flex; justify-content: space-between; margin: 2px 0 0;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-40);
}

.filters .cta { width: 100%; justify-content: center; }
.f-clear {
  display: block; text-align: center; margin-top: 12px;
  font-size: 13px; color: var(--ink-55);
}

/* --- Results bar ---------------------------------------------------------- */

.results-bar {
  display: flex; flex-wrap: wrap; gap: 14px;
  align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.results-bar p { margin: 0; font-size: 15px; color: var(--ink-70); }
.sortform { display: flex; align-items: center; gap: 9px; }
.sortform label { font-size: 15px; color: var(--ink-55); }
.sortform select {
  border: 1px solid var(--line); background: var(--card);
  padding: 9px 12px; font-family: var(--font-body); font-size: 15px;
  color: var(--ink); cursor: pointer; min-height: var(--tap);
}
.sortform select:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* --- The table ------------------------------------------------------------ */

.tablewrap { overflow-x: auto; border: 2px solid var(--ink); background: var(--card); }
.pricetable { width: 100%; border-collapse: collapse; min-width: 640px; }

.pricetable thead tr { background: var(--ink); color: var(--paper); }
.pricetable th[scope="col"] {
  padding: 13px 14px; font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; font-weight: 700; text-align: right;
}
.pricetable th.col-title { text-align: left; padding-left: 16px; }
.pricetable th.col-art { width: 58px; padding: 0; }

.pricetable tbody tr { border-top: 1px solid var(--line-3); }
/* .is-alt, not :nth-child(even): an item with a crew note occupies two rows,
   so nth-child would start alternating on the wrong one from the first note
   down the page. browse.php counts items and marks both rows of a pair. */
.pricetable tbody tr.is-alt { background: var(--stripe); }

/* --- The crew-note row ---------------------------------------------------
   A full-width row under the item it belongs to. No rule between the two, and
   the same stripe, so the pair reads as one row that happens to be two.
   Indented to 74px — 58px of box-art column plus the title cell's 16px — so
   the note starts exactly under the title it is about. */
.pricetable tbody tr.noterow { border-top: 0; }
.pricetable tbody tr.noterow > td { padding: 0 16px 12px 74px; }

.col-art { width: 58px; padding: 8px 0 8px 10px; }
.art {
  display: block; width: 44px; height: 44px;
  background: var(--sunk); border: 1px solid var(--line-3);
}
.art img { display: block; width: 100%; height: 100%; object-fit: contain; }

.pricetable td.col-title, .pricetable th.col-title {
  text-align: left; padding: 12px 16px;
  font-family: var(--font-body); font-weight: 500; font-size: 15px;
}
.col-title a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.col-title a:hover { color: var(--red); border-bottom-color: var(--red); }
.col-title a:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }


.pricetable td.col-price {
  text-align: right; padding: 10px 14px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cell-label { display: none; }
.col-price .money-was { display: block; font-size: 11px; }
.col-price .money-paid { display: block; font-size: 15px; }
.cell-none { color: var(--ink-30); }

/* --- Pager ---------------------------------------------------------------- */

.pager {
  display: flex; gap: 7px; flex-wrap: wrap;
  justify-content: center; padding: 20px 0 0;
}
.pager-n {
  text-decoration: none; min-width: var(--tap); min-height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 13px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  transition: border-color 150ms, background-color 150ms;
}
.pager-n:hover { border-color: var(--ink); color: var(--ink); }
.pager-n.is-on { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.pager-gap { display: inline-flex; align-items: center; color: var(--ink-40); padding: 0 2px; }

/* ===========================================================================
   Phone
   =========================================================================== */

@media (max-width: 900px) {

  .browse { padding-top: 14px; }
  .browse-head { padding: 12px 0 14px; border-bottom: 0; display: block; }
  .browse-head h1 { font-size: 28px; margin-bottom: 6px; }

  /* Gone on a phone. The header stacks here, so the plate lands under the
     heading and pushes the price table down — measured at 61px of header
     becoming 185px, which is 124px of the one thing this page exists to show.
     display:none rather than a clipped box, so the browser never fetches the
     file at all on the devices that cannot use it. */
  .browse-head > .browse-art { display: none; }
  .browse-count { display: none; }
  .browse-count-sm {
    display: block; margin: 0;
    font-family: var(--font-mono); font-size: 13px; color: var(--ink-55);
  }

  /* The figure keeps its own column; the end date drops under the coverage
     rather than competing with it for the width that is left. */
  .browse-boost { margin-top: 8px; grid-template-columns: max-content 1fr; }
  .bb-num { font-size: 18px; }
  .bb-what { font-size: 14px; }
  /* Same column as the coverage, so it falls to the next row underneath it
     rather than fighting it for the width a phone has left. */
  .bb-when { grid-column: 2; }
  .browse-boost-foot { margin-top: 6px; font-size: 12.5px; }

  .browse-cols { display: block; padding-top: 0; }

  /* The disclosure comes back. Sort sits beside it because it is the control
     people actually reach for, and burying it behind "Filters" would cost a
     tap for the common case. */
  .filters { margin-bottom: 14px; }
  .filters.js > summary, .filters > summary {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    border: 1.5px solid var(--ink); background: var(--card); color: var(--ink);
    font-size: 13px; font-weight: 600; min-height: 46px; cursor: pointer;
    list-style: none;
  }
  .filters > summary::-webkit-details-marker { display: none; }
  .filters[open] > summary { margin-bottom: 14px; }
  /* Collapsed again here, driven by the element's own state rather than by the
     UA default, which the desktop rule above has overridden. */
  .filters:not([open]) > .filters-form { display: none; }
  .filters-n {
    background: var(--red); color: #FFFFFF;
    font-family: var(--font-mono); font-size: 11px; padding: 1px 6px;
  }

  .results-bar { margin-bottom: 11px; }
  .results-bar p { font-size: 13px; }
  .sortform { flex: 1 1 auto; }
  .sortform select { flex: 1 1 auto; min-height: 46px; font-size: 13px; }

  /* --- Table becomes cards ---
     Every cell is re-laid-out: the row is the card, the title row is its
     header, and the price cells become a strip along the bottom. The hidden
     per-cell labels come back, because a column heading two hundred pixels
     above is no use once the columns are gone. */
  .tablewrap { overflow-x: visible; border: 0; background: none; }
  .pricetable { min-width: 0; display: block; }
  .pricetable thead { display: none; }
  .pricetable tbody { display: block; }

  /* The row is a wrapping flex line.
     Art and title fill line one exactly — the title's basis is the rest of the
     width, which is what forces the price cells onto line two. A basis of 0
     (the obvious `flex: 1 1 0`) would let them squeeze onto line one instead,
     because a zero-basis item never causes a wrap.
     Padding lives on the art and title rather than the row, so the price strip
     runs edge to edge the way the board draws it. */
  .pricetable tbody tr {
    display: flex; flex-wrap: wrap; align-items: flex-start;
    background: var(--card); border: 1px solid var(--line);
    margin-bottom: 11px; padding: 0;
  }
  .pricetable tbody tr.is-alt { background: var(--card); }

  /* On a phone every row is its own bordered card, so a note row would float
     below the item as a SECOND card. Closed up instead: the item above drops
     its bottom edge and its 11px gap, and the note row continues the same box
     with no top edge of its own. */
  .pricetable tbody tr.has-note { border-bottom: 0; margin-bottom: 0; }
  .pricetable tbody tr.noterow {
    display: block; border-top: 0; margin-bottom: 11px; padding: 0;
  }
  .pricetable tbody tr.noterow > td { display: block; padding: 0 14px 12px; }

  .col-art { flex: 0 0 auto; width: auto; margin: 13px 13px 11px 14px; padding: 0; }
  .art { width: 72px; height: 72px; }

  .pricetable th.col-title {
    /* 72 art + 13 gap + 14 left + 14 right = 113 */
    flex: 1 1 calc(100% - 113px); min-width: 0;
    margin: 13px 14px 11px 0; padding: 0;
    font-size: 15px; font-weight: 600; line-height: 1.3;
  }
  .col-title a { border-bottom: 0; }

  /*
   * THE PRICE STRIP WRAPS, AND EVERY CELL IS WIDE ENOUGH FOR THE PRICE.
   *
   * Ken, 2026-11-25: on NES, "Little Samson and Power Blade 2 prices crush
   * into each other".
   *
   * This was `flex: 1 1 0; min-width: 0`, which divides the row by however
   * many conditions the category prices and lets every one of them be as
   * narrow as that comes to. NES prices six, so on a 390px phone each cell
   * was 60px wide holding content that needed 74 to 79 — measured in
   * Chromium. A price has no spaces in it, so it cannot wrap: "$1,689.99"
   * simply ran out of its cell and into the one beside it. It showed up on
   * those two games first because they are the dearest on the platform and
   * four figures is the longest a price gets.
   *
   * min-width is the whole fix. 96px is comfortably past the 79 that was
   * overflowing, and it is a MINIMUM rather than a width: flex-wrap is
   * already on this row, so the cells now fall onto a second line when they
   * will not fit and share the line they are on. Six conditions become two
   * rows of three on a phone and stay one row of six on anything wider.
   *
   * Not a smaller font. The paid price is the number the whole page exists
   * to show, and 13px is already the smallest it reads at.
   *
   * A fixed three-per-line was the other option and is wrong for this
   * catalogue: the number of conditions a category prices runs from two
   * (Amiibo, Skylanders) to twelve (the Game Boy family), so any fixed count
   * is right for one of them and wrong for the rest.
   */
  .pricetable td.col-price {
    flex: 1 1 96px; min-width: 96px;
    text-align: center; padding: 9px 4px; white-space: normal;
    border-top: 1px solid var(--line-3);
  }
  .pricetable td.col-price + td.col-price { border-left: 1px solid var(--line-3); }

  .cell-label {
    display: block; font-family: var(--font-mono); font-size: 10px;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-40);
    margin-bottom: 3px;
  }
  .col-price .money-was { font-size: 10px; }
  .col-price .money-paid { font-size: 13px; }

  .pager { padding-top: 6px; padding-bottom: 10px; }
}

/* ---------------------------------------------------------------------------
   SUBCATEGORY STRIP

   Navigation, not a filter — so it sits under the header at full width, above
   the two columns, rather than in the filter panel (which is a <details> that
   is shut unless a filter is already on).

   Reuses .chip-sub from categories.css so the control a seller clicked to get
   here looks the same once they arrive. Only the current state is added.
   --------------------------------------------------------------------------- */
.browse-subs {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 0 0 18px;
}

/* THE CURRENT CHIP IS INK, NOT RED.

   categories.css carries the reason in its own words: "a filled red chip made
   its siblings read as disabled, as though consoles and accessories were not
   wanted". That risk is real here too, and red is the brand accent — on this
   page it is already saying "boosted price" a few pixels above. A solid ink
   chip reads as "you are here", which is the only thing it has to say. */
.browse-subs .chip-sub.is-current {
  background: var(--ink); border-color: var(--ink); color: var(--paper);
  cursor: default;
}
/* The current chip is still a link (it points at the page you are on), so it
   would otherwise pick up the hover rule and appear to change state for a
   click that does nothing. */
.browse-subs .chip-sub.is-current:hover {
  background: var(--ink); border-color: var(--ink); color: var(--paper);
}

@media (min-width: 901px) {
  /* NO TOP BORDER ON DESKTOP.

     .browse-head ends in a 2px ink rule and the strip sits flush against it --
     measured, the gap is 0.0px -- so each chip was drawing its own 1px line
     directly beneath a 2px one. Dropping it lets the chips hang off the rule
     like tabs instead of reading as a separate row that happens to be touching.

     Colour rather than width, so the chip keeps its 34px height and nothing
     shifts. The side borders still run the full box, so they meet the rule.
     The current chip is unaffected either way: its background is painted under
     the border box, so ink shows through a transparent edge regardless.

     Desktop only. Below 900px there is no rule above the strip for the chips
     to belong to -- the header collapses -- so there the top border is still
     closing the shape. */
  .browse-subs .chip-sub { border-top-color: transparent; }
}

@media (max-width: 900px) {
  /* 44px targets, matching the chips on /categories at this width. */
  .browse-subs { gap: 8px; margin-bottom: 14px; }
  .browse-subs .chip-sub {
    padding: 0 13px; min-height: var(--tap);
    display: inline-flex; align-items: center;
  }
}
