/* Homepage Layout Fixes for Editorial Theme Blog */

/* Fix unnecessary scroll bars and spacing issues in posts grid */
.posts {
  overflow: visible !important;
  margin: 0 0 2em 0 !important;
  width: 100% !important;
}

.posts article {
  margin: 0 0 4em 0 !important;
  width: calc(33.33333% - 2em) !important;
  margin-right: 2em !important;
  position: relative !important;
}

/* Fix post-meta spacing issues */
.posts article .post-meta {
  margin-top: 1rem !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
  line-height: 1.4 !important;
  overflow: visible !important;
  white-space: normal !important;
}

.posts article .post-meta .date {
  display: inline !important;
  margin-right: 0.5rem !important;
}

.posts article .post-meta a {
  display: inline !important;
  margin: 0 !important;
  white-space: nowrap !important;
}

/* Remove unnecessary pseudo-elements that create lines and spacing issues */
.posts article:before,
.posts article:after {
  display: none !important;
}

/* Remove all decorative lines from Editorial theme */
.posts article:nth-child(3n + 1):before,
.posts article:nth-child(3n + 1):after,
.posts article:nth-child(2n + 1):before,
.posts article:nth-child(2n + 1):after,
.posts article:nth-last-child(1):before,
.posts article:nth-last-child(2):before,
.posts article:nth-last-child(3):before,
.posts article:nth-last-child(1):after,
.posts article:nth-last-child(2):after,
.posts article:nth-last-child(3):after {
  display: none !important;
  content: none !important;
  background: none !important;
  height: 0 !important;
  width: 0 !important;
}

/* Fix flexbox issues on mobile */
@media screen and (max-width: 980px) {
  .posts {
    display: block !important;
  }
  
  .posts article {
    width: 100% !important;
    margin: 0 0 3em 0 !important;
    float: none !important;
  }
}

@media screen and (max-width: 1680px) and (min-width: 981px) {
  .posts article {
    width: calc(50% - 1em) !important;
    margin-right: 1em !important;
  }
  
  .posts article:nth-child(2n) {
    margin-right: 0 !important;
  }
}

/* Fix main content overflow issues */
#main {
  overflow: visible !important;
}

#main .inner {
  overflow: visible !important;
}

/* Fix section spacing */
section#recent-posts {
  margin-bottom: 3rem !important;
  overflow: visible !important;
}

/* Ensure images don't cause overflow */
.posts article .image {
  overflow: hidden !important;
  margin-bottom: 1.5rem !important;
}

.posts article .image img {
  width: 100% !important;
  height: auto !important;
  display: block !important;
}

/* Fix button spacing */
.posts article .actions {
  margin: 1rem 0 1rem 0 !important;
}

/* Ensure clean layout without horizontal scroll */
body {
  overflow-x: hidden !important;
}

#wrapper {
  overflow-x: hidden !important;
}