/* CSS VARIABLES & RESET */
:root {
    --primary: #1B3A5C;
    --secondary: #8B6914;
    --accent: #4A7FA5;
    --bg-color: #DCECF6;
    --text-dark: #2D2D2D;
    --text-light: #F4F1E8;
    --highlight: #D4A843;
    --peach: #FFDAB9;
    --toggle-bg: #F1F4CE;
    --grey: #6B7280;
    --card-bg: #FFFFFF;
    --border: #B8D4E8;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(--bg-color); color: var(--text-dark); line-height: 1.6; display: flex; flex-direction: column; min-height: 100vh; }

/* HEADER & NAVIGATION */
header { display: flex; justify-content: space-between; align-items: center; background-color: var(--primary); padding: 1.2rem 3rem; color: var(--text-light); flex-wrap: wrap; gap: 1rem; }
.site-name { color: white; font-size: 1.15rem; font-weight: 700; text-decoration: none; letter-spacing: 0.5px; white-space: nowrap; flex-shrink: 0; transition: color 0.2s; }
.site-name:hover { color: var(--peach); }
.nav-links { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: center; }
.nav-links a { color: #D6D0C0; font-size: 0.9rem; cursor: pointer; text-transform: uppercase; letter-spacing: 1px; transition: color 0.3s; text-decoration: none; padding-bottom: 4px; border-bottom: 2px solid transparent; }
.nav-links a:hover, .nav-links a.active { color: var(--peach); border-bottom: 2px solid var(--peach); }

/* HERO SECTION */
.hero { display: flex; justify-content: space-between; padding: 4rem 3rem; gap: 3rem; background: linear-gradient(135deg, #EAF4FC, #DCECF6); border-bottom: 3px solid var(--border); }
.hero-left { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.hero-name { font-size: 3rem; color: var(--primary); margin-bottom: 0.3rem; font-weight: 700; }
.hero-affiliation { font-size: 1rem; color: var(--accent); font-weight: 600; margin-bottom: 1.2rem; letter-spacing: 0.5px; }
.poetic-line { font-size: 1.25rem; font-style: italic; color: var(--secondary); margin-bottom: 1.5rem; border-left: 4px solid var(--highlight); padding-left: 1rem; line-height: 1.5; }
.poetic-line strong { font-style: normal; font-size: 1.1rem; color: var(--primary); }
.motivation { font-size: 1.05rem; color: #444; text-align: justify; }
.hero-right { flex: 0.4; display: flex; justify-content: center; align-items: center; }
.profile-photo { width: 100%; max-width: 300px; height: 340px; object-fit: cover; object-position: center 20%; border-radius: 12px; box-shadow: 0 12px 28px rgba(0,0,0,0.2); border: 5px solid white; }
.photo-placeholder { width: 260px; height: 280px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; font-size: 4rem; font-weight: bold; border-radius: 12px; box-shadow: 0 10px 20px rgba(0,0,0,0.15); border: 5px solid white; }

/* PAGE HEADER (non-home pages) */
.page-header { background: linear-gradient(135deg, var(--primary) 0%, #2C547A 100%); color: white; padding: 3rem; border-bottom: 4px solid var(--highlight); }
.page-header h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.page-header p { font-size: 1.1rem; opacity: 0.85; }

/* RESEARCH AREAS GRID (home) */
.research-section { padding: 3rem; background-color: #EAF4FC; }
.section-heading { color: var(--primary); margin-bottom: 1.5rem; text-transform: uppercase; font-size: 1.4rem; letter-spacing: 2px; border-bottom: 3px solid var(--highlight); padding-bottom: 0.5rem; display: inline-block; }
.research-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.research-card { background: white; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; transition: transform 0.3s, box-shadow 0.3s; text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.research-card:hover { transform: translateY(-6px); box-shadow: 0 14px 28px rgba(0,0,0,0.13); border-color: var(--peach); }
.research-card .card-img { height: 185px; background-size: cover; background-position: center; }
.research-card .card-body { padding: 1.5rem; flex-grow: 1; display: flex; flex-direction: column; background: #F5FBFF; }
.research-card .card-body h3 { color: var(--primary); margin-bottom: 0.5rem; font-size: 1.15rem; }
.research-card .card-body p { color: #555; font-size: 0.95rem; margin-bottom: 1rem; flex-grow: 1; }
.research-card .read-more { color: var(--primary); font-weight: bold; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; background: var(--peach); display: inline-block; padding: 0.3rem 0.9rem; border-radius: 4px; width: fit-content; }
.research-card:hover .read-more { background: #FFB87A; }

/* MAIN CONTENT */
.main-content { padding: 3rem; flex-grow: 1; max-width: 1200px; margin: 0 auto; width: 100%; }
.section-title { color: var(--primary); border-bottom: 3px solid var(--highlight); padding-bottom: 0.5rem; margin-bottom: 2rem; font-size: 1.6rem; display: inline-block; }
.item-box { background: white; padding: 1.5rem; border-radius: 8px; margin-bottom: 1.5rem; box-shadow: 0 3px 10px rgba(0,0,0,0.07); border-left: 4px solid var(--highlight); }
.item-title { font-weight: bold; font-size: 1.15rem; color: var(--primary); margin-bottom: 0.3rem; }
.item-meta { font-size: 0.9rem; color: var(--grey); margin-bottom: 0.3rem; }

/* ARTICLE TITLE LINKS */
.article-title-link { color: var(--primary); text-decoration: none; font-weight: 700; font-size: 1.05rem; line-height: 1.5; transition: color 0.2s; }
.article-title-link:hover { color: var(--accent); text-decoration: underline; }

/* AUTHOR HIGHLIGHT */
.author-highlight { font-weight: 700; color: var(--secondary); }
.pub-authors { font-size: 0.93rem; color: #555; margin-bottom: 0.3rem; }

/* EXPANDABLE DETAILS */
.expand-toggle { display: inline-block; margin-top: 0.6rem; font-size: 0.85rem; background: var(--primary); color: white; padding: 0.4rem 1rem; border-radius: 3px; cursor: pointer; user-select: none; transition: background 0.2s; }
.expand-toggle:hover { background: var(--accent); }
.expand-panel { display: none; margin-top: 0.8rem; padding: 1rem; background: var(--toggle-bg); border-radius: 5px; border-left: 3px solid var(--accent); font-size: 0.95rem; color: #444; }
.expand-panel.open { display: block; }

/* SKILLS GRID */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; margin-top: 1rem; }
.skill-card { background: var(--primary); color: white; padding: 1.5rem; border-radius: 8px; text-align: center; border-bottom: 4px solid var(--highlight); }
.skill-card h4 { color: var(--peach); margin-bottom: 0.5rem; font-size: 1rem; }

/* INSTITUTE LOGOS */
.inst-logo { height: 56px; width: auto; max-width: 72px; object-fit: contain; border-radius: 4px; flex-shrink: 0; }
.inst-logo-text { height: 56px; width: 72px; display: flex; align-items: center; justify-content: center; background: var(--primary); color: white; font-size: 0.68rem; font-weight: 700; text-align: center; border-radius: 6px; flex-shrink: 0; line-height: 1.3; padding: 4px; }

/* EDUCATION BOX */
.edu-header { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 0.8rem; }

/* CONFERENCE BOX */
.conf-header { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 0.8rem; }
.conf-logo { height: 52px; }
.conf-meta-block { flex: 1; }
.conf-name { font-weight: 700; color: var(--primary); font-size: 1.05rem; line-height: 1.4; }
.conf-place-date { font-size: 0.88rem; color: var(--grey); margin-top: 0.2rem; }
.conf-title { font-size: 1rem; color: #333; margin-bottom: 0.4rem; font-style: italic; border-left: 3px solid var(--highlight); padding-left: 0.8rem; margin-top: 0.5rem; line-height: 1.5; }
.conf-authors { font-size: 0.9rem; color: #666; margin-top: 0.3rem; }

/* RESEARCH DETAIL PAGE */
.detail-hero { width: 100%; height: 340px; background-size: cover; background-position: center; position: relative; }
.detail-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(27,58,92,0.25), rgba(27,58,92,0.75)); }
.detail-hero .hero-text { position: absolute; bottom: 2.5rem; left: 3rem; color: white; z-index: 1; }
.detail-hero .hero-text h1 { font-size: 2.5rem; margin-bottom: 0.5rem; text-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.detail-hero .hero-text p { font-size: 1.1rem; max-width: 650px; opacity: 0.95; text-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.detail-content { padding: 3rem; max-width: 1000px; margin: 0 auto; flex-grow: 1; }
.detail-content h2 { color: var(--primary); margin-top: 2rem; margin-bottom: 1rem; border-left: 4px solid var(--highlight); padding-left: 1rem; font-size: 1.35rem; }
.detail-content p { margin-bottom: 1rem; color: #444; font-size: 1.05rem; }
.detail-content ul { margin-left: 1.5rem; margin-bottom: 1rem; color: #444; }
.detail-content ul li { margin-bottom: 0.6rem; font-size: 1.02rem; }
.back-link { display: inline-flex; align-items: center; gap: 0.4rem; margin-bottom: 2rem; color: var(--accent); text-decoration: none; font-weight: bold; font-size: 0.95rem; }
.back-link:hover { color: var(--secondary); }

/* RESULT FIGURE CARDS */
.results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 1.8rem; margin: 1.5rem 0 2.5rem; }
.result-card { background: white; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; transition: transform 0.3s, box-shadow 0.3s; }
.result-card:hover { transform: translateY(-7px); box-shadow: 0 16px 32px rgba(0,0,0,0.15); }
.result-img-wrap { position: relative; overflow: hidden; }
.result-img { width: 100%; height: 220px; object-fit: cover; display: block; transition: transform 0.4s ease; }
.result-card:hover .result-img { transform: scale(1.08); }
.result-img-placeholder { height: 220px; background: linear-gradient(135deg, #1B3A5C, #4A7FA5); display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; transition: transform 0.4s; }
.result-card:hover .result-img-placeholder { transform: scale(1.05); }
.result-img-placeholder span { font-size: 1.1rem; font-weight: 700; opacity: 0.9; }
.result-img-placeholder p { font-size: 0.85rem; opacity: 0.75; margin-top: 0.3rem; }
.result-caption { background: rgba(27,58,92,0.93); color: white; padding: 0.9rem 1rem; font-size: 0.76rem; line-height: 1.5; max-height: 0; overflow: hidden; transition: max-height 0.4s ease, padding 0.3s ease; }
.result-card:hover .result-caption { max-height: 250px; }
.result-btn-row { margin-top: auto; }
.result-btn { display: block; text-align: center; padding: 0.7rem; font-size: 0.83rem; font-weight: 700; text-decoration: none; text-transform: uppercase; letter-spacing: 1px; border-top: 1px solid var(--border); transition: background 0.2s; }
.result-btn-active { background: var(--peach); color: var(--primary); }
.result-btn-active:hover { background: #FFB87A; }
.result-btn-soon { background: #f0f0f0; color: var(--grey); cursor: default; pointer-events: none; }

/* TEACHING */
.course-item { background: white; padding: 1.2rem 1.5rem; border-radius: 8px; margin-bottom: 1rem; box-shadow: 0 3px 8px rgba(0,0,0,0.06); border-left: 4px solid var(--accent); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.course-item .course-name { font-weight: 600; color: var(--primary); font-size: 1rem; }
.course-item .course-code { font-size: 0.85rem; color: var(--grey); }
.course-item .course-years { font-size: 0.88rem; color: var(--secondary); font-weight: 600; background: var(--toggle-bg); border: 1px solid var(--border); padding: 0.2rem 0.7rem; border-radius: 20px; }

/* FOOTER */
footer { background-color: var(--primary); color: #D6D0C0; padding: 2.5rem 3rem; display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 2rem; font-size: 0.9rem; margin-top: auto; border-top: 4px solid var(--highlight); }
footer h3 { margin-bottom: 0.7rem; font-size: 1rem; color: var(--peach); text-transform: uppercase; letter-spacing: 1px; }
.footer-left a { color: #A8C5DA; text-decoration: none; display: block; margin-bottom: 0.4rem; transition: color 0.2s; }
.footer-left a:hover { color: var(--peach); }
.footer-center { text-align: center; flex: 1; min-width: 250px; }
.footer-center a { color: #A8C5DA; }
.footer-center a:hover { color: var(--peach); }
.footer-right .download-btn { background: var(--peach); color: var(--primary); padding: 0.8rem 1.8rem; text-decoration: none; font-weight: bold; border-radius: 25px; transition: 0.3s; display: inline-block; font-size: 0.9rem; }
.footer-right .download-btn:hover { background: #FFB87A; color: var(--primary); }

/* LIGHTBOX */
#lb-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.88); z-index: 9999; align-items: center; justify-content: center; padding: 1.5rem; }
#lb-overlay.lb-active { display: flex; animation: lb-fade-in 0.2s ease; }
@keyframes lb-fade-in { from { opacity: 0; } to { opacity: 1; } }
#lb-box { position: relative; max-width: 92vw; max-height: 92vh; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
#lb-img { max-width: 100%; max-height: 80vh; object-fit: contain; border-radius: 6px; box-shadow: 0 8px 40px rgba(0,0,0,0.6); }
#lb-caption { color: #ddd; font-size: 0.85rem; text-align: center; max-width: 720px; line-height: 1.6; background: rgba(0,0,0,0.5); padding: 0.7rem 1.2rem; border-radius: 6px; }
#lb-close { position: absolute; top: -2.2rem; right: 0; background: none; border: none; color: white; font-size: 2rem; cursor: pointer; line-height: 1; opacity: 0.8; transition: opacity 0.2s; }
#lb-close:hover { opacity: 1; }

/* PUBLICATION HIGHLIGHT */
@keyframes pub-flash { 0% { background: white; } 20% { background: #FFF3CD; box-shadow: 0 0 0 4px #FFD96A; } 60% { background: #FFF8E1; box-shadow: 0 0 0 2px #FFD96A; } 100% { background: white; box-shadow: none; } }
.item-box.pub-highlight { animation: pub-flash 3.2s ease forwards; }

/* ── HAMBURGER BUTTON (hidden on desktop) ── */
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 0.4rem; color: white; flex-direction: column; justify-content: center; gap: 5px; flex-shrink: 0; z-index: 200; }
.hamburger span { display: block; width: 24px; height: 2px; background: white; border-radius: 2px; transition: transform 0.3s, opacity 0.3s; }
.hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.is-open span:nth-child(2) { opacity: 0; }
.hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── MOBILE ── */
@media (max-width: 768px) {

    /* Header & Nav */
    header { justify-content: space-between; align-items: center; padding: 0.9rem 1.2rem; flex-wrap: nowrap; position: relative; }
    .site-name { font-size: 1rem; }
    .hamburger { display: flex; }
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0; right: 0;
        background: var(--primary);
        padding: 0.5rem 0 1rem;
        z-index: 100;
        border-top: 1px solid rgba(255,255,255,0.1);
        box-shadow: 0 8px 20px rgba(0,0,0,0.25);
        gap: 0;
    }
    .nav-links.nav-open { display: flex; }
    .nav-links a { padding: 0.75rem 1.5rem; border-bottom: none; font-size: 0.9rem; letter-spacing: 0.5px; width: 100%; border-radius: 0; }
    .nav-links a:hover, .nav-links a.active { background: rgba(255,218,185,0.12); color: var(--peach); border-bottom: none; }

    /* Hero */
    .hero { flex-direction: column; padding: 1.8rem 1.2rem; gap: 1.5rem; }
    .hero-right { order: -1; align-self: center; }
    .profile-photo { max-width: 200px; height: 220px; }
    .hero-name { font-size: 2rem; }
    .hero-affiliation { font-size: 0.88rem; }
    .poetic-line { font-size: 1.05rem; }
    .motivation { font-size: 0.95rem; }

    /* Sections */
    .research-section { padding: 1.8rem 1.2rem; }
    .main-content { padding: 1.8rem 1.2rem; }
    .detail-content { padding: 1.8rem 1.2rem; }
    .page-header { padding: 2rem 1.2rem; }
    .page-header h1 { font-size: 1.8rem; }
    .page-header p { font-size: 0.95rem; }

    /* Section headings */
    .section-heading { font-size: 1.1rem; }
    .section-title { font-size: 1.2rem; }

    /* Research cards */
    .research-grid { grid-template-columns: 1fr; }
    .research-card .card-img { height: 160px; }

    /* Detail hero */
    .detail-hero { height: 220px; }
    .detail-hero .hero-text { left: 1.2rem; right: 1.2rem; bottom: 1.2rem; }
    .detail-hero .hero-text h1 { font-size: 1.5rem; }
    .detail-hero .hero-text p { font-size: 0.9rem; }

    /* Result figure cards */
    .results-grid { grid-template-columns: 1fr; gap: 1.2rem; }
    .result-img { height: 190px; }
    /* Always show caption on mobile (no hover) */
    .result-caption { max-height: 200px; padding: 0.8rem 1rem; font-size: 0.75rem; }

    /* Publications */
    .item-box { padding: 1.1rem 1rem; }
    .article-title-link { font-size: 0.97rem; }

    /* Education toggles */
    .edu-header { flex-wrap: wrap; gap: 0.6rem; }
    .expand-toggle { font-size: 0.8rem; padding: 0.35rem 0.8rem; }
    .expand-panel { font-size: 0.9rem; }

    /* Conference items */
    .conf-header { flex-wrap: wrap; gap: 0.6rem; }
    .conf-name { font-size: 0.95rem; }
    .conf-title { font-size: 0.92rem; }

    /* Skills grid */
    .skills-grid { grid-template-columns: 1fr 1fr; }

    /* Teaching */
    .course-item { flex-direction: column; align-items: flex-start; gap: 0.4rem; }

    /* Contact page */
    .contact-wrapper { grid-template-columns: 1fr !important; gap: 1.5rem; }
    .contact-info-card { padding: 1.5rem; }
    .contact-form-card { padding: 1.5rem; }
    .social-row { gap: 0.5rem; }
    .social-btn { font-size: 0.8rem; padding: 0.4rem 0.8rem; }

    /* Footer */
    footer { flex-direction: column; text-align: center; gap: 1.5rem; align-items: center; padding: 1.8rem 1.2rem; }
    footer h3 { margin-bottom: 0.5rem; }
    .footer-left a { display: inline; margin: 0 0.3rem; }
    .footer-right .download-btn { padding: 0.7rem 1.5rem; font-size: 0.85rem; }

    /* Lightbox on mobile */
    #lb-box { max-width: 96vw; }
    #lb-img { max-height: 65vh; }
    #lb-caption { font-size: 0.78rem; padding: 0.6rem 0.8rem; }
    #lb-close { font-size: 1.8rem; top: -1.8rem; }
}

@media (max-width: 480px) {
    .hero-name { font-size: 1.7rem; }
    .skills-grid { grid-template-columns: 1fr; }
    .nav-links a { font-size: 0.85rem; padding: 0.7rem 1.2rem; }
    .detail-hero { height: 180px; }
    .detail-hero .hero-text h1 { font-size: 1.3rem; }
}
