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

/* Light theme defaults */
:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --accent-color: #3b82f6;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #ffffff;
    --background-light: #f9fafb;
    --background-white: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --navbar-height: 70px;
}

/* Dark theme overrides */
body.dark-theme {
    --primary-color: #38bdf8;
    --secondary-color: #0ea5e9;
    --accent-color: #22c55e;
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-light: #f9fafb;
    --background-light: #020617;
    --background-white: #020617;
    --border-color: #1f2937;
    --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.7), 0 2px 4px -1px rgba(15, 23, 42, 0.8);
    --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.9), 0 10px 10px -5px rgba(15, 23, 42, 0.9);
    background-color: var(--background-white);
    color: var(--text-primary);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-white);
}

html {
    scroll-behavior: smooth;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--background-white);
    box-shadow: var(--shadow);
    z-index: 1000;
    transition: all 0.3s ease;
}

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

/* New: left cluster for toggle + brand */
.nav-left {
    display: flex;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Theme toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-right: 1.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background-color: var(--background-light);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    user-select: none;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.theme-toggle:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.theme-toggle-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.theme-toggle-label {
    letter-spacing: 0.02em;
}

/* Adjust toggle colors in dark mode */
body.dark-theme .theme-toggle {
    background-color: #020617;
    border-color: #1e293b;
}

/* Navigation menu / burger */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.hamburger {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    margin: 5px 0;
    transition: 0.3s;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: color 0.3s ease;
    padding: 0.5rem 0;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .nav-container {
        padding: 1rem;
    }

    .nav-toggle {
        display: block;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        height: 100vh;
        background-color: var(--background-white);
        flex-direction: column;
        padding: 5rem 2rem 2rem;
        box-shadow: var(--shadow-lg);
        transition: right 0.3s ease;
        gap: 1.2rem;
        align-items: flex-start;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-toggle.active .hamburger:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }

    .nav-toggle.active .hamburger:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active .hamburger:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }

    .nav-link {
        font-size: 1.1rem;
    }

    .theme-toggle {
        margin-right: 0.75rem;
    }
}

/* Hero Section */
.hero {
    padding: 8rem 2rem 6rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-light);
    text-align: center;
    margin-top: var(--navbar-height);
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero-subtitle {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    opacity: 0.95;
}

.cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background-color: var(--text-light);
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Sections */
.section {
    padding: 5rem 0;
}

.section-alt {
    background-color: var(--background-light);
}

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

/* About Section */
.about-content {
    max-width: 900px;
    margin: 0 auto;
}

.about-content p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.tech-stack {
    margin-top: 3rem;
}

.tech-stack h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tech-tag {
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: var(--text-light);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Work Experience Section */
.experience-timeline {
    max-width: 900px;
    margin: 0 auto;
}

.experience-item {
    margin-bottom: 3rem;
    padding: 2rem;
    background-color: var(--background-white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}

.experience-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* Logo placeholder – round image */
.experience-logo {
    width: 64px;
    height: 64px;
    border-radius: 9999px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: var(--shadow);
    background-color: var(--background-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.experience-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.experience-body {
    flex: 1;
}

.experience-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.experience-header h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.experience-period {
    color: var(--text-secondary);
    font-weight: 500;
}

.experience-company {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

/* Collapsible content */
.experience-content {
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 4;       /* show 4 lines when collapsed */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.experience-details {
    list-style-position: inside;
}

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

/* Expanded state – remove clamp */
.experience-item.expanded .experience-content {
    -webkit-line-clamp: unset;
    max-height: none;
}

/* "Read more..." toggle */
.experience-toggle {
    margin-top: 1rem;
    padding: 0;
    border: none;
    background: none;
    color: var(--primary-color);
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-size: 0.95rem;
}

.experience-toggle:focus {
    outline: none;
    text-decoration-thickness: 2px;
}

/* Services Section */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.service-card {
    padding: 2rem;
    background-color: var(--background-white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* New: image-based icons for services */
.service-icon {
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
}

.service-icon img {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: var(--shadow);
}

.service-card h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.service-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Publications Section */
.publications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.publication-card {
    background-color: var(--background-white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.publication-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.publication-link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.publication-image-wrapper {
    position: relative;
    overflow: hidden;
}

.publication-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.publication-card:hover .publication-image {
    transform: scale(1.04);
}

.publication-content {
    padding: 1.5rem;
}

.publication-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.publication-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}


/* Contact Section */
.contact-content {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.contact-intro {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    line-height: 1.8;
}

.contact-methods {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.contact-item {
    padding: 2rem;
    background-color: var(--background-white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.contact-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* New: image-based icons for contact */
.contact-icon {
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
}

.contact-icon img {
    width: 48px;
    height: 48px;
    border-radius: 9999px;
    object-fit: cover;
    box-shadow: var(--shadow);
}

.contact-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.contact-info a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.contact-info a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Footer */
.footer {
    background-color: var(--text-primary);
    color: var(--text-light);
    padding: 2rem 0;
    text-align: center;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.footer-links a {
    color: var(--text-light);
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.footer-links a:hover {
    opacity: 0.8;
}

.separator {
    opacity: 0.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .section {
        padding: 3rem 0;
    }

    .section-title {
        font-size: 2rem;
    }

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

    .contact-methods {
        grid-template-columns: 1fr;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .experience-item {
        flex-direction: row;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 6rem 1rem 4rem;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .container {
        padding: 0 1rem;
    }

    .experience-item {
        flex-direction: column;
    }

    .experience-logo {
        margin-bottom: 0.75rem;
    }
}
