/* Modern CSS Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
    margin: 0;
}

ul[role='list'],
ol[role='list'] {
    list-style: none;
}

html:focus-within {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    text-rendering: optimizeSpeed;
    line-height: 1.5;
}

a:not([class]) {
    text-decoration-skip-ink: auto;
}

img,
picture {
    max-width: 100%;
    display: block;
}

input,
button,
textarea,
select {
    font: inherit;
}

@media (prefers-reduced-motion: reduce) {
    html:focus-within {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Prevent transitions on load */
.preload * {
    transition: none !important;
}

/* Variables */
:root {
    /* Colors */
    --color-primary: #0056b3;
    /* Darker blue for batter contrast */
    --color-secondary: #6c757d;
    --color-accent: #ffc107;
    --color-text: #333;
    --color-bg: #f1f0f3;
    /* Dimmer light mode background */
    --color-header-bg: #ffffff;
    /* White header for separation */
    --color-bg-alt: #ffffff;
    /* Keeping cards white or alt bg */
    --color-border: #dee2e6;
    --color-white: #ffffff;

    /* Typography */
    --font-primary: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Outfit', sans-serif;

    /* Spacing */
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 2rem;
    --spacing-xl: 4rem;

    /* Layout */
    --container-max-width: 1200px;
    --header-height: 70px;
}

[data-theme="dark"] {
    --color-primary: #4dabf7;
    --color-secondary: #adb5bd;
    --color-accent: #e6bc23;
    --color-text: #e9ecef;
    --color-bg: #211f1f;
    /* Deep dark background */
    --color-header-bg: #272626;
    /* Distinct header background */
    --color-bg-alt: #2c3035;
    /* Alt background */
    --color-border: #495057;
    --color-white: #212529;
    /* In dark mode, cards are dark */
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.theme-toggle:hover {
    background-color: var(--color-bg-alt);
}

/* Global Styles */
body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-primary);
    display: flex;
    flex-direction: column;
}

h1,
h2,
h3 {
    font-family: var(--font-heading);
    color: var(--color-primary);
    margin-bottom: var(--spacing-md);
}

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

a:hover {
    color: var(--color-secondary);
    text-decoration: underline;
}

/* Layout Compontents */
.container {
    width: 100%;
    max-width: var(--container-max-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
}

.site-header {
    background-color: var(--color-header-bg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] .site-header {
    box-shadow: none;
    /* Hide shadow in dark mode if it's not visible */
    border-bottom: 1px solid var(--color-border);
    /* Add distinct border */
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height);
}

.site-logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-primary);
    text-decoration: none;
}

.site-nav ul {
    display: flex;
    gap: var(--spacing-md);
    list-style: none;
    padding: 0;
    margin: 0;
    align-items: center;
    /* Vertically align text and icons */
}

.site-nav a {
    color: var(--color-text);
    font-weight: 500;
}

.site-nav a.active,
.site-nav a:hover {
    color: var(--color-primary);
}

.site-main {
    flex: 1;
    padding-top: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
}

.site-footer {
    background-color: var(--color-header-bg);
    padding: var(--spacing-lg) 0;
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-secondary);
    border-top: 1px solid var(--color-border);
    margin-top: auto;
}

/* Grid System */
.grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-cols-2 {
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.grid-cols-3 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-cols-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}




/* Components */
.card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: var(--spacing-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.member-card {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.member-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-md);
}

.member-image {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 3px solid var(--color-bg-alt);
}

.member-intro {
    flex: 1;
}

.member-details {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-bg-alt);
}

.member-position {
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
    color: var(--color-primary);
}

.member-focus {
    font-size: 0.9rem;
    /* font-style: italic; */
    margin-bottom: var(--spacing-sm);
    color: var(--color-text);
}

.member-education {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--spacing-sm) 0;
    font-size: 0.85rem;
    color: var(--color-secondary);
}

.member-education li {
    margin-bottom: 0.2rem;
}

.hero {
    background-color: var(--color-primary);
    background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)), url('/images/anton_crop.webp');
    background-size: cover;
    background-position: center;
    color: var(--color-white);
    padding: var(--spacing-xl) 0;
    min-height: 400px;
    /* Ensure enough height to see the image */
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.hero-content {
    padding: var(--spacing-lg);
}

.hero h1 {
    color: var(--color-white);
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero h2 {
    color: var(--color-accent);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.hero mark {
    background-color: transparent;
    color: inherit;
    padding: 0;
}

/* Logo Grid */
.logo-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-lg);
    padding: var(--spacing-md);
}

.logo-item {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-sm);
}

.logo-item img {
    max-height: 80px;
    /* Consistent height */
    max-width: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: grayscale(100%);
    /* Optional: make logos consistent style */
    opacity: 0.8;
    transition: filter 0.3s, opacity 0.3s;
}

.logo-item img:hover {
    filter: grayscale(0%);
    opacity: 1;
}

/* Theme-based Logo Switching */
.theme-switchable img {
    display: none;
    /* Hide images by default inside switchable container */
}

/* Light Theme (Default) */
html[data-theme="light"] .logo-light,
:root:not([data-theme="dark"]) .logo-light {
    display: block;
}

/* Dark Theme */
html[data-theme="dark"] .logo-dark {
    display: block;
}

/* Ensure consistent sizing for switched logos */
.theme-switchable img {
    max-height: 80px;
    max-width: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: var(--spacing-xl);
}

.mb-4 {
    margin-bottom: var(--spacing-xl);
}

.items-center {
    align-items: center;
}

.self-center {
    align-self: center;
}

/* Responsive Video & Map */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
    overflow: hidden;
    margin-bottom: var(--spacing-md);
    border-radius: 8px;
    background: #000;
}

.video-container iframe,
.video-container object,
.video-container embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.map-container {
    position: relative;
    padding-bottom: 50%;
    /* Smaller aspect ratio (was 75%) */
    height: 0;
    overflow: hidden;
    margin-bottom: var(--spacing-md);
    border-radius: 8px;
    background: #eee;
}

.map-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Ensure nav items are vertically centered */
.site-nav ul {
    align-items: center;
}

@media (max-width: 768px) {
    .site-header .container {
        flex-direction: column;
        height: auto;
        padding: var(--spacing-sm) 0;
    }

    .site-nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--spacing-sm);
        margin-top: var(--spacing-sm);
    }

    .hero {
        padding: var(--spacing-lg) 0;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .member-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .member-image {
        margin-bottom: var(--spacing-md);
    }
}

/* Publications List specific overrides */
.publication-item .pub-title strong {
    font-weight: normal;
    /* Make title normal weight as requested */
    color: var(--color-text);
}

.publication-item .pub-authors {
    font-size: 0.85rem;
    /* Match member education size */
    color: var(--color-secondary);
    margin-top: 0.2rem;
    margin-bottom: 0.2rem;
}

.publication-item .pub-meta {
    font-size: 0.9rem;
    /* Slightly larger than authors, smaller than body */
    color: var(--color-text);
}

.pub-separator {
    color: var(--color-border);
    margin: 0 0.3rem;
}