:root {
    --bg: #0b1020;
    --panel: #0f172a;
    --text: #e5edff;
    --muted: #9aa8c7;
    --accent: #7aa2ff;
    --link: #9db6ff;
    --border: rgba(255, 255, 255, 0.08);
}

/* Светлая тема */
[data-theme="light"] {
    --bg: #f8f9fa;
    --panel: #ffffff;
    --text: #212529;
    --muted: #6c757d;
    --accent: #007bff;
    --link: #0d6efd;
    --border: rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    background: radial-gradient(circle at top, #162049, var(--bg) 60%);
    color: var(--text);
    font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    transition: background 0.3s ease, color 0.3s ease;
}

main.content {
    flex: 1; /* Растягивает основной контент, выталкивая футер вниз */
}

/* Для светлой темы меняем градиент */
[data-theme="light"] body {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.wrap {
    width: min(920px, 92vw);
    margin: 0 auto;
}

.site-header {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.04), transparent);
    border-bottom: 1px solid var(--border);
    padding: 18px 0;
}

[data-theme="light"] .site-header {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.02), transparent);
}

.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.2px;
    font-size: 20px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 12px; /* отступ между элементами */
}
.nav a {
    color: var(--muted);
    text-decoration: none;
    margin-left: 14px;
}

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

.content {
    padding: 36px 0 56px;
}

h1, h2, h3 {
    line-height: 1.2;
    margin-top: 1.2em;
}

a {
    color: var(--link);
}

code, pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

pre {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: auto;
}

[data-theme="light"] pre {
    background: rgba(0, 0, 0, 0.03);
}

.post {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 26px 24px;
}

[data-theme="light"] .post {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
}

.post-title {
    margin: 0 0 6px;
}

.post-meta {
    color: var(--muted);
    font-size: 13px;
}

.sep {
    border: none;
    border-top: 1px solid var(--border);
    margin: 28px 0 18px;
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 22px 0 36px;
    color: var(--muted);
    font-size: 13px;
}

/* Стили для кнопки */
#theme-toggle {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}
.tabs-section {
    margin: 20px 0;
}

/* Вкладки (кнопки переключения) */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.2);
}

/* Контент вкладок */
.tab-panel {
    display: none;
}

/* Категории внутри вкладок */
.category {
    margin-bottom: 30px;
}

.category-title {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Сетка ссылок */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

/* Карточка ссылки */
.link-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    transition: all 0.3s ease;
}

.link-item:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

/* Иконка ссылки */
.link-icon {
    margin-right: 10px;
    font-size: 18px;
}

/* Название ссылки */
.link-name {
    font-weight: 500;
    font-size: 14px;
}

/* Светлая тема — корректировка стилей */
[data-theme="light"] .tab-btn {
    background: #e9ecef;
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .tab-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

[data-theme="light"] .link-item {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .links-grid {
    gap: 14px;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        padding: 8px 12px;
        font-size: 14px;
    }

    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }

    .link-item {
        padding: 10px 14px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .tabs {
        justify-content: center;
    }

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

    .link-icon {
        margin-right: 8px;
        font-size: 16px;
    }
}

/* Анимации */
.tab-panel {
    animation: fadeIn 0.3s ease-in;
}

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

.link-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
}

.link-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Дополнительные состояния */
.link-item:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Стили для иконок (если используем Font Awesome или Tabler Icons) */
.link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

/* Улучшение доступности */
.tab-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Специальные стили для тёмной темы */
[data-theme="dark"] .tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .link-item:hover {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Оптимизация для печати */
@media print {
    .tabs-section {
        display: none;
    }

    body {
        background: white !important;
        color: black !important;
    }

    [data-theme] {
        --bg: white;
        --text: black;
    }
}

/* Плавный переход при смене темы */
#theme-root {
    transition: background 0.5s ease, color 0.5s ease;
}

/* Дополнительные стили для категорий */
.category {
    margin-bottom: 30px;
}

.category-title {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    padding-left: 12px;
}

.category-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 12px;
    background: var(--accent);
    border-radius: 2px;
}

/* Особые стили для очень маленьких экранов */
@media (max-width: 360px) {
    .wrap {
        padding: 0 10px;
    }

    .link-name {
        font-size: 12px;
    }

    .category-title {
        font-size: 12px;
    }
}

.link-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
}

/* Для тёмной темы */
[data-theme="dark"] .link-icon {
    opacity: 0.9;
}

/* Для светлой темы */
[data-theme="light"] .link-icon {
    opacity: 0.8;
}

/* Адаптация размера иконок */
@media (max-width: 768px) {
    .link-icon {
        width: 18px;
        height: 18px;
        margin-right: 8px;
    }
}
