/**
 * Diamond Image & Logo Showcase Component
 * Inspired by dienvinh.vn & adapted for TVD theme
 */

:root {
  --tvd-d-size: 380px;
  --tvd-d-inner: 270px;
  --tvd-d-border-1: #ba2228;
  --tvd-d-border-2: #e18f19;
  --tvd-d-bg: #ffffff;
  --tvd-d-spin-speed: 20s;
  --tvd-d-spin-speed-rev: 15s;
}

.tvd-diamond-showcase {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  user-select: none;
}

.tvd-diamond-showcase__container {
  position: relative;
  width: var(--tvd-d-size, 380px);
  height: var(--tvd-d-size, 380px);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Outer rotating border */
.tvd-diamond-showcase__border {
  position: absolute;
  top: 50%;
  left: 50%;
  border: 1.5px solid var(--tvd-d-border-1, #ba2228);
  pointer-events: none;
  z-index: 1;
  border-radius: 6px;
}

.tvd-diamond-showcase__border--lg {
  border-color: var(--tvd-d-border-1, #ba2228);
  opacity: 0.45;
  animation: tvd-diamond-spin var(--tvd-d-spin-speed, 20s) linear infinite;
}

.tvd-diamond-showcase__border--sm {
  border-color: var(--tvd-d-border-2, #e18f19);
  opacity: 0.6;
  animation: tvd-diamond-spin-rev var(--tvd-d-spin-speed-rev, 15s) linear infinite;
}

/* Inner card rotated 45 degrees */
.tvd-diamond-showcase__inner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--tvd-d-inner, 270px);
  height: var(--tvd-d-inner, 270px);
  transform: translate(-50%, -50%) rotate(45deg);
  background: var(--tvd-d-bg, #ffffff);
  overflow: hidden;
  border-radius: 12px;
  z-index: 2;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tvd-diamond-showcase--has-shadow .tvd-diamond-showcase__inner {
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.18), 0 4px 15px rgba(0, 0, 0, 0.08);
}

.tvd-diamond-showcase:hover .tvd-diamond-showcase__inner {
  transform: translate(-50%, -50%) rotate(45deg) scale(1.03);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.25);
}

/* Logo Mode: un-rotates content so logo sits upright inside the diamond */
.tvd-diamond-showcase__logo-wrap {
  width: 100%;
  height: 100%;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.tvd-diamond-showcase__logo-img {
  max-width: 85%;
  max-height: 85%;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.1));
  transition: transform 0.3s ease;
}

.tvd-diamond-showcase:hover .tvd-diamond-showcase__logo-img {
  transform: scale(1.08);
}

/* Photo Mode: covers the entire diamond area */
.tvd-diamond-showcase__photo-img {
  position: absolute;
  top: -22%;
  left: -22%;
  width: 144%;
  height: 144%;
  object-fit: cover;
  transform: rotate(-45deg);
  transition: transform 0.5s ease;
}

.tvd-diamond-showcase:hover .tvd-diamond-showcase__photo-img {
  transform: rotate(-45deg) scale(1.08);
}

/* Rotation keyframes */
@keyframes tvd-diamond-spin {
  from {
    transform: translate(-50%, -50%) rotate(45deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(405deg);
  }
}

@keyframes tvd-diamond-spin-rev {
  from {
    transform: translate(-50%, -50%) rotate(45deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(-315deg);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .tvd-diamond-showcase__container {
    width: 280px;
    height: 280px;
  }
  .tvd-diamond-showcase__inner {
    width: 200px;
    height: 200px;
  }
  .tvd-diamond-showcase__border--lg {
    width: 250px !important;
    height: 250px !important;
  }
  .tvd-diamond-showcase__border--sm {
    width: 140px !important;
    height: 140px !important;
  }
}
