/* gamecollecting.net - box-art shelf, period treatment.
   Palette lifted from the site's own archived 2013-15 stylesheets: near-black
   greys with a soft sky blue. Press Start 2P is drawn on an 8px grid, so it is
   only ever sized in multiples of 8 - off-grid sizes render soft.
   Everything is hard-edged on purpose: 2px borders, no radius, offset shadows
   with zero blur, spacing in 8px steps. */
:root {
  --bg:        #101114;
  --plate:     #191b20;
  --plate-2:   #1f2229;
  --fg:        #ededed;
  --muted:     #8d8d8d;
  --dim:       #5c6068;
  --blue:      #68b1dc;   /* archived sky blue  */
  --blue-2:    #86b5d9;   /* archived steel     */
  --pale:      #d5dde5;   /* archived pale grey */
  --ink:       #0b0d10;
  --line:      #2c3038;
  --line-hi:   #3d434e;

  --display: "Press Start 2P", monospace;
  --body:    "Barlow", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Grid rows/tiles beat the UA stylesheet's [hidden]{display:none}. */
[hidden] { display: none !important; }

/* ---------- CRT ---------- */
.crt {
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0,0,0,.26) 0px, rgba(0,0,0,.26) 1px,
      transparent 1px, transparent 3px),
    radial-gradient(ellipse at center,
      transparent 55%, rgba(0,0,0,.45) 100%);
  animation: flicker 5.5s steps(1) infinite;
}
@keyframes flicker {
  0%, 96%, 100% { opacity: 1; }
  97%           { opacity: .88; }
  98%           { opacity: 1; }
  99%           { opacity: .93; }
}
@media (prefers-reduced-motion: reduce) {
  .crt { animation: none; }
}

/* ---------- masthead ---------- */
.bar {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 24px 24px 16px;
  border-bottom: 2px solid var(--line);
}
.brand {
  font-family: var(--display);
  font-size: 16px;
  line-height: 1;
  color: var(--fg);
  text-decoration: none;
}
.brand span { color: var(--blue); margin-right: 8px; }
.count {
  font-family: var(--display);
  font-size: 8px;
  line-height: 1.6;
  color: var(--dim);
}
.count b { color: var(--blue); font-weight: 400; }
.count i { color: var(--line-hi); font-style: normal; }
.handle {
  margin-left: auto;
  font-family: var(--display);
  font-size: 8px;
  color: var(--muted);
  text-decoration: none;
}
.handle:hover { color: var(--blue); }

/* ---------- filter rack ---------- */
.rack {
  padding: 16px 24px 8px;
  border-bottom: 2px solid var(--line);
  background: var(--plate);
}
.rack-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.rack-lab {
  font-family: var(--display);
  font-size: 8px;
  color: var(--dim);
  width: 56px;
  flex: none;
}
.key {
  font-family: var(--display);
  font-size: 8px;
  line-height: 1;
  padding: 8px 8px 6px;
  cursor: pointer;
  color: var(--muted);
  background: var(--plate-2);
  border: 2px solid var(--line-hi);
  border-radius: 0;
  box-shadow: 2px 2px 0 var(--ink);
}
.key:hover { color: var(--fg); border-color: var(--muted); }
.key:active { transform: translate(2px, 2px); box-shadow: none; }
.key.is-on {
  background: var(--blue);
  border-color: var(--pale);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
#q {
  flex: 1;
  min-width: 180px;
  font-family: var(--body);
  font-size: 15px;
  padding: 7px 10px;
  color: var(--fg);
  background: var(--ink);
  border: 2px solid var(--line-hi);
  border-radius: 0;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,.5);
}
#q::placeholder { color: var(--dim); }
#q:focus { outline: none; border-color: var(--blue); }

/* ---------- section nav + hub ---------- */
.sections { display: flex; gap: 8px; }
.sections a {
  font-family: var(--display);
  font-size: 8px;
  line-height: 1;
  padding: 8px 8px 6px;
  color: var(--muted);
  text-decoration: none;
  border: 2px solid transparent;
}
.sections a:hover { color: var(--fg); }
.sections a.on {
  color: var(--blue);
  border-color: var(--line);
  background: var(--plate);
}

.hub {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 24px;
}
.card {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 24px;
  background: var(--plate);
  border: 2px solid var(--line-hi);
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .08s steps(2), box-shadow .08s steps(2), border-color .08s;
}
.card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--ink);
  border-color: var(--blue);
}
.card h2 {
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.6;
  margin: 0 0 16px;
}
.card p { color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.card-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.card-stats span {
  font-family: var(--display);
  font-size: 8px;
  line-height: 1.4;
  color: var(--dim);
}
.card-stats b { color: var(--blue); font-weight: 400; font-size: 16px; display: block; margin-bottom: 6px; }

/* ---------- deals ---------- */
.off {
  position: absolute; top: 0; right: 0;
  font-family: var(--display); font-size: 8px; line-height: 1;
  padding: 6px 6px 4px;
  background: var(--blue); color: var(--ink);
  border-left: 2px solid var(--line-hi);
  border-bottom: 2px solid var(--line-hi);
}
.slot.is-free .off { background: var(--pale); }
.meta .sys s { color: var(--dim); }

/* ---------- platform logos ----------
   Masks, not <img>: the source SVGs carry their own brand colours, and a mask
   paints the shape in currentColor instead - so every logo matches the rack and
   flips with the active state.

   Each file's viewBox was retightened to its true getBBox, so `ratio` is the
   real ink proportion and chips size honestly. Ratios run 1:1 (Switch) to
   7.2:1 (Game Boy wordmark); max-width caps the very wide wordmarks and
   mask-size:contain letterboxes them rather than squashing. */
.key-ico { padding: 7px 9px 6px; }
.pico {
  display: block;
  height: 22px;
  width: calc(22px * var(--ratio, 1));
  max-width: 108px;
  background-color: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat;
          mask: var(--ico) center / contain no-repeat;
}
@media (max-width: 640px) {
  .pico { height: 18px; width: calc(18px * var(--ratio, 1)); max-width: 88px; }
}

/* ---------- shelf ---------- */
main { padding: 24px; }
.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 24px 16px;
}
.slot { text-decoration: none; color: inherit; display: block; }

.art {
  position: relative;
  aspect-ratio: 3 / 4;
  background:
    repeating-linear-gradient(135deg,
      #16181d 0px, #16181d 8px, #191b20 8px, #191b20 16px);
  border: 2px solid var(--line-hi);
  box-shadow: 4px 4px 0 var(--ink);
  overflow: hidden;
  transition: transform .08s steps(2), box-shadow .08s steps(2), border-color .08s;
}
.art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.slot:hover .art {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--ink);
  border-color: var(--blue);
}
.noart {
  display: flex; align-items: center; justify-content: center;
  height: 100%;
  font-family: var(--display); font-size: 8px; line-height: 2;
  color: var(--dim); text-align: center;
}

.pill {
  position: absolute; top: 0; left: 0;
  font-family: var(--display); font-size: 8px; line-height: 1;
  padding: 6px 6px 4px;
  background: var(--ink); color: var(--muted);
  border-right: 2px solid var(--line-hi);
  border-bottom: 2px solid var(--line-hi);
}
.slot:hover .pill { color: var(--blue); }

.band {
  position: absolute; left: 0; right: 0; top: 50%;
  transform: translateY(-50%);
  font-family: var(--display); font-size: 8px; line-height: 1;
  text-align: center; padding: 6px 0 4px;
  background: rgba(11,13,16,.92); color: var(--pale);
  border-top: 2px solid var(--line-hi);
  border-bottom: 2px solid var(--line-hi);
}

/* Sold out: clearly deprioritised but still identifiable - people want to see
   what they missed. brightness(.55) crushed the art to near-black at tile size. */
.slot.gone .art img { filter: grayscale(.9) brightness(.82); opacity: .7; }
.slot:hover.gone .art img { filter: grayscale(.35) brightness(.95); opacity: .9; }
.slot.gone .name    { color: var(--dim); }
.slot.gone .tag-price { color: var(--dim); text-decoration: line-through; }

.meta { padding-top: 8px; }
.name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  /* two lines max, so the grid stays on its rhythm */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.sys {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tag-price {
  display: block;
  margin-top: 4px;
  font-family: var(--display);
  font-size: 8px;
  color: var(--pale);
}

.nada {
  font-family: var(--display); font-size: 10px; line-height: 2;
  color: var(--muted); padding: 32px 24px;
}

footer {
  border-top: 2px solid var(--line);
  padding: 24px;
  text-align: center;
}
footer p {
  margin: 0;
  font-family: var(--display);
  font-size: 8px;
  line-height: 2.2;
  color: var(--dim);
}

@media (max-width: 640px) {
  .bar, .rack, main, footer { padding-left: 16px; padding-right: 16px; }
  .brand { font-size: 10px; }
  .handle { margin-left: 0; }
  .rack-lab { width: 100%; }
  .shelf { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 16px 8px; }
}
