@charset "UTF-8";

/**
 * Modern Blog Cards - E-commerce Style
 * 
 * Purpose: Professional blog card design for home page
 * Features:
 * - Modern card layout
 * - Fully responsive
 * - Hover effects
 * - Image optimization
 * - Professional typography
 * 
 * @version 1.0.0
 * @date 2026-01-25
 */

/* ============================================================
   BLOG SECTION CONTAINER
   ============================================================ */

.nx-blog-section {
    width: 100%;
    max-width: 100%;
    padding: 4rem 0;
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
    overflow-x: hidden;
    box-sizing: border-box;
}

@media (max-width: 991px) {
    .nx-blog-section {
        padding: 3rem 0;
    }
}

.nx-blog-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    box-sizing: border-box;
}

/* Section header / title / CTA: home-section-unified.modern.css (.nx-home-section-*) */

/* ============================================================
   BLOG CARDS GRID
   ============================================================ */

.nx-blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 2rem;
    margin-top: 2rem;
    width: 100%;
    min-width: 0;
}

/* Large screens */
@media (min-width: 1200px) {
    .nx-blog-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }
}

/* Medium-large screens */
@media (min-width: 992px) and (max-width: 1199px) {
    .nx-blog-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

/* Tablets */
@media (min-width: 768px) and (max-width: 991px) {
    .nx-blog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* Small tablets and large phones */
@media (min-width: 576px) and (max-width: 767px) {
    .nx-blog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
}

/* Mobile phones */
@media (max-width: 575px) {
    .nx-blog-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Extra small devices */
@media (max-width: 375px) {
    .nx-blog-container {
        padding: 0 1rem;
    }
    .nx-blog-grid {
        gap: 1.25rem;
    }
}

/* ============================================================
   SMALL DEVICES: touch horizontal scroll + scroll-snap
   (same idea as .nx-settings-banner-row.nx-banner-count-3)
   ============================================================ */

@media (max-width: 767px) {
    .nx-blog-grid {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        grid-template-columns: unset;
        gap: 1rem;
        margin-top: 1.5rem;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        scroll-padding-inline: 0.5rem;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
        padding: 0 0.25rem;
        min-width: 0;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .nx-blog-grid::-webkit-scrollbar {
        display: none;
    }

    .nx-blog-grid .nx-blog-card {
        flex: 0 0 85%;
        min-width: 85%;
        max-width: 85%;
        scroll-snap-align: start;
        scroll-snap-stop: always;
        height: auto;
        min-height: 0;
        align-self: stretch;
    }
}

@media (max-width: 576px) {
    .nx-blog-grid .nx-blog-card {
        flex: 0 0 88%;
        min-width: 88%;
        max-width: 88%;
    }
}

@media (max-width: 360px) {
    .nx-blog-grid .nx-blog-card {
        flex: 0 0 90%;
        min-width: 90%;
        max-width: 90%;
    }
}

/* ============================================================
   BLOG CARD
   ============================================================ */

.nx-blog-card {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
    cursor: pointer;
    min-width: 0;
}

.nx-blog-card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    border-color: rgba(13, 110, 253, 0.2);
}

.nx-blog-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--bs-primary, #0d6efd), #6366f1, var(--bs-primary, #0d6efd));
    background-size: 200% auto;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.nx-blog-card:hover::before {
    opacity: 1;
    animation: gradient-shift 3s ease infinite;
}

/* ============================================================
   BLOG CARD IMAGE
   ============================================================ */

/* Blog cover style – shorter height, 16:9 aspect */
.nx-blog-card-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 – standard blog cover height */
    overflow: hidden;
    background: linear-gradient(135deg, #f5f5f7 0%, #e8e8ed 50%, #fafafa 100%);
    border-radius: 16px 16px 0 0;
    isolation: isolate;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 992px) and (max-width: 1199px) {
    .nx-blog-card-image-wrapper {
        padding-top: 56.25%;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .nx-blog-card-image-wrapper {
        padding-top: 56.25%;
    }
}

@media (min-width: 576px) and (max-width: 767px) {
    .nx-blog-card-image-wrapper {
        padding-top: 56.25%;
    }
}

.nx-blog-card-image-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    overflow: hidden;
    z-index: 1;
}

.nx-blog-card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: filter 0.4s ease, opacity 0.4s ease;
    display: block;
    filter: brightness(1) contrast(1) saturate(1);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.nx-blog-card:hover .nx-blog-card-image {
    filter: brightness(1.05) contrast(1.05) saturate(1.05);
}

.nx-blog-card-image-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, 
        rgba(0, 0, 0, 0) 0%, 
        rgba(0, 0, 0, 0.02) 50%,
        rgba(0, 0, 0, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 2;
}

.nx-blog-card:hover .nx-blog-card-image-wrapper::before {
    opacity: 1;
}

.nx-blog-card-image-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(13, 110, 253, 0.1) 0%, 
        transparent 50%,
        rgba(13, 110, 253, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 2;
}

.nx-blog-card:hover .nx-blog-card-image-wrapper::after {
    opacity: 1;
}

/* Image loading state */
.nx-blog-card-image[data-src] {
    opacity: 0;
    transition: opacity 0.5s ease;
    background: linear-gradient(135deg, #f5f5f7 0%, #e8e8ed 100%);
}

.nx-blog-card-image.lazyloaded {
    opacity: 1;
    background: transparent;
}

/* Better image quality on high DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .nx-blog-card-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Image placeholder shimmer effect */
.nx-blog-card-image-wrapper:has(.nx-blog-card-image[data-src]:not(.lazyloaded)) {
    background: linear-gradient(90deg, 
        #f5f5f7 0%, 
        #e8e8ed 50%, 
        #f5f5f7 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ============================================================
   BLOG CARD CONTENT
   ============================================================ */

.nx-blog-card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

@media (max-width: 576px) {
    .nx-blog-card-content {
        padding: 1.25rem;
    }
}

.nx-blog-card-date {
    font-size: 0.8125rem;
    color: #6e6e73;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.nx-blog-card-date-icon {
    width: 14px;
    height: 14px;
    color: var(--bs-primary, #0d6efd);
    flex-shrink: 0;
}

.nx-blog-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1d1d1f;
    margin: 0 0 1rem 0;
    line-height: 1.4;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.nx-blog-card:hover .nx-blog-card-title {
    color: var(--bs-primary, #0d6efd);
}

@media (max-width: 576px) {
    .nx-blog-card-title {
        font-size: 1.125rem;
    }
}

.nx-blog-card-title-link {
    color: inherit;
    text-decoration: none;
    display: block;
}

.nx-blog-card-title-link:hover {
    color: var(--bs-primary, #0d6efd);
}

.nx-blog-card-excerpt {
    font-size: 0.9375rem;
    color: #6e6e73;
    line-height: 1.6;
    margin-bottom: 1.25rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nx-blog-card-excerpt p {
    margin: 0;
}

.nx-blog-card-excerpt * {
    font-size: inherit;
    color: inherit;
    line-height: inherit;
}

/* ============================================================
   BLOG CARD FOOTER / READ MORE
   ============================================================ */

.nx-blog-card-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.nx-blog-card-read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.5rem 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--bs-primary, #0d6efd);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.nx-blog-card-read-more::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--bs-primary, #0d6efd);
    transition: width 0.3s ease;
}

.nx-blog-card-read-more:hover {
    color: var(--bs-primary, #0d6efd);
    gap: 0.75rem;
}

.nx-blog-card-read-more:hover::after {
    width: 100%;
}

.nx-blog-card-read-more-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.nx-blog-card-read-more:hover .nx-blog-card-read-more-icon {
    transform: translateX(4px);
}

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */

@media (max-width: 576px) {
    .nx-blog-card-image-wrapper {
        border-radius: 12px 12px 0 0;
    }
    
    .nx-blog-card-excerpt {
        -webkit-line-clamp: 2;
    }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */

.nx-blog-card:focus-within {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: 4px;
    border-radius: 16px;
}

.nx-blog-card-read-more:focus-visible {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nx-blog-card {
    animation: fadeInUp 0.6s ease-out;
}

.nx-blog-card:nth-child(1) { animation-delay: 0.1s; }
.nx-blog-card:nth-child(2) { animation-delay: 0.2s; }
.nx-blog-card:nth-child(3) { animation-delay: 0.3s; }

@keyframes gradient-shift {
    0% {
        background-position: 0% center;
    }
    50% {
        background-position: 100% center;
    }
    100% {
        background-position: 0% center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nx-blog-card {
        animation: none;
    }
    
    .nx-blog-card-image {
        transition: none;
    }
    
    .nx-blog-card::before {
        animation: none;
    }
}
