/* Blog Section Styles */

/* Blog Section on Homepage */
.blog-section {
    padding: 150px 0;
    background-color: var(--light-color);
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.blog-card {
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.blog-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.blog-image {
    height: 200px;
    overflow: hidden;
}

.blog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.blog-card:hover .blog-image img {
    transform: scale(1.1);
}

.blog-content {
    padding: 20px;
    margin-bottom: 40px;
    font-family: 'Montserrat', sans-serif;
    color: #2c2c2c;
    line-height: 1.8;
}

/* Enhanced post content styling */
.post-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
}

.post-content h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin: 40px 0 25px;
    font-weight: 700;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    counter-increment: section;
}

.post-content h2:first-of-type {
    margin-top: 30px;
}

.post-content p {
    margin-bottom: 25px;
    line-height: 1.9;
    text-align: justify;
    color: #444;
    font-size: 1.1rem;
    text-indent: 1.5em;
}

.post-header {
    margin-top: 50px;
}

.post-content p:first-of-type {
    text-indent: 0;
    font-size: 1.2rem;
    font-weight: 500;
    color: #333;
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    padding: 20px;
    margin: 30px 0;
    border-radius: 0 8px 8px 0;
}

/* Titoli e sottotitoli nel contenuto */
.post-content h1 {
    font-size: 2.4rem;
    color: var(--secondary-color);
    margin: 40px 0 20px;
    font-weight: 700;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 10px;
}

.post-content h2 {
    font-size: 2rem;
    color: var(--secondary-color);
    margin: 35px 0 18px;
    font-weight: 600;
    position: relative;
    padding-left: 20px;
}

.post-content h2:before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 30px;
    background: linear-gradient(to bottom, var(--primary-color), var(--accent-color));
    border-radius: 2px;
}

.post-content h3 {
    font-size: 1.6rem;
    color: var(--secondary-color);
    margin: 30px 0 15px;
    font-weight: 600;
}

.post-content h4 {
    font-size: 1.3rem;
    color: var(--secondary-color);
    margin: 25px 0 12px;
    font-weight: 500;
}

.post-content h5 {
    font-size: 1.1rem;
    color: var(--secondary-color);
    margin: 20px 0 10px;
    font-weight: 500;
}

.post-content h6 {
    font-size: 1rem;
    color: var(--text-color);
    margin: 18px 0 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Paragrafi e testo */
.post-content p {
    margin-bottom: 20px;
    line-height: 1.8;
    text-align: justify;
    color: #444;
    font-size: 1.05rem;
}

.post-content p:first-child {
    font-size: 1.15rem;
    color: #333;
    font-weight: 400;
}

/* Liste */
.post-content ul, .post-content ol {
    margin-bottom: 25px;
    padding-left: 30px;
}

.post-content ul {
    list-style: none;
}

.post-content ul li {
    position: relative;
    margin-bottom: 12px;
    padding-left: 25px;
    line-height: 1.7;
}

.post-content ul li:before {
    content: '▶';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-size: 0.8rem;
    top: 2px;
}

.post-content ol li {
    margin-bottom: 12px;
    line-height: 1.7;
    color: #444;
}

/* Citazioni */
.post-content blockquote {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-left: 5px solid var(--primary-color);
    margin: 30px 0;
    padding: 25px 30px;
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #555;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.post-content blockquote p {
    margin-bottom: 0;
    text-align: left;
}

/* Codice */
.post-content code {
    background-color: #f4f4f4;
    color: #e74c3c;
    padding: 3px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.post-content pre {
    background-color: #2d3748;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 25px 0;
    font-family: 'Courier New', monospace;
    line-height: 1.5;
}

.post-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

/* Link nel contenuto */
.post-content a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

.post-content a:hover {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

/* Tabelle */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.post-content table th {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.post-content table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
}

.post-content table tr:hover {
    background-color: #f8f9fa;
}

/* Immagini nel contenuto */
.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.post-content img:hover {
    transform: scale(1.02);
}

/* Evidenziazioni */
.post-content mark,
.post-content .highlight {
    background: linear-gradient(120deg, transparent 0%, transparent 40%, #ffd700 40%, #ffd700 60%, transparent 60%);
    padding: 2px 4px;
    border-radius: 3px;
}

/* Separatori */
.post-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--primary-color), transparent);
    margin: 40px 0;
}

/* Primo paragrafo evidenziato */
.post-content > p:first-of-type::first-letter {
    font-size: 3.5rem;
    float: left;
    line-height: 1;
    margin: 0 8px 0 0;
    color: var(--primary-color);
    font-weight: 700;
}

/* Reading progress bar */
.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: rgba(106, 27, 154, 0.1);
    z-index: 9999;
}

.reading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    width: 0%;
    transition: width 0.3s ease;
}

/* Table of contents */
.table-of-contents {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-left: 4px solid var(--primary-color);
    margin: 30px 0 40px;
    padding: 25px 30px;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.table-of-contents h3 {
    margin: 0 0 15px 0;
    color: var(--secondary-color);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-of-contents ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.table-of-contents li {
    margin-bottom: 8px;
}

.table-of-contents a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    padding: 5px 0;
    display: block;
    transition: color 0.3s ease, padding-left 0.3s ease;
}

.table-of-contents a:hover {
    color: var(--primary-color);
    padding-left: 10px;
}

/* Reading time indicator */
.reading-time {
    color: #666;
    font-size: 0.9rem;
    margin-left: 15px;
}

/* Reveal animations */
.reveal-element {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-element.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Image zoom effect */
.post-image img {
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.post-image img.zoomed {
    transform: scale(1.5);
    cursor: zoom-out;
    position: relative;
    z-index: 10;
}

/* Responsive Design per Blog */
@media (max-width: 768px) {
    /* Header post responsive */
    .post-header h1 {
        font-size: 2rem;
        line-height: 1.3;
    }
    
    .post-meta {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .post-meta span {
        font-size: 0.9rem;
    }
    
    /* Contenuto post responsive */
    .post-content h1 {
        font-size: 1.8rem;
        margin: 30px 0 15px;
    }
    
    .post-content h2 {
        font-size: 1.5rem;
        margin: 25px 0 12px;
        padding-left: 15px;
    }
    
    .post-content h2:before {
        height: 20px;
        width: 3px;
    }
    
    .post-content h3 {
        font-size: 1.3rem;
        margin: 20px 0 10px;
    }
    
    .post-content h4 {
        font-size: 1.1rem;
        margin: 18px 0 8px;
    }
    
    .post-content p {
        font-size: 1rem;
        text-align: left;
        margin-bottom: 18px;
    }
    
    .post-content p:first-child {
        font-size: 1.05rem;
    }
    
    /* Prima lettera responsive */
    .post-content > p:first-of-type::first-letter {
        font-size: 2.5rem;
        margin: 0 5px 0 0;
    }
    
    /* Liste responsive */
    .post-content ul, .post-content ol {
        padding-left: 20px;
        margin-bottom: 20px;
    }
    
    .post-content ul li {
        padding-left: 20px;
        margin-bottom: 10px;
    }
    
    /* Citazioni responsive */
    .post-content blockquote {
        margin: 20px 0;
        padding: 15px 20px;
        font-size: 1rem;
    }
    
    /* Tabelle responsive */
    .post-content table {
        font-size: 0.9rem;
        margin: 20px 0;
    }
    
    .post-content table th,
    .post-content table td {
        padding: 8px 10px;
    }
    
    /* Codice responsive */
    .post-content pre {
        padding: 15px;
        font-size: 0.85rem;
        margin: 20px 0;
    }
    
    .post-content code {
        font-size: 0.85rem;
    }
    
    /* Condivisione responsive */
    .post-share {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .post-share span {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }
    
    /* Tags responsive */
    .post-tags {
        text-align: center;
    }
    
    .post-tags a {
        margin: 5px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .post-header h1 {
        font-size: 1.6rem;
    }
    
    .post-content h1 {
        font-size: 1.5rem;
    }
    
    .post-content h2 {
        font-size: 1.3rem;
        padding-left: 10px;
    }
    
    .post-content h2:before {
        height: 15px;
        width: 2px;
    }
    
    .post-content p {
        font-size: 0.95rem;
    }
    
    .post-content > p:first-of-type::first-letter {
        font-size: 2rem;
        margin: 0 3px 0 0;
    }
    
    .post-content blockquote {
        padding: 12px 15px;
        font-size: 0.95rem;
    }
}

/* Stili per la stampa */
@media print {
    .post-content {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
    }
    
    .post-content h1, .post-content h2, .post-content h3 {
        color: #000;
        page-break-after: avoid;
    }
    
    .post-content blockquote {
        border-left: 3px solid #000;
        background: none;
        box-shadow: none;
    }
    
    .post-content pre {
        background: #f5f5f5;
        border: 1px solid #ccc;
    }
    
    .post-share, .post-tags {
        display: none;
    }
}