/* trawlr deals: the design in docs/design/homepage.html. Dark only; no JS.
   Fonts: Barlow / Barlow Condensed when installed, else close system fonts
   (the CSP only allows our own files, so no web font service). */
:root {
  color-scheme: dark;
  --bg: #0D0E12; --panel: #2E323E; --line: #3A3F4D;
  --text: #EEF2F6; --muted: #A3ABB9; --soft: #D3D9E2;
  --badge: #567592; --on-badge: #FFFFFF;   /* white on it: 4.8:1 */
  --btn: #D3D9E2; --on-btn: #0D0E12;      /* soft grey: pure white glared on the dark page */
  --hover: #567592; --on-hover: #FFFFFF;
  --brand: #8FAFCC;
  --display: "Barlow Condensed", "Roboto Condensed", "Arial Narrow", "Liberation Sans Narrow", sans-serif;
  --body: "Barlow", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; overflow-x: clip; background: var(--bg); color: var(--text); font: 400 16px/1.5 var(--body); }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
img { display: block; }
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 24px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Page changes: the browser cross-fades between our pages (no JS), the header
   stays put, and a game's card image grows into its page's cover and back
   (named from data-vt; browsers without typed attr() just cross-fade).
   Only grid cards are named: the rows may show the same game, and a name
   used twice on one page cancels the whole transition. */
@view-transition { navigation: auto; }
::view-transition-group(*) { animation-duration: .28s; animation-timing-function: cubic-bezier(.2, .7, .2, 1); }
header.site { view-transition-name: site-header; }
.grid .pic, .product .cover { view-transition-name: attr(data-vt type(<custom-ident>), none); }
#deals { scroll-margin-top: 20px; }

/* Header: over the hero's picture when the page has one */
header.site .wrap { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 18px; padding-bottom: 18px; }
body:has(.hero) header.site { position: absolute; inset: 0 0 auto; z-index: 2; }
.brand { font: 800 26px/1 var(--display); font-stretch: condensed; text-decoration: none; white-space: nowrap; }
.brand span { color: var(--brand); }
header.site p { margin: 0; color: var(--soft); }

/* Hero: the picture is the page */
.hero { position: relative; min-height: min(78vh, 680px); display: flex; align-items: flex-end; overflow: hidden; }
.hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 60% 30%;
  animation: hero-art .9s cubic-bezier(.2, .7, .2, 1) both; }
.hero .wrap { animation: hero-text .6s .15s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes hero-art { from { opacity: 0; transform: scale(1.04); } }
@keyframes hero-text { from { opacity: 0; transform: translateY(12px); } }
.hero::after { content: ""; position: absolute; inset: 0;  /* top fade keeps the header readable on bright art */
  background: linear-gradient(180deg, rgb(13 14 18 / .75) 0%, rgb(13 14 18 / 0) 22%),
              linear-gradient(90deg, rgb(13 14 18 / .94) 0%, rgb(13 14 18 / .72) 38%, rgb(13 14 18 / 0) 70%),
              linear-gradient(0deg, var(--bg) 0%, rgb(13 14 18 / 0) 30%); }
.hero .wrap { position: relative; z-index: 1; width: 100%; padding-bottom: 56px; }
.hero h1 { font: 800 clamp(48px, 7vw, 96px)/.9 var(--display); font-stretch: condensed; margin: 0 0 14px; max-width: 9ch; }
.hero p { margin: 0 0 22px; max-width: 42ch; color: var(--soft); font-size: 18px; }
.deal { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.deal .now { font: 800 48px/1 var(--display); font-stretch: condensed; }
.deal s { color: var(--muted); font-size: 20px; }
.cut { background: var(--badge); color: var(--on-badge); font: 800 20px/1 var(--display); font-stretch: condensed; padding: 6px 9px; }
.deal .cut { font-size: 22px; padding: 8px 10px; }
.btn { display: inline-block; background: var(--btn); color: var(--on-btn); text-decoration: none; font-weight: 600; padding: 13px 22px; white-space: nowrap;
  transition: background-color .15s, color .15s; }
.btn:hover { background: var(--hover); color: var(--on-hover); }

/* Rows: scroll sideways, no JS */
.rail { margin-top: 36px; }
.rail h2, h1.listing, h2.listing { font: 800 30px/1 var(--display); font-stretch: condensed; margin: 0 0 14px; }
.rail ul { list-style: none; margin: -6px -6px 0; padding: 6px 6px 12px; scroll-padding-inline: 6px;  /* same column as the grid */
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 300px); gap: 18px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.rail ul:hover { scrollbar-color: var(--muted) transparent; }
.rail ul::-webkit-scrollbar { height: 8px; }
.rail ul::-webkit-scrollbar-track { background: transparent; }
.rail ul::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.rail ul:hover::-webkit-scrollbar-thumb { background: var(--muted); }
.rail li { scroll-snap-align: start; }

/* Cards (rows and grid). A missing image shows the title on a panel. */
.thumb { position: relative; display: block; text-decoration: none; } /* holds its .sr text, which would otherwise widen the page */
.pic { position: relative; display: block; aspect-ratio: 460 / 215; overflow: hidden; background: var(--panel); }
.pic img { width: 100%; height: 100%; object-fit: cover; color: transparent; transition: transform .3s cubic-bezier(.2, .7, .2, 1); }
.thumb { transition: transform .2s cubic-bezier(.2, .7, .2, 1); }
.thumb:hover { transform: translateY(-3px); }
.thumb:hover .pic img { transform: scale(1.04); }
.pic img::before { content: ""; position: absolute; inset: 0; background: var(--panel); }
.pic img::after, .noimg { content: attr(data-title); position: absolute; inset: 0; padding: 14px 16px 40px; color: var(--soft);
  font: 800 24px/1.05 var(--display); font-stretch: condensed; overflow: hidden; }
.pic .cut { position: absolute; left: 0; bottom: 0; box-shadow: 0 0 0 2px var(--bg); }
.thumb:hover .pic { outline: 3px solid var(--brand); outline-offset: 0; }
.thumb .name { display: block; font-weight: 500; font-size: 16px; color: var(--soft); margin-top: 9px; }
.line b { font: 800 22px/1.2 var(--display); font-stretch: condensed; color: var(--text); }
.line s { color: var(--muted); }
.line .store { color: var(--muted); font-size: 14px; margin-left: 4px; }

/* Filters */
.filters { margin-top: 44px; background: var(--panel); padding: 18px 20px; display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: end; }
.filters label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.filters input, .filters select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); padding: 9px 12px; min-width: 150px; }
.filters input[type=search] { min-width: 260px; }
.filters button { font: 600 16px/1 var(--body); background: var(--btn); color: var(--on-btn); border: 0; padding: 12px 20px; cursor: pointer;
  transition: background-color .15s, color .15s; }
.filters button:hover { background: var(--hover); color: var(--on-hover); }
.filters .reset { padding: 12px 0; color: var(--soft); }

/* Listing */
h1.listing, h2.listing { margin-top: 36px; }
.count { color: var(--muted); margin: -6px 0 18px; }
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 26px 20px; }
.empty { padding: 48px 0; text-align: center; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); }
.pager a { background: var(--panel); color: var(--text); padding: 10px 18px; text-decoration: none; font-weight: 600;
  transition: background-color .15s, color .15s; }
.pager a:hover { background: var(--hover); color: var(--on-hover); }

/* Product page */
.crumbs { margin: 8px 0 20px; }
.crumbs a { color: var(--soft); }
.product .cover { width: 100%; max-width: 460px; height: auto; aspect-ratio: 460 / 215; object-fit: cover; } /* the card's frame */
.product h1 { font: 800 clamp(36px, 5vw, 60px)/.95 var(--display); font-stretch: condensed; margin: 18px 0 10px; }
.kind { font: 600 14px/1 var(--body); color: var(--muted); border: 1px solid var(--line); padding: 4px 8px; vertical-align: middle; }
.lowest { color: var(--muted); }
.lowest strong { color: var(--text); }
.offers { position: relative; width: 100%; border-collapse: collapse; margin-top: 20px; background: var(--panel); }
.offers th, .offers td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); }
.offers thead th { font-size: 14px; color: var(--muted); font-weight: 500; }
.offers tbody tr:last-child th, .offers tbody tr:last-child td { border-bottom: 0; }
.offers b { font: 800 22px/1 var(--display); font-stretch: condensed; }
.offers s { color: var(--muted); margin-left: 6px; }
.offers .unavailable { color: var(--muted); }
.offers .btn { padding: 9px 16px; }

/* Footer */
footer.site { margin-top: 56px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
footer.site .wrap { padding-top: 22px; padding-bottom: 30px; }
footer.site p { margin: 0; max-width: 72ch; }
footer.site p + p { margin-top: 10px; }
footer.site a { color: var(--soft); }

/* Plain text pages (privacy) */
.prose { max-width: 68ch; padding-bottom: 8px; }
.prose h1 { font: 800 clamp(40px, 6vw, 64px)/.95 var(--display); font-stretch: condensed; margin: 8px 0 10px; }
.prose h2 { font: 800 26px/1.1 var(--display); font-stretch: condensed; margin: 34px 0 10px; }
.prose p, .prose li { color: var(--soft); }
.prose ul { padding-left: 1.2em; }
.prose li + li { margin-top: 8px; }
.prose strong { color: var(--text); }

@media (max-width: 720px) {
  header.site .wrap { flex-direction: column; align-items: flex-start; gap: 2px; }
  .hero { min-height: 560px; }
  .hero::after { background: linear-gradient(180deg, rgb(13 14 18 / .75) 0%, rgb(13 14 18 / 0) 25%),
                             linear-gradient(0deg, var(--bg) 8%, rgb(13 14 18 / .75) 55%, rgb(13 14 18 / .35) 100%); }
  /* The phone shows a slice of the wide art: aim it where the detail is
     (focus-N, measured by the art check; docs/decisions.md). */
  .hero > img.focus-0 { object-position: 0% 30%; }
  .hero > img.focus-10 { object-position: 10% 30%; }
  .hero > img.focus-20 { object-position: 20% 30%; }
  .hero > img.focus-30 { object-position: 30% 30%; }
  .hero > img.focus-40 { object-position: 40% 30%; }
  .hero > img.focus-50 { object-position: 50% 30%; }
  .hero > img.focus-60 { object-position: 60% 30%; }
  .hero > img.focus-70 { object-position: 70% 30%; }
  .hero > img.focus-80 { object-position: 80% 30%; }
  .hero > img.focus-90 { object-position: 90% 30%; }
  .hero > img.focus-100 { object-position: 100% 30%; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px; }
  .filters label:first-child, .filters label:nth-child(4), .filters button, .filters .reset { grid-column: 1 / -1; }
  .filters input, .filters select, .filters button { width: 100%; min-width: 0; }
  .grid { grid-template-columns: 1fr 1fr; gap: 20px 12px; }
  .grid .thumb .name { font-size: 15px; }
  .grid .line .store { display: block; margin: 0; }
  .offers th, .offers td { padding: 10px 8px; font-size: 15px; }
}
/* Less motion for those who ask: no page transitions, no entrance or hover movement. */
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto; }
  .thumb:hover, .thumb:hover .pic img { transform: none; }
}
