/* =========================================================
   gorbenko.ml — dark, outcome-first personal site
   ========================================================= */

:root {
    --bg: #0F1626;
    --bg-2: #121B2E;
    --surface: #161F33;
    --surface-2: #1B2540;
    --line: #26324C;
    --line-strong: #34436A;
    --text: #EEF2F8;
    --text-2: #C5CEDF;
    --muted: #8F9CB5;
    --accent: #3B8BFF;
    --accent-2: #25A9EF;
    --accent-ink: #0A1B3A;
    --paper: #F4F6FA;

    --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
    --body: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

    --maxw: 72rem;
    --pad: clamp(1.25rem, 4vw, 3rem);
    --section-gap: clamp(5rem, 10vw, 8.5rem);
    --radius: 6px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--body);
    font-size: 1.0625rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img,
svg {
    display: block;
    max-width: 100%;
}

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

ul,
ol,
dl {
    margin: 0;
    padding: 0;
    list-style: none;
}

dd {
    margin: 0;
}

p {
    margin: 0;
}

h1,
h2,
h3 {
    margin: 0;
    font-family: var(--display);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

:focus-visible {
    outline: 2px solid var(--accent-2);
    outline-offset: 3px;
    border-radius: 2px;
}

::selection {
    background: var(--accent);
    color: #fff;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    padding: 0.6rem 1rem;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius);
    z-index: 100;
}

.skip-link:focus {
    top: 1rem;
}

/* ---------- Buttons and links ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.9375rem;
    line-height: 1;
    border: 1px solid transparent;
    transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: #2F7BEA;
}

.btn-ghost {
    border-color: var(--line-strong);
    color: var(--text);
}

.btn-ghost:hover {
    border-color: var(--text-2);
}

.btn-small {
    padding: 0.55rem 1rem;
    font-size: 0.875rem;
}

.btn-large {
    padding: 1.05rem 2rem;
    font-size: 1.0625rem;
}

.btn:active {
    transform: translateY(1px);
}

.text-link {
    color: var(--accent-2);
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s var(--ease);
}

.text-link:hover {
    border-bottom-color: currentColor;
}

/* ---------- Top bar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(15, 22, 38, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 var(--pad);
    height: 4rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.brand {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.0625rem;
    letter-spacing: -0.01em;
    margin-right: auto;
}

.site-nav {
    display: flex;
    gap: 1.75rem;
}

.site-nav a {
    font-size: 0.9375rem;
    color: var(--text-2);
    padding: 0.35rem 0;
    border-bottom: 1px solid transparent;
    transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.site-nav a:hover,
.site-nav a.is-active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

.topbar-tools {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lang-switch {
    display: inline-flex;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    overflow: hidden;
}

.lang-switch button {
    appearance: none;
    background: transparent;
    border: 0;
    color: var(--muted);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.45rem 0.7rem;
    cursor: pointer;
    transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.lang-switch button[aria-pressed="true"] {
    background: var(--surface-2);
    color: var(--text);
}

.lang-switch button:hover {
    color: var(--text);
}

.menu-toggle {
    display: none;
    appearance: none;
    background: transparent;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
    font-size: 0.875rem;
    padding: 0.5rem 0.9rem;
    cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: clamp(3.5rem, 9vw, 7rem) var(--pad) 0;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
}

.hero-role {
    font-size: 1rem;
    color: var(--accent-2);
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.04;
}

.hero-title span {
    display: block;
}

.hero-title-accent {
    color: var(--accent-2);
}

.hero-intro {
    margin-top: 1.75rem;
    max-width: 34rem;
    font-size: 1.1875rem;
    color: var(--text-2);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2.25rem;
}

.hero-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
    margin-top: 2.25rem;
}

.hero-links a {
    font-size: 0.9375rem;
    color: var(--muted);
    border-bottom: 1px solid transparent;
    transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.hero-links a:hover {
    color: var(--text);
    border-bottom-color: var(--accent);
}

.hero-visual {
    position: relative;
    justify-self: end;
    width: min(100%, 24rem);
    padding-bottom: 5.5rem;
}

.portrait {
    position: relative;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    padding: 0.75rem;
}

.portrait::after {
    content: "";
    position: absolute;
    inset: -1.25rem 1.25rem 1.25rem -1.25rem;
    border: 1px solid var(--line);
    z-index: -1;
}

.portrait img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    filter: saturate(0.85);
}

.hero-visual .toptal-badge {
    position: absolute;
    left: -1.5rem;
    bottom: 0;
}

/* Page-load sequence: one orchestrated entrance, hero only */
.hero-copy > *,
.hero-visual {
    animation: rise 0.9s var(--ease) both;
}

.hero-copy > :nth-child(1) { animation-delay: 0.05s; }
.hero-copy > :nth-child(2) { animation-delay: 0.12s; }
.hero-copy > :nth-child(3) { animation-delay: 0.2s; }
.hero-copy > :nth-child(4) { animation-delay: 0.28s; }
.hero-copy > :nth-child(5) { animation-delay: 0.34s; }
.hero-visual { animation-delay: 0.25s; }

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin-top: clamp(3.5rem, 7vw, 5.5rem);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.stat {
    padding: 1.75rem 1.5rem 1.75rem 0;
    border-right: 1px solid var(--line);
}

.stat + .stat {
    padding-left: 1.5rem;
}

.stat:last-child {
    border-right: 0;
}

.stat dt {
    font-family: var(--display);
    font-size: clamp(2rem, 3.4vw, 2.75rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.stat dd {
    margin-top: 0.6rem;
    font-size: 0.9375rem;
    color: var(--muted);
    max-width: 16rem;
}

/* ---------- Sections ---------- */
.section {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: var(--section-gap) var(--pad) 0;
}

.section-grid {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: start;
}

.section-head {
    position: sticky;
    top: 5.5rem;
}

.section-head h2 {
    font-size: clamp(1.875rem, 3.2vw, 2.5rem);
}

.section-head p {
    margin-top: 1rem;
    color: var(--muted);
    max-width: 22rem;
}

.section-head .text-link {
    display: inline-block;
    margin-top: 1.25rem;
    font-size: 0.9375rem;
}

/* About */
.about-text p {
    color: var(--text-2);
    font-size: 1.125rem;
    max-width: 40rem;
}

.about-text p + p {
    margin-top: 1.25rem;
}

.facts {
    margin-top: 2.5rem;
    border-top: 1px solid var(--line);
}

.fact {
    display: grid;
    grid-template-columns: 8rem 1fr;
    gap: 1rem;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--line);
}

.fact dt {
    color: var(--muted);
    font-size: 0.9375rem;
}

.fact dd {
    color: var(--text);
}

/* Skills */
.skills {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.skills li {
    padding: 1.5rem;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    transition: background-color 0.25s var(--ease);
}

.skills li:hover {
    background-color: var(--bg-2);
}

.skills h3 {
    font-size: 1.1875rem;
    font-weight: 600;
}

.skills p {
    margin-top: 0.6rem;
    font-size: 0.9375rem;
    color: var(--muted);
}

/* Projects ledger */
.ledger {
    border-top: 1px solid var(--line);
}

.entry {
    display: grid;
    grid-template-columns: 11rem 1fr;
    gap: 2rem;
    padding: 2rem 0;
    border-bottom: 1px solid var(--line);
}

.entry-metric strong {
    display: block;
    font-family: var(--display);
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--accent-2);
    font-variant-numeric: tabular-nums;
}

.entry-metric span {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.4;
}

.entry-company {
    font-size: 0.9375rem;
    color: var(--muted);
}

.entry-body h3 {
    margin-top: 0.35rem;
    font-size: 1.375rem;
}

.entry-body p:not(.entry-company) {
    margin-top: 0.75rem;
    color: var(--text-2);
    max-width: 44rem;
}

/* Certifications */
.certs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.certs a {
    display: block;
    padding: 1rem;
    background: var(--paper);
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.certs a:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.35);
}

.certs img {
    width: 100%;
    height: auto;
}

/* Articles */
.articles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.article {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: border-color 0.25s var(--ease);
}

.article:hover {
    border-color: var(--line-strong);
}

.article-meta {
    font-size: 0.8125rem;
    color: var(--muted);
}

.article h3 {
    margin-top: 0.75rem;
    font-size: 1.1875rem;
    line-height: 1.25;
}

.article h3 a:hover {
    color: var(--accent-2);
}

.article p {
    margin-top: 0.75rem;
    font-size: 0.9375rem;
    color: var(--text-2);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: auto;
    padding-top: 1.25rem;
}

.article-tags span {
    font-size: 0.75rem;
    color: var(--muted);
    padding: 0.2rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 999px;
}

.articles-error {
    color: var(--muted);
}

.articles-error a {
    color: var(--accent-2);
}

/* Contact */
.contact {
    padding-bottom: var(--section-gap);
}

.contact h2 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.contact-lead {
    margin-top: 1.25rem;
    font-size: 1.1875rem;
    color: var(--text-2);
    max-width: 34rem;
}

.contact-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2.25rem;
}

.contact-email {
    font-family: var(--display);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text);
    border-bottom: 1px solid var(--line-strong);
    transition: border-color 0.2s var(--ease);
}

.contact-email:hover {
    border-bottom-color: var(--accent-2);
}

.contact-alt {
    margin-top: 1.5rem;
    color: var(--muted);
}

.contact-alt a {
    color: var(--text-2);
    border-bottom: 1px solid var(--line-strong);
}

.contact-alt a:hover {
    color: var(--text);
    border-bottom-color: var(--accent-2);
}

/* ---------- Footer ---------- */
.footer {
    border-top: 1px solid var(--line);
    background: var(--bg-2);
    font-size: 0.875rem;
    color: var(--muted);
}

.footer-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 2rem var(--pad);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem 2rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
}

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

/* ---------- Toptal badge ---------- */
.toptal-badge {
    --toptal-hex: polygon(50% 0, 100% 24%, 100% 76%, 50% 100%, 0 76%, 0 24%);
    font-family: proxima-nova, Arial, sans-serif;
    line-height: 1.2;
    width: 176px;
}

.toptal-hex {
    display: inline-block;
    background: #25a9ef;
    padding: 5px;
    clip-path: var(--toptal-hex);
}

.toptal-card {
    width: 166px;
    padding: 20px 0 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #204ecf;
    text-align: center;
    background:
        radial-gradient(circle at 20% -10%, #00c3ff -80%, #fff 30%),
        radial-gradient(circle at -20% 20%, #00c3ff -80%, #fff 30%),
        radial-gradient(circle at 70% 100%, #00c3ff -80%, #fff 30%),
        radial-gradient(circle at 120% 80%, #00c3ff -80%, #fff 30%);
    background-blend-mode: multiply;
    clip-path: var(--toptal-hex);
}

.toptal-card > svg:first-child {
    width: 54px;
}

.toptal-title {
    margin: 0;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
    color: inherit;
}

.toptal-rule {
    width: 100px;
    height: 1px;
    background: #25a9ef;
}

.toptal-vetted {
    font-size: 14px;
    margin-bottom: -5px;
}

.toptal-logo {
    width: 84px;
}

.toptal-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 16px;
    border-radius: 6px;
    background: #296bff;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.toptal-cta:hover {
    text-decoration: underline;
    text-decoration-thickness: 0.5px;
    text-underline-offset: 2px;
}

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

    .stat {
        padding: 1.5rem 1.25rem 1.5rem 0;
    }

    .stat:nth-child(2n) {
        border-right: 0;
        padding-left: 1.25rem;
    }

    .stat:nth-child(-n + 2) {
        border-bottom: 1px solid var(--line);
    }

    .stat:nth-child(3) {
        padding-left: 0;
    }

    .section-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .section-head {
        position: static;
    }

    .section-head p {
        max-width: 36rem;
    }
}

@media (max-width: 860px) {
    .topbar-inner {
        gap: 1rem;
    }

    .menu-toggle {
        display: inline-block;
        order: 3;
    }

    .topbar-tools {
        order: 2;
    }

    .topbar-tools .btn {
        display: none;
    }

    .site-nav {
        order: 4;
        flex-basis: 100%;
        flex-direction: column;
        gap: 0;
        display: none;
        padding-bottom: 1rem;
    }

    .site-nav.is-open {
        display: flex;
    }

    .site-nav a {
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--line);
    }

    .topbar-inner {
        height: auto;
        min-height: 4rem;
        flex-wrap: wrap;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .hero-grid {
        grid-template-columns: 1fr;
    }

    .hero-visual {
        justify-self: start;
        width: min(100%, 22rem);
        margin-top: 1rem;
    }

    .hero-title {
        max-width: none;
    }

    .skills {
        grid-template-columns: 1fr;
    }

    .entry {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1.5rem 0;
    }

    .certs {
        grid-template-columns: repeat(3, 1fr);
    }

    .articles {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    body {
        font-size: 1rem;
    }

    .hero-intro {
        font-size: 1.0625rem;
    }

    .hero-actions .btn {
        flex: 1 1 100%;
    }

    .hero-visual {
        width: 100%;
        padding-bottom: 5rem;
    }

    .hero-visual .toptal-badge {
        left: 0;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .stat,
    .stat:nth-child(2n),
    .stat:nth-child(3) {
        padding: 1.25rem 0;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .stat:last-child {
        border-bottom: 0;
    }

    .fact {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }

    .certs {
        grid-template-columns: repeat(2, 1fr);
    }

    .contact-actions .btn {
        width: 100%;
    }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .hero-copy > *,
    .hero-visual {
        animation: none;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
    }
}
