/* ===================================
   Reset & Base
   =================================== */

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

html {
    scroll-behavior: smooth;
}

/* ===================================
   Variables
   =================================== */

:root {
    --color-bg: #FFFFFF;
    --color-text: #1a1a1a;
    --color-text-secondary: #666666;
    --color-accent: #0066cc;
    --color-border: #e5e5e5;
    --color-newsletter-bg: #000000;
    --color-terminal-green: #00ff00;

    --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Geist Mono', 'Courier New', monospace;

    --max-width: 820px;
    --section-spacing: 64px;
}

/* ===================================
   Typography
   =================================== */

body {
    font-family: var(--font-stack);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.3;
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 2rem 0 1rem;
    line-height: 1.4;
}

p {
    margin-bottom: 1rem;
}

/* ===================================
   Links
   =================================== */

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

a:hover {
    text-decoration: underline;
}

a:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ===================================
   Layout
   =================================== */

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 32px;
}

.section {
    margin-bottom: var(--section-spacing);
}

/* ===================================
   Compact Header
   =================================== */

header {
    padding-top: 48px;
    padding-bottom: 48px;
    max-height: 40vh;
    overflow: visible;
}

.profile-image {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    float: left;
    margin-right: 20px;
    margin-bottom: 16px;
    object-fit: cover;
}

.header-text {
    overflow: hidden;
}

.manifesto {
    font-size: 1.1rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--color-text);
    margin-bottom: 0;
}

.manifesto-mono {
    font-family: var(--font-mono);
    font-weight: 400;
}

.social-icons {
    margin-top: 24px;
    display: flex;
    gap: 16px;
    align-items: center;
}

.social-icons a {
    color: #666666;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s ease;
}

.social-icons a:hover {
    color: var(--color-accent);
    transform: scale(1.1);
    text-decoration: none;
}

.social-icons svg {
    width: 20px;
    height: 20px;
}

/* ===================================
   About Section
   =================================== */

#about p {
    margin-bottom: 24px;
}

#about p:last-child {
    margin-bottom: 0;
}

/* ===================================
   Newsletter Section - Terminal Style
   =================================== */

.newsletter-box {
    background-color: var(--color-newsletter-bg);
    padding: 32px;
    border: 2px solid var(--color-terminal-green);
    border-radius: 4px;
    margin: var(--section-spacing) 0;
    color: #FFFFFF;
    font-family: var(--font-mono);
}

.newsletter-box h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #FFFFFF;
}

.newsletter-subtitle {
    font-size: 1rem;
    color: #CCCCCC;
    margin-bottom: 1.5rem;
}

.cta-group {
    display: flex;
    gap: 0.75rem;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.newsletter-box .btn-primary {
    background-color: var(--color-terminal-green);
    color: #000000;
    border: 2px solid var(--color-terminal-green);
    font-weight: 600;
}

.newsletter-box .btn-primary:hover {
    text-decoration: none;
    opacity: 0.9;
}

.newsletter-box .btn-secondary {
    background-color: transparent;
    color: #FFFFFF;
    border: 2px solid var(--color-terminal-green);
}

.newsletter-box .btn-secondary:hover {
    text-decoration: none;
    background-color: var(--color-terminal-green);
    color: #000000;
}

/* ===================================
   Timeline Section (Karpathy Style)
   =================================== */

#timeline h2 {
    margin-bottom: 32px;
}

.timeline-container {
    position: relative;
    min-height: 400px;
}

.timeline-line {
    position: absolute;
    left: 140px;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #e0e0e0;
}

.timeline-entry {
    display: grid;
    grid-template-columns: 120px 40px 72px 1fr;
    gap: 0;
    margin-bottom: 24px;
    align-items: start;
}

.timeline-entry.short {
    align-items: center;
}

.timeline-entry:last-child {
    margin-bottom: 0;
}

.timeline-date {
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 400;
    color: #666666;
    line-height: 1.7;
    padding-right: 16px;
}

.timeline-dot-col {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 5px;
}

.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #999999;
    z-index: 1;
}

.timeline-logo-col {
    display: flex;
    align-items: flex-start;
}

.timeline-logo {
    width: 56px;
    height: 56px;
    object-fit: cover;
    object-position: center;
    display: block;
}

.timeline-logo-fallback {
    width: 56px;
    height: 56px;
    text-align: center;
    line-height: 56px;
    font-size: 40px;
    display: block;
}

.timeline-content {
    line-height: 1.7;
}

.timeline-text {
    font-family: var(--font-stack);
    font-size: 1rem;
    font-weight: 400;
    color: #1a1a1a;
    line-height: 1.7;
}

.timeline-text a {
    color: #0066cc;
    text-decoration: none;
}

.timeline-text a:hover {
    text-decoration: underline;
}

/* ===================================
   Approfondimenti Section
   =================================== */

.approfondimenti-section {
    margin-top: 48px;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

.tag {
    display: inline;
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.95rem;
    color: #666666;
    margin-right: 0.75rem;
}

/* ===================================
   Publications Section
   =================================== */

.publications-list,
.articles-list {
    list-style: none;
}

.publications-list li {
    margin-bottom: 0.75rem;
}

.publications-list li:last-child {
    margin-bottom: 0;
}

.year {
    color: var(--color-text-secondary);
    font-weight: 400;
}

.articles-list li {
    margin-bottom: 0.75rem;
}

.articles-list li:last-child {
    margin-bottom: 0;
}

.articles-list .meta {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* ===================================
   Speaking Section
   =================================== */

.speaking-list {
    list-style: none;
}

.speaking-list li {
    margin-bottom: 1.5rem;
}

.speaking-list li:last-child {
    margin-bottom: 0;
}

.speaking-list strong {
    font-weight: 600;
}

.speaking-list .meta {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.speaking-list p {
    margin: 0.25rem 0 0;
}

/* ===================================
   Footer
   =================================== */

footer {
    padding: 48px 0 32px;
    border-top: 1px solid var(--color-border);
    margin-top: var(--section-spacing);
}

footer p {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

/* ===================================
   Responsive - Mobile
   =================================== */

@media (max-width: 768px) {
    .container {
        padding: 0 24px;
    }

    header {
        text-align: center;
        padding-top: 40px;
        padding-bottom: 40px;
        max-height: none;
    }

    .profile-image {
        float: none;
        margin: 0 auto 16px;
        display: block;
    }

    .header-text {
        overflow: visible;
    }

    .social-icons {
        justify-content: center;
    }

    h1 {
        font-size: 1.75rem;
    }

    .manifesto {
        font-size: 1rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    /* Nascondi linea e pallini */
    .timeline-line {
        display: none;
    }

    .timeline-dot-col {
        display: none;
    }

    /* Timeline entry: da grid a flex verticale */
    .timeline-entry {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 32px;
        padding: 0;
    }

    .timeline-entry.short {
        display: flex;
        flex-direction: column;
        text-align: left;
        align-items: flex-start;
    }

    /* Data */
    .timeline-date {
        font-size: 0.9rem;
        color: #666;
        text-align: left;
        padding: 0;
    }

    .timeline-entry.short .timeline-date,
    .timeline-entry.short .timeline-content {
        text-align: left;
        align-items: flex-start;
    }

    /* Logo più piccolo */
    .timeline-logo-col {
        display: block;
    }

    .timeline-logo {
        width: 48px;
        height: 48px;
        object-fit: cover;
    }

    .timeline-logo-fallback {
        width: 48px;
        height: 48px;
        font-size: 36px;
        line-height: 48px;
    }

    /* Contenuto */
    .timeline-content {
        display: block;
    }

    .timeline-text {
        font-size: 0.95rem;
    }

    .cta-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    .newsletter-box {
        padding: 24px;
    }

    :root {
        --section-spacing: 48px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 20px;
    }

    header {
        padding-top: 32px;
        padding-bottom: 32px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .manifesto {
        font-size: 0.95rem;
    }

    h2 {
        font-size: 1.15rem;
    }

    body {
        font-size: 0.95rem;
    }

    .profile-image {
        width: 110px;
        height: 110px;
    }

    .newsletter-box {
        padding: 20px;
    }

    :root {
        --section-spacing: 40px;
    }
}

/* ===================================
   Accessibility
   =================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ===================================
   Print Styles
   =================================== */

@media print {
    header {
        page-break-after: avoid;
        max-height: none;
    }

    .btn {
        display: none;
    }

    a {
        color: var(--color-text);
        text-decoration: underline;
    }

    .section {
        margin-bottom: 32px;
    }

    .profile-image {
        float: none;
        margin: 0 auto 16px;
        display: block;
    }
}
