html {
    min-height: 100%;
    background-color: var(--bg-color);
}

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

html.theme-switching,
html.theme-switching body,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
    transition: none !important;
    animation: none !important;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 220ms;
    animation-timing-function: ease;
}

:root {
    color-scheme: light;
    --bg-color: #eff2f6;
    --text-color: #334155;
    --text-muted: #748195;
    --link-color: #4f72c9;
    --link-hover-color: #3f61b6;
    --card-bg-color: #fafbfd;
    --surface-muted: #e9eef4;
    --border-color: #d9e1ea;
    --border-strong: #c6d0db;
    --header-bg: #e7ecf3;
    --heading-color: #1f2b3d;
    --author-highlight-color: #315fcb;
    --avatar-bg-color: #dbe3ec;
    --bio-color: #748195;
    --shadow-color: rgba(15, 23, 42, 0.05);
}

html[data-theme="dark"],
body[data-theme="dark"] {
    color-scheme: dark;
    --bg-color: #0f172a;
    --text-color: #e5e7eb;
    --text-muted: #94a3b8;
    --link-color: #60a5fa;
    --link-hover-color: #93c5fd;
    --card-bg-color: #111827;
    --surface-muted: #1e293b;
    --border-color: #334155;
    --border-strong: #475569;
    --header-bg: #374151;
    --heading-color: #f8fafc;
    --author-highlight-color: #93c5fd;
    --avatar-bg-color: #1e293b;
    --bio-color: #94a3b8;
    --shadow-color: rgba(2, 6, 23, 0.35);
}

body {
    font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    line-height: 1.6;
    margin: 0;
    background-color: var(--bg-color) !important;
    color: var(--text-color) !important;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease-in-out, text-decoration 0.2s ease-in-out;
}

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

.masthead {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    box-sizing: border-box;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    box-shadow: 0 10px 30px var(--shadow-color);
}

.masthead__inner-wrap {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
}

.masthead__menu {
    grid-column: 2;
    min-width: 0;
    display: flex;
    justify-content: center;
}

.greedy-nav {
    position: relative;
}

.visible-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
}

.masthead__menu-item a {
    padding: 0.5rem 1rem;
    display: block;
    color: var(--text-color);
    font-weight: 700;
    border-radius: 5px;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.masthead__menu-item a:hover {
    background-color: var(--surface-muted);
    color: var(--link-hover-color);
}

.theme-toggle,
.greedy-nav__toggle,
.back-to-top {
    outline: none;
}

.theme-toggle:focus-visible,
.greedy-nav__toggle:focus-visible,
.back-to-top:focus-visible {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.theme-toggle {
    grid-column: 3;
    justify-self: end;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--card-bg-color);
    color: var(--text-color);
    box-shadow: 0 8px 20px var(--shadow-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.theme-toggle:hover {
    background: var(--surface-muted);
    color: var(--link-color);
    transform: translateY(-1px);
}

.theme-toggle i {
    font-size: 0.95rem;
}

.greedy-nav__toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    position: absolute;
    top: 0.6rem;
    right: 0;
}

.greedy-nav__toggle .bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: var(--text-color);
    transition: all 0.3s ease-in-out;
}

.hidden-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

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

.initial-content {
    display: flex;
    max-width: 1280px;
    margin: 88px auto 30px;
    gap: 2.5rem;
    padding: 0 1rem;
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
}

.author__profile {
    background: var(--card-bg-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 2rem 1.5rem;
    border-radius: 20px;
    text-align: left;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.04);
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.author__avatar img,
.author__avatar div {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 1.5rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
    background-color: var(--avatar-bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bio-color);
    font-size: 0.8rem;
    text-align: center;
    border: 4px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

html[data-theme="dark"] .author__avatar img {
    border-color: rgba(30, 41, 59, 0.8);
}

.author__avatar img:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.12);
}

.author__content {
    text-align: center;
}

.author__name {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    color: var(--heading-color);
}

.author__bio {
    font-size: 0.9rem;
    color: var(--bio-color);
    margin-bottom: 1rem;
}

.author__urls {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
}

.author__urls li {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.author__status {
    margin-top: 0.9rem;
    padding: 0.95rem 1rem;
    border: 1px solid color-mix(in srgb, var(--link-color) 28%, var(--border-color));
    border-radius: 12px;
    background: color-mix(in srgb, var(--link-color) 10%, var(--card-bg-color));
    color: var(--heading-color);
    line-height: 1.55;
    font-weight: 700;
    box-shadow: 0 10px 24px var(--shadow-color);
}

.author__status .icon-pad-right {
    color: var(--link-color);
}

.author__status-text {
    display: inline-block;
    vertical-align: top;
    width: calc(100% - 2.2rem);
}

.author__urls a {
    color: var(--text-color);
    transition: color 0.2s;
}

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

.icon-pad-right {
    margin-right: 0.75rem;
    width: 1.25em;
    text-align: center;
}

.main-content {
    flex-grow: 1;
    background: var(--card-bg-color);
    padding: 2.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 16px 40px var(--shadow-color);
}

.main-content section {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.main-content section:nth-child(1) { animation-delay: 0.1s; }
.main-content section:nth-child(2) { animation-delay: 0.2s; }
.main-content section:nth-child(3) { animation-delay: 0.3s; }
.main-content section:nth-child(4) { animation-delay: 0.4s; }
.main-content section:nth-child(5) { animation-delay: 0.5s; }
.main-content section:nth-child(6) { animation-delay: 0.6s; }

.main-content section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

h1,
h2 {
    color: var(--heading-color);
    border-bottom: 2px solid var(--link-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.publication-item {
    margin-bottom: 30px;
}

.publication-item:last-child,
.experience-item:last-child,
.honors-list__item:last-child {
    margin-bottom: 0;
}

.publication-item__image {
    max-width: 100%;
    display: block;
    margin-bottom: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 30px var(--shadow-color);
}

.publication-item__header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.publication-item__title {
    font-size: 1.15rem;
    color: var(--heading-color);
}

.publication-item__authors .author-highlight {
    color: var(--author-highlight-color);
    font-weight: 700;
}

.publication-item__journal {
    display: inline-block;
}

.publication-item__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.2rem;
}

.news-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.news-list__item {
    margin-bottom: 1rem;
}

.news-list__item:last-child {
    margin-bottom: 0;
}

.news-item {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 1rem;
    align-items: start;
}

.news-item__date {
    color: var(--text-muted);
    font-size: 0.95rem;
    white-space: nowrap;
}

.news-item__content {
    color: var(--text-color);
}

.honors-list {
    list-style-type: disc;
    padding-left: 20px;
    margin-bottom: 0;
}

.honors-list__item {
    margin-bottom: 12px;
}

.honor-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
}

.honor-item__title {
    font-size: 1.05rem;
    color: var(--text-color);
}

.honor-item__year {
    color: var(--text-muted);
    font-size: 0.95rem;
    white-space: nowrap;
    margin-left: auto;
}

.experience-item {
    margin-bottom: 25px;
}

.experience-item__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 12px;
}

.experience-item__role {
    font-size: 1.15rem;
    color: var(--heading-color);
}

.experience-item__period {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.experience-item__company {
    font-style: italic;
    color: var(--text-muted);
    margin-top: 4px;
}

.experience-item__description {
    margin-top: 6px;
}

.misc-panel {
    display: flex;
    justify-content: center;
}

#misc .misc-panel {
    width: min(100%, 560px);
    margin: 0 auto;
}

.misc-panel__widget {
    width: 100%;
    display: flex;
    justify-content: center;
}

.misc-panel__map {
    width: min(100%, 360px);
    margin: 0 auto;
    padding: 0;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    background: transparent;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.misc-panel__map > div,
.misc-panel__map iframe,
.misc-panel__map canvas,
.misc-panel__map img,
.misc-panel__map a {
    max-width: 100%;
    border-radius: 10px;
}

.misc-panel__map img {
    display: block;
    width: 100%;
    height: auto;
}

.page__footer {
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.back-to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--card-bg-color);
    color: var(--link-color);
    box-shadow: 0 8px 20px var(--shadow-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    z-index: 120;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--link-color);
    color: #ffffff;
}

.btn-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    border: 1px solid var(--link-color);
    color: var(--link-color) !important;
    background-color: transparent;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-pill:hover {
    background-color: var(--link-color);
    color: #ffffff !important;
    text-decoration: none;
}

@media (max-width: 768px) {
    .masthead__inner-wrap {
        display: grid;
        grid-template-columns: auto auto;
        align-items: center;
        justify-content: space-between;
        position: relative;
    }

    .initial-content {
        flex-direction: column;
        margin-top: 72px;
        gap: 1.5rem;
    }

    .sidebar {
        width: 100%;
        position: static;
    }

    .author__profile {
        text-align: center;
    }

    .author__urls {
        text-align: left;
        display: inline-block;
    }

    .news-item {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .misc-panel__map {
        width: 100%;
    }

    .misc-panel__widget {
        width: 100%;
    }

    .masthead__menu {
        width: auto;
        grid-column: 1;
        justify-content: flex-start;
    }

    .greedy-nav {
        position: static;
    }

    .visible-links {
        display: none;
        flex-direction: column;
        width: 100%;
        background-color: var(--card-bg-color);
        position: absolute;
        top: calc(100% + 0.75rem);
        left: 0;
        right: 0;
        border-top: 1px solid var(--border-color);
        box-shadow: 0 12px 28px var(--shadow-color);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        overflow: hidden;
    }

    .visible-links.open {
        display: flex;
    }

    .masthead__menu-item {
        text-align: center;
        border-bottom: 1px solid var(--border-color);
    }

    .masthead__menu-item:last-child {
        border-bottom: none;
    }

    .greedy-nav__toggle {
        display: block;
        position: static;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
        grid-column: 2;
        justify-self: end;
    }

    .back-to-top {
        right: 1rem;
        bottom: 1rem;
    }
}
