/* Basic Reset & Typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
}

/* Header */
.header {
    background-color: #A51C30;
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.header h1 {
    font-size: 1.8rem;
    margin: 0;
    font-weight: 600;
}

.header .subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    margin: 0;
}

/* Navigation Bar */
.nav-bar {
    background-color: #8B1538;
    padding: 0;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.nav-bar nav ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

.nav-bar nav li {
    margin: 0;
}

.nav-bar nav a {
    color: white;
    text-decoration: none;
    display: block;
    padding: 1rem 1.5rem;
    transition: background-color 0.2s;
    border-bottom: 3px solid transparent;
}

.nav-bar nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-bottom-color: rgba(255, 255, 255, 0.3);
}

.nav-toggle {
    display: none;
}

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

.content-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding-top: 1rem;
}

.content-wrapper > *:first-child {
    margin-top: 0;
}

.course-info {
    background-color: #f8f9fa;
    padding: 1rem 2rem;
    border-bottom: 1px solid #eee;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
}

/* Headings */
.main-content h1, .content-wrapper > h1:first-child {
    color: #A51C30;
    margin-bottom: 1.5rem;
    font-size: 2.2rem;
    font-weight: 700;
    border-bottom: 3px solid #A51C30;
    padding-bottom: 0.5rem;
    margin-top: 0;
}

.main-content h2 {
    color: #A51C30;
    margin-top: 2.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem 0 0.5rem 0;
    border-top: 3px solid #A51C30;
    border-bottom: 1px solid #dee2e6;
    font-size: 1.8rem;
    font-weight: 600;
}

.main-content h2:first-of-type {
    margin-top: 1rem;
    border-top: none;
}

.main-content h3 {
    color: #8B1538;
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding: 0.75rem 0 0.75rem 1rem;
    border-left: 4px solid #A51C30;
    background-color: #f8f9fa;
    font-size: 1.3rem;
}

.main-content h4 {
    color: #A51C30;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Text & Links */
.main-content p {
    margin-bottom: 1.2rem;
    line-height: 1.7;
}

.main-content a {
    color: #A51C30;
}

.main-content a:hover {
    color: #8B1538;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 1.5rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto; 
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background-color: #A51C30;
    color: white;
    font-weight: 600;
}

tr:nth-child(even) {
    background-color: #f8f9fa;
}

tr:hover {
    background-color: #f0f0f0;
}

/* Special Table Rows */
.week-header, .section-header td {
    background-color: #8B1538 !important;
    color: white;
    font-weight: bold;
}

.section-header td {
    background-color: #A51C30 !important;
    font-size: 1.2em !important;
    text-align: center !important;
    padding: 1.5rem !important;
}

.paper-title {
    font-style: italic;
    color: #555;
}


/* Other Content Elements */
blockquote {
    border-left: 4px solid #A51C30;
    background-color: #f8f9fa;
    padding: 1rem;
    margin: 1.5rem 0;
}

code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: Monaco, Consolas, monospace;
}

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

li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.main-content hr {
    margin: 2rem 0;
    border: none;
    border-top: 1px solid #dee2e6;
}

h1 + hr, h2 + hr {
    margin-top: 1rem;
    border-top: 1px solid #A51C30;
    opacity: 0.3;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .nav-bar nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-bar nav a {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .content-wrapper {
        max-width: 100%;
        padding-top: 0;
    }

    .main-content h1, .content-wrapper > h1:first-child {
        font-size: 1.8rem;
    }

    .main-content h2 {
        font-size: 1.5rem;
    }

    .main-content h3 {
        font-size: 1.2rem;
    }

    th, td {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: block;
        position: absolute;
        top: 1rem;
        right: 1rem;
        background: transparent;
        border: 0;
        cursor: pointer;
        z-index: 1001;
    }

    .hamburger {
        display: block;
        position: relative;
        width: 2em;
        height: 3px;
        background: white;
        transition: transform 0.3s ease;
    }

    .hamburger::before,
    .hamburger::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        height: 3px;
        background: white;
        transition: transform 0.3s ease, top 0.3s ease, bottom 0.3s ease;
    }

    .hamburger::before {
        top: -8px;
    }

    .hamburger::after {
        bottom: -8px;
    }

    .nav-bar nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #8B1538;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }

    .nav-bar .nav--visible {
        display: block;
    }

    .nav-bar nav ul {
        flex-direction: column;
        align-items: center;
        padding: 1rem 0;
    }

    .nav-bar nav li {
        width: 100%;
        text-align: center;
    }

    .nav-bar nav a {
        padding: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-bar nav li:last-child a {
        border-bottom: none;
    }
}

/* Blog Post Specific Styles */
.blog-post {
    max-width: 800px;
    margin: 0 auto;
}

.blog-post-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #A51C30;
}

.blog-post-header h1 {
    color: #A51C30;
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
    line-height: 1.2;
}

.blog-meta {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.blog-meta a {
    color: #1DA1F2;
    text-decoration: none;
}

.categories {
    color: #A51C30;
    font-weight: 500;
}

.category {
    background-color: #f8f9fa;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
}

.blog-content {
    line-height: 1.8;
    font-size: 1.1rem;
    margin-bottom: 3rem;
}

.blog-content p {
    margin-bottom: 1.5rem;
}

.blog-content h2 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: #A51C30;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.5rem;
}

.blog-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #8B1538;
}

.blog-post-footer {
    border-top: 1px solid #dee2e6;
    padding-top: 2rem;
}

/* Social Sharing */
.social-sharing {
    margin-bottom: 3rem;
}

.social-sharing h3 {
    color: #A51C30;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.share-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.share-button {
    display: inline-block;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    color: white;
}

.share-button.twitter { background-color: #1DA1F2; }
.share-button.linkedin { background-color: #0077B5; }
.share-button.hackernews { background-color: #FF6600; }
.share-button.reddit { background-color: #FF4500; }

.share-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Comments Section */
.comments-section {
    margin-top: 3rem;
}

.comments-section h3 {
    color: #A51C30;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.comment-guidelines {
    background-color: #f8f9fa; 
    padding: 1.5rem; 
    border-radius: 5px; 
    margin-bottom: 1.5rem; 
    border-left: 3px solid #A51C30;
}
.comment-guidelines p {
    margin: 0 0 1rem 0; 
    color: #555; 
    font-size: 0.9rem;
}
.comment-guidelines p:last-child {
    margin-bottom: 0;
}

/* Images and Figures in Blog Posts */
.blog-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
}

.post-figure {
    margin: 1.5rem 0;
    text-align: center;
}
.post-figure figcaption {
    font-size: 0.95rem;
    color: #555;
    margin-top: 0.5rem;
    padding: 0 1rem;
}


/* Post Navigation */
.post-navigation {
    margin-bottom: 3rem;
    padding: 2rem 0;
    border-bottom: 1px solid #dee2e6;
}

.nav-links {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
}

.nav-prev, .nav-next {
    flex: 1;
    max-width: 45%;
}

.nav-prev { text-align: left; }
.nav-next { text-align: right; }

.nav-link {
    display: block;
    text-decoration: none;
    padding: 1.5rem;
    border-radius: 8px;
    background-color: #f8f9fa;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    color: inherit;
}

.nav-link:hover {
    background-color: #e9ecef;
    border-color: #A51C30;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(165, 28, 48, 0.1);
}

.nav-direction {
    display: block;
    font-size: 0.9rem;
    color: #A51C30;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.nav-title {
    display: block;
    font-size: 1rem;
    color: #333;
    font-weight: 500;
    line-height: 1.3;
}

/* Author Connect Section */
.author-connect {
    margin-top: 3rem;
    padding: 2rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #A51C30;
}
.author-connect-header {
    font-size: 0.9rem; 
    color: #666; 
    margin-bottom: 1rem;
}
.author-connect-container {
    display: flex; 
    gap: 2rem; 
    flex-wrap: wrap;
}
.author-profile {
    flex: 1; 
    min-width: 200px;
}
.author-name {
    margin: 0 0 0.5rem 0; 
    color: #A51C30; 
    font-size: 1rem;
}
.author-links {
    display: flex; 
    gap: 0.5rem;
}

.connect-button-small {
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 5px;
    transition: all 0.3s ease;
    color: white;
}
.connect-button-small.linkedin-small { background-color: #0077B5; }
.connect-button-small.twitter-small { background-color: #1DA1F2; }

.connect-button-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}


/* Responsive Blog Styles */
@media (max-width: 768px) {
    .blog-post-header h1 {
        font-size: 2rem;
    }
    
    .blog-content {
        font-size: 1rem;
    }
    
    .share-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .share-button {
        text-align: center;
    }

    .nav-links {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-prev, .nav-next {
        max-width: 100%;
        text-align: left;
    }
    
    .post-navigation {
        padding: 1.5rem 0;
    }
    
    .nav-link {
        padding: 1rem;
    }

    .author-connect {
        padding: 1.5rem;
    }
}

/* Margin Notes */
.margin-note {
    display: none;
    position: absolute;
    right: -280px;
    width: 250px;
    padding: 1rem;
    background-color: #f8f9fa;
    border-left: 3px solid #A51C30;
    border-radius: 5px;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #555;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 10;
}

.margin-note:before {
    content: "💡 Note: ";
    font-weight: bold;
    color: #A51C30;
}

.blog-content {
    position: relative;
}

/* Show margin notes on larger screens */
@media (min-width: 1200px) {
    .margin-note {
        display: block;
    }
}

/* Clickable margin notes for smaller screens */
@media (max-width: 1199px) {
    .margin-note {
        display: block;
        position: relative;
        right: auto;
        width: auto;
        margin: 1.5rem 0;
        padding: 1rem;
        background-color: #f8f9fa;
        border: none;
        border-left: 3px solid #A51C30;
        border-radius: 5px;
        font-size: 0.9rem;
        color: #555;
        cursor: default;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }
    
    .margin-note:hover {
        background-color: #f8f9fa;
    }
}
