/* ============================================================
   Portfolio — оригинальная тёмная тема
   ============================================================ */

:root {
    --bg: #0d1017;
    --bg-2: #141924;
    --bg-3: #1b2230;
    --card: #161c28;
    --line: #242c3a;
    --text: #e7ecf3;
    --muted: #8b96a8;
    --accent: #6c8cff;
    --accent-2: #4f6ef0;
    --accent-soft: rgba(108, 140, 255, 0.14);
    --ok: #37c98b;
    --err: #ff6b6b;
    --radius: 16px;
    --shadow: 0 20px 45px -20px rgba(0, 0, 0, 0.6);
    --sidebar-w: 320px;
    --maxw: 900px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 90px; }

body {
    font-family: 'Manrope', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    background-image:
        radial-gradient(1000px 600px at 100% -10%, rgba(108, 140, 255, 0.10), transparent 60%),
        radial-gradient(800px 500px at -10% 10%, rgba(79, 110, 240, 0.08), transparent 55%);
    background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, h5 { line-height: 1.2; font-weight: 700; }

/* ---------------- Layout ---------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 32px 24px;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, var(--bg-2), var(--bg));
}
.sidebar-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    height: 100%;
    gap: 6px;
}

.avatar {
    position: relative;
    width: 140px; height: 140px;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    margin-bottom: 10px;
}
.avatar img, .avatar-ph {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-3);
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem; color: var(--muted);
}
.status-dot {
    position: absolute; right: 10px; bottom: 10px;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--ok); border: 3px solid var(--bg-2);
    box-shadow: 0 0 0 0 rgba(55, 201, 139, 0.5);
    animation: pulse 2.2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(55, 201, 139, 0.5); }
    70% { box-shadow: 0 0 0 10px rgba(55, 201, 139, 0); }
    100% { box-shadow: 0 0 0 0 rgba(55, 201, 139, 0); }
}

.side-name { font-size: 1.4rem; margin-top: 4px; }
.side-role {
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.side-contacts {
    list-style: none;
    width: 100%;
    margin: 12px 0;
    display: flex; flex-direction: column; gap: 10px;
    text-align: left;
    font-size: 0.9rem;
}
.side-contacts li { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.side-contacts li i { color: var(--accent); font-size: 1rem; width: 18px; text-align: center; }
.side-contacts a:hover { color: var(--text); }

.side-socials { display: flex; gap: 12px; margin: 14px 0 18px; }
.side-socials a {
    width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-3); border: 1px solid var(--line);
    font-size: 1.1rem; color: var(--muted);
    transition: .2s;
}
.side-socials a:hover { color: #fff; background: var(--accent); border-color: var(--accent); transform: translateY(-3px); }

/* ---------------- Content ---------------- */
.content { flex: 1; min-width: 0; }
.content > .section, .content > .messages, .topbar > .topnav { max-width: var(--maxw); }
.content { padding: 0 clamp(20px, 5vw, 64px); }

.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 16px;
    padding: 14px 0;
    margin-bottom: 10px;
    background: rgba(13, 16, 23, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.topnav { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 auto 0 0; }
.topnav a {
    padding: 8px 14px; border-radius: 10px;
    color: var(--muted); font-weight: 600; font-size: 0.9rem;
    transition: .2s;
}
.topnav a:hover { color: var(--text); background: var(--bg-3); }
.topnav a.active { color: var(--accent); background: var(--accent-soft); }

.side-toggle {
    display: none;
    background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
    width: 42px; height: 42px; border-radius: 12px; font-size: 1.3rem; cursor: pointer;
}

/* ---------------- Sections ---------------- */
.section { padding: 48px 0; scroll-margin-top: 80px; }
.section-head { margin-bottom: 28px; }
.eyebrow {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem; letter-spacing: 1px; text-transform: uppercase;
    color: var(--accent);
    padding: 5px 12px; border-radius: 999px;
    background: var(--accent-soft); border: 1px solid rgba(108, 140, 255, 0.25);
    margin-bottom: 12px;
}
.section-head h3 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.accent { color: var(--accent); }

/* ---------------- Hero ---------------- */
.hero { padding-top: 24px; }
.hero-title { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; margin: 8px 0 16px; letter-spacing: -0.5px; }
.hero-lead { color: var(--muted); font-size: 1.1rem; max-width: 620px; }

.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 36px; }
.fact {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 20px 16px; text-align: center;
}
.fact-num { display: block; font-size: 2rem; font-weight: 800; color: var(--accent); }
.fact-label { color: var(--muted); font-size: 0.85rem; }

/* ---------------- Skills ---------------- */
.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 32px; }
.skill-top { display: flex; justify-content: space-between; margin-bottom: 8px; font-weight: 600; font-size: 0.95rem; }
.skill-val { color: var(--accent); }
.skill-bar { height: 8px; border-radius: 999px; background: var(--bg-3); overflow: hidden; }
.skill-bar span {
    display: block; height: 100%; width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent-2), var(--accent));
    transition: width 1.1s cubic-bezier(.2,.8,.2,1);
}
.skill.in .skill-bar span { width: var(--lvl); }

/* ---------------- Resume ---------------- */
.resume-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.timeline-title { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; font-size: 1.1rem; }
.timeline-title i { color: var(--accent); }
.tl-item {
    position: relative; padding-left: 26px; padding-bottom: 26px;
    border-left: 2px solid var(--line);
}
.tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-item::before {
    content: ''; position: absolute; left: -7px; top: 4px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.tl-period {
    font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
    color: var(--accent);
}
.tl-item h5 { font-size: 1.05rem; margin: 4px 0 2px; }
.tl-org { color: var(--muted); font-size: 0.9rem; }
.tl-item p { color: var(--muted); font-size: 0.9rem; margin-top: 6px; }

/* ---------------- Services ---------------- */
.services { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.service-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 26px 22px; transition: .25s;
}
.service-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.service-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 52px; height: 52px; border-radius: 14px;
    background: var(--accent-soft); color: var(--accent);
    font-size: 1.5rem; margin-bottom: 14px;
}
.service-card h4 { font-size: 1.1rem; margin-bottom: 8px; }
.service-card p { color: var(--muted); font-size: 0.92rem; }
.service-price {
    display: inline-block; margin-top: 14px; font-weight: 700;
    color: var(--accent); font-family: 'JetBrains Mono', monospace; font-size: 0.9rem;
}

/* ---------------- Portfolio ---------------- */
.portfolio { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.work {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden; transition: .25s;
}
.work:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.work-media {
    position: relative; display: block; aspect-ratio: 16/10;
    background: var(--bg-3); overflow: hidden;
}
.work-media img { width: 100%; height: 100%; object-fit: cover; transition: .4s; }
.work:hover .work-media img { transform: scale(1.05); }
.work-ph {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem; color: var(--muted);
}
.work-overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(13, 16, 23, 0.55); color: #fff; font-size: 1.6rem;
    opacity: 0; transition: .25s;
}
.work:hover .work-overlay { opacity: 1; }
.work-body { padding: 18px 20px 22px; }
.work-body h4 { font-size: 1.15rem; margin-bottom: 6px; }
.work-body h4 a:hover { color: var(--accent); }
.work-body p { color: var(--muted); font-size: 0.92rem; margin-bottom: 12px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    font-family: 'JetBrains Mono', monospace; font-size: 0.72rem;
    padding: 4px 10px; border-radius: 999px;
    background: var(--bg-3); border: 1px solid var(--line); color: var(--muted);
}

/* ---------------- Contact ---------------- */
.contact-grid { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 32px; align-items: start; }
.contact-info p { color: var(--muted); margin-bottom: 20px; }
.contact-list { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.contact-list li { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.contact-list li i { color: var(--accent); font-size: 1.1rem; width: 20px; }
.contact-list a:hover { color: var(--text); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.contact-form { padding: 28px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.field input, .field select, .field textarea {
    width: 100%; padding: 12px 14px;
    background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
    color: var(--text); font-family: inherit; font-size: 0.95rem;
    transition: .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; }
.field .errorlist { list-style: none; color: var(--err); font-size: 0.8rem; margin-top: 4px; }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 22px; border-radius: 12px; border: none; cursor: pointer;
    font-family: inherit; font-weight: 700; font-size: 0.95rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; transition: .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -8px var(--accent-2); }
.btn-block { width: 100%; margin-top: auto; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-outline {
    background: transparent; border: 1px solid var(--line); color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); box-shadow: none; }

/* ---------------- Messages ---------------- */
.messages { padding-top: 12px; }
.alert {
    padding: 14px 18px; border-radius: 12px; margin-bottom: 12px; font-weight: 600; font-size: 0.92rem;
    border: 1px solid var(--line);
}
.alert-success { background: rgba(55, 201, 139, 0.12); border-color: rgba(55, 201, 139, 0.4); color: var(--ok); }
.alert-error { background: rgba(255, 107, 107, 0.1); border-color: rgba(255, 107, 107, 0.4); color: var(--err); }

.content-footer { padding: 40px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }

/* ---------------- Detail page ---------------- */
.layout--detail { justify-content: center; }
.content--detail { max-width: 760px; padding-top: 40px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); margin-bottom: 28px; font-weight: 600; }
.back-link:hover { color: var(--accent); }
.detail-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 12px; }
.detail-lead { color: var(--muted); font-size: 1.1rem; margin-bottom: 16px; }
.detail-media { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); margin: 24px 0; }
.detail-body { color: var(--text); font-size: 1.02rem; margin-bottom: 28px; }
.detail-body p { margin-bottom: 14px; }
.detail-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------------- Reveal animation ---------------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------------- Backdrop (mobile sidebar) ---------------- */
.sidebar-backdrop {
    display: none; position: fixed; inset: 0; z-index: 40;
    background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(2px);
}
.sidebar-backdrop.show { display: block; }

/* ---------------- Responsive ---------------- */
@media (max-width: 980px) {
    .resume-grid { grid-template-columns: 1fr; gap: 32px; }
    .contact-grid { grid-template-columns: 1fr; }
    .facts { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
    .sidebar {
        position: fixed; left: 0; top: 0; z-index: 50;
        transform: translateX(-100%); transition: transform .3s ease;
        box-shadow: var(--shadow);
    }
    .sidebar.open { transform: none; }
    .side-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .portfolio, .skills { grid-template-columns: 1fr; }
    .topnav { display: none; }
}
@media (max-width: 460px) {
    .facts { grid-template-columns: 1fr 1fr; }
    .content { padding: 0 18px; }
}
