/* brainai.store: the store layer, on top of brand.css and home.css. The
   catalog, the home page rails and the about page. Apps are listed as a ruled
   index like the rest of the site, not as a grid of cards. */

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- category tints: one quiet colour per shelf ---------- */
.app__icon {
  --tint: var(--b-ink);
  display: inline-grid; place-items: center; flex: none;
  width: 2.75rem; height: 2.75rem; border-radius: 0.75rem;
  color: var(--tint); background: color-mix(in srgb, var(--tint) 11%, var(--b-paper));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tint) 18%, transparent);
}
.app__icon svg {
  width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.app__icon--photos { --tint: #0b6b43; }
.app__icon--documents { --tint: #2638d9; }
.app__icon--data { --tint: #8a4b00; }
.app__icon--design { --tint: #a0245f; }
.app__icon--developer { --tint: #3b4452; }
.app__icon--audio { --tint: #6331b0; }

/* ---------- catalog page ---------- */
.shelf { padding-top: clamp(2rem, 5vw, 3.75rem) !important; padding-bottom: 5rem !important; }
.shelf__title {
  margin: 0; font-weight: 750; letter-spacing: -0.035em; line-height: 1.02;
  font-size: clamp(2.25rem, 5.5vw, 3.75rem); text-wrap: balance;
}
.shelf__lede { margin: 1rem 0 0; max-width: 38rem; color: var(--b-graphite); font-size: clamp(1.0625rem, 1.5vw, 1.1875rem); }

.finder {
  display: flex; flex-wrap: wrap; gap: 0.625rem; align-items: stretch;
  margin-top: 2rem;
}
.finder__search {
  position: relative; flex: 1 1 14rem; min-width: 0; display: flex; align-items: center;
}
.finder__glass {
  position: absolute; left: 0.9rem; width: 1.2rem; height: 1.2rem; pointer-events: none;
  fill: none; stroke: var(--b-graphite); stroke-width: 2; stroke-linecap: round;
}
.finder__search input {
  width: 100%; min-height: 48px; padding: 0 1rem 0 2.6rem;
  font: inherit; color: var(--b-ink); background: var(--b-paper);
  border: 1.5px solid var(--b-rule); border-radius: 0.75rem;
}
.finder__search input:focus { outline: 3px solid var(--b-signal); outline-offset: 1px; border-color: var(--b-signal); }
.finder__sort {
  display: flex; align-items: center; gap: 0.5rem; padding: 0 0.25rem 0 0.9rem;
  min-height: 48px; background: var(--b-paper); border: 1.5px solid var(--b-rule); border-radius: 0.75rem;
  color: var(--b-graphite); font-size: 0.95rem;
}
.finder__sort select {
  min-height: 44px; font: inherit; font-weight: 600; color: var(--b-ink);
  background: transparent; border: 0; padding: 0 0.5rem; cursor: pointer;
}
.finder__sort select:focus-visible { outline: 3px solid var(--b-signal); outline-offset: 2px; border-radius: 0.4rem; }
.finder__file { display: flex; min-width: 0; max-width: 100%; }
.finder__sort { min-width: 0; max-width: 100%; }
.finder__sort select { min-width: 0; max-width: 100%; }
.finder__filebtn {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0.5rem 1rem; max-width: 100%;
  border-radius: 0.75rem; border: 1.5px dashed color-mix(in srgb, var(--b-ink) 30%, transparent);
  font-weight: 600; color: var(--b-signal); cursor: pointer; background: transparent;
}
.finder__filebtn:hover { border-color: var(--b-signal); background: color-mix(in srgb, var(--b-signal) 5%, transparent); }
.finder__file:focus-within .finder__filebtn { outline: 3px solid var(--b-signal); outline-offset: 2px; }

.chips {
  display: flex; gap: 0.4rem; margin: 0.5rem calc(var(--b-gutter) * -1) 0; padding: 0.5rem var(--b-gutter) 0.625rem;
  overflow-x: auto; scrollbar-width: none; scroll-padding-inline: calc(var(--b-gutter) + 0.5rem);
}
.chips::-webkit-scrollbar { display: none; }
/* End padding is dropped in scrolling flex rows; this keeps the last chip's focus ring visible. */
.chips::after { content: ''; flex: 0 0 1px; }
.chip {
  display: inline-flex; align-items: center; gap: 0.4rem; flex: none;
  min-height: 44px; padding: 0 0.95rem; border-radius: 999px;
  color: var(--b-ink); text-decoration: none; font-weight: 600; font-size: 0.975rem;
  border: 1.5px solid var(--b-rule);
}
.chip:hover { border-color: var(--b-ink); }
/* Inside a scroller: a ring at offset 0 isn't clipped by the scroll edge. */
.chip:focus-visible { outline: 3px solid var(--b-signal); outline-offset: 0; }
.chip[aria-current='page'] { background: var(--b-ink); border-color: var(--b-ink); color: var(--b-paper); }
.chip__n { font-variant-numeric: tabular-nums; font-weight: 500; opacity: 0.7; }

.finder__status { margin: 1.5rem 0 0.75rem; min-height: 1.5em; color: var(--b-graphite); font-size: 0.975rem; }
.finder__status .linkbtn { margin-left: 0.35rem; }
.linkbtn {
  font: inherit; color: var(--b-signal); background: none; border: 0; padding: 0.6rem 0.1rem;
  text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; font-weight: 600;
}

/* ---------- the app index ---------- */
.applist {
  list-style: none; margin: 0; padding: 0;
  border-top: 2px solid var(--b-ink);
  display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 2.5rem;
}
@media (min-width: 56rem) { .applist { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.app { border-bottom: 1px solid var(--b-rule); }
.app[hidden] { display: none; }
.app__link {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 1rem; row-gap: 0.15rem;
  padding: 1.1rem 0.35rem; color: inherit; text-decoration: none; border-radius: 0.5rem;
}
.app__icon { grid-row: 1 / 4; align-self: start; }
.app__name { font-size: 1.1875rem; font-weight: 700; letter-spacing: -0.015em; line-height: 1.3; }
.app__tagline { color: var(--b-graphite); line-height: 1.45; overflow-wrap: anywhere; }
.app__name, .app__meta { min-width: 0; overflow-wrap: anywhere; }
.app__meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-top: 0.3rem; font-size: 0.875rem; color: var(--b-graphite); }
.app__cat { font-weight: 600; color: var(--b-ink); }
.app__trend { color: var(--b-local); font-weight: 600; font-variant-numeric: tabular-nums; }
.app__link:hover { background: color-mix(in srgb, var(--b-ink) 3%, transparent); }
.app__link:hover .app__name, .app__link:focus-visible .app__name { color: var(--b-signal); }
.app__link:focus-visible { outline: 3px solid var(--b-signal); outline-offset: -3px; }
.app.is-match .app__icon { box-shadow: inset 0 0 0 2px var(--tint); }

.applist__empty { padding: 2rem 0.35rem; border-bottom: 1px solid var(--b-rule); }
.applist__empty p { margin: 0; }

/* ---------- home page rails ---------- */
.rail { padding-bottom: 4rem !important; }
.rail__head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 2rem;
  margin-bottom: 1.25rem;
}
.rail__head h2 { margin: 0; font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.025em; font-weight: 750; }
.rail__sub { margin: 0; color: var(--b-graphite); max-width: 36rem; }
.rail__sub a { font-weight: 600; display: inline-block; padding: 0.6rem 0; }
.rail[hidden] { display: none; }

/* Most used: a real ranking, so it is numbered. */
.ranks {
  list-style: none; margin: 0; padding: 0; counter-reset: rank;
  border-top: 2px solid var(--b-ink);
  display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 2.5rem;
}
@media (min-width: 56rem) { .ranks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ranks li { counter-increment: rank; border-bottom: 1px solid var(--b-rule); }
.rank {
  display: grid; grid-template-columns: 2.5rem auto minmax(0, 1fr); align-items: center; column-gap: 1rem;
  padding: 0.9rem 0.35rem; color: inherit; text-decoration: none; border-radius: 0.5rem;
}
.rank::before {
  content: counter(rank); font-variant-numeric: tabular-nums; font-weight: 800;
  font-size: 1.75rem; letter-spacing: -0.03em; color: var(--b-graphite); text-align: right;
}
.rank__text { display: grid; min-width: 0; overflow-wrap: anywhere; }
.rank__name { font-weight: 700; font-size: 1.125rem; }
.rank__uses { color: var(--b-local); font-size: 0.9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.rank:hover { background: color-mix(in srgb, var(--b-ink) 3%, transparent); }
.rank:hover .rank__name { color: var(--b-signal); }
.rank:focus-visible { outline: 3px solid var(--b-signal); outline-offset: -3px; }

.cats {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 0.625rem;
}
.cat {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 0.9rem; align-items: center;
  padding: 0.9rem 1rem; border-radius: 0.9rem; min-height: 4.5rem;
  background: var(--b-paper); border: 1px solid var(--b-rule);
  color: inherit; text-decoration: none;
}
.cat .app__icon { grid-row: 1 / 3; }
.cat__name, .cat__n { min-width: 0; overflow-wrap: anywhere; }
.cat__name { font-weight: 700; }
.cat__n { color: var(--b-graphite); font-size: 0.9rem; }
.cat:hover { border-color: var(--b-ink); }
.cat:hover .cat__name { color: var(--b-signal); }
.cat:focus-visible { outline: 3px solid var(--b-signal); outline-offset: 2px; }

.tools__sub a { font-weight: 600; white-space: nowrap; }

@media (prefers-reduced-motion: no-preference) {
  .app.is-entering { animation: app-in 220ms var(--b-ease) both; }
  @keyframes app-in { from { opacity: 0; transform: translateY(4px); } }
}

/* Wide screens have room for every category: wrap instead of scrolling. */
@media (min-width: 48rem) {
  .chips { flex-wrap: wrap; overflow: visible; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
  .chips::after { display: none; }
  .chip:focus-visible { outline-offset: 3px; }
}
