/* ====================================
   Custom Homepage Styles
   ==================================== */

/* General Section Styling */
.custom-homepage .homepage-section {
    margin-bottom: 4rem;
    clear: both;
}

.custom-homepage .section-title {
    font-size: 2.5rem; /* Increased from 2rem */
    margin-bottom: 2rem;
    font-weight: 600;
}

/* ====================================
   Section 1: Latest Post
   ==================================== */
.latest-post-section {
    margin-bottom: 1.125rem; /* Reduced by additional 30px (1.875rem total reduction from original 4rem) */
}

.latest-post-section .section-title {
    text-align: left;
}

/* Fix excerpt width to match title section - new approach */
/* Constrain the entire article to prevent overflow */
.latest-post-section .content-post {
    max-width: 100%;
    box-sizing: border-box;
}

.latest-post-section .post-page-content {
    box-sizing: border-box !important;
    text-align: center !important;
    padding-left: 4rem !important; /* Increase padding to match header inner */
    padding-right: 4rem !important; /* Increase padding to match header inner */
    padding-top: 1.5rem !important;
    padding-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

.latest-post-section .post-page-content p {
    max-width: 100% !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

/* Ensure the header inner has same padding */
.latest-post-section .post-header-inner {
    padding-left: 4rem !important;
    padding-right: 4rem !important;
}

/* Match footer padding too */
.latest-post-section .post-footer {
    padding-left: 4rem !important;
    padding-right: 4rem !important;
}

/* ====================================
   Section 2: Categories
   ==================================== */
.categories-section {
    margin-bottom: 4rem;
    margin-top: 0 !important; /* Remove top margin to prevent double spacing */
    padding-top: 0 !important;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.category-card {
    position: relative;
}

.category-title-link {
    text-decoration: none;
    color: inherit;
    display: block;
    text-align: center;
}

.category-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 500;
    text-align: center;
}

.category-title-link:hover .category-title {
    opacity: 0.7;
}

.category-image-link {
    display: block;
    width: 100%;
    overflow: hidden;
    border-radius: 4px;
}

.category-image {
    width: 100%;
    aspect-ratio: 4/5;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.category-image-link:hover .category-image {
    transform: scale(1.05);
}

/* ====================================
   Section 3: Recent Posts
   ==================================== */
.recent-posts-section {
    margin-bottom: 4rem;
    padding-top: 1.25rem; /* Added 20px (1.25rem) spacing above */
}

.recent-posts-list {
    margin-bottom: 2rem;
}

.recent-post-item {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e0e0e0;
}

.recent-post-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.recent-post-thumbnail {
    flex: 0 0 33.333%;
    max-width: 33.333%;
}

.recent-post-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.recent-post-content {
    flex: 0 0 66.666%;
    max-width: 66.666%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.recent-post-content .cat-links {
    display: inline-block;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recent-post-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.recent-post-title a {
    text-decoration: none;
    color: inherit;
}

.recent-post-title a:hover {
    opacity: 0.8;
}

.recent-post-meta {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 1rem;
}

.read-more-link {
    display: inline-block;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.read-more-link:hover {
    opacity: 0.7;
}

.see-all-posts {
    text-align: center;
    margin-top: 2.625rem; /* Increased by 10px (0.625rem) */
}

.see-all-link {
    display: inline-block;
    font-size: 1.125rem;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.see-all-link:hover {
    opacity: 0.7;
}

/* ====================================
   Section 4: Featured Posts Carousel
   ==================================== */
.featured-posts-section {
    margin-bottom: 4rem;
    padding-top: 1.25rem; /* Added 20px (1.25rem) spacing above */
}

.featured-carousel-wrapper {
    position: relative;
    overflow: hidden;
}

.featured-carousel {
    display: flex;
    transition: transform 0.5s ease;
    width: 100%; /* Ensure full width */
}

.featured-slide {
    min-width: 100%;
    max-width: 100%;
    flex-shrink: 0;
    box-sizing: border-box;
}

/* Fix excerpt overflow in Featured section */
.featured-slide .post-page-content {
    box-sizing: border-box !important;
    text-align: center !important;
    padding-left: 4rem !important;
    padding-right: 4rem !important;
    padding-top: 1.5rem !important;
    padding-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

.featured-slide .post-page-content p {
    max-width: 100% !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

.featured-slide .post-header-inner {
    padding-left: 4rem !important;
    padding-right: 4rem !important;
}

.featured-slide .post-footer {
    padding-left: 4rem !important;
    padding-right: 4rem !important;
}

/* Carousel Navigation Buttons */
.carousel-prev,
.carousel-next {
    position: absolute;
    top: 30%; /* Position relative to image height, not full post */
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 60px; /* Increased from 50px */
    height: 60px; /* Increased from 50px */
    font-size: 2.5rem; /* Increased from 2rem */
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-prev:hover,
.carousel-next:hover {
    background: rgba(0, 0, 0, 0.8);
    color: white;
}

.carousel-prev {
    left: 1rem;
}

.carousel-next {
    right: 1rem;
}

/* Carousel Dots */
.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0 !important; /* Remove top margin */
    padding-top: 0 !important; /* Remove top padding */
}

.carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ddd;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
    padding: 0;
}

.carousel-dot.active {
    background: #333;
}

.carousel-dot:hover {
    background: #666;
}

/* ====================================
   Responsive Styles
   ==================================== */

/* Tablets */
@media screen and (max-width: 768px) {
    .categories-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* Reduce padding on mobile for Latest Post */
    .latest-post-section .post-page-content,
    .latest-post-section .post-header-inner,
    .latest-post-section .post-footer {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }

    /* Reduce padding on mobile for Featured section */
    .featured-slide .post-page-content,
    .featured-slide .post-header-inner,
    .featured-slide .post-footer {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }

    .recent-post-item {
        flex-direction: column;
        gap: 1rem;
    }

    .recent-post-thumbnail,
    .recent-post-content {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .carousel-prev,
    .carousel-next {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .carousel-prev {
        left: 0.5rem;
    }

    .carousel-next {
        right: 0.5rem;
    }
}

/* Mobile */
@media screen and (max-width: 480px) {
    .custom-homepage .section-title {
        font-size: 1.5rem;
    }

    .category-title {
        font-size: 1.25rem;
    }

    .recent-post-title {
        font-size: 1.25rem;
    }
}
