/* Latest Blogs Section Styles */
/* This file makes the blog cards look pretty and work smoothly */

/* Main container for the latest blogs section */
.latest-blogs-section {
    position: relative;
    width: 100%;
    padding: 4rem 0; /* Increased padding for better section spacing */
    margin: 3rem 0; /* Add margin between sections */
    background-color: var(--card-background);
}

/* Header section with title, subtitle, and view all button */
.latest-blogs-section .section-header {
    margin-bottom: 3rem;
    padding: 0 2rem; /* Add padding so content doesn't touch edges */
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
}

/* Left side: title and subtitle container */
.latest-blogs-section .title-container {
    flex: 1;
    text-align: left;
}

.latest-blogs-section .section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 0.5rem 0;
    font-family: var(--font-title); /* Use theme font variable */
    line-height: 1.2; /* Consistent line height for alignment */
}

.latest-blogs-section .section-subtitle {
    font-size: 1.1rem;
    color: var(--text-color-light); /* Use proper theme color */
    margin: 0;
    font-family: var(--font-body); /* Use theme font variable */
    text-align: left;
    line-height: 1.4;
}

/* View All Posts Button */
.latest-blogs-section .view-all-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-body); /* Use theme font variable */
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    flex-shrink: 0; /* Prevent button from shrinking */
    align-self: flex-start; /* Align to top of header */
    margin-top: 0.2rem; /* Fine-tune vertical alignment with title baseline */
}

.latest-blogs-section .view-all-button:hover {
    background: var(--color-secondary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Container for the scrolling gallery with internal arrows */
.blogs-gallery-container {
    position: relative;
    padding: 0;
    overflow: hidden; /* Hide arrows when not needed */
}

/* Carousel arrows inside the gallery */
.blogs-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    z-index: 10;
    transition: all 0.3s ease;
    opacity: 0.8;
    backdrop-filter: blur(10px);
}

.blogs-carousel-arrow:hover {
    background: var(--color-primary);
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.blogs-carousel-arrow-left {
    left: 10px;
}

.blogs-carousel-arrow-right {
    right: 10px;
}

/* Hide arrows on mobile to avoid overlap */
@media (max-width: 768px) {
    .blogs-carousel-arrow {
        display: none;
    }
}

/* The scrolling area where blog cards live */
.blogs-gallery-scroll {
    display: flex;
    gap: 1.5rem; /* Space between cards */
    overflow-x: auto; /* Allow horizontal scrolling */
    padding: 1rem 0 2rem 0;
    scroll-behavior: smooth; /* Smooth scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on mobile */
    scrollbar-width: thin;
    scrollbar-color: var(--color-primary) var(--card-background);
    cursor: grab; /* Show grab cursor */
    user-select: none; /* Prevent text selection while dragging */
    align-items: stretch; /* Make all cards same height */
}

.blogs-gallery-scroll.dragging {
    cursor: grabbing; /* Show grabbing cursor when dragging */
    scroll-behavior: auto; /* Disable smooth scroll while dragging */
}

/* Scrollbar styling for webkit browsers (Chrome, Safari) */
.blogs-gallery-scroll::-webkit-scrollbar {
    height: 8px;
}

.blogs-gallery-scroll::-webkit-scrollbar-track {
    background: var(--input-background);
    border-radius: 4px;
}

.blogs-gallery-scroll::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 4px;
}

.blogs-gallery-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-light);
}

/* Individual blog card styling - CYBERPUNK STYLE with complex clip-path */
.blog-card {
    background: transparent;
    width: 280px;
    min-width: 280px;
    flex: 0 0 280px;
    padding: 1px 1px;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    margin: 0 15px;
    height: 100%;
    position: relative;
}

.blog-card:hover {
    transform: translateY(-8px);
}

.blog-card:hover::before {
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.blog-card:hover .card-wrapper {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

/* Cyberpunk blue frame (outer border) */
.blog-card::before {
    content: "";
    position: absolute;
    background: var(--color-primary); /* Blue cyberpunk frame */
    top: -10px;
    left: -3px;
    width: calc(100% + 7px);
    height: calc(100% + 10px);
    clip-path: polygon(
        0px 25px,              /* Top left corner */
        26px 0px,              /* Top left diagonal */
        calc(57% - 15px) 0px,  /* Top line start */
        calc(63% - 15px) 4%,   /* Top notch */
        95% 4%,                /* Top line end */
        100% 8%,               /* Top right corner */
        100% calc(100% - 10px), /* Bottom right corner */
        calc(100% - 15px) calc(100% - 10px),   /* Bottom right notch */
        calc(80% - 10px)  calc(100% - 10px),   /* Bottom line start */
        calc(80% - 15px) calc(100% - 0px),     /* Bottom notch */
        10px  calc(100% - 0px), /* Bottom left corner */
        0% calc(100% - 10px)    /* Bottom line end */
    );
    z-index: -1;
    padding-bottom: 10px;
}

/* Inner background with matching clip-path */
.blog-card::after {
    content: "";
    position: absolute;
    background: var(--card-background); /* Match section background for floating border effect */
    top: -3px;
    left: -3px;
    width: calc(100% + 8px);
    height: calc(100% + 7px);
    clip-path: polygon(
        0px 25px,              /* Top left corner */
        26px 0px,              /* Top left diagonal */
        calc(60% - 25px) 0px,  /* Top line */
        60% 25px,              /* Top right notch */
        100% 25px,             /* Top right corner */
        100% calc(100% - 10px), /* Bottom right corner */
        calc(100% - 15px) calc(100% - 10px),   /* Bottom right notch */
        calc(80% - 10px)  calc(100% - 10px),   /* Bottom line start */
        calc(80% - 15px) calc(100% - 0px),     /* Bottom notch */
        10px  calc(100% - 0px), /* Bottom left corner */
        0% calc(100% - 10px)    /* Bottom line end */
    );
    z-index: -1;
}

/* Card wrapper with cyberpunk clip-path */
.blog-card .card-wrapper {
    background: var(--card-background); /* Match section background for floating border effect */
    position: relative;
    height: 360px;
    display: flex;
    flex-direction: column;
    clip-path: polygon(
        0px 25px,              /* Top left corner */
        26px 0px,              /* Top left diagonal */
        calc(60% - 25px) 0px,  /* Top line */
        60% 25px,              /* Top right notch */
        100% 25px,             /* Top right corner */
        100% calc(100% - 10px), /* Bottom right corner */
        calc(100% - 15px) calc(100% - 10px),   /* Bottom right notch */
        calc(80% - 10px)  calc(100% - 10px),   /* Bottom line start */
        calc(80% - 15px) calc(100% - 0px),     /* Bottom notch */
        10px  calc(100% - 0px), /* Bottom left corner */
        0% calc(100% - 10px)    /* Bottom line end */
    );
}

.blog-card .blog-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

/* Blog image styling - matches cyberpunk card height */
.blog-card .blog-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-image {
    transform: scale(1.05);
}

/* Blog details section - matches cyberpunk card layout */
.blog-card .blog-details {
    padding: 1.5rem;
    height: calc(100% - 200px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Blog title styling */
.blog-card .blog-title {
    font-family: var(--font-title-en); /* Use theme title font */
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    line-clamp: 2; /* Standard property for compatibility */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Blog date styling */
.blog-card .blog-date {
    font-family: var(--font-body-en); /* Use theme body font */
    font-size: 0.9rem;
    color: var(--text-color-light);
    margin: 0 0 0.75rem 0;
    font-weight: 500;
}

/* Blog excerpt styling */
.blog-card .blog-excerpt {
    font-family: var(--font-body-en); /* Use theme body font */
    font-size: 0.9rem;
    color: var(--text-color-light);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Limit to 3 lines */
    line-clamp: 3; /* Standard property for compatibility */
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1; /* Take up remaining space */
}

/* Error and no-blogs messages */
.no-blogs-message,
.error-message {
    text-align: center;
    padding: 2rem;
    font-family: var(--font-body-en);
    color: var(--text-color-light);
    font-size: 1.1rem;
    font-style: italic;
}

.error-message {
    color: var(--color-error, #ff6b6b);
}

/* Mobile responsive design - maintain cyberpunk styling */
@media (max-width: 768px) {
    .latest-blogs-section {
        padding: 3rem 0; /* Reduced padding on mobile */
        margin: 2rem 0;
    }
    
    /* Mobile header layout - stack title/subtitle vertically, move button below cards */
    .latest-blogs-section .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin-bottom: 2rem;
        padding: 0 1rem;
    }
    
    .latest-blogs-section .title-container {
        text-align: center;
        margin-bottom: 2rem;
    }
    
    .latest-blogs-section .section-title {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }
    
    .latest-blogs-section .section-subtitle {
        font-size: 1rem;
        text-align: center;
        margin: 0;
    }
    
    /* Hide view all button in header on mobile */
    .latest-blogs-section .view-all-button {
        display: none;
    }
    
    /* Mobile view all button positioned below cards */
    .mobile-view-all-button {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.8rem 1.5rem;
        margin: 2rem auto 0;
        width: fit-content;
        background-color: var(--color-primary);
        color: white;
        border: none;
        border-radius: 25px;
        font-size: 1rem;
        font-weight: 600;
        font-family: var(--font-body);
        text-decoration: none;
        cursor: pointer;
        box-shadow: 0 2px 10px rgba(243, 121, 100, 0.3);
        transition: all 0.3s ease;
    }
    
    .mobile-view-all-button:hover {
        background: var(--color-primary);
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    }
    
    /* Keep same cyberpunk card size on mobile */
    .blog-card {
        width: 280px;
        min-width: 280px;
        flex: 0 0 280px;
    }
    
    .blogs-gallery-scroll {
        gap: 1rem;
        padding: 1rem 0.5rem 2rem 0.5rem;
    }
    
    .blog-card .blog-details {
        padding: 1rem;
    }
    
    .blog-card .blog-title {
        font-size: 1.1rem;
    }
    
    .blog-card .blog-date,
    .blog-card .blog-excerpt {
        font-size: 0.85rem;
    }
}

/* Animation for when the section appears */
.container.content-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.container.content-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animation for blog cards */
.blog-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.blog-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays for each card */
.blog-card:nth-child(1) { transition-delay: 0.1s; }
.blog-card:nth-child(2) { transition-delay: 0.2s; }
.blog-card:nth-child(3) { transition-delay: 0.3s; }
.blog-card:nth-child(4) { transition-delay: 0.4s; }
.blog-card:nth-child(5) { transition-delay: 0.5s; }
.blog-card:nth-child(6) { transition-delay: 0.6s; }


[data-theme="dark"] .blogs-carousel-arrow {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

[data-theme="dark"] .blogs-carousel-arrow:hover {
    background: var(--color-primary);
}
