:root {
    --bg: #070b14;
    --bg-soft: #080d18;
    --card: #0d1424;
    --card-2: #10192c;
    --text: #f4f7fb;
    --muted: #93a0b8;
    --line: rgba(255, 255, 255, 0.08);
    --header: rgba(7, 11, 20, 0.92);
    --orange: #ff8a1d;
    --orange-2: #f97316;
    --blue: #3b82f6;
    --blue-2: #60a5fa;
    --quote: #6aa7ff;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    --font: "Inter", "Segoe UI", sans-serif;
    --display: "Outfit", "Inter", sans-serif;
    --radius: 16px;
    color-scheme: dark;
}

[data-theme="light"] {
    --bg: #f4f7fb;
    --bg-soft: #e9eef6;
    --card: #ffffff;
    --card-2: #f8fafc;
    --text: #101828;
    --muted: #536278;
    --line: rgba(16, 24, 40, 0.1);
    --header: rgba(255, 255, 255, 0.92);
    --quote: #1d4ed8;
    --shadow: 0 16px 34px rgba(16, 24, 40, 0.08);
    color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    background:
        radial-gradient(900px 420px at 12% 0%, rgba(37, 99, 235, 0.16), transparent 60%),
        var(--bg);
    color: var(--text);
    line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
::selection { background: rgba(59, 130, 246, 0.35); }

.skip-link {
    position: absolute;
    left: 16px;
    top: -40px;
    background: var(--orange);
    color: #1a0d00;
    padding: 8px 12px;
    border-radius: 8px;
    z-index: 100;
}
.skip-link:focus { top: 12px; }

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

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--header);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid transparent;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner {
    min-height: 78px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-family: var(--display);
    font-weight: 800;
    letter-spacing: -0.04em;
    background: linear-gradient(180deg, #1a2744, #0d1528);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.08);
}
[data-theme="light"] .brand-mark {
    background: #101828;
    color: #fff;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-family: var(--display); font-size: 15px; letter-spacing: -0.02em; }
.brand-text small {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav { display: flex; align-items: center; gap: 26px; }
.nav a {
    position: relative;
    color: var(--muted);
    font-size: 14.5px;
    font-weight: 500;
    padding: 8px 0;
}
.nav a:hover, .nav a.active { color: var(--text); }
.nav a.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    border-radius: 99px;
    background: var(--orange);
}
.header-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.nav-toggle { display: none; }
.nav .nav-cv { display: none; }
.nav-toggle {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: transparent;
    padding: 0;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
}
.nav-toggle span {
    display: block;
    width: 16px;
    height: 1.5px;
    background: var(--text);
    transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.theme-switch {
    width: 68px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px;
    cursor: pointer;
}
.theme-opt {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--muted);
}
.theme-opt.is-active {
    background: #121a2e;
    color: var(--text);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
}
[data-theme="light"] .theme-opt.is-active { background: #fff; color: #101828; box-shadow: 0 2px 8px rgba(16, 24, 40, 0.08); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 12px;
    padding: 12px 18px;
    border: 1px solid transparent;
    font-weight: 700;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: transform .18s ease, filter .18s ease, border-color .18s ease, background .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
    background: linear-gradient(180deg, #ff9d33, var(--orange-2));
    color: #2a1200;
    box-shadow: 0 8px 22px rgba(249, 115, 22, 0.28);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost {
    background: rgba(6, 10, 20, 0.45);
    border-color: rgba(255, 255, 255, 0.14);
    color: var(--text);
}
[data-theme="light"] .btn-ghost { background: #fff; border-color: rgba(16, 24, 40, 0.12); }
.btn-ghost:hover { border-color: rgba(255, 255, 255, 0.32); }
.btn-cv {
    border-radius: 999px;
    padding: 9px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 138, 29, 0.75);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}
[data-theme="light"] .btn-cv { background: #fff; }
.btn-cv:hover { background: rgba(255, 138, 29, 0.1); }

.hero {
    position: relative;
    min-height: 640px;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 42px 0 56px;
}
.hero-copy { position: relative; z-index: 2; max-width: 640px; }
.eyebrow {
    color: var(--orange);
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 12px;
}
.eyebrow span { margin-right: 6px; }
.hero-title {
    font-family: var(--display);
    font-size: clamp(52px, 6vw, 78px);
    line-height: 0.95;
    letter-spacing: -0.045em;
    font-weight: 800;
}
.name-accent { color: #3d7eff; }
.hero-role {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-top: 18px;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.role-pipe { color: var(--orange); font-weight: 500; margin: 0 4px; }
.hero-text {
    max-width: 560px;
    margin-top: 18px;
    color: var(--muted);
    font-size: 15.5px;
    line-height: 1.75;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-media {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(54vw, 820px);
    z-index: 1;
}
.hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center right;
}
.hero-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 72%, transparent) 24%, color-mix(in srgb, var(--bg) 18%, transparent) 58%, transparent 100%);
    pointer-events: none;
}
.hero-copy > * { animation: fadeUp .7s ease both; }
.hero-copy > *:nth-child(2) { animation-delay: .05s; }
.hero-copy > *:nth-child(3) { animation-delay: .1s; }
.hero-copy > *:nth-child(4) { animation-delay: .15s; }
.hero-copy > *:nth-child(5) { animation-delay: .2s; }

.specialties {
    position: relative;
    z-index: 2;
    background: color-mix(in srgb, var(--bg-soft) 88%, transparent);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.specialties-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.specialty {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 92px;
    padding: 16px 18px;
}
.specialty:not(:last-child) { border-right: 1px solid var(--line); }
.spec-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
}
.spec-icon.accent-blue { color: #60a5fa; }
.spec-icon.accent-orange { color: #fb923c; }
.specialty h3 { font-size: 14px; font-weight: 700; letter-spacing: -0.02em; }
.specialty p { color: var(--muted); font-size: 12.5px; line-height: 1.35; }

.about-skills { padding: 88px 0 36px; }
.about-skills-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr);
    gap: 54px;
    align-items: start;
}
.about-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 210px;
    gap: 22px;
}
.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--display);
    font-size: 28px;
    letter-spacing: -0.03em;
    margin-bottom: 18px;
}
.section-title i {
    width: 22px;
    height: 3px;
    border-radius: 99px;
    background: var(--orange);
    display: block;
}
.about-copy p { color: var(--muted); margin-bottom: 14px; font-size: 15px; }
.quote {
    color: var(--quote);
    font-style: italic;
    font-family: var(--display);
    font-size: 18px;
    line-height: 1.45;
    margin-top: 8px;
}
.facts { display: flex; flex-direction: column; gap: 16px; padding-top: 46px; }
.about-photo {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(61, 126, 255, 0.45);
    margin-bottom: 4px;
}
.fact { display: flex; gap: 10px; align-items: flex-start; color: var(--text); }
.fact .icon { color: var(--blue-2); margin-top: 2px; flex: 0 0 auto; }
.fact strong { display: block; font-size: 14px; font-weight: 600; }
.fact small {
    display: -webkit-box;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}
.skill-card {
    min-height: 104px;
    border-radius: 16px;
    background: var(--card);
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    padding: 12px 8px;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.skill-card:hover {
    transform: translateY(-3px);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: var(--shadow);
}
.skill-card span, .skill-card strong {
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.brand-icon { width: 36px; height: 36px; object-fit: contain; }
.skills-grid .is-extra { display: none; }
.skills-grid.is-open .is-extra { display: flex; }
.skill-more {
    background: transparent;
    color: var(--text);
    cursor: pointer;
    border-style: dashed;
}
.more-plus {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    color: var(--muted);
}

.projects { padding: 36px 0 80px; }
.projects-head, .section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}
.link-more { color: var(--blue-2); font-weight: 600; font-size: 14px; }
.link-more:hover { color: var(--text); }
.projects-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
}
.project-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    min-width: 0;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.project-card:hover {
    transform: translateY(-4px);
    border-color: rgba(96, 165, 250, 0.35);
    box-shadow: var(--shadow);
}
.project-link { display: block; height: 100%; }
.project-cover { position: relative; height: 132px; overflow: hidden; background: #10192c; }
.project-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .45s ease;
}
.project-card:hover .project-cover img { transform: scale(1.06); }
.cover-fallback {
    display: grid;
    place-items: center;
    height: 100%;
    font-family: var(--display);
    font-size: 28px;
    color: var(--blue-2);
    background: radial-gradient(circle at 30% 20%, rgba(59, 130, 246, 0.35), transparent 55%), #10192c;
}
.project-go {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(7, 11, 20, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #fff;
}
.project-body { padding: 14px 14px 16px; }
.project-body h3 { font-size: 15px; letter-spacing: -0.02em; margin-bottom: 6px; }
.project-body p {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.45;
    min-height: 36px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tech-list { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 12px; padding-right: 28px; }
.tech { font-size: 11px; font-weight: 800; letter-spacing: 0.01em; }
.tone-orange { color: #fb923c; }
.tone-blue { color: #60a5fa; }
.tone-yellow { color: #facc15; }
.tone-purple { color: #c084fc; }
.tone-cyan { color: #22d3ee; }
.tone-violet { color: #a78bfa; }
.tone-amber { color: #fbbf24; }
.tone-green { color: #4ade80; }

.contact { padding: 10px 0 90px; }
.contact-grid {
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    gap: 36px;
    align-items: start;
}
.contact-lead { color: var(--muted); max-width: 460px; margin-bottom: 22px; }
.contact-points { display: flex; flex-direction: column; gap: 12px; }
.contact-points a, .contact-points span {
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--text);
}
.contact-points .icon { color: var(--orange); }
.contact-card, .detail-card, .page-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 22px;
    box-shadow: var(--shadow);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field span { font-size: 13px; color: var(--muted); }
.field input, .field textarea, .field select {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
    padding: 12px 13px;
    outline: none;
}
[data-theme="light"] .field input,
[data-theme="light"] .field textarea,
[data-theme="light"] .field select { background: #fff; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgba(59, 130, 246, 0.7); }
.form-alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.form-alert.is-ok { background: rgba(34, 197, 94, 0.12); color: #86efac; }
.form-alert.is-error { background: rgba(239, 68, 68, 0.12); color: #fca5a5; }
[data-theme="light"] .form-alert.is-ok { color: #166534; }
[data-theme="light"] .form-alert.is-error { color: #991b1b; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 14px; }

.site-footer { border-top: 1px solid var(--line); padding: 36px 0 18px; background: rgba(0, 0, 0, 0.15); }
.footer-grid { display: grid; grid-template-columns: 1.4fr .8fr .8fr; gap: 24px; }
.footer-text { color: var(--muted); margin-top: 14px; max-width: 420px; font-size: 14px; }
.footer-nav, .footer-contact { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.footer-nav a:hover, .footer-contact a:hover { color: var(--blue-2); }
.socials { display: flex; gap: 10px; }
.socials a {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
}
.footer-bottom {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 26px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

.page-intro { padding: 48px 0 10px; }
.page-intro h1 { font-family: var(--display); font-size: clamp(36px, 5vw, 56px); letter-spacing: -0.04em; }
.page-intro p { color: var(--muted); margin-top: 8px; }
.detail { padding: 28px 0 80px; }
.detail-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 28px; align-items: start; }
.detail-cover { border-radius: 20px; overflow: hidden; border: 1px solid var(--line); min-height: 240px; background: #10192c; }
.detail-cover img { width: 100%; height: 100%; max-height: 460px; object-fit: cover; }
.detail-card h1 { font-family: var(--display); font-size: 36px; letter-spacing: -0.04em; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; color: var(--muted); font-size: 14px; }
.prose { color: var(--muted); white-space: pre-wrap; }
.detail-copy { margin-top: 18px; }
.detail-related { margin-top: 42px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.back-link { color: var(--blue-2); font-weight: 600; display: inline-flex; margin-bottom: 18px; }
.empty-state { color: var(--muted); padding: 24px; border: 1px dashed var(--line); border-radius: 16px; }

.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 1100px) {
    .specialties-grid, .projects-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .specialty:nth-child(3) { border-right: 0; }
    .about-skills-grid, .contact-grid, .detail-grid, .footer-grid { grid-template-columns: 1fr; }
    .skills-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .facts { padding-top: 0; flex-direction: row; flex-wrap: wrap; }
    .fact { width: calc(50% - 8px); }
}

@media (max-width: 1180px) {
    .header-inner { grid-template-columns: 1fr auto; }
    .nav {
        display: none;
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 8px 22px 18px;
        background: var(--header);
        border-bottom: 1px solid var(--line);
    }
    .nav.is-open {
        display: flex;
        background: var(--bg);
        z-index: 5;
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    }
    .nav a.active::after { display: none; }
    .header-actions .btn-cv { display: none; }
    .nav .nav-cv { display: inline-flex; margin-top: 8px; }
    .nav-toggle { display: inline-flex; }
    .hero { min-height: 0; display: block; padding-top: 28px; }
    .hero-media {
        position: relative;
        width: 100%;
        height: 250px;
        margin-top: 28px;
        border-radius: 18px;
        overflow: hidden;
    }
    .hero-media::after {
        background: linear-gradient(180deg, transparent 40%, var(--bg) 100%);
    }
}

@media (max-width: 720px) {
    .container { width: min(1220px, calc(100% - 28px)); }
    .specialties-grid, .projects-grid, .skills-grid, .form-grid { grid-template-columns: 1fr 1fr; }
    .specialty { border-right: 0 !important; border-bottom: 1px solid var(--line); }
    .about-layout { grid-template-columns: 1fr; }
    .brand-text small { display: none; }
    .hero-title { font-size: 46px; }
    .footer-bottom, .projects-head, .section-head { flex-direction: column; align-items: flex-start; }
    .facts .fact { width: 100%; }
}

@media (max-width: 520px) {
    .projects-grid, .skills-grid { grid-template-columns: 1fr; }
    .hero-actions .btn, .form-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
    .reveal { opacity: 1; transform: none; }
}
