/* ============================================
   Myungsung Kim - Academic Website
   Minimal, Clean Design inspired by daehwakim.com
   ============================================ */

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

:root {
    /* Colors */
    --color-text: #2d3748;
    --color-text-light: #718096;
    --color-text-lighter: #a0aec0;
    --color-bg: #ffffff;
    --color-bg-gray: #f7fafc;
    --color-border: #e2e8f0;
    --color-accent: #3182ce;
    --color-accent-hover: #2c5282;
    
    /* Typography */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-serif: 'Crimson Text', Georgia, serif;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 6rem;
    
    /* Layout */
    --max-width: 960px;
    --border-radius: 8px;
}

body {
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Typography
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: var(--spacing-sm);
}

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

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

/* ============================================
   Language Toggle (Fixed Button)
   ============================================ */

.language-toggle {
    position: fixed;
    top: 1rem;
    right: 2rem;
    z-index: 1000;
}

.lang-btn {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0.4rem 0.9rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.lang-btn:hover {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
    box-shadow: 0 2px 8px rgba(49, 130, 206, 0.3);
}

/* ============================================
   Navigation
   ============================================ */

.nav {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--color-text-light);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--color-accent);
}

/* ============================================
   Container & Layout
   ============================================ */

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

/* ============================================
   Hero Section
   ============================================ */

.hero {
    padding: 3rem 0 2rem;
    background: linear-gradient(180deg, var(--color-bg-gray) 0%, var(--color-bg) 100%);
}

.hero-content {
    text-align: center;
}

.profile-image {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    border: 4px solid white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.name {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.affiliation {
    font-size: 1.125rem;
    color: var(--color-text-light);
    margin-bottom: 1rem;
}

.status-badge {
    display: inline-block;
    background: #edf2f7;
    padding: 0.5rem 1.25rem;
    border-radius: 24px;
    font-size: 0.875rem;
    color: var(--color-text);
    margin: 1rem 0;
    border: 1px solid var(--color-border);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.social-links a {
    font-size: 1.5rem;
    color: var(--color-text-light);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.social-links a:hover {
    color: var(--color-accent);
    transform: translateY(-2px);
}

/* ============================================
   Sections
   ============================================ */

.section {
    padding: 4rem 0;
}

.section-gray {
    background: var(--color-bg-gray);
}

.section h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--color-text);
}

/* ============================================
   About Section
   ============================================ */

.about-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
}

.about-main h2 {
    margin-bottom: 0.5rem;
}

.bio {
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--color-text);
    margin-bottom: 2rem;
}

.research-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tag {
    background: white;
    color: var(--color-accent);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--color-border);
}

.about-sidebar {
    display: flex;
    flex-direction: column;
}

.about-sidebar .info-box {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
}

.about-sidebar .info-box:last-child {
    margin-bottom: 0;
    flex: 1;
}

.info-box h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.edu-item {
    margin-bottom: 1rem;
}

.edu-item:last-child {
    margin-bottom: 0;
}

.edu-item strong {
    color: var(--color-text);
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
}

.edu-item p {
    font-size: 0.9375rem;
    color: var(--color-text-light);
    line-height: 1.6;
    margin: 0;
}

.info-box p {
    font-size: 0.9375rem;
    color: var(--color-text-light);
    line-height: 1.6;
}

.info-box strong {
    color: var(--color-text);
    font-weight: 600;
}

/* ============================================
   Publications
   ============================================ */

.pub-category {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-border);
}

.pub-category:first-of-type {
    margin-top: 0;
}

.pub-item {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    transition: all 0.2s ease;
}

.pub-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    border-color: var(--color-accent);
}

.pub-image {
    flex-shrink: 0;
    width: 200px;
    height: 140px;
    overflow: hidden;
    border-radius: var(--border-radius);
    background: var(--color-bg-gray);
}

.pub-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pub-content {
    flex: 1;
}

.pub-badges {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-first {
    background: #dbeafe;
    color: #1e40af;
}

.badge-cofirst {
    background: #e9d5ff;
    color: #6b21a8;
}

.badge-second,
.badge-third {
    background: #e5e7eb;
    color: #4b5563;
}

.badge-status {
    background: #fef3c7;
    color: #92400e;
}

.pub-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.pub-summary {
    font-size: 0.9375rem;
    color: var(--color-text-light);
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

.pub-venue {
    font-size: 0.9375rem;
    color: var(--color-text-lighter);
    font-style: italic;
    margin-bottom: 0.25rem;
}

.pub-authors {
    font-size: 0.875rem;
    color: var(--color-text-lighter);
    margin-bottom: 1rem;
}

.pub-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.pub-links a {
    font-size: 0.875rem;
    padding: 0.4rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    transition: all 0.2s ease;
    text-decoration: none;
}

.pub-links a:hover {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

/* ============================================
   Projects
   ============================================ */

.projects-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.project-card {
    display: flex;
    gap: 2rem;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.2s ease;
    padding: 1.5rem;
}

.project-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    border-color: var(--color-accent);
}

.project-image {
    flex-shrink: 0;
    width: 300px;
    height: 200px;
    overflow: hidden;
    background: var(--color-bg-gray);
    border-radius: var(--border-radius);
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-content {
    flex: 1;
}

.project-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.project-desc {
    font-size: 1rem;
    color: var(--color-text-light);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.project-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.project-tags .tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
}

/* ============================================
   Conferences
   ============================================ */

.conf-item {
    position: relative;
    padding: 1.5rem;
    background: white;
    border-left: 3px solid var(--color-accent);
    border-radius: var(--border-radius);
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.conf-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.conf-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.conf-venue {
    font-size: 0.9375rem;
    color: var(--color-text-light);
    margin-bottom: 0.25rem;
}

.conf-authors {
    font-size: 0.875rem;
    color: var(--color-text-lighter);
    margin-bottom: 0.75rem;
}

/* Conference Image Gallery Button */
.conf-gallery-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-bg-gray);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.conf-gallery-btn:hover {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

/* Conference Image Modal */
.conf-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    padding: 2rem;
    overflow-y: auto;
}

.conf-modal.active {
    display: block;
}

.conf-modal-content {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.conf-modal-close {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: all 0.2s ease;
}

.conf-modal-close:hover {
    background: var(--color-accent);
    color: white;
    transform: scale(1.1);
}

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

.conf-image-item {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.conf-image-item img {
    width: 100%;
    height: auto;
    display: block;
}

.conf-image-caption {
    padding: 1rem;
    font-size: 0.9375rem;
    color: var(--color-text-light);
    background: white;
}

/* ============================================
   Gallery
   ============================================ */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.gallery-item {
    position: relative;
    cursor: pointer;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--color-bg-gray);
    aspect-ratio: 4/3;
}

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

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

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 1rem;
    font-size: 0.9375rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-caption {
    opacity: 1;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 90%;
    max-height: 90vh;
    border-radius: var(--border-radius);
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   Footer
   ============================================ */

.footer {
    padding: 3rem 0;
    text-align: center;
    color: var(--color-text-light);
    font-size: 0.9375rem;
    background: var(--color-bg-gray);
    border-top: 1px solid var(--color-border);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .social-links {
        flex-wrap: nowrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .social-link {
        width: 38px;
        height: 38px;
    }

    .research-tags {
        gap: 0.4rem;
    }

    .tag {
        padding: 0.35rem 0.7rem;
        font-size: 0.8rem;
    }

    .container {
        padding: 0 1rem;
    }

    .nav .container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-links {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .language-toggle {
        top: 1rem;
        right: 1rem;
    }

    .hero {
        padding: 2rem 0 1.5rem;
    }

    .profile-image {
        width: 120px;
        height: 120px;
    }

    .name {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .pub-item {
        flex-direction: column;
    }

    .pub-image {
        width: 100%;
        height: 200px;
    }

    /* 프로젝트 카드 모바일 */
    .project-card {
        flex-direction: column;
    }

    .project-image {
        width: 100%;
        height: 200px;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1rem;
    }

    /* Conference 모달 모바일 */
    .conf-images-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .profile-image {
        width: 140px;
        height: 140px;
    }

    .social-links {
        flex-direction: column;
        gap: 0.75rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Animations
   ============================================ */

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

.fade-in {
    animation: fadeIn 0.5s ease-out;
}


/* ============================================
   Layout Refinements (2026-04)
   ============================================ */
@media (min-width: 769px) {
    .hero {
        padding: 2.2rem 0 1.4rem;
    }

    .profile-image {
        width: 156px;
        height: 156px;
        margin-bottom: 0.85rem;
    }

    .name {
        margin-bottom: 0.3rem;
    }

    .affiliation {
        margin-bottom: 0.55rem;
    }

    .status-badge {
        margin: 0.45rem 0 0.7rem;
        padding: 0.45rem 1rem;
    }

    .social-links {
        margin-top: 0.65rem;
        gap: 0.7rem;
    }

    .section {
        padding: 2.6rem 0;
    }

    .section h2 {
        margin-bottom: 1.35rem;
    }

    .about-grid {
        gap: 1.8rem;
        align-items: start;
    }

    .bio {
        margin-bottom: 1.1rem;
    }

    .research-tags {
        gap: 0.55rem;
    }

    .about-sidebar {
        display: grid;
        grid-template-rows: 1fr auto;
        gap: 0.9rem;
        align-content: start;
    }

    .about-sidebar .info-box {
        margin-bottom: 0;
        padding: 1.15rem 1.2rem;
    }

    .info-box h3 {
        margin-bottom: 0.7rem;
    }

    .edu-item {
        margin-bottom: 0.75rem;
    }

    .info-box p {
        margin-bottom: 0.7rem;
    }

    .info-box p:last-child {
        margin-bottom: 0;
    }

    .pub-category {
        margin-top: 0.9rem;
        margin-bottom: 1rem;
    }

    .pub-item {
        gap: 1rem;
        padding: 1.1rem;
        margin-bottom: 0.9rem;
        align-items: start;
    }

    .pub-image {
        width: 180px;
        height: 118px;
    }

    .pub-content {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
    }

    .pub-badges,
    .pub-title,
    .pub-summary,
    .pub-venue,
    .pub-authors {
        margin-bottom: 0;
    }

    .pub-badges {
        gap: 0.45rem;
    }

    .pub-summary {
        line-height: 1.58;
    }

    .projects-grid {
        gap: 1rem;
    }

    .project-card {
        display: grid;
        grid-template-columns: 220px 1fr;
        gap: 1.2rem;
        align-items: start;
        padding: 1.15rem;
    }

    .project-content {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .project-header {
        display: flex;
        flex-direction: column;
        gap: 0.2rem;
    }

    .project-period,
    .project-desc,
    .project-title {
        margin-bottom: 0;
    }
}

.social-links {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.social-link {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: #fff;
    color: var(--color-text-light);
    transition: all 0.2s ease;
}

.social-link svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.social-link .social-text {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.social-link:hover {
    color: var(--color-accent);
    border-color: rgba(49, 130, 206, 0.28);
    background: rgba(49, 130, 206, 0.06);
    transform: translateY(-1px);
}

.pub-title-row {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}

.pub-title-row .pub-title {
    flex: 1;
}

.pub-title-link {
    flex-shrink: 0;
    width: 1.9rem;
    height: 1.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-text-light);
    background: #fff;
    font-size: 0.95rem;
    line-height: 1;
}

.pub-title-link:hover {
    color: #fff;
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.project-image {
    width: 100%;
    min-height: 148px;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--color-bg-gray);
    border: 1px solid var(--color-border);
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
    color: var(--color-text-lighter);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    font-weight: 600;
}

.project-title {
    font-size: 1.18rem;
    line-height: 1.35;
}

.project-period {
    color: var(--color-text-lighter);
}

@media (max-width: 768px) {
    .hero {
        padding: 2.5rem 0 1.75rem;
    }

    .social-links {
        flex-wrap: nowrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .social-link {
        width: 38px;
        height: 38px;
    }
    .research-tags {
        gap: 0.4rem;
    }

    .tag {
        padding: 0.35rem 0.7rem;
        font-size: 0.8rem;
    }

    .pub-title-row {
        gap: 0.45rem;
    }

    .project-card {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .project-image {
        min-height: 190px;
    }
}

/* ===== Mobile fix: social icons stay in one row ===== */
@media (max-width: 768px) {
    .hero .social-links {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }

    .hero .social-links a,
    .hero .social-links .social-link {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 38px !important;
        height: 38px !important;
        flex: 0 0 38px !important;
    }
}