/*
 * Control IO Theme Styles
 * @file: css/components/cards.css
 * @purpose: Card components (generic + category-specific)
 * @author: WojBit
 * @version: 1.0.0
 * @license: https://wojbit.au/licenses/proprietary.html
 * @notes: Uses variables from css/default.css
 */

/* ========================================================================== */
/*  Base Card                                                                */
/* ========================================================================== */

.category-card,
.wbc-card {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-2xl, 16px);
  background: var(--surface-1, #fff);
  box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,.08));
  transition: transform .2s ease, box-shadow .2s ease;
  text-decoration: none;
  color: inherit;
}

.category-card:hover,
.wbc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl, 0 16px 40px rgba(0,0,0,.12));
}

/* ========================================================================== */
/*  Media Area                                                               */
/* ========================================================================== */

/* Generic media (works when <img> is inside) */
.category-card__media {
  margin: 0;
  aspect-ratio: 16 / 11;
  background: var(--surface-2, #f3f3f3);
}

.category-card__media > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  will-change: transform;
}

/* Placeholder for when no image is set */
.category-card__placeholder {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(180deg, rgba(0,0,0,.03), rgba(0,0,0,0)),
    var(--surface-2, #f3f3f3);
}

/* ========================================================================== */
/*  Title/Footer                                                             */
/* ========================================================================== */

.category-card__title,
.wbc-card__body {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .9rem 1rem;
  background: var(--surface-1, #fff);
  color: var(--text-1, #222);
  font-weight: 600;
  line-height: 1.2;
  border-top: 1px solid var(--border-1, rgba(0,0,0,.06));
}

.category-card__count {
  color: var(--text-2, #666);
  font-weight: 500;
  font-size: .95em;
}

/* ========================================================================== */
/*  Hover Effects                                                            */
/* ========================================================================== */

.category-card:hover .category-card__media > img {
  transform: scale(1.04);
  transition: transform .25s ease;
}

.wbc-card--category:hover .wbc-card__media {
  filter: brightness(0.98);
  transform: scale(1.01);
  transition: transform .25s ease, filter .25s ease;
}

/* ========================================================================== */
/*  Front Page Variant (WBC Card)                                            */
/* ========================================================================== */

.wbc-card--category .wbc-card__media {
  aspect-ratio: 16 / 11;
  background-color: var(--surface-2, #f3f3f3);
  background-image: var(--cat-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Fallback for browsers without aspect-ratio */
@supports not (aspect-ratio: 1 / 1) {
  .category-card__media,
  .wbc-card--category .wbc-card__media {
    height: 160px;
  }
}
