/* ============================================
   BLOG ARCHIVE — FIGMA MATCH v4.0
   Equal-Height Rows + Primary Color Active States
   Dev: Paul .Y 20260328

   v4.0: Equal-height rows (flex stretch per row)
         Active tab/pagination → bg-Primary (#928572)
         Image h-80 (320px) not 350px
         Grid container 1280px
         Default 9 posts (3×3)
   v3.2: Active/hover color → #5A4F42
   v3.1: Smart pagination inline SVG
   v3.0: Afacad Flux + Figma tokens
   ============================================ */


/* ===================================
   CSS VARIABLES (Figma Design Tokens)
   =================================== */

:root {
    --blog-dark-text: #2A2A2A;   /* Dark-Text */
    --blog-light-text: #666666;  /* Light-Text */
    --blog-primary: #928572;     /* Primary — active tabs, pagination, interactive */
    --blog-600: #928A80;         /* text-600 — inactive tab text */
    --blog-400: #CCC8C0;         /* outline-400 — dividers */
    --blog-200: #EFEDEB;         /* bg-200 — tab bg, breadcrumb bg */
    --blog-100: #FAF9F7;         /* bg-100 — light bg sections */
    --blog-white: #FFFFFF;
}


/* ===================================
   PILL-STYLE CATEGORY TABS
   Figma: inline-flex gap-2.5 (10px), centered
   Active: bg-Primary text-White
   Inactive: bg-200 text-600
   =================================== */

.blog-filter-section {
    background: var(--blog-white);
    padding: 30px 0 40px 0;
    width: 100%;
    display: flex;
    justify-content: center;
}

.blog-filter-container {
    max-width: 1440px;
    width: 100%;
    padding: 0 80px;
    display: flex;
    justify-content: center;
}

.blog-category-filters {
    display: inline-flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

/* Pill Tab Base — Afacad Flux 14px 400, bg-200, text-600 */
.category-filter-tab {
    font-family: 'Afacad Flux', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: var(--blog-600);
    text-decoration: none;
    text-transform: capitalize;
    padding: 10px 20px;
    background: var(--blog-200);
    border-radius: 50px;
    border: none;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
}

.category-filter-tab:hover {
    background: var(--blog-primary);
    color: var(--blog-white);
}

/* Active — bg-Primary + text-White (Figma: data-state="Hover" on active) */
.category-filter-tab.active {
    background: var(--blog-primary);
    color: var(--blog-white);
    font-weight: 400;
}

.category-filter-tab.active:hover {
    background: #7A7062;
    color: var(--blog-white);
}


/* ===================================
   BLOG POSTS SECTION
   =================================== */

.blog-posts-section {
    background: var(--blog-white);
    padding: 80px 0;
    width: 100%;
    display: flex;
    justify-content: center;
}

.blog-posts-container {
    max-width: 1440px;
    width: 100%;
    padding: 0 80px;
}


/* ===================================
   BLOG POSTS GRID
   Figma: w-[1280px], gap-7 (28px) rows, gap-5 (20px) cols
   Equal-height rows: each row stretches cards to match
   =================================== */

.blog-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px 20px;
    margin-bottom: 60px;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}


/* ===================================
   BLOG CARD
   Figma: w-96 (384px at 1280 grid)
   Equal height via grid stretch + flex column
   =================================== */

.blog-card {
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: relative;
    /* Grid stretches height automatically per row */
}

/* Vertical Divider Lines — outline-400 (#CCC8C0) */
.blog-card:nth-child(3n+2)::before,
.blog-card:nth-child(3n)::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--blog-400);
}

/* Card Content Section (TOP) — flex-1 stretches to fill equal height */
.blog-card-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    order: 1;
    flex: 1;  /* KEY: makes content stretch so all cards in row match height */
}

/* Meta Row: Date (left) + Category Tag (right) */
.blog-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

/* Date — Afacad Flux 14px 300 Light-Text */
.blog-card-date {
    font-family: 'Afacad Flux', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    font-weight: 300;
    color: var(--blog-light-text);
    font-style: normal;
}

/* Category Tag — Afacad Flux 12px 400 Dark-Text, border Dark-Text */
.blog-card-category {
    font-family: 'Afacad Flux', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: var(--blog-dark-text);
    padding: 5px 10px;
    border: 0.5px solid var(--blog-dark-text);
    border-radius: 0;
    background: transparent;
    white-space: nowrap;
}

/* Title & Excerpt */
.blog-card-title-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.blog-card-title {
    margin: 0;
}

.blog-card-title a {
    font-family: 'Afacad Flux', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 24px;
    font-weight: 400;
    line-height: 1.3;
    color: var(--blog-dark-text);
    text-decoration: none;
    text-transform: capitalize;
    transition: color 0.3s ease;
    display: block;
}

.blog-card-title a:hover {
    color: var(--blog-light-text);
}

/* Excerpt — Afacad Flux 18px 300 Light-Text */
.blog-card-excerpt {
    font-family: 'Afacad Flux', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 18px;
    font-weight: 300;
    line-height: 1.3;
    color: var(--blog-light-text);
    margin: 0;
}


/* ===================================
   BLOG CARD IMAGE (BOTTOM)
   Figma: self-stretch h-80 (320px)
   =================================== */

.blog-card-image {
    width: 100% !important;
    height: 320px !important;
    min-height: 320px !important;
    max-height: 320px !important;
    overflow: hidden !important;
    order: 2;
    flex-shrink: 0;
    position: relative;
}

.blog-card-image a {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

/* Override Elementor img rules */
.blog-archive-shortcode .blog-card-image img,
.blog-archive-shortcode .blog-card-image img.blog-card-thumbnail,
.blog-card-image img,
.blog-card-image img.blog-card-thumbnail,
.blog-card-thumbnail,
.elementor .blog-card-image img,
.elementor-widget-container .blog-card-image img {
    width: 100% !important;
    height: 100% !important;
    min-height: 320px !important;
    max-width: none !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* Hover zoom */
.blog-card:hover .blog-card-thumbnail {
    transform: scale(1.05);
}

.blog-card-image img {
    transition: transform 0.3s ease;
}


/* ===================================
   NO POSTS
   =================================== */

.no-blog-posts {
    text-align: center;
    padding: 80px 20px;
}

.no-blog-posts p {
    font-family: 'Afacad Flux', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 18px;
    color: var(--blog-light-text);
}


/* ===================================
   PAGINATION — FIGMA v4.0
   Active: bg-Primary text-White
   Inactive: outline-Primary text-Primary
   Hover: bg-Primary text-White
   Dots: no border, text-Primary
   =================================== */

.blog-pagination {
    display: flex;
    justify-content: center;
    margin-top: 60px;
}

.blog-pagination .page-numbers {
    display: flex;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.blog-pagination .page-numbers li {
    list-style: none;
}

/* Base button (numbers + nav)
   Figma: outline-Primary, text-Primary */
.blog-pagination .page-numbers a,
.blog-pagination .page-numbers span {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 40px !important;
    height: 40px !important;
    padding: 6px 14px !important;
    font-family: 'Afacad Flux', -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-size: 20px !important;
    font-weight: 400 !important;
    /*color: var(--blog-primary) !important;*/
     color: #5A4F42!important;
    text-decoration: none !important;
    border: 1px solid #5A4F42!important;
    border-radius: 0 !important;
    background: transparent !important;
    transition: all 0.3s ease !important;
    box-sizing: border-box !important;
}

/* Hover — bg-Primary, text-White */
.blog-pagination .page-numbers a:hover {
    background: #5A4F42!important;
    color: var(--blog-white) !important;
    border-color: #5A4F42!important;
}

/* Current / Selected — bg-Primary, text-White */
.blog-pagination .page-numbers .current {
    background: #5A4F42!important;
    color: var(--blog-white) !important;
    border-color: #5A4F42!important;
}

/* Dots / Ellipsis */
.blog-pagination .page-numbers .dots {
    border: none !important;
    background: transparent !important;
    min-width: auto !important;
    padding: 0 4px !important;
    color: var(--blog-primary) !important;
    font-size: 20px !important;
    cursor: default !important;
    pointer-events: none !important;
}

/* Navigation arrow buttons */
.blog-pagination .page-numbers a.page-nav {
    display: flex !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    justify-content: center !important;
    align-items: center !important;
    flex-shrink: 0 !important;
}

.blog-pagination .page-numbers a.page-nav svg {
    display: block !important;
    width: 24px !important;
    height: 24px !important;
    flex-shrink: 0 !important;
    color: #5A4F42!important;
    transition: color 0.3s ease !important;
}

.blog-pagination .page-numbers a.page-nav:hover svg {
    color: var(--blog-white) !important;
}


/* ===================================
   FULL-WIDTH BREAKOUT (Elementor compat)
   =================================== */

.blog-archive-shortcode {
    width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    overflow-x: hidden;
}


/* ===================================
   RESPONSIVE: Tablet Landscape (1024px - 1279px)
   3 columns, fluid widths
   =================================== */

@media (max-width: 1279px) {
    .blog-filter-container,
    .blog-posts-container {
        padding: 0 60px;
    }

    .blog-posts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 28px 20px;
    }

    .blog-card-image,
    .blog-archive-shortcode .blog-card-image {
        height: 280px !important;
        min-height: 280px !important;
        max-height: 280px !important;
    }

    .blog-archive-shortcode .blog-card-image img,
    .blog-card-image img {
        min-height: 280px !important;
    }
}


/* ===================================
   RESPONSIVE: Tablet Portrait (768px - 1023px)
   2 columns
   =================================== */

@media (max-width: 1023px) {
    .blog-filter-container,
    .blog-posts-container {
        padding: 0 40px;
    }

    .blog-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 28px 20px;
    }

    .blog-card-image,
    .blog-archive-shortcode .blog-card-image {
        height: 260px !important;
        min-height: 260px !important;
        max-height: 260px !important;
    }

    .blog-archive-shortcode .blog-card-image img,
    .blog-card-image img {
        min-height: 260px !important;
    }

    /* Remove 3-col dividers, add 2-col dividers */
    .blog-card:nth-child(3n+2)::before,
    .blog-card:nth-child(3n)::before {
        display: none;
    }

    .blog-card:nth-child(2n)::before {
        content: '';
        position: absolute;
        left: -10px;
        top: 0;
        bottom: 0;
        width: 1px;
        background: var(--blog-400);
    }

    /* Pagination tablet */
    .blog-pagination .page-numbers {
        gap: 8px;
    }

    .blog-pagination .page-numbers a,
    .blog-pagination .page-numbers span {
        min-width: 38px;
        height: 38px;
        font-size: 18px;
        padding: 5px 12px;
    }

    .blog-pagination .page-numbers a.page-nav {
        width: 38px;
        height: 38px;
    }

    .blog-pagination .page-numbers a.page-nav svg {
        width: 22px;
        height: 22px;
    }
}


/* ===================================
   RESPONSIVE: Mobile (≤767px)
   1 column, no dividers
   =================================== */

@media (max-width: 767px) {
    .blog-filter-container,
    .blog-posts-container {
        padding: 0 20px;
    }

    .blog-filter-section {
        padding: 20px 0 30px 0;
    }

    /* Category tabs — wrap naturally, max ~3 per row, left-aligned */
    .blog-category-filters {
        gap: 10px;
        overflow-x: visible;
        padding-bottom: 0;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .category-filter-tab {
        font-size: 14px;
        padding: 10px 20px;
        flex-shrink: 0;
    }

    .blog-posts-section {
        padding: 50px 0;
    }

    .blog-posts-grid {
        grid-template-columns: 1fr;
        gap: 40px;
        margin-bottom: 40px;
    }

    .blog-card-image,
    .blog-archive-shortcode .blog-card-image {
        width: 100% !important;
        height: auto !important;
        min-height: unset !important;
        max-height: unset !important;
        aspect-ratio: 384 / 320;
    }

    .blog-archive-shortcode .blog-card-image img,
    .blog-card-image img {
        min-height: unset !important;
        height: 100% !important;
    }

    /* No dividers on mobile */
    .blog-card::before,
    .blog-card:nth-child(2n)::before,
    .blog-card:nth-child(3n)::before,
    .blog-card:nth-child(3n+2)::before {
        display: none !important;
    }

    .blog-card-content {
        gap: 10px;
    }

    .blog-card-title a {
        font-size: 20px;
    }

    .blog-card-excerpt {
        font-size: 16px;
    }

    /* Pagination Mobile */
    .blog-pagination {
        margin-top: 40px;
    }

    .blog-pagination .page-numbers {
        gap: 6px;
    }

    .blog-pagination .page-numbers a,
    .blog-pagination .page-numbers span {
        min-width: 36px;
        height: 36px;
        font-size: 16px;
        padding: 5px 10px;
    }

    .blog-pagination .page-numbers a.page-nav {
        width: 36px;
        height: 36px;
    }

    .blog-pagination .page-numbers a.page-nav svg {
        width: 20px;
        height: 20px;
    }

    /* Hide double arrows on mobile */
    .blog-pagination .page-numbers a[aria-label="First page"],
    .blog-pagination .page-numbers a[aria-label="Last page"] {
        display: none;
    }
}


/* ===================================
   RESPONSIVE: Small Mobile (≤480px)
   =================================== */

@media (max-width: 480px) {
    .blog-card-title a {
        font-size: 18px;
    }

    .blog-card-excerpt {
        font-size: 14px;
    }

    .blog-card-date {
        font-size: 12px;
    }

    .blog-card-category {
        font-size: 11px;
        padding: 4px 8px;
    }

    .blog-pagination .page-numbers a,
    .blog-pagination .page-numbers span {
        min-width: 32px;
        height: 32px;
        font-size: 14px;
        padding: 4px 8px;
    }

    .blog-pagination .page-numbers a.page-nav {
        width: 32px;
        height: 32px;
    }

    .blog-pagination .page-numbers a.page-nav svg {
        width: 18px;
        height: 18px;
    }
}


/* ===================================
   UTILITY
   =================================== */

.blog-card-read-more {
    display: none !important;
}


/* ===================================
   PRINT
   =================================== */

@media print {
    .blog-filter-section,
    .blog-pagination {
        display: none;
    }

    .blog-card-image {
        break-inside: avoid;
    }
}