:root {
    /* Light Theme */
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --light-text: #64748b;
    --white: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-border: rgba(226, 232, 240, 0.8);
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    /* Dark Theme */
    --primary-color: #60a5fa;
    --secondary-color: #93c5fd;
    --bg-color: #0f172a;
    --text-color: #f1f5f9;
    --light-text: #cbd5e1;
    --white: #1e293b; /* Card background in dark mode */
    --card-bg: rgba(30, 41, 59, 0.8);
    --card-border: rgba(51, 65, 85, 0.5);
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --bg-alt: #1e293b;
}

:root {
    /* ... existing vars ... */
    --bg-alt: #f1f5f9;
}

/* Section Styling */
.section {
    padding: 80px 0;
}

.section:nth-child(even) {
    background-color: var(--bg-alt);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 50px;
    color: var(--primary-color);
}

/* Timeline Styling */
.timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

.timeline-item {
    display: flex;
    gap: 20px; /* Reduced gap to fit logo */
    margin-bottom: 40px;
    align-items: flex-start;
}

.timeline-logo {
    width: 50px;
    height: 50px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    color: var(--primary-color);
    font-size: 1.2rem;
    flex-shrink: 0; /* Prevent shrinking */
    margin-top: 15px; /* Better alignment with card content */
}

/* Ensure darker bg for logo in dark mode if needed, though white often looks crisp */
[data-theme="dark"] .timeline-logo {
    background: rgba(30, 41, 59, 1);
    color: var(--primary-color);
    border-color: rgba(255, 255, 255, 0.1);
}

.timeline-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* or contain, depending on the logo */
    border-radius: 50%;
    padding: 2px; /* Optional: adds a little whitespace inside the border */
}

.timeline-date {
    min-width: 150px;
    text-align: right;
    font-weight: 600;
    color: var(--primary-color);
    padding-top: 25px; /* Align with content padding */
}

.timeline-content {
    flex: 1;
    text-align: left; /* Ensure left align */
}

.timeline-content h3 {
    margin-bottom: 5px;
    color: var(--text-color);
}

.timeline-content h4 {
    margin-bottom: 15px;
    color: var(--light-text);
    font-weight: 500;
}

.timeline-content ul {
    list-style: none; /* Remove default bullets */
    padding-left: 0;
    margin-top: 10px;
}

.timeline-content li {
    position: relative;
    padding-left: 20px; /* Space for the custom bullet */
    margin-bottom: 8px;
    line-height: 1.5;
}

.timeline-content li::before {
    content: ""; /* Use empty content for a shape */
    position: absolute;
    left: 0;
    top: 10px; /* Align with first line of text */
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%; /* Circle shape */
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.project-card h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.tags {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tags span {
    background: var(--bg-color);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.85rem;
    border: 1px solid var(--card-border);
}

/* Contact Links */
.contact-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.contact-item {
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.contact-item i {
    font-size: 1.2rem;
    color: var(--primary-color);
}

/* Footer */
footer {
    padding: 20px 0;
    text-align: center;
    background: var(--bg-alt);
    color: var(--light-text);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Fira Code', 'Monaco', 'Courier New', monospace;
    scroll-behavior: smooth;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Theme Toggle Button */
.theme-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: transform 0.3s;
}

.theme-btn:hover {
    transform: rotate(15deg) scale(1.1);
    color: var(--primary-color);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (max-width: 768px) {
    .container {
        padding: 0 25px; /* More padding on small screens */
    }
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s;
}

[data-theme="dark"] .navbar {
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 1px 2px rgba(255, 255, 255, 0.05);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
    align-items: center; /* Center items vertically for toggle button */
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.hamburger {
    display: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-color);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    width: 100%; /* Explicit width */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: 70px;
    position: relative;
    overflow: hidden;
}

/* Hero Text Shadow */
.hero h1, .hero h2, .hero p {
    text-shadow: 1px 5px 10px rgba(255, 255, 255, 0.8); /* Light glow for light mode */
}

[data-theme="dark"] .hero h1, 
[data-theme="dark"] .hero h2, 
[data-theme="dark"] .hero p {
    text-shadow: 0 5px 10px rgba(255, 255, 255, 0.2); /* Dark shadow for dark mode */
}

/* Ensure content sits above canvas */
.hero .container {
    position: relative;
    z-index: 2;
}

/* P5.js Canvas */
#gosper-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    opacity: 0.3;
    pointer-events: none;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
}

/* Hero Typography */
.hero h1, .hero h2, .hero p {
    white-space: nowrap;      /* Prevent wrapping */
    overflow: hidden;         /* Hide overflow if any */
    text-overflow: ellipsis;  /* Add dots if it really can't fit */
    max-width: 100%;          /* Ensure it doesn't break layout */
    margin-left: auto;
    margin-right: auto;
    width: fit-content;       /* Center the block naturally */
}

/* Specific sizing */
.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 10px;
}

.highlight {
    color: var(--primary-color);
}

.hero h2 {
    font-size: 1.5rem;
    color: var(--light-text);
    margin-bottom: 20px;
    font-weight: 500;
    
    display: block; 
    border-right: none;
    animation: fadeInUp 0.8s forwards 0.2s; 
    opacity: 0; 
}

.hero p {
    font-size: 1.2rem;
    color: var(--light-text);
    margin-bottom: 30px;
    /* Removed max-width 600px constraint */
}

/* Responsive Font Scaling to keep single line */
@media (max-width: 900px) {
    .hero h1 { font-size: 2.5rem; }
    .hero h2 { font-size: 1.5rem; }
    .hero p { font-size: 1rem; }
}

@media (max-width: 600px) {
    .hero h1 { font-size: 1.8rem; }
    .hero h2 { font-size: 1.1rem; }
    .hero p { font-size: 0.9rem; }
}

.hero-btns {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Glassmorphism/Card styles - Unified */
.about-content, .timeline-content, .project-card, .contact-item, .skill-item {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    border-radius: 12px;
    padding: 25px; /* Consistent padding */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.about-content:hover, .timeline-content:hover, .project-card:hover, .contact-item:hover, .skill-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
    border-color: var(--primary-color);
}

/* Specific About Section Styling */
.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Override skill item padding specifically if needed, but the general rule is good */
.skill-item {
    padding: 8px 16px; /* Keep skills smaller */
    border-radius: 20px;
    display: flex; /* Ensure flex is kept */
    align-items: center;
    gap: 8px;
}

/* Hero Title - Removed Typing, added subtle fade */
.hero h2 {
    display: block; /* Back to block */
    white-space: normal;
    border-right: none;
    animation: fadeInUp 0.8s forwards 0.2s; /* Reuse fade in */
    opacity: 0; 
    max-width: 100%;
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--primary-color); }
}

/* Button Refinement */
.btn {
    padding: 10px 20px; /* Slightly smaller */
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

/* Gosper Info Button */
.gosper-info-btn {
    position: relative; /* Changed from absolute */
    display: inline-block;
    margin-top: 30px;
    z-index: 10;
    font-size: 0.8rem;
    color: var(--light-text);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    opacity: 0; 
    animation: fadeInUp 0.8s forwards 0.8s; /* Delayed fade in */
}

[data-theme="dark"] .gosper-info-btn {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.05);
}

.gosper-info-btn:hover {
    opacity: 1;
    background: var(--card-bg);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.gosper-info-btn i {
    margin-right: 5px;
}

/* Animations - Subtle */
.animate-text {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s forwards;
}

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    .hamburger {
        display: block;
    }
    
    /* Allow wrapping on mobile for better UX */
    .hero h1, .hero h2, .hero p {
        white-space: normal;
        word-wrap: break-word;
        padding: 0 10px; /* Add padding to prevent edge touching */
    }

    .hero h1 {
        font-size: 2.2rem;
        line-height: 1.2;
    }

    .hero h2 {
        font-size: 1.3rem;
        line-height: 1.4;
        margin-bottom: 15px;
    }

    .hero p {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    .timeline-item {
        flex-direction: column;
        gap: 10px;
    }
    
    .timeline-date {
        text-align: left;
        min-width: auto;
    }

    .gosper-info-btn {
        font-size: 0.75rem; /* Slight resize only */
    }
}

/* Skills - Tight Button Style */
.skills-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px; /* Tighter gap */
}

.skill-item {
    background: var(--white);
    padding: 6px 14px; /* Smaller padding */
    border-radius: 20px; /* Pill shape */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.skill-item i {
    color: var(--primary-color);
    font-size: 1rem;
}

.skill-item:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.1);
}
