/* The page that lists the games. The list fills the width with as many columns as fit, so adding a
   game never needs a layout change. */
/* this page is the one that scrolls */
html { height: auto; overflow: visible; }
body { height: auto; min-height: 100vh; min-height: 100svh; overflow: visible; }
main.picker {
  flex: 1;
  display: block;
  justify-items: normal;   /* the shared page centers its children; this list fills the width */
  align-content: normal;
  max-width: 1040px;
  padding: 20px 16px 120px;   /* room at the bottom so the last tile clears a floating address bar */
}
.lead { margin: 0 0 20px; max-width: 46ch; font-size: 1.1rem; color: var(--ink); text-wrap: pretty; }

.games {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 14px;
}
.game {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  grid-template-areas: "art name" "art note";
  align-content: center;
  column-gap: 16px;
  row-gap: 2px;
  height: 100%;
  min-height: 128px;
  padding: 14px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  text-decoration: none;
}
.game:hover { border-color: var(--p1); }
.art { grid-area: art; width: 96px; height: 96px; display: block; align-self: center; }
.game-name { grid-area: name; align-self: end; font-size: 1.25rem; font-weight: 700; line-height: 1.25; }
.game-note { grid-area: note; align-self: start; color: var(--dim); font-size: .95rem; line-height: 1.4; }

.art-line { stroke: var(--line); }
.art-p1 { stroke: var(--p1); }
.art-p2 { stroke: var(--p2); }
.art-rack { fill: var(--bg); stroke: var(--line); stroke-width: 3; }
.art-hole { fill: var(--panel); }
.art-p1-fill { fill: var(--p1); }
.art-p2-fill { fill: var(--p2); }
.art-sq { fill: var(--line); }
.art-crown { fill: var(--bg); }
.art-ring { fill: none; stroke: #8a4a22; stroke-width: 2.5; }
.art-ink { stroke: var(--ink); }
.art-ink-fill { fill: var(--ink); }
.art-box-1 { fill: var(--p1); opacity: .22; }
.art-box-2 { fill: var(--p2); opacity: .22; }
.art-card { fill: var(--bg); stroke: var(--line); stroke-width: 3; }
.art-card-up { fill: var(--bg); stroke: var(--p1); stroke-width: 3; }
.art-back { fill: var(--line); }

/* on a wide screen the tiles get taller, with the drawing on top */
@media (min-width: 720px) {
  main.picker { padding: 32px 24px 128px; align-content: normal; }
  .lead { margin-bottom: 28px; }
  .game {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "art" "name" "note";
    align-content: start;
    row-gap: 6px;
    padding: 20px;
  }
  .art { width: 132px; height: 132px; margin-bottom: 10px; }
  .game-name, .game-note { align-self: start; }
}

/* Two screens side by side: one column of tiles on each, nothing under the hinge. Not seen on a
   real device yet; browsers that report no segments never get here. */
@media (horizontal-viewport-segments: 2) {
  body { padding-left: 0; padding-right: 0; }
  main.picker { max-width: none; margin: 0; padding-inline: 16px; }
  .lead { max-width: min(46ch, env(viewport-segment-width 0 0) - 32px); }
  .games {
    grid-template-columns: calc(env(viewport-segment-width 0 0) - 32px) calc(env(viewport-segment-width 1 0) - 32px);
    column-gap: calc(env(viewport-segment-left 1 0) - env(viewport-segment-right 0 0) + 32px);
  }
}
