/* CSS Variables for consistent theming */
:root {
    --color-bg: #ffffff;
    --color-text: #111111;
    --color-text-muted: #555;
    --color-accent: #2c5282;
    --color-accent-hover: #1e3a5f;
    --color-border: #e0e0e0;
    --font-heading: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --max-width: 720px;
    --spacing-unit: 1rem;
}

/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1.0625rem;
    line-height: 1.75;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-heading);
    font-weight: 500;
    line-height: 1.3;
    margin-top: 0;
}

h1 {
    font-size: 2.25rem;
    margin-bottom: calc(var(--spacing-unit) * 1.5);
}

h2 {
    font-size: 1.5rem;
    margin-top: calc(var(--spacing-unit) * 2.5);
    margin-bottom: var(--spacing-unit);
    color: var(--color-text);
}

h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

p {
    margin: 0 0 var(--spacing-unit);
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover,
a:focus {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

/* Focus styles for accessibility */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Skip link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-accent);
    color: white;
    padding: 8px;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Navigation */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: calc(var(--spacing-unit) * 2) var(--spacing-unit);
}

.nav-name {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--color-text);
}

.nav-name:hover {
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: calc(var(--spacing-unit) * 1.5);
}

.nav-links a {
    color: var(--color-text-muted);
    font-size: 0.9375rem;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--color-text);
}

.nav-links a.active {
    font-weight: 500;
}

/* Main content */
main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: calc(var(--spacing-unit) * 2) var(--spacing-unit) calc(var(--spacing-unit) * 4);
}

/* Home page */
.home-content {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: calc(var(--spacing-unit) * 2.5);
    align-items: start;
}

.home-photo img {
    width: 180px;
    height: auto;
    border-radius: 4px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.home-photo {
    margin: 0;
}

.contact {
    margin-top: calc(var(--spacing-unit) * 2);
    padding-top: calc(var(--spacing-unit) * 1.5);
    border-top: 1px solid var(--color-border);
}

.contact h2 {
    margin-top: 0;
    font-size: 1.25rem;
}

.contact address {
    font-style: normal;
}

/* Research page */
.research section {
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.paper {
    margin-bottom: calc(var(--spacing-unit) * 1.5);
    padding-bottom: calc(var(--spacing-unit) * 1.5);
    border-bottom: 1px solid var(--color-border);
}

.paper:last-child {
    border-bottom: none;
}

.paper-title {
    margin-bottom: 0.25rem;
}

.paper-title a {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--color-text);
}

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

.paper-authors {
    color: var(--color-text-muted);
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
}

.paper-status {
    font-size: 0.9375rem;
    color: var(--color-text-muted);
    margin-bottom: 0;
}

.paper-status strong {
    color: var(--color-text);
    font-weight: 500;
}

/* Teaching page */
.teaching section {
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.course {
    margin-bottom: calc(var(--spacing-unit) * 1.5);
}

.course-title {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.course-info {
    color: var(--color-text-muted);
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
}

.course-description {
    font-size: 0.9375rem;
}

.placeholder-text {
    color: var(--color-text-muted);
    font-style: italic;
}

/* Footer */
footer {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: calc(var(--spacing-unit) * 2) var(--spacing-unit);
    border-top: 1px solid var(--color-border);
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

/* Responsive design */
@media (max-width: 640px) {
    .nav {
        flex-direction: column;
        gap: var(--spacing-unit);
    }
    
    .nav-links {
        gap: var(--spacing-unit);
    }
    
    .home-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .home-photo {
        display: flex;
        justify-content: center;
    }
    
    .home-photo img {
        width: 150px;
    }
    
    .contact {
        text-align: left;
    }
    
    h1 {
        font-size: 1.875rem;
    }
}

/* Print styles */
@media print {
    .nav-links {
        display: none;
    }
    
    a {
        color: var(--color-text);
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: var(--color-text-muted);
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    a {
        transition: none;
    }
}
