/* ****** */
/* COLORS */
/* ****** */

:root {
    --background: #ddd;
    --text-color: #000;
    --secondary-text: #555;
    --sidebar-bg: #d0d0d0;
    --sidebar-hover: #ccc;
    --sidebar-active-bg: #000;
    --sidebar-active-text: #f7f7f7;
    --border-color: #bbb;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --accent-color: #17645c;
}

[data-theme="dark"] {
    --background: #111;
    --text-color: #fff;
    --secondary-text: #ccc;
    --sidebar-bg: #1e1e1e;
    --sidebar-hover: #333;
    --sidebar-active-bg: #fff;
    --sidebar-active-text: #000;
    --border-color: #444;
    --shadow-color: rgba(255, 255, 255, 0.05);
    --accent-color: #d6c8a4;
}

/* ****** */
/* GLOBAL */
/* ****** */

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    background: var(--background);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* **** */
/* PAGE */
/* **** */

main {
    margin-left: 440px;
    padding: 48px 32px 20px;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    box-sizing: border-box;
}

.main-content {
    max-width: 860px;
    flex-grow: 1;
    line-height: 1.6;
    font-size: 16px;
    color: var(--text-color);
}

.main-content h1,
.main-content h2,
.main-content h3,
.main-content h4,
.main-content h5,
.main-content h6 {
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 12px;
}

.main-content h1 { font-size: 24px; }
.main-content h2 { font-size: 20px; }
.main-content h3 { font-size: 18px; }
.main-content h4 { font-size: 16px; }
.main-content h5 { font-size: 14px; }
.main-content h6 { font-size: 12px; }

.main-content p {
    margin-bottom: 16px;
}

.main-content a {
    color: var(--text-color);
    text-decoration: underline 1px;
    text-underline-offset: 1.5px;
    transition: color 0.2s;
}

.main-content a:hover {
    color: var(--accent-color);
    text-decoration: underline 2px;
}

.main-content ul,
.main-content ol {
    margin-bottom: 16px;
    padding-left: 20px;
}

.main-content li {
    margin-bottom: 4px;
}

.main-content img {
    width: 100%;
    height: auto;
    margin-top: 16px;
    border-radius: 4px;
}

.main-content code {
    background: var(--border-color);
    color: var(--accent-color);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 14px;
}

.main-content pre {
    background: var(--sidebar-bg);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.4;
}

.main-content pre code {
    background: none;
    padding: 0;
    color: var(--text-color);
}

.main-content hr {
    border: none;
    height: 1px;
    background-color: var(--border-color);
}

.main-content table {
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 15px;
}

.main-content th,
.main-content td {
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    text-align: left;
}

.main-content th {
    font-weight: 600;
}

/* pandoc --mathml display math */
.main-content math[display="block"] {
    display: block;
    margin: 16px 0;
    overflow-x: auto;
}

.site-footer {
    text-align: center;
    padding: 16px 0 0;
    border-top: 1px solid var(--border-color);
    margin-top: 32px;
    font-size: 0.8rem;
    color: var(--secondary-text);
}

.site-footer p {
    font-size: 15px;
    margin: 2px 0;
}

/* ************ */
/* THEME TOGGLE */
/* ************ */

#theme-toggle {
    position: fixed;
    top: 40px;
    right: 40px;
    z-index: 1001;
    width: 52px;
    height: 52px;
    background: transparent;
    border: none;
    border-radius: 50%;
    font-size: 22px;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#theme-toggle:hover {
    background: var(--sidebar-hover);
    color: var(--accent-color);
}

#theme-toggle .icon {
    width: 26px;
    height: 26px;
    margin: 0;
}

/* moon in light mode, sun in dark mode — pure CSS swap */
#theme-toggle .icon-sun { display: none; }
[data-theme="dark"] #theme-toggle .icon-moon { display: none; }
[data-theme="dark"] #theme-toggle .icon-sun { display: block; }

/* ***** */
/* ICONS */
/* ***** */

/* inline Font Awesome SVGs — sized like the old icon-font rules
   (.menu i: font-size 14px, width 16px, margin-right 8px) */
.icon {
    width: 16px;
    height: 14px;
    margin-right: 8px;
    flex-shrink: 0;
}

/* ******* */
/* SIDEBAR */
/* ******* */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    overflow-y: auto;
    background: var(--sidebar-bg);
    color: var(--text-color);
    padding: 20px;
    box-sizing: border-box;
    font-size: 16px;
    display: flex;
    flex-direction: column;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
}

/* mobile nav toggle — hidden on desktop, the checkbox is never shown */
.nav-toggle {
    display: none;
}

.nav-toggle-label {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-color);
    flex-shrink: 0;
}

.nav-toggle-label:hover {
    background: var(--sidebar-hover);
    color: var(--accent-color);
}

.nav-toggle-label .icon {
    width: 20px;
    height: 20px;
    margin: 0;
}

.nav-toggle-label .icon-close {
    display: none;
}

.sidebar-header {
    margin-bottom: 20px;
    flex-shrink: 0;
}

.sidebar-header h1 {
    font-size: 18px;
    margin: 0;
    font-weight: 600;
}

.sidebar-bottom {
    margin-top: auto;
}

.home-link {
    color: inherit;
    text-decoration: none;
}

.menu, .sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu li, .sub-menu li {
    margin-bottom: 8px;
}

.menu a, .sub-menu a {
    color: var(--text-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
}

.menu a:hover, .sub-menu a:hover {
    background: var(--sidebar-hover);
    color: var(--accent-color);
}

.menu li.active a, .sub-menu li.active a {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}

.link a::after {
    content: ' →';
    margin-left: auto;
    color: var(--secondary-text);
    font-size: 12px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-top: 20px;
    margin-bottom: 8px;
}

/* ********* */
/* ITEM LIST */
/* ********* */

.item-list {
    list-style: none;
    padding: 0 !important;
    margin: 0;
}

.item-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    margin-bottom: 0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.item-list li:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
    color: var(--accent-color);
}

.item-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    text-decoration: none;
}

.item-list a:hover {
    text-decoration: none;
}

.item-text {
    display: flex;
    flex-direction: column;
}

.item-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.item-subtitle {
    font-size: 14px;
    color: var(--secondary-text);
    margin-top: 4px;
}

.item-arrow {
    margin-left: auto;
    font-size: 14px;
    color: var(--secondary-text);
}

/* ************* */
/* HOME-SPECIFIC */
/* ************* */

.intro-container {
    display: flex;
    align-items: flex-start;
    gap: 32px;
    margin-bottom: 40px;
}

/* breathing room between the home sections */
.main-content .item-list,
.main-content .timeline {
    margin-bottom: 56px;
}

.intro-content {
    flex: 1;
    max-width: 600px;
}

.intro-content h1 {
    margin-bottom: 10px;
}

.intro-content p {
    margin: 0 auto;
}

.info {
    display: flex;
    justify-content: space-between;
}

/* two classes so this beats the ".intro-content p" centering rule */
.info .info-location {
    font-size: 15px;
    color: var(--secondary-text);
    margin: auto 0 auto auto;
    padding-top: 8px;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.info-location .icon {
    width: 14px;
    height: 13px;
    margin-right: 6px;
}

.job {
    color: var(--text-color);
    margin-top: -3px;
}

.job-title {
    font-size: 15px;
    margin-bottom: 10px;
}

.introduction p {
    color: var(--text-color);
    font-size: 16px;
    margin: 10px auto;
}

.highlighted-link {
    color: inherit;
    text-decoration: underline 1px;
    text-underline-offset: 1.5px;
    transition: color 0.2s, text-decoration 0.2s;
}

.highlighted-link:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.intro-image {
    position: relative;
    width: 220px;
    height: 220px;
    aspect-ratio: 1/1;
    flex-shrink: 0;
    border-radius: 50%;
    margin-bottom: auto;
    padding: 20px 0 0 0;
}

.profile-image {
    position: absolute;
    width: 100%;
    height: 100%;
    max-height: 220px;
    border-radius: 50%;
    clip-path: circle(50%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: drop-shadow(0 4px 8px var(--shadow-color));
}

/* ******** */
/* TIMELINE */
/* ******** */

.timeline {
    position: relative;
    margin-left: 20px;
    padding-left: 20px;
    border-left: 2px solid var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 32px;
}

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

.timeline-dot {
    position: absolute;
    left: -27px;
    top: 8px;
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    border-radius: 50%;
}

.timeline-content h3 {
    font-size: 18px;
    margin: 0 0 4px;
    color: var(--text-color);
}

.timeline-date {
    font-size: 15px;
    color: var(--secondary-text);
    display: block;
    margin-bottom: 12px;
}

.timeline-content p {
    font-size: 16px;
    color: var(--secondary-text);
    line-height: 1.5;
    margin-bottom: 0;
}

/* ************* */
/* MEDIA QUERIES */
/* ************* */

/* Narrow desktop: shrink the gutter between sidebar and content */
@media (max-width: 1400px) and (min-width: 1145px) {
    main {
        margin-left: calc(280px + 64px);
        margin-right: 64px;
    }
}

/* Tablet / mobile: sidebar becomes a sticky top bar with a hamburger
   button that expands the full menu. No JS involved — the checkbox in
   the template drives the collapse/expand, and since every link loads a
   new page the menu naturally starts closed again after navigating. */
@media (max-width: 1144px) {
    .sidebar {
        position: sticky;
        top: 0;
        z-index: 1000;
        width: 100%;
        height: auto;
        max-height: 100vh;
        padding: 8px 16px;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 0;
        /* keep the hamburger clear of the fixed theme-toggle button */
        padding-right: 44px;
    }

    /* same box as the theme-toggle button so the two icons line up */
    .nav-toggle-label {
        display: flex;
        width: 52px;
        height: 52px;
        border-radius: 50%;
    }

    /* collapsed by default; the checked checkbox reveals the menu */
    .sidebar-content,
    .sidebar-bottom {
        display: none;
    }

    .nav-toggle:checked ~ .sidebar-content {
        display: flex;
        margin-top: 12px;
    }

    .nav-toggle:checked ~ .sidebar-bottom {
        display: block;
        margin-top: 0;
    }

    /* swap hamburger for an X while open */
    .nav-toggle:checked ~ .sidebar-header .icon-bars {
        display: none;
    }

    .nav-toggle:checked ~ .sidebar-header .icon-close {
        display: block;
    }

    main {
        margin-left: 16px;
        margin-right: 16px;
        padding: 16px 16px 20px;
        max-width: none;
    }

    /* matches the top bar's 8px padding so the moon aligns with the hamburger */
    #theme-toggle {
        top: 8px;
        right: 8px;
    }
}

@media (max-width: 864px) {
    .intro-container {
        flex-direction: column;
    }

    .intro-image {
        margin-left: auto;
        margin-right: auto;
    }

    .item-list li {
        padding: 12px 16px;
    }

    .item-title {
        font-size: 15px;
    }

    .item-subtitle {
        font-size: 13px;
    }

    .timeline {
        margin-left: 0;
    }
}
