/* MatchAll Mirrors — service layer on the shared Swiss base.
   The base (apps/shared/styles: tokens, swiss-tokens, swiss) is inlined by Astro; this file only
   adds what the catalog needs. Every selector carries .ma-swiss so it wins regardless of the order
   in which the inlined base and this stylesheet load. Identity is --matchall-c-mirrors through
   data-service="mirrors" (swatch and index marks only). The .card / .card-top / .icon / .license /
   .go / .loading / .empty class names are emitted by the inline catalog script — keep them. */

.ma-swiss .nav-shell > [data-matchall-palette-trigger] { flex: none; margin-left: 8px; }

/* ---------- Platform signals: three ruled columns ---------- */
.ma-swiss .mx-signal {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: var(--matchall-gutter);
  margin: 0;
  border-top: 1px solid var(--matchall-text);
}
.ma-swiss .mx-signal > div {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 18px 0 22px;
  border-bottom: 1px solid var(--matchall-rule);
}
.ma-swiss .mx-signal dt {
  color: var(--matchall-muted);
  font: 500 var(--matchall-fs-label)/1.4 var(--matchall-font-mono);
  letter-spacing: .04em;
}
.ma-swiss .mx-signal dd {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}
@media (min-width: 760px) {
  .ma-swiss .mx-signal { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ma-swiss .mx-signal > div { padding-right: var(--matchall-gutter); border-bottom: 0; }
}

/* ---------- Catalog head + search ---------- */
.ma-swiss .mx-catalog { padding-top: var(--matchall-section); scroll-margin-top: var(--matchall-header-h); }
.ma-swiss .mx-catalog:focus { outline: none; }
.ma-swiss .mx-search { align-self: end; width: 100%; max-width: 28rem; }
.ma-swiss .mx-search .ma-field__label { color: var(--matchall-text-2); }
@media (min-width: 960px) {
  .ma-swiss .mx-catalog__head > :is(h2, .ma-h2) { grid-column: 4 / span 5; }
  .ma-swiss .mx-catalog__head > .mx-search { grid-column: 9 / span 4; max-width: none; }
}

/* ---------- Project cells (rendered by the catalog script) ---------- */
.ma-swiss .mx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  border-top: 1px solid var(--matchall-rule);
  border-left: 1px solid var(--matchall-rule);
}
.ma-swiss .mx-grid > * {
  min-width: 0;
  margin: 0;
  border-right: 1px solid var(--matchall-rule);
  border-bottom: 1px solid var(--matchall-rule);
}
.ma-swiss .mx-grid .card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 15rem;
  padding: clamp(20px, 2.4vw, 32px);
  background: var(--matchall-canvas);
  color: inherit;
  text-decoration: none;
  transition: background-color var(--matchall-ease);
}
.ma-swiss .mx-grid .card:hover { background: var(--matchall-canvas-2); }
.ma-swiss .mx-grid .card:focus-visible { outline-offset: -3px; }
.ma-swiss .card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ma-swiss .card-top .icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--matchall-text);
  font: 700 1rem/1 var(--matchall-font-mono);
}
.ma-swiss .card-top .license {
  min-width: 0;
  color: var(--matchall-muted);
  font: 500 var(--matchall-fs-label)/1.4 var(--matchall-font-mono);
  text-align: right;
  overflow-wrap: anywhere;
}
.ma-swiss .mx-grid .card h3 {
  margin-top: auto;
  padding-top: 28px;
  font-size: 1.375rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.ma-swiss .mx-grid .card p { color: var(--matchall-text-2); font-size: .9375rem; overflow-wrap: anywhere; }
.ma-swiss .mx-grid .card .go {
  margin-top: 6px;
  font-size: var(--matchall-fs-small);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--matchall-rule-strong);
  text-underline-offset: .2em;
}
.ma-swiss .mx-grid .card:hover .go { text-decoration-color: currentColor; }

/* Loading / empty / error follow the shared ma-state shapes: ring, dashed, filled. */
.ma-swiss .mx-grid :is(.loading, .empty) {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 32px clamp(20px, 2.4vw, 32px);
  background: var(--matchall-canvas);
  color: var(--matchall-text-2);
}
.ma-swiss .mx-grid :is(.loading, .empty)::before { content: ""; width: 10px; height: 10px; flex: none; border: 2px solid currentColor; }
.ma-swiss .mx-grid .loading::before { border-radius: 50%; border-right-color: transparent; animation: ma-spin 900ms linear infinite; }
.ma-swiss .mx-grid .empty::before { border-style: dashed; }
.ma-swiss .mx-grid .empty.error { color: var(--matchall-error); }
.ma-swiss .mx-grid .empty.error::before { border-style: solid; background: currentColor; }
.ma-swiss .mx-catalog noscript .ma-note { margin-bottom: 24px; }

/* ---------- Footer ---------- */
.ma-swiss .mx-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 16px;
  border-top: 1px solid var(--matchall-text);
  color: var(--matchall-muted);
}
.ma-swiss .mx-footer div { display: flex; flex-wrap: wrap; gap: 0 20px; }
.ma-swiss .mx-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--matchall-text);
  text-decoration: underline;
  text-decoration-color: var(--matchall-rule-strong);
  text-underline-offset: .2em;
}
.ma-swiss .mx-footer a:hover { text-decoration-color: currentColor; }

@media (max-width: 759px) {
  .ma-swiss .nav-shell > [data-matchall-palette-trigger] { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .ma-swiss .mx-grid .card { transition: none; }
  .ma-swiss .mx-grid .loading::before { animation: none; }
}
@media (forced-colors: active) {
  .ma-swiss .mx-grid, .ma-swiss .mx-grid > *, .ma-swiss .mx-signal, .ma-swiss .card-top .icon { border-color: CanvasText; }
}
