/* =====================================================
   Alexandr Nomokonov — personal site
   Modern responsive theme (light / dark)
   ===================================================== */

/* ---------- Design tokens ---------- */
:root {
    color-scheme: dark;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Dark theme (default) */
    --bg: #0a0e17;
    --bg-2: #0d1220;
    --surface: rgba(255, 255, 255, 0.035);
    --surface-2: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #e8ebf2;
    --text-dim: #9aa3b7;
    --text-faint: #6b7386;
    --accent: #7c86ff;
    --accent-2: #29d3ee;
    --accent-grad: linear-gradient(135deg, #6d7bff 0%, #2ad4ee 100%);
    --accent-soft: rgba(109, 123, 255, 0.14);
    --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.75);
    --radius: 16px;
    --radius-lg: 22px;
    --nav-h: 68px;
    --maxw: 1120px;
}

[data-theme="light"] {
    color-scheme: light;
    --bg: #f6f8fd;
    --bg-2: #ffffff;
    --surface: #ffffff;
    --surface-2: #ffffff;
    --border: #e7eaf3;
    --border-strong: #d5dbe9;
    --text: #101828;
    --text-dim: #4c5568;
    --text-faint: #8a92a6;
    --accent: #5661f0;
    --accent-2: #0aa5c4;
    --accent-grad: linear-gradient(135deg, #5661f0 0%, #0aa5c4 100%);
    --accent-soft: rgba(86, 97, 240, 0.10);
    --shadow: 0 24px 55px -30px rgba(30, 41, 80, 0.30);
}

/* ---------- Reset & base ---------- */
* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 12px);
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    transition: background .3s ease, color .3s ease;
}

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }

.container {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 24px;
}

.grad {
    background: var(--accent-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---------- Reveal animation ---------- */
.js .reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .7s cubic-bezier(.2, .7, .2, 1);
}
.js .reveal.in {
    opacity: 1;
    transform: none;
}
@media (prefers-reduced-motion: reduce) {
    .js .reveal { opacity: 1; transform: none; transition: none; }
    html { scroll-behavior: auto; }
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 13px 22px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform .18s ease, box-shadow .25s ease, background .25s ease, border-color .25s ease;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
    background: var(--accent-grad);
    color: #06121c;
    box-shadow: 0 12px 30px -12px var(--accent);
}
.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 38px -12px var(--accent);
}

.btn--ghost {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
}
.btn--ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

/* ---------- Icon button ---------- */
.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

.icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ---------- Language switch ---------- */
.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 11px;
}
.lang-switch button {
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: color .2s ease, background .2s ease;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button.active {
    background: var(--accent-grad);
    color: #06121c;
}

/* ---------- Navigation ---------- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-h);
    z-index: 50;
    display: flex;
    align-items: center;
    transition: background .3s ease, border-color .3s ease, backdrop-filter .3s ease;
    border-bottom: 1px solid transparent;
}
.nav.scrolled {
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom-color: var(--border);
}
.nav__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.nav__brand { display: flex; align-items: center; gap: 11px; font-weight: 700; }
.nav__logo {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--accent-grad);
    color: #06121c;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0;
}
.nav__name { font-size: 15px; letter-spacing: -0.01em; }

.nav__links { display: flex; align-items: center; gap: 6px; }
.nav__links a {
    padding: 8px 14px;
    border-radius: 9px;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--text-dim);
    transition: color .2s ease, background .2s ease;
}
.nav__links a:hover { color: var(--text); background: var(--surface); }
.nav__links a.active { color: var(--accent); }
.nav__cta {
    color: var(--text) !important;
    border: 1px solid var(--border-strong);
}
.nav__cta:hover { border-color: var(--accent); color: var(--accent) !important; background: transparent !important; }

.nav__actions { display: flex; align-items: center; gap: 10px; }
.nav__burger { display: none; }

/* ---------- Hero ---------- */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: calc(var(--nav-h) + 40px) 0 80px;
    overflow: hidden;
}
.hero__bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: .55;
    animation: float 16s ease-in-out infinite;
}
.blob--1 { width: 520px; height: 520px; background: #6d7bff; top: -120px; left: -80px; }
.blob--2 { width: 460px; height: 460px; background: #2ad4ee; bottom: -140px; right: -60px; animation-delay: -4s; }
.blob--3 { width: 380px; height: 380px; background: #a855f7; top: 30%; right: 22%; opacity: .35; animation-delay: -8s; }
[data-theme="light"] .blob { opacity: .28; }
[data-theme="light"] .blob--3 { opacity: .2; }

.grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, var(--border) 1px, transparent 1px),
        linear-gradient(to bottom, var(--border) 1px, transparent 1px);
    background-size: 60px 60px;
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 75%);
    mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 75%);
    opacity: .5;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(28px, -24px) scale(1.06); }
}

.hero__inner { position: relative; z-index: 1; max-width: 820px; }
.hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-dim);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 7px 15px;
    border-radius: 999px;
    margin-bottom: 26px;
}
.hero__eyebrow .pin { color: var(--accent); flex-shrink: 0; }

.hero__title {
    font-size: clamp(2.6rem, 7vw, 4.6rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 10px;
}
.hero__subtitle {
    font-size: clamp(1.15rem, 3vw, 1.6rem);
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 22px;
}
.hero__lead {
    font-size: clamp(1rem, 2.1vw, 1.18rem);
    color: var(--text-dim);
    max-width: 640px;
    margin-bottom: 34px;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 56px; }

.hero__stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    max-width: 700px;
}
.stat {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.stat__num {
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    font-weight: 800;
    background: var(--accent-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
}
.stat__label { font-size: 13px; color: var(--text-faint); }

/* ---------- Section shell ---------- */
.section { padding: 96px 0; position: relative; }
.section--alt { background: var(--bg-2); }
[data-theme="light"] .section--alt { background: #eef2fb; }

.section__kicker {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.02em;
    margin-bottom: 12px;
}
.section__title {
    font-size: clamp(1.7rem, 4vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 44px;
}

/* ---------- About ---------- */
.about__grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 32px;
    align-items: start;
}
.about__text p { color: var(--text-dim); margin-bottom: 18px; font-size: 1.05rem; }
.about__text strong { color: var(--text); font-weight: 600; }
.about__card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px 24px;
    box-shadow: var(--shadow);
}
.factlist li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
}
.factlist li:last-child { border-bottom: none; }
.factlist span { color: var(--text-faint); font-size: 14px; }
.factlist strong { font-weight: 600; font-size: 14.5px; text-align: right; }

/* ---------- Timeline ---------- */
.timeline { position: relative; }
.timeline::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(var(--border-strong), transparent);
}
.tl-item { position: relative; padding-left: 40px; margin-bottom: 28px; }
.tl-item:last-child { margin-bottom: 0; }
.tl-dot {
    position: absolute;
    left: 0;
    top: 26px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-grad);
    box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px var(--border);
}
.section--alt .tl-dot { box-shadow: 0 0 0 4px var(--bg-2), 0 0 0 6px var(--border); }
[data-theme="light"] .section--alt .tl-dot { box-shadow: 0 0 0 4px #eef2fb, 0 0 0 6px var(--border); }

.tl-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 26px;
    transition: border-color .25s ease, transform .25s ease;
}
.tl-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.tl-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.tl-role { font-size: 1.28rem; font-weight: 700; }
.tl-company { color: var(--text-dim); font-size: 15px; margin-top: 3px; }
.tl-company a { color: var(--accent); }
.tl-company a:hover { text-decoration: underline; }
.tl-period {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-faint);
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 999px;
    white-space: nowrap;
}

.progression {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px;
    background: var(--accent-soft);
    border-radius: 12px;
    margin-bottom: 18px;
}
.progression__label { font-size: 13px; color: var(--text-dim); margin-right: 2px; }
.pill {
    font-size: 12.5px;
    font-weight: 600;
    padding: 4px 11px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
}
.pill--active {
    background: var(--accent-grad);
    color: #06121c;
    border-color: transparent;
}
.arrow { color: var(--text-faint); font-size: 13px; }

.tl-list { margin-bottom: 18px; }
.tl-list li {
    position: relative;
    padding-left: 22px;
    color: var(--text-dim);
    margin-bottom: 9px;
    font-size: 15.5px;
}
.tl-list li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 10px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}
.tl-list strong { color: var(--text); font-weight: 600; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-family: var(--font-mono);
    transition: border-color .2s ease, color .2s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Skills ---------- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}
.skill-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 22px 24px;
    transition: border-color .25s ease, transform .25s ease;
}
.skill-card:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.skill-card h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.skill-card h3::before {
    content: "";
    width: 6px; height: 18px; border-radius: 3px;
    background: var(--accent-grad);
}

/* ---------- Education ---------- */
.edu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.edu-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px 24px;
    transition: border-color .25s ease, transform .25s ease;
}
.edu-card:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.edu-year {
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 4px 11px;
    border-radius: 999px;
}
.edu-card h3 { font-size: 1.2rem; font-weight: 700; margin: 16px 0 8px; }
.edu-school { color: var(--text); font-weight: 500; font-size: 15px; margin-bottom: 6px; }
.edu-note { color: var(--text-dim); font-size: 14.5px; }
.edu-card--award { background: linear-gradient(160deg, var(--accent-soft), var(--surface)); }

/* ---------- Projects ---------- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}
.project-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 26px;
    transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}
.project-card__icon {
    font-size: 34px;
    line-height: 1;
    margin-bottom: 16px;
    color: var(--accent);
}
.project-card h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 10px; }
.project-card p { color: var(--text-dim); font-size: 15px; margin-bottom: 18px; }
.project-card .chips { margin-bottom: 18px; }
.project-card__link {
    margin-top: auto;
    color: var(--accent);
    font-weight: 600;
    font-size: 14.5px;
}
.project-card--gh { justify-content: flex-start; }

/* ---------- Contact ---------- */
.contact__inner { text-align: center; max-width: 680px; }
.contact .section__kicker,
.contact .section__title { text-align: center; }
.contact__lead {
    color: var(--text-dim);
    font-size: 1.1rem;
    margin: -20px auto 32px;
    max-width: 520px;
}
.contact__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
}

/* ---------- Footer ---------- */
.footer {
    border-top: 1px solid var(--border);
    padding: 28px 0;
    background: var(--bg-2);
}
[data-theme="light"] .footer { background: #eef2fb; }
.footer__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--text-faint);
    font-size: 14px;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .about__grid { grid-template-columns: 1fr; }
    .hero__stats { grid-template-columns: repeat(2, 1fr); }

    .nav__links {
        position: fixed;
        top: var(--nav-h);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 14px 20px 20px;
        background: color-mix(in srgb, var(--bg) 96%, transparent);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-bottom: 1px solid var(--border);
        transform: translateY(-140%);
        transition: transform .32s cubic-bezier(.2, .8, .2, 1);
        box-shadow: var(--shadow);
    }
    .nav__links.open { transform: translateY(0); }
    .nav__links a { padding: 12px 14px; font-size: 16px; }
    .nav__cta { text-align: center; }
    .nav__burger { display: inline-grid; }
    .nav__name { display: none; }
}

@media (max-width: 520px) {
    .container { padding: 0 18px; }
    .section { padding: 72px 0; }
    .hero__stats { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat { padding: 14px 16px; }
    .tl-item { padding-left: 32px; }
    .btn { width: 100%; justify-content: center; }
    .hero__actions .btn { width: auto; }
    .tl-head { flex-direction: column; }
}
