:root {
    --primary: #3b82f6;
    --primary-dim: rgba(59, 130, 246, 0.15);
    --sidebar-bg: #263238;
    --sidebar-text: #cfd8dc;
    --sidebar-text-dim: #90a4ae;
    --sidebar-text-bright: #ffffff;
    --sidebar-border: rgba(255,255,255,0.08);
    --sidebar-accent: #4fc3f7;
    --sidebar-accent-dim: rgba(79, 195, 247, 0.15);
    --bg: #0f1214;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --text: #e5e5e5;
    --text-dim: #888;
    --text-bright: #fff;
    --border: rgba(255, 255, 255, 0.08);
    --radius: 12px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --sidebar-width: 300px;
}

/* === LIGHT THEME === */
[data-theme="light"] {
    --bg: #f0f2f5;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f0f2;
    --text: #374151;
    --text-dim: #6b7280;
    --text-bright: #111827;
    --border: rgba(0, 0, 0, 0.1);
    --primary-dim: rgba(59, 130, 246, 0.1);
}

.theme-toggle-float {
    position: fixed; bottom: 1.25rem; right: 1.25rem; width: 40px; height: 40px;
    border-radius: 50%; background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-dim); cursor: pointer; display: flex; align-items: center;
    justify-content: center; z-index: 1000; transition: all 0.2s;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.theme-toggle-float:hover { color: var(--text-bright); transform: scale(1.1); }
@media print { .theme-toggle-float { display: none !important; } }

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* === MOBILE TOP NAV (hidden on desktop) === */
.top-nav {
    display: none;
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-border);
}
.top-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    height: 56px;
}
.nav-logo {
    font-weight: 700;
    font-size: 1rem;
    color: var(--sidebar-text-bright);
    text-decoration: none;
    letter-spacing: 0.02em;
}
.nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    gap: 0;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--sidebar-text);
    margin: 4px 0;
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}
.mobile-nav-links {
    display: none;
    flex-direction: column;
    background: var(--sidebar-bg);
    border-top: 1px solid var(--sidebar-border);
    padding: 0.75rem 0;
}
.mobile-nav-links.open { display: flex; }
.mobile-nav-link {
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    transition: color 0.2s, background 0.2s;
}
.mobile-nav-link:hover { color: var(--sidebar-text-bright); background: rgba(255,255,255,0.05); }

/* === CV LAYOUT === */
.cv-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

/* === SIDEBAR === */
.cv-sidebar {
    background: var(--sidebar-bg);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    border-right: 1px solid var(--sidebar-border);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.cv-sidebar::-webkit-scrollbar { width: 4px; }
.cv-sidebar::-webkit-scrollbar-track { background: transparent; }
.cv-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* Sidebar photo */
.sidebar-photo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}
.sidebar-photo {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--sidebar-accent);
    box-shadow: 0 0 0 6px rgba(79, 195, 247, 0.12);
}
.sidebar-photo-placeholder {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: 2px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sidebar-text-dim);
}

/* Sidebar identity */
.sidebar-identity {
    text-align: center;
    margin-bottom: 1.75rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--sidebar-text-bright);
    line-height: 1.3;
    margin-bottom: 0.375rem;
}
.sidebar-title {
    font-size: 0.8rem;
    color: var(--sidebar-accent);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Sidebar nav */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--sidebar-text-dim);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
}
.sidebar-nav-link:hover,
.sidebar-nav-link.active {
    color: var(--sidebar-text-bright);
    background: rgba(255,255,255,0.07);
}
.sidebar-nav-link.active { color: var(--sidebar-accent); }
.sidebar-nav-link svg { flex-shrink: 0; opacity: 0.7; }

/* Sidebar sections */
.sidebar-section {
    margin-bottom: 1.75rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-section:last-child { border-bottom: none; margin-bottom: 0; }
.sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sidebar-text-dim);
    margin-bottom: 1rem;
}

/* Sidebar contacts */
.sidebar-contact-item {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
    transition: color 0.2s;
    line-height: 1.4;
    word-break: break-all;
}
.sidebar-contact-item:last-child { margin-bottom: 0; }
.sidebar-contact-item:hover { color: var(--sidebar-text-bright); }
.sidebar-contact-item svg { color: var(--sidebar-accent); flex-shrink: 0; margin-top: 2px; }

/* Sidebar social */
.sidebar-social { display: flex; flex-direction: column; gap: 0.375rem; }
.sidebar-social-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--sidebar-text-dim);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.375rem 0.5rem;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}
.sidebar-social-link:hover { color: var(--sidebar-accent); background: rgba(255,255,255,0.05); }

/* Sidebar skills */
.sidebar-skill-group { margin-bottom: 1.25rem; }
.sidebar-skill-group:last-child { margin-bottom: 0; }
.sidebar-skill-cat {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--sidebar-accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.75rem;
}
.sidebar-skill-item { margin-bottom: 0.875rem; }
.sidebar-skill-item:last-child { margin-bottom: 0; }
.sidebar-skill-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.375rem;
}
.sidebar-skill-name { font-size: 0.8rem; font-weight: 500; color: var(--sidebar-text); }
.sidebar-skill-pct { font-size: 0.72rem; color: var(--sidebar-text-dim); }
.sidebar-skill-bar {
    height: 5px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
}
.sidebar-skill-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sidebar-accent), #81d4fa);
    border-radius: 3px;
    width: 0;
    transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Sidebar languages */
.sidebar-lang-item { margin-bottom: 1rem; }
.sidebar-lang-item:last-child { margin-bottom: 0; }
.sidebar-lang-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.375rem;
}
.sidebar-lang-name { font-size: 0.82rem; font-weight: 600; color: var(--sidebar-text); }
.sidebar-lang-level { font-size: 0.72rem; color: var(--sidebar-accent); font-weight: 500; }

/* === MAIN CONTENT === */
.cv-main {
    min-height: 100vh;
    background: var(--bg);
}

.main-section {
    padding: 3.5rem 3rem;
    border-bottom: 1px solid var(--border);
}
.main-section:last-child { border-bottom: none; }

/* Main hero */
.main-hero-section {
    background: linear-gradient(135deg, rgba(38, 50, 56, 0.3) 0%, transparent 60%);
    padding-top: 4.5rem;
}
.main-hero { max-width: 680px; }
.main-hero-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sidebar-accent);
    background: rgba(79, 195, 247, 0.12);
    padding: 0.3rem 0.875rem;
    border-radius: 50px;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(79, 195, 247, 0.2);
}
.main-hero-name {
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    font-weight: 800;
    color: var(--text-bright);
    line-height: 1.15;
    margin-bottom: 0.5rem;
}
.main-hero-role {
    font-size: 1.05rem;
    color: var(--sidebar-accent);
    font-weight: 500;
    margin-bottom: 1.25rem;
}
.main-hero-bio, .main-hero-about {
    font-size: 1rem;
    color: var(--text-dim);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}
.main-stats { display: flex; gap: 2.5rem; }
.main-stat { display: flex; flex-direction: column; }
.main-stat-number { font-size: 2rem; font-weight: 800; color: var(--sidebar-accent); line-height: 1; }
.main-stat-label { font-size: 0.78rem; color: var(--text-dim); margin-top: 0.375rem; }

/* Main section titles */
.main-section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 2rem;
    padding-bottom: 0.875rem;
    border-bottom: 2px solid var(--border);
}
.main-section-title svg { color: var(--sidebar-accent); flex-shrink: 0; }

/* === TIMELINE === */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 2rem; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-dot {
    position: absolute;
    left: -2rem;
    top: 8px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--text-dim);
    z-index: 1;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.timeline-dot.active {
    border-color: var(--sidebar-accent);
    box-shadow: 0 0 0 4px rgba(79, 195, 247, 0.15);
}
.timeline-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.375rem 1.5rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.timeline-content:hover {
    border-color: rgba(79, 195, 247, 0.2);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.timeline-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.375rem; flex-wrap: wrap; }
.timeline-role { font-size: 1.05rem; font-weight: 600; color: var(--text-bright); }
.timeline-date { font-size: 0.78rem; color: var(--sidebar-accent); font-weight: 500; white-space: nowrap; }
.timeline-company { font-size: 0.9rem; color: var(--text-dim); margin-bottom: 0.625rem; font-weight: 500; }
.timeline-desc { font-size: 0.875rem; color: var(--text-dim); line-height: 1.7; }

/* === PROJECTS === */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}
.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.project-card:hover {
    transform: translateY(-4px);
    border-color: rgba(79, 195, 247, 0.25);
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.project-image { aspect-ratio: 16 / 10; overflow: hidden; }
.project-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.project-card:hover .project-image img { transform: scale(1.05); }
.project-info { padding: 1.25rem; }
.project-title { font-size: 1rem; font-weight: 600; color: var(--text-bright); margin-bottom: 0.5rem; }
.project-title a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 0.375rem; }
.project-title a:hover { color: var(--sidebar-accent); }
.project-title svg { opacity: 0.5; }
.project-desc { font-size: 0.85rem; color: var(--text-dim); line-height: 1.6; margin-bottom: 0.875rem; }
.project-tags { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.tag {
    font-size: 0.68rem;
    font-weight: 500;
    padding: 0.2rem 0.55rem;
    border-radius: 50px;
    background: rgba(79, 195, 247, 0.1);
    color: var(--sidebar-accent);
    border: 1px solid rgba(79, 195, 247, 0.2);
}

/* === CONTACT === */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.125rem 1.375rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
a.contact-item:hover { border-color: var(--sidebar-accent); box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.contact-item svg { color: var(--sidebar-accent); flex-shrink: 0; }
.contact-label { display: block; font-size: 0.72rem; color: var(--text-dim); margin-bottom: 0.125rem; }
.contact-value { display: block; font-size: 0.9rem; font-weight: 500; color: var(--text-bright); word-break: break-all; }

/* === ANIMATIONS === */
.fade-in {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.75rem 1.75rem; border-radius: 50px;
    font-size: 0.9rem; font-weight: 600; text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s; cursor: pointer; border: none;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 15px rgba(59,130,246,0.3); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }

/* === RESPONSIVE — MOBILE === */
@media (max-width: 860px) {
    .cv-layout { grid-template-columns: 1fr; }
    .cv-sidebar { display: none; }
    .top-nav { display: block; }
    .main-section { padding: 2.5rem 1.5rem; }
    .main-section-title { font-size: 1.15rem; }
    .main-hero-section { padding-top: 2.5rem; }
    .timeline { padding-left: 1.5rem; }
    .timeline-dot { left: -1.5rem; }
    .timeline-header { flex-direction: column; gap: 0.25rem; }
    .projects-grid { grid-template-columns: 1fr; }
    .contact-grid { grid-template-columns: 1fr; }
    .main-stats { gap: 1.5rem; }
}

/* === PRINT === */
@media print {
    .cv-sidebar { position: relative; height: auto; width: 240px; }
    .top-nav { display: none !important; }
    .theme-toggle-float { display: none !important; }
    .cv-layout { grid-template-columns: 240px 1fr; }
    .fade-in { opacity: 1 !important; transform: none !important; }
    .sidebar-skill-fill { width: var(--level) !important; }
    * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
