/* The Store at full screen (js/community-gallery/community-gallery.js): a rail of views, a spotlight
   and shelves beside it, one page per entry.
   The pictures carry the colour here, so the page stays neutral: no border on a
   card, no tinted shelves, one green key per screen. Corners follow the brand's
   4/6/10 scale. The keys and modals other windows share stay in SettingsModal.css. */
.cst-overlay,
.settings-overlay { --cols: 5; }

.cgal-overlay.cst-overlay { padding: 0; }
.preset-modal.cst {
  position: relative;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--cst-text);
  background: var(--cst-page);
  backdrop-filter: blur(40px);
}
body.low-power-gpu .preset-modal.cst { backdrop-filter: none; }
@media (prefers-reduced-transparency: reduce) { .preset-modal.cst { backdrop-filter: none; } }
.cst button { font-family: inherit; }
.cst h1, .cst h2, .cst h3 { letter-spacing: 0; color: inherit; }

.cst-close {
  position: absolute; top: 18px; right: 22px; z-index: 3;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; border-radius: 10px;
  color: var(--cst-text); background: var(--cst-well);
  cursor: pointer;
}
.cst-close:hover { background: var(--cst-on); }
.cst-close .cgal-ic { font-size: 20px; }

/* ── The rail ── */
.cst-rail {
  display: flex; flex-direction: column; gap: 14px;
  min-height: 0; overflow-y: auto;
  padding: 22px 14px 18px;
  background: var(--cst-rail);
  scrollbar-width: none;
}
.cst-rail-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 0 0 10px; }
.cst-rail-title { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.2; }
.cst-refresh { color: var(--cst-muted); background: none; border: 0; }
.cst-find {
  display: flex; align-items: center; gap: 8px;
  flex: none; height: 40px; padding: 0 12px;
  border-radius: 10px;
  color: var(--cst-muted); background: var(--cst-well);
}
.cst-find .cgal-ic { flex: none; font-size: 18px; }
.cst .cst-find input.cst-search[type] {
  flex: 1; min-width: 0; height: 100%; padding: 0;
  border: 0; border-radius: 0; outline: 0; box-shadow: none;
  font-size: 15px; color: var(--cst-text); background: none;
}
.cst .cst-find input.cst-search::placeholder { color: var(--cst-muted); opacity: 1; }
.cst .cst-find input.cst-search::-webkit-search-cancel-button { display: none; }
.cst-find:focus-within { outline: 2px solid var(--cst-key); outline-offset: -2px; }
.cst-rail-list { display: flex; flex-direction: column; gap: 2px; }
.cst-rail-own { padding-top: 12px; border-top: 1px solid var(--cst-sep); }
.cst-railrow {
  display: flex; align-items: center; gap: 12px;
  flex: none; width: 100%; height: 42px; padding: 0 10px;
  border: 0; border-radius: 10px;
  font-size: 15px; font-weight: 600; text-align: left;
  color: var(--cst-muted); background: none;
  cursor: pointer;
}
.cst-railrow:hover { color: var(--cst-text); background: var(--cst-well); }
.cst-railrow.on { color: var(--cst-text); background: var(--cst-on); }
.cst-railrow:focus-visible { outline: 2px solid var(--cst-key); outline-offset: -2px; }
.cst-railrow .cgal-ic { flex: none; font-size: 19px; }
.cst-railrow .cgal-ic [data-xspark] { width: 19px; height: 19px; }
.cst-railrow-name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cst-railrow-count { margin-left: auto; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cst-railrow-count.is-update { color: var(--cst-danger); }
.cst-rail-make {
  margin-top: auto; padding: 10px;
  font-size: 13.5px; font-weight: 600;
  color: var(--cst-muted); text-decoration: none;
}
.cst-rail-make:hover { color: var(--cst-text); }

/* ── The main side ── */
.cgal-scroll.cst-main {
  min-height: 0;
  padding: 22px 32px 32px;
  overflow-x: hidden; overflow-y: auto;
  container: cst-main / inline-size;
}
.cst-view, .cst-page { display: flow-root; }
.cst-view[hidden], .cst-page[hidden] { display: none; }
.cst-host { display: flex; flex-direction: column; gap: 34px; }
.cst-listhead {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 40px; margin-bottom: 16px; padding-right: 54px;
}
.cst-listhead[hidden] { display: none; }
.cst-listhead h2 { margin: 0; font-size: 26px; font-weight: 700; }
.cst-listhead .cgal-select[hidden] { display: none; }

/* ── The spotlight ── */
.cst-spot { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; }
.cst-spot.is-solo { grid-template-columns: minmax(0, 1fr); padding-right: 54px; }
.cst-hero {
  --cst-hero-h: 400px;
  display: flex; min-width: 0; min-height: 280px; max-height: var(--cst-hero-h);
  border-radius: 10px; overflow: hidden;
  color: var(--cst-text); background: var(--cst-well);
  cursor: pointer;
}
.cst-hero.is-paper { color: var(--cst-ink); background: var(--cst-paper); }
.cst-hero-words {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 10px;
  padding: 32px;
}
.cst-hero-kind { font-size: 14px; font-weight: 600; opacity: 0.72; }
.cst-name { margin: 0; font-size: clamp(38px, 3.4vw, 60px); line-height: 1; font-weight: 700; overflow-wrap: anywhere; }
.cst-hero-line {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
  margin: 0 0 8px; font-size: 16px; line-height: 1.4; opacity: 0.86;
}
.cst-hero-key {
  display: inline-flex; align-items: center; gap: 8px;
  height: 46px; padding: 0 26px;
  border: 0; border-radius: 10px;
  font-size: 16px; font-weight: 700;
  color: var(--cst-page); background: var(--cst-text);
  cursor: pointer;
}
.cst-hero.is-paper .cst-hero-key { color: var(--cst-paper); background: var(--cst-ink); }
.cst-hero-key:disabled { opacity: 0.5; cursor: default; }
.cst-hero-key.cgal-installed { cursor: default; }
.cst-hero-key .cgal-ic { font-size: 18px; }
/* The picture keeps its proportions and the hero follows it: nothing is cropped,
   and no band of paper is left above or below it on a narrower window. */
.cst-hero .cgal-media { display: contents; }
.cst-hero .cgal-media img {
  position: static; flex: none; align-self: center;
  width: auto; height: auto; max-width: 68%; max-height: var(--cst-hero-h);
}
.cst-hero:has(canvas), .cst-hero:has(.cgal-preview) { height: var(--cst-hero-h); }
.cst-hero .cgal-media canvas, .cst-hero .cgal-media .cgal-preview {
  position: relative; inset: auto; flex: 0 0 46%; height: 100%;
}
.cst-side { display: grid; grid-template-rows: repeat(3, 1fr); gap: 10px; min-width: 0; padding-top: 46px; }

/* ── Cards ── */
.cst-card { display: block; min-width: 0; color: inherit; cursor: pointer; }
.cst-card.dim { opacity: 0.55; }
.cgal-clickable:focus-visible { outline: 2px solid var(--cst-key, var(--accent)); outline-offset: 3px; border-radius: 10px; }
.cgal-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 10px;
  background: var(--cst-sheet);
}
.cgal-media img, .cgal-media canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
/* The hero has the room to show a very wide picture whole, on its own colour. On a
   card that would be a thin strip in a box, so a card fills its frame. */
.cgal-media.from-left img { object-position: left center; }
.cst-hero .cgal-media.is-wide img { object-fit: contain; }
.cgal-preview { position: absolute; inset: 0; }
.cgal-preview-frame { width: 100%; height: 100%; border: 0; display: block; pointer-events: none; }
.cst-card-name {
  margin-top: 9px;
  font-size: 15.5px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cst-card-line {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 2px;
  font-size: 13.5px; font-weight: 500;
  color: var(--cst-muted);
}
.cst-card-kind { display: inline-flex; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; }
.cst-card-price { display: inline-flex; align-items: center; gap: 4px; flex: none; white-space: nowrap; }
.cst-card-price [data-xspark] { width: 14px; height: 14px; }
.cst-card .cgal-stars { margin: 0; color: inherit; font-weight: 500; }
.cst-card .cgal-stars:empty { display: none; }
.cst-side-item { display: grid; grid-template-columns: 136px minmax(0, 1fr); grid-template-rows: 1fr auto auto 1fr; column-gap: 12px; align-items: center; }
.cst-side-item .cgal-media { grid-row: 1 / -1; }
.cst-side-item .cst-card-name { grid-column: 2; grid-row: 2; margin-top: 0; white-space: normal; line-height: 1.15; }
.cst-side-item .cst-card-line { grid-column: 2; grid-row: 3; flex-direction: column; gap: 0; }

/* ── Shelves ── */
/* The keys on the right stay clear of the close key while the page scrolls under it. */
.cst-shelf-head { display: flex; align-items: center; gap: 12px; min-height: 34px; margin-bottom: 12px; padding-right: 54px; }
.cst-shelf-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 22px; font-weight: 700; }
.cst-shelf-lead { margin: -6px 0 12px; font-size: 14.5px; color: var(--cst-muted); }
.cst-more {
  flex: none; height: 34px; padding: 0 4px;
  border: 0; background: none;
  font-size: 14px; font-weight: 600; color: var(--cst-muted);
  cursor: pointer;
}
.cst-more:hover { color: var(--cst-text); }
.cst-keys { display: flex; flex: none; gap: 4px; }
.cst-keys[hidden] { display: none; }
.cst-step {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; border-radius: 6px;
  color: var(--cst-text); background: var(--cst-well);
  cursor: pointer;
}
.cst-step:hover:not(:disabled) { background: var(--cst-on); }
.cst-step:disabled { opacity: 0.35; cursor: default; }
.cst-step .cgal-ic { font-size: 18px; }
.cst-row {
  display: grid; grid-auto-flow: column;
  grid-auto-columns: calc((100% - (var(--cols) - 1) * 16px) / var(--cols));
  gap: 16px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.cst-row::-webkit-scrollbar { display: none; }
.cst-row > * { scroll-snap-align: start; }
.cst-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 22px 16px; }
.cst-shelf.is-history .cst-shelf-head h2 { color: var(--cst-muted); }

/* A rail of cards the Sparks view shows too. */
.cgal-hrail {
  display: grid; grid-auto-flow: column;
  grid-auto-columns: calc((100% - (var(--cols) - 1) * 16px) / var(--cols));
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.cgal-hrail > .cst-card { scroll-snap-align: start; }
