/* ==========================================================================
   ML Learning Portfolio - Shared Styles
   Industry-standard CSS following best practices
   ========================================================================== */

/* CSS Custom Properties (Variables) for Consistency */
:root {
    /* Color Palette from Color Hunt: #F9F7F7, #DBE2EF, #3F72AF, #112D4E */
    --bg-color: #F9F7F7;              /* Overall page background (Light Grey) */
    --card-bg-color: #ffffff;         /* Cards remain white for crisp contrast */
    --primary-text-color: #112D4E;    /* Very Dark Blue (almost black) for main headings, strong text */
    --secondary-text-color: #495057;  /* Dark Grey for paragraphs, secondary text (chosen for contrast) */
    --accent-1: #3F72AF;              /* Medium Blue for primary links, interactive elements */
    --accent-2: #112D4E;              /* Very Dark Blue for stronger accents, hover states */
    --header-text-color: var(--primary-text-color); /* Use primary text color for main headers */
    --shadow-color: rgba(17, 45, 78, 0.08); /* Shadow based on dark blue */
    --border-color: #DBE2EF;          /* Light Blue-Grey for subtle borders */
    --success-color: #28a745;         /* (Keep existing) */
    --warning-color: #ffc107;         /* (Keep existing) */
    --error-color: #dc3545;           /* (Keep existing) */
    
    /* Typography */
    --font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; /* Using Inter */
    --font-family-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    
    /* Spacing System */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-xxl: 4rem;
    
    /* Border Radius */
    --border-radius-sm: 5px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px var(--shadow-color);
    --shadow-md: 0 4px 15px var(--shadow-color);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);

    /* --- Timeline Specific Derived Variables --- */
    --timeline-shadow-soft: rgba(63, 114, 175, 0.15); /* Shadow based on --accent-1 */
    --timeline-shadow-hover: rgba(63, 114, 175, 0.25);
    --timeline-tag-bg: var(--border-color); /* Light blue-grey for tag backgrounds */

    /* --- Top Navigation Specific Variables (for project.html, etc.) --- */
    --top-nav-bg: var(--card-bg-color); /* White background for top nav */
    --top-nav-item-hover-bg: var(--border-color); /* Light blue-grey hover for top nav items */
    --top-nav-item-active-bg: var(--border-color); /* Light blue-grey active for top nav items */
}

/* ==========================================================================
   Base Styles - Reset and Foundation
   ========================================================================== */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-family-primary);
    background-color: var(--bg-color); /* Now uses the new light grey */
    color: var(--primary-text-color); /* Main body text uses dark blue/almost black */
    line-height: 1.7;
    margin: 0;
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

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

.main-container {
    width: 100%;
    max-width: 1200px;
    flex-grow: 1;
    display: flex;
    gap: var(--spacing-lg);
}

/* Sidebar Navigation - Default for main pages (index, html/*.html) */
.sidebar {
    width: 200px;
    min-width: 200px;
    background: var(--card-bg-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--spacing-md);
    height: fit-content;
    position: sticky;
    top: var(--spacing-lg);
    z-index: 100;
}

/* Main Content Area */
.main-content {
    flex: 1;
    min-width: 0; /* Prevents flex item from overflowing */
}

/* Navbar styles shared by both sidebar and top nav (default is sidebar orientation) */
.navbar {
    display: flex;
    flex-direction: column; /* Default: vertical for sidebar */
    gap: var(--spacing-xs);
    padding: 0;
    margin-bottom: 0;
    text-align: left;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    position: static;
    top: auto;
    z-index: auto;
}

.navbar a {
    font-weight: 600;
    color: var(--primary-text-color); /* Navbar links use dark blue/almost black */
    text-decoration: none;
    padding: var(--spacing-sm) var(--spacing-md);
    margin: 0;
    border-radius: var(--border-radius-md);
    transition: all var(--transition-normal);
    display: block;
    border: 2px solid transparent;
    text-align: left;
    width: 100%;
    font-size: 0.95rem;
}

/* Hover and Active Styles for Navbar - consistent across all uses */
.navbar a:hover {
    background-color: var(--border-color); /* Light blue-grey hover background */
    color: var(--accent-1); /* Medium blue hover text */
    border-color: var(--border-color); /* Consistent border color */
    transform: translateX(4px); /* Sidebar specific effect */
    box-shadow: 0 4px 12px rgba(63, 114, 175, 0.15); /* Tinted shadow from accent-1 */
}

.navbar a.active {
    background-color: var(--border-color); /* Light blue-grey active background */
    color: var(--accent-1); /* Medium blue active text */
    border-color: var(--accent-1); /* Medium blue active border */
    box-shadow: 0 2px 8px rgba(63, 114, 175, 0.1); /* Tinted shadow from accent-1 */
    transform: translateX(4px); /* Sidebar specific effect */
}


/* --- TOP NAVIGATION SPECIFIC STYLES (FOR PROJECT PAGES) --- */
/* Override default body padding and flex behavior for pages with top navigation */
body.top-nav-page {
    padding: 0; /* Remove global body padding */
    display: block; /* Override flex display for direct content flow */
    min-height: auto; /* Allow height to adjust naturally */
}

/* Top navigation bar wrapper */
.top-navbar-wrapper {
    width: 100%;
    background-color: var(--top-nav-bg);
    box-shadow: var(--shadow-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    position: sticky; /* Keep top nav visible when scrolling */
    top: 0;
    z-index: 1000;
}

/* Styles for the top navigation bar itself */
.top-navbar {
    max-width: 1200px; /* Match main container width */
    margin: 0 auto;
    display: flex;
    flex-direction: row; /* Horizontal layout for top nav */
    justify-content: center; /* Center items */
    gap: var(--spacing-md);
    padding: 0;
    list-style: none; /* Remove bullet points */
}

.top-navbar a {
    font-weight: 600;
    color: var(--primary-text-color);
    text-decoration: none;
    padding: var(--spacing-sm) var(--spacing-md);
    margin: 0;
    border-radius: var(--border-radius-md);
    transition: all var(--transition-normal);
    display: flex; /* Use flex for vertical centering in item */
    align-items: center;
    border: 2px solid transparent; /* Consistent border */
    font-size: 0.95rem;
}

/* Top Navbar Hover/Active styles - adjusted for horizontal layout */
.top-navbar a:hover {
    background-color: var(--top-nav-item-hover-bg);
    color: var(--accent-1);
    border-color: var(--border-color);
    transform: translateY(-2px); /* Subtle lift instead of slide */
    box-shadow: 0 4px 12px rgba(63, 114, 175, 0.1);
}

.top-navbar a.active {
    background-color: var(--top-nav-item-active-bg);
    color: var(--accent-1);
    border-color: var(--accent-1);
    box-shadow: 0 2px 8px rgba(63, 114, 175, 0.1);
    transform: translateY(-2px);
}

/* Main content wrapper for top nav pages */
.top-nav-content-wrapper {
    max-width: 1200px;
    margin: var(--spacing-lg) auto; /* Top margin to give space after nav */
    padding: 0 var(--spacing-lg);
    flex-grow: 1; /* Allow content to grow */
}


/* Header Section (for index.html main header, etc.) */
.header {
    text-align: center;
    margin-bottom: var(--spacing-xxl);
    padding: var(--spacing-xxl) var(--spacing-lg);
    background: linear-gradient(135deg, var(--bg-color) 0%, var(--card-bg-color) 50%, var(--border-color) 100%); /* Using new palette */
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg); /* Using project's shadow */
    color: var(--primary-text-color);
    border: 1px solid var(--border-color);
}

/* Add extra spacing after header for better visual separation */
header {
    margin-bottom: calc(var(--spacing-xxl) + var(--spacing-lg));
}

.header-image {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    object-position: center;
    border-radius: var(--border-radius-lg);
    margin-bottom: var(--spacing-xl);
    border: none;
    background: linear-gradient(135deg, var(--bg-color) 0%, var(--card-bg-color) 50%, var(--bg-color) 100%);
    box-shadow: 0 4px 20px var(--shadow-color);
    padding: var(--spacing-sm);
    display: block;
}

.header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin: 0 0 var(--spacing-md) 0;
    color: var(--primary-text-color); /* Uses dark blue/almost black */
    text-shadow: none;
    line-height: 1.2;
}

.header p {
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--secondary-text-color); /* Uses dark grey */
    margin: 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* ==========================================================================
   Content Components
   ========================================================================== */

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

.section-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--primary-text-color); /* Uses dark blue/almost black */
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--border-color);
    text-align: left;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background-color: var(--accent-1); /* Use medium blue accent */
    border-radius: 1px;
}

.card {
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    border: 1px solid var(--border-color);
    margin-bottom: var(--spacing-lg);
}

/* Enhanced card styling for landing page sections */
.about .card {
    background: linear-gradient(135deg, var(--card-bg-color) 0%, var(--border-color) 100%);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(63, 114, 175, 0.08); /* Accent-1 tinted shadow */
}

.projects .card {
    background: linear-gradient(135deg, var(--card-bg-color) 0%, var(--border-color) 100%);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(63, 114, 175, 0.08); /* Accent-1 tinted shadow */
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(63, 114, 175, 0.08); /* Accent-1 tinted shadow */
    border-color: var(--accent-1); /* Hover border */
}

.card h1,
.card h2,
.card h3,
.card h4,
.card h5,
.card h6 {
    color: var(--primary-text-color); /* Uses dark blue/almost black */
    margin-bottom: var(--spacing-sm);
}

.card h2 {
    font-size: 1.6rem;
    margin-top: 1.5em;
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid var(--border-color);
}

.card h3 {
    font-size: 1.3rem;
    color: var(--primary-text-color); /* Uses dark blue/almost black for stronger subheadings */
}

.card p,
.card li {
    line-height: 1.7;
    color: var(--secondary-text-color); /* Uses dark grey */
    margin-bottom: var(--spacing-sm);
}

.card a {
    color: var(--accent-1); /* Uses medium blue for links */
    text-decoration: none;
    transition: color var(--transition-fast);
}

.card a:hover {
    text-decoration: underline;
    color: var(--accent-2); /* Uses dark blue on hover */
}

/* ==========================================================================
   Prerequisites Page Specific Styles
   ========================================================================== */

.topic-section {
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.topic-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.topic-header h2 {
    color: var(--primary-text-color); /* Uses dark blue/almost black */
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.topic-header p {
    font-size: 1.1rem;
    color: var(--secondary-text-color); /* Uses dark grey */
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--spacing-lg);
}

.concept-card,
.resource-card {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.concept-card:hover,
.resource-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(63, 114, 175, 0.06); /* Accent-1 tinted shadow */
    border-color: var(--accent-1);
    background-color: var(--border-color); /* Use a subtle accent background */
}

.concept-card h3,
.resource-card h4 {
    color: var(--primary-text-color); /* Uses dark blue/almost black */
    font-size: 1.3rem;
    margin-bottom: var(--spacing-md);
}

.concept-list {
    list-style: disc;
    padding-left: var(--spacing-lg);
    flex-grow: 1;
}

.concept-list li {
    font-size: 0.95rem;
    margin-bottom: var(--spacing-sm);
    color: var(--secondary-text-color); /* Uses dark grey */
}

.concept-list li strong {
    color: var(--primary-text-color); /* Uses dark blue/almost black */
}

.resource-card p {
    font-size: 0.9rem;
    flex-grow: 1;
    margin-bottom: var(--spacing-md);
}

.resource-link {
    display: inline-block;
    text-decoration: none;
    background-color: var(--border-color); /* Light blue-grey for button background */
    color: var(--accent-1); /* Medium blue for button text */
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    transition: all var(--transition-normal);
    text-align: center;
    margin-top: auto;
    border: 2px solid var(--accent-1); /* Border with medium blue */
}

.resource-link:hover {
    background-color: var(--accent-1); /* Medium blue on hover */
    color: var(--card-bg-color); /* White text on hover */
    border-color: var(--accent-2); /* Dark blue border on hover */
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(63, 114, 175, 0.15); /* Accent-1 tinted shadow */
    text-decoration: none;
}

/* ==========================================================================
   Project List Styles
   ========================================================================== */

.project-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.project-list li {
    margin-bottom: var(--spacing-md);
}

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

.project-list a {
    display: block;
    padding: var(--spacing-lg) var(--spacing-xl);
    background: linear-gradient(135deg, var(--card-bg-color) 0%, var(--bg-color) 100%); /* Blend white with page bg */
    border-radius: var(--border-radius-md);
    text-decoration: none;
    color: var(--primary-text-color); /* Uses dark blue/almost black */
    font-size: 1.1rem;
    font-weight: 600;
    transition: all var(--transition-normal);
    border: 2px solid var(--border-color);
    position: relative;
    margin-bottom: var(--spacing-sm);
}

.project-list a:hover {
    background: linear-gradient(135deg, var(--border-color) 0%, var(--accent-1) 10%); /* Hover effect with accent */
    color: var(--card-bg-color); /* White text on hover */
    border-color: var(--accent-2); /* Dark blue border on hover */
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(63, 114, 175, 0.15); /* Accent-1 tinted shadow */
}

.project-list a span {
    transition: color var(--transition-normal);
}

/* ==========================================================================
   Code and Technical Elements
   ========================================================================== */

pre {
    background-color: var(--bg-color); /* Use light grey bg */
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-md);
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid var(--border-color);
    margin: var(--spacing-md) 0;
}

code {
    font-family: var(--font-family-mono);
    font-size: 0.9rem;
    background-color: var(--bg-color); /* Use light grey bg */
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    color: var(--primary-text-color); /* Uses dark blue/almost black */
}

pre code {
    background-color: transparent;
    padding: 0;
}

/* ==========================================================================
   Tables
   ========================================================================== */

table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-md) 0;
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

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

th {
    background-color: var(--border-color); /* Use light blue-grey */
    font-weight: 600;
    color: var(--primary-text-color); /* Uses dark blue/almost black */
}

tr:nth-child(even) {
    background-color: var(--bg-color); /* Use page bg color for even rows */
}

tr:hover {
    background-color: var(--border-color); /* Light blue-grey on hover */
}

/* ==========================================================================
   Dividers and Separators
   ========================================================================== */

hr {
    border: 0;
    height: 1px;
    background-color: var(--border-color);
    margin: var(--spacing-lg) 0;
}

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

footer {
    text-align: center;
    padding: var(--spacing-xxl) var(--spacing-lg);
    color: var(--secondary-text-color); /* Uses dark grey */
    width: 100%;
    margin-top: auto;
}

footer a {
    color: var(--accent-1); /* Uses medium blue */
    text-decoration: none;
    transition: color var(--transition-normal);
}

footer a:hover {
    color: var(--accent-2); /* Uses dark blue */
}

/* ==========================================================================
   Responsive Design - Mobile First Approach
   ========================================================================== */

/* Small devices (phones, 480px and down) */
@media (max-width: 480px) {
    body {
        padding: var(--spacing-sm);
    }
    
    .main-container {
        padding: 0;
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .sidebar {
        width: 100%;
        min-width: auto;
        position: static;
        order: 2;
    }
    
    .main-content {
        order: 1;
    }
    
    /* Top navigation also needs to become vertical/stacked on small screens */
    .top-navbar-wrapper {
        padding: var(--spacing-sm) var(--spacing-xs);
    }
    .top-navbar {
        flex-direction: column;
        gap: var(--spacing-xs);
    }
    .top-navbar a {
        padding: var(--spacing-xs) var(--spacing-sm);
        text-align: center;
        width: auto; /* Allow items to size naturally */
        align-self: stretch; /* Stretch to fill available space */
    }
    .top-navbar a:hover,
    .top-navbar a.active {
        transform: translateY(-2px); /* Keep subtle lift */
    }


    .header {
        padding: var(--spacing-xl) var(--spacing-md);
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .header-image {
        max-height: 300px;
        padding: var(--spacing-xs);
    }
    
    .section-title {
        font-size: 1.4rem;
    }
    
    .card {
        padding: var(--spacing-lg);
    }
    
    .project-list a {
        font-size: 1.1rem;
    }
    
    .navbar {
        display: flex;
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
        gap: var(--spacing-xs);
    }
    
    .navbar a {
        margin: 0;
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.9rem;
        display: inline-block;
        width: auto;
        text-align: center;
    }
    
    .navbar a:hover,
    .navbar a.active {
        transform: translateY(-2px);
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .topic-header h2 {
        font-size: 1.7rem;
    }
}

/* Medium devices (tablets, 768px and down) */
@media (max-width: 768px) {
    body {
        padding: var(--spacing-md);
    }
    
    .main-container {
        padding: 0;
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .sidebar {
        width: 100%;
        min-width: auto;
        position: static;
        order: 2;
    }
    
    .main-content {
        order: 1;
    }
    
    /* Top navigation also needs responsive adjustments */
    .top-navbar {
        gap: var(--spacing-sm);
        flex-wrap: wrap; /* Allow items to wrap */
    }
    .top-navbar a {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.9rem;
    }


    .header h1 {
        font-size: 2.4rem;
    }
    
    .header p {
        font-size: 1.1rem;
    }
    
    .section-title {
        font-size: 1.6rem;
    }
    
    .card {
        padding: var(--spacing-lg);
    }
    
    .navbar {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
        gap: var(--spacing-xs);
    }
    
    .navbar a {
        padding: var(--spacing-xs) var(--spacing-sm);
        margin: 0;
        font-size: 0.9rem;
        display: inline-block;
        width: auto;
        text-align: center;
    }
    
    .navbar a:hover,
    .navbar a.active {
        transform: translateY(-2px);
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
}

/* Large devices (desktops, 1024px and up) */
@media (min-width: 1024px) {
    .content-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    }
    
    .header-image {
        max-height: 600px;
        padding: var(--spacing-md);
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .main-container {
        max-width: 1400px;
    }
    
    .content-grid {
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    }
}

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

/* Focus indicators for keyboard navigation */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--accent-1);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --bg-color: #ffffff;
        --card-bg-color: #ffffff;
        --primary-text-color: #000000;
        --secondary-text-color: #333333;
        --border-color: #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Print styles */
@media print {
    .navbar, .top-navbar-wrapper { /* Hide both navs for print */
        display: none;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    a {
        color: #000 !important;
        text-decoration: underline;
    }
    
    .header {
        background: none !important;
        color: #000 !important;
    }
}


/* ==========================================================================
   Timeline Specific Styles (for AIML_Research.html)
   These styles now fully integrate with the new global palette,
   maintaining the single-sided layout and elegant feel.
   ========================================================================== */

/* Specific body styling for the timeline page */
body.timeline-page {
    background-color: var(--bg-color); /* Uses the new global light grey */
    padding: 0; /* Remove default body padding to control layout better within main-container */
    display: flex; /* Ensure flex behavior for centering main-container */
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* The timeline page header section, adapting existing .header styles with new palette */
.timeline-page-header {
    text-align: center;
    margin-bottom: var(--spacing-xxl); /* Use project's spacing */
    padding: var(--spacing-xxl) var(--spacing-lg); /* Use project's spacing */
    background: linear-gradient(135deg, var(--bg-color) 0%, var(--card-bg-color) 50%, var(--border-color) 100%); /* Consistent gradients */
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md); /* Using project's shadow */
    color: var(--primary-text-color);
    border: 1px solid var(--border-color); /* Using project's border color */
    width: 100%; /* Ensure it spans available width */
    max-width: 960px; /* Constrain width for better readability */
    margin-left: auto;
    margin-right: auto;
}

.timeline-page-header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--primary-text-color); /* Uses dark blue/almost black for strong heading contrast */
    margin: 0 0 var(--spacing-md) 0;
    line-height: 1.2;
}

.timeline-page-header p {
    font-size: 1.1rem;
    color: var(--secondary-text-color); /* Uses dark grey for body text */
    max-width: 700px;
    margin: 0 auto;
}

/* Era Heading for grouping timeline items */
.era-heading {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-text-color); /* Uses dark blue/almost black for era heading */
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin: var(--spacing-xxl) 0 var(--spacing-lg) 0; /* Adjust vertical spacing */
    padding-left: 65px; /* Offset to align with timeline bar */
    position: relative;
    max-width: 960px; /* Constrain width to align with cards */
    margin-left: auto;
    margin-right: auto;
}

.era-heading::before {
    content: '';
    position: absolute;
    left: 15px; /* Matches timeline bar position */
    top: 50%;
    transform: translateY(-50%);
    width: 25px; /* Short line before heading */
    height: 2px;
    background-color: var(--accent-1); /* Uses medium blue for accent line */
}

/* Main timeline content area - the vertical bar and items */
.timeline-content-area {
    position: relative;
    padding-left: 65px; /* Offset for timeline bar and markers */
    max-width: 960px; /* Constrain width for better readability */
    margin-left: auto;
    margin-right: auto;
}

.timeline-content-area::before {
    content: '';
    position: absolute;
    left: 28px; /* Centered with marker */
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-1); /* Timeline bar with medium blue */
    z-index: 0;
}

/* Individual timeline item */
.timeline-item {
    position: relative;
    margin-bottom: var(--spacing-xl); /* Spacing between cards, using project spacing */
}

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

/* The circular marker on the timeline bar */
.timeline-marker {
    position: absolute;
    left: -15px; /* Positioned relative to timeline-content-area's left padding */
    top: 0.8rem; /* Vertical alignment with card */
    height: 18px;
    width: 18px;
    background: var(--card-bg-color); /* Using project's card background for marker fill */
    border: 3px solid var(--accent-1); /* Border with medium blue */
    border-radius: 50%;
    z-index: 1; /* Above the timeline bar */
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.timeline-item:hover .timeline-marker {
    background: var(--accent-1); /* Medium blue on hover */
    border-color: var(--accent-2); /* Dark blue border on hover */
}

/* The content card for each timeline item */
.timeline-card {
    background: var(--card-bg-color); /* Using project's card background */
    border: 1px solid var(--border-color); /* Using project's border color */
    border-radius: var(--border-radius-lg); /* Using project's border-radius */
    padding: var(--spacing-lg) var(--spacing-xl); /* Using project's spacing */
    box-shadow: 0 8px 25px var(--timeline-shadow-soft); /* Soft, tinted shadow */
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    position: relative;
    margin-left: var(--spacing-md); /* Space between marker/line and card */
}

.timeline-card:hover {
    transform: translateY(-7px); /* More noticeable lift */
    box-shadow: 0 12px 30px var(--timeline-shadow-hover);
}

.timeline-card .year {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-text-color); /* Year text with dark blue/almost black for prominence */
    margin-bottom: 0.6rem;
    display: block;
    letter-spacing: 0.5px;
}

.timeline-card h3 {
    margin: 0 0 var(--spacing-sm) 0; /* Using project's spacing */
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-text-color); /* Uses dark blue/almost black */
    line-height: 1.3;
}

.timeline-card p {
    margin: 0 0 var(--spacing-md) 0; /* Using project's spacing */
    color: var(--secondary-text-color); /* Uses dark grey */
    font-size: 1rem;
}

/* Tags styling */
.tags {
    margin-bottom: var(--spacing-md); /* Using project's spacing */
    display: flex;
    flex-wrap: wrap;
    gap: 8px; /* Consistent spacing between tags */
}

.tag {
    display: inline-block;
    background: var(--timeline-tag-bg); /* Light blue-grey for tag background */
    border: 1px solid var(--accent-1); /* Border with medium blue */
    color: var(--primary-text-color); /* Tag text with dark blue/almost black */
    padding: 6px 14px;
    border-radius: 20px; /* More pill-shaped */
    font-size: 0.85rem;
    font-weight: 600;
}

/* Link Button styling */
.timeline-card .link-button {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-md); /* Using project's spacing */
    background-color: var(--accent-1); /* Button background with medium blue */
    color: var(--card-bg-color); /* White text from project's palette */
    text-decoration: none;
    border-radius: var(--border-radius-md); /* Using project's border-radius */
    font-weight: 600;
    transition: background-color var(--transition-normal), transform var(--transition-fast);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); /* Subtle button shadow */
    border: none; /* No extra border */
}

.timeline-card .link-button:hover {
    background-color: var(--accent-2); /* Dark blue on hover */
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

/* Responsive Adjustments for Timeline */
@media (max-width: 768px) {
    .timeline-page-header h1 {
        font-size: 2.2rem;
    }
    .timeline-page-header p {
        font-size: 1rem;
    }
    .era-heading {
        font-size: 1.1rem;
        padding-left: 50px;
    }
    .era-heading::before {
        left: 10px;
        width: 20px;
    }
    .timeline-content-area {
        padding-left: 50px;
    }
    .timeline-content-area::before {
        left: 20px;
    }
    .timeline-marker {
        left: -20px;
        top: 0.6rem;
    }
    .timeline-card {
        padding: 1.2rem 1.5rem;
        margin-left: 10px;
    }
    .timeline-card h3 {
        font-size: 1.3rem;
    }
    .timeline-card p {
        font-size: 0.95rem;
    }
    .timeline-card .link-button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .timeline-page-header {
        margin-bottom: var(--spacing-xl); /* Adjusted for smaller screens */
    }
    .timeline-page-header h1 {
        font-size: 1.8rem;
    }
    .era-heading {
        font-size: 1rem;
        padding-left: 40px;
        margin: var(--spacing-xl) 0 var(--spacing-md) 0; /* Adjust spacing */
    }
    .era-heading::before {
        left: 5px;
        width: 15px;
    }
    .timeline-content-area {
        padding-left: 40px;
    }
    .timeline-content-area::before {
        left: 15px;
    }
    .timeline-marker {
        left: -20px;
        top: 0.5rem;
        height: 14px;
        width: 14px;
        border-width: 2px;
    }
    .timeline-item {
        margin-bottom: var(--spacing-lg); /* Adjusted for smaller screens */
    }
    .timeline-card {
        padding: 1rem 1.2rem;
        margin-left: 5px;
    }
    .timeline-card h3 {
        font-size: 1.15rem;
    }
    .timeline-card p {
        font-size: 0.9rem;
    }
    .tags {
        gap: 5px;
    }
    .tag {
        padding: 4px 10px;
        font-size: 0.75rem;
    }
    .timeline-card .link-button {
        padding: 8px 15px;
        font-size: 0.85rem;
    }
}