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

html {
    scroll-behavior: smooth;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.page-wrapper {
    --bg: #0a0a0a;
    --bg-elevated: #111111;
    --text: #f5f5f5;
    --text-muted: #a3a3a3;
    --text-faint: #525252;
    --accent: #facc15;
    --accent-hover: #fde047;
    --border: #262626;
    --border-hover: #404040;
    --font-display: "Space Grotesk", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", monospace;

    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-display);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

html[data-theme="dark"] .page-wrapper {
    --bg: #0a0a0a;
    --bg-elevated: #111111;
    --text: #f5f5f5;
    --text-muted: #a3a3a3;
    --text-faint: #525252;
    --accent: #facc15;
    --accent-hover: #fde047;
    --border: #262626;
    --border-hover: #404040;
}

@media (prefers-color-scheme: light) {
    .page-wrapper {
        --bg: #f5f0e6;
        --bg-elevated: #faf6f0;
        --text: #171717;
        --text-muted: #525252;
        --text-faint: #a3a3a3;
        --accent: #dc2626;
        --accent-hover: #b91c1c;
        --border: #e5e5e5;
        --border-hover: #d4d4d4;
    }
}

html[data-theme="light"] .page-wrapper {
    --bg: #f5f0e6;
    --bg-elevated: #faf6f0;
    --text: #171717;
    --text-muted: #525252;
    --text-faint: #a3a3a3;
    --accent: #dc2626;
    --accent-hover: #b91c1c;
    --border: #e5e5e5;
    --border-hover: #d4d4d4;
}

/* ─── THEME TOGGLE ─── */
.theme-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 200;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.theme-toggle:hover {
    color: var(--accent);
    transform: scale(1.05);
}

.theme-toggle svg {
    position: absolute;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

html[data-theme="dark"] .theme-icon-moon,
html[data-theme="light"] .theme-icon-sun {
    opacity: 0;
    transform: scale(0.8);
}

html[data-theme="dark"] .theme-icon-sun,
html[data-theme="light"] .theme-icon-moon {
    opacity: 1;
    transform: scale(1);
}

/* ─── CONTAINER ─── */
.container {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 2rem 4rem;
    display: flex;
    flex-direction: column;
}

/* ─── HEADER ─── */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.logo {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 0.4rem 0.7rem;
    display: inline-block;
    transition: all 0.25s ease;
    line-height: 1;
}

.logo-link:hover .logo {
    background: var(--accent);
    color: var(--bg);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    flex-wrap: wrap;
}

.header-nav a {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.25s ease;
    line-height: 1;
}

.header-nav a:hover,
.header-nav a.active {
    color: var(--accent);
}

/* ─── PAGE HERO ─── */
.page-hero {
    margin-bottom: 3.5rem;
}

.section-num {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 0.75rem;
}

.page-title {
    font-size: clamp(2.5rem, 7vw, 4rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--text);
    word-break: break-word;
}

/* ─── ABOUT GRID ─── */
.about-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    margin-bottom: 4rem;
}

.about-block {
    padding: 1.5rem 0;
    border-top: 1px solid var(--border);
}

.block-title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1rem;
}

.block-text {
    font-size: clamp(1rem, 2vw, 1.15rem);
    line-height: 1.7;
    color: var(--text-muted);
    max-width: 600px;
    text-align: justify;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    hyphens: auto;
}

/* ─── EDU ─── */
.edu-item {
    margin-top: 0.5rem;
}

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

.edu-degree {
    font-size: clamp(1rem, 2vw, 1.15rem);
    font-weight: 500;
    color: var(--text);
}

.edu-year {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    letter-spacing: 0.05em;
}

.edu-school {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* ─── SKILLS ─── */
.skills-section {
    margin-bottom: 2rem;
}

.skills-header {
    margin-bottom: 2.5rem;
}

.skill-group {
    padding: 1.5rem 0;
    border-top: 1px solid var(--border);
}

.skill-cat {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1.25rem;
}

.skill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.skill-list span {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    transition: all 0.25s ease;
}

.skill-list span:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

/* ─── FOOTER ─── */
.footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer p {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-faint);
    letter-spacing: 0.05em;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 640px) {
    .container {
        padding: 1.5rem 1.25rem 3rem;
    }

    .site-header {
        margin-bottom: 3rem;
        padding-bottom: 1rem;
    }

    .header-nav {
        gap: 1rem;
    }

    .header-nav a {
        font-size: 0.75rem;
    }

    .page-hero {
        margin-bottom: 2.5rem;
    }

    .about-grid {
        gap: 2rem;
        margin-bottom: 3rem;
    }

    .block-text {
        text-align: left;
        -webkit-hyphens: none;
        -moz-hyphens: none;
        hyphens: none;
    }

    .edu-header-row {
        flex-direction: column;
        gap: 0.25rem;
    }

    .skill-list span {
        font-size: 0.75rem;
        padding: 0.35rem 0.7rem;
    }
}

@media (max-width: 480px) {
    .header-nav {
        gap: 0.75rem;
    }

    .header-nav a {
        font-size: 0.7rem;
    }

    .page-title {
        font-size: 2rem;
    }

    .theme-toggle {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
}