/* AnyCDKey. Barlow for text, Barlow Condensed for names and prices.
   Yellow is reserved for one thing: the price tag on the cheapest offer. */

@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("../fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("../fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("../fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("../fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("../fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }

:root {
  --page: #eef0f7;
  --panel: #ffffff;
  --line: #d2d6e8;
  --ink: #171a33;
  --muted: #555b84;
  --link: #3640c4;
  --btn: #3640c4;
  --btn-ink: #ffffff;
  --tag: #ffd43a;
  --tag-ink: #1b1700;
  --good: #1c7046;
  --bad: #b3261e;
  --wait: #7a5200;
  --text: "Barlow", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  --radius: 4px;
  --hole: var(--page);
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #12142a;
    --panel: #1b1e3b;
    --line: #30345f;
    --ink: #eceefa;
    --muted: #a3a9d1;
    --link: #a3adff;
    --btn: #a3adff;
    --btn-ink: #12142a;
    --good: #6fd3a0;
    --bad: #ff8a80;
    --wait: #f0c060;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 400 1.0625rem/1.5 var(--text);
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; padding-block: 1.5rem 4rem; }
img { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.08; margin: 0; letter-spacing: .005em; }
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem); }
h2 { font-size: 1.625rem; }
h3 { font-size: 1.25rem; font-weight: 600; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 2px; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 78rem; margin-inline: auto; padding-inline: clamp(1rem, 3vw, 2rem); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--panel); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: .5rem; top: .5rem; }
.quiet { color: var(--muted); }
.small { font-size: .875rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- header ---- */
.head { background: var(--panel); border-bottom: 1px solid var(--line); }
.head-row { display: flex; align-items: center; gap: 1rem 1.5rem; padding-block: .75rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .45rem; color: var(--ink); text-decoration: none; font: 700 1.75rem/1 var(--display); letter-spacing: .01em; }
.brand svg { fill: var(--tag); stroke: var(--tag-ink); stroke-width: 1; flex: none; }
.brand svg circle { fill: var(--panel); }
.search { position: relative; display: flex; flex: 1 1 18rem; max-width: 40rem; }
.search input {
  flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--page);
  border: 1px solid var(--line); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); padding: .5rem .75rem;
}
.search input::placeholder { color: var(--muted); opacity: 1; }
.search button { font: 600 1rem var(--text); border: 0; border-radius: 0 var(--radius) var(--radius) 0; background: var(--btn); color: var(--btn-ink); padding: 0 1rem; cursor: pointer; }
.suggest {
  position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0; margin: 0; padding: .25rem 0; list-style: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgb(10 12 40 / .25);
}
.suggest a { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem .75rem; color: var(--ink); text-decoration: none; }
.suggest a:hover, .suggest a[aria-selected="true"] { background: var(--page); }
.suggest .quiet { flex: none; font-size: .875rem; }
.cur select, .list-form select, .runform select {
  font: inherit; color: var(--ink); background: var(--page); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem .5rem;
}
.cur { margin-left: auto; }
.kinds { display: flex; gap: 1.5rem; overflow-x: auto; padding-block: 0 .1rem; scrollbar-width: none; }
.kinds a { flex: none; padding: .5rem 0 .55rem; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 3px solid transparent; }
.kinds a:hover { color: var(--ink); }
.kinds a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--tag); }

/* ---- price tag ---- */
.price { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag {
  position: relative; display: inline-flex; align-items: baseline; gap: .3em;
  background: var(--tag); color: var(--tag-ink); font: 700 1.5rem/1 var(--display);
  padding: .32em .6em .32em 1.45em; clip-path: polygon(.75em 0, 100% 0, 100% 100%, .75em 100%, 0 50%);
}
.tag::before { content: ""; position: absolute; left: .72em; top: 50%; width: .32em; height: .32em; margin-top: -.16em; border-radius: 50%; background: var(--hole); }
.tag-lead { font: 500 .6em var(--text); }

/* ---- buttons, chips ---- */
.btn {
  display: inline-block; font: 600 .9375rem/1.2 var(--text); text-decoration: none; text-align: center; cursor: pointer;
  background: var(--btn); color: var(--btn-ink); border: 1px solid var(--btn); border-radius: var(--radius); padding: .5rem .85rem; white-space: nowrap;
}
.btn:hover { filter: brightness(1.1); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.linklike { font: inherit; color: var(--link); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.chip {
  font: 500 .9375rem/1.2 var(--text); color: var(--ink); background: transparent; text-decoration: none; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: .35rem .8rem;
}
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"], .chip[aria-current="true"] { background: var(--ink); color: var(--page); border-color: var(--ink); }
.chip-empty { opacity: .45; }
.more-chips { position: relative; }
.more-chips summary { cursor: pointer; color: var(--link); font-size: .9375rem; padding: .35rem .2rem; }
.more-chips > .chips { margin-top: .4rem; }

/* ---- covers and tiles ---- */
.cover {
  position: relative; display: block; aspect-ratio: 5 / 7; overflow: hidden; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
}
/* Game covers are 5:7 and fill the frame; the few wide gift-card pictures sit inside it uncropped. */
.cover img { display: block; width: 100%; height: 100%; object-fit: contain; }
.cover.noimg img { display: none; }
.cover.noimg::after {
  content: attr(data-title); position: absolute; inset: 0; display: flex; align-items: flex-end; padding: .75rem;
  font: 600 1.125rem/1.1 var(--display); color: var(--muted); overflow-wrap: anywhere;
}
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.25rem, 1fr)); gap: 1.75rem 1rem; }
.tile a { display: block; color: var(--ink); text-decoration: none; }
.tile a:hover .tile-title { text-decoration: underline; }
.tile-title { display: block; margin-top: .55rem; font-weight: 500; font-size: .9375rem; line-height: 1.25; overflow-wrap: anywhere; }
.tile-price { display: block; margin-top: .15rem; font-size: .875rem; }
.tile-price .price { font: 700 1.125rem/1 var(--display); }
.tile-price .quiet { white-space: nowrap; }

/* ---- home ---- */
.intro { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 2.5rem; align-items: center; padding-block: 1.5rem 3rem; }
.intro-solo { grid-template-columns: minmax(0, 46rem); }
.intro h1 { font-size: clamp(2.25rem, 1.2rem + 4.2vw, 4rem); max-width: 14ch; }
.intro-text p { margin-top: 1rem; max-width: 34rem; font-size: 1.1875rem; color: var(--muted); }
.intro-kinds { list-style: none; margin: 1.5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; }
.intro-kinds a { color: var(--ink); text-decoration: none; }
.intro-kinds a:hover { text-decoration: underline; }
.intro-kinds strong { font: 700 1.25rem var(--display); }
.ladder { --hole: var(--panel); display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 1.25rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.ladder h2 a { color: var(--ink); text-decoration: none; }
.ladder h2 a:hover { text-decoration: underline; }
.rungs { list-style: none; margin: .9rem 0 1rem; padding: 0; }
.rungs li {
  display: grid; grid-template-columns: minmax(0, 7.5rem) minmax(0, 1fr) auto; gap: .75rem; align-items: center;
  padding: .45rem 0; border-top: 1px solid var(--line);
}
/* Prices rise down the list: each rung starts a step further in. */
.rungs li:nth-child(2) { margin-left: .75rem; }
.rungs li:nth-child(3) { margin-left: 1.5rem; }
.rungs li:nth-child(4) { margin-left: 2.25rem; }
.rungs li:nth-child(5) { margin-left: 3rem; }
.rung-store { font-weight: 600; }
.rung-what { color: var(--muted); font-size: .9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rungs .price { font: 700 1.25rem/1 var(--display); }
.rungs .tag { font-size: 1.5rem; }
.rungs .tag .price { font-size: 1em; }
.shelf { margin-top: 3rem; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.tiles-row { grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* ---- listing ---- */
.list-head { margin-bottom: 1.25rem; }
.list-head p { margin: .35rem 0 0; }
.list-head h1 .quiet { font: 500 1.125rem var(--text); }
.list-tools { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; justify-content: space-between; margin-bottom: 1.75rem; }
.list-form { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; font-size: .9375rem; }
.js [data-nojs] { display: none; }
.pages { margin-top: 2.5rem; }
.pages ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.pages a, .pages .here { display: block; padding: .4rem .75rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.pages .here { background: var(--ink); color: var(--page); border-color: var(--ink); }
.pages .gap { color: var(--muted); padding-inline: .25rem; }
.empty { padding: 1.5rem; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); max-width: 46rem; }

/* ---- product ---- */
.crumbs { display: flex; gap: .5rem; font-size: .9375rem; color: var(--muted); margin-bottom: 1rem; }
.crumbs a { color: var(--muted); }
.product { display: grid; grid-template-columns: 15rem minmax(0, 1fr); grid-template-areas: "side head" "side main"; grid-template-rows: auto 1fr; column-gap: 2.5rem; align-items: start; }
.product-head { grid-area: head; }
.product-side { grid-area: side; }
.product-main { grid-area: main; min-width: 0; }
.facts { margin: 1.25rem 0 0; font-size: .9375rem; }
.facts div { padding: .45rem 0; border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: .8125rem; }
.facts dd { margin: 0; }
.product-head { margin-bottom: 1.5rem; }
.lowest { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: .9rem 0 0; }
.lowest .tag { font-size: 2rem; }
.filters { display: grid; gap: .65rem; margin-bottom: 1rem; }
.filter { display: grid; grid-template-columns: 5.25rem minmax(0, 1fr); gap: .5rem; align-items: start; }
.filter-name { color: var(--muted); font-size: .9375rem; padding-top: .4rem; }
.also-global { font-size: .9375rem; margin-left: 5.75rem; }
.offers-wrap { overflow-x: auto; }
.offers { width: 100%; border-collapse: collapse; }
.offers th, .offers td { padding: .6rem .75rem .6rem 0; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.offers thead th { font-weight: 500; font-size: .8125rem; color: var(--muted); padding-block: .4rem; }
.offers tbody th { font-weight: 600; }
.offers .num { text-align: right; }
.offers .go { text-align: right; padding-right: 0; width: 1%; }
.offers .meta-line { display: none; }
.offers .cell-price .price { font: 700 1.375rem/1 var(--display); }
.offers tr.best .cell-price {
  position: relative; display: inline-flex; background: var(--tag); color: var(--tag-ink);
  padding: .3rem .6rem .3rem 1.75rem; clip-path: polygon(.9rem 0, 100% 0, 100% 100%, .9rem 100%, 0 50%);
}
.offers tr.best .cell-price::before { content: ""; position: absolute; left: .85rem; top: 50%; width: .4rem; height: .4rem; margin-top: -.2rem; border-radius: 50%; background: var(--page); }
.checked { margin-top: .9rem; font-size: .875rem; }
.prose { margin-top: 3rem; max-width: 44rem; }
.prose h2 { margin-bottom: .75rem; }
.prose h3 { margin: 1.5rem 0 .4rem; }
.prose h4 { margin: 1.25rem 0 .3rem; font: 600 1rem var(--text); }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li { margin: .25rem 0; }
.reqs { font-size: .9375rem; }
.critic { margin-top: 3rem; }
.critic h2 { margin-bottom: .75rem; }
.critic iframe { border: 0; width: 100%; max-width: 30rem; display: block; }
.product .shelf .tiles-row { grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }

/* ---- plain pages and tables ---- */
.page { max-width: 44rem; }
.page h1 { margin-bottom: 1rem; }
.page h2 { margin: 2rem 0 .5rem; }
.notfound p { max-width: 36rem; }
.plain { border-collapse: collapse; width: 100%; max-width: 56rem; }
.plain th, .plain td { text-align: left; padding: .55rem 1rem .55rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.plain thead th { font-weight: 500; font-size: .8125rem; color: var(--muted); }
.plain tbody th { font-weight: 600; }
.plain .num { text-align: right; }

/* ---- footer ---- */
.foot { border-top: 1px solid var(--line); background: var(--panel); padding-block: 1.75rem; font-size: .9375rem; color: var(--muted); }
.foot p { max-width: 52rem; }
.foot nav { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }

/* ---- owner's pages ---- */
.admin-block { margin-top: 2.75rem; }
.admin-block h2 { margin-bottom: .75rem; }
.admin { max-width: none; font-size: .9375rem; }
.admin.narrow { max-width: 24rem; }
.state { font-weight: 600; white-space: nowrap; }
.state-ok { color: var(--good); }
.state-bad { color: var(--bad); }
.state-wait, .state-off { color: var(--wait); }
.notice { padding: .75rem 1rem; border: 1px solid var(--line); border-left: 4px solid var(--tag); border-radius: var(--radius); background: var(--panel); max-width: 56rem; }
.tpl { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: .4rem .75rem; align-items: center; padding: .9rem 0; border-top: 1px solid var(--line); }
.tpl > label:first-child { grid-column: 1 / -1; font-weight: 600; }
.tpl input[name="link_template"] { font: .9375rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .6rem; min-width: 0; }
.tpl .check { font-size: .9375rem; white-space: nowrap; }
.tpl p { grid-column: 1 / -1; margin: 0; overflow-wrap: anywhere; }
.runform { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-bottom: 1rem; }
.inline { display: flex; gap: .4rem; flex-wrap: wrap; }
code { font: .875em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }

/* ---- narrower screens ---- */
@media (max-width: 68rem) {
  .tiles-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .home .tiles-row .tile:nth-child(n+9) { display: none; }
  .intro { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
}
@media (max-width: 52rem) {
  .product { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "side" "main"; grid-template-rows: auto; }
  .product-side { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1rem; align-items: start; margin-bottom: 1.5rem; }
  .facts { margin-top: 0; }
  .facts div:first-child { border-top: 0; padding-top: 0; }
  .tpl { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 42rem) {
  body { font-size: 1rem; }
  .tiles, .tiles-row, .product .shelf .tiles-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem .85rem; }
  .home .tiles-row .tile:nth-child(n+7) { display: none; }
  .cur { margin-left: 0; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .head-row { justify-content: space-between; }
  .ladder { grid-template-columns: 5.5rem minmax(0, 1fr); padding: 1rem; gap: 1rem; }
  .rungs li { grid-template-columns: minmax(0, 1fr) auto; }
  .rung-what { display: none; }
  .rungs li:nth-child(n) { margin-left: 0; }
  .filter { grid-template-columns: minmax(0, 1fr); gap: .25rem; }
  .filter-name { padding-top: 0; }
  .also-global { margin-left: 0; }

  /* Offers: each row becomes store + details on the left, price and button on the right. */
  .offers, .offers tbody { display: block; }
  .offers thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .offers tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: .6rem; align-items: center; padding: .65rem 0; border-bottom: 1px solid var(--line); }
  .offers th, .offers td { border: 0; padding: 0; width: auto; }
  .offers td.meta { display: none; }
  .offers .meta-line { display: block; font-weight: 400; font-size: .875rem; color: var(--muted); }
  .offers .cell-price .price { font-size: 1.25rem; }
  .btn { padding: .45rem .65rem; }
}
@media print {
  .head, .foot, .filters, .go, .critic { display: none; }
}
