/* Plugins catalog (docs/plugins/catalog.md): a grid of cards with status badges.
   The search field reuses the .algorithms-filters styles of algorithms.css. */

:root {
  --plugin-official-color: #2e7d32;
  --plugin-community-color: #3949ab;
  --plugin-released-color: #00796b;
  --plugin-unreleased-color: #a65c00;
  --plugin-unmaintained-color: #c62828;
  /* Opaque, unlike --md-default-fg-color in the slate scheme, which lets the
     text behind the tooltip show through. */
  --plugin-tooltip-bg-color: #212121;
  --plugin-tooltip-fg-color: #fff;
  /* The bullhorn icon of Material Design Icons. */
  --plugin-announcement-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h1v4a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-4h3l5 4V4l-5 4m9.5 4c0 1.71-.96 3.26-2.5 4V8c1.53.75 2.5 2.3 2.5 4"/></svg>');
}

[data-md-color-scheme="slate"] {
  --plugin-official-color: #81c784;
  --plugin-community-color: #9fa8da;
  --plugin-released-color: #80cbc4;
  --plugin-unreleased-color: #ffb74d;
  --plugin-unmaintained-color: #ef9a9a;
  --plugin-tooltip-bg-color: #e2e4e9;
  --plugin-tooltip-fg-color: #1e2129;
}

.plugin-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The announcement inviting to list a community plugin. */

.md-typeset .admonition.plugin-announcement {
  border-color: var(--plugin-community-color);
}

.md-typeset .plugin-announcement > .admonition-title {
  background-color: color-mix(in srgb, var(--plugin-community-color) 10%, transparent);
}

.md-typeset .plugin-announcement > .admonition-title::before {
  background-color: var(--plugin-community-color);
  -webkit-mask-image: var(--plugin-announcement-icon);
  mask-image: var(--plugin-announcement-icon);
}

/* The badges, on the cards and in the filters. */

.md-typeset .plugin-badge {
  position: relative;
  display: inline-block;
  padding: 0 0.5rem;
  border: 1px solid currentColor;
  border-radius: 1rem;
  background-color: color-mix(in srgb, currentColor 10%, transparent);
  font-size: 0.6rem;
  line-height: 1.5;
  white-space: nowrap;
}

.md-typeset .plugin-badge--official,
.md-typeset .algorithms-filters .plugin-badge--official {
  color: var(--plugin-official-color);
}

.md-typeset .plugin-badge--community,
.md-typeset .algorithms-filters .plugin-badge--community {
  color: var(--plugin-community-color);
}

.md-typeset .plugin-badge--released,
.md-typeset .algorithms-filters .plugin-badge--released {
  color: var(--plugin-released-color);
}

.md-typeset .plugin-badge--unreleased,
.md-typeset .algorithms-filters .plugin-badge--unreleased {
  color: var(--plugin-unreleased-color);
}

.md-typeset .plugin-badge--unmaintained,
.md-typeset .algorithms-filters .plugin-badge--unmaintained {
  color: var(--plugin-unmaintained-color);
}

/* The description of a badge, shown above it on hover and on keyboard focus. */
.md-typeset .plugin-badge[data-description]::after {
  content: attr(data-description);
  position: absolute;
  bottom: calc(100% + 0.4rem);
  left: 0;
  z-index: 2;
  width: max-content;
  max-width: 14rem;
  padding: 0.3rem 0.5rem;
  border-radius: 0.2rem;
  background-color: var(--plugin-tooltip-bg-color);
  box-shadow: var(--md-shadow-z2);
  color: var(--plugin-tooltip-fg-color);
  font-size: 0.6rem;
  font-weight: normal;
  line-height: 1.4;
  white-space: normal;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.md-typeset .plugin-badge[data-description]:hover::after,
.md-typeset .plugin-badge[data-description]:focus-visible::after {
  opacity: 1;
  transition-delay: 0.2s;
}

/* The filters: the badges on one line, the origins apart from the statuses. */

.md-typeset .plugin-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.md-typeset .plugin-filters-separator {
  align-self: stretch;
  width: 1px;
  margin: 0 0.3rem;
  background-color: var(--md-default-fg-color--lightest);
}

.md-typeset .plugin-filters-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
}

.md-typeset .algorithms-filters .plugin-toggle {
  padding: 0 0.5rem;
  border: 1px solid currentColor;
  border-radius: 1rem;
  background-color: color-mix(in srgb, currentColor 10%, transparent);
  font-size: 0.6rem;
  line-height: 1.5;
  cursor: pointer;
}

.md-typeset .algorithms-filters .plugin-toggle:hover {
  background-color: color-mix(in srgb, currentColor 20%, transparent);
}

.md-typeset .algorithms-filters .plugin-toggle[aria-pressed="false"] {
  border-style: dashed;
  background-color: transparent;
  opacity: 0.5;
}

.md-typeset .algorithms-filters .plugin-toggle[aria-pressed="false"]:hover {
  opacity: 0.8;
}

.md-typeset .algorithms-filters .plugin-toggle:focus-visible {
  outline: 2px solid var(--md-accent-fg-color);
  outline-offset: 2px;
}

/* As high as the badges, so that showing it does not move them. */
.md-typeset .algorithms-filters #plugins-reset {
  padding: 0 0.5rem;
  border-radius: 1rem;
  font-size: 0.6rem;
  line-height: 1.5;
}

.md-typeset .algorithms-filters #plugins-reset[hidden] {
  display: none;
}

/* The cards: the link of the name stretches over the whole card, as the clickable
   cards of the GEMSEO documentation, so clicking anywhere follows it. */

.md-typeset .plugin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.8rem;
  margin: 1rem 0;
}

.md-typeset .plugin-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0.8rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.2rem;
  font-size: 0.7rem;
  text-align: left;
  transition:
    border-color 0.25s,
    box-shadow 0.25s;
}

.md-typeset .plugin-card:hover,
.md-typeset .plugin-card:focus-within {
  /* A visible border, as the shadow alone hardly shows in the slate scheme. */
  border-color: var(--md-default-fg-color--lighter);
  box-shadow: var(--md-shadow-z2);
}

.md-typeset .plugin-card:focus-within {
  outline: 2px solid var(--md-accent-fg-color);
  outline-offset: 2px;
}

.md-typeset .plugin-card h3 {
  margin: 0;
  font-size: 0.85rem;
}

/* ::before, as ::after holds the glyph of the external links (style.css). */
.md-typeset .plugin-card .plugin-link::before {
  content: "";
  position: absolute;
  inset: 0;
}

.md-typeset .plugin-card .plugin-link:focus-visible {
  outline: none;
}

.md-typeset .plugin-card:hover .plugin-link {
  color: var(--md-accent-fg-color);
}

/* Above the stretched link: the permalink stays clickable. */
.md-typeset .plugin-card .headerlink {
  position: relative;
  z-index: 1;
}

/* Under the stretched link, so that clicking a badge follows it. */
.md-typeset .plugin-card .plugin-badge {
  position: static;
}

.md-typeset .plugin-card p {
  margin: 0.4rem 0 0;
}

.md-typeset .plugin-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.md-typeset .plugin-release {
  color: var(--md-default-fg-color--light);
  font-size: 0.65rem;
}

.md-typeset .plugin-keywords .md-tag {
  font-size: 0.55rem;
}

.md-typeset .plugin-card.plugin-hidden {
  display: none;
}

.md-typeset .plugin-empty {
  color: var(--md-default-fg-color--light);
  text-align: center;
}
