/* The /plugins directory. Its own stylesheet: the home page has a .plugin-list
   of its own, and nothing here should reach it. */

#plugin-directory {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 20px 90px;
}

/* ----------------------------------------------------------------- header */

/* the site-wide `header` rule dresses every header element as the masthead;
   this one is a heading inside the page, so that is undone */
.directory-header {
  position: static;
  z-index: auto;
  background: none;
  box-shadow: none;
  border: 0;
  margin-bottom: 34px;
  text-align: center;
}

#content .directory-header h1 {
  margin-bottom: 16px;
}


/* the categories, as a row of pills that wraps as it needs to */
.directory-categories {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 760px;
  margin: 0 auto 16px;
}

#content .directory-category {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid #ddd;
  border-radius: 100px;
  background: white;
  color: #444;
  font-size: 15px;
  font-variation-settings: "wght" 600, "ital" 0;
  text-decoration: none;
  transition: border-color 0.12s, background-color 0.12s, color 0.12s;
}

#content .directory-category:hover {
  border-color: royalblue;
  color: royalblue;
}

#content .directory-category[aria-current="true"] {
  border-color: royalblue;
  background: royalblue;
  color: white;
}

.directory-category-count {
  color: #999;
  font-size: 12px;
  font-variation-settings: "wght" 500, "ital" 0;
}

#content .directory-category[aria-current="true"] .directory-category-count {
  color: rgba(255, 255, 255, 0.75);
}

/* Free wears the site's green (the cart, the "Free" tags) so it reads as
   the odd one out: pale until chosen, deep once it is */
#content .directory-category.is-free {
  border-color: #b9dfc6;
  background: #eaf6ee;
  color: seagreen;
}

#content .directory-category.is-free .directory-category-count {
  color: #6fae88;
}

#content .directory-category.is-free:hover {
  border-color: seagreen;
  color: #1e6b41;
}

#content .directory-category.is-free[aria-current="true"] {
  border-color: #1e7a4a;
  background: #1e7a4a;
  color: white;
}

#content .directory-category.is-free[aria-current="true"] .directory-category-count {
  color: rgba(255, 255, 255, 0.75);
}

/* what the chosen category is about, when the admin says */
/* the line under the categories; it holds one line's height even when the
   chosen category has nothing written about it */
.directory-descriptions {
  max-width: 640px;
  min-height: 1.5em;
  margin: 18px auto 16px;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
  padding: 8px;
}

#content .directory-category-about {
  margin: 0;
  color: #666;
  font-size: 16px;
  line-height: 1.5;
  /* even lines rather than a word left alone on the last */
  text-wrap: balance;
  font-variation-settings: "wght" 400, "ital" 1;
}

#content .directory-category-about[hidden] {
  display: none;
}

#content .plugin-cards > li[hidden] {
  display: none;
}

/* the order and light/dark switches are in view-switches.css, which
   /collections shares */

/* ------------------------------------------------------------------ grid */

#content .plugin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 420px) {
  #content .plugin-cards {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

#content .plugin-card-item {
  margin: 0;
  padding: 0;
  background: none;
}

/* ------------------------------------------------------------------ card */

#content .plugin-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  background: white;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

#content .plugin-card:hover,
#content .plugin-card:focus-visible {
  border-color: var(--theme);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

/* the interface, sitting on a wash of the plugin's own colour */
.plugin-card-stage {
  position: relative;
  aspect-ratio: 5 / 4;
  background: var(--tint);
  transition: background 0.25s;
}

/* laid over the stage rather than sized by it: a percentage max-height does
   not resolve against a height that only comes from aspect-ratio, so a squarer
   interface (Vulf Compressor, Midside) would stretch its card taller than the
   others in the row */
.plugin-card-interface {
  position: absolute;
  inset: 12px;
  display: block;
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  object-fit: contain;
  transition: transform 0.3s;
}

#content .plugin-card:hover .plugin-card-interface {
  transform: scale(1.03);
}

/* dark screenshots want a dark stage */
#plugin-directory.is-dark .plugin-card-stage {
  background: linear-gradient(var(--tint), var(--tint)), #1c1c1e;
}

/* the fallback, for a plugin with no screenshot: its nameplate, as the old
   directory showed it */
.plugin-card-nameplate {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  background-color: var(--theme);
  background-size: 260px auto;
}

.plugin-card-nameplate img {
  width: 72%;
  max-width: 340px;
}

.plugin-card-stage.no-interface .plugin-card-nameplate,
.plugin-card-stage.missing .plugin-card-nameplate {
  display: flex;
}

.plugin-card-stage.missing .plugin-card-interface {
  display: none;
}

.plugin-card-sale {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 2px 10px;
  border-radius: 100px;
  background: var(--theme);
  color: white;
  font-size: 13px;
  font-variation-settings: "wght" 800, "ital" 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

/* logo, name and tagline, and the price */
.plugin-card-info {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px 18px;
  border-top: 1px solid #f0f0f0;
}

.plugin-card-logo {
  display: block;
  width: 52px;
  height: 52px;
}

.plugin-card-text {
  min-width: 0;
}

/* named with the element: #content h2:not(:first-child) would otherwise add
   60px above every name */
#content h2.plugin-card-name {
  margin: 0;
  color: var(--theme);
  font-size: 1.2em;
  line-height: 1.15;
  font-variation-settings: "wght" 780, "opsz" 24;
}

#content .plugin-card-tagline {
  margin: 3px 0 0;
  color: #666;
  font-size: 14px;
  line-height: 1.35;
}

.plugin-card-price {
  align-self: start;
  padding-top: 2px;
  color: #222;
  font-size: 17px;
  white-space: nowrap;
  font-variation-settings: "wght" 750, "ital" 0;
}

.plugin-card-price s {
  display: block;
  color: lightpink;
  font-size: 13px;
  text-align: right;
}
