body {
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

body.dark-mode {
    background: black;
    color: white;
}

body.light-mode {
    background: #f8f7f2;
    color: #333;
}

header {
    text-align: center;
    padding: 2rem;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

nav a {
    text-decoration: none;
    margin: 0 1rem;
    font-size: 1.1rem;
}

body.dark-mode nav a {
    color: white;
}

body.light-mode nav a {
    color: black;
}

.mode-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

section {
    padding: 2rem;
    text-align: center;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

p {
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Single Timeline Styles (e.g., Academic Background) */
.timeline {
    position: relative;
    max-width: 850px;
    margin: 0 auto;
    padding: 1rem 0;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
    text-align: left;
    display: flex;
    align-items: center;
}

.timeline-item .date {
    font-size: 1rem;
    min-width: 160px;
    text-align: right;
    padding-right: 1rem;
}

body.dark-mode .timeline-item .date {
    color: #ccc;
}

body.light-mode .timeline-item .date {
    color: #666;
}

.timeline-item p {
    margin: 0;
    padding-left: 2rem;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 170px;
    top: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

body.dark-mode .timeline-item::before {
    background: white;
}

body.light-mode .timeline-item::before {
    background: black;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 174px;
    width: 2px;
}

body.dark-mode .timeline::before {
    background: #555;
}

body.light-mode .timeline::before {
    background: #ccc;
}

/* Dual Timeline Styles (e.g., Experience) */
.dual-timeline {
    display: flex;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    gap: 2rem;
}

.timeline-container {
    flex: 1;
    text-align: center;
}

.timeline-container .timeline {
    max-width: none;
    /* Override max-width for dual timelines */
    margin: 0;
    /* Remove auto margin for side-by-side layout */
}

/* Project Toggle Styles */
.toggle {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
}

.toggle-btn {
    border: none;
    padding: 0.8rem 1.5rem;
    margin: 0 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    border-radius: 25px;
    font-weight: 500;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

body.dark-mode .toggle-btn {
    background: #2d2d2d;
    color: #e0e0e0;
}

body.light-mode .toggle-btn {
    background: #f0f0f0;
    color: #333;
}

body.dark-mode .toggle-btn.active,
body.dark-mode .toggle-btn:hover {
    background: linear-gradient(135deg, #4a4a4a, #2d2d2d);
    color: #ffffff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

body.light-mode .toggle-btn.active,
body.light-mode .toggle-btn:hover {
    background: linear-gradient(135deg, #e0e0e0, #c7c7c7);
    color: #222;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.project-category {
    display: none;
}

.project-category.active {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2.5rem;
    max-width: 1200px;
    margin: 0 auto;
    justify-content: center;
}

@media (min-width: 769px) {
    .project-category.active {
        grid-template-columns: repeat(auto-fit, minmax(280px, 350px));
        row-gap: 5rem;
    }
}

@media (min-width: 1200px) {
    .project-category.active {
        grid-template-columns: repeat(3, minmax(280px, 350px));
    }
}

.project {
    padding: 1.5rem;
    margin: 0;
    border-radius: 12px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.project::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

body.dark-mode .project {
    background: #1a1a1a;
}

body.light-mode .project {
    background: #fffef7;
}

body.dark-mode .project::before {
    background: linear-gradient(90deg, #444, #666);
}

body.light-mode .project::before {
    background: linear-gradient(90deg, #ccc, #999);
}

body.dark-mode .project:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

body.light-mode .project:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.project h3 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
    text-align: center;
}

.project p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
    line-height: 1.6;
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 500;
    transition: all 0.3s ease;
    align-self: flex-end;
    margin-top: auto;
}

body.dark-mode .btn {
    background: #333;
    color: white;
}

body.light-mode .btn {
    background: #eee;
    color: #333;
}

body.dark-mode .btn:hover {
    background: #555;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

body.light-mode .btn:hover {
    background: #ddd;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Publications Styles */
.publication-list {
    max-width: 800px;
    margin: 0 auto;
}

.publication-category {
    display: none;
}

.publication-category.active {
    display: block;
}

.publication {
    padding: 1.5rem;
    margin: 1rem auto;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.publication::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

body.dark-mode .publication {
    background: #1a1a1a;
}

body.light-mode .publication {
    background: #f5f3e8;
}

body.dark-mode .publication::before {
    background: linear-gradient(90deg, #444, #666);
}

body.light-mode .publication::before {
    background: linear-gradient(90deg, #ccc, #999);
}

.publication p {
    font-size: 1rem;
    margin-bottom: 1rem;
    text-align: left;
}

.presentation-info {
    display: inline-block;
    font-style: italic;
    color: #4a90e2;
    margin-left: 5px;
    font-size: 0.9rem;
}

body.light-mode .presentation-info {
    color: #2c6cb9;
}

/* Shooting Stars Animation */
@keyframes shootingStar {
    0% {
        transform: translateX(0) translateY(0);
        opacity: 1;
    }

    100% {
        transform: translateX(300px) translateY(300px);
        opacity: 0;
    }
}

.shooting-star {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    animation: shootingStar 0.8s linear infinite;
    z-index: -1;
}

body.dark-mode .shooting-star {
    background: white;
    box-shadow: 0 0 5px 2px rgba(255, 255, 255, 0.5);
}

body.light-mode .shooting-star {
    background: black;
    box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.5);
}

/* Logo styles */
.timeline-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
    margin-right: 10px;
    vertical-align: middle;
    border-radius: 4px;
}

body.dark-mode .timeline-logo {
    background: white;
    padding: 2px;
}

body.light-mode .timeline-logo {
    background: white;
    padding: 2px;
}

/* Profile Photo Styles */
.profile-photo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.profile-photo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 35%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: 4px solid transparent;
    transition: all 0.3s ease;
}

body.dark-mode .profile-photo {
    border-color: #ffffff;
}

body.light-mode .profile-photo {
    border-color: #000000;
}

.profile-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Specific logo adjustments */
.reti-logo {
    margin-left: -8px;
    margin-right: 10px;
}

/* Responsive adjustments for profile photo */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    nav a {
        font-size: 1rem;
    }

    section {
        padding: 1rem;
    }

    .dual-timeline {
        flex-direction: column;
        gap: 1rem;
    }

    .timeline-item {
        flex-direction: column;
        text-align: center;
    }

    .timeline-item .date {
        text-align: center;
        padding-right: 0;
        margin-bottom: 0.5rem;
    }

    .timeline-item p {
        padding-left: 0;
    }

    .timeline-item::before {
        left: 50%;
        transform: translateX(-50%) translateY(0);
        top: auto;
        bottom: -1rem;
    }

    .timeline::before {
        left: 50%;
        transform: translateX(-50%);
    }

    .project,
    .publication {
        margin: 0.5rem;
    }

    .timeline-logo {
        width: 24px;
        height: 24px;
        margin-right: 5px;
    }

    .profile-photo {
        width: 150px;
        height: 150px;
    }
}

/* About Me text styling */
.about-me-text {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

.contact-logo {
    width: 32px;
    height: 32px;
    margin: 0 10px;
    transition: transform 0.3s ease;
}

.contact-logo:hover {
    transform: scale(1.2);
}

.contact-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin: 1rem auto;
}