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

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

body {
    font-family: 'Crimson Text', serif;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Crimson Text', serif;
    font-weight: 600;
    line-height: 1.2;
}

h2 {
    font-size: clamp(3rem, 8vw, 6rem);
    text-align: center;
    margin-bottom: 2rem;
}

p {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    line-height: 1.7;
}

a {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.3s ease;
}

a:hover {
    opacity: 0.7;
}

/* Container */
.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Hero Section */
.hero {
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

.hero::after { content: none; }

.hero-background::after {
    content: '';
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.18) 0%, rgba(0,0,0,0.1) 40%, rgba(0,0,0,0.18) 100%);
    pointer-events: none;
}

.hero-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    filter: grayscale(100%) contrast(1.1);
    will-change: auto;
}

/* Section Banners */
.section-banner {
    height: 40vh;
    position: relative;
    overflow: hidden;
    background: #000;
}

.section-banner::after { content: none; }

.section-banner .banner-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
    filter: grayscale(100%);
    will-change: transform;
    transition: transform 0.2s ease-out;
}

/* Video banners */
.section-banner .banner-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

/* Floating Header */
/* Site Header (Top Bar) */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transform: translateY(-100%);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.35s ease;
    background-color: rgba(45,45,45,0);
    backdrop-filter: none !important;
}

.site-header.is-visible {
    transform: translateY(0);
}

.site-header.is-scrolled { box-shadow: none !important; }

.site-header.is-hidden {
    transform: translateY(-110%);
}

.header-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 120px; /* default */
}
.header-inner .brand { order: 1; }
.header-inner .social-icons { order: 2; }
.header-inner .site-nav { order: 3; }
.header-inner .menu-toggle { order: 4; }

/* Wider header container to match screenshot spacing */
.site-header .container { max-width: 1200px; padding-left: 24px; padding-right: 24px; }

/* Split header: brand block (top) + menu bar (bottom) */
.header-top { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    padding-top: 10px; /* slight offset from very top */
    position: relative;
    width: 100%;
}
.header-menu { 
    width: 100%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

.brand { display: flex; flex-direction: column; align-items: center; line-height: 1.1; text-align: center; }

.brand-link {
    display: inline-flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.brand-name {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    color: #fff;
}

.brand-title {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    opacity: 0.9;
    font-size: clamp(0.75rem, 1.8vw, 0.95rem);
    margin-top: 2px;
    letter-spacing: 0.02em;
    color: #fff;
}

.site-nav { display: none; gap: 32px; align-items: center; }

@media (min-width: 768px) { .site-nav { display: flex; } }

.site-nav a {
    color: #000;
    font-size: 2rem;
    font-family: 'Crimson Text', serif;
    position: relative;
    text-decoration: none;
}

.site-nav a::after {
    content: '';
    position: absolute;
    left: 0; bottom: -3px;
    height: 1px; width: 0;
    background: #000;
    transition: width 0.25s ease;
}

.site-nav a:hover::after, .site-nav a.active::after {
    width: 100%;
}

/* Menu bar height like Wix */
.header-menu .site-nav { height: 55px; }
.header-menu .site-nav > a,
.header-menu .site-nav > .nav-item > a { line-height: 55px; }

/* Subtle translucent bar behind menu, like Wix */
.header-menu { margin-top: 6px; }
.header-menu .site-nav { background: transparent; padding: 0 14px; }
.header-menu .site-nav > a,
.header-menu .site-nav > .nav-item > a { padding: 0 12px; }

/* Homepage: fixed header height and bottom-flush nav */
body.home .header-inner {
    height: 200px;
    min-height: 200px;
    position: relative;
}
body.home .header-menu {
    position: absolute;
    left: 0; right: 0; bottom: 0;
}

/* Smooth transitions for all header elements */
.header-top { 
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1); 
}

/* Brand positioning - smooth movement from center to left */
.brand {
    position: relative;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    transform-origin: center;
}

/* Social icons positioning - smooth movement from center to right */
.social-icons {
    position: relative;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    margin-top: 6px;
}

/* Fade out brand + socials as you scroll; reappear in compact */
.header-top .brand,
.header-top .social-icons { opacity: var(--t, 1); }
.site-header.is-compact .header-top .brand,
.site-header.is-compact .header-top .social-icons { opacity: 1; }

/* Compact header layout */
.site-header.is-compact .header-inner { 
    height: 64px; 
    min-height: 64px; 
}

.site-header.is-compact .header-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    margin: 0;
}

.site-header.is-compact .brand {
    margin: 0;
    align-items: flex-start;
}

.site-header.is-compact .brand-name {
    font-size: 0.95rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
}

.site-header.is-compact .brand-title { 
    display: none; 
}

.site-header.is-compact .social-icons {
    margin: 0;
    position: relative;
    right: auto;
    top: auto;
}

.site-header.is-compact .social-icons a { 
    width: 28px;
    height: 28px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.site-header.is-compact .social-icons a img {
    width: 14px;
    height: 14px;
}

.site-header.is-compact .header-menu { 
    position: static; 
    margin-top: 0;
}
.site-header.is-compact .header-menu .site-nav { height: 60px; }
.site-header.is-compact .header-menu .site-nav > a,
.site-header.is-compact .header-menu .site-nav > .nav-item > a { line-height: 60px; }

/* Menu toggle positioning in compact mode */
.site-header.is-compact .menu-toggle {
    position: absolute;
    right: 20px;
    top: 12px;
}

/* Compact top bar background */
.site-header.is-compact { box-shadow: 0 8px 20px rgba(0,0,0,0.18); }

/* Also show the solid bar background during transition near top */
.site-header.has-bar-bg { box-shadow: 0 8px 20px rgba(0,0,0,0.18); }

/* Compact bar: make nav readable on dark background */
.site-header.is-compact .site-nav a,
.site-header.has-bar-bg .site-nav a { color: #fff; }
.site-header.is-compact .site-nav a::after,
.site-header.has-bar-bg .site-nav a::after { background: #fff; }
.site-header.is-compact .site-nav .has-submenu > a::after,
.site-header.has-bar-bg .site-nav .has-submenu > a::after { border-top-color: #fff; }

/* When compact, push the page down so it doesn't scroll under the bar */
body.compact-offset { padding-top: 64px; }

/* Blur overlay during initial load */
body.is-loading::after {
    content: '';
    position: fixed;
    inset: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(0,0,0,0.02);
    z-index: 100000;
}

/* Header dropdown (Teaching → courses) */
.site-nav .nav-item { position: relative; }
.site-nav .has-submenu > a { padding-right: 14px; }
.site-nav .has-submenu > a::after {
    /* small caret */
    content: '';
    position: absolute;
    right: -2px; bottom: 2px;
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #000;
}
.site-nav .submenu {
    display: none;
    position: absolute;
    left: 0; top: calc(100% + 8px);
    background: rgba(0,0,0,0.9);
    backdrop-filter: saturate(160%) blur(8px);
    border-radius: 10px;
    padding: 10px 8px;
    min-width: 280px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.25);
    z-index: 1200;
}
.site-nav .submenu a {
    display: block;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 0.95rem;
    padding: 10px 12px;
    line-height: 1.3;
    opacity: 0.95;
}
.site-nav .submenu a:hover { opacity: 1; background: rgba(255,255,255,0.06); border-radius: 6px; }
.site-nav .has-submenu:hover .submenu,
.site-nav .has-submenu:focus-within .submenu { display: block; }

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    background: transparent;
    border: 0;
    width: 40px; height: 40px;
    align-items: center; justify-content: center;
    cursor: pointer;
}
.menu-toggle .bar {
    display: block;
    width: 22px; height: 2px;
    background: #fff;
    margin: 3px 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

@media (max-width: 767px) {
  .menu-toggle { display: inline-flex; }
  .site-nav { display: none; }
  .site-header.menu-open .site-nav {
    display: block;
    position: fixed;
    top: 64px;
    right: 12px;
    background: rgba(0,0,0,0.92);
    backdrop-filter: saturate(160%) blur(8px);
    border-radius: 12px;
    padding: 10px;
    min-width: 280px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.25);
    z-index: 1200;
  }
  .site-header.menu-open .site-nav a { display:block; padding: 10px 12px; }
  .site-header.menu-open .site-nav .submenu { display:block; position:static; padding: 6px 0 0 12px; background: transparent; box-shadow: none; }
  .site-header.menu-open .site-nav .has-submenu > a::after { display:none; }
}

.social-icons { display: flex; gap: 12px; margin-top: 6px; }

.social-icons a {
    width: 34px;
    height: 34px;
    background: #ffffff;
    color: #000;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.social-icons a:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.2);
}

.social-icons a svg { width: 18px; height: 18px; display: block; fill: #fff; }
.social-icons a i { font-size: 16px; line-height: 1; color: #fff; }
.social-icons a img { width: 18px; height: 18px; display: block; }

/* Platform-specific colors */
.social-linkedin { background: #0A66C2; }
.social-x { background: #000000; }
.social-ssrn { background: #ffffff; border: 1px solid #e0e0e0; width: 34px; padding: 0; border-radius: 9999px; }
.social-ssrn .social-text { display: none; }

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Main Navigation */
.main-nav { display: none; }

.main-nav.hidden {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(-20px);
    pointer-events: none;
}

.main-nav a {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 400;
    font-family: 'Crimson Text', serif;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    transition: all 0.4s cubic-bezier(0.87, 0, 0.13, 1);
    position: relative;
    text-decoration: none;
}

.main-nav a:hover {
    opacity: 1;
    transform: translateY(-2px);
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 1px;
    background: #fff;
    transition: width 0.3s ease;
}

.main-nav a:hover::after {
    width: 100%;
}


/* Content Sections */
.content-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    position: relative;
    transition: all 0.6s cubic-bezier(0.87, 0, 0.13, 1);
}

.content-section h2 {
    transition: all 0.6s cubic-bezier(0.87, 0, 0.13, 1);
}

.content-section.visible {
    transform: translateY(0);
}

/* Enhanced scroll animations */
.content-section:not(.visible) {
    transform: translateY(8px);
    opacity: 0.9;
}

/* Research Section */
.research-section {
    background: #fff;
    flex-direction: column;
}

.research-links {
    text-align: center;
    margin-bottom: 3rem;
}

.cv-link {
    font-size: 1.3rem;
    text-decoration: underline;
    color: #000;
    font-family: 'Crimson Text', serif;
}

.research-section h3 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-align: left;
    width: 100%;
    max-width: 900px;
}

/* Research: cards */
.papers-grid { display: block; }

.paper {
    width: 100%;
    max-width: 900px;
    margin: 0 auto 1.25rem auto;
    background: #f7f7f7;
    border: 1px solid #eeeeee;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    text-align: left;
}

.paper h4 {
    margin-bottom: 0.35rem;
}

.paper-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #000;
    text-decoration: underline;
    margin-bottom: 0.35rem;
    display: inline-block;
}

.authors {
    font-style: italic;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
    color: #666;
}

.journal {
    color: #B8860B;
    font-style: italic;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.abstract {
    margin-top: 0.5rem;
    line-height: 1.6;
    color: #555;
}

.abstract strong {
    font-weight: 600;
    color: #000;
}

/* Teaching Section */
.teaching-section {
    background: #f8f8f8;
    position: relative;
    overflow: hidden;
}

.teaching-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.teaching-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.3;
}

.teaching-section .container {
    position: relative;
    z-index: 2;
}

.courses-layout {
    margin-top: 3rem;
}

.course-item {
    display: flex;
    align-items: center;
    gap: 3rem;
    margin-bottom: 4rem;
    background: rgba(255,255,255,0.95);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.course-item:nth-child(even) {
    flex-direction: row-reverse;
}

.course-image {
    flex: 0 0 400px;
    height: 300px;
    border-radius: 8px;
    overflow: hidden;
}

.course-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.course-item:hover .course-image img {
    transform: scale(1.05);
}

.course-content {
    flex: 1;
    padding: 1rem;
}

.course-content h3 {
    font-size: 2rem;
    color: #000;
    margin-bottom: 1rem;
    letter-spacing: 1px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.course-content p {
    color: #666;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.course-link-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #000;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

.course-link-btn:hover {
    background: #333;
    transform: translateY(-2px);
}

.workshops-section {
    margin-top: 5rem;
    padding-top: 3rem;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.workshops-section h3 {
    font-size: 2rem;
    color: #000;
    margin-bottom: 1rem;
    text-align: center;
    font-family: 'Crimson Text', serif;
}

.workshops-section > p {
    color: #555;
    text-align: center;
    max-width: 700px;
    margin: 0 auto 3rem;
    font-size: 1.1rem;
}

.workshop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.workshop-item {
    text-align: center;
}

.workshop-image {
    height: 200px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.workshop-image img,
.workshop-image video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.workshop-item:hover .workshop-image img,
.workshop-item:hover .workshop-image video {
    transform: scale(1.05);
}

.workshop-label {
    color: #333;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
}

.conference-note {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-top: 2rem;
}

/* Resources Section */
.resources-section {
    background: #f8f8f8;
}

.resources-content {
    max-width: 700px;
    text-align: left;
}

.resources-content p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: #555;
}

.resources-content a {
    color: #000;
    text-decoration: underline;
}

.resources-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.resource-item {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.resource-item h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.resource-item h3 a {
    color: #000;
    text-decoration: underline;
}

.resource-item p {
    color: #666;
    font-size: 0.95rem;
    margin: 0;
}

/* About Section */
.about-section {
    background: #fff;
}

.about-content {
    max-width: 700px;
    text-align: center;
}

.about-content p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: #555;
}

/* Contact Section */
.contact-section {
    background: #f8f8f8;
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    max-width: 900px;
}

.contact-info h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.contact-info p {
    margin-bottom: 1rem;
    color: #555;
}

.contact-info a {
    color: #000;
    text-decoration: underline;
}

.map-container {
    height: 400px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

#map {
    height: 100%;
    width: 100%;
}

/* Footer */
.site-footer {
    background: #000;
    color: #fff;
    text-align: center;
    padding: 2rem 0;
}

.site-footer p {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .floating-header {
        padding: 10px 20px;
        border-radius: 20px;
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .header-content {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .name-title h1 {
        font-size: 1rem;
    }
    
    .name-title p {
        font-size: 0.65rem;
    }
    
    .social-icons a {
        min-width: 20px;
        height: 20px;
        padding: 0 4px;
        font-size: 0.5rem;
    }
    
    .main-nav {
        flex-direction: column;
        gap: 20px;
    }
    
    .main-nav a {
        font-size: 1.3rem;
    }
    
    .container {
        padding: 0 15px;
    }
    
    h2 {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }
    
    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .courses-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .course-item {
        flex-direction: column !important;
        text-align: center;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    
    .course-image {
        flex: none;
        width: 100%;
        height: 250px;
    }
    
    .course-content h3 {
        font-size: 1.5rem;
    }
    
    .workshop-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.5rem;
    }
    
    .workshops-section h3 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .content-section {
        padding: 60px 0;
    }
    
    .floating-header {
        flex-direction: column;
        gap: 8px;
        padding: 12px 16px;
    }
    
    .name-title {
        text-align: center;
    }
    
    .paper {
        margin-bottom: 2rem;
    }
    
    .abstract {
        font-size: 0.9rem;
    }
}

/* Leaflet Map Styles */
.leaflet-container {
    height: 100%;
    width: 100%;
    font-family: 'Inter', sans-serif;
}

.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.leaflet-popup-content {
    font-family: 'Inter', sans-serif;
    line-height: 1.4;
}

/* Smooth Scrolling Enhanced */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Print Styles */
@media print {
    .site-header,
    .main-nav {
        display: none;
    }
    
    .content-section {
        min-height: auto;
        page-break-inside: avoid;
    }
    
    .hero {
        height: 50vh;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles */
a:focus,
button:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* Loading States */
.hero-image {
    transition: opacity 0.5s ease;
}

.hero-image[loading] {
    opacity: 0.5;
}
