/* ============================
   ARTICLES LIST
============================ */

.articles-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg, 24px);
}

@media (min-width: 768px) {
    .articles-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .articles-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================
   ARTICLE CARD
============================ */

.article-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-soft, #e5e7eb);
    border-radius: var(--radius-lg, 12px);
    background: var(--bg-card, #ffffff);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    height: 100%;
}

.article-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    border-color: var(--primary, #2c5282);
}

.article-card a {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    /*height: 100%;*/
}

/* ============================
   THUMBNAIL
============================ */

.article-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    flex-shrink: 0;
}

.article-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.article-card:hover .article-thumb img {
    transform: scale(1.05);
}

/* Placeholder quando non c'è immagine */
.article-thumb.placeholder::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23cbd5e0'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z'/%3E%3C/svg%3E");
    opacity: 0.3;
}

/* ============================
   CONTENT
============================ */

.article-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-md, 20px);
    gap: 12px;
}

/* Category Badge */
.article-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary, #2c5282);
    text-decoration: none;
    transition: color 0.2s ease;
}

.article-category:hover {
    color: var(--primary-dark, #1a365d);
}

.article-category svg {
    width: 14px;
    height: 14px;
}

/* Title */
.article-content h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary, #1a202c);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Excerpt */
.article-excerpt {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary, #64748b);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================
   META & FOOTER
============================ */

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted, #94a3b8);
    margin-top: auto;
}

.article-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.article-meta-item svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

/* Tags */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 var(--space-md, 20px) var(--space-md, 20px);
}

.article-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-subtle, #f8fafc);
    color: var(--text-secondary, #64748b);
    border: 1px solid var(--border-soft, #e5e7eb);
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.article-tag:hover {
    background: var(--primary, #2c5282);
    color: white;
    border-color: var(--primary, #2c5282);
}

.article-tag::before {
    content: '#';
    opacity: 0.6;
    margin-right: 2px;
}

/* Read More Button */
.article-footer {
    padding: 0 var(--space-md, 20px) var(--space-md, 20px);
    margin-top: auto;
}

.btn-read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary, #2c5282);
    background: transparent;
    border: 1px solid var(--border-soft, #e5e7eb);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-read-more:hover {
    background: var(--primary, #2c5282);
    color: white;
    border-color: var(--primary, #2c5282);
    transform: translateX(2px);
}

.btn-read-more svg {
    width: 16px;
    height: 16px;
}

/* ============================
   AD CARD
============================ */

.article-card.ad-card {
    border-style: dashed;
    background: linear-gradient(135deg, #fafbfc 0%, #f5f7fa 100%);
    opacity: 0.95;
}

.article-card.ad-card .article-content {
    gap: 8px;
}

.article-card.ad-card .sponsored-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #94a3b8);
}

.article-card.ad-card .sponsored-badge svg {
    width: 12px;
    height: 12px;
}

/* ============================
   EMPTY STATE
============================ */

.articles-empty {
    grid-column: 1 / -1;
    padding: var(--space-xl, 48px) var(--space-lg, 24px);
    text-align: center;
    color: var(--text-secondary, #64748b);
}

.articles-empty svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    opacity: 0.3;
}

/* ============================
   LOADING STATE
============================ */

body.is-loading {
    cursor: progress;
}

.article-card.skeleton {
    pointer-events: none;
}

.article-card.skeleton .article-thumb,
.article-card.skeleton h3,
.article-card.skeleton .article-excerpt,
.article-card.skeleton .article-meta {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

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

/* ============================
   ARTICLE VIEW (singolo articolo)
============================ */

.article-view {
    max-width: 800px;
    margin: 0 auto;
}

.article-header {
    margin-bottom: var(--space-xl, 48px);
    text-align: center;
}

.article-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 16px;
}

.article-header .article-meta {
    justify-content: center;
    font-size: 0.9rem;
}

.article-content-static {
    line-height: 1.75;
    font-size: 1.0625rem;
    color: var(--text-primary, #1a202c);
}

.article-content-static img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 24px 0;
}

.article-content-static h2,
.article-content-static h3 {
    margin-top: 32px;
    margin-bottom: 16px;
    font-weight: 600;
}

.article-content-static p {
    margin-bottom: 16px;
}

.article-related {
    margin-top: var(--space-xl, 48px);
    padding-top: var(--space-xl, 48px);
    border-top: 2px solid var(--border-soft, #e5e7eb);
}

.article-related h3 {
    font-size: 1.5rem;
    margin-bottom: var(--space-lg, 24px);
    color: var(--text-primary, #1a202c);
}

/* ============================
   UTILITIES
============================ */

.muted {
    color: var(--text-muted, #94a3b8);
}

.text-primary {
    color: var(--primary, #2c5282);
}

/* Responsive tweaks */
@media (max-width: 767px) {
    .article-header h1 {
        font-size: 1.875rem;
    }
    
    .article-content h3 {
        font-size: 1rem;
    }
    
    .articles-list {
        gap: var(--space-md, 16px);
    }
}