/* Precision Replica Design System */

:root {
    --bg-color: #000000; /* Pure black background */
    --text-primary: #d2d2d2; /* Soft off-white to prevent screen glare */
    --text-secondary: #606060; /* Tinted darker neutral gray for secondary text elements */
    --text-muted: #3e3e3e; /* Tinted darker gray for metadata and degrees */
    --border-color: rgba(255, 255, 255, 0.15); /* Slightly lightened silver-grey boundary line */
    
    --font-sans: 'Inter', 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

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

html {
    scroll-behavior: smooth;
    background-color: var(--bg-color);
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.2; /* Tight spacing layout */
    letter-spacing: -0.04em; /* Compressed tracking */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* Hide checkbox used for pure CSS state toggle */
.popup-state-checkbox {
    display: none !important;
}

/* Master Wrapper */
/* Locks desktop heights to prevent page-level scrollbars */
.wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 40px; /* Aligned padding */
    height: 100vh;
    overflow: hidden; /* Prevent body level scroll */
}

/* Container Grid Layout */
.container {
    display: grid;
    grid-template-columns: 240px 1fr; /* Fixed sidebar width / remaining content */
    gap: 40px;
    position: relative;
    height: 100%; /* Spans full wrapper height */
}

/* -------------------------------------------------- */
/* Left Sidebar: RED BOX - Completely Static          */
/* -------------------------------------------------- */
.sidebar {
    height: 100%;
    overflow: hidden; /* Ensures left column never scrolls under any action */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    z-index: 10;
}

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

/* Profile Header (Name Block) */
/* Height expanded to 170px to widen the gap between name and border line */
.profile-header {
    height: 170px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-bottom: 0;
    margin-bottom: 0;
}

.name {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.05;
    color: #f0f0f0; /* Bright off-white, close to pure white but softened */
    display: flex;
    flex-direction: column;
    white-space: nowrap; /* Prevents name wrapping under narrow widths */
}

.name-ko {
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Sidebar Roles segment - Border top and bottom */
/* Top border will perfectly align horizontally with Education top border */
.roles-container {
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0; /* Standardized gap set to 20px */
    margin-bottom: 0; /* Spacing handled by contact paddings */
}

.roles-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar .roles-list li {
    font-size: 0.8125rem; /* ~13px */
    color: #f0f0f0 !important; /* Bright off-white, close to pure white but softened */
    font-weight: 400;
}

/* Contact Info list - Individual border bottom on each row */
.contact-info {
    display: flex;
    flex-direction: column;
}

.contact-row {
    padding: 10px 0; /* Adjusted contact rows back to 10px padding */
    border-bottom: 1px solid var(--border-color);
}

.contact-link, .contact-text {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 400;
    display: block;
    width: 100%;
}

.contact-link:hover {
    color: var(--text-primary);
}

/* -------------------------------------------------- */
/* Right Main Content: BLUE BOX - Scrollable          */
/* -------------------------------------------------- */
.main-content {
    max-width: 820px;
    height: 100%;
    overflow-y: auto; /* Activates internal scrolling on right content only */
    padding-right: 0; /* Restored padding since scrollbar is hidden */
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;  /* Hide scrollbar on IE and Edge */
    scrollbar-width: none;  /* Hide scrollbar on Firefox */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.main-content::-webkit-scrollbar {
    display: none !important;
}

/* Content Header (Top aligned with Name Header) */
/* Height slightly reduced to 170px to match profile-header exactly */
.content-header {
    height: 170px;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    padding-top: 5px; /* Aligns indicator with Na Jae hwi baseline */
    padding-bottom: 0;
    margin-bottom: 0;
}

/* -------------------------------------------------- */
/* Details/Summary Dropdown Lang Selector             */
/* -------------------------------------------------- */
.lang-selector {
    position: relative;
    display: inline-block;
}

/* Visibility routing: Default shows Desktop selector and hides Mobile selector */
.lang-selector-desktop {
    display: inline-block !important;
}

.lang-selector-mobile {
    display: none !important;
}

.lang-indicator {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    letter-spacing: 0;
    user-select: none;
    list-style: none; /* Removes standard details triangle */
    outline: none;
}

/* Remove default details marker in Webkit browsers */
.lang-indicator::-webkit-details-marker {
    display: none !important;
}

.lang-indicator:hover {
    color: var(--text-primary);
}

/* Dropdown box positioning */
.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background-color: #0c0c0c; /* Deep studio black */
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    min-width: 70px;
    display: flex;
    flex-direction: column;
    padding: 4px 0;
    z-index: 100;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8);
}

.lang-dropdown a {
    display: block;
    padding: 6px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: center;
    transition: background-color 0.15s, color 0.15s;
}

.lang-dropdown a:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.lang-dropdown a.active {
    color: var(--text-primary);
    font-weight: 700;
}

/* -------------------------------------------------- */
/* CV Sections - Border Line BEFORE Title             */
/* -------------------------------------------------- */
/* First section's top border perfectly matches Roles top border */
.section {
    border-top: 1px solid var(--border-color); /* Line above section title */
    padding-top: 20px; /* Line to Title space standard set to 20px */
    margin-bottom: 45px; /* Space to next section line */
}

.section-title {
    font-size: 0.875rem; /* ~14px */
    font-weight: 600;
    text-transform: capitalize;
    color: var(--text-primary);
    margin-bottom: 14px; /* Space between title and row listings */
    border-bottom: none; /* No line below title */
    padding-bottom: 0;
}

.section-subtitle {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 8px;
}

.exhibition-block {
    margin-bottom: 20px;
}

.exhibition-block:last-child {
    margin-bottom: 0;
}

.exhibition-subtitle {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary); /* Soft white for exhibition subheadings */
    margin-bottom: 8px;
}

/* CV Layout Lists */
.grid-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.grid-row {
    display: grid;
    align-items: baseline;
    font-size: 0.8125rem; /* ~13px */
    padding: 1px 0;
    column-gap: 8px; /* Tighter gaps to keep layout elements close */
}

/* Precision grid column widths */

/* Education: Year (80px) | Degree (38px) | Details & Status (1fr) */
#education .grid-row {
    grid-template-columns: 80px 38px 1fr;
}

/* Employment & Lecture Summaries: Year (80px) | Institution (140px) | Role (1fr) */
#employment .grid-row,
#lecture-summary .grid-row,
#academic-lectures .grid-row,
#corporate-lectures .grid-row,
.exhibition-block .row-3col {
    grid-template-columns: 80px 140px 1fr;
}

/* Research Section: Year (80px) | Type (38px) | Title & Publisher (1fr) */
#research .grid-row {
    grid-template-columns: 80px 38px 1fr;
}

/* Awards & Stacking lists: Year (80px) | Info (1fr) */
.row-2col-exh {
    grid-template-columns: 80px 1fr;
}

/* Column cell colors */
.grid-row .col-1 {
    color: var(--text-secondary);
    font-weight: 400;
}

.grid-row .col-2 {
    color: var(--text-primary);
    font-weight: 500;
}

.grid-row .col-3 {
    color: var(--text-secondary);
}

/* Make school description white in education section */
#education .grid-row .col-3 {
    color: var(--text-primary) !important;
}

/* Make graduation status intermediate gray in education section */
#education .inline-meta {
    color: var(--text-secondary) !important;
}

/* Metadata tag styling */
.inline-meta {
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-left: 8px; /* Pulled close to the text */
    display: inline-block;
}

/* Footer elements */
.footer-nav {
    margin-top: 50px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.top-link {
    display: inline-block;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 600;
}

.top-link:hover {
    color: var(--text-primary);
}

/* -------------------------------------------------- */
/* Responsive Styles                                  */
/* -------------------------------------------------- */

/* Responsive Intermediate size (Tablets, small notebooks) */
@media (max-width: 900px) {
    .container {
        grid-template-columns: 200px 1fr;
        gap: 30px;
    }
    .wrapper {
        padding: 40px 24px;
    }
    
    /* Ensure the name text scales nicely and doesn't push the boundaries */
    .name {
        font-size: 1.55rem;
    }
    
    /* Strictly synchronize left and right column top boundaries at intermediate size */
    .profile-header, .content-header {
        height: 140px; /* Reduced proportionally, keeping them identical */
    }
}

/* Mobile size viewport (Mobile phones) */
@media (max-width: 768px) {
    /* Reset wrapper to auto layout and remove page scroll lock */
    .wrapper {
        padding: 0 16px 30px 16px; /* Top padding zeroed out to align with fixed header */
        height: auto;
        overflow: visible;
    }
    
    /* RESTORED: 1-column flow layout for mobile viewports */
    .container {
        grid-template-columns: 1fr;
        gap: 0; /* gap handled by margins and fixed paddings */
        height: auto;
        overflow: visible;
    }
    
    /* -------------------------------------------------- */
    /* Mobile Absolute Scroll Lock: Completely stationary */
    /* position: fixed; ensures name header never floats or moves at scroll start */
    /* -------------------------------------------------- */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: auto;
        overflow: visible;
        padding: 24px 16px 12px 16px; /* Retains name top spacing block permanently */
        background-color: var(--bg-color); /* Prevents scroll overlap bleeding */
        border-bottom: 1px solid var(--border-color); /* Visually separates sticky header */
        z-index: 100;
    }
    
    .profile-header {
        height: auto;
        padding-bottom: 12px;
    }
    
    .name {
        font-size: 1.6rem;
        white-space: nowrap;
    }
    
    .name-ko {
        font-size: 0.875rem;
        margin-top: 3px;
    }
    
    /* Responsive Language selector overrides for Mobile viewport */
    .lang-selector-desktop {
        display: none !important; /* Hide desktop version inside content-header */
    }
    
    .lang-selector-mobile {
        display: inline-block !important; /* Activate mobile-only fixed selector */
        position: absolute;
        top: 24px;
        right: 16px;
        z-index: 200;
    }
    
    /* RESTORED: Horizontal flex list layouts for compact screen fitting */
    .roles-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px 12px;
    }
    
    .roles-list li {
        font-size: 0.75rem;
    }
    
    /* RESTORED: Horizontal contact links */
    .contact-info {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0;
        border-bottom: none;
    }
    
    .contact-row {
        border-bottom: none;
        padding: 8px 16px 0 0;
    }
    
    .contact-link, .contact-text {
        font-size: 0.75rem;
    }
    
    /* Main Content offsets exactly matching the fixed sidebar height to prevent overlapping */
    .main-content {
        max-width: none;
        height: auto;
        overflow-y: visible;
        padding-right: 0;
        margin-top: 155px; /* Fits fixed header dimensions perfectly */
    }
    
    .content-header {
        height: auto;
        margin-bottom: 30px;
        padding-top: 10px;
    }
    
    .lang-indicator {
        font-size: 0.8125rem;
    }
    
    .section {
        margin-bottom: 30px;
    }
    
    /* Mobile Grid Optimizations: Prevents excessive wraps (kept intact) */
    .grid-row {
        display: grid;
        align-items: baseline;
        padding: 2px 0;
        column-gap: 6px;
    }
    
    /* Mobile column size overrides */
    #education .grid-row {
        grid-template-columns: 75px 38px 1fr;
    }
    
    #employment .grid-row,
    #lecture-summary .grid-row,
    #academic-lectures .grid-row,
    #corporate-lectures .grid-row,
    .exhibition-block .row-3col {
        grid-template-columns: 75px 120px 1fr;
    }
    
    #research .grid-row {
        grid-template-columns: 75px 38px 1fr;
    }
    
    .row-2col-exh {
        grid-template-columns: 75px 1fr;
    }
    
    .grid-row .col-1 {
        font-size: 0.8125rem;
        color: var(--text-secondary);
    }
    
    .grid-row .col-2 {
        font-size: 0.8125rem;
        font-weight: 500;
    }
    
    .grid-row .col-3 {
        font-size: 0.8125rem;
    }
}