/* The module catalogue (/modules/ and /modules/<slug>), generated by
   tools/modules.js. Loaded after colonizer.css and docs.css and built only
   from their tokens, plus four category tints of its own. These pages follow
   the system theme: dark by default like the rest of the site, light when the
   visitor's system asks for it. */

:root {
  --m-yellow: #f2d58a;
  --m-purple: #c3a6ff;
  --m-red: #ff8f8f;
  --m-teal: #7fd8cf;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f7f4;
    --panel: #ffffff;
    --panel-2: #f1f1ed;
    --well: #ecece7;
    --chip: #efefea;
    --hull: #ffffff;
    --ink: #15171c;
    --muted: #434a58;
    --dim: #5f6676;
    --accent: #b04a00;
    --accent-hi: #8f3c00;
    --blue: #1f4fbf;
    --green: #236b35;
    --line: rgba(0, 0, 0, .1);
    --line-2: rgba(0, 0, 0, .12);
    --line-3: rgba(0, 0, 0, .18);
    --m-yellow: #7a5a00;
    --m-purple: #6a3fc0;
    --m-red: #b42323;
    --m-teal: #0f6b62;
    color-scheme: light;
  }
}

/* The catalogue wants the whole row, not the docs' reading measure. */
.doc.store { max-width: none; }
.store .doc-lede { max-width: 70ch; }

.sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------ the icon tile */

.mi {
  --tint: var(--dim);
  flex: none; width: 52px; height: 52px; border-radius: 14px;
  display: inline-grid; place-items: center;
  font-family: var(--mono); font-size: 18px; font-weight: 500; letter-spacing: -.02em;
  color: var(--tint);
  background: color-mix(in srgb, var(--tint) 13%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--tint) 30%, transparent);
}
.mi--lg { width: 88px; height: 88px; border-radius: 22px; font-size: 30px; }
.mi--settlers { --tint: var(--accent); }
.mi--providers { --tint: var(--blue); }
.mi--skillsets { --tint: var(--green); }
.mi--token-savings { --tint: var(--m-yellow); }
.mi--loops { --tint: var(--m-purple); }
.mi--security { --tint: var(--m-red); }
.mi--add-ons { --tint: var(--m-teal); }
.mi--sources { --tint: var(--ink); }

/* ------------------------------------------------------- badges and chips */

.badge, .cchip {
  display: inline-flex; align-items: center; white-space: nowrap;
  font-family: var(--mono); font-size: 11px; line-height: 1; padding: 4px 8px; border-radius: 999px;
}
.cchip { color: var(--muted); background: var(--chip); border: 1px solid var(--line); }
.badge { border: 1px solid currentColor; }
.badge--builtin { color: var(--green); }
.badge--optional { color: var(--blue); }
.badge--tests { color: var(--accent-hi); }
.badge--planned { color: var(--dim); border-style: dashed; }

/* ------------------------------------------------------- search and tabs */

.store .search { margin-top: 28px; }
.search__box {
  display: flex; align-items: center; gap: 10px; max-width: 520px;
  padding: 0 14px; border: 1px solid var(--line-3); border-radius: 12px; background: var(--panel);
  color: var(--dim);
}
.search__box:focus-within { border-color: var(--accent); }
.search__box input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 16px; padding: 12px 0;
}
.search__box input::placeholder { color: var(--dim); }

/* The tabs scroll sideways inside their own row on a narrow screen; the page
   itself never does. */
.store .tabs { margin-top: 16px; min-width: 0; }
.store .tabs__row {
  list-style: none; padding: 2px 2px 8px; margin: 0;
  display: flex; flex-wrap: nowrap; gap: 8px;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin;
}
.store .tabs__row li { flex: none; font-size: inherit; line-height: 1; }
.store .tabs__row li::marker { content: none; }
.store .tab {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line-3);
  font-size: 14px; color: var(--muted); text-decoration: none; background: var(--panel);
}
.store .tab:hover { color: var(--ink); border-color: var(--accent); }
.store .tab[aria-current="true"] { color: var(--bg); background: var(--ink); border-color: var(--ink); }
.tab__n { font-family: var(--mono); font-size: 11px; opacity: .7; }

/* ------------------------------------------------------------------ cards */

.store .apps {
  list-style: none; padding: 0; margin-top: 16px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 12px;
}
.store .apps li { font-size: inherit; line-height: inherit; }
.store .apps li::marker { content: none; }
.app { min-width: 0; }
.app__link {
  height: 100%; display: flex; gap: 14px; align-items: flex-start;
  padding: 16px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel);
  color: inherit; text-decoration: none !important;
  transition: border-color .15s var(--ease), background .15s var(--ease), transform .15s var(--ease);
}
.app__link:hover { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--panel-2); color: inherit; }
@media (prefers-reduced-motion: no-preference) { .app__link:hover { transform: translateY(-1px); } }
.app__body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.app__name { font-size: 16px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.app__tag { font-size: 14px; line-height: 1.5; color: var(--muted); text-wrap: pretty; }
.app__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.app__default { font-family: var(--mono); font-size: 11px; color: var(--green); }
.app__default::before { content: "✓ "; }

/* -------------------------------------------------------------- featured */

.store .featured { margin-top: 30px; }
.store .featured__h {
  margin-top: 0; padding-top: 0; border-top: 0;
  font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--dim);
}
.store .apps--featured { grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); margin-top: 12px; }
.apps--featured .app__link {
  flex-direction: column; gap: 12px; padding: 20px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 7%, var(--panel)), var(--panel) 60%);
}
.apps--featured .mi { width: 60px; height: 60px; font-size: 21px; border-radius: 16px; }

/* -------------------------------------------------------------- sections */

.store .cat h2 { margin-top: 48px; }
.cat__blurb { margin-top: 8px; font-size: 15px !important; max-width: 70ch; }
.store .empty { margin-top: 32px; color: var(--muted); }
.store .legend ul { list-style: none; padding: 0; gap: 10px; }
.store .legend li::marker { content: none; }
.store .legend .badge { margin-right: 6px; }

/* ------------------------------------------------------------ detail page */

.store--detail .mhead { display: flex; gap: 22px; align-items: flex-start; margin-top: 18px; }
.store--detail .mhead__text { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.store--detail .mhead h1 { font-size: clamp(30px, 4.4vw, 42px); }
.store--detail .facts {
  margin-top: 26px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  border: 1px solid var(--line-2); border-radius: 14px; background: var(--panel); overflow: hidden;
}
.facts > div { padding: 14px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.facts dt { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.facts dd { margin: 6px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.facts__note { display: block; margin-top: 6px; color: var(--muted); font-size: 13.5px; }
.store--detail > h2, .store--detail > p, .store--detail > ul { max-width: 74ch; }

@media (max-width: 560px) {
  .store--detail .mhead { flex-direction: column; gap: 14px; }
  .mi--lg { width: 72px; height: 72px; border-radius: 18px; font-size: 25px; }
  .app__link { padding: 14px; gap: 12px; }
  .mi { width: 46px; height: 46px; border-radius: 12px; font-size: 16px; }
}

/* On a phone the shared top menu can be a few pixels wider than the screen;
   here it scrolls inside its own row instead of pushing the page sideways.
   The features panel is positioned against the bar, so it is not clipped. */
@media (max-width: 1023px) {
  .docs-body .nav { overflow-x: auto; scrollbar-width: none; }
  .docs-body .nav::-webkit-scrollbar { display: none; }
}
