/**
 * Models Pages Stylesheet
 * CSS per le pagine dei modelli matematici/tecnici
 */

/* Import design tokens from main.css */
:root {
    --color-primary: #1e3a5f;
    --color-primary-dark: #0d1b2a;
    --color-secondary: #3182ce;
    --color-accent: #38b2ac;
    --color-text: #1a202c;
    --color-text-muted: #718096;
    --color-background: #f7fafc;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    line-height: 1.7;
    color: var(--color-text);
    background-color: var(--color-background);
}

/* Site Header */
.site-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-brand a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.2s;
}

.header-brand a:hover {
    opacity: 0.9;
}

.header-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.header-nav a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.header-nav a:hover {
    color: white;
}

.language-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: background 0.2s;
}

.language-switch:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Article Container */
.article-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

/* Article Header */
.article-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
}

.article-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

@media (max-width: 768px) {
    .article-header h1 {
        font-size: 1.75rem;
    }
}

/* Author Info */
.author-info {
    background: var(--color-surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.author-info h3 {
    color: var(--color-primary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.author-info p {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin: 0.25rem 0;
}

/* Table of Contents */
.toc {
    background: var(--color-surface);
    padding: 1.5rem 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 3rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.toc h2 {
    font-size: 1.125rem;
    color: var(--color-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-border);
}

.toc ul {
    list-style: none;
    padding: 0;
}

.toc li {
    margin: 0.5rem 0;
}

.toc a {
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: color 0.2s;
    display: block;
    padding: 0.25rem 0;
}

.toc a:hover {
    color: var(--color-secondary);
}

/* Sections */
.section {
    margin-bottom: 3rem;
}

h2 {
    font-size: 1.75rem;
    color: var(--color-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-border);
}

h3 {
    font-size: 1.25rem;
    color: var(--color-primary);
    margin: 1.5rem 0 1rem;
}

h4 {
    font-size: 1rem;
    color: var(--color-text);
    margin: 1rem 0 0.5rem;
}

p {
    margin: 1rem 0;
    text-align: justify;
}

ul, ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

li {
    margin: 0.5rem 0;
}

/* Formula Box */
.formula {
    background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
    border-left: 4px solid var(--color-secondary);
    overflow-x: auto;
}

/* Explanation Box */
.explanation {
    background: var(--color-surface);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
    border-left: 4px solid var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.explanation p:first-child {
    margin-top: 0;
}

.explanation p:last-child {
    margin-bottom: 0;
}

/* ASCII Art Diagram */
.ascii-art {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    white-space: pre;
    background: var(--color-primary-dark);
    color: #a0e8af;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Code */
code {
    font-family: 'Consolas', 'Monaco', monospace;
    background: #edf2f7;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.875em;
    color: var(--color-primary);
}

pre code {
    display: block;
    background: var(--color-primary-dark);
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
}

/* SVG Container */
.svg-container {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.svg-container h4 {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--color-primary);
}

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

/* Footer */
.article-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.article-footer p {
    text-align: center;
}

/* Site Footer */
.site-footer {
    background: var(--color-primary-dark);
    color: rgba(255, 255, 255, 0.7);
    padding: 2rem;
    text-align: center;
    margin-top: 4rem;
}

.site-footer a {
    color: var(--color-accent);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* MathJax adjustments */
.MathJax_Display {
    overflow-x: auto;
    overflow-y: hidden;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

th {
    background: var(--color-primary);
    color: white;
    font-weight: 600;
}

tr:hover {
    background: #f8fafc;
}

/* Note/Warning boxes */
.note {
    background: #ebf8ff;
    border-left: 4px solid var(--color-secondary);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
}

.warning {
    background: #fffaf0;
    border-left: 4px solid #ed8936;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    .article-container {
        padding: 1rem;
    }
    
    .site-header {
        padding: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .header-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .formula {
        padding: 1rem;
    }
    
    .ascii-art {
        font-size: 0.75rem;
        padding: 1rem;
    }
}

/* Print styles */
@media print {
    .site-header,
    .site-footer,
    .language-switch {
        display: none;
    }
    
    .article-container {
        max-width: 100%;
        padding: 0;
    }
    
    .section {
        page-break-inside: avoid;
    }
}
