
.read-more-wrapper {
    position: relative;
}

.read-more-wrapper .read-more-content {
    max-height: 700px;
    overflow: hidden;
    position: relative;
    transition: max-height 0.7s cubic-bezier(0.4, 0, 0.2, 1); /* Smoother easing */
}

/* This pseudo-element creates the fade-out effect */
.read-more-wrapper:not(.is-expanded) .read-more-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1) 80%);
    pointer-events: none; /* Allows clicking through the gradient */
    transition: opacity 0.3s ease-out;
    opacity: 1;
}

.read-more-wrapper.is-expanded .read-more-content::after {
    opacity: 0;
}

.read-more-wrapper.is-expanded .read-more-content {
    max-height: 10000px; /* A large value to accommodate any content length */
}

/* Common button container */
.read-more-buttons {
    position: relative;
    text-align: center;
    margin-top: -50px; /* Pulls the button up over the gradient */
    height: 40px; /* Allocate space for the buttons */
}

.read-more-wrapper.is-expanded .read-more-buttons {
    margin-top: 20px;
}

.read-more-wrapper .read-more-button,
.read-more-wrapper .read-less-button {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    cursor: pointer;
    padding: 10px 25px;
  background-color: #4ba8e5;
    color: #fff;
    border: none;
    border-radius: 5px;
    transition: background-color 0.3s, opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;
    opacity: 1;
    visibility: visible;
}

.read-more-wrapper .read-more-button:hover,
.read-more-wrapper .read-less-button:hover {
    background-color: #083b22;
}

/* Hide the 'Read Less' button by default */
.read-more-wrapper .read-less-button {
    opacity: 0;
    visibility: hidden;
}

/* When expanded, hide the 'Read More' button and show the 'Read Less' button */
.read-more-wrapper.is-expanded .read-more-button {
    opacity: 0;
    visibility: hidden;
}

.read-more-wrapper.is-expanded .read-less-button {
    opacity: 1;
    visibility: visible;
}
