/* === BLOG SECTION - Theme Responsive === */
.blog-section-container {
    padding: 80px 20px;
    background-color: var(--bg-color);
    color: var(--text-color);
    text-align: center;
    transition: all 0.4s ease;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 50px;
    font-weight: 700;
    color: var(--primary-color);
}

.blog-grid {
    display: grid;
    /* Exactly 3 columns on desktop to ensure 3/3/3 layout */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    perspective: 1500px;
    align-items: stretch; /* Ensure cards stretch to equal height */
}

/* On wide screens with 3 columns, center the single card in 4th row */
@media (min-width: 901px) {
    .blog-grid > .blog-card:nth-child(10) {
        grid-column: 2; /* Middle column */
    }
}

/* Responsive adjustments: 2 columns on tablets, 1 on mobile */
@media (max-width: 900px) {
    .blog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: center;
    }
}

@media (max-width: 560px) {
    .blog-grid {
        grid-template-columns: 1fr;
    }
}

/* Theme-responsive blog cards - NOW USES CSS VARIABLES */
.blog-card {
    background-color: var(--card-bg-color, var(--secondary-bg-color, #ffffff));
    border: 1px solid var(--border-color, rgba(226, 232, 240, 0.8));
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--card-shadow, 0 4px 6px rgba(0,0,0,0.1));
    transition: transform 0.4s ease, box-shadow 0.4s ease, background-color 0.4s ease;
    cursor: pointer;
    will-change: transform;
    display: flex;            /* Equalize card heights */
    flex-direction: column;   /* Stack image and content */
    height: 100%;
}

.blog-card:hover {
    transform: translateY(-8px) rotateX(3deg) rotateY(-3deg) scale(1.02);
    box-shadow: var(--card-hover-shadow, 0 20px 40px rgba(0,0,0,0.15));
}

.blog-card-image-wrapper {
    position: relative;
    overflow: hidden;
    height: 220px;            /* Fixed image area for consistent layout */
}

.blog-card-image-wrapper img {
    width: 100%;
    height: 100%;            /* Fill fixed wrapper height */
    object-fit: cover;
    border-radius: 20px 20px 0 0;
    transition: transform 0.4s ease;
}

.blog-card:hover .blog-card-image-wrapper img {
    transform: scale(1.08);
}

.blog-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--card-overlay, linear-gradient(to top, rgba(59,130,246,0.2), transparent));
    opacity: 0;
    transition: opacity 0.4s ease;
}

.blog-card:hover .blog-card-overlay {
    opacity: 1;
}

.blog-card-content {
    padding: 25px;
    text-align: left;
    background-color: var(--card-content-bg, var(--bg-color));
    color: var(--text-color);
    border-radius: 0 0 20px 20px;
    display: flex;            /* Stretch content to fill remaining height */
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
}

.blog-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 15px 0;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.blog-card:hover .blog-card-title {
    color: var(--accent-color, var(--primary-color));
}

.blog-card-info-top, .blog-card-info-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--secondary-text-color, #6b7280);
}

.blog-card-info-top {
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.blog-card:hover .blog-card-info-top {
    transform: translateY(0);
    opacity: 1;
}

.blog-tag {
    background-color: var(--primary-color-translucent);
    color: var(--primary-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
}

/* === MODAL STYLES === */
.blog-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay-bg, rgba(0, 0, 0, 0.8));
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.blog-modal-container.active {
    opacity: 1;
    pointer-events: auto;
}

.blog-modal-content {
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: 40px;
    border-radius: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--card-shadow, 0 20px 60px rgba(0, 0, 0, 0.3));
    transform: scale(0.7);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.blog-modal-container.active .blog-modal-content {
    transform: scale(1);
}

.close-modal-button {
    position: absolute;
    top: 15px;
    right: 20px;
    background: var(--accent-color, #ff6b6b);
    border: none;
    color: var(--bg-color);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.close-modal-button:hover {
    transform: scale(1.1);
    background-color: var(--primary-color);
}

#modal-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 15px;
    margin-bottom: 20px;
}

/* Services modal image sizing */
#services-modal-image {
    width: 100%;
    height: auto;
    max-height: 40vh; /* Prevent oversized image in dialog */
    object-fit: cover;
    border-radius: 15px;
    margin-bottom: 16px;
}

@media (max-width: 600px) {
    #services-modal-image {
        max-height: 30vh; /* Smaller on mobile for better layout */
    }
}

#modal-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent-color, var(--primary-color));
    margin-bottom: 10px;
}

.modal-meta-info {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    margin-bottom: 30px;
}

#modal-full-text {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-color);
}
