/* Import Fenix from Google Fonts */
@import url('https://fonts.googleapis.com/css?family=Fenix');

:root {
    --primary-color: #007bff;
    --text-dark: #2c3e50;
    --text-light: #f4f4f4;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    /* Apply Fenix Font Globally */
    font-family: 'Fenix', serif;
    color: var(--text-dark);
    /* Standard background for subpages (Index overrides this via JS) */
    background-color: #f9f9f9; 
    overflow-x: hidden; 
}

/* --- TOP NAVIGATION BAR --- */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 5px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(5px);
}

.nav-brand {
    font-weight: 400;
    font-size: 1.6em;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dark);
    margin-left: 25px;
    font-size: 1.1em;
    opacity: 0.7;
    transition: opacity 0.3s, color 0.3s;
}

.nav-links a:hover {
    opacity: 1;
    color: var(--primary-color);
}

/* Each nav link hovers in its own section color (exact-match hrefs, so
   course pages — which use ../../../ paths — are unaffected for now) */
#main-nav .nav-links a[href="research.html"]:hover { color: #e7210e; }
#main-nav .nav-links a[href="design.html"]:hover { color: #13b272; }
#main-nav .nav-links a[href="education.html"]:hover { color: #1d5adc; }
#main-nav .nav-links a[href="strategy.html"]:hover { color: #b8860b; }
#main-nav .nav-links a[href="contact.html"]:hover { color: #7a2fc2; }
#main-nav .nav-links a[href="https://hanusa.xyz/blog"]:hover { color: #d81b8c; } /* insights magenta */

/* --- INDEX PAGE: Fixed Stage & Slides --- */
#fixed-stage {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.8s ease; 
    z-index: 1;
}

.slide {
    position: absolute;
    width: 100%;
    height: 100%;
    max-width: 1400px;
    padding: 100px 5% 0 5%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.slide.active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
}

/* --- SHARED: Split Layout (Used in Index & Subpages) --- */
.split-layout {
    display: flex;
    align-items: center;
    gap: 80px;
    width: 100%;
}

.split-layout.inverted { flex-direction: row-reverse; }

.text-side { flex: 1; }
.image-side { flex: 1;}

/* Default Image Styling (Index) */
.image-side img {
    /* natural size (capped at the container) so the shadow hugs the
       image itself instead of a stretched letterboxed box */
    max-width: 100%;
    height: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    border-radius: 6px;
}

/* --- SUBPAGE LAYOUTS (Research, Portfolio, etc.) --- */

/* 1. The Grid Container */
.page-grid {
    display: grid;
    grid-template-columns: 3fr 1fr; /* 75% Content, 25% Sidebar */
    gap: 40px;
    max-width: 1400px;
    margin: 90px auto 20px; /* top clears fixed header; 20px + card margin = 40px above footer */
    padding: 0 5%;
}

.main-column {
    min-width: 0; /* Prevents grid blowout */
}

/* 2. Hero Header */
.hero-section {
    text-align: left;
    padding: 0 0 0 0;
%    border-bottom: 2px solid #eee;
    margin-bottom: 20px;
}

.hero-section h1 { font-size: 3em; margin-bottom: 15px; color: #2c3e50; }
.hero-section p { font-size: 1.3em; color: #666; max-width: 90%; }

/* 3. Static Section Blocks (Cards) */
.section-block {
    display: flex;
    align-items: center;
    gap: 40px;
    background: #fff;
    padding: 40px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border: 1px solid #e0e0e0;
}

.section-block.inverted { flex-direction: row-reverse; }

/* Uniform paragraph rhythm inside content cards (the global reset
   zeroes p margins; 12px matches the list-item spacing) */
.section-block p { margin-bottom: 12px; }
.section-block p:last-child { margin-bottom: 0; }

/* Specific override for subpage images (Smaller than index) */
.section-block .image-side img {
    max-height: 350px; 
}

/* 4. Topic Lists */
ul.topic-list { list-style: none; }
ul.topic-list li { 
    margin-bottom: 10px; 
    padding-left: 15px; 
    border-left: 3px solid #007bff; 
    font-size: 1.05em;
}

/* --- SIDEBAR & BLOG WIDGETS --- */
.sidebar {
    padding-top: 20px;
}

.sidebar-widget {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    position: sticky;
    top: 120px; /* Sticks as you scroll */
}

.widget-header {
    display: block; /* Desktop default */
    margin-bottom: 20px;
    border-bottom: 2px solid #007bff;
}

.widget-header h3 {
    font-size: 1.5em;
    color: #2c3e50;
    margin: 0;
    padding-bottom: 5px;
    display: inline-block;
}

.blog-list { list-style: none; }
.blog-item { margin-bottom: 25px; }

.blog-date {
    font-size: 0.85em;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 4px;
}

.blog-title {
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    text-decoration: none;
    line-height: 1.4;
%    display: block;
    transition: color 0.2s;
}
.blog-title:hover { color: #007bff; }

.mobile-arrow {
%    display: block;
    color: #007bff;
    font-size: 1.2em;
    font-weight: bold;
    margin-left: 10px;
}

.blog-excerpt {
    font-size: 0.95em;
    color: #666;
    margin-top: 5px;
    line-height: 1.5;
}

/* --- COMMON TYPOGRAPHY & UTILS --- */
h1 { font-size: 4em; margin-bottom: 20px; line-height: 1.1; }
h2 { font-size: 2.5em; margin-bottom: 20px; line-height: 1.1; color: var(--text-dark); }
p { font-size: 1.2em; margin-bottom: 30px; line-height: 1.6; color: #444; }
.bio-text { font-size: 1.4em; }

.scroll-indicator {
    display: inline-block;
    margin-top: 20px;
    color: var(--primary-color);
    font-size: 1.2em;
    animation: bounce 2s infinite;
}

.btn {
    display: inline-block;
    padding: 15px 40px;
    background-color: var(--primary-color);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 1.1em;
    transition: transform 0.2s, background-color 0.2s;
}
.btn:hover { 
    transform: translateY(-3px);
    background-color: #0056b3; 
}

/* Hide mobile-specific elements on desktop */
.mobile-view-all { display: none; }
.desktop-view-all { display: inline-block; }
.desc-long { display: block; }
    
/* Animations */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-10px);}
    60% {transform: translateY(-5px);}
}

/* --- MINIMALIST ACCORDION (Minze Style) --- */
.accordion {
    /*    margin-top: 0px; */
    /* No outer borders, just clean text */
}

.accordion-item {
    border-bottom: 1px solid rgba(0,0,0,0.1); /* Very subtle separator */
}

.accordion-header {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    padding: 10px 0; /* More vertical breathing room */
    
    /* Typography */
    font-family: 'Fenix', serif;
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-dark);
    text-align: left;
    cursor: pointer;
    
    /* Layout */
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.3s ease;
}

.accordion-header:hover {
    color: var(--primary-color);
}


/* The Plus Icon */
.accordion-header .icon {
    font-size: 1.4em;
    font-weight: 300;
    line-height: 1;
    transition: transform 0.3s ease;
}

/* Rotate to X when open */
.accordion-header.active .icon {
    transform: rotate(45deg);
}

/* Smooth Slide Animation */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.25, 1, 0.5, 1); /* Smooth "ease-out" feel */
    opacity: 0; /* Fade in effect */
    transition: max-height 0.4s ease, opacity 0.4s ease;
}

.accordion-header.active + .accordion-content {
    opacity: 1;
}

.accordion-inner {
    padding-top: 10px;
    padding-bottom: 20px;
    padding-left: 20px;
    font-size: 1em;
    color: #555;
}

.accordion-inner p {
    margin-bottom: 15px;
}
.accordion-inner p:last-child {
    margin-bottom: 0;
}

/* --- PUBLICATIONS PAGE (papers.html) --- */

.single-column-layout {
    max-width: 1000px;
    margin: 90px auto 60px;
    padding: 0 5%;
}

/* Controls Area */
.controls {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

/* NEW RULE: Fixes vertical alignment and reduces gap below */
.controls h2 {
    margin-bottom: 0; 
}
.button-group {
    display: flex;
    gap: 10px;
}

/* Toggle Switch Styling */
.toggle-btn {
    background: none;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 8px 16px;
    font-family: 'Fenix', serif;
    font-size: 1em;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.2s ease;
}

.toggle-btn:hover, .toggle-btn.active {
    background-color: var(--primary-color);
    color: #fff;
}


        /* Styling for the new profile links */
        .profile-links {
            width: 100%;        /* Force this element to take the full width */
            margin-top: 0px;   /* Add spacing above */
            font-size: 0.95rem;
            display: block;     /* Ensure it behaves like a block */
        }
        .profile-links a {
            color: #007bff;
            text-decoration: none;
            margin-right: 5px; /* Space between links */
            margin-left: 5px; /* Space between links */
        }
        .profile-links a:hover {
            text-decoration: underline;
        }

/* Paper Item Styling */
.paper-item {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.paper-title {
    font-size: 1.4em;
    font-weight: bold;
    color: var(--text-dark);
    display: block;
    margin-bottom: 5px;
}

.paper-meta {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 8px;
}

.paper-links a {
    display: inline-block;
    margin-right: 15px;
    font-size: 0.95em;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}

.paper-links a:hover { text-decoration: underline; }

/* --- HIDDEN CONTENT STYLES --- */
.paper-abstract {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-left: 4px solid var(--primary-color);
    color: #444;
    font-size: 0.95em;
    line-height: 1.6;
    display: none; 
}

/* BibTeX Styling */
.paper-bibtex {
    margin-top: 15px;
    padding: 20px;
    background-color: #f1f1f1; /* Light Gray Background */
    border-radius: 6px;
    border: 1px solid #ddd;
    display: none;
    position: relative;
}

.bibtex-text {
    color: #1b5e20; /* Dark Green Text */
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    white-space: pre-wrap; /* Preserves line breaks */
    display: block;
    margin-top: 5px; 
}

/* Copy Button */
.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #fff;
    border: 1px solid #ccc;
    color: #333;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.copy-btn:hover { 
    background: #e9ecef; 
    border-color: #bbb;
}

/* Utilities to show content */
.show-abstracts .paper-abstract {
    display: block;
    animation: fadeIn 0.4s ease;
}

.show-bibtex .paper-bibtex {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}



/* --- RESPONSIVE ADJUSTMENTS (Mobile < 1000px) --- */
@media (max-width: 1000px) {
    
    /* 1. Page Layout Changes */
    .page-grid {
        display: flex;
        flex-direction: column;
        /* top clears the fixed nav (wraps to 2 rows); bottom 0 so the sidebar's
           own 20px margin sets the gap to the footer, matching card spacing */
        margin: 100px auto 0;
        /* the desktop 40px column gap becomes a vertical gap when stacked */
        gap: 0;
    }

    /* 2. Sidebar Positioning */
    .sidebar {
        order: 1; /* Move to bottom */
        margin-bottom: 20px;
        /* base padding-top (desktop alignment) would double the gap above
           the widget; the preceding card's 20px margin is the spacing */
        padding-top: 0;
    }
    
    .sidebar-widget {
        position: static; /* Remove sticky on mobile */
    }

    /* 3. Mobile Header Layout (Split Left/Right) */
    .widget-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #ccc;
        padding-bottom: 10px;
        margin-bottom: 10px;
    }

    .widget-header h3 {
        font-size: 1.2em;
        padding-bottom: 0;
    }

    /* 4. Show Mobile Button / Hide Desktop Button */
    .mobile-view-all {
        display: inline-block;
        font-size: 0.85em;
        text-decoration: none;
        color: #007bff;
        font-weight: bold;
        border: 1px solid #007bff;
        padding: 5px 12px;
        border-radius: 20px;
    }

    .desktop-view-all { display: none; }

    /* 5. Minimalist List Items */
    .blog-item {
        margin-bottom: 10px;
        border-bottom: 1px solid #eee;
        padding-bottom: 5px;
    }
    
    .blog-item:last-child { border-bottom: none; }

    /* Hide Date and Descriptions */
    .blog-date { display: none; }
    .blog-excerpt { display: none; } /* Hides both descriptions */
    .desc-long{ display: none; }

    /* 6. Title & Arrow Styling */
    .blog-title {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 1em;
        font-weight: 400;
        color: #333;
    }


    
    /* Index slides: stack with the image above the text
       (both slide variants keep text before image in the DOM) */
    .split-layout, .split-layout.inverted {
        flex-direction: column-reverse;
        gap: 20px;
    }
    /* slides must fit one viewport (fixed-stage scrolling): keep the
       image to about a third of the screen, text gets the rest */
    .split-layout .image-side img {
        max-height: 35vh;
        width: auto;
    }
    /* center all slide text */
    .split-layout .text-side { text-align: center; }
    .split-layout .text-side h1 {
        font-size: 3.2em; /* slightly smaller than the desktop 4em */
    }
    /* center the slide buttons */
    .split-layout .btn {
        display: block;
        width: fit-content;
        margin-left: auto;
        margin-right: auto;
    }

    /* Stack content cards; stretch children so text stays left-aligned
       (the desktop align-items:center would center narrow text columns) */
    .section-block, .section-block.inverted { 
        flex-direction: column-reverse; 
        padding: 30px; 
        align-items: stretch;
    }
    .section-block .image-side { text-align: center; }
}
/* --- Site footer: light, hairline-topped, with the five-color signature --- */
footer {
    text-align: center;
    padding: 25px 20px;
    font-size: 0.9em;
    color: #777;
    border-top: 1px solid #e0e0e0;
    /* three-color stripe matching the logo: red, teal, blue */
    background:
        linear-gradient(90deg,
            #e7210e 0 33.33%, #13b272 33.33% 66.67%, #1d5adc 66.67% 100%)
        top / 100% 3px no-repeat;
}
footer p { margin: 0; }
footer .footer-links a {
    color: #777;
    text-decoration: none;
    margin: 0 6px;
}
footer .footer-links a:hover { color: var(--primary-color); }
footer .footer-links svg {
    width: 18px; height: 18px;
    fill: currentColor;
    vertical-align: -4px;
}
