/* Base Styles and Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-color: #F5F2E8;
    --text-color: #2C2416;
    --accent-color: #8B7355;
    --border-color: #2C2416;
    --shadow-color: rgba(44, 36, 22, 0.1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(44, 36, 22, 0.03) 2px,
            rgba(44, 36, 22, 0.03) 4px
        );
    overflow-x: hidden;
}

/* Ensure all SVGs are responsive */
svg {
    max-width: 100%;
    height: auto;
}

/* Prevent any element from causing horizontal overflow */
img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* Header Styles */
.site-header {
    text-align: center;
    padding: 2rem 1rem;
    border-bottom: 3px solid var(--border-color);
    background: linear-gradient(180deg, #FAF8F3 0%, var(--bg-color) 100%);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.site-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 900;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    text-shadow: 2px 2px 4px var(--shadow-color);
}

.established {
    font-family: 'Courier Prime', monospace;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    color: var(--accent-color);
}

/* Navigation */
.main-nav {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.main-nav a {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-decoration: none;
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.main-nav a:hover {
    border-bottom-color: var(--border-color);
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 1px;
    background: var(--text-color);
    transition: width 0.3s ease;
}

.main-nav a:hover::after {
    width: 80%;
}

/* Main Content */
.home-content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Featured Experiment Section - Most Recent Article */
.featured-experiment {
    background: white;
    border: 2px solid var(--border-color);
    padding: 2rem;
    margin-bottom: 3rem;
    box-shadow: 5px 5px 15px var(--shadow-color);
    position: relative;
}

.featured-experiment::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: repeating-linear-gradient(
        45deg,
        var(--border-color),
        var(--border-color) 1px,
        transparent 1px,
        transparent 8px
    );
    z-index: -1;
    opacity: 0.1;
}

.experiment-label {
    font-family: 'Courier Prime', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    color: var(--accent-color);
    margin-bottom: 1rem;
    display: block;
}

.experiment-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.experiment-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin: 0;
}

.experiment-header h2 a {
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.experiment-header h2 a:visited {
    color: var(--text-color);
}

.experiment-header h2 a:hover {
    color: var(--accent-color);
}

.experiment-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    align-items: start;
}

.experiment-thumbnail {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.experiment-thumbnail img {
    width: 100%;
    height: auto;
    max-width: 300px;
    display: block;
}

.experiment-description p {
    margin-bottom: 1rem;
    line-height: 1.8;
    font-size: 0.95rem;
}

.experiment-more-link {
    color: #6366F1;
    text-decoration: none;
    font-size: 0.95rem;
    display: inline-block;
    margin-bottom: 1rem;
}

.experiment-more-link:hover {
    text-decoration: underline;
}

.category-tag {
    font-family: 'Courier Prime', monospace;
    font-size: 0.85rem !important;
    color: var(--accent-color);
    font-style: italic;
    display: block;
    margin-top: 1rem;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.project-card {
    background: white;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--border-color);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.project-card:hover::before {
    transform: translateX(0);
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 3px 3px 10px var(--shadow-color);
}

.project-illustration {
    height: 120px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 1rem;
}

.project-illustration svg {
    width: 100%;
    height: 100%;
    max-width: 200px;
}

.project-card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.project-card h3 a {
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.project-card h3 a:visited {
    color: var(--text-color);
}

.project-card h3 a:hover {
    color: var(--accent-color);
}

.project-card p {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    color: var(--text-color);
    opacity: 0.9;
}

.project-card .category {
    font-family: 'Courier Prime', monospace;
    font-size: 0.8rem;
    color: var(--accent-color);
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--accent-color);
    background: rgba(139, 115, 85, 0.1);
}

/* Article Page Styles */
.article-header {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
    text-align: center;
    border-bottom: 3px solid var(--border-color);
    padding-bottom: 2rem;
}

.article-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    margin-bottom: 1rem;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.article-meta {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    font-family: 'Courier Prime', monospace;
    font-size: 0.9rem;
    color: var(--accent-color);
}

.article-content {
    max-width: 900px;
    margin: 3rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    transition: grid-template-columns 0.4s ease;
}

/* Collapsed sidebar state - triggered by scrolling */
.article-content.sidebar-collapsed {
    grid-template-columns: 4.7fr 0.3fr;
    gap: 1rem;
}

.article-content.sidebar-collapsed .illustration-container img{
    width:200px
}

.article-text {
    font-size: 1.05rem;
    line-height: 1.8;
}

.article-text p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

.article-text p:first-of-type::first-letter {
    font-family: 'Playfair Display', serif;
    font-size: 4rem;
    font-weight: 700;
    float: left;
    line-height: 0.8;
    margin: 0.1em 0.1em 0 0;
}

.article-illustration {
    position: sticky;
    top: 2rem;
    height: fit-content;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

/* Scale down sidebar content when collapsed */
.article-content.sidebar-collapsed .article-illustration {
    transform: scale(0.85);
    opacity: 0.9;
}

.illustration-container {
    background: white;
    border: 2px solid var(--border-color);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: padding 0.4s ease;
}

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

/* Reduce padding in collapsed state */
.article-content.sidebar-collapsed .illustration-container {
    padding: 1rem;
}

.illustration-caption {
    font-family: 'Courier Prime', monospace;
    font-size: 0.85rem;
    text-align: center;
    margin-top: 1rem;
    font-style: italic;
    color: var(--accent-color);
}

/* App link button styling */
.article-illustration .illustration-container p a {
    display: block;
    padding: 0.75rem 1.5rem;
    background-color: var(--text-color);
    color: var(--bg-color);
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    border: 2px solid var(--text-color);
    transition: all 0.3s ease;
    text-transform: uppercase;
    box-shadow: 2px 2px 5px var(--shadow-color);
    width: 100%;
    text-align: center;
}

.article-illustration .illustration-container p a:hover {
    background-color: var(--bg-color);
    color: var(--text-color);
    transform: translateY(-2px);
    box-shadow: 3px 3px 8px var(--shadow-color);
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    border-top: 2px solid var(--border-color);
    margin-top: 4rem;
    font-family: 'Courier Prime', monospace;
    font-size: 0.85rem;
    color: var(--accent-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .experiment-content {
        grid-template-columns: 1fr;
    }

    .experiment-thumbnail {
        max-width: 100%;
    }

    .experiment-header h2 {
        font-size: 1.5rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .article-content,
    .article-content.sidebar-collapsed {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    .article-illustration {
        position: static !important;
        order: -1;
        transform: none !important;
        opacity: 1 !important;
    }

    .illustration-container {
        padding: 1.5rem !important;
    }

    .article-list-item {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .article-thumbnail {
        width: 100%;
        height: auto;
        max-height: 200px;
    }

    .main-nav {
        gap: 1rem;
    }

    .main-nav a {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    .article-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 1.5rem;
    }

    .experiment-header h3 {
        font-size: 1.5rem;
    }

    .project-card {
        padding: 1rem;
    }

    .article-header {
        padding: 0 0.75rem;
        margin: 1rem auto;
    }

    .article-content {
        padding: 0 0.75rem;
        margin: 2rem auto;
    }

    .illustration-container {
        padding: 1rem !important;
    }
}

/* Article List - Full Width Layout */
.article-list {
    max-width: 1200px;
    margin: 0 auto 3rem auto;
}

.article-list h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
    letter-spacing: 0.05em;
}

.article-list-item {
    background: white;
    border: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1.5rem;
    align-items: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 3px 3px 8px var(--shadow-color);
}

.article-list-item:hover {
    transform: translateX(5px);
    box-shadow: 5px 5px 12px var(--shadow-color);
}

.article-thumbnail {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
}

.article-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.article-info h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.02em;
}

.article-info h3 a {
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.article-info h3 a:visited {
    color: var(--text-color);
}

.article-info h3 a:hover {
    color: var(--accent-color);
}

.article-info p {
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
    color: var(--text-color);
    opacity: 0.9;
}

.article-info .category, .experiment-content .category {
    font-family: 'Courier Prime', monospace;
    font-size: 0.8rem;
    color: var(--accent-color);
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--accent-color);
    background: rgba(139, 115, 85, 0.1);
    width: fit-content;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: white;
    border: 2px dashed var(--border-color);
    margin: 2rem 0;
}

.empty-state p {
    font-family: 'Courier Prime', monospace;
    font-size: 1rem;
    color: var(--accent-color);
    margin: 0;
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .main-nav {
        display: none;
    }

    .project-card {
        break-inside: avoid;
    }

    .site-footer {
        margin-top: 2rem;
    }
}

/* Animation for SVG elements */
@keyframes drawLine {
    from {
        stroke-dashoffset: 100;
    }
    to {
        stroke-dashoffset: 0;
    }
}

.neural-network line {
    stroke-dasharray: 100;
    animation: drawLine 2s ease-in-out;
}

/* Hover effect for neural network nodes */
.neural-network circle {
    transition: fill 0.3s ease;
}

.neural-network:hover circle {
    fill: rgba(139, 115, 85, 0.2);
}

/* Decorative elements */
.ornament {
    display: inline-block;
    width: 30px;
    height: 30px;
    margin: 0 1rem;
    opacity: 0.5;
}

.ornament::before,
.ornament::after {
    content: '❦';
    font-size: 1.5rem;
    color: var(--accent-color);
}
