/* Base Layout */
.articoli-page {
    background-color: #000;
    min-height: 100vh;
    padding-top: 80px;
    /* Space for fixed navbar */
    font-family: 'Century Gothic', Arial, sans-serif;
}

/* Hero Section */
.articoli-hero {
    position: relative;
    padding: 60px 20px 40px;
    background: linear-gradient(to bottom, #1a1a1a, #000);
    text-align: center;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 20px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.hero-filters {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.filter-tag {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 16px;
    border: 1px solid #333;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.filter-tag:hover,
.filter-tag.active {
    background-color: #b43d9e;
    /* Consistent with site accent */
    border-color: #b43d9e;
}

/* Search Bar */
.search-bar-wrapper {
    margin: 24px auto 0;
    max-width: 560px;
    width: 100%;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    padding: 12px 20px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    backdrop-filter: blur(8px);
}

.search-bar:focus-within {
    border-color: #b43d9e;
    box-shadow: 0 0 0 3px rgba(180, 61, 158, 0.25);
}

.search-icon {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
    min-height: 18px;
    max-width: 18px;
    max-height: 18px;
    color: #888;
    flex-shrink: 0;
    transition: color 0.25s ease;
    display: block;
}

.search-bar:focus-within .search-icon {
    color: #b43d9e;
}

#articoli-search {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 1rem;
    font-family: 'Century Gothic', Arial, sans-serif;
    caret-color: #b43d9e;
}

#articoli-search::placeholder {
    color: #666;
}

/* Hide the native clear button on webkit */
#articoli-search::-webkit-search-cancel-button {
    display: none;
}

.search-clear {
    background: transparent;
    border: none;
    color: #666;
    font-size: 1rem;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.2s ease;
}

.search-clear:hover {
    color: #b43d9e;
}

.search-no-results {
    margin-top: 12px;
    color: #888;
    font-size: 0.9rem;
    text-align: center;
}

/* Search active: uniform 2-column grid, all cards same size */
.articoli-grid.search-active {
    grid-template-columns: repeat(2, 1fr) !important;
}

.articoli-grid.search-active .articolo-card {
    grid-column: span 1 !important;
}

.articoli-grid.search-active .card-title {
    font-size: 1.4rem !important;
}

@media (max-width: 600px) {
    .articoli-grid.search-active {
        grid-template-columns: 1fr !important;
    }
}

/* Grid Container */
.articoli-grid-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

/* AdSense 3-column layout */
.adsense-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.adsense-sidebar {
    flex: 0 0 160px;
    min-width: 160px;
    position: sticky;
    top: 100px;
    min-height: 600px;
    background: #111;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 0;
    gap: 20px;
}

.articoli-main-content {
    flex: 1 1 auto;
    min-width: 0;
}


.articoli-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

/* Card Styles */
.articolo-card {
    background: transparent;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.articolo-card:hover {
    transform: translateY(-5px);
}

.card-link {
    text-decoration: none;
    color: #fff;
    display: block;
}

.card-image-wrapper {
    position: relative;
    padding-top: 56.25%;
    /* 16:9 Aspect Ratio */
    background: #111;
    overflow: hidden;
    border-radius: 8px;
}

.card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.card-content {
    padding: 15px 0;
}

.card-title {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 10px;
    color: #fff;
}

.featured .card-title {
    font-size: 1.8rem;
}

.card-summary {
    font-size: 0.95rem;
    color: #ccc;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Featured Articles (Span 2 columns on desktop if desired, but let's keep it simple grid for now or make first 2 distinct) */
/* For a true "Geopop" feel, we might want the first row to be 2 large cards */

.featured {
    grid-column: span 1;
    /* Default to 1 column */
}

/* Responsive specific override for "Featured" to be larger could be added here if we had a specific layout */
/* Currently keeping grid uniform for simplicity but distinct in styling size */


/* Responsive Design */
/* Grid Logic: Pattern of 6
   1st: Big (Span 6)
   2nd, 3rd: Medium (Span 3)
   4th, 5th, 6th: Small (Span 2)
*/

@media (min-width: 900px) {
    .articoli-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    /* 1: Big */
    .articolo-card:nth-child(6n+1) {
        grid-column: span 6;
    }

    .articolo-card:nth-child(6n+1) .card-title {
        font-size: 2.5rem;
    }

    /* 2, 3: Medium */
    .articolo-card:nth-child(6n+2),
    .articolo-card:nth-child(6n+3) {
        grid-column: span 3;
    }

    .articolo-card:nth-child(6n+2) .card-title,
    .articolo-card:nth-child(6n+3) .card-title {
        font-size: 1.8rem;
    }

    /* 4, 5, 6: Small (Standard) */
    .articolo-card:nth-child(6n+4),
    .articolo-card:nth-child(6n+5),
    .articolo-card:nth-child(6n) {
        grid-column: span 2;
    }
}


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

    .featured,
    .standard {
        grid-column: span 1;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    /* Hide sidebars on medium screens */
    .adsense-sidebar {
        display: none;
    }
}

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

    .featured,
    .standard {
        grid-column: span 1;
    }

    .hero-title {
        font-size: 2rem;
    }
}

.no-articles {
    text-align: center;
    color: #fff;
    padding: 40px;
    font-size: 1.2rem;
}