/* cart.slopped.site home: the finder and the denser views (catalog.js; cartridges skill, slopbox.md "Finding a cartridge").
   Everything here is dormant without script: the finder is made by catalog.js, and the Grid and List views apply only when
   the page's head script has set html[data-view]. Brand tokens only (themes skill), so it wears every theme. */
.catalog { position: relative; }
html[data-view] { scroll-padding-top: 76px; } /* a focused card or an anchor is not left under the sticky bar */
.catalog .cart-card[hidden], #shelves > section[hidden], .finder [hidden] { display: none !important; }

/* "Every game is one small file" now follows the shelves, so it opens its own band like the sections after it */
#shelves + .turn { padding: 32px 0; border-top: 2px solid var(--ink); }

/* the bar: the search and the view switch, stuck to the top while the shelves scroll under it */
.find-bar { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 10px; padding: 10px 0; background: var(--paper); border-bottom: 2px solid var(--ink); }
.find-field { position: relative; flex: 1 1 auto; min-width: 0; }
.find-q { display: block; width: 100%; min-height: 48px; margin: 0; padding: 0 48px 0 18px; border: 2px solid var(--ink); border-radius: 999px; background: var(--card, #fff); color: var(--ink); font: 16px/1.2 Arial, Helvetica, sans-serif; -webkit-appearance: none; appearance: none; }
.find-q::placeholder { color: var(--muted); opacity: 1; }
.find-q::-webkit-search-cancel-button, .find-q::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.find-q:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.find-key { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); min-width: 24px; padding: 1px 6px; border: 1px solid var(--muted); border-radius: 5px; color: var(--muted); font: 700 13px/1.4 Arial, sans-serif; text-align: center; pointer-events: none; }
.finder.has-q .find-key, .find-q:focus ~ .find-key { display: none; }
@media (any-pointer: coarse) { .find-key { display: none; } }
.find-clear { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--ink); cursor: pointer; }
.find-clear:hover { background: var(--acid); color: var(--on-acid, #171815); }
.find-clear:focus-visible, .find-v:focus-visible, .find-chip:focus-visible, .find-more summary:focus-visible, .find-reset:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.find-view { flex: none; display: flex; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
.find-v { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 44px; min-height: 44px; padding: 0 10px; border: 0; background: var(--paper); color: var(--ink); font: 700 14px/1 Arial, Helvetica, sans-serif; cursor: pointer; }
.find-v + .find-v { border-left: 2px solid var(--ink); }
.find-v:hover { background: var(--acid); color: var(--on-acid, #171815); }
.find-v[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.find-v:focus-visible { outline-offset: -5px; }
.find-vt { display: none; }
@media (min-width: 760px) { .find-v { padding: 0 14px; } .find-vt { display: inline; } }

/* kind and phone-control filters, each with its count */
.find-kinds { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0 2px; }
.find-chip { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 44px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); color: var(--ink); font: 700 14px/1 Arial, Helvetica, sans-serif; white-space: nowrap; cursor: pointer; }
.find-chip .n { color: var(--muted); font-weight: 400; font-size: 13px; }
.find-chip:hover:not(:disabled) { background: var(--acid); color: var(--on-acid, #171815); }
.find-chip:hover:not(:disabled) .n { color: inherit; }
.find-chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.find-chip[aria-pressed="true"] .n { color: inherit; }
.find-chip:disabled { border-style: dashed; border-color: var(--muted); color: var(--muted); cursor: default; }
.find-more { margin: 4px 0 0; }
.find-more summary { display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; font: 700 14px/1.2 Arial, Helvetica, sans-serif; cursor: pointer; }
.find-pick { font-weight: 400; }
.find-more summary::after { content: ""; flex: none; width: 8px; height: 8px; margin: -3px 0 0 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.find-more[open] summary::after { margin-top: 3px; transform: rotate(-135deg); }
.find-touch { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 6px; }
@media (max-width: 760px) {
  .find-kinds { flex-wrap: nowrap; overflow-x: auto; margin: 0 -5vw; padding: 12px 5vw 2px; scrollbar-width: none; }
  .find-kinds::-webkit-scrollbar { display: none; }
}

/* what is showing, and the way back */
.find-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0 14px; padding: 4px 0; }
.find-status { margin: 0; padding: 6px 0; font-size: 15px; }
.find-status:empty { display: none; }
.find-reset { min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--ink); font: 700 15px/1 Arial, Helvetica, sans-serif; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.finder.none { padding-bottom: 36px; }
.finder.none .find-status { padding: 26px 0 6px; font: 1000 clamp(20px, 3.2vw, 30px)/1.2 var(--head); letter-spacing: -.5px; max-width: 28ch; }
.catalog #shelves > section:first-of-type { border-top: 0; }

/* "Start here" on the lesson's card also on a phone, where the other cards drop their credit line */
@media (max-width: 760px) { #starters .shelf.compact .cart-card:has(a[href$="cart=first"]) .from { display: block; color: var(--ink); font-weight: 700; } }

/* the denser views. Cards is the page as it was. */
html[data-view="grid"], html[data-view="list"] { --tile: 124px; }
html[data-view="grid"] #shelves > section, html[data-view="list"] #shelves > section { padding: 22px 0; }
html[data-view="grid"] #shelves > section h2, html[data-view="list"] #shelves > section h2 { font-size: clamp(22px, 2.6vw, 30px); letter-spacing: -1px; margin-bottom: 12px; }
html[data-view="grid"] #shelves .sub { display: none; }

/* Grid: a drawn cartridge and its name, as many across as fit. The cover is the link; the heading stays for keyboards and
   screen readers, and its focus rings the whole tile. */
html[data-view="grid"] #shelves .shelf:not(.newest) { grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr)); gap: 20px 14px; }
html[data-view="grid"] #shelves .cart-card .about, html[data-view="grid"] #shelves .cart-card .from, html[data-view="grid"] #shelves .cart-card .facts, html[data-view="grid"] #shelves .cart-card .acts, html[data-view="grid"] #shelves .cart-card .when a { display: none; }
html[data-view="grid"] #shelves .cart-card h3 { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html[data-view="grid"] #shelves .cart-card .shell .label { padding: 6px 7px 9px; font-size: 14px; line-height: 1.05; letter-spacing: -.4px; white-space: normal; overflow-wrap: break-word; text-overflow: clip; }
html[data-view="grid"] #shelves .cart-card:focus-within { outline: 3px solid var(--focus); outline-offset: 6px; border-radius: 8px; }
html[data-view="grid"] #shelves .cart-card .when { margin: 2px 0 0; font-size: 12px; }
html[data-view="grid"] #newest .shelf.newest > li { flex-basis: var(--tile); min-width: 0; }
html[data-view="grid"] #shelves .shelf > li { min-width: 0; }
/* the lesson keeps "Start here": a wide tile with its line */
html[data-view="grid"] #shelves .cart-card:has(a[href$="cart=first"]) { grid-column: span 2; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 0 12px; }
html[data-view="grid"] #shelves .cart-card:has(a[href$="cart=first"]) .from { display: block; margin: 4px 0 0; color: var(--ink); font-size: 13px; font-weight: 700; }
@media (max-width: 760px) { html[data-view="grid"] #shelves .cart-card .shell .label, html[data-view="list"] #newest .cart-card .shell .label { padding: 5px 4px 8px; font-size: 12px; letter-spacing: -.5px; } html[data-view="grid"], html[data-view="list"] { --tile: 100px; } html[data-view="grid"] #shelves .shelf:not(.newest) { gap: 18px 12px; } }

/* List: one row each: the cover, the name, the about line, Play */
html[data-view="list"] #shelves .shelf:not(.newest) { grid-template-columns: minmax(0, 1fr); gap: 0 48px; border-top: 1px solid var(--line); }
@media (min-width: 1100px) { html[data-view="list"] #shelves .shelf:not(.newest) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; grid-template-areas: "shell title acts" "shell about acts" "shell from acts"; align-items: center; column-gap: 14px; min-height: 76px; padding: 8px 0; border-bottom: 1px solid var(--line); }
html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card:hover .shell { transform: none; }
html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card .shell { grid-area: shell; padding: 8px 6px 11px; }
html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card .shell img { border-width: 3px; border-bottom: 0; }
html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card .shell .label { display: none; }
html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card h3 { grid-area: title; margin: 0; font-size: 16px; }
html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card h3 a { display: flex; align-items: center; min-height: 44px; }
html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card h3 + .about { margin-top: -10px; }
html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card .about { grid-area: about; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 13px; color: var(--muted); }
html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card .from, html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card .facts, html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card .acts .btn:not(.primary), html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card .when a { display: none; }
html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card .acts { grid-area: acts; margin: 0; }
/* the lesson keeps "Start here" */
html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card:has(a[href$="cart=first"]) .from { display: block; grid-area: from; margin: 2px 0 0; font-size: 13px; font-weight: 700; color: var(--ink); }
html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card .acts .btn.primary { min-height: 44px; min-width: 64px; padding: 0 16px; }
@media (max-width: 760px) {
  html[data-view="list"] #shelves .shelf:not(.newest) { grid-template-columns: minmax(0, 1fr); gap: 0; }
  html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card .about { font-size: 13px; margin-bottom: 0; }
  html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card { grid-template-columns: 56px minmax(0, 1fr) auto; column-gap: 12px; }
  html[data-view="list"] #shelves .shelf:not(.newest) > .cart-card .acts .btn.primary { flex: none; }
}

/* the Newest strip is one row of small tiles in both dense views (its cards are the same as the shelves' below) */
html[data-view="list"] #newest .cart-card .about, html[data-view="list"] #newest .cart-card .when a { display: none; }
html[data-view="list"] #newest .cart-card h3 { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html[data-view="list"] #newest .shelf.newest > li { flex-basis: var(--tile); min-width: 0; }
html[data-view="list"] #newest .cart-card .shell .label { padding: 6px 7px 9px; font-size: 14px; line-height: 1.05; letter-spacing: -.4px; white-space: normal; overflow-wrap: break-word; text-overflow: clip; }
html[data-view="list"] #newest .cart-card:focus-within { outline: 3px solid var(--focus); outline-offset: 6px; border-radius: 8px; }
html[data-view="list"] #newest .cart-card .when { margin: 2px 0 0; font-size: 12px; }
html[data-view="list"] #newest .sub { display: none; }

/* the chosen state must not rest on colour alone where the system overrides it */
@media (forced-colors: active) {
  .find-v[aria-pressed="true"], .find-chip[aria-pressed="true"] { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  .find-chip:disabled { color: GrayText; border-color: GrayText; }
  .find-bar { border-bottom-color: CanvasText; }
}
@media (prefers-reduced-motion: reduce) { html[data-view] #shelves .cart-card:hover .shell { transform: none; } }
