/* ===========================
   Modern Academic Design System
   Minimal, Professional, Typography-Focused
   =========================== */

/* ===========================
   CSS Custom Properties (Design Tokens)
   =========================== */
:root {
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-serif: 'Source Serif Pro', Georgia, serif;

    /* Colors - Neutral Palette */
    --color-text-primary: #1a1a1a;
    --color-text-secondary: #4a5568;
    --color-text-tertiary: #718096;
    --color-border: #e2e8f0;
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f7fafc;
    --color-bg-tertiary: #edf2f7;

    /* Accent Colors */
    --color-accent: #2563eb;
    --color-accent-hover: #1e40af;
    --color-accent-light: #dbeafe;

    /* Status Colors */
    --color-status-wip: #10b981;
    --color-status-working: #3b82f6;
    --color-status-published: #8b5cf6;

    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    line-height: 1.8;
    color: var(--color-text-primary);
    background-color: #fafafa;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===========================
   Masthead (Mobile Header)
   =========================== */
.masthead {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1400px;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
    transition: all var(--transition-base);
}

.masthead.hidden {
    transform: translateX(-50%) translateY(-100%);
}

.masthead-inner {
    padding: var(--space-md) var(--space-xl) var(--space-md) var(--space-2xl);
    margin-left: 280px;
    transition: all var(--transition-base);
}

/* On screens wider than the 1280px page, the page is centered, so the menu
   shifts with it to stay above the content column */
@media (min-width: 1281px) {
    .masthead-inner {
        margin-left: calc(50% - 360px);
    }
}

.masthead-nav {
    display: flex;
    gap: var(--space-xl);
    align-items: center;
}

.masthead-nav .nav-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: all var(--transition-fast);
    padding: var(--space-sm) 0;
    border-bottom: 2px solid transparent;
}

.masthead-nav .nav-link:hover {
    color: var(--color-text-primary);
    border-bottom-color: var(--color-accent);
}

.masthead-nav .nav-link::after {
    display: none;
}

/* ===========================
   Page Wrapper
   =========================== */
.page-wrapper {
    display: flex;
    min-height: 100vh;
    max-width: 1280px;
    margin: 0 auto;
    padding-top: 72px;
}

/* ===========================
   Sidebar
   =========================== */
.sidebar {
    width: 280px;
    background: linear-gradient(to bottom, var(--color-bg-secondary) 0%, var(--color-bg-primary) 100%);
    padding: var(--space-3xl) var(--space-xl);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
    border-right: 1px solid var(--color-border);
    z-index: 200;
}

.author-profile {
    text-align: center;
}

.author-avatar {
    width: 200px;
    height: 200px;
    border-radius: var(--radius-full);
    object-fit: cover;
    margin: 0 auto var(--space-xl);
    border: 4px solid var(--color-bg-primary);
    box-shadow: var(--shadow-lg);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.author-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
}

.author-name {
    font-family: var(--font-sans);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0 0 var(--space-xl) 0;
    padding: 0;
    border: none;
    letter-spacing: -0.01em;
    text-transform: uppercase;
}

.contact-heading {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: var(--space-xl) 0 var(--space-md);
}

.author-info {
    text-align: left;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: var(--space-lg);
}

.author-info p {
    margin-bottom: var(--space-sm);
}

.author-links {
    list-style: none;
    text-align: left;
    margin-top: var(--space-lg);
}

.author-links li {
    margin-bottom: var(--space-sm);
}

.author-links a {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.author-links a:hover {
    color: var(--color-accent);
    background-color: var(--color-accent-light);
    transform: translateX(4px);
}

.author-links i {
    margin-right: var(--space-md);
    width: 18px;
    text-align: center;
}

/* ===========================
   Main Content Area
   =========================== */
.main-content {
    flex: 1;
    background-color: var(--color-bg-primary);
    padding: var(--space-xl) var(--space-2xl) var(--space-2xl);
    max-width: 1000px;
    margin: 0;
}

article {
    margin-bottom: var(--space-3xl);
}

/* ===========================
   Typography System
   =========================== */
h1 {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    line-height: 1.3;
    margin-top: var(--space-lg);
    margin-bottom: 1.25rem;
    font-weight: 600;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--color-text-primary);
}

h1:first-child {
    margin-top: 0;
}

h2 {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    line-height: 1.4;
    margin-top: 2.25rem;
    margin-bottom: 1.4rem;
    font-weight: 600;
    color: var(--color-text-tertiary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
}

h3 {
    font-family: var(--font-sans);
    font-size: 1.05rem;
    line-height: 1.4;
    margin-top: var(--space-lg);
    margin-bottom: var(--space-md);
    font-weight: 600;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
}

p {
    margin-bottom: var(--space-lg);
    line-height: 1.7;
    color: var(--color-text-primary);
}

/* About intro paragraphs — serif to match section/paper titles, tighter
   spacing between them so the three read as one block */
p.about-intro {
    font-family: var(--font-serif);
    margin-bottom: var(--space-md);
}

p.about-intro:last-of-type {
    margin-bottom: var(--space-lg);
}

strong {
    font-weight: 600;
    color: var(--color-text-primary);
}

em {
    font-style: normal;
}

/* ===========================
   Links
   =========================== */
a {
    color: var(--color-accent);
    text-decoration: none;
    transition: all var(--transition-fast);
    position: relative;
}

a:hover {
    color: var(--color-accent-hover);
}

a:not(.author-links a):not(.masthead a)::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-accent);
    transition: width var(--transition-base);
}

a:not(.author-links a):not(.masthead a):hover::after {
    width: 100%;
}

/* ===========================
   Lists
   =========================== */
ul {
    margin-left: var(--space-xl);
    margin-bottom: var(--space-lg);
}

li {
    margin-bottom: var(--space-sm);
    color: var(--color-text-primary);
}

/* ===========================
   Research Publications - Card Design
   =========================== */
dl {
    margin: 0 0 1.9rem;
    padding: 0;
}

/* Tighter spacing for academic appointments only */
#academic-appointments ~ dl:not(#research ~ dl) {
    margin-bottom: var(--space-sm);
    padding: var(--space-xs) 0;
    background-color: transparent;
    border: none;
    border-radius: 0;
}

#academic-appointments ~ dl:not(#research ~ dl):hover {
    box-shadow: none;
    border-color: transparent;
}

#academic-appointments ~ dl:not(#research ~ dl):last-of-type {
    margin-bottom: var(--space-md);
}

#academic-appointments ~ dl:not(#research ~ dl) dd {
    margin-bottom: var(--space-xs);
    font-size: 0.875rem;
    line-height: 1.5;
}

#academic-appointments ~ dl:not(#research ~ dl) dt {
    margin-bottom: var(--space-xs);
    font-size: 1rem;
}

dt {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 1.1rem;
    line-height: 1.35;
    margin-bottom: 0.3rem;
    color: var(--color-text-primary);
}

/* Submission status sits beside the title without competing with it */
span.paper-status {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 400;
    font-style: normal;
    color: var(--color-text-tertiary);
    white-space: nowrap;
}

dt a {
    color: var(--color-text-primary);
    text-decoration: none;
}

/* Title links can wrap to multiple lines; the animated ::after underline only
   renders under the last line, so use text-decoration which underlines every line. */
dt a::after {
    display: none;
}

dt a:hover {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

dd {
    margin-left: 0;
    margin-bottom: 0.15rem;
    color: #3b4252;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Links in entries are dark navy with a quiet underline, not bright blue */
dd a {
    color: #232d4b;
    text-decoration: underline;
    text-decoration-color: rgba(35, 45, 75, 0.3);
    text-underline-offset: 2px;
}

dd a:hover {
    color: #000;
    text-decoration-color: currentColor;
}

dd a::after {
    display: none;
}

dd:last-child {
    margin-bottom: 0;
}

/* Status Badges - removed for professional appearance */

/* Research entries: a title, optional coauthors, then one row of links.
   Abstract and Presentations are toggles in that row; their text opens below it. */
dd.entry-links {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 1rem;
    margin-top: 0.45rem;
}

.ln {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
}

.ln-note {
    color: var(--color-text-tertiary);
    font-size: 0.85em;
}

@media (min-width: 481px) {
    dd.entry-links {
        column-gap: 0;
    }

    .ln:not(:last-child)::after {
        content: "";
        align-self: center;
        width: 1px;
        height: 0.9em;
        background-color: var(--color-border);
        margin: 0 0.8rem 0 0.45rem;
    }
}

.toggle-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

/* The row's links and toggles use the same blue as the links in the About text */
.entry-links a,
.slides-links a,
.ln label {
    color: var(--color-accent);
    text-decoration: none;
}

.entry-links a:hover,
.slides-links a:hover,
.ln label:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ln label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
}

.ln label::after {
    content: "▾";
    font-size: 0.85em;
    transition: transform var(--transition-base);
}

.ln:has(input:checked) label::after {
    transform: rotate(180deg);
}

.toggle-input:focus-visible + label {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
    border-radius: 2px;
}

dd.entry-panel {
    display: none;
    margin: 0.7rem 0 0.4rem 0.2rem;
    padding-left: 1.1rem;
    border-left: 1px solid var(--color-border);
}

dl:has(input.t-abs:checked) dd.panel-abs,
dl:has(input.t-slides:checked) dd.panel-slides,
dl:has(input.t-pres:checked) dd.panel-pres {
    display: block;
}

dd.entry-panel + dd.entry-panel {
    margin-top: 0.9rem;
}

dd.panel-abs p {
    font-family: var(--font-serif);
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin: 0;
    text-align: justify;
    text-justify: inter-word;
    -webkit-hyphens: auto;
    hyphens: auto;
    text-wrap: pretty;
}

ul.presentation-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-family: var(--font-serif);
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--color-text-secondary);
}

ul.presentation-list li {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    column-gap: var(--space-md);
    align-items: baseline;
    margin-bottom: 0;
    padding: 0.25rem 0;
}

.pres-date {
    order: -1;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pres-venue {
    color: var(--color-text-primary);
}

.pres-mark {
    color: var(--color-accent);
    font-weight: 600;
    font-size: 0.8em;
    vertical-align: super;
    line-height: 0;
    padding-left: 0.1em;
}

@media (max-width: 480px) {
    ul.presentation-list li {
        grid-template-columns: 1fr;
        row-gap: 0.1rem;
    }

    /* Justified text opens wide gaps on a narrow screen */
    dd.panel-abs p {
        text-align: left;
    }
}

/* Slide viewer: one slide at a time, with a small control bar underneath */
.slides {
    outline: none;
}

.slides-img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    background-color: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    cursor: pointer;
}

.slides:focus-visible .slides-img {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.slides-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-top: 0.6rem;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.slides-bar button {
    font: inherit;
    line-height: 1.4;
    padding: 0.1rem 0.7rem;
    color: var(--color-accent);
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    cursor: pointer;
}

.slides-bar button:hover:not(:disabled) {
    border-color: var(--color-accent);
}

.slides-bar button:disabled {
    color: var(--color-text-tertiary);
    cursor: default;
}

.slides-count {
    min-width: 4.5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.slides-links {
    margin-left: auto;
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.slides-bar .slides-full {
    padding: 0;
    border: none;
}

.slides-bar .slides-full:hover:not(:disabled) {
    color: var(--color-accent-hover);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.slides:fullscreen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-color: #000;
    padding: 1rem;
}

.slides:fullscreen .slides-img {
    width: auto;
    max-width: 100%;
    max-height: calc(100vh - 5rem);
    margin: 0 auto;
    border: none;
}

.slides:fullscreen .slides-bar {
    justify-content: center;
    color: #cbd5e0;
}

.slides:fullscreen .slides-links {
    margin-left: 0;
}

/* ===========================
   Horizontal Rules
   =========================== */
hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-2xl) 0;
}

/* ===========================
   Footer
   =========================== */
.site-footer {
    margin-top: var(--space-3xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--color-border);
    text-align: center;
    color: var(--color-text-tertiary);
    font-size: 0.875rem;
}

.footer-links {
    margin-bottom: var(--space-md);
}

.footer-links a {
    color: var(--color-text-tertiary);
    margin: 0 var(--space-md);
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--color-accent);
}

.footer-follow {
    margin-bottom: var(--space-md);
}

.footer-follow strong {
    color: var(--color-text-secondary);
    font-weight: 600;
    margin-right: var(--space-sm);
}

.footer-follow a {
    color: var(--color-text-tertiary);
}

.footer-follow a:hover {
    color: var(--color-accent);
}

.footer-attribution {
    line-height: 1.6;
}

.footer-attribution p {
    margin: 0;
}

.footer-attribution a {
    color: var(--color-text-tertiary);
}

.footer-attribution a:hover {
    color: var(--color-accent);
}

/* ===========================
   Responsive Design
   =========================== */

/* Large Tablet */
@media (max-width: 1200px) {
    .sidebar {
        width: 260px;
        padding: var(--space-2xl) var(--space-lg);
    }

    .masthead-inner {
        margin-left: 260px;
    }

    .main-content {
        padding: var(--space-xl) var(--space-2xl) var(--space-2xl);
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
        padding: var(--space-xl) var(--space-md);
    }

    .masthead-inner {
        margin-left: 240px;
    }

    .author-avatar {
        width: 120px;
        height: 120px;
    }

    h1 {
        font-size: 1.4rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    body {
        padding-top: 60px;
    }

    .masthead {
        left: 0;
        transform: none;
    }

    .masthead.hidden {
        transform: translateY(-100%);
    }

    .masthead-inner {
        margin-left: 0;
        padding: var(--space-sm) var(--space-lg);
    }

    .masthead-nav {
        gap: var(--space-md);
    }

    .masthead-nav .nav-link {
        font-size: 0.8rem;
    }

    .page-wrapper {
        flex-direction: column;
        padding-top: 0;
    }

    .sidebar {
        width: 100%;
        position: static;
        height: auto;
        padding: var(--space-xl) var(--space-lg);
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }

    .author-avatar {
        width: 100px;
        height: 100px;
    }

    .main-content {
        padding: var(--space-xl) var(--space-lg);
        max-width: 100%;
    }

    h1 {
        font-size: 1.5rem;
    }


    h3 {
        font-size: 1rem;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .main-content {
        padding: var(--space-lg) var(--space-md);
    }

    .author-avatar {
        width: 80px;
        height: 80px;
    }

    h1 {
        font-size: 1.3rem;
    }
}

/* ===========================
   Print Styles
   =========================== */
@media print {
    .sidebar,
    .masthead,
    .site-footer {
        display: none;
    }

    .page-wrapper {
        margin-left: 0;
        padding-top: 0;
    }

    .main-content {
        padding: 0;
        max-width: 100%;
    }

    body {
        font-size: 12pt;
        color: #000;
    }

    a {
        color: #000;
        text-decoration: none;
    }

    h1, h2, h3 {
        page-break-after: avoid;
    }

    dl {
        page-break-inside: avoid;
    }
}

/* ===========================
   Smooth Scrollbar
   =========================== */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-full);
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-tertiary);
}
