/* ============ theme variables ============ */
:root {
    --bg: #0d1117;
    --card: #161b22;
    --border: #30363d;
    --text: #e6edf3;
    --muted: #8b949e;
    --accent: #58a6ff;
    --accent-dim: #1f6feb;
    --on-accent: #0d1117;
}
:root[data-theme='light'] {
    --bg: #ffffff;
    --card: #f6f8fa;
    --border: #d0d7de;
    --text: #1f2328;
    --muted: #57606a;
    --accent: #0969da;
    --accent-dim: #0969da;
    --on-accent: #ffffff;
}
/* follow the OS theme until the user clicks the toggle */
@media (prefers-color-scheme: light) {
    :root:not([data-theme='dark']) {
        --bg: #ffffff;
        --card: #f6f8fa;
        --border: #d0d7de;
        --text: #1f2328;
        --muted: #57606a;
        --accent: #0969da;
        --accent-dim: #0969da;
        --on-accent: #ffffff;
    }
}

/* ============ i18n visibility ============ */
html[lang='ru'] .en {
    display: none !important;
}
html[lang='en'] .ru {
    display: none !important;
}

/* ============ base ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    background: var(--bg);
    color: var(--text);
    font-family:
        'Segoe UI',
        system-ui,
        -apple-system,
        sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition:
        background 0.25s ease,
        color 0.25s ease;
}
.wrap {
    max-width: 880px;
    margin: 0 auto;
    padding: 56px 20px;
}

/* ============ topbar (theme / lang) ============ */
.topbar {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 12px;
}
.icon-btn {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.2s;
}
.icon-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ============ hero ============ */
.hero {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.hero img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 2px solid var(--border);
}
.hero h1 {
    font-size: 2rem;
    font-weight: 700;
}
.role {
    color: var(--accent);
    font-weight: 600;
}
.bio {
    color: var(--muted);
    max-width: 560px;
    margin-top: 6px;
}

/* ============ sections ============ */
section {
    margin-top: 56px;
}
h2 {
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 22px;
}
.section-note {
    color: var(--muted);
    font-size: 0.9rem;
    margin: -12px 0 18px;
}

/* ============ project cards ============ */
.projects {
    display: grid;
    gap: 16px;
}
.project {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 22px;
    transition:
        border-color 0.2s,
        transform 0.2s;
}
.project:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}
.project h3 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.project h3 a {
    color: var(--text);
    text-decoration: none;
}
.project h3 a:hover {
    color: var(--accent);
}
.project p {
    color: var(--muted);
    font-size: 0.93rem;
    margin: 10px 0 12px;
}
.project code {
    background: var(--bg);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}
.project a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    margin-right: 16px;
}
.project a:hover {
    text-decoration: underline;
}
.meta {
    color: var(--muted);
    font-size: 0.82rem;
    margin-bottom: 8px;
}
.plinks a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    margin-right: 16px;
}
.plinks a:hover {
    text-decoration: underline;
}

/* badges */
.b {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.02em;
}
.b.blue {
    background: var(--accent-dim);
}
.b.green {
    background: #238636;
}
.b.purple {
    background: #8957e5;
}
.b.pink {
    background: #db61a2;
}
.b.orange {
    background: #d29922;
    color: #0d1117;
}

/* ============ stack by language ============ */
.lang-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.lang-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}
.lang-card h3 {
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 14px;
    font-weight: 600;
}
.sub {
    margin-bottom: 12px;
}
.sub:last-child {
    margin-bottom: 0;
}
.sub-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 6px;
}
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tag {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
}

/* ============ npm widget ============ */
.npm-status {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 12px;
}
.npm-status a {
    color: var(--accent);
}

/* ============ contact ============ */
.links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    background: var(--card);
    transition: 0.2s;
    font-size: 0.95rem;
    cursor: pointer;
    user-select: none;
}
.btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
}
.btn.primary:hover {
    color: var(--on-accent);
    filter: brightness(1.1);
}

/* ============ footer / toast ============ */
footer {
    margin-top: 64px;
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
}
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--card);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    opacity: 0;
    pointer-events: none;
    transition: 0.25s ease;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============ responsive ============ */
@media (max-width: 520px) {
    .hero img {
        width: 72px;
        height: 72px;
    }
    .hero h1 {
        font-size: 1.6rem;
    }
    .wrap {
        padding: 32px 16px;
    }
}
