/**
 * VIOTIA247 reusable article cards (depends on global.css).
 */

.v247-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.v247-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  border-color: rgba(0, 119, 255, 0.35);
}

.v247-card__media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--color-gray-100);
  overflow: hidden;
}

.v247-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 240ms ease;
}

.v247-card:hover .v247-card__media img {
  transform: scale(1.035);
}

.v247-card__content {
  padding: 14px 16px 16px;
}

.v247-card__content .btn {
  margin-top: 12px;
}

.v247-card__title {
  margin: 8px 0 8px;
  font-size: clamp(1.05rem, 1.25vw, 1.375rem);
  line-height: 1.18;
  font-weight: 800;
  color: var(--color-navy-900);
}

.v247-card__title a {
  color: inherit;
  text-decoration: none;
}

.v247-card__title a:hover {
  color: var(--color-blue-600);
}

.v247-card__excerpt {
  margin: 0 0 12px;
  color: var(--color-gray-700);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.v247-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 4px;
  background: var(--color-blue-600);
  color: var(--color-white);
  font-size: 0.6875rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.v247-label:hover {
  color: var(--color-white);
  background: var(--color-blue-500);
}

.v247-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  line-height: 1.3;
}

.v247-meta::before {
  content: "";
  width: 13px;
  height: 13px;
  display: inline-block;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 2v2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-2V2h-2v2H9V2H7Zm12 8H5v10h14V10Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.v247-card__play {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.92);
  color: var(--color-blue-600);
  font-size: 20px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
}

/* Featured */
.v247-card--featured {
  display: grid;
  min-height: 360px;
}

.v247-card--featured .v247-card__media,
.v247-card--featured .v247-card__content {
  grid-area: 1 / 1;
}

.v247-card--featured .v247-card__media {
  aspect-ratio: auto;
  height: 100%;
}

.v247-card--featured .v247-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(2, 11, 34, 0.88), rgba(2, 11, 34, 0.42) 52%, rgba(2, 11, 34, 0.08));
  pointer-events: none;
}

.v247-card--featured .v247-card__content {
  position: relative;
  z-index: 2;
  align-self: end;
  max-width: 560px;
  padding: clamp(24px, 4vw, 44px);
}

.v247-card--featured .v247-card__title {
  color: var(--color-white);
  font-size: clamp(1.75rem, 3vw, 2.875rem);
}

.v247-card--featured .v247-card__title a:hover {
  color: var(--color-white);
}

.v247-card--featured .v247-card__excerpt,
.v247-card--featured .v247-meta {
  color: rgba(255, 255, 255, 0.88);
}

/* Overlay */
.v247-card--overlay {
  display: grid;
  min-height: 200px;
  height: 100%;
}

.v247-card--overlay .v247-card__media,
.v247-card--overlay .v247-card__content {
  grid-area: 1 / 1;
}

.v247-card--overlay .v247-card__media {
  aspect-ratio: 16 / 10;
  height: 100%;
}

.v247-card--overlay .v247-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(2, 11, 34, 0.08), rgba(2, 11, 34, 0.82));
  pointer-events: none;
}

.v247-card--overlay .v247-card__content {
  position: relative;
  z-index: 2;
  align-self: end;
  padding: 16px 18px;
}

.v247-card--overlay .v247-card__title {
  margin: 6px 0 6px;
  color: var(--color-white);
  font-size: clamp(1rem, 1.4vw, 1.2rem);
}

.v247-card--overlay .v247-card__title a:hover {
  color: var(--color-blue-400);
}

.v247-card--overlay .v247-meta {
  color: rgba(255, 255, 255, 0.88);
}

/* Horizontal */
.v247-card--horizontal {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  align-items: stretch;
}

.v247-card--horizontal .v247-card__media {
  aspect-ratio: auto;
  height: 100%;
  min-height: 160px;
}

/* Compact */
.v247-card--compact {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.v247-card--compact .v247-card__media {
  aspect-ratio: 4 / 3;
  border-radius: 7px;
}

.v247-card--compact .v247-card__content {
  padding: 0;
}

.v247-card--compact .v247-card__title {
  font-size: 1rem;
  line-height: 1.25;
}

.v247-card--compact .v247-card__excerpt {
  display: none;
}

/* Sidebar */
.v247-card--sidebar {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  background: transparent;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--color-border-soft);
}

.v247-card--sidebar:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--color-border-soft);
}

.v247-card--sidebar .v247-card__media {
  border-radius: 7px;
  aspect-ratio: 1.25 / 1;
}

.v247-card--sidebar .v247-card__content {
  padding: 0;
}

.v247-card--sidebar .v247-label,
.v247-card--sidebar .v247-card__excerpt {
  display: none;
}

.v247-card--sidebar .v247-card__title {
  margin: 0 0 7px;
  font-size: 0.875rem;
  line-height: 1.3;
}

.v247-card--sidebar .v247-meta {
  font-size: 0.75rem;
}

/* Video */
.v247-card--video .v247-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 45%, rgba(0, 14, 40, 0.72));
  pointer-events: none;
}

/* Grids for listings & demo */
.posts-grid {
  align-items: stretch;
}

.posts-grid > .v247-card {
  height: 100%;
}

.v247-grid {
  display: grid;
  gap: var(--gutter);
}

.v247-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.v247-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.v247-grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.v247-cards-demo__section {
  margin-bottom: calc(var(--section-gap) + 12px);
}

.v247-cards-demo__section > h2 {
  margin-bottom: 18px;
}

.v247-cards-demo__row {
  display: grid;
  gap: var(--gutter);
}

.v247-cards-demo__row--sidebar {
  max-width: 360px;
}

@media (max-width: 991px) {
  .v247-grid--4,
  .v247-grid--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .v247-card--horizontal,
  .v247-card--compact {
    grid-template-columns: 1fr;
  }

  .v247-card--horizontal .v247-card__media {
    aspect-ratio: 16 / 9;
    min-height: 0;
  }

  .v247-card--featured {
    min-height: 380px;
  }

  .v247-card--featured .v247-card__media::after {
    background: linear-gradient(180deg, rgba(2, 11, 34, 0.2), rgba(2, 11, 34, 0.9));
  }

  .v247-grid--2,
  .v247-grid--3,
  .v247-grid--4 {
    grid-template-columns: 1fr;
  }
}
