:root {
    --base-color: #7a8288;
    --bg-color: #fff;
    --border-color: #f2f3f3;
    --link-color: #52adc8;
    --link-color-hover: #2f7f93;
    --text-color: #494e52;
    --text-color-light: #bdc1c4;
    --masthead-link-color: #494e52;
    --masthead-link-color-hover: #5a6065;
    --container-width: 750px;
    --sidebar-width: 220px;
}

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

::selection {
    color: #fff;
    background: #000;
}

html {
    font-size: 16px;
    text-size-adjust: 100%;
    background-color: var(--bg-color);
}

@media (min-width: 48em) {
    html {
        font-size: 18px;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Mobile Layout (Default) */

.sidebar {
    padding: 2rem 1.5rem;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 100%;
    margin: 0 auto;
}

.profile-picture {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 1rem;
    background-color: var(--bg-color);
    padding: 5px;
    border: 2px solid var(--border-color);
    box-sizing: border-box;
}

.profile-picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

.sidebar-name {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.sidebar-bio {
    font-size: 0.85rem;
    color: var(--text-color);
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.sidebar-bio a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s;
}

.sidebar-bio a:hover {
    color: var(--link-color-hover);
    text-decoration: underline;
}

.contact-list {
    list-style: none;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    text-align: left;
}

.contact-list li {
    margin-bottom: 0.625rem;
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-color);
}

.contact-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.75rem;
    transition: color 0.2s;
}

.contact-link:hover {
    color: var(--link-color);
}

.contact-list .icon {
    margin-right: 0.75rem;
    flex-shrink: 0;
    color: var(--base-color);
    transition: color 0.2s;
}

.contact-link:hover .icon {
    color: var(--link-color);
}

.external-icon {
    margin-left: 0.5rem;
    flex-shrink: 0;
    opacity: 0.6;
    color: var(--base-color);
    transition: opacity 0.2s, color 0.2s;
}

.contact-link:hover .external-icon {
    opacity: 1;
    color: var(--link-color);
}

/* Calendly sidebar link */
.calendly-link {
    cursor: pointer;
}

.calendly-link:hover {
    color: var(--link-color);
}

/* Navbar */
.navbar {
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0.375rem 0;
    position: sticky;
    top: 0;
    z-index: 200;
}

.navbar-content {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0.375rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-home-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s;
}

.navbar-home-icon:hover {
    color: var(--masthead-link-color-hover);
}

.navbar-home-icon.active {
    color: var(--link-color);
}

.navbar-home-icon svg {
    display: block;
    width: 18px;
    height: 18px;
}

.menu-toggle {
    display: flex;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    padding: 0.25rem;
}

.navbar-right {
    display: none; /* Hidden on mobile by default */
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    flex-direction: column;
    padding: 0.375rem 0.75rem;
    gap: 0;
}

.navbar-right.active {
    display: flex;
}

.nav-link {
    text-decoration: none;
    color: var(--masthead-link-color);
    font-size: 1rem;
    transition: color 0.2s;
    padding: 0.375rem 0;
    line-height: 1.4;
}

.navbar-right .nav-link {
    border-bottom: 1px solid var(--border-color);
    padding: 0.875rem 0;
    font-size: 1rem;
}

.navbar-right .nav-link:last-child {
    border-bottom: none;
}

.navbar-right .nav-link.home-icon {
    display: none;
}

.nav-link:hover {
    color: var(--masthead-link-color-hover);
}

.nav-link.active {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.nav-link.home-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-link.home-icon svg {
    display: block;
}

.nav-link.home-icon.active {
    color: var(--link-color);
}

.nav-link.home-icon.active svg {
    color: var(--link-color);
}

/* Main Content */
.main-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
    text-align: justify;
}

.main-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1.25rem;
    line-height: 1.3;
    color: var(--text-color);
    text-align: justify;
}

.main-title .section-title-link {
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

.content p {
    margin-bottom: 1.25rem;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
    text-align: justify;
}

.content ul {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
    text-align: justify;
}

.content li {
    margin-bottom: 0.5rem;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
    text-align: justify;
}

.content a {
    color: var(--link-color);
    text-decoration: none;
}

.content a:hover {
    color: var(--link-color-hover);
    text-decoration: underline;
}

.section-title {
    font-size: 1.35rem;
    font-weight: bold;
    margin-top: 1.75rem;
    margin-bottom: 1.25rem;
    color: var(--text-color);
    text-align: justify;
}

.section-title-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-color) !important;
    transition: color 0.2s;
}

.section-title-link:hover {
    color: var(--link-color) !important;
    text-decoration: none;
}

.section-title-link .external-icon {
    opacity: 0.6;
    color: var(--base-color);
    transition: opacity 0.2s, color 0.2s;
}

.section-title-link:hover .external-icon {
    opacity: 1;
    color: var(--link-color);
}

/* Education Page Styles */
.education-item {
    margin-bottom: 2rem;
}

.education-institution {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    text-align: justify;
}

.education-degree {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-color);
    text-align: justify;
}

.education-details {
    font-size: 0.95rem;
    color: var(--base-color);
    margin-bottom: 1rem;
    text-align: justify;
}

.stat-item {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    text-align: justify;
}

.stat-item strong {
    font-weight: 600;
}

.education-section {
    margin-top: 1.5rem;
}

.education-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-color);
    text-align: justify;
}

.coursework {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-color);
    margin-bottom: 1rem;
    text-align: justify;
}

.coursework sup {
    font-size: 0.75em;
    vertical-align: super;
    line-height: 0;
    font-weight: bold;
    color: var(--text-color);
}

/* Publications Page Styles */
.publication-item {
    margin-bottom: 2rem;
}

.publication-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    text-align: justify;
    line-height: 1.4;
}

.publication-authors {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    color: var(--text-color);
    text-align: justify;
}

.publication-venue {
    font-size: 0.95rem;
    color: var(--base-color);
    margin-bottom: 0.75rem;
    text-align: justify;
}

.publication-venue em {
    font-style: italic;
}

.publication-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-color);
    margin-bottom: 1rem;
    text-align: justify;
}

/* Projects Page Styles */
.project-disclaimer {
    font-size: 0.95rem;
    color: var(--base-color);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    text-align: justify;
}

.project-list {
    margin-top: 1rem;
}

.project-item {
    margin-bottom: 0.25rem;
}

.project-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
}

.project-logo {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    object-fit: cover;
    background-color: var(--border-color);
    padding: 0;
    flex-shrink: 0;
}

.project-text {
    flex: 1;
}

.project-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    text-align: justify;
    line-height: 1.4;
}

.project-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-color);
    margin-bottom: 1rem;
    text-align: justify;
}

/* Blog Page Styles */
.blog-empty {
    color: var(--base-color);
    font-style: italic;
}

.blog-year-section {
    margin-bottom: 2.5rem;
}

.blog-year {
    font-size: 1.1rem;
    font-weight: normal;
    color: var(--base-color);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.blog-post {
    margin-bottom: 2rem;
}

.blog-post-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.blog-post-title a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s;
}

.blog-post-title a:hover {
    color: var(--link-color-hover);
    text-decoration: underline;
}

.blog-post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.blog-read-time {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--base-color);
}

.blog-read-time svg {
    flex-shrink: 0;
}

.blog-post-date {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.95rem;
    color: var(--text-color);
    margin-bottom: 0.75rem;
}

.blog-post-date svg {
    flex-shrink: 0;
    color: var(--base-color);
}

.blog-post-date strong {
    font-weight: 600;
}

.blog-post-excerpt {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-color);
    margin-bottom: 0;
    text-align: justify;
}

/* Blog Post Full Page Styles */
.blog-post-header {
    margin-bottom: 1.5rem;
}

.blog-post-header .main-title {
    margin-bottom: 0.5rem;
}

.blog-post-header .blog-post-meta {
    margin-bottom: 0.75rem;
}

.blog-post-content h2 {
    font-size: 1.25rem;
    font-weight: bold;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.blog-post-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.blog-post-content p {
    margin-bottom: 1.25rem;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-color);
    text-align: justify;
}

.blog-post-content ol,
.blog-post-content ul {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.blog-post-content li {
    margin-bottom: 0.5rem;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-color);
}

.blog-post-content code {
    font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;
    font-size: 0.875em;
    background-color: var(--border-color);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    color: var(--text-color);
}

.blog-post-content pre {
    background-color: #f6f8fa;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1.25rem;
}

.blog-post-content pre code {
    background-color: transparent;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.blog-post-content blockquote {
    border-left: 4px solid var(--link-color);
    padding-left: 1rem;
    margin: 1.25rem 0;
    color: var(--base-color);
    font-style: italic;
}

/* Timeline Styles */
.timeline {
    margin-top: 1rem;
}

.timeline-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2rem;
    position: relative;
    padding-left: 1.5rem;
}

.timeline-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--base-color);
}

.timeline-marker {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--border-color);
}

.timeline-dot {
    position: absolute;
    left: -5px;
    top: 0.5rem;
    width: 12px;
    height: 12px;
    background-color: var(--base-color);
    border-radius: 50%;
    border: 2px solid var(--bg-color);
    z-index: 1;
    position: relative;
}

.timeline-line {
    position: absolute;
    top: 0.9rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: calc(100% - 0.9rem + 1.5rem + 0.4rem);
    background-color: var(--border-color);
}

.timeline-item:last-child .timeline-line {
    display: none;
}

.timeline-logo {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    object-fit: contain;
    background-color: var(--border-color);
    padding: 0;
    flex-shrink: 0;
}

.timeline-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
}

.timeline-text {
    flex: 1;
}

.timeline-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.15rem;
    line-height: 1.4;
}

.timeline-title a {
    color: var(--link-color);
    text-decoration: none;
}

.timeline-title a:hover {
    text-decoration: underline;
    color: var(--link-color-hover);
}

.timeline-role {
    font-size: 0.9rem;
    color: var(--base-color);
    margin-bottom: 0.35rem;
}

.timeline-description {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-color);
    text-align: justify;
}

.timeline-description a {
    color: var(--link-color);
    text-decoration: none;
}

.timeline-description a:hover {
    text-decoration: underline;
    color: var(--link-color-hover);
}

/* Desktop Overrides (>= 768px) */
@media (min-width: 768px) {
    .navbar {
        padding: 1rem 0;
    }

    .navbar-content {
        padding: 0.75rem 2rem;
    }
    
    .nav-link {
        font-size: 1rem;
        padding: 0;
    }
    
    .navbar-right .nav-link {
        border-bottom: none;
        padding: 0;
    }
    
    .navbar-right .nav-link.home-icon {
        display: flex;
    }
    
    .navbar-home-icon {
        display: none;
    }

    .menu-toggle {
        display: none;
    }

    .navbar-right {
        display: flex;
        position: static;
        flex-direction: row;
        width: 100%;
        padding: 0;
        border: none;
        justify-content: space-between;
        gap: 0;
    }

    .content {
        padding: 2rem;
    }

    .timeline-item {
        display: grid;
        grid-template-columns: 100px 10px 1fr;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
        align-items: start;
        padding-left: 0;
    }

    .timeline-date {
        font-size: 0.85rem;
        color: var(--base-color);
        text-align: right;
        padding-top: 0.15rem;
        white-space: nowrap;
        font-weight: normal;
    }

    .timeline-marker {
        display: flex;
        flex-direction: column;
        align-items: center;
        position: relative;
        height: 100%;
        width: auto;
        background: none;
    }

    .timeline-dot {
        width: 12px;
        height: 12px;
        margin-top: 0.4rem;
        left: auto;
        top: auto;
        position: relative;
        border: 2px solid var(--bg-color);
    }

    .timeline-line {
        position: absolute;
        top: 0.9rem;
        left: 50%;
        transform: translateX(-50%);
        width: 2px;
        height: calc(100% - 0.9rem + 1.5rem + 0.4rem);
        background-color: var(--border-color);
    }

    .timeline-content {
        display: flex;
        gap: 0.75rem;
        align-items: flex-start;
        flex-direction: row;
    }

    .timeline-logo {
        width: 80px;
        height: 80px;
    }

    .project-content {
        display: flex;
        flex-direction: row;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .project-logo {
        width: 80px;
        height: 80px;
    }
}

/* Large Desktop Overrides (>= 1200px) */
@media (min-width: 1200px) {
    body {
        display: flex;
        justify-content: center;
    }

    .sidebar {
        position: fixed;
        right: calc(50% + 375px);
        top: 0;
        width: auto;
        height: 100vh;
        background-color: var(--bg-color);
        overflow-y: auto;
        padding: 0 1rem 2rem 1rem;
        z-index: 100;
        border-bottom: none;
    }

    .sidebar-content {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        max-width: 220px;
    }

    .profile-picture {
        width: 180px;
        height: 180px;
        margin-top: calc(53px + 2rem + 0.5rem);
        margin-bottom: 0.75rem;
        margin-left: 0;
        margin-right: 0;
    }

    .sidebar-name {
        font-size: 1.05rem;
    }

    .sidebar-bio {
        font-size: 0.75rem;
        margin-bottom: 1.25rem;
    }

    .contact-list {
        display: block;
        width: 100%;
        text-align: left;
    }

    .contact-list li {
        margin-bottom: 0.625rem;
    }

    .contact-list .icon {
        margin-right: 0.75rem;
    }

    .external-icon {
        margin-left: 0.5rem;
    }

    .main-container {
        width: var(--container-width);
        margin-left: 0;
    }
    
    .navbar-content {
        max-width: var(--container-width);
        padding: 0 2rem;
    }
}

/* Footer */
.site-footer {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 2rem 2rem 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.site-footer p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-color-light);
}

@media (max-width: 768px) {
    .content {
        text-align: left;
    }
    
    .content p,
    .content li,
    .timeline-description,
    .main-title,
    .section-title,
    .education-institution,
    .education-degree,
    .education-details,
    .education-subtitle,
    .coursework,
    .publication-title,
    .publication-authors,
    .publication-venue,
    .publication-description,
    .project-disclaimer,
    .project-title,
    .project-description,
    .blog-post-excerpt {
        text-align: left;
    }
    
    .site-footer {
        padding: 1.5rem 1rem 1rem;
    }
}
