/* Gallery: the bento.
   The apps tile a 4-column grid in four sizes, three rows at a time as you scroll, and stop when they run out.
   Every tile is lit by its own app: the tint colours the glass, a blurred copy of the icon glows in the corner. */

html { scroll-behavior: auto; }
body { overflow-x: clip; }

.page { padding-top: 76px; padding-bottom: 0; }

/* Browser surfaces, in the page palette */
::selection { background: var(--blue); color: #03101f; }

/* ---------- Bar: search, categories, sort ---------- */
.bar {
  position: sticky; top: 68px; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  margin: 0 calc(var(--gutter) * -1) 10px; padding: 12px var(--gutter);
  background: rgba(5,13,28,.88);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.find {
  flex: none; width: min(340px, 100%);
  display: flex; align-items: center;
  height: 46px; padding: 0 4px 0 16px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--ground-2);
  transition: border-color .12s;
}
.find:focus-within { border-color: var(--blue); }
.find__lead { flex: none; padding-right: 8px; font: 300 16px/1 var(--display); letter-spacing: -.03em; color: var(--pale); white-space: nowrap; }
.find__input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font: 500 16px/1 var(--body); color: var(--ink); caret-color: var(--blue); }
.find__input::placeholder { color: #8197b6; }
.find__input::-webkit-search-cancel-button { display: none; }
.find__clear { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--ink-2); cursor: pointer; }
.find__clear:hover { color: var(--ink); background: var(--ground-3); }
.find__clear[hidden] { display: none; }

.chips3 {
  flex: 1; min-width: 0;
  display: flex; gap: 6px;
  overflow-x: auto; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
          mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
  padding-right: 28px;
}
.chips3::-webkit-scrollbar { display: none; }
.chip3 {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: none; color: var(--ink-2); cursor: pointer;
  font: 500 14px/1 var(--body); white-space: nowrap;
  transition: color .12s, border-color .12s, background-color .12s;
}
.chip3 i { font-style: normal; font-size: 12px; color: #8197b6; font-variant-numeric: tabular-nums; }
.chip3:hover { color: var(--ink); border-color: #2a4470; }
.chip3[aria-pressed="true"] { background: var(--pale); border-color: var(--pale); color: #03101f; }
.chip3[aria-pressed="true"] i { color: #3b5578; }

.sort { flex: none; display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.sort button { height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: none; color: var(--ink-2); cursor: pointer; font: 500 13px/1 var(--body); }
.sort button[aria-pressed="true"] { background: var(--ground-3); color: var(--ink); }
.count { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---------- The grid ---------- */
.feed { --gap: 14px; }
.bento {
  --row: clamp(214px, 17.4vw, 240px);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: var(--row);
  grid-auto-flow: dense;
  gap: var(--gap);
}

/* A tile, back to front: glass in the app's tint, the icon's glow, a light that follows the pointer,
   then the words and screens, and a fine bright edge over the top of everything. */
.tile {
  --tint: var(--blue);
  position: relative; isolation: isolate; overflow: hidden;
  display: flex;
  border-radius: 28px;
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--tint) 24%, #0b1830) 0%, color-mix(in srgb, var(--tint) 7%, #071020) 62%);
}
.tile::after {                                   /* the icon, blurred into a glow */
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  right: -16%; bottom: -34%; width: 68%; aspect-ratio: 1; border-radius: 50%;
  background: var(--icon) center / cover;
  filter: blur(46px) saturate(1.6);
  opacity: .46;
}
.tile::before {                                  /* the edge */
  content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none;
  border-radius: inherit;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.16),
    inset 0 0 0 1px color-mix(in srgb, var(--tint) 30%, rgba(255,255,255,.07));
  transition: box-shadow .16s;
}
.tile:hover::before, .tile:focus-within::before {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.3),
    inset 0 0 0 1px color-mix(in srgb, var(--tint) 70%, rgba(255,255,255,.3));
}
.tile__glow {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--tint) 34%, transparent), transparent 70%);
  opacity: 0; transition: opacity .2s;
}
.tile:hover .tile__glow { opacity: 1; }

.tile.is-new { animation: tile-in .42s var(--ease) both; animation-delay: calc(var(--n) * 45ms); }
@keyframes tile-in { from { opacity: 0; transform: translateY(18px) scale(.985); } }

.tile--big  { grid-column: span 2; grid-row: span 2; }
.tile--tall { grid-row: span 2; }
.tile--wide { grid-column: span 2; }
.tile--banner { grid-column: 1 / -1; }

.tile__body { position: relative; z-index: 1; display: flex; flex-direction: column; min-width: 0; padding: 20px; }
.tile__head { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tile__icon {
  flex: none; width: 52px; height: 52px; border-radius: 13px; background: var(--ground-3);
  box-shadow: 0 0 0 1px rgba(255,255,255,.14), 0 10px 22px -8px color-mix(in srgb, var(--tint) 70%, #000);
}
.tile__name { font: 600 20px/1.15 var(--display); letter-spacing: -.035em; }
.tile__link { text-decoration: none; outline: 0; }
/* The whole tile opens the app page: .tile__cover lies over everything, and the body lets clicks
   fall through to it except on the icon and the store buttons, which go to the store. */
.tile__cover { position: absolute; inset: 0; z-index: 2; border-radius: inherit; }
.tile:has(.tile__link:focus-visible) .tile__cover { outline: 2px solid var(--pale); outline-offset: -5px; }
.tile__body, .tile__art { pointer-events: none; }
.tile__body { z-index: 3; }
.tile__link, .tile__store, .tile__get a { pointer-events: auto; }
.tile__store { display: block; flex: none; align-self: flex-start; line-height: 0; border-radius: 14px; }
.tile__cat { display: none; margin-top: 3px; font-size: 13.5px; color: color-mix(in srgb, var(--ink) 55%, var(--tint)); }
.tile__want { margin-top: 6px; color: color-mix(in srgb, var(--ink) 80%, var(--tint)); font-size: 15px; line-height: 1.35; text-wrap: balance; }
.tile__want b { font-weight: 600; color: color-mix(in srgb, var(--tint) 60%, #fff); }
.tile__line { display: none; }

.tile__get { position: relative; z-index: 3; display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 12px; }
.get {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; padding: 0 15px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.07);
  font: 600 13px/1 var(--body); text-decoration: none; white-space: nowrap;
  transition: background-color .12s, border-color .12s, color .12s;
}
.get:hover { background: #fff; border-color: #fff; color: #03101f; }
.get:active { transform: scale(.97); }
.get--solid { background: #fff; border-color: #fff; color: #03101f; }
.get--solid:hover { background: var(--pale); border-color: var(--pale); }
.tile__open {
  margin-left: auto; flex: none;
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid rgba(255,255,255,.18);
  color: var(--ink);
  transition: background-color .14s, color .14s, border-color .14s, transform .2s var(--ease);
}
.tile:hover .tile__open { background: #fff; border-color: #fff; color: #03101f; transform: rotate(45deg); }

.tile__art { position: relative; z-index: 1; min-width: 0; }
.shot {                                           /* a screenshot, set in a phone edge */
  position: absolute; display: block;
  aspect-ratio: 540 / 1103; height: auto; object-fit: cover;
  /* The phone edge is a spread shadow, not a border. A border on a tilted image makes the browser
     clip the picture to the inner edge without smoothing, so the edge looks thick, thin, then gone. */
  --edge: 4px;
  border-radius: 20px;
  box-shadow: 0 0 0 var(--edge) #050a14, 0 0 0 calc(var(--edge) + 1px) rgba(255,255,255,.2), 0 30px 50px -20px rgba(0,0,0,.9);
  transition: transform .26s var(--ease);
}

/* Big: store-style header, the want set large, two phones stepping off the bottom edge */
.tile--big .tile__body { flex: 1 1 54%; padding: 26px; }
.tile--big .tile__head, .tile--wide .tile__head { flex-direction: row; align-items: center; }
.tile--big .tile__cat, .tile--wide .tile__cat { display: block; }
.tile--big .tile__icon { width: 64px; height: 64px; border-radius: 16px; }
.tile--big .tile__name { font-size: 24px; }
.tile--big .tile__want { margin-top: 22px; font: 300 clamp(1.55rem, 2.6vw, 2.3rem)/1.06 var(--display); letter-spacing: -.04em; color: var(--ink); }
.tile--big .tile__want b { display: block; margin-bottom: 6px; font: 600 15px/1.2 var(--display); letter-spacing: -.02em; }
.tile--big .tile__line { display: block; margin-top: 14px; max-width: 22rem; color: color-mix(in srgb, var(--ink) 64%, var(--tint)); font-size: 15px; line-height: 1.45; text-wrap: pretty; }
.tile--big .get { height: 42px; padding: 0 20px; font-size: 14px; }
.tile--big .tile__open { width: 42px; height: 42px; }
.tile--big .tile__art { flex: 1 1 46%; }
.tile--big .shot:nth-child(1) { z-index: 1; left: 0; top: 10%; width: 60%; transform: rotate(-3deg); }
.tile--big .shot:nth-child(2) { right: 5%; top: 24%; width: 60%; transform: rotate(4deg); }
.tile--big:hover .shot:nth-child(1) { transform: rotate(-4.5deg) translate(-4px, -10px); }
.tile--big:hover .shot:nth-child(2) { transform: rotate(6deg) translate(6px, -6px); }
.tile--big::after { right: -6%; bottom: -30%; width: 62%; opacity: .5; }

/* Tall: the screen is the tile; the name sits on a wash of the app colour */
.tile--tall { flex-direction: column; justify-content: flex-end; }
.tile--tall::after { display: none; }
.tile--tall .tile__art { position: absolute; inset: 0; }
.tile--tall .shot { inset: 0; width: 100%; height: 100%; aspect-ratio: auto; object-position: 50% 0; border-radius: 0; box-shadow: none; }
.tile--tall .tile__body {
  z-index: 2; padding-top: 88px;
  --wash: color-mix(in srgb, var(--tint) 18%, #050c19);
  background: linear-gradient(to top, var(--wash) 0, var(--wash) calc(100% - 100px), color-mix(in srgb, var(--wash) 72%, transparent) calc(100% - 62px), transparent);
}
.tile--tall .tile__icon { box-shadow: 0 0 0 1px rgba(255,255,255,.18), 0 12px 24px -8px rgba(0,0,0,.7); }
.tile--tall .tile__get { margin-top: 0; }
.tile--tall:hover .shot { transform: scale(1.03); }

/* Wide: words on the left, one phone rising from the right */
.tile--wide .tile__body { flex: 1 1 62%; }
.tile--wide .tile__want { margin-top: 14px; font-size: 16px; }
.tile--wide .tile__art { flex: 0 0 34%; }
.tile--wide .shot { left: 0; top: 15%; width: 84%; transform: rotate(3deg); }
.tile--wide:hover .shot { transform: rotate(1deg) translateY(-12px); }
.tile--banner .tile__art { flex-basis: 20%; }
.tile--banner .tile__line { display: block; margin-top: 8px; max-width: 34rem; color: color-mix(in srgb, var(--ink) 64%, var(--tint)); font-size: 15px; }

/* Small: icon, name, the want */
.tile--small .tile__body { flex: 1; }
.tile--small .tile__head { gap: 12px; }
.tile--small .tile__want { flex: none; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile--small .tile__get { padding-top: 8px; }
.tile--small .get, .tile--tall .get { padding: 0 13px; }
.tile--small .get + .get ~ .tile__open, .tile--tall .get + .get ~ .tile__open { display: none; }   /* two store buttons leave no room for the cue */

/* Notes under the grid */
.plain { display: grid; gap: 10px; color: var(--ink-2); }
.plain a { color: var(--ink); font-weight: 600; }
.end { margin-top: var(--gap); padding: 26px 24px; border: 1px dashed var(--line); border-radius: 28px; color: var(--ink-2); font-size: 15px; }
.end strong { display: block; margin-bottom: 4px; font: 600 18px/1.3 var(--display); letter-spacing: -.02em; color: var(--ink); }
.link { margin-top: 14px; padding: 0; border: 0; background: none; cursor: pointer; font: 600 15px/1 var(--body); color: var(--blue); text-decoration: underline; text-underline-offset: 4px; }
.link:hover { color: var(--pale); }
.page .closing { margin-top: clamp(56px, 8vw, 104px); }

/* ---------- Narrower ---------- */
@media (max-width: 1040px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); --row: clamp(172px, 31vw, 250px); }
}
@media (max-width: 700px) {
  .page { padding-top: 68px; }
  .sort { display: none; }
  .bar { flex-wrap: wrap; gap: 10px; margin-bottom: 12px; padding-top: 10px; padding-bottom: 10px; box-shadow: 0 1px 0 var(--line); }
  .find { width: 100%; }
  .chips3 { flex: 1 1 100%; margin-right: calc(var(--gutter) * -1); }
  .feed { --gap: 10px; }
  .tile { border-radius: 24px; }
  .tile__body { padding: 15px; }
  .tile__head { gap: 10px; }
  .tile__icon { width: 44px; height: 44px; border-radius: 11px; }
  .tile__name { font-size: 17px; }
  .tile__want { font-size: 13.5px; }
  .tile--small .tile__get, .tile--wide .tile__get, .tile--tall .tile__get { display: none; }
  .tile--small .tile__want, .tile--wide .tile__want { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .tile--wide .tile__cat { display: none; }
  .tile--wide .tile__head { flex-direction: column; align-items: flex-start; }
  .tile--wide .tile__want { margin-top: 6px; font-size: 13.5px; }

  /* Big goes full width and three rows deep: words on top, phones below */
  .tile--big { grid-row: span 3; flex-direction: column; }
  .tile--big .tile__body { flex: none; padding: 20px 20px 0; }
  .tile--big .tile__icon { width: 54px; height: 54px; }
  .tile--big .tile__name { font-size: 21px; }
  .tile--big .tile__want { margin-top: 16px; font-size: 1.65rem; }
  .tile--big .tile__line { display: none; }
  .tile--big .tile__get { margin-top: 0; padding-top: 16px; }
  .tile--big .tile__art { flex: 1; margin-top: 18px; }
  .tile--big .shot:nth-child(1) { left: 7%; top: 0; width: 44%; }
  .tile--big .shot:nth-child(2) { right: 7%; top: 12%; width: 44%; }

  .tile--wide .tile__art { flex-basis: 30%; }
  .tile--wide .shot { width: 92%; top: 14%; --edge: 3px; border-radius: 15px; }
}

@media (hover: none) { .tile__glow { display: none; } }
@media (pointer: coarse) {
  .chip3 { height: 44px; padding: 0 16px; }
  .find__clear { width: 44px; height: 44px; }
  .tile--big .get { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .tile.is-new { animation: none; }
  .tile:hover .shot, .tile:hover .tile__open { transform: none; }
  .tile--big .shot:nth-child(1), .tile--big:hover .shot:nth-child(1) { transform: rotate(-3deg); }
  .tile--big .shot:nth-child(2), .tile--big:hover .shot:nth-child(2) { transform: rotate(4deg); }
}

/* An announced app has no store to send anyone to yet */
.get--soon, .get--soon:hover { border-style: dashed; background: none; border-color: rgba(255,255,255,.45); color: #fff; cursor: inherit; }

/* Tiles and pills come from the script; their space is held open so the page below does not jump. */
.chips3 { min-height: 38px; }
.feed:empty { min-height: 100vh; }
