/* The free designs gallery (/gallery/): the share page's look (share.css), with
   the designs as cards. One font size; hierarchy by dimming and weight. */

.gallery { padding: 12px 0 64px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.gallery .intro { max-width: 680px; display: grid; gap: 8px; }
.gallery h1 { font-size: 22px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
.gallery .crumbs a { color: inherit; }

/* Categories: a row of quiet links, the current one in black. */
.gallery .cats { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.gallery .cats a { padding: 3px 12px; border-radius: 999px; color: var(--dim); text-decoration: none; }
.gallery .cats a:hover { color: #000; }
.gallery .cats a[aria-current="page"] { background: #000; color: #fff; }
.gallery .cats a[aria-current="page"] .dim { color: rgba(255, 255, 255, .6); }

/* The designs */
.gallery .cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 28px 20px; }
.gallery .card a { position: relative; display: block; border-radius: 6px; overflow: hidden; text-decoration: none; }
/* Every design in the same box: scaled to fit a square inside an even margin, on its cloth (its card's
   background, set from the design; ZigZag's default cloth where it has none), so wide, tall, tiny and
   big designs all sit alike. */
.gallery .card .pic { aspect-ratio: 1; padding: 11%; background: #ece7dc; display: grid; place-items: center; overflow: hidden; }
.gallery .card .pic img { min-width: 0; min-height: 0; }
.gallery .card img { width: 100%; height: 100%; object-fit: contain; transition: transform .25s ease, opacity .25s ease; }
/* A picture fades in when it arrives, on the card's cloth colour (gallery.js; without script it just shows). */
.gallery .cards.fading img:not(.in) { opacity: 0; }
.gallery .card a:hover img, .gallery .card a:focus-visible img { transform: scale(1.04); }
/* The name and facts, on a white band over the picture's foot, on hover or keyboard focus. */
.gallery .card .over {
  position: absolute; inset: auto 8px 8px 8px; padding: 8px 10px; display: grid; gap: 0;
  background: #fff; border-radius: 6px; box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
  font-size: 13px; line-height: 1.35; color: #000;
  opacity: 0; transform: translateY(4px); transition: opacity .16s ease, transform .16s ease;
}
.gallery .card a:hover .over, .gallery .card a:focus-visible .over { opacity: 1; transform: none; }
.gallery .card .over .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gallery .card .over .facts { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-reduced-motion: reduce) { .gallery .card img, .gallery .card .over { transition: none; } }
.gallery .more { text-align: center; }
.gallery .empty { padding: 48px 0; }

/* Make your own: the app, under the designs. */
.gallery .own { margin-top: 24px; padding: 24px; border-radius: 10px; background: #f6f6f4; display: grid; gap: 10px; justify-items: start; max-width: 680px; }
.gallery .own h2 { color: inherit; font-weight: 600; margin: 0; }
.gallery .own .tagline { display: none; }

@media (max-width: 640px) {
  .gallery h1 { font-size: 20px; }
  .gallery .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
}

/* The finder: the search across the top, the categories under it, Sort & filter at their right. */
.gallery .finder { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.gallery .finder .search input {
  width: 100%; padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px;
  font: inherit; background: #fff; color: #000;
}
.gallery .finder .search input:focus { outline: none; border-color: #000; }
/* The magnifier, inside the box at its left. */
.gallery .finder .search { position: relative; display: block; }
.gallery .finder .search svg {
  position: absolute; left: 15px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%);
  fill: none; stroke: var(--dim); stroke-width: 1.5; stroke-linecap: round; pointer-events: none;
}
.gallery .finder .search input { padding-left: 40px; padding-right: 44px; }
/* The browser's own clear button: ours does it, the same everywhere. */
.gallery .finder .search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.gallery .finder .search .clear-q {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px;
  display: grid; place-items: center; border-radius: 50%; color: var(--dim); text-decoration: none;
}
.gallery .finder .search .clear-q:hover { background: #f2f2f0; color: #000; }
.gallery .finder .search .clear-q svg { position: static; transform: none; width: 14px; height: 14px; stroke: currentColor; }
.gallery .finder .search input:focus + svg, .gallery .finder .search:focus-within svg { stroke: #000; }
.gallery .finder .bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gallery .finder .cats { flex: 1; min-width: 0; }

/* Sort & filter: a menu at the right, like the share page's Export. */
.gallery .filter-menu { flex: none; }
.gallery .filter-menu summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.gallery .filter-menu summary .n { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #000; color: #fff; display: inline-grid; place-items: center; font-size: 12px; line-height: 1; }
.gallery .filter-menu[open] summary svg { transform: rotate(180deg); }
.gallery .filter-menu .panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; width: 280px;
  padding: 14px; border-radius: 10px; background: #fff; box-shadow: 0 6px 24px rgba(0, 0, 0, .14), 0 0 0 1px rgba(0, 0, 0, .05);
  display: grid; gap: 12px;
}
.gallery .filter-menu .field { display: grid; gap: 4px; }
.gallery .filter-menu select { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font: inherit; color: #000; }
.gallery .filter-menu .check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.gallery .filter-menu .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gallery .finder.live .filter-menu .btn:not(.light) { display: none; }
.gallery .filter-menu .clear { text-decoration: underline; text-underline-offset: 3px; }
.gallery .finder .count { flex: none; white-space: nowrap; }
/* A phone: the categories in one row that scrolls sideways, Sort & filter still at its right. */
@media (max-width: 640px) {
  .gallery .finder .cats {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin-left: -4px; padding: 2px 4px;
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
    mask-image: linear-gradient(to right, #000 85%, transparent);
  }
  .gallery .finder .cats::-webkit-scrollbar { display: none; }
  .gallery .finder .cats a { flex: none; white-space: nowrap; }
  .gallery .filter-menu summary { padding: 0 10px; }
  .gallery .filter-menu .panel { width: min(280px, calc(100vw - 32px)); }
}

/* Pages */
.gallery .pager { display: flex; align-items: center; justify-content: center; gap: 20px; }
.gallery .pager .nums { display: inline-flex; gap: 4px; }
.gallery .pager .nums a, .gallery .pager .nums span[aria-current] { min-width: 32px; padding: 3px 8px; text-align: center; border-radius: 999px; text-decoration: none; }
.gallery .pager .nums a:hover { background: #f2f2f0; }
.gallery .pager .nums span[aria-current] { background: #000; color: #fff; }
.gallery .pager .gap { padding: 3px 2px; }
.gallery .pager .prev, .gallery .pager .next { text-decoration: none; }
@media (max-width: 640px) {
  .gallery .pager { gap: 10px; }
}
/* Endless scrolling (gallery.js): the pager gives way to this, which loads the next page as it nears. */
.gallery .endless { min-height: 24px; text-align: center; }

/* Sort & filter's button: white with a hairline, so the black is kept for what's chosen. */
.share-page .filter-menu summary.btn.light { background: #fff; color: #000 !important; box-shadow: inset 0 0 0 1px var(--line); }
.share-page .filter-menu summary.btn.light:hover, .share-page .filter-menu[open] summary.btn.light { box-shadow: inset 0 0 0 1px #000; background: #fff; }
.share-page .filter-menu summary svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.5; transition: transform .15s; }
