/* Tool listing card (article_category_page.html / article_index_page.html) */
/* Tools carry little content (image, title, maybe a maker), so the card leans on a
   two-color glow + accent rule to read as "featured" among plain category/article cards. */

.tool-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 0 1 18rem;
  /* a block-level element's own width already fills its parent by
  default, but height doesn't -- height:100% only takes effect once its
  parent (the wrapping .body-tool-card div in article_body_blocks.html)
  actually has an explicit height of its own (see "Height" in the block-
  style panel); percentage height against an auto-height parent just
  resolves back to auto, so this is a no-op until then. Relies on
  box-sizing:border-box from shared/card_base.css so 100% includes this
  element's own border (card_base.css's overflow:hidden also clips content
  taller than an explicit height, for the unrelated ::before gradient bar
  reason noted below). */
  height: 100%;
  border: 2px solid var(--color-border);
  border-radius: 14px;
  box-shadow:
    0 2px 8px var(--color-shadow),
    0 0 0 0 transparent;
  text-decoration: none;
  color: var(--color-text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  background-color: var(--color-card-bg);
}

.tool-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--color-cta), var(--color-secondary), var(--color-accent));
}

.tool-card:hover,
.tool-card:focus-visible {
  transform: translateY(-3px);
  box-shadow:
    0 6px 18px var(--color-shadow),
    0 0 22px color-mix(in srgb, var(--color-cta) 30%, transparent);
}

.tool-card-image {
  width: 100%;
  /* was a fixed 9rem -- didn't scale with the card's own width at all, so
  a narrow editor-chosen width_rem (or the new forced 100% mobile width
  below) distorted/over-cropped it independent of anything the box's
  actual proportions called for. aspect-ratio keeps it proportioned the
  same way every other card's own image already is (e.g. .articlecard
  img's 8/5, article_card.css). */
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.tool-card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 1rem 1.25rem 1.25rem;
}

.tool-card-body h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: bold;
  /* a long single unbroken tool name (no spaces to wrap at otherwise)
  would overflow the card and get raw-clipped by its own overflow:hidden
  above. */
  overflow-wrap: break-word;
}

/* This tool's own direct parent category (tool.get_parent.title) -- mainly
useful once CategoryPage.show_nested_tools (article_models.py) pulls tools
from several different subcategories into one flat grid, where it's
otherwise not obvious which one a given card actually lives in. */
.tool-card-category {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  opacity: 0.8;
}

.tool-card-maker {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.tool-card-link-hint {
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--color-secondary);
}

/* a tool_card block's own width is a free-form rem number (editor picks
it via width_rem) -- carried in as a --card-width custom property
(article_body_blocks.html/article_column_content.html) rather than a
literal inline width, so the 480px override below can win over it at
normal specificity instead of needing !important to beat an inline style.
.tool-card's own "flex: 0 1 18rem" only means anything as a flex *item*
(inside .tool-grid), so standalone it needs its own explicit width
instead, same pattern as article_card.css's own .body-article-card. */
.body-tool-card {
  width: var(--card-width);
  max-width: 100%;
}

.body-tool-card--fixed-height {
  height: var(--card-height);
  overflow: hidden;
}

@media (max-width: 480px) {
  .body-tool-card,
  .body-tool-card--fixed-height {
    width: 100%;
    height: auto;
    overflow: visible;
  }

  /* Compact row on phone regardless of context (standalone in an article
  body, or inside .tool-grid's own listing pages) -- image beside title/
  maker instead of stacked above, so the card doesn't need a full image's
  worth of extra height just to show a small amount of text. */
  .tool-card {
    flex-direction: row;
    align-items: center;
  }

  .tool-card-image {
    width: 4rem;
    height: 4rem;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
  }

  .tool-card-body {
    padding: 0.5rem 0.75rem;
    gap: 0.15rem;
  }

  .tool-card-link-hint {
    display: none;
  }
}
