/* General container for the Read Also section */
.read-also-box {
  border: double 2px #BD3730;
  background-color: #f0fff0; /* Light green background - will be overridden by inline style from PHP */
  padding: 15px;
  margin-top: 40px;
  box-shadow: 0 0 10px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  position: relative; /* For positioning the credit text */
}

/* Animated and centered heading */
.read-also-heading {
  text-align: center;
  font-weight: bold;
  color: #BD3730;
  font-size: 18px;
  margin: 0 auto 15px auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  animation: flicker 1.5s infinite;
  padding-bottom: 5px;
  border-bottom: 1px solid #BD3730;
  width: fit-content;
}

/* Flicker animation */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Bouncing finger animation */
.read-also-heading .finger-emoji {
  display: inline-block;
  animation: bounceFinger 1s infinite alternate 0.2s;
}

@keyframes bounceFinger {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Grid layout for related posts */
.related-posts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  /* grid-template-columns will be set by inline style based on # of posts */
  gap: 12px;
  width: 100%;
}

/* Each related post item */
.related-posts-list li {
  display: flex;
  /* align-items: flex-start; Removed to be set by inline style */
  border: 1px solid #e0e0e0;
  background-color: #ffffff; /* Default, will be overridden by inline style from PHP */
  border-radius: 5px;
  padding: 10px;
  /* gap: 5px; Updated by inline style to 10px */
  transition: box-shadow 0.3s ease;
}

.related-posts-list li:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Thumbnail image styling */
.related-thumb {
  flex-shrink: 0;
  border: 1px solid gold; /* Default thin golden border, will be overridden by inline style */
  padding: 2px; /* Small padding to make border visible */
}
.related-thumb img {
  /* width and height are handled by WordPress's image sizes or custom inline style */
  height: auto; /* Ensure aspect ratio is maintained for standard sizes */
  object-fit: cover;
  border-radius: 0px; /* Default, will be overridden by inline style from PHP */
  transition: transform 0.3s ease;
  display: block;
}

/* Hover zoom effect */
.related-posts-list li a:hover .related-thumb img {
  transform: scale(1.05);
}

/* Text container */
.related-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Post title */
.related-title {
  font-size: 12px; /* Default font size, will be overridden by inline style */
  font-weight: bold;
  color: #000; /* Default color, will be overridden by inline style */
  text-align: center; /* Align to center */
  transition: color 0.3s ease;
  border: 1px solid #f0dada;
  padding: 5px;
  border-radius: 3px;
  margin-bottom: 4px;
  line-height: 1.3;
}

/* Full clickable area */
.related-posts-list li a {
  display: flex;
  /* align-items: flex-start; Updated by inline style to center */
  text-decoration: none;
  color: inherit;
  width: 100%;
}

/* Author info */
.related-meta {
  font-size: 10px;
  color: #555;
  display: flex;
  align-items: center;
  gap: 5px;
  align-self: flex-end;
}

.related-meta img {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
}

/* Credit text at the bottom right */
.deo-credit {
    font-size: 9px; /* Smaller font size */
    color: #888888; /* Grey color */
    text-align: right; /* Keep in right */
    margin-top: 10px;
    padding-top: 5px;
    border-top: 1px dashed #e0e0e0;
}

/* Admin instruction box (only in admin) */
.deo-important-instruction-admin {
    background-color: #d1ecf1; /* Light blue background */
    border: 1px solid #bee5eb;
    color: #0c5460;
    padding: 15px;
    margin-top: 20px;
    border-radius: 5px;
    font-size: 14px;
}
.deo-important-instruction-admin h3 {
    margin-top: 0;
    color: #0c5460;
}


/* Load more button (if needed later) */
#loadMoreRelatedPosts {
  transition: box-shadow 0.3s ease-in-out, transform 0.3s ease;
}
#loadMoreRelatedPosts:hover {
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.7), 0 0 25px rgba(99, 102, 241, 0.5);
  transform: translateY(-2px);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .related-posts-list {
    grid-template-columns: 1fr !important; /* Ensure single column on mobile */
  }

  .read-also-heading {
    font-size: 16px;
  }

  .related-posts-list li {
    flex-direction: row;
    /* align-items: flex-start; Updated by inline style to center */
  }
}