:root {
    --primary: #3EBA52;
    --primary-dark: #045C25;
    --bg-main: #051d10;
    --bg-card: #0a2a18;
    --text-main: #d2d2d2;
    --text-muted: #c8d5cd;
    --border-color: rgba(62, 186, 82, 0.15);
    --bg-header: var(--bg-main);
    --bg-menu: #082414;
    --shadow-card: rgba(0,0,0,0.2);
    --shadow-header: rgba(0,0,0,0.3);
    --bg-menu-btn: rgba(255, 255, 255, 0.05);
}

html.light-theme {
    --primary: #1a8a34;
    --primary-dark: #e6f7ea;
    --bg-main: #f4f7f5;
    --bg-card: #ffffff;
    --text-main: #1a2e22;
    --text-muted: #2d3d33;
    --border-color: rgba(26, 138, 52, 0.15);
    --bg-header: #ffffff;
    --bg-menu: #ffffff;
    --shadow-card: rgba(0,0,0,0.05);
    --shadow-header: rgba(0,0,0,0.05);
    --bg-menu-btn: rgba(0, 0, 0, 0.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    font-size: 18px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

a:hover {
    border-bottom-color: var(--primary);
}

header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 20px var(--shadow-header);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    border-bottom: none;
}
.logo img { height: 35px; width: auto; }

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.action-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--primary);
    width: 42px;
    height: 42px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease;
    flex-shrink: 0;
}
.action-btn:hover { border-color: var(--primary); }
.action-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.burger-btn svg { width: 24px; height: 24px; }

html.light-theme .icon-moon { display: none; }
html:not(.light-theme) .icon-sun { display: none; }

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.side-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 30%;
    height: 100%;
    background: var(--bg-menu);
    border-left: 1px solid var(--border-color);
    box-shadow: -5px 0 15px rgba(0,0,0,0.2);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease, background-color 0.3s ease;
}
.side-menu.active {
    right: 0;
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.menu-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-muted);
}

.close-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.close-btn:hover { color: var(--text-main); border-color: var(--text-muted); }
.close-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.menu-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-scroll::-webkit-scrollbar { width: 4px; }
.menu-scroll::-webkit-scrollbar-track { background: transparent; }
.menu-scroll::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.menu-scroll a {
    color: var(--text-muted);
    padding: 14px 20px;
    border-radius: 50px;
    background-color: var(--bg-menu-btn);
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    transition: color 0.2s ease, background-color 0.2s ease;
    display: block;
    border-bottom: none;
}

.menu-scroll a:hover { 
    color: var(--text-main); 
    background-color: var(--primary-dark); 
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.hero-title { font-size: 2.5rem; font-weight: 800; margin-bottom: 15px; color: var(--text-main); transition: color 0.3s ease; }
.hero-subtitle { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 50px; max-width: 600px; transition: color 0.3s ease; }

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    max-width: 1000px;
    width: 100%;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 30px 20px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-main);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    border-bottom: none;
}

.card svg { width: 40px; height: 40px; stroke: var(--primary); fill: none; stroke-width: 1.5; transition: transform 0.2s ease; stroke-linecap: round; stroke-linejoin: round; }
.card span { font-size: 1.1rem; font-weight: 600; }

.card:hover { border-color: var(--primary); box-shadow: 0 10px 25px var(--shadow-card); transform: translateY(-3px); }
.card:hover svg { transform: scale(1.1); }

.btn-russian {
    margin-top: 40px;
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 12px 35px;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-bottom: none;
}
.btn-russian:hover { background: var(--primary); color: var(--bg-main); }

.article-page {
    flex: 1;
    padding: 40px 20px 0;
    justify-content: flex-start;
    text-align: left;
}

.article-container {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.article-container h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 25px;
    color: var(--text-main);
}

.article-container h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 35px 0 15px;
    color: var(--text-main);
}

.article-container h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 25px 0 10px;
    color: var(--text-main);
}

.article-container p {
    margin-bottom: 15px;
    color: var(--text-main);
    line-height: 1.8;
}

.article-container ol,
.article-container ul {
    margin: 0 0 20px 0;
    padding-left: 20px;
    font-size: 18px;
    color: var(--text-main);
}

.article-container li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    line-height: 1.6;
}

.article-container li:last-child {
    border-bottom: none;
}

.article-container strong {
    color: var(--text-main);
    font-weight: 600;
}

.article-container img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 20px 0;
}

.article-container blockquote {
    border-left: 3px solid var(--primary);
    padding: 15px 20px;
    margin: 20px 0;
    background: var(--bg-card);
    border-radius: 0 8px 8px 0;
    color: var(--text-main);
    font-style: italic;
}

.article-container table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.95rem;
}

.article-container table th,
.article-container table td {
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    text-align: left;
    color: var(--text-main);
}

.article-container table th {
    background: var(--bg-card);
    font-weight: 700;
}

.prefooter {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 10px 0 50px;
    text-align: left;
}

.prefooter p {
    margin-bottom: 8px;
    color: var(--text-main);
}

footer {
    background: var(--bg-header);
    border-top: 1px solid var(--border-color);
    padding: 50px 20px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
}

.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 10px; }

.footer-col a {
    color: var(--text-muted);
    border-bottom: none;
    transition: color 0.2s ease;
}
.footer-col a:hover { color: var(--text-main); }

.footer-info p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 15px; transition: color 0.3s ease; }

@media (max-width: 768px) {
    body { font-size: 18px; }

    .side-menu { width: 80%; }
    
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .card { padding: 20px 10px; }
    .card span { font-size: 0.9rem; }
    .card svg { width: 32px; height: 32px; }

    .hero-title { font-size: 1.8rem; }
    .hero-subtitle { font-size: 1rem; }

    .article-page {
        padding: 25px 15px 0;
    }

    .article-container h1 {
        font-size: 1.4rem;
    }

    .article-container h2 {
        font-size: 1.2rem;
    }

    .article-container ol,
    .article-container ul {
        padding-left: 30px;
        font-size: 18px;
    }

    .article-container table th,
    .article-container table td {
        padding: 10px;
        font-size: 0.85rem;
    }
}