/* =====================================================
   THEME: Gramscitalia.it – IGS Italia
   Colori: Paper Ivory #F3EDE1, Charcoal Ink #1F2328,
   Gramsci Burgundy #7A2633, Muted Terracotta #A65A43,
   Olive Slate #66705F, Stone Gray #C8C1B4,
   Deep Archive Blue #314A5E
   ===================================================== */

/* RESET & BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    background-color: #F3EDE1; /* Paper Ivory */
    color: #1F2328;            /* Charcoal Ink */
    font-family: 'Georgia', 'Times New Roman', Times, serif;
    line-height: 1.6;
    scroll-behavior: smooth;
}

body.nav-open {
    overflow: hidden;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* TYPOGRAPHY */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 500;
    line-height: 1.2;
    color: #1F2328;
}

h1 { font-size: 2.8rem; letter-spacing: -0.02em; }
h2 { font-size: 2rem; margin-bottom: 1rem; border-left: 4px solid #7A2633; padding-left: 1rem; }
h3 { font-size: 1.5rem; }
a {
    color: #314A5E; /* Deep Archive Blue */
    text-decoration: none;
    transition: color 0.2s ease;
}
a:hover {
    color: #A65A43; /* Muted Terracotta */
}

/* HEADER & NAVIGATION */
.site-header {
    background-color: #1F2328;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.logo-area .site-logo {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.logo-gramsci { color: #F3EDE1; }
.logo-italia { color: #7A2633; background: #F3EDE1; padding: 0 4px; border-radius: 4px; }
.site-subtitle {
    font-size: 0.75rem;
    color: #C8C1B4;
    margin-top: 0.2rem;
}
.main-nav .nav-list {
    display: flex;
    gap: 1.8rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.nav-link {
    color: #F3EDE1;
    font-weight: 500;
    font-family: 'Segoe UI', sans-serif;
    font-size: 1rem;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
}
.nav-link:hover { color: #A65A43; border-bottom-color: #A65A43; }
.nav-link.active {
    color: #7A2633;
    border-bottom-color: #7A2633;
}
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    width: 48px;
    height: 48px;
    padding: 10px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.hamburger {
    width: 28px;
    height: 2px;
    background: #F3EDE1;
    position: relative;
    display: block;
    pointer-events: none;
}
.hamburger::before, .hamburger::after {
    content: '';
    position: absolute;
    width: 28px;
    height: 2px;
    background: #F3EDE1;
    left: 0;
}
.hamburger::before { top: -8px; }
.hamburger::after { bottom: -8px; }

/* BUTTONS */
.btn-primary {
    display: inline-block;
    background-color: #7A2633;
    color: #F3EDE1;
    padding: 0.75rem 1.8rem;
    border-radius: 30px;
    font-weight: 600;
    transition: all 0.2s;
    margin-top: 1.5rem;
}
.btn-primary:hover {
    background-color: #A65A43;
    color: #F3EDE1;
    transform: translateY(-2px);
}

/* HERO SECTION */
.hero-section {
    background: linear-gradient(135deg, #EEE6D8 0%, #F3EDE1 100%);
    padding: 4rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    border-bottom: 1px solid #C8C1B4;
}
.hero-content { flex: 2; }
.hero-title {
    font-size: 3.2rem;
    font-weight: 700;
}
.hero-title span { font-weight: 400; color: #66705F; }
.hero-description { font-size: 1.2rem; margin-top: 1rem; max-width: 600px; }
.hero-quote {
    flex: 1;
    background: rgba(49,74,94,0.05);
    padding: 1.5rem;
    border-left: 4px solid #7A2633;
}
.hero-quote blockquote {
    font-style: italic;
    font-size: 1.1rem;
}
.hero-quote cite { color: #66705F; font-size: 0.9rem; }

/* SECTION HEADER */
.section-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
}
.section-badge {
    background: #A65A43;
    color: #F3EDE1;
    padding: 0.25rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* NEWS GRID / CARDS */
.news-section, .keywords-section, .research-section, .events-section {
    padding: 3rem 1.5rem;
    border-bottom: 1px solid #C8C1B4;
}
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}
.news-card {
    background: #EEE6D8;
    border: 1px solid #C8C1B4;
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.news-card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,0.05); }
.card-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: #66705F;
}
.card-tag {
    background: #314A5E20;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
}
.news-card h3 a { color: #1F2328; }
.read-more { font-weight: 500; margin-top: 1rem; display: inline-block; }

/* KEYWORDS GRID */
.keywords-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.8rem;
}
.keyword-card {
    background: #F3EDE1;
    border: 1px solid #C8C1B4;
    border-radius: 20px;
    padding: 1.5rem;
    text-align: center;
}
.keyword-icon { font-size: 2.5rem; margin-bottom: 1rem; }

/* RESEARCH ITEMS */
.research-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}
.research-item {
    flex: 1;
    background: #FFF9EF;
    padding: 1.5rem;
    border-radius: 16px;
    border-left: 5px solid #7A2633;
}
.text-link { color: #314A5E; font-weight: 500; }

/* EVENTS LIST */
.events-list {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}
.event-item {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    background: #EEE6D8;
    padding: 1rem 1.5rem;
    border-radius: 12px;
}
.event-date {
    font-weight: 700;
    color: #7A2633;
    min-width: 140px;
}
.event-info h3 { font-size: 1.2rem; margin-bottom: 0.2rem; }

/* CONTENT WRAPPER & DIVIDER */
.content-wrapper { padding: 2rem 1.5rem; max-width: 880px; margin: 0 auto; }
.content-divider { margin: 2rem auto; width: 80px; border-color: #C8C1B4; }

/* MARKDOWN BODY */
.markdown-body {
    font-family: 'Georgia', serif;
    max-width: 800px;
    margin: 0 auto;
}
.markdown-body p, .markdown-body li { font-size: 1.1rem; }
.markdown-body a { color: #314A5E; text-decoration: underline; }

/* RELATED ARTICLES (shortcode) */
.related-section {
    background: #F3EDE1;
    padding: 2rem 1.5rem;
    margin-top: 2rem;
}
.related-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-align: center;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
}
.related-card {
    background: #EEE6D8;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #C8C1B4;
}
.related-img { width: 100%; height: 160px; object-fit: cover; }
.related-card-body { padding: 1rem; }
.related-card-title { font-size: 1.2rem; margin-bottom: 0.5rem; }
.related-summary { font-size: 0.9rem; color: #66705F; }
.related-meta { margin-top: 0.5rem; font-size: 0.8rem; color: #7A2633; }

/* PAGINATION */
.pagination-wrapper, .pagination-container {
    margin: 2rem 0;
    text-align: center;
}
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    list-style: none;
    flex-wrap: wrap;
}
.page-item a, .page-item span {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #EEE6D8;
    border: 1px solid #C8C1B4;
    border-radius: 6px;
    color: #1F2328;
}
.page-item.active span {
    background: #7A2633;
    color: white;
    border-color: #7A2633;
}
.page-item a:hover { background: #A65A43; color: white; }

/* FOOTER */
.site-footer {
    background: #1F2328;
    color: #C8C1B4;
    padding: 3rem 1.5rem 2rem;
    margin-top: 3rem;
}
.footer-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: space-between;
}
.footer-about, .footer-links, .footer-contact { flex: 1; min-width: 200px; }
.footer-about h3, .footer-links h4, .footer-contact h4 { color: #F3EDE1; margin-bottom: 1rem; }
.footer-links ul { list-style: none; }
.footer-links li a { color: #C8C1B4; line-height: 1.8; }
.footer-links li a:hover { color: #A65A43; }

/* RESPONSIVE */
@media (max-width: 768px) {
    .mobile-nav-toggle { display: inline-flex; }
    .main-nav {
        position: fixed;
        top: 70px;
        left: 0;
        width: min(82vw, 340px);
        max-width: calc(100vw - 1rem);
        height: calc(100vh - 70px);
        background: #1F2328;
        transform: translateX(-110%);
        transition: transform 0.3s ease;
        z-index: 99;
        padding: 2rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: 12px 0 28px rgba(0,0,0,0.24);
    }
    .main-nav.open { transform: translateX(0); }
    .nav-list { flex-direction: column; gap: 1rem; align-items: flex-start; }
    .footer-about, .footer-links, .footer-contact { min-width: 0; }
    .hero-title { font-size: 2rem; }
    .hero-section { flex-direction: column; }
    .event-item { flex-direction: column; }
    .event-date { min-width: auto; }
}

@media (max-width: 480px) {
    .container { padding: 0 1rem; }
    h1 { font-size: 2rem; }
    .news-grid, .related-grid { grid-template-columns: 1fr; }
}
