/* ==========================================================================
   ARTICLE DESIGN SYSTEM — Nicola Silvestre
   Componenti riutilizzabili per articoli generati da Oliver.
   Ogni articolo usa questi stessi blocchi: risultato sempre consistente.
   ========================================================================== */

/* === RESET (solo per pagine articolo standalone) === */
.article-page *, .article-page *::before, .article-page *::after {
    box-sizing: border-box;
}

/* === LAYOUT === */
.article-container {
    max-width: 780px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* === BACK LINK === */
.back-link {
    display: inline-block;
    margin-bottom: 2rem;
    font-size: 0.85rem;
    color: #6b7280;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    transition: color 0.15s;
}
.back-link:hover { color: #0F3460; }

/* ==========================================================================
   HERO HEADER
   ========================================================================== */
.article-hero {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e5e7eb;
}

.article-meta-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.category-badge {
    background: #0F3460;
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'Inter', sans-serif;
}

.article-date {
    color: #6b7280;
    font-size: 0.85rem;
}

.reading-time {
    color: #9ca3af;
    font-size: 0.8rem;
}

.article-hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: #111827;
}

.article-subtitle {
    font-size: 1.15rem;
    color: #4b5563;
    line-height: 1.6;
    font-family: 'Inter', sans-serif;
}

/* ==========================================================================
   TOPIC TAGS
   ========================================================================== */
.topic-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}

.topic-tag {
    background: #f3f4f6;
    color: #374151;
    padding: 0.3rem 0.75rem;
    border-radius: 2px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid #e5e7eb;
    font-family: 'Inter', sans-serif;
}

/* ==========================================================================
   KEY TAKEAWAY BOX
   Uso: punto chiave dell'articolo, sempre in alto
   ========================================================================== */
.takeaway-box {
    background: #f0f4ff;
    border-left: 4px solid #0F3460;
    padding: 1.25rem 1.5rem;
    margin: 2rem 0;
    border-radius: 0 4px 4px 0;
}

.takeaway-box .label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #0F3460;
    margin-bottom: 0.4rem;
    font-family: 'Inter', sans-serif;
}

.takeaway-box p {
    font-size: 0.95rem;
    color: #1e3a5f;
    line-height: 1.6;
    margin-bottom: 0;
}

/* ==========================================================================
   BODY TEXT — headings, paragraphs, links
   ========================================================================== */
.article-body h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    font-weight: 600;
    margin: 2.5rem 0 1rem;
    color: #111827;
}

.article-body h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
    color: #111827;
    font-family: 'Inter', sans-serif;
}

.article-body p {
    margin-bottom: 1.25rem;
    font-size: 1.02rem;
    color: #374151;
    line-height: 1.7;
    font-family: 'Inter', sans-serif;
}

.article-body strong {
    color: #111827;
    font-weight: 600;
}

.article-body a {
    color: #0F3460;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.article-body a:hover {
    color: #1a4a8a;
}

/* ==========================================================================
   QUOTE BLOCK
   Uso: citazioni di persone, CEO, ricercatori
   ========================================================================== */
.quote-block {
    border-left: 3px solid #0F3460;
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    background: #fafafa;
}

.quote-block p {
    font-style: italic;
    font-size: 1.05rem;
    color: #374151;
    margin-bottom: 0.5rem;
}

.quote-block .attribution {
    font-style: normal;
    font-size: 0.85rem;
    color: #6b7280;
    font-family: 'Inter', sans-serif;
}

/* ==========================================================================
   INFO BOX
   Uso: "Perche' conta", "Lo sapevi?", approfondimenti
   ========================================================================== */
.info-box {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 4px;
    padding: 1.25rem 1.5rem;
    margin: 2rem 0;
}

.info-box .info-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: #92400e;
    font-family: 'Inter', sans-serif;
}

.info-box p {
    font-size: 0.92rem;
    color: #78350f;
    margin-bottom: 0;
    line-height: 1.6;
}

/* Variante: tech box (blu) */
.info-box.tech {
    background: #eff6ff;
    border-color: #93c5fd;
}
.info-box.tech .info-title { color: #1e40af; }
.info-box.tech p { color: #1e3a5f; }

/* Variante: warning box (rosso) */
.info-box.warning {
    background: #fef2f2;
    border-color: #fca5a5;
}
.info-box.warning .info-title { color: #991b1b; }
.info-box.warning p { color: #7f1d1d; }

/* ==========================================================================
   STATS ROW
   Uso: numeri in evidenza (benchmark, costi, performance)
   ========================================================================== */
.stats-row {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 140px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 1.25rem;
    text-align: center;
}

.stat-card .stat-number {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    color: #0F3460;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.4rem;
    font-family: 'Inter', sans-serif;
}

/* ==========================================================================
   COMPARISON TABLE
   Uso: confronti tra modelli, prodotti, approcci
   ========================================================================== */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
}

.comparison-table thead {
    background: #0F3460;
    color: #fff;
}

.comparison-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
}

.comparison-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    color: #374151;
}

.comparison-table tbody tr:hover {
    background: #f9fafb;
}

.comparison-table .highlight {
    color: #0F3460;
    font-weight: 600;
}

/* ==========================================================================
   TIMELINE
   Uso: cronologia eventi, storia di un prodotto/azienda
   ========================================================================== */
.timeline {
    position: relative;
    margin: 2rem 0;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.45rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 2px;
    background: #d1d5db;
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.55rem;
    top: 0.45rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #0F3460;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #0F3460;
}

.timeline-item .timeline-date {
    font-size: 0.8rem;
    font-weight: 600;
    color: #0F3460;
    margin-bottom: 0.2rem;
    font-family: 'Inter', sans-serif;
}

.timeline-item .timeline-text {
    font-size: 0.92rem;
    color: #374151;
    line-height: 1.5;
    font-family: 'Inter', sans-serif;
}

/* ==========================================================================
   DIAGRAM CONTAINER (Rough.js / Excalidraw-style)
   Uso: schemi architetturali, flowchart, confronti visivi
   ========================================================================== */
.diagram-container {
    margin: 2.5rem 0;
    text-align: center;
    overflow-x: auto;
}

.diagram-container canvas {
    max-width: 100%;
    display: block;
    margin: 0 auto;
}

.diagram-caption {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-top: 0.75rem;
    text-align: center;
    font-style: italic;
    font-family: 'Inter', sans-serif;
}

/* ==========================================================================
   CODE BLOCK
   Uso: snippet di codice, comandi, output tecnico
   ========================================================================== */
.code-block {
    background: #1f2937;
    color: #e5e7eb;
    padding: 1.25rem 1.5rem;
    border-radius: 4px;
    margin: 2rem 0;
    overflow-x: auto;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.88rem;
    line-height: 1.6;
}

.code-block .code-label {
    display: block;
    font-size: 0.7rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    font-family: 'Inter', sans-serif;
}

.code-block code {
    color: #e5e7eb;
}

.code-block .kw { color: #c084fc; }
.code-block .str { color: #86efac; }
.code-block .cm { color: #6b7280; }
.code-block .fn { color: #93c5fd; }

/* ==========================================================================
   NUMBERED LIST (styled)
   Uso: step, procedure, classifiche
   ========================================================================== */
.styled-list {
    list-style: none;
    counter-reset: item;
    margin: 1.5rem 0;
    padding: 0;
}

.styled-list li {
    counter-increment: item;
    padding: 0.75rem 0 0.75rem 3rem;
    position: relative;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.95rem;
    color: #374151;
    line-height: 1.5;
    font-family: 'Inter', sans-serif;
}

.styled-list li::before {
    content: counter(item);
    position: absolute;
    left: 0;
    top: 0.65rem;
    width: 2rem;
    height: 2rem;
    background: #0F3460;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

/* ==========================================================================
   PROS/CONS SPLIT
   Uso: vantaggi/svantaggi, pro/contro
   ========================================================================== */
.pros-cons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 2rem 0;
}

.pros-col, .cons-col {
    padding: 1.25rem;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
}

.pros-col {
    background: #f0fdf4;
    border: 1px solid #86efac;
}

.cons-col {
    background: #fef2f2;
    border: 1px solid #fca5a5;
}

.pros-col h4, .cons-col h4 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.pros-col h4 { color: #166534; }
.cons-col h4 { color: #991b1b; }

.pros-col ul, .cons-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pros-col li, .cons-col li {
    font-size: 0.9rem;
    padding: 0.3rem 0;
    line-height: 1.5;
}

.pros-col li::before { content: '+ '; color: #16a34a; font-weight: 700; }
.cons-col li::before { content: '- '; color: #dc2626; font-weight: 700; }

/* ==========================================================================
   SOURCE LINK
   Uso: link alla fonte originale della notizia
   ========================================================================== */
.source-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 0.5rem 1rem;
    border-radius: 3px;
    font-size: 0.85rem;
    color: #374151;
    text-decoration: none;
    margin: 2rem 0;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.15s;
}

.source-link:hover {
    border-color: #0F3460;
    color: #0F3460;
}

.source-link::before {
    content: '\2197';
    font-size: 1rem;
}

/* ==========================================================================
   ARTICLE FOOTER
   ========================================================================== */
.article-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.author-line {
    font-size: 0.85rem;
    color: #9ca3af;
    font-family: 'Inter', sans-serif;
}

.author-line a {
    color: #0F3460;
    text-decoration: none;
}
.author-line a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   ARTICLE CARD (per la griglia nella pagina articoli)
   ========================================================================== */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.article-card {
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    background: #fff;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.card-gradient {
    height: 140px;
    display: flex;
    align-items: flex-end;
    padding: 1rem;
    position: relative;
    overflow: hidden;
    background-size: cover;
}


/* Gradient per categoria con pattern geometrico */
.card-gradient.cat-modelli {
    background: linear-gradient(135deg, #0F3460 0%, #1a4a8a 100%);
    background-image:
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.05) 10px, rgba(255,255,255,0.05) 20px),
        linear-gradient(135deg, #0F3460 0%, #1a4a8a 100%);
}

.card-gradient.cat-business {
    background: linear-gradient(135deg, #065f46 0%, #059669 100%);
    background-image:
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.05) 10px, rgba(255,255,255,0.05) 20px),
        linear-gradient(135deg, #065f46 0%, #059669 100%);
}

.card-gradient.cat-ricerca {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    background-image:
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.05) 10px, rgba(255,255,255,0.05) 20px),
        linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
}

.card-gradient.cat-hardware {
    background: linear-gradient(135deg, #92400e 0%, #d97706 100%);
    background-image:
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.05) 10px, rgba(255,255,255,0.05) 20px),
        linear-gradient(135deg, #92400e 0%, #d97706 100%);
}

.card-gradient.cat-opensource {
    background: linear-gradient(135deg, #991b1b 0%, #dc2626 100%);
    background-image:
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.05) 10px, rgba(255,255,255,0.05) 20px),
        linear-gradient(135deg, #991b1b 0%, #dc2626 100%);
}

.card-gradient.cat-default {
    background: linear-gradient(135deg, #374151 0%, #6b7280 100%);
    background-image:
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.05) 10px, rgba(255,255,255,0.05) 20px),
        linear-gradient(135deg, #374151 0%, #6b7280 100%);
}

.card-gradient .card-category {
    background: rgba(255,255,255,0.2);
    color: #fff;
    padding: 0.3rem 0.7rem;
    border-radius: 2px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: 'Inter', sans-serif;
    position: relative;
    z-index: 2;
}

.card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-body h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.6rem;
    color: #111827;
}

.card-body .card-excerpt {
    font-size: 0.88rem;
    color: #6b7280;
    line-height: 1.5;
    flex: 1;
    font-family: 'Inter', sans-serif;
}

.card-body .card-date {
    font-size: 0.78rem;
    color: #9ca3af;
    margin-top: 0.75rem;
    font-family: 'Inter', sans-serif;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 600px) {
    .article-hero h1 { font-size: 1.8rem; }
    .article-container { padding: 1.25rem 1rem 3rem; }
    .stats-row { flex-direction: column; }
    .stat-card { min-width: 100%; }
    .pros-cons { grid-template-columns: 1fr; }
    .articles-grid { grid-template-columns: 1fr; }
}
