* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Hide scrollbars */
::-webkit-scrollbar {
    display: none;
}

html {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    z-index: 9999;
    animation: fadeOut 0.6s ease-out forwards;
    animation-delay: 0.8s;
}

.loading-overlay.hidden {
    pointer-events: none;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

:root {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --text-primary: #000000;
    --text-secondary: #333333;
    --border-color: #e5e5e7;
    --accent-color: #0071e3;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.15);
    --bg-primary-rgb: 245, 245, 247;
}

body.dark-mode {
    --bg-primary: #1d1d1f;
    --bg-secondary: #2a2a2e;
    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --border-color: #424245;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.5);
    --bg-primary-rgb: 29, 29, 31;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-primary);
    background-image: url('../img/bg.webp');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    color: var(--text-primary);
    line-height: 1.6;
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
}

body.dark-mode {
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('../img/bg.webp');
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    background: rgba(var(--bg-primary-rgb), 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    margin: 0 calc(-50vw + 50%);
    padding: 0 calc(50vw - 50%);
}

:root {
    --bg-primary-rgb: 245, 245, 247;
}

body.dark-mode {
    --bg-primary-rgb: 29, 29, 31;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.nav-links {
    display: flex;
    gap: 40px;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--text-primary);
}

/* Dark Mode Toggle Button */
.dark-mode-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background-color 0.3s ease;
    color: var(--text-primary);
    padding: 0;
    position: relative;
}

.dark-mode-toggle:hover {
    background-color: var(--border-color);
}

.dark-mode-toggle svg {
    width: 20px;
    height: 20px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.sun-icon {
    opacity: 1;
    transform: rotate(0deg);
}

.moon-icon {
    position: absolute;
    opacity: 0;
    transform: rotate(-180deg);
}

body.dark-mode .sun-icon {
    opacity: 0;
    transform: rotate(180deg);
}

body.dark-mode .moon-icon {
    opacity: 1;
    transform: rotate(0deg);
}

/* Hero Section */
.hero {
    padding: 80px 0;
    text-align: center;
}

.hero-content h2 {
    font-size: 48px;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
    line-height: 1.2;
}

.hero-content p {
    font-size: 18px;
    color: var(--text-secondary);
}

/* Grid Container */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 40px;
    margin-bottom: 80px;
}

/* Block Styles */
.block {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

body.dark-mode .block {
    background: rgba(0, 0, 0, 0.5);
}

.block:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.block-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

/* Block Sizes */
.block-large {
    grid-column: span 2;
    min-height: 360px;
}

@media (max-width: 768px) {
    .block-large {
        grid-column: span 1;
    }
}

/* About Block */
.block-about h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
}

.block-about p {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.8;
    margin-bottom: 24px;
}

.block-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.3s ease;
    width: fit-content;
}

.block-link:hover {
    transform: translateX(4px);
}

/* Skills Blocks */
.block-skills h4 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

.skill-list {
    list-style: none;
}

.skill-list li {
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    transition: color 0.3s ease;
    margin-bottom: 21px;
}

.block-skills:hover .skill-list li {
    color: var(--accent-color);
}

/* Projects Info Block */
.block-projects-info h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
}

.block-projects-info p {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.8;
}

/* Project Blocks */
.block-project {
    position: relative;
    overflow: hidden;
}

.block-project::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 113, 227, 0) 0%, rgba(0, 113, 227, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.block-project:hover::before {
    opacity: 1;
}

.project-icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.project-logo {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    margin-bottom: 16px;
    object-fit: cover;
}

.block-project h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
}

.project-desc {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 16px;
}

.project-tag {
    display: inline-block;
    background: var(--bg-primary);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.project-link {
    text-decoration: none;
    color: var(--accent-color);
    background: transparent;
    padding: 0;
    pointer-events: auto;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.project-link:hover {
    transform: translateX(4px);
}

.block-project:hover .project-tag:not(.project-link) {
    background: var(--accent-color);
    color: white;
}

/* Stats Block */
.block-stats {
    display: flex;
    gap: 40px;
}

.stat {
    flex: 1;
}

.stat h3 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat p {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

/* Contact Block */
.block-contact h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}

.block-contact p {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 24px;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    width: fit-content;
}

.contact-link:hover {
    transform: translateX(4px);
}

/* Footer */
.footer {
    background: rgba(var(--bg-primary-rgb), 0.8);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    margin: 0 calc(-50vw + 50%);
    padding: 40px calc(50vw - 50%);
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .grid-container {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 16px;
    }

    .block {
        padding: 32px;
        min-height: 240px;
    }

    .hero-content h2 {
        font-size: 36px;
    }

    .nav-links {
        gap: 24px;
    }
}

@media (max-width: 640px) {
    .header-content {
        padding: 12px 16px;
    }

    .logo {
        font-size: 18px;
    }

    .nav-links {
        gap: 16px;
        font-size: 13px;
    }

    .grid-container {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 60px;
    }

    .block {
        padding: 24px;
        min-height: 200px;
    }

    .block-large {
        grid-column: span 1;
        min-height: 240px;
    }

    .hero {
        padding: 60px 0;
    }

    .hero-content h2 {
        font-size: 28px;
        margin-bottom: 12px;
    }

    .hero-content p {
        font-size: 16px;
    }

    .block-about h3 {
        font-size: 20px;
    }

    .block-stats {
        flex-direction: column;
        gap: 20px;
    }

    .stat h3 {
        font-size: 28px;
    }

    .footer {
        padding: 30px 0;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.block {
    animation: fadeInUp 0.6s ease-out forwards;
}

.block:nth-child(1) { animation-delay: 0.1s; }
.block:nth-child(2) { animation-delay: 0.2s; }
.block:nth-child(3) { animation-delay: 0.3s; }
.block:nth-child(4) { animation-delay: 0.4s; }
.block:nth-child(5) { animation-delay: 0.5s; }
.block:nth-child(6) { animation-delay: 0.6s; }
.block:nth-child(7) { animation-delay: 0.7s; }
