:root {
    --bg: #050505;
    --text: #f5f5f5;
    --muted: #a7a7ac;
    --soft: #d8d8dc;
    --line: rgba(255, 255, 255, 0.16);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -3;
    background:
        radial-gradient(circle at 78% 30%, rgba(40, 72, 120, 0.18), transparent 31rem),
        radial-gradient(circle at 18% 82%, rgba(14, 46, 38, 0.22), transparent 34rem),
        linear-gradient(135deg, #020304 0%, #07090c 48%, #020304 100%);
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(rgba(180, 255, 220, 0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(180, 255, 220, 0.022) 1px, transparent 1px);
    background-size: 58px 58px;
    mask-image: radial-gradient(circle at center, black 0%, transparent 78%);
}

#ambient-canvas {
    position: fixed;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

a {
    color: inherit;
    text-decoration: none;
}

.shell {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.section-wide {
    width: 100%;
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(5, 5, 5, 0.62);
    backdrop-filter: blur(18px);
    overflow: visible;
    transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.site-header::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0;
    background:
        radial-gradient(circle at var(--nav-x, 50%) 50%, rgba(255, 255, 255, 0.24), transparent 15rem),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03), rgba(120, 140, 255, 0.18), rgba(255, 255, 255, 0.03));
    transition: opacity 0.22s ease;
}

.site-header:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(12, 13, 20, 0.78);
    box-shadow: 0 18px 70px rgba(40, 60, 150, 0.2);
}

.site-header:hover::before {
    opacity: 1;
}

.nav {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    font-size: 15px;
    font-weight: 700;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-menu {
    position: relative;
    padding: 24px 0;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.nav-trigger {
    appearance: none;
    background: transparent;
    cursor: default;
    font-family: inherit;
}

.nav-menu:hover .nav-link,
.nav-link:hover {
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 0 0 34px rgba(120, 140, 255, 0.24);
    color: var(--text);
}

.dropdown {
    position: absolute;
    top: calc(100% - 10px);
    right: 0;
    min-width: 230px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(7, 8, 12, 0.92);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48), 0 0 42px rgba(120, 140, 255, 0.14);
    backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.nav-menu:hover .dropdown,
.nav-menu:focus-within .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown a {
    display: block;
    padding: 12px 13px;
    border-radius: 4px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

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

.hero {
    min-height: calc(100vh - 79px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: center;
    gap: 86px;
    padding: 70px 0 96px;
}

h1 {
    margin: 0;
    font-size: clamp(58px, 8vw, 118px);
    line-height: 0.95;
    font-weight: 700;
    letter-spacing: 0;
}

.lead {
    max-width: 760px;
    margin: 28px 0 0;
    color: var(--soft);
    font-size: clamp(20px, 2.2vw, 28px);
    line-height: 1.45;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 34px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 22px;
    border-radius: 4px;
    border: 1px solid var(--line);
    font-weight: 700;
    font-size: 14px;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.button:hover {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg);
}

.contact {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 28px;
    color: var(--muted);
    font-size: 15px;
}

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

.contact a {
    overflow-wrap: anywhere;
}

.portrait-wrap {
    border: 1px solid var(--line);
    background: #111;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

.portrait {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
}

.work-experience {
    position: relative;
    min-height: 150px;
    padding: 0;
}

.work-inner {
    display: block;
    padding: 52px 0;
}

.work-experience h2 {
    margin: 0;
    font-size: clamp(24px, 3vw, 38px);
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0;
}

.experience-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 68px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.04);
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.experience-card:hover {
    border-color: rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.075);
    transform: translateY(-2px);
}

.experience-panel {
    margin-top: 24px;
    padding: 24px;
    border: 1px solid var(--line);
    background: rgba(5, 5, 5, 0.58);
    backdrop-filter: blur(16px);
}

.experience-company {
    display: flex;
    align-items: center;
    gap: 14px;
}

.experience-company img {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.company-name {
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
}

.experience-card > span {
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
}

.knowledge {
    padding: 86px 0 90px;
}

.knowledge h2 {
    margin: 0 0 24px;
    font-size: clamp(24px, 3vw, 38px);
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0;
}

.knowledge-sections {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
    gap: 18px;
    align-items: start;
}

.knowledge-block {
    scroll-margin-top: 110px;
    padding: 26px;
    border: 1px solid var(--line);
    background: rgba(5, 5, 5, 0.58);
    backdrop-filter: blur(16px);
}

.knowledge-head {
    margin-bottom: 18px;
}

.knowledge-head h3 {
    margin: 0 0 16px;
    color: var(--soft);
    font-size: 24px;
    font-weight: 700;
}

.skill-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.skill-grid.programming {
    grid-template-columns: 1fr;
}

.skill-grid span {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    column-gap: 14px;
    align-items: center;
    min-height: 68px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.04);
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.skill-grid span:hover {
    border-color: rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.075);
    transform: translateY(-2px);
}

.skill-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.skill-grid strong {
    display: block;
    margin-bottom: 3px;
    color: var(--text);
    font-size: 16px;
    line-height: 1.22;
}

@media (max-width: 820px) {
    .shell {
        width: min(100% - 32px, 1180px);
    }

    .nav {
        min-height: auto;
        gap: 12px;
        align-items: center;
        flex-direction: column;
        padding: 18px 0;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        gap: 8px;
    }

    .nav-menu {
        padding: 0;
    }

    .nav-link {
        min-height: 36px;
        padding: 0 10px;
        font-size: 13px;
        white-space: nowrap;
    }

    .dropdown {
        display: none;
    }

    .hero {
        min-height: auto;
        grid-template-columns: 1fr;
        gap: 38px;
        padding: 44px 0 64px;
    }

    .portrait-wrap {
        width: min(280px, 100%);
        justify-self: center;
        margin-inline: auto;
    }

    h1 {
        font-size: clamp(52px, 16vw, 76px);
    }

    .lead {
        margin-top: 20px;
        font-size: 22px;
    }

    .actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
    }

    .button {
        min-width: 0;
        padding: 0 12px;
    }

    .contact {
        width: 100%;
        gap: 10px 18px;
        font-size: 14px;
        justify-content: center;
        text-align: center;
    }

    .contact a {
        display: inline-block;
    }

    .work-inner {
        padding: 54px 0 60px;
    }

    .experience-panel,
    .knowledge-block {
        padding: 18px;
    }

    .knowledge {
        padding-top: 60px;
        padding-bottom: 60px;
    }

    .experience-card {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .knowledge-sections,
    .skill-grid,
    .skill-grid.programming {
        grid-template-columns: 1fr;
    }

    .knowledge-block {
        scroll-margin-top: 96px;
    }
}

@media (max-width: 520px) {
    .shell {
        width: min(100% - 24px, 1180px);
    }

    .site-header {
        position: sticky;
    }

    .brand {
        font-size: 14px;
    }

    .nav-links {
        justify-content: space-between;
    }

    .nav-link {
        padding: 0 8px;
        font-size: 12px;
    }

    .hero {
        padding-top: 34px;
    }

    h1 {
        font-size: clamp(46px, 18vw, 64px);
    }

    .lead {
        font-size: 20px;
    }

    .actions {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .button,
    .contact {
        width: 100%;
    }

    .contact {
        flex-direction: column;
        align-items: center;
    }

    .portrait-wrap {
        width: min(240px, 100%);
        margin-inline: auto;
    }

    .work-experience h2,
    .knowledge h2 {
        font-size: 34px;
    }

    .experience-card {
        padding: 14px;
    }

    .experience-company {
        gap: 12px;
    }

    .experience-card > span,
    .company-name {
        font-size: 15px;
    }

    .knowledge-head h3 {
        font-size: 22px;
    }

    .skill-grid span {
        grid-template-columns: 38px minmax(0, 1fr);
        min-height: 64px;
        padding: 14px;
    }

    .skill-logo {
        width: 30px;
        height: 30px;
    }

    .skill-grid strong {
        font-size: 15px;
    }
}
