:root {
    --bg-main: #141416;
    --card-bg: #1e1e22;
    --card-hover: #26262c;
    --text-primary: #f4f4f6;
    --text-muted: #9e9ea8;
    --accent-blue: #3584e4;
    --accent-blue-hover: #1c71d8;
    --accent-purple: #9141ac;
    --border-color: #2e2e34;
    --footer-bg: #09090b; /* Четко отделенный цвет футера */
    --radius-lg: 16px;
    --radius-md: 10px;
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
    --bg-main: #f6f5f4;
    --card-bg: #ffffff;
    --card-hover: #f0f0f3;
    --text-primary: #1d1d20;
    --text-muted: #62626c;
    --border-color: #e0e0e6;
    --footer-bg: #18181b; /* Темный футер в светлой теме для мощного контраста */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; }

/* Navbar Animation */
.navbar {
    background: rgba(20, 20, 22, 0.85);
    backdrop-filter: blur(12px);
    position: sticky; top: 0; z-index: 90;
    border-bottom: 1px solid var(--border-color);
    padding: 22px 0;
}
[data-theme="light"] .navbar { background: rgba(246, 245, 244, 0.9); }
.nav-container { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.logo { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 1.3rem; color: var(--text-primary); text-decoration: none; }
.logo-symbol { color: var(--accent-blue); }
.nav-links a { color: var(--text-muted); text-decoration: none; margin: 0 14px; font-weight: 500; transition: var(--transition); }
.nav-links a:hover { color: var(--accent-blue); }

/* Styled lang / theme controls */
.nav-controls { display: flex; gap: 12px; align-items: center; }
.btn-pill {
    min-width: 52px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}
.btn-pill:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(53, 132, 228, 0.25);
}
.btn-pill:active { transform: translateY(0); }
#theme-toggle { font-size: 1.05rem; padding: 9px 16px; }

/* Sections — увеличенные отступы */
.section { padding: 96px 0; scroll-margin-top: 90px; }
.section-title { font-size: 2rem; font-weight: 800; margin-bottom: 16px; letter-spacing: -0.02em; }

/* Hero Section */
.hero { padding: 130px 0 100px; text-align: center; }
.hero-badge { display: inline-block; background: rgba(53, 132, 228, 0.12); color: var(--accent-blue); padding: 10px 22px; border-radius: 30px; font-weight: 600; font-size: 0.9rem; margin-bottom: 28px; border: 1px solid rgba(53,132,228,0.25); }
.hero-title { font-size: 3.2rem; font-weight: 800; line-height: 1.15; max-width: 900px; margin: 0 auto 24px; }
.hero-subtitle { font-size: 1.2rem; color: var(--text-muted); max-width: 720px; margin: 0 auto 40px; line-height: 1.7; }
.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* Buttons */
.btn { padding: 12px 24px; border-radius: var(--radius-md); font-weight: 600; text-decoration: none; border: none; cursor: pointer; transition: var(--transition); }
.btn-primary { background: var(--accent-blue); color: #fff; }
.btn-primary:hover { background: var(--accent-blue-hover); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(53, 132, 228, 0.3); }
.btn-secondary { background: var(--card-bg); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--card-hover); transform: translateY(-2px); }

/* Projects Grid */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 36px; margin-top: 56px; }

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 36px;
    display: flex; flex-direction: column;
    transition: var(--transition);
    position: relative;
}
.card h3 { margin: 14px 0 12px; font-size: 1.35rem; }
.card p { color: var(--text-muted); line-height: 1.7; margin-bottom: 8px; }
.card:hover { transform: translateY(-6px); background: var(--card-hover); border-color: rgba(53, 132, 228, 0.4); }
.card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.badge { background: rgba(255,255,255,0.06); border: 1px solid var(--border-color); padding: 5px 12px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; font-family: 'JetBrains Mono', monospace; color: var(--text-muted); }
.badge-accent { background: rgba(53,132,228,0.14); border-color: rgba(53,132,228,0.4); color: var(--accent-blue); }

.card-footer-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.btn-sm { padding: 10px 18px; font-size: 0.88rem; display: inline-block; }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-outline:hover { border-color: var(--accent-blue); color: var(--accent-blue); background: rgba(53,132,228,0.08); transform: translateY(-2px); }

.glow-card { border: 1px solid rgba(145, 65, 172, 0.4); cursor: pointer; }
.glow-card:hover { box-shadow: 0 10px 30px rgba(145, 65, 172, 0.25); }

.card-gallery-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 24px 0 8px; }
.card-gallery-preview.single { grid-template-columns: 1fr; }
.card-gallery-preview img { width: 100%; height: 180px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border-color); display: block; }

.tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.tags span { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-color); padding: 5px 12px; border-radius: 6px; font-size: 0.8rem; font-family: 'JetBrains Mono'; }

/* About Me Section Expanded */
.section-about { background: rgba(255, 255, 255, 0.015); border-y: 1px solid var(--border-color); }
.about-hero-block { margin-top: 32px; }
.about-text { max-width: 860px; }
.lead-text { font-size: 1.35rem; line-height: 1.7; margin-bottom: 20px; }
.about-text p { margin-bottom: 18px; line-height: 1.8; color: var(--text-muted); }
.about-text .lead-text { color: var(--text-primary); }
.philosophy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 28px; margin-top: 48px; }
.ph-card { background: var(--card-bg); padding: 32px; border-radius: var(--radius-md); border: 1px solid var(--border-color); line-height: 1.7; }
.ph-card h4 { margin-bottom: 10px; font-size: 1.1rem; }
.ph-icon { font-size: 2rem; margin-bottom: 14px; }

/* News Section & Timeline */
.news-header { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; }
.json-indicator { font-size: 0.85rem; color: var(--text-muted); }
.news-timeline { margin-top: 40px; display: flex; flex-direction: column; gap: 24px; }
.news-item { background: var(--card-bg); padding: 28px 30px; border-radius: var(--radius-md); border: 1px solid var(--border-color); border-left: 4px solid var(--accent-blue); display: flex; gap: 24px; align-items: flex-start; line-height: 1.7; }
.news-item h4 { margin-bottom: 8px; font-size: 1.1rem; }
.news-item p { color: var(--text-muted); }
.news-date { font-family: 'JetBrains Mono'; color: var(--accent-blue); font-weight: 700; white-space: nowrap; padding-top: 2px; }
.news-link { display: inline-block; margin-top: 12px; color: var(--accent-blue); font-weight: 600; text-decoration: none; font-size: 0.9rem; }
.news-link:hover { text-decoration: underline; }

/* Dev.to Banner */
.devto-banner { background: linear-gradient(135deg, rgba(53,132,228,0.1), rgba(145,65,172,0.1)); border: 1px solid var(--border-color); padding: 40px; border-radius: var(--radius-lg); margin-top: 56px; display: flex; justify-content: space-between; align-items: center; gap: 28px; flex-wrap: wrap; line-height: 1.7; }

/* Modal Window */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(10px); display: none; justify-content: center; align-items: center; z-index: 1000; opacity: 0; transition: opacity 0.3s ease; }
.modal-overlay.active { display: flex; opacity: 1; }
.modal-window { background: var(--card-bg); width: 90%; max-width: 900px; max-height: 85vh; border-radius: var(--radius-lg); border: 1px solid var(--border-color); padding: 36px; overflow-y: auto; position: relative; animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.modal-close { position: absolute; top: 20px; right: 20px; background: none; border: none; color: var(--text-primary); font-size: 1.5rem; cursor: pointer; }

/* Separated Footer */
.footer-separated { background: var(--footer-bg); border-top: 2px solid var(--border-color); padding: 80px 0 36px; margin-top: 100px; color: #d0d0d8; }
.footer-top { display: grid; grid-template-columns: 1fr 1.5fr; gap: 56px; }
.footer-brand h3 { margin-bottom: 14px; }
.footer-brand p { line-height: 1.7; color: #9e9ea8; }
.footer-support-box h4 { margin-bottom: 10px; }
.footer-support-box > p { color: #9e9ea8; margin-bottom: 6px; }
.crypto-grid { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.crypto-item { background: rgba(255, 255, 255, 0.05); padding: 14px 18px; border-radius: 10px; display: flex; justify-content: space-between; align-items: center; gap: 14px; font-family: 'JetBrains Mono'; font-size: 0.85rem; border: 1px solid rgba(255,255,255,0.06); }
.crypto-item code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.btn-copy { background: var(--accent-blue); color: #fff; border: none; padding: 8px 16px; border-radius: 999px; cursor: pointer; font-size: 0.78rem; font-weight: 600; transition: var(--transition); flex-shrink: 0; }
.btn-copy:hover { background: var(--accent-blue-hover); transform: translateY(-1px); }
.footer-divider { height: 1px; background: var(--border-color); margin: 48px 0 28px; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; font-size: 0.9rem; color: var(--text-muted); }
.footer-socials a { color: var(--accent-blue); margin-left: 18px; text-decoration: none; }
.footer-socials a:hover { text-decoration: underline; }

/* Links inside cards must always be clickable */
.card a, .news-item a, .footer-socials a, .devto-banner a { position: relative; z-index: 2; }

/* Clickable project cards */
.project-card { cursor: zoom-in; }
.project-card:hover { border-color: rgba(53, 132, 228, 0.55); }
.project-card:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 3px; }
.card-header .zoom-hint {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 1rem;
    opacity: 0.7;
    transition: var(--transition);
}
.project-card:hover .zoom-hint { opacity: 1; color: var(--accent-blue); }

/* Modal Window */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(10px); display: none; justify-content: center; align-items: center; z-index: 1000; opacity: 0; transition: opacity 0.3s ease; padding: 24px; }
.modal-overlay.active { display: flex; opacity: 1; }
.modal-window { background: var(--card-bg); width: 90%; max-width: 900px; max-height: 85vh; border-radius: var(--radius-lg); border: 1px solid var(--border-color); padding: 36px; overflow-y: auto; position: relative; animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.modal-close { position: absolute; top: 20px; right: 20px; background: none; border: 1px solid var(--border-color); border-radius: 999px; width: 38px; height: 38px; color: var(--text-primary); font-size: 1rem; cursor: pointer; transition: var(--transition); }
.modal-close:hover { border-color: var(--accent-blue); color: var(--accent-blue); }
.modal-header { margin-bottom: 20px; padding-right: 50px; }
.modal-header h2 { margin-top: 12px; font-size: 1.7rem; }
.project-modal-window p { color: var(--text-muted); line-height: 1.8; margin: 20px 0 8px; font-size: 1.05rem; }
.project-modal-image-wrap { margin: 8px 0 4px; }
.project-modal-image-wrap img { width: 100%; max-height: 52vh; object-fit: contain; background: rgba(0,0,0,0.3); border-radius: 12px; border: 1px solid var(--border-color); display: block; }

@media (max-width: 860px) {
    .hero { padding: 90px 0 70px; }
    .hero-title { font-size: 2.1rem; }
    .section { padding: 64px 0; }
    .card { padding: 28px; }
    .news-item { flex-direction: column; gap: 12px; }
    .footer-top { grid-template-columns: 1fr; }
    .nav-links { display: none; }
    .devto-banner { padding: 30px; }
}

@keyframes slideUp { from { transform: translateY(30px); } to { transform: translateY(0); } }

/* Blog page */
.nav-active { color: var(--accent-blue) !important; font-weight: 700; }
.blog-hero { padding: 90px 0 40px; }
.blog-toolbar { max-width: 860px; margin: 0 auto; }
.blog-search, .blog-select {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    font-size: 0.9rem;
    font-family: 'Inter', system-ui, sans-serif;
    outline: none;
}
.blog-search { flex: 1 1 220px; min-width: 200px; }
.blog-search:focus, .blog-select:focus { border-color: var(--accent-blue); }
.blog-select { cursor: pointer; }
.blog-status { margin-top: 18px; color: var(--text-muted); font-size: 0.85rem; font-family: 'JetBrains Mono', monospace; }
.blog-updated { opacity: 0.8; }
.blog-section { padding-top: 32px; }
.blog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 28px; }
.blog-card { cursor: pointer; }
.blog-card h3 { font-size: 1.2rem; line-height: 1.4; }
.blog-cover { margin: 16px 0 4px; }
.blog-cover img { width: 100%; height: 180px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border-color); display: block; }
.blog-loading { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 28px; }
.skeleton-card { height: 260px; border-radius: var(--radius-lg); border: 1px solid var(--border-color); background: linear-gradient(100deg, var(--card-bg) 40%, var(--card-hover) 50%, var(--card-bg) 60%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.blog-error { text-align: center; padding: 40px; border: 1px dashed var(--border-color); border-radius: var(--radius-lg); color: var(--text-muted); }
.blog-error .hero-actions { margin-top: 20px; }

/* Reader — full article on-site, opened as an overlay above the page */
.reader-overlay { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; padding: 24px; opacity: 0; transition: opacity 0.22s ease; }
.reader-overlay[hidden] { display: none; }
.reader-overlay.active { opacity: 1; }
.reader-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
body.reader-open { overflow: hidden; }
.blog-reader { position: relative; width: 100%; max-width: 820px; max-height: calc(100vh - 48px); margin: 0 auto; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 44px; overflow-y: auto; overscroll-behavior: contain; transform: translateY(24px) scale(0.985); transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1); }
.reader-overlay.active .blog-reader { transform: none; }
.reader-topbar { position: sticky; top: -44px; z-index: 3; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; padding: 10px 0 14px; background: linear-gradient(var(--card-bg) 75%, transparent); }
.reader-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.reader-title { font-size: 2rem; line-height: 1.25; letter-spacing: -0.02em; margin-bottom: 14px; }
.reader-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.reader-cover-wrap { margin-bottom: 28px; }
.reader-cover-wrap img { width: 100%; max-height: 380px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border-color); display: block; }
.reader-body { line-height: 1.85; font-size: 1.05rem; color: var(--text-primary); overflow-wrap: break-word; }
.reader-body p { margin-bottom: 1.2em; color: var(--text-primary); }
.reader-body h1, .reader-body h2, .reader-body h3, .reader-body h4 { margin: 1.8em 0 0.7em; line-height: 1.3; }
.reader-body ul, .reader-body ol { margin: 0 0 1.2em 1.4em; }
.reader-body li { margin-bottom: 0.5em; }
.reader-body a { color: var(--accent-blue); }
.reader-body img { max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border-color); margin: 1em 0; }
.reader-body pre { background: rgba(0,0,0,0.35); border: 1px solid var(--border-color); border-radius: 10px; padding: 18px; overflow-x: auto; margin: 1.2em 0; font-size: 0.88rem; line-height: 1.6; }
[data-theme="light"] .reader-body pre { background: #f0f0f3; }
.reader-body code { font-family: 'JetBrains Mono', monospace; font-size: 0.88em; background: rgba(255,255,255,0.06); padding: 2px 7px; border-radius: 6px; }
[data-theme="light"] .reader-body code { background: rgba(0,0,0,0.06); }
.reader-body pre code { background: none; padding: 0; }
.reader-body blockquote { border-left: 3px solid var(--accent-blue); padding: 8px 20px; margin: 1.2em 0; color: var(--text-muted); background: rgba(53,132,228,0.06); border-radius: 0 10px 10px 0; }
.reader-body .highlight { margin: 1.2em 0; }
.reader-bottom { margin-top: 36px; margin-bottom: 0; }

@media (max-width: 860px) {
    .reader-overlay { padding: 12px; }
    .blog-reader { max-height: calc(100vh - 24px); padding: 24px 18px; }
    .reader-topbar { top: -24px; }
    .reader-title { font-size: 1.5rem; }
}

/* B2B page */
.b2b-hero { padding: 90px 0 40px; }
.b2b-section-sub { color: var(--text-muted); max-width: 760px; line-height: 1.8; margin-top: 8px; }
.price-tag { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 1.15rem; color: var(--accent-blue); margin: 12px 0 4px; }
.check-list { list-style: none; margin: 16px 0 0; display: flex; flex-direction: column; gap: 10px; color: var(--text-muted); line-height: 1.7; }
.check-list li { padding-left: 28px; position: relative; }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: var(--accent-blue); font-weight: 700; }
.check-list strong { color: var(--text-primary); }
