/**
 * Greci in Sicilia - Premium Content Design v3.2
 * Modern, elegant, reading-optimized
 * FIX: Accessibility contrast issues resolved
 * FIX: UTF-8 encoding corrected
 * FIX: Added missing styles for nav-storia and sources
 */

/* ========== LAYOUT ========== */
.greci-article {
    background: linear-gradient(to bottom, #fff 0%, #f8f9fa 100%);
}

.greci-content {
    max-width: 780px;
    margin: 0 auto;
    padding: 0 5%;
}

/* ========== HERO ========== */
.greci-header {
    position: relative;
    width: 100%;
    height: 75vh;
    min-height: 500px;
    max-height: 800px;
    overflow: hidden;
    margin-bottom: 4rem;
}

.greci-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.85) contrast(1.1);
}

.greci-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3rem 5%;
    margin: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 50%, transparent 100%);
    color: #fff;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

/* ========== BREADCRUMBS ========== */
.greci-breadcrumbs {
    max-width: 780px;
    margin: 2rem auto 3rem;
    padding: 0 5%;
}

.greci-breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
    color: #6c757d;
}

.greci-breadcrumbs li::after {
    content: "›";
    margin-left: 0.5rem;
    color: #adb5bd;
}

.greci-breadcrumbs li:last-child::after {
    content: "";
}

.greci-breadcrumbs a {
    color: #6c757d;
    text-decoration: none;
    transition: color 0.2s;
}

.greci-breadcrumbs a:hover {
    color: #b8864a;
}

/* ========== TOC ========== */
.greci-toc {
    background: #fff;
    border: 2px solid #e9ecef;
    border-left: 6px solid #b8864a;
    border-radius: 12px;
    padding: 2rem;
    margin: 0 0 4rem 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
}

.greci-toc:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.greci-toc-title {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
}

.greci-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.greci-toc-list li {
    margin: 0;
}

.greci-toc-list a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    color: #495057;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.greci-toc-list a::before {
    content: "→";
    margin-right: 0.75rem;
    color: #b8864a;
    font-weight: bold;
}

.greci-toc-list a:hover {
    background: #b8864a;
    color: #fff;
    border-left-color: #9a6f3a;
    transform: translateX(4px);
}

.greci-toc-list a.active {
    background: #b8864a;
    color: #fff;
    border-left-color: #9a6f3a;
}

/* ========== TYPOGRAPHY ========== */
.greci-content p {
    font-size: 1.125rem;
    line-height: 1.8;
    color: #212529;
    margin: 0 0 1.5rem 0;
}

.greci-intro {
    margin-bottom: 4rem;
    padding: 2rem;
    background: linear-gradient(135deg, #fff5e6 0%, #fff 100%);
    border-radius: 12px;
    border-left: 4px solid #b8864a;
}

.greci-intro p {
    font-size: 1.2rem;
    line-height: 1.9;
    color: #2c3e50;
}

.greci-section h2 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    color: #212529;
    margin: 4rem 0 2rem 0;
    line-height: 1.2;
    letter-spacing: -0.02em;
    position: relative;
    padding-bottom: 1rem;
}

.greci-section h2::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 4px;
    background: linear-gradient(to right, #b8864a, #9a6f3a);
    border-radius: 2px;
}

/* FIX: Timeline h3 instead of h4 for proper heading hierarchy */
.greci-section h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #343a40;
    margin: 3rem 0 1.5rem 0;
}

.greci-content a {
    color: #996b2f;
    text-decoration: none;
    border-bottom: 2px solid #996b2f;
    transition: all 0.2s;
    font-weight: 500;
}

.greci-content a:hover {
    color: #7a5526;
    border-bottom-color: #7a5526;
    background: rgba(153, 107, 47, 0.1);
}

.greci-content strong {
    font-weight: 700;
    color: #212529;
}

/* ========== IMAGES ========== */
.greci-image-container {
    margin: 3rem -5% 3rem -5%;
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}

.greci-img-responsive {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.greci-image-container:hover .greci-img-responsive {
    transform: scale(1.05);
}

.greci-caption {
    margin: 1rem 5% 0;
    text-align: center;
    font-size: 0.95rem;
    font-style: italic;
    color: #6c757d;
}

/* ========== TABLES ========== */
.greci-table-container {
    margin: 3rem 0;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.greci-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
}

.greci-table thead {
    background: linear-gradient(135deg, #9a6f3a 0%, #7a5526 100%);
    color: #fff;
}

.greci-table th {
    padding: 1.25rem 1.5rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.greci-table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    font-size: 1rem;
    color: #495057;
    transition: background 0.2s;
}

.greci-table tbody tr:hover td {
    background: #f8f9fa;
}

/* ========== HIGHLIGHT BOXES ========== */
.greci-highlight-box {
    margin: 3rem 0;
    padding: 2rem 2.5rem;
    background: linear-gradient(135deg, #e3f2fd 0%, #fff 100%);
    border-left: 6px solid #1976d2;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(25, 118, 210, 0.1);
}

.greci-highlight-box p {
    font-size: 1.15rem;
    line-height: 1.8;
    color: #0d47a1;
    margin: 0;
    font-weight: 500;
}

/* ========== TIMELINE ========== */
.greci-timeline {
    position: relative;
    padding: 2rem 0 2rem 3rem;
    margin: 3rem 0;
}

.greci-timeline::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, #b8864a, #9a6f3a);
    border-radius: 2px;
}

.greci-timeline-item {
    position: relative;
    margin-bottom: 2.5rem;
    padding-left: 1.5rem;
}

.greci-timeline-item::before {
    content: "";
    position: absolute;
    left: -3rem;
    top: 0.5rem;
    width: 16px;
    height: 16px;
    background: #b8864a;
    border: 4px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 3px #b8864a;
}

.greci-timeline-date {
    display: inline-block;
    padding: 0.25rem 1rem;
    background: #9a6f3a;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 20px;
    margin-bottom: 0.75rem;
}

/* FIX: Changed from h4 to h3 for proper heading hierarchy */
.greci-timeline-item h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #212529;
    margin: 0 0 0.5rem 0;
}

.greci-timeline-item p {
    margin: 0;
    font-size: 1rem;
    color: #495057;
}

/* ========== FAQ ACCORDION ========== */
.greci-faq-item {
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: all 0.3s;
}

.greci-faq-item:hover {
    border-color: #b8864a;
    box-shadow: 0 4px 20px rgba(184, 134, 74, 0.15);
}

.greci-faq-question {
    padding: 1.5rem 2rem;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.15rem;
    color: #212529;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.greci-faq-question:hover {
    background: #f8f9fa;
}

.greci-faq-question::after {
    content: "+";
    font-size: 1.5rem;
    color: #9a6f3a;
    font-weight: 300;
    transition: transform 0.3s;
}

.greci-faq-item.active .greci-faq-question::after {
    transform: rotate(45deg);
}

.greci-faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s;
    padding: 0 2rem;
}

.greci-faq-item.active .greci-faq-answer {
    max-height: 500px;
    padding: 0 2rem 1.5rem;
}

/* ========== CARDS ========== */
.greci-card {
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: all 0.3s;
}

.greci-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    border-color: #b8864a;
}

/* FIX: Card h3 color changed from #d4a574 to #8b5e2f for WCAG AA contrast (4.5:1 ratio) */
.greci-card h3 {
    margin-top: 0;
    color: #8b5e2f;
    font-size: 1.3rem;
    font-weight: 700;
}

/* ========== NAVIGATION STORIA (NEW) ========== */
.greci-nav-storia {
    margin: 4rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 12px;
    border: 2px solid #e9ecef;
    text-align: center;
}

.greci-nav-storia h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #212529;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.greci-nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.greci-nav-prev,
.greci-nav-next {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: #fff;
    border: 2px solid #b8864a;
    border-radius: 8px;
    color: #b8864a;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
}

.greci-nav-prev:hover,
.greci-nav-next:hover {
    background: #b8864a;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(184, 134, 74, 0.3);
}

.greci-nav-current {
    padding: 0.75rem 1.5rem;
    background: #7a5526; /* Darkened from #b8864a for WCAG AA contrast (4.5:1 with white) */
    color: #fff;
    font-weight: 700;
    border-radius: 8px;
}

/* ========== SOURCES SECTION (NEW) ========== */
.greci-sources {
    margin: 4rem 0 2rem;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #6c757d;
}

.greci-sources h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #495057;
}

.greci-sources ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.greci-sources li {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
}

.greci-sources li::before {
    content: "📚";
    position: absolute;
    left: 0;
    top: 0;
}

.greci-sources a {
    color: #495057;
    text-decoration: none;
    border-bottom: 1px solid #adb5bd;
    transition: all 0.2s;
}

.greci-sources a:hover {
    color: #b8864a;
    border-bottom-color: #b8864a;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .greci-header {
        height: 60vh;
        min-height: 400px;
    }
    
    .greci-title {
        font-size: 2rem;
        padding: 2rem 1.5rem;
    }
    
    .greci-content {
        padding: 0 1.5rem;
    }
    
    .greci-toc-list {
        grid-template-columns: 1fr;
    }
    
    .greci-intro {
        padding: 1.5rem;
    }
    
    .greci-content p {
        font-size: 1.05rem;
    }
    
    .greci-image-container {
        margin-left: 0;
        margin-right: 0;
    }
    
    .greci-timeline {
        padding-left: 2rem;
    }
    
    .greci-timeline-item::before {
        left: -2.25rem;
    }
    
    /* Responsive nav storia */
    .greci-nav-links {
        flex-direction: column;
        gap: 1rem;
    }
    
    .greci-nav-prev,
    .greci-nav-next,
    .greci-nav-current {
        width: 100%;
        justify-content: center;
    }
}