/**
 * Aimstyle – Visibility Grid widget.
 *
 * Original HTML-widget design. Elementor Style controls override the
 * --swm-* custom properties; the var() fallbacks keep the original values.
 */

.swm-news-grid {
  --swm-text: #04293D;
  --swm-line: rgba(4, 41, 61, 0.28);
  --swm-green: rgba(0, 112, 72, 0.82);
  --swm-bg: #f7f7f7;

  width: 100%;
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 0;
  row-gap: var(--swm-row-gap, 30px);
  color: var(--swm-text);
}

/* Vertical dividing line */
.swm-news-grid::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background-color: var(--swm-line);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 2;
}

.swm-news-card {
  position: relative;
  display: block;
  color: var(--swm-text) !important;
  padding-bottom: 28px;
  cursor: default;
}

.swm-news-card:nth-child(odd) {
  padding-right: var(--swm-gutter, 25px);
}

.swm-news-card:nth-child(even) {
  padding-left: var(--swm-gutter, 25px);
}

/* Horizontal dividing lines */
.swm-news-card:nth-child(1)::after,
.swm-news-card:nth-child(2)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background-color: var(--swm-line);
  z-index: 1;
}

/* Circle at line intersection */
.swm-news-card:nth-child(1)::before {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -28px;
  width: 56px;
  height: 56px;
  background-color: var(--swm-bg);
  border-radius: 50%;
  z-index: 5;
  pointer-events: none;
}

/* Image container */
.swm-news-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  margin-bottom: 18px;
  position: relative;
  background: var(--swm-text);
  isolation: isolate;
}

.swm-news-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition:
    transform 0.45s ease,
    opacity 0.45s ease;
}

/* Green hover overlay */
.swm-news-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: var(--swm-green);
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 1;
  pointer-events: none;
}

/* Official SWM Logo */
.swm-hover-icon {
  position: absolute;
  top: 50%;
  left: 50%;

  width: 150px;
  max-width: 45%;
  height: 150px;
  max-height: 75%;

  background-image: url('https://swm.aimstyle.me/wp-content/uploads/2026/06/white-logo.svg');
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;

  opacity: 0;
  z-index: 3;
  pointer-events: none;

  transform: translate(-50%, -45%) scale(0.9);

  transition:
    opacity 0.4s ease,
    transform 0.45s ease;
}

/* Hover effects */
.swm-news-card:hover .swm-news-thumb::before {
  opacity: 1;
}

.swm-news-card:hover .swm-hover-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.swm-news-card:hover .swm-news-thumb img {
  transform: scale(1.06);
  opacity: 0.65;
}

/* Titles */
.swm-news-card h3 {
  color: var(--swm-text) !important;
  font-size: 24px;
  line-height: 1.18;
  font-weight: 700;
  margin: 0 0 10px;
  text-decoration: none !important;
}

/* Descriptions */
.swm-news-card p {
  color: var(--swm-text) !important;
  font-size: 16px;
  line-height: 1.45;
  font-weight: 400;
  margin: 0;

  /* Two lines tall; 1em follows the font size set in Elementor. */
  min-height: calc(1em * 1.45 * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Tablet */
@media (max-width: 1024px) {
  .swm-news-card:nth-child(odd) {
    padding-right: var(--swm-gutter, 20px);
  }

  .swm-news-card:nth-child(even) {
    padding-left: var(--swm-gutter, 20px);
  }

  .swm-news-card h3 {
    font-size: 20px;
  }

  .swm-news-card p {
    font-size: 15px;
  }

  .swm-hover-icon {
    width: 125px;
    height: 125px;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .swm-news-grid {
    grid-template-columns: 1fr;
    row-gap: 0;
  }

  .swm-news-grid::before {
    display: none;
  }

  .swm-news-card,
  .swm-news-card:nth-child(odd),
  .swm-news-card:nth-child(even) {
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 24px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--swm-line);
  }

  .swm-news-card:nth-child(1)::before,
  .swm-news-card:nth-child(1)::after,
  .swm-news-card:nth-child(2)::after {
    display: none;
  }

  .swm-news-card:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
  }

  .swm-news-card h3 {
    font-size: 20px;
  }

  .swm-news-card p {
    font-size: 15px;
    min-height: auto;
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
  }

  .swm-hover-icon {
    width: 110px;
    height: 110px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .swm-news-thumb img,
  .swm-news-thumb::before,
  .swm-hover-icon {
    transition: none;
  }
}
