/* ==========================================================================
   PORTFOLIO DESIGN SYSTEM
   Palette: Crimson Accents, Pure Black (Dark Theme), Pure White (Light Theme)
   ========================================================================== */

:root {
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Base Dimensions */
    --max-width: 860px;
    --header-height: 64px;
    --border-radius: 8px;
    --transition-speed: 0.25s;
}

/* --------------------------------------------------------------------------
   THEME DEFINITIONS
   -------------------------------------------------------------------------- */

/* Dark Mode (Black Background, White Normal Text, Crimson Highlights) */
[data-theme="dark"] {
    --bg-body: #000000;
    --bg-surface: #0a0a0d;
    --bg-surface-hover: #141419;
    --bg-card: rgba(12, 12, 16, 0.85);
    --border-color: #222228;
    --border-hover: #383842;
    
    /* Text: White Normal Text */
    --text-primary: #ffffff;
    --text-secondary: #f0f0f0;
    --text-muted: #a3a3a3;
    
    /* Highlights: Crimson */
    --accent-crimson: #ff2a55;
    --accent-crimson-hover: #ff4d73;
    --accent-crimson-dim: #dc143c;
    
    --tag-bg: rgba(255, 42, 85, 0.08);
    --tag-border: rgba(255, 42, 85, 0.25);
    --tag-text: #ff4d73;

    --header-bg: rgba(0, 0, 0, 0.85);
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    --avatar-shadow: 0 8px 30px rgba(0, 0, 0, 0.8);
}

/* Light Mode (White Background, Black Normal Text, Crimson Highlights) */
[data-theme="light"] {
    --bg-body: #ffffff;
    --bg-surface: #f9f9fa;
    --bg-surface-hover: #f1f1f3;
    --bg-card: rgba(249, 249, 250, 0.95);
    --border-color: #e5e5e8;
    --border-hover: #d1d1d6;
    
    /* Text: Black Normal Text */
    --text-primary: #000000;
    --text-secondary: #171717;
    --text-muted: #525252;
    
    /* Highlights: Crimson */
    --accent-crimson: #dc143c;
    --accent-crimson-hover: #be123c;
    --accent-crimson-dim: #9f1239;
    
    --tag-bg: rgba(220, 20, 60, 0.06);
    --tag-border: rgba(220, 20, 60, 0.2);
    --tag-text: #dc143c;

    --header-bg: rgba(255, 255, 255, 0.88);
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    --avatar-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* --------------------------------------------------------------------------
   RESET & BASE
   -------------------------------------------------------------------------- */

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 1.5rem);
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15.5px;
    line-height: 1.68;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

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

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

ul {
    list-style: none;
}

/* --------------------------------------------------------------------------
   TOP STICKY HEADER & NAVIGATION
   -------------------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background-color: var(--header-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.header-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Brand Link */
.brand-link {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.prompt-tilde {
    color: var(--accent-crimson);
    font-weight: 700;
}

.brand-link:hover .brand-name {
    color: var(--accent-crimson);
    text-decoration: underline;
}

/* Nav Menu */
.nav-list {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.nav-link {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: var(--text-muted);
    position: relative;
    padding: 0.25rem 0;
    transition: color 0.2s ease;
}

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

.nav-link.active {
    color: var(--accent-crimson);
    font-weight: 600;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent-crimson);
    border-radius: 1px;
}

.cv-pdf-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--accent-crimson);
}

.cv-pdf-link:hover {
    color: var(--accent-crimson-hover);
}

.external-icon {
    stroke-width: 2.2;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Dark/Light Mode Button */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.35rem 0.7rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    border-color: var(--accent-crimson);
    background: var(--bg-surface-hover);
    color: var(--accent-crimson);
}

[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: block; }

/* Mobile Menu Button */
.mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 34px;
    height: 34px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
}

.mobile-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    transition: all 0.3s ease;
}

/* --------------------------------------------------------------------------
   PAGE CONTENT & SECTIONS
   -------------------------------------------------------------------------- */

.page-content {
    padding-top: 3rem;
    padding-bottom: 5rem;
}

.section {
    margin-bottom: 4.5rem;
}

.section-header-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.section-title {
    font-family: var(--font-mono);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.terminal-arrow {
    color: var(--accent-crimson);
    margin-right: 0.3rem;
}

.section-intro {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* --------------------------------------------------------------------------
   HERO / ABOUT SECTION (2-Column Layout with Profile Picture)
   -------------------------------------------------------------------------- */

.hero-section {
    margin-bottom: 4rem;
}

.hero-intro-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2.5rem;
    margin-bottom: 2.2rem;
}

.hero-text-col {
    flex: 1;
    min-width: 0;
}

.hero-header {
    margin-bottom: 1.4rem;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.3rem 0.8rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.status-dot {
    width: 7px;
    height: 7px;
    background-color: var(--accent-crimson);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-crimson);
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1.15;
    margin-bottom: 0.35rem;
}

.hero-subtitle {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    color: var(--accent-crimson);
    font-weight: 500;
}

.hero-headline {
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 0.5rem;
    line-height: 1.35;
}

.bio-prose {
    font-size: 0.94rem;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-top: 0.6rem;
}

.bio-prose p {
    margin-bottom: 0.85rem;
}

.bio-prose p:last-child {
    margin-bottom: 0;
}

/* Avatar Column */
.hero-avatar-col {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    padding-top: 0.5rem;
}

.avatar-frame {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border-color);
    box-shadow: var(--avatar-shadow);
    background: var(--bg-surface);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-frame:hover {
    border-color: var(--accent-crimson);
    box-shadow: 0 10px 30px rgba(220, 20, 60, 0.3);
    transform: translateY(-2px);
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

/* What I work on Grid */
.subheading {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
}

.focus-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.focus-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.focus-card:hover {
    border-color: var(--accent-crimson);
    background: var(--bg-surface-hover);
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
}

.focus-card-title {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.focus-card-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* --------------------------------------------------------------------------
   WORK & PROJECTS
   -------------------------------------------------------------------------- */

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.15rem;
}

.project-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.project-card:hover {
    border-color: var(--accent-crimson);
    background: var(--bg-surface-hover);
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
}

.project-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.project-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
}

.project-badge {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--accent-crimson);
    background: var(--tag-bg);
    border: 1px solid var(--tag-border);
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    white-space: nowrap;
}

.project-year {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.project-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.tech-item {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    background: var(--tag-bg);
    border: 1px solid var(--tag-border);
    color: var(--tag-text);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.project-actions {
    display: flex;
    gap: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
}

.action-link {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--accent-crimson);
    font-weight: 600;
}

.action-link:hover {
    color: var(--accent-crimson-hover);
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   CV / SKILLS SECTION
   -------------------------------------------------------------------------- */

.cv-container {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.cv-block {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.cv-block-title {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.6rem;
    margin-bottom: 1.25rem;
}

.cv-entry {
    margin-bottom: 1.2rem;
}

.cv-entry:last-child {
    margin-bottom: 0;
}

.cv-entry-head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.cv-degree {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.cv-year {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.cv-institution {
    font-size: 0.88rem;
    color: var(--accent-crimson);
    font-family: var(--font-mono);
    margin-bottom: 0.25rem;
}

.cv-details {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.skills-category-group {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 3rem;
    row-gap: 0.75rem;
}

.skill-category {
    display: contents;
    line-height: 1.5;
}

.cat-name {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--accent-crimson);
    white-space: nowrap;
}

.cat-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.cat-item {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    border: 1px solid #4a4a52;
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
}

/* --------------------------------------------------------------------------
   CONTACT SECTION & FOOTER
   -------------------------------------------------------------------------- */

.contact-section {
    border-top: 1px solid var(--border-color);
    padding-top: 3.5rem;
    margin-bottom: 3.5rem;
}

.contact-title {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
}

.highlight-link {
    color: var(--accent-crimson);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.highlight-link:hover {
    color: var(--accent-crimson-hover);
}

.contact-desc {
    color: var(--text-secondary);
    font-size: 0.98rem;
    max-width: 580px;
    margin-bottom: 1.75rem;
    line-height: 1.65;
}

.contact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-bottom: 2rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--accent-crimson);
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.65rem 1.3rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: var(--accent-crimson-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(220, 20, 60, 0.4);
}

.btn-arrow-icon {
    transition: transform 0.2s ease;
}

.btn-primary:hover .btn-arrow-icon {
    transform: translateX(3px);
}

.social-links-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.88rem;
}

.social-link {
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.social-link:hover {
    color: var(--accent-crimson);
    text-decoration: underline;
}

.link-divider {
    color: var(--border-color);
}

/* Site Footer */
.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.8rem 0;
    background-color: var(--bg-body);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: color-mix(in srgb, var(--text-muted) 65%, black);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.back-to-top {
    color: var(--accent-crimson);
    font-weight: 600;
}

.back-to-top:hover {
    color: var(--accent-crimson-hover);
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   RESPONSIVE DESIGN
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
    .hero-intro-row {
        flex-direction: column-reverse;
        align-items: center;
        text-align: left;
        gap: 1.8rem;
    }

    .avatar-frame {
        width: 170px;
        height: 170px;
    }

    .focus-grid,
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .main-nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        width: 100%;
        background-color: var(--bg-body);
        border-bottom: 1px solid var(--border-color);
        padding: 1.25rem 1.5rem;
        display: none;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    }

    .main-nav.open {
        display: block;
    }

    .nav-list {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .mobile-toggle {
        display: flex;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .skills-category-group {
        grid-template-columns: 1fr;
        row-gap: 0.9rem;
    }

    .cat-name {
        display: block;
        margin-bottom: 0.2rem;
    }
}
