/* Master Detail Container */
.master-detail-container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.master-detail-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
  align-items: stretch;
  margin: 0;
  padding: 0;
}

/* LEFT COLUMN – 2x3 Grid with centered images & curved corners */
.md-grid-left {
  flex: 1.2;
  min-width: 280px;
}

.md-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.md-post-card {
  position: relative;
  aspect-ratio: 325 / 173;
  background: #d9d9d9;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.md-post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -12px rgba(0, 0, 0, 0.2);
}
.md-post-card.active-card {
  outline: 3px solid #2d7a8c;
  outline-offset: 1px;
}

.md-card-img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  object-fit: cover;
  display: block;
}

.md-card-gradient {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.1) 0%,
    rgba(0, 0, 0, 0.65) 100%
  );
  border-radius: 16px;
  pointer-events: none;
  z-index: 1;
}

.md-card-title {
  position: absolute;
  bottom: 18px;
  left: 18px;
  font-weight: 600;
  font-size: 12px;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

/* RIGHT COLUMN – overlay buttons on image */
.md-detail-right {
  flex: 1;
  min-width: 340px;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  position: relative;
}

.md-big-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  background: transparent;
  position: relative;
}

.md-big-image-wrapper {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 400px;
  overflow: hidden;
  cursor: pointer;
  background: transparent;
}

.md-big-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.md-img-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.4) 0%,
    rgba(0, 0, 0, 0) 100%
  );
  pointer-events: none;
  z-index: 1;
  border-radius: 0 0 16px 16px;
}

/* Info panel overlaying the image – centered and aligned */
.md-info-panel {
  position: absolute;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 90%;
  display: flex;
  flex-direction: column;
  gap: 22px;
  z-index: 10;
  background: transparent;
  pointer-events: none;
  text-align: center;
  align-items: center;
}

/* Tags container – straight line, centered, with consistent spacing */
.md-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  background: transparent;
  margin: 0;
  padding: 0;
}

/* Title button – white border, transparent background, hover black + zoom */
.md-title-button {
  background: transparent !important;
  border: 2px solid #ffffff;
  border-radius: 60px;
  padding: 10px 20px;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  width: auto;
  min-width: 160px;
  white-space: nowrap;
}
.md-title-button:hover {
  background: #000000 !important;
  border-color: #000000;
  color: #ffffff;
  transform: translateY(-2px) scale(1.05);
}

/* Tags – white border, transparent background, hover black (no zoom) */
.md-tag {
  background: transparent !important;
  border: 1.5px solid #ffffff;
  border-radius: 40px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  color: #ffffff;
  cursor: default;
  transition: all 0.2s;
  white-space: nowrap;
}
.md-tag:hover {
  background: #000000 !important;
  border-color: #000000;
  color: #ffffff;
}

/* Responsive */
@media (max-width: 1024px) {
  .master-detail-grid {
    gap: 32px;
  }
  .md-grid {
    gap: 20px;
  }
  .md-big-image-wrapper {
    min-height: 350px;
  }
  .md-title-button {
    font-size: 16px;
    padding: 8px 20px;
    min-width: 140px;
  }
}
@media (max-width: 768px) {
  .master-detail-grid {
    flex-direction: column;
    gap: 32px;
  }
  /* RIGHT GRID APPEARS ABOVE LEFT GRID ON MOBILE */
  .md-detail-right {
    order: -1;
  }
  .md-grid-left {
    flex: auto;
    width: 100%;
  }
  .md-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  .md-post-card {
    aspect-ratio: 4 / 3;
  }
  .md-card-title {
    font-size: 11px;
    bottom: 12px;
    left: 12px;
  }
  .md-big-image-wrapper {
    min-height: 300px;
  }
  .md-info-panel {
    bottom: 15px;
    max-width: 95%;
    gap: 10px;
  }
  .md-title-button {
    font-size: 14px;
    padding: 6px 16px;
    min-width: 130px;
    white-space: nowrap;
  }
  .md-tag {
    font-size: 10px;
    padding: 4px 10px;
  }
}
@media (max-width: 480px) {
  .master-detail-grid {
    gap: 24px;
  }
  .md-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .md-post-card {
    aspect-ratio: 16 / 9;
  }
  .md-card-title {
    font-size: 12px;
    bottom: 14px;
    left: 14px;
  }
  .md-big-image-wrapper {
    min-height: 280px;
  }
  .md-info-panel {
    bottom: 12px;
    max-width: 96%;
    gap: 8px;
  }
  .md-title-button {
    font-size: 13px;
    padding: 5px 12px;
    min-width: 110px;
    white-space: nowrap;
  }
  .md-tag {
    font-size: 9px;
    padding: 3px 8px;
    white-space: nowrap;
  }
  .md-big-card {
    border-radius: 12px;
  }
  .md-img-overlay {
    border-radius: 0 0 12px 12px;
  }
}

/* Force Elementor widget container to have no padding */
.elementor-widget-master_detail_grid .elementor-widget-container {
  padding: 0 !important;
  margin: 0 !important;
}

/* Whimsical scroll animations */
.md-animate {
  opacity: 0;
  transform: translateY(30px) scale(0.95);
  transition:
    opacity 0.8s cubic-bezier(0.2, 0.9, 0.4, 1.1),
    transform 0.6s ease-out;
}
.md-animate.md-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.md-post-card {
  transition-delay: 0s;
}
.md-post-card.md-animate.md-visible {
  transition-delay: calc(var(--index, 0) * 0.08s);
}
.md-detail-right.md-animate {
  transform: translateY(40px) scale(0.92) rotateX(2deg);
  opacity: 0;
  transition: all 0.7s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.md-detail-right.md-animate.md-visible {
  transform: translateY(0) scale(1) rotateX(0);
  opacity: 1;
}
.md-post-card:hover {
  transform: translateY(-8px) rotate(0.5deg);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.2);
}
.md-big-image-wrapper:hover .md-big-img {
  transform: scale(1.03);
  transition: transform 0.5s ease;
}
