/* Pocket Arcade — home page layout. Colours and fonts come from the tokens in base.css. */

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.top-row { display: flex; align-items: center; gap: 12px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: 4px; font: 700 17px/1 var(--font-display); letter-spacing: -.01em; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; flex: none; }
.search { flex: 1; max-width: 460px; margin-left: auto; position: relative; }
.search svg { position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.search input {
  width: 100%; height: 40px; padding: 0 12px 0 38px;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); font-size: 15px;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; border-color: var(--fg); }
.btn.icon { width: 40px; padding: 0; justify-content: center; }

/* ---------- sections ---------- */
.section-head { display: flex; align-items: baseline; gap: 10px; margin: 28px 0 14px; }
.section-head h2 { margin: 0; font: 700 20px/1.2 var(--font-display); letter-spacing: -.015em; }
.rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 236px); gap: 16px;
  overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; scrollbar-width: thin;
}
.rail > * { scroll-snap-align: start; }
.intro { margin: 28px 0 0; max-width: 62ch; color: var(--muted); font-size: 16px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin: 32px 0 20px; border-bottom: 1px solid var(--line); }
.cats {
  display: flex; gap: 22px; flex: 1 1 420px; min-width: 0; overflow-x: auto; scrollbar-width: none;
  padding-right: 32px; mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
}
.cats::-webkit-scrollbar { display: none; }
.cats button {
  border: 0; background: none; padding: 10px 0 12px; margin-bottom: -1px; white-space: nowrap;
  color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent;
}
.cats button:hover { color: var(--fg); }
.cats button[aria-pressed="true"] { color: var(--fg); font-weight: 600; border-bottom-color: var(--fg); }
.cats i { font-style: normal; font-size: 12px; color: var(--faint); margin-left: 4px; font-variant-numeric: tabular-nums; }
.tools { display: flex; align-items: center; gap: 10px; margin-left: auto; padding-bottom: 8px; }
.toggle {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 14px; font-weight: 500;
}
.toggle svg { width: 16px; height: 16px; }
.toggle[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--inv); }
.toggle[aria-pressed="true"] svg { fill: currentColor; }
.sort { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.sort select { height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); font-weight: 500; }

/* ---------- game cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 42vw), 1fr)); gap: 32px 20px; }
.item { position: relative; min-width: 0; }
.card { display: block; }
.cover {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius);
  background: var(--chip); box-shadow: inset 0 0 0 1px var(--line); transition: translate .2s, box-shadow .2s;
}
.cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
a.card:hover .cover { translate: 0 -3px; box-shadow: 0 10px 24px -10px var(--shadow); }
.badge { position: absolute; left: 8px; top: 8px; padding: 2px 7px; border-radius: 6px; background: var(--fg); color: var(--inv); font-size: 11px; font-weight: 600; }
.info h3 { margin: 12px 0 2px; font: 700 16px/1.25 var(--font-display); letter-spacing: -.01em; }
.tag { margin: 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { margin: 6px 0 0; color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.card.soon .cover img { filter: grayscale(.7); opacity: .6; }
.rail .info h3 { margin-top: 10px; font-size: 15px; }
.rail .meta { margin-top: 2px; }
.heart {
  position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); color: var(--fg);
  box-shadow: 0 1px 4px var(--shadow); opacity: 0; transition: opacity .15s;
}
.heart svg { width: 17px; height: 17px; }
.item:hover .heart, .heart:focus-visible, .heart[aria-pressed="true"] { opacity: 1; }
.heart[aria-pressed="true"] svg { fill: currentColor; }
@media (hover: none) { .heart { opacity: 1; } }
.empty { grid-column: 1 / -1; padding: 48px 0; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--fg); font: 700 18px var(--font-display); margin-bottom: 4px; }

/* ---------- footer ---------- */
footer { margin-top: 56px; padding: 24px 0 calc(40px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
footer b { color: var(--fg); font-weight: 600; }

@media (max-width: 640px) {
  .top-row { gap: 8px; }
  .brand span, #surprise span { display: none; }
  #surprise { width: 40px; padding: 0; justify-content: center; }
  .grid { gap: 24px 14px; }
  .rail { grid-auto-columns: 46%; }
  .tools { margin-left: 0; width: 100%; justify-content: space-between; }
}
