/* Workflow Examples gallery, rendered by extensions/rapids_examples.py.
   Colours come from the theme's variables so light and dark mode both work. */

.eg {
  --eg-radius: 0.375rem;
  margin-top: 1.5rem;
}

/* Search */
.eg-search {
  position: relative;
}

/* Font Awesome swaps the <i> for an <svg> */
.eg-search i,
.eg-search svg {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  color: var(--pst-color-text-muted);
  pointer-events: none;
}

.eg-search input {
  width: 100%;
  padding: 0.8rem 1rem 0.8rem 2.75rem;
  font-size: 1.05rem;
  color: var(--pst-color-text-base);
  background: var(--pst-color-background);
  border: 1px solid var(--pst-color-border);
  border-radius: var(--eg-radius);
}

/* Autocomplete suggestions under the search box */
.eg-suggestions {
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.3rem);
  right: 0;
  left: 0;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: var(--pst-color-background);
  border: 1px solid var(--pst-color-border);
  border-radius: var(--eg-radius);
  box-shadow: 0 0.5rem 1.25rem var(--pst-color-shadow);
}

.eg-suggestions[hidden] {
  display: none;
}

.eg-suggestion {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.4rem 0.6rem;
  border-radius: 0.25rem;
  cursor: pointer;
}

.eg-suggestion:hover,
.eg-suggestion[aria-selected="true"] {
  background: var(--pst-color-surface);
}

.eg-suggestion-kind {
  flex: 0 0 5.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pst-color-text-muted);
}

.eg-search input:focus {
  outline: 2px solid var(--pst-color-accent);
  outline-offset: -1px;
}

/* Platform buttons and the services row under them */
.eg-platforms,
.eg-services {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.eg-services {
  margin-top: 0.6rem;
}

.eg-services[hidden] {
  display: none;
}

.eg-platform {
  padding: 0.35rem 0.95rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--pst-color-text-base);
  background: transparent;
  border: 1px solid var(--pst-color-border);
  border-radius: 999px;
  cursor: pointer;
}

.eg-services .eg-platform {
  padding: 0.2rem 0.75rem;
  font-size: 0.82rem;
}

.eg-platform:hover:not(:disabled) {
  border-color: var(--pst-color-accent);
}

.eg-platform[aria-pressed="true"] {
  color: var(--pst-color-background);
  background: var(--pst-color-primary);
  border-color: var(--pst-color-primary);
}

.eg-platform:disabled {
  opacity: 0.4;
  cursor: default;
}

.eg-more::after {
  content: " ▾";
}

/* Filter dropdowns */
.eg-toolbar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--pst-color-border);
}

.eg-facets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.eg-facet {
  position: relative;
}

.eg-facet summary {
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
  list-style: none;
  border: 1px solid var(--pst-color-border);
  border-radius: var(--eg-radius);
  cursor: pointer;
  user-select: none;
}

.eg-facet summary::-webkit-details-marker {
  display: none;
}

.eg-facet summary::after {
  content: " ▾";
  color: var(--pst-color-text-muted);
}

.eg-facet[open] summary,
.eg-facet summary:hover {
  border-color: var(--pst-color-accent);
}

.eg-selected {
  color: var(--pst-color-primary);
  font-weight: 600;
}

.eg-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.3rem);
  left: 0;
  min-width: 15rem;
  max-height: 24rem;
  padding: 0.4rem;
  overflow-y: auto;
  background: var(--pst-color-background);
  border: 1px solid var(--pst-color-border);
  border-radius: var(--eg-radius);
  box-shadow: 0 0.5rem 1.25rem var(--pst-color-shadow);
}

.eg-menu-heading {
  margin: 0.5rem 0.5rem 0.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pst-color-text-muted);
}

.eg-option {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0;
  padding: 0.3rem 0.5rem;
  font-size: 0.9rem;
  border-radius: 0.25rem;
  cursor: pointer;
}

.eg-option:hover {
  background: var(--pst-color-surface);
}

.eg-option input {
  margin: 0;
  accent-color: var(--pst-color-primary);
}

.eg-option--group {
  font-weight: 600;
}

.eg-option--child {
  padding-left: 1.75rem;
}

.eg-n {
  margin-left: auto;
  padding-left: 1rem;
  font-variant-numeric: tabular-nums;
  color: var(--pst-color-text-muted);
}

.eg-option:has(input:disabled) {
  opacity: 0.45;
  cursor: default;
}

.eg-count {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--pst-color-primary);
}

/* Applied filters */
.eg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.9rem;
}

.eg-chips[hidden] {
  display: none;
}

.eg-chip {
  padding: 0.2rem 0.65rem;
  font: inherit;
  font-size: 0.8rem;
  color: var(--pst-color-text-base);
  background: var(--pst-color-surface);
  border: 1px solid var(--pst-color-border);
  border-radius: 999px;
  cursor: pointer;
}

.eg-chip::after {
  content: "×";
  margin-left: 0.45rem;
  color: var(--pst-color-text-muted);
}

.eg-chip:hover {
  border-color: var(--pst-color-accent);
}

.eg-clear {
  padding: 0;
  font: inherit;
  font-size: 0.85rem;
  color: var(--pst-color-link);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}

/* Cards, also used by the examples section on platform pages */
.eg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.eg-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.25rem;
  background: var(--pst-color-background);
  border: 1px solid var(--pst-color-border);
  border-radius: var(--eg-radius);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.eg-card[hidden] {
  display: none;
}

/* On hover a green border and top edge, drawn as a shadow so the card doesn't move */
.eg-card:hover,
.eg-card:focus-within {
  border-color: var(--pst-color-accent);
  box-shadow:
    inset 0 3px 0 var(--pst-color-accent),
    0 0.25rem 0.9rem var(--pst-color-shadow);
}

.eg-card .eg-card-title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
}

.eg-card-title a {
  color: var(--pst-color-heading);
  text-decoration: none;
}

/* The title link covers the whole card */
.eg-card-title a::after {
  position: absolute;
  inset: 0;
  content: "";
}

.eg-card-desc {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  line-height: 1.5;
}

.eg-card-meta {
  margin: auto 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--pst-color-primary);
}

/* Separates cards about the search from ones that only mention it */
.eg-divider {
  grid-column: 1 / -1;
  margin: 0.25rem 0 0;
  padding-top: 0.9rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pst-color-text-muted);
  border-top: 1px solid var(--pst-color-border);
}

.eg-divider[hidden] {
  display: none;
}

.eg-see-all {
  margin-top: 0.9rem;
}

.eg-empty {
  margin-top: 1.5rem;
  color: var(--pst-color-text-muted);
}

.eg-empty[hidden] {
  display: none;
}

/* "About this example" in the right sidebar of example pages */
.example-about {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.9rem;
  margin: 0.5rem 0 1.25rem;
  font-size: 0.85rem;
}

.example-about dt {
  font-weight: 400;
  color: var(--pst-color-text-muted);
}

.example-about dd {
  margin: 0;
}

.example-about a {
  text-decoration: none;
}

.example-about a:hover {
  text-decoration: underline;
}

@media (max-width: 576px) {
  /* Dropdowns open full width under the toolbar instead of off screen */
  .eg-facet {
    position: static;
  }

  .eg-menu {
    right: 0;
  }
}
