/**
 * Blog Index Page Styles
 * Will and Estate Lawyers Australia
 * 
 * File: /assets/css/blog-index.css
 * Add to functions.php: wp_enqueue_style('wela-blog-index', get_stylesheet_directory_uri() . '/assets/css/blog-index.css');
 */

/* ============================================
   CSS VARIABLES (inherit from main theme)
   ============================================ */

:root {
    --navy: #1e3a5f;
    --navy-dark: #152944;
    --pink: #f4a5b9;
    --pink-light: #ffd6e3;
    --pink-dark: #e88ea5;
    --gray: #f8f9fa;
    --gray-dark: #6c757d;
    --gray-light: #e9ecef;
    --white: #ffffff;
}

/* ============================================
   HERO SECTION
   ============================================ */

.blog-hero {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
    padding: 4rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.blog-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--pink) 0%, transparent 70%);
    opacity: 0.1;
    pointer-events: none;
}

.blog-hero-container {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.blog-hero-badge {
    display: inline-block;
    background-color: rgba(244, 165, 185, 0.2);
    color: var(--pink-light);
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.blog-hero h1 {
    font-size: 2.75rem;
    color: var(--white);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.blog-hero-subtitle {
    font-size: 1.25rem;
    color: var(--pink-light);
    max-width: 700px;
    margin: 0 auto 2rem auto;
}

/* Search Box */
.blog-search-container {
    max-width: 600px;
    margin: 0 auto;
}

.blog-search-box {
    display: flex;
    background-color: var(--white);
    border-radius: 9999px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.blog-search-input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    font-size: 1rem;
    outline: none;
}

.blog-search-input::placeholder {
    color: var(--gray-dark);
}

.blog-search-btn {
    padding: 1rem 2rem;
    background-color: var(--pink);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.blog-search-btn:hover {
    background-color: var(--pink-dark);
}

.blog-search-btn svg {
    color: var(--navy);
}

/* ============================================
   CATEGORY FILTER
   ============================================ */

.category-filter-section {
    background-color: var(--white);
    padding: 1.5rem 1.5rem;
    border-bottom: 1px solid var(--gray-light);
    position: sticky;
    top: 130px;
    z-index: 50;
}

.category-filter-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
}

.category-filter-container::-webkit-scrollbar {
    height: 4px;
}

.category-filter-container::-webkit-scrollbar-track {
    background: transparent;
}

.category-filter-container::-webkit-scrollbar-thumb {
    background: var(--gray-light);
    border-radius: 2px;
}

.category-filter-label {
    font-weight: 600;
    color: var(--navy);
    white-space: nowrap;
    flex-shrink: 0;
}

.category-filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.category-btn {
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.category-btn-all {
    background-color: var(--navy);
    color: var(--white);
}

.category-btn-all:hover {
    background-color: var(--navy-dark);
}

.category-btn-default {
    background-color: var(--gray);
    color: var(--navy);
}

.category-btn-default:hover {
    background-color: var(--pink-light);
    border-color: var(--pink);
}

.category-btn-active {
    background-color: var(--pink-light);
    color: var(--navy);
    border-color: var(--pink);
}

/* ============================================
   SECTION HEADERS
   ============================================ */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.5rem;
    color: var(--navy);
    font-weight: 700;
}

.section-link {
    color: var(--pink-dark);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.section-link:hover {
    color: var(--navy);
}

/* ============================================
   FEATURED ARTICLES SECTION
   ============================================ */

.featured-section {
    background-color: var(--gray);
    padding: 3rem 1.5rem;
}

.featured-container {
    max-width: 1280px;
    margin: 0 auto;
}

.featured-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* Featured Large Card */
.featured-card-large {
    display: flex;
    flex-direction: column;
    background-color: var(--white);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    text-decoration: none;
}

.featured-card-large:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
}

.featured-card-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
}

.featured-card-content {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.featured-card-category {
    display: inline-block;
    background-color: var(--pink-light);
    color: var(--navy);
    padding: 0.375rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
    width: fit-content;
}

.featured-card-title {
    font-size: 1.5rem;
    color: var(--navy);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.featured-card-excerpt {
    color: var(--gray-dark);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex: 1;
}

.featured-card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--gray-dark);
}

.featured-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* Featured Stack Cards */
.featured-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.featured-card-small {
    display: flex;
    background-color: var(--white);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    text-decoration: none;
}

.featured-card-small:hover {
    transform: translateX(5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.featured-card-small-image {
    width: 180px;
    height: 140px;
    object-fit: cover;
    flex-shrink: 0;
}

.featured-card-small-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.featured-card-small-category {
    display: inline-block;
    background-color: var(--pink-light);
    color: var(--navy);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    width: fit-content;
}

.featured-card-small-title {
    font-size: 1rem;
    color: var(--navy);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.featured-card-small-meta {
    font-size: 0.8125rem;
    color: var(--gray-dark);
}

/* ============================================
   CATEGORY HIGHLIGHT SECTIONS
   ============================================ */

.category-highlight-section {
    padding: 4rem 1.5rem;
}

.category-highlight-section:nth-child(even) {
    background-color: var(--gray);
}

.category-highlight-container {
    max-width: 1280px;
    margin: 0 auto;
}

.category-highlight-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--pink);
}

.category-highlight-title {
    font-size: 1.75rem;
    color: var(--navy);
}

.category-highlight-description {
    color: var(--gray-dark);
    font-size: 0.9375rem;
    margin-top: 0.5rem;
}

/* Horizontal Scroll Cards */
.category-cards-scroll {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.category-cards-scroll::-webkit-scrollbar {
    height: 6px;
}

.category-cards-scroll::-webkit-scrollbar-track {
    background: var(--gray-light);
    border-radius: 3px;
}

.category-cards-scroll::-webkit-scrollbar-thumb {
    background: var(--pink);
    border-radius: 3px;
}

.category-card {
    min-width: 320px;
    flex-shrink: 0;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    background-color: var(--white);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    text-decoration: none;
    border: 1px solid var(--gray-light);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
}

.category-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.category-card-content {
    padding: 1.25rem;
}

.category-card-title {
    font-size: 1rem;
    color: var(--navy);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.category-card-meta {
    font-size: 0.8125rem;
    color: var(--gray-dark);
}

/* ============================================
   ALL ARTICLES GRID
   ============================================ */

.articles-section {
    background-color: var(--white);
    padding: 4rem 1.5rem;
}

.articles-container {
    max-width: 1280px;
    margin: 0 auto;
}

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

/* Article Card */
.article-card {
    display: flex;
    flex-direction: column;
    background-color: var(--white);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    text-decoration: none;
    border: 1px solid var(--gray-light);
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
    border-color: var(--pink);
}

.article-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

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

.article-card-category {
    display: inline-block;
    background-color: var(--pink-light);
    color: var(--navy);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    width: fit-content;
}

.article-card-title {
    font-size: 1.125rem;
    color: var(--navy);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.article-card-excerpt {
    color: var(--gray-dark);
    font-size: 0.9375rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    flex: 1;
}

.article-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
    color: var(--gray-dark);
    padding-top: 1rem;
    border-top: 1px solid var(--gray-light);
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.pagination a,
.pagination span {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.pagination .prev,
.pagination .next {
    background-color: var(--navy);
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination .prev:hover,
.pagination .next:hover {
    background-color: var(--navy-dark);
}

.pagination .page-numbers {
    background-color: var(--gray);
    color: var(--navy);
    min-width: 2.5rem;
    text-align: center;
}

.pagination .page-numbers:hover {
    background-color: var(--pink-light);
}

.pagination .page-numbers.current {
    background-color: var(--pink);
    color: var(--navy);
}

/* WordPress default pagination */
.pagination ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 0.5rem;
}

.pagination li {
    margin: 0;
}

/* ============================================
   POPULAR TOPICS SECTION
   ============================================ */

.topics-section {
    background-color: var(--gray);
    padding: 3rem 1.5rem;
}

.topics-container {
    max-width: 1280px;
    margin: 0 auto;
}

.topics-header {
    text-align: center;
    margin-bottom: 2rem;
}

.topics-title {
    font-size: 1.5rem;
    color: var(--navy);
    margin-bottom: 0.5rem;
}

.topics-subtitle {
    color: var(--gray-dark);
    font-size: 1rem;
}

.topics-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.topic-tag {
    padding: 0.625rem 1.25rem;
    background-color: var(--white);
    color: var(--navy);
    text-decoration: none;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 2px solid var(--gray-light);
    transition: all 0.2s;
}

.topic-tag:hover {
    background-color: var(--pink-light);
    border-color: var(--pink);
}

.topic-tag-count {
    display: inline-block;
    background-color: var(--gray);
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* ============================================
   CTA SECTION
   ============================================ */

.cta-section {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
    padding: 4rem 1.5rem;
    text-align: center;
}

.cta-container {
    max-width: 800px;
    margin: 0 auto;
}

.cta-section h2 {
    color: var(--white);
    font-size: 2.25rem;
    margin-bottom: 1rem;
}

.cta-section p {
    color: var(--pink-light);
    font-size: 1.125rem;
    margin-bottom: 2rem;
}

.cta-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.cta-button-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background-color: var(--pink);
    color: var(--navy);
    text-decoration: none;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s;
}

.cta-button-primary:hover {
    background-color: var(--pink-dark);
    transform: translateY(-2px);
}

.cta-button-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background-color: transparent;
    color: var(--white);
    text-decoration: none;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 1rem;
    border: 2px solid var(--pink);
    transition: all 0.2s;
}

.cta-button-secondary:hover {
    background-color: rgba(244, 165, 185, 0.1);
    transform: translateY(-2px);
}

/* ============================================
   NEWSLETTER SECTION
   ============================================ */

.newsletter-section {
    background-color: var(--white);
    padding: 3rem 1.5rem;
    border-top: 1px solid var(--gray-light);
}

.newsletter-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.newsletter-icon {
    width: 60px;
    height: 60px;
    background-color: var(--pink-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
}

.newsletter-icon svg {
    color: var(--navy);
}

.newsletter-title {
    font-size: 1.5rem;
    color: var(--navy);
    margin-bottom: 0.5rem;
}

.newsletter-subtitle {
    color: var(--gray-dark);
    margin-bottom: 1.5rem;
}

.newsletter-form {
    display: flex;
    gap: 0.75rem;
    max-width: 500px;
    margin: 0 auto;
}

.newsletter-input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--gray-light);
    border-radius: 9999px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.newsletter-input:focus {
    border-color: var(--pink);
}

.newsletter-btn {
    padding: 0.875rem 1.5rem;
    background-color: var(--navy);
    color: var(--white);
    border: none;
    border-radius: 9999px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.newsletter-btn:hover {
    background-color: var(--navy-dark);
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

@media (max-width: 1023px) {
    .featured-grid {
        grid-template-columns: 1fr;
    }
    
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .blog-hero {
        padding: 3rem 1rem;
    }

    .blog-hero h1 {
        font-size: 2rem;
    }

    .blog-hero-subtitle {
        font-size: 1rem;
    }

    .category-filter-section {
        top: 100px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .featured-card-image {
        height: 200px;
    }

    .cta-section h2 {
        font-size: 1.75rem;
    }
    
    .category-highlight-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

@media (max-width: 640px) {
    .featured-card-small {
        flex-direction: column;
    }

    .featured-card-small-image {
        width: 100%;
        height: 160px;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .category-card {
        min-width: 280px;
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .cta-button-primary,
    .cta-button-secondary {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
}

/* ============================================
   HELPER FUNCTION (add to functions.php)
   ============================================ */

/*
// Add this to your theme's functions.php:

function wela_reading_time() {
    $content = get_post_field('post_content', get_the_ID());
    $word_count = str_word_count(strip_tags($content));
    $reading_time = ceil($word_count / 200); // Average reading speed
    return max(1, $reading_time);
}
*/
