/* 
  Theme: Cute & Bright (Reference: resume.yowu.dev)
  Font: Pretendard for clean modern look
*/

:root[data-theme="light"] {
    --bg-color: #f4f5f7;
    --card-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --accent: #5c6ac4;
    /* Soft Indigo */
    --accent-light: #e0e4ff;
    --border-color: #eeeeee;
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.08);
    --shadow-sharp: 0 2px 8px rgba(0, 0, 0, 0.05);
    --tag-bg: #f0f2f5;
    --halo: 0 0 0 8px rgba(92, 106, 196, 0.05);
    /* Soft outer ring */
    --toggle-bg: #e2e8f0;
}

:root[data-theme="dark"] {
    --bg-color: #1a1b1e;
    --card-bg: #25262b;
    --text-primary: #ededed;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --accent: #748ffc;
    /* Brighter Blue-Purple */
    --accent-light: rgba(116, 143, 252, 0.15);
    --border-color: #2c2e33;
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.3);
    --shadow-sharp: 0 2px 8px rgba(0, 0, 0, 0.2);
    --tag-bg: #2c2e33;
    --halo: 0 0 0 8px rgba(116, 143, 252, 0.05);
    --toggle-bg: #2c2e33;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 4rem 1rem 2rem 1rem;
}

/* Lenis Recommended CSS */
html.lenis {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis.lenis-stopped {
    overflow: hidden;
}

.lenis.lenis-scrolling iframe {
    pointer-events: none;
}

/* Layout */
.main-layout {
    width: 100%;
    max-width: 860px;
    position: relative;
}

.resume-card {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: var(--shadow-soft);
    position: relative;
    /* The Glow Effect */
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border 0.3s ease;
}

.resume-card:hover {
    box-shadow: var(--shadow-soft), var(--halo);
    transform: translateY(-2px);
}

/* Theme Toggle */
.theme-switch-wrapper {
    position: absolute;
    top: -3.5rem;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    margin-right: 15px;
    gap: 10px;
}

.theme-toggle {
    background: var(--toggle-bg);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sharp);
}

.theme-toggle:hover {
    transform: rotate(15deg) scale(1.1);
    background: var(--accent-light);
    color: var(--accent);
}

/* Header Section */
.header-section {
    display: flex;
    gap: 2rem;
    align-items: center;
    margin-bottom: 2rem;
}

.profile-img-container {
    flex-shrink: 0;
}

.profile-img {
    width: 150px;
    height: 150px;
    border-radius: 100%;
    /* Squircle */
    border: 3px solid var(--card-bg);
    /* Inner border */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background-color: #f1f3f5;
}

.header-content {
    flex: 1;
}

.name {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.2rem;
}

.name small {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.role {
    font-size: 1rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bio {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.social-badge {
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    background: var(--tag-bg);
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid transparent;
}

.social-badge:hover {
    background: var(--accent-light);
    color: var(--accent);
    transform: translateY(-2px);
    border-color: var(--accent);
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 2rem 0;
    border-radius: 1px;
}

/* Sections */
.section {
    margin-bottom: 3rem;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

/* Grids */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Cards */
.info-card,
.simple-card {
    background: var(--bg-color);
    /* Slightly contrasted from card-bg in some themes, or just same layer */
    padding: 1.2rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.info-card h3,
.simple-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.info-card p,
.simple-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.info-card:hover,
.simple-card:hover {
    border-color: var(--accent);
    background: var(--card-bg);
    /* Pop effect */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Timeline */
.timeline-item {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.timeline-left {
    min-width: 120px;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.period {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: monospace;
    margin-bottom: 0.3rem;
}

.company-logo {
    font-weight: 700;
    color: var(--text-primary);
}

.timeline-right {
    flex: 1;
    padding-left: 1.5rem;
    border-left: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.timeline-right h3 {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.timeline-right .summary {
    color: var(--accent);
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
    font-weight: 500;
}

.detail-list {
    list-style: none;
}

.detail-list li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    position: relative;
    padding-left: 1rem;
}

.detail-list li::before {
    content: '●';
    font-size: 6px;
    margin-top: 6.5px;
    color: var(--accent);
    position: absolute;
    left: 0;
}

/* Project Grid */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.project-card {
    background: var(--bg-color);
    /* No padding here, handled in children */
    padding: 0;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border-color: var(--accent-light);
}

.card-header {
    padding: 1.2rem;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px dashed var(--border-color);
}

.project-card h3 {
    font-size: 1rem;
    margin-bottom: 0.8rem;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.card-body {
    padding: 1.2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.card-body p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Footer & Signature */
.footer {
    text-align: center;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.signature {
    font-family: 'Dancing Script', cursive;
    /* Fallback if not loaded, simple script */
    font-size: 1.5rem;
    color: var(--accent);
    margin-top: 0.5rem;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 600px) {
    .resume-card {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .header-section {
        flex-direction: column;
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .timeline-item {
        flex-direction: column;
        gap: 0.5rem;
    }

    .timeline-left {
        text-align: left;
        align-items: flex-start;
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .timeline-right {
        padding-left: 0;
        border-left: none;
    }

    .theme-switch-wrapper {
        top: -3rem;
        right: 0.5rem;
    }
}

/* Button & Modal Styles */

.btn-text {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    margin-top: auto;
    position: relative;
    display: inline-block;
}

.btn-text::after {
    content: ' →';
    transition: transform 0.2s;
    display: inline-block;
}

.btn-text:hover::after {
    transform: translateX(4px);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 600px;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    border: 1px solid var(--border-color);
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

/* Custom scrollbar for modal */
.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
    margin: 20px 0;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.modal-overlay.open .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--accent);
}

.modal-header h3 {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.modal-header .tags {
    margin-bottom: 1.5rem;
}

.modal-body {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 1rem;
    max-height: 60vh;
}

.gpa {
    display: inline-block;
    background: var(--tag-bg);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--accent);
    margin-top: 4px;
    font-weight: 600;
}

/* Modal Gallery */
.modal-gallery {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    /* margin-bottom: 1.5rem; */
    padding-bottom: 0.5rem;
    scroll-behavior: smooth;
}

.modal-gallery::-webkit-scrollbar {
    height: 8px;
}

.modal-gallery::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

.modal-gallery::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.modal-gallery::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.modal-image-item {
    flex-shrink: 0;
    width: 280px;
    max-width: 100%;
    /* Fix: Prevent overflow on small screens */
    height: 180px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: var(--shadow-sharp);
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.modal-image-item:hover {
    transform: scale(1.02);
}