/* ====================
   GRID LAYOUT & BASE
==================== */
.goldprices {
  min-height: 100vh;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  padding: 24px;
  box-sizing: border-box;
}

/* Base Styles for all blocks */
.goldprices-block {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  overflow: hidden;
  background: #014d4d;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.1);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  min-height: 250px; /* Ensures a minimum height for all cards */
}

/* Hover effect */
.goldprices-block:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 8px 28px rgba(255, 217, 0, 0.801);
}

/* ====================
   IMAGE BACKGROUND
==================== */
.goldprices-animated .goldprices-modal-block {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  border-radius: 16px;
}

.goldprices-animated img.goldprices-default-img,
.goldprices-animated img.goldprices-hover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.7s ease, transform 1.2s ease;
}

.goldprices-animated img.goldprices-default-img {
  opacity: 1;
  z-index: 1;
}

.goldprices-animated img.goldprices-hover-img {
  opacity: 0;
  transform: scale(1.08);
  z-index: 2;
}

.goldprices-animated:hover img.goldprices-default-img {
  opacity: 0;
}

.goldprices-animated:hover img.goldprices-hover-img {
  opacity: 1;
  transform: scale(1);
}

/* ====================
   TEXT OVERLAY
==================== */
.goldprices-block-content,
.goldprices-modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  width: 90%;
  max-width: 500px;
  min-height: 160px;
  text-align: center;
  padding: 24px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.goldprices-block-content {
  opacity: 1;
}

.goldprices-modal-content {
  z-index: 4;
  opacity: 0;
}

.goldprices-animated:hover .goldprices-block-content {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.99);
}

.goldprices-animated:hover .goldprices-modal-content {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.04);
}

/* ====================
   TYPOGRAPHY & BUTTONS
==================== */
.goldprices-container h1 {
  color: white;
  font-weight: 800;
  font-size: 1.6rem;
  text-align: center;
}

.goldprices-paragraph-container {
  text-align: center;
  color: white;
  margin: 10px auto 0;
  width: 90%;
  font-size: 0.9rem;
}

.goldprices-block-content h2,
.goldprices-modal-content h2 {
  margin: 0 0 10px;
  font-weight: 700;
  line-height: 1.2;
  font-size: 1.6rem;
  color: gold;
  letter-spacing: 0.5px;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.goldprices-block-content p,
.goldprices-modal-content p {
  margin: 6px 0;
  font-weight: 500;
  font-size: 1rem;
  color: #f1f1f1;
}

.goldprices-btn {
  margin-top: 12px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffd700, #ffb700);
  color: #111;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.35s ease;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.goldprices-btn:hover {
  background: linear-gradient(135deg, #ffdf5a, #ffc107);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 18px rgba(255, 217, 0, 0.855);
}

.goldprices-container {
  margin-top: 5rem;
}

/* ====================
   RESPONSIVE DESIGN (Mobile First)
==================== */

/* Smallest mobiles (max 374px) */
@media (max-width: 374px) {
  .goldprices {
    padding: 20px 12px;
    gap: 16px;
  }
  .goldprices-container h1 {
    font-size: 1.2rem;
  }
  .goldprices-paragraph-container {
    font-size: 0.8rem;
  }
}

/* Big mobiles (480px and up) */
@media (min-width: 480px) {
  .goldprices {
    padding: 28px 16px;
    gap: 20px;
  }
  .goldprices-container h1 {
    font-size: 1.6rem;
  }
  .goldprices-paragraph-container {
    width: 90%;
    font-size: 0.9rem;
  }
}

/* Small tablets (600px and up) */
@media (min-width: 600px) {
  .goldprices {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    padding: 32px 20px;
  }
  .goldprices-container h1 {
    font-size: 1.8rem;
  }
  .goldprices-paragraph-container {
    width: 80%;
  }
}

/* Fullscreen modal for screens under 800px */
@media (max-width: 799px) {
  .goldprices {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
  }

  .goldprices-block {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    margin: 0;
    box-shadow: none;
    transform: none !important;
    scroll-snap-align: start;
  }

  .goldprices-block-content,
  .goldprices-modal-content {
    width: 90%;
    max-width: 90%;
    padding: 24px;
    font-size: 1rem;
  }

  .goldprices-container h1 {
    font-size: 1.6rem;
  }

  .goldprices-paragraph-container {
    width: 90%;
    font-size: 0.9rem;
  }
}

/* Big tablets & small desktops (800px to 1426px) */
@media (min-width: 800px) and (max-width: 1426px) {
  .goldprices {
    grid-template-columns: repeat(2, 1fr);
    gap: 36px;
    padding: 48px 64px;
  }

  .goldprices-block {
    min-height: 480px;
  }

  .goldprices-block-content,
  .goldprices-modal-content {
    max-width: 520px;
    padding: 32px 36px;
  }

  .goldprices-block-content h2,
  .goldprices-modal-content h2 {
    font-size: 1.9rem;
  }

  .goldprices-block-content p,
  .goldprices-modal-content p {
    font-size: 1.1rem;
  }

  .goldprices-btn {
    font-size: 1rem;
    padding: 14px 28px;
    margin-top: 18px;
  }
}

/* Larger desktops (1427px and up) */
@media (min-width: 1427px) {
  .goldprices {
    gap: 40px;
    padding: 64px 80px;
  }
  .goldprices-container h1 {
    font-size: 3rem;
  }
  .goldprices-paragraph-container {
    width: 35%;
    font-size: 1.1rem;
  }

  .goldprices-container {
    margin-top: 5rem;
  }
}

/* ====================
   IMAGE ADJUSTMENTS FOR SMALL SCREENS
==================== */

/* Apply to all small screens up to 479px (medium mobiles and smaller) */
@media (max-width: 479px) {
  .goldprices-animated .goldprices-modal-block {
    /* Reduce the size of the container for the image */
    left: 5%; /* 5% gap from left edge */
    right: 5%; /* 5% gap from right edge */
    top: 5%; /* 5% gap from top */
    bottom: 5%; /* 5% gap from bottom */
    border-radius: 12px; /* Add a border-radius */
    border: none;
    overflow: hidden; /* Ensure content respects border-radius */
  }

  .goldprices-animated img.goldprices-default-img,
  .goldprices-animated img.goldprices-hover-img {
    /* Initially zoom out the image slightly */
    transform: scale(1); /* Start zoomed out by 10% */
    transition: opacity 0.7s ease, transform 1.2s ease; /* Maintain existing transition */
    object-fit: contain; /* Ensure the entire image is visible, fitting within the container */
    padding: 5px; /* Add a small internal padding to act as a border */
    background-color: rgba(
      255,
      255,
      255,
      0.1
    ); /* Light background for the "border" effect */
    border-radius: 12px; /* Match the container's border-radius */
  }

  /* Zoom in effect on hover (or interaction for non-hover devices) */
  .goldprices-animated:hover img.goldprices-hover-img {
    transform: scale(1.05); /* Zoom in to original size on hover */
  }
}

/* Specific adjustments for smallest mobiles (max 374px) if needed,
   otherwise, the above styles will apply. */
@media (max-width: 374px) {
  .goldprices-animated .goldprices-modal-block {
    left: 8%; /* Slightly larger gap for very small screens */
    right: 8%;
    top: 8%;
    bottom: 8%;
  }
}

/* ====================
   TYPOGRAPHY & BUTTONS
==================== */

.goldprices-block-content h2,
.goldprices-modal-content h2 {
  margin: 0 0 10px;
  font-weight: 700;
  line-height: 1.2;
  /* Responsive font size for titles */
  font-size: clamp(1.2rem, 5vw, 1.6rem);
  color: gold;
  letter-spacing: 0.5px;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.goldprices-block-content p,
.goldprices-modal-content p {
  margin: 6px 0;
  font-weight: 500;
  /* Responsive font size for paragraphs */
  font-size: clamp(0.8rem, 3vw, 1rem);
  color: #f1f1f1;
}

/* Rest of the CSS remains the same... */

/* ====================
   FIXED - IMAGE ADJUSTMENTS FOR SMALL SCREENS
==================== */

/* Apply to all small screens up to 479px (medium mobiles and smaller) */
@media (max-width: 479px) {
  .goldprices-animated .goldprices-modal-block {
    /* Create a clear gap by reducing the container size */
    left: 4%;
    right: 4%;
    top: 4%;
    bottom: 4%;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6); /* Use a darker shadow for a cleaner look */
    overflow: hidden;
  }

  .goldprices-animated img.goldprices-default-img,
  .goldprices-animated img.goldprices-hover-img {
    /* Reset padding and border to remove the ugly background */
    padding: 0;
    background-color: transparent;
    border-radius: 12px;

    /* Maintain the zoom-out effect for a better initial view */
    transform: scale(0.99); /* Slightly more zoomed out */
    object-fit: contain;
    transition: transform 1.2s ease; /* Only transition the transform */
  }

  /* Zoom in effect on hover */
  .goldprices-animated:hover img.goldprices-hover-img {
    transform: scale(
      1.02
    ); /* Subtle zoom-in to original size, with a little extra */
    opacity: 0.8; /* Ensure the hover image is visible */
  }
}

/* ====================
   FIXED - TEXT OVERLAY ADJUSTMENTS
==================== */
.goldprices-block-content,
.goldprices-modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  width: 60%; /* Reduce the width of the overlay */
  max-width: 300px; /* A reasonable max-width to prevent stretching */
  min-height: 160px;
  text-align: center;
  padding: 18px;
  border-radius: 12px;
  background: rgba(
    0,
    0,
    0,
    0.35
  ); /* Make the overlay a bit darker for better contrast */
  backdrop-filter: blur(4px); /* Increase the blur for a softer effect */
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* ====================
   FIXED - TYPOGRAPHY FOR MOBILE
==================== */

@media (max-width: 479px) {
  .goldprices-block-content h2,
  .goldprices-modal-content h2 {
    /* Adjust clamp values for a better fit on smaller screens */
    font-size: clamp(1rem, 4.5vw, 1.4rem);
    line-height: 1.3;
  }

  .goldprices-block-content p,
  .goldprices-modal-content p {
    /* Adjust clamp values for paragraphs */
    font-size: clamp(0.7rem, 2.5vw, 0.9rem);
    line-height: 1.5;
  }
}
