/* ==========================================================================
   Tenebros — тёмная дизайн-система
   ========================================================================== */

/* ---------- Переменные ---------- */
:root {
    /* Цветовая палитра */
    --bg-0: #0a0c10;
    --bg-1: #0f1218;
    --bg-2: #151a22;
    --bg-3: #1c222d;
    --surface: rgba(255, 255, 255, 0.03);
    --surface-hover: rgba(255, 255, 255, 0.06);

    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);

    --text-0: #f2f5f9;
    --text-1: #c3ccd9;
    --text-2: #8b96a7;
    --text-3: #5f6b7d;

    --accent: #6366f1;
    --accent-2: #8b5cf6;
    --accent-soft: rgba(99, 102, 241, 0.15);
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;

    --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);

    /* Тени */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --glow: 0 0 0 1px var(--accent-soft), 0 8px 32px rgba(99, 102, 241, 0.25);

    /* Геометрия */
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 22px;
    --radius-full: 999px;

    /* Типографика */
    --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --mono: 'JetBrains Mono', 'Consolas', monospace;

    /* Анимации */
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --fast: 160ms;
    --base: 280ms;
    --slow: 500ms;

    /* Размещение */
    --container: 1200px;
    --nav-h: 68px;
}

/* ---------- Сброс ---------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg-0);
    color: var(--text-1);
    line-height: 1.65;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Фоновое «сияние» — декоративный градиент */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(600px circle at 15% 10%, rgba(99, 102, 241, 0.12), transparent 45%),
        radial-gradient(700px circle at 85% 90%, rgba(217, 70, 239, 0.08), transparent 45%),
        var(--bg-0);
    pointer-events: none;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--fast) var(--ease);
}
a:hover { color: var(--accent-2); }

::selection {
    background: var(--accent);
    color: #fff;
}

/* ---------- Скроллбар ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb {
    background: var(--bg-3);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-1);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ---------- Типографика ---------- */
h1, h2, h3, h4 {
    color: var(--text-0);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
}
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.2rem; }
p { margin-bottom: 1em; }

.text-gradient {
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* ---------- Контейнер ---------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: clamp(16px, 4vw, 32px);
}

/* ---------- Навигация ---------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    background: rgba(15, 18, 24, 0.75);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border-bottom: 1px solid var(--border);
}
.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text-0);
    letter-spacing: -0.03em;
}
.brand__logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--gradient);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.1rem;
    box-shadow: var(--glow);
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
}
.nav-links a {
    display: inline-block;
    padding: 8px 14px;
    border-radius: var(--radius-full);
    color: var(--text-1);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--fast) var(--ease);
}
.nav-links a:hover {
    color: var(--text-0);
    background: var(--surface-hover);
}
.nav-links a.active {
    color: #fff;
    background: var(--accent-soft);
}
.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}
.nav-user__name {
    color: var(--text-1);
    font-size: 0.9rem;
    font-weight: 500;
}

/* ---------- Кнопки ---------- */
.btn {
    --btn-bg: var(--bg-3);
    --btn-fg: var(--text-0);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    background: var(--btn-bg);
    color: var(--btn-fg);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--fast) var(--ease), box-shadow var(--base) var(--ease), background var(--fast) var(--ease);
    user-select: none;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn--primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: var(--glow);
}
.btn--primary:hover { box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.4), 0 12px 40px rgba(99, 102, 241, 0.4); }

.btn--ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text-1);
}
.btn--ghost:hover { background: var(--surface-hover); color: var(--text-0); }

.btn--danger {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}
.btn--danger:hover { background: rgba(239, 68, 68, 0.2); }

.btn--sm { padding: 7px 14px; font-size: 0.85rem; }
.btn--block { width: 100%; }

/* Состояние загрузки кнопки */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    color: var(--text-0);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Поля форм ---------- */
.field { margin-bottom: 18px; }
.field label {
    display: block;
    margin-bottom: 7px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-1);
}
.input, .textarea, .select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-0);
    font-family: inherit;
    font-size: 0.98rem;
    transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
}
.input:focus, .textarea:focus, .select:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-1);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.select { cursor: pointer; }
.select option { background: var(--bg-2); color: var(--text-0); }

.field__error {
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--danger);
    min-height: 1em;
}
.field.has-error .input, .field.has-error .textarea {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* ---------- Карточки ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(8px);
}

/* ---------- Бейджи ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--accent-soft);
    color: #c7d2fe;
    border: 1px solid rgba(99, 102, 241, 0.25);
}
.badge--muted {
    background: var(--surface);
    color: var(--text-2);
    border-color: var(--border);
}
.badge--danger {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

/* ---------- Аватар ---------- */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-strong);
    flex-shrink: 0;
}
.avatar--sm { width: 30px; height: 30px; }
.avatar--lg { width: 72px; height: 72px; }

/* ==========================================================================
   ГЛАВНАЯ / ЛЕНТА
   ========================================================================== */
.hero {
    padding: 56px 0 32px;
    text-align: center;
    position: relative;
}
.hero__title {
    font-size: clamp(2.2rem, 6vw, 3.6rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 14px;
    line-height: 1.1;
}
.hero__subtitle {
    max-width: 560px;
    margin: 0 auto 28px;
    color: var(--text-2);
    font-size: 1.08rem;
}

/* Панель инструментов ленты */
.feed-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 8px 0 26px;
}
.search-box {
    position: relative;
    flex: 1;
    min-width: 240px;
    max-width: 460px;
}
.search-box__icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    font-size: 1rem;
    pointer-events: none;
}
.search-box .input { padding-left: 44px; }

.chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.chip {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-1);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--fast) var(--ease);
}
.chip:hover { background: var(--surface-hover); color: var(--text-0); }
.chip.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: #c7d2fe;
}

/* Сетка статей */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 22px;
    margin-bottom: 40px;
}

.post-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform var(--base) var(--ease), border-color var(--base) var(--ease), box-shadow var(--base) var(--ease);
    animation: fadeUp 0.5s var(--ease) both;
}
.post-card:hover {
    transform: translateY(-6px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
}
.post-card__cover {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-2);
}
.post-card__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease);
}
.post-card:hover .post-card__cover img { transform: scale(1.06); }
.post-card__cover--empty {
    display: grid;
    place-items: center;
    font-size: 2.4rem;
    background:
        linear-gradient(135deg, rgba(99,102,241,0.12), rgba(217,70,239,0.08)),
        var(--bg-2);
    color: var(--text-3);
}
.post-card__body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}
.post-card__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-2);
}
.post-card__meta .author {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-1);
    font-weight: 500;
}
.post-card__title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.35;
}
.post-card__title a {
    color: var(--text-0);
    transition: color var(--fast) var(--ease);
}
.post-card__title a:hover { color: var(--accent); }
.post-card__excerpt {
    color: var(--text-2);
    font-size: 0.94rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post-card__actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* Кнопки действий (лайк, комментарии) */
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    color: var(--text-2);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--fast) var(--ease);
}
.action-btn:hover { background: var(--surface-hover); color: var(--text-0); }
.action-btn.liked {
    color: #f87171;
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
}
.action-btn .icon { transition: transform 0.3s var(--ease); }
.action-btn:active .icon { transform: scale(1.3); }

/* Анимация «сердечка» */
@keyframes pop {
    0% { transform: scale(1); }
    40% { transform: scale(1.4); }
    100% { transform: scale(1); }
}
.pop { animation: pop 0.4s var(--ease); }

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 70px 20px;
    color: var(--text-2);
}
.empty-state__icon {
    font-size: 3.4rem;
    margin-bottom: 16px;
    opacity: 0.7;
}

/* ---------- Пагинация ---------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 12px 0 40px;
}
.pagination__btn {
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-1);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--fast) var(--ease);
}
.pagination__btn:hover:not(:disabled) { background: var(--surface-hover); color: var(--text-0); }
.pagination__btn.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: #c7d2fe;
}
.pagination__btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ==========================================================================
   Сайдбар
   ========================================================================== */
.layout-main {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    align-items: start;
    padding-bottom: 60px;
}
.sidebar {
    position: sticky;
    top: calc(var(--nav-h) + 20px);
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.widget {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
}
.widget__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-0);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cat-list { list-style: none; }
.cat-list li { margin-bottom: 4px; }
.cat-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-1);
    font-size: 0.92rem;
    transition: all var(--fast) var(--ease);
}
.cat-list a:hover { background: var(--surface-hover); color: var(--text-0); padding-left: 16px; }
.cat-list a.active { background: var(--accent-soft); color: #c7d2fe; }
.cat-list .count {
    font-size: 0.8rem;
    color: var(--text-3);
    background: var(--bg-3);
    padding: 2px 9px;
    border-radius: var(--radius-full);
}
.popular-list { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.popular-item { display: flex; gap: 12px; align-items: flex-start; }
.popular-item__num {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-3);
    line-height: 1;
    min-width: 24px;
}
.popular-item a { color: var(--text-1); font-size: 0.9rem; font-weight: 500; line-height: 1.4; }
.popular-item a:hover { color: var(--accent); }

/* ==========================================================================
   Страница статьи
   ========================================================================== */
.post-header {
    max-width: 820px;
    margin: 0 auto;
    padding: 40px 0 28px;
}
.post-header__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.post-header h1 {
    font-size: clamp(1.9rem, 5vw, 2.9rem);
    margin-bottom: 20px;
}
.post-author {
    display: flex;
    align-items: center;
    gap: 12px;
}
.post-author__info { display: flex; flex-direction: column; }
.post-author__name {
    color: var(--text-0);
    font-weight: 600;
    font-size: 0.95rem;
}
.post-author__date { color: var(--text-3); font-size: 0.82rem; }

.post-cover {
    max-width: 900px;
    margin: 0 auto 34px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}
.post-cover img { width: 100%; max-height: 520px; object-fit: cover; }

.post-content {
    max-width: 820px;
    margin: 0 auto;
    font-size: 1.08rem;
    line-height: 1.8;
    color: var(--text-1);
}
.post-content h2, .post-content h3 {
    margin: 2em 0 0.8em;
    color: var(--text-0);
}
.post-content h2 { font-size: 1.6rem; }
.post-content h3 { font-size: 1.3rem; }
.post-content p { margin-bottom: 1.4em; }
.post-content ul, .post-content ol {
    margin: 0 0 1.4em 1.4em;
    color: var(--text-1);
}
.post-content li { margin-bottom: 0.5em; }
.post-content strong { color: var(--text-0); font-weight: 600; }
.post-content a { text-decoration: underline; text-underline-offset: 3px; }
.post-content code {
    font-family: var(--mono);
    background: var(--bg-2);
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.9em;
    color: #c7d2fe;
}
.post-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 4px 20px;
    margin: 1.5em 0;
    color: var(--text-2);
    background: var(--surface);
    border-radius: 0 var(--radius) var(--radius) 0;
}

/* Блок действий статьи */
.post-actions-bar {
    max-width: 820px;
    margin: 36px auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 18px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.post-actions-bar__left, .post-actions-bar__right {
    display: flex;
    align-items: center;
    gap: 14px;
}
.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text-1);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--fast) var(--ease);
}
.like-btn:hover { background: var(--surface-hover); }
.like-btn.liked {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}
.like-btn.liked .icon { animation: pop 0.4s var(--ease); }

/* ==========================================================================
   Комментарии
   ========================================================================== */
.comments-section {
    max-width: 820px;
    margin: 0 auto 60px;
}
.comments-section__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    font-size: 1.35rem;
}
.comment-form {
    display: flex;
    gap: 14px;
    margin-bottom: 30px;
}
.comment-form textarea { min-height: 90px; }
.comment-form__actions {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.comment-tree { display: flex; flex-direction: column; gap: 18px; }
.comment {
    display: flex;
    gap: 14px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    animation: fadeUp 0.4s var(--ease) both;
}
.comment__body { flex: 1; min-width: 0; }
.comment__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.comment__author { color: var(--text-0); font-weight: 600; font-size: 0.92rem; }
.comment__time { color: var(--text-3); font-size: 0.8rem; }
.comment__text { color: var(--text-1); font-size: 0.96rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.comment__actions { margin-top: 8px; display: flex; gap: 10px; }
.comment__actions button {
    background: none;
    border: none;
    color: var(--text-3);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all var(--fast) var(--ease);
}
.comment__actions button:hover { color: var(--text-0); background: var(--surface-hover); }
.comment__actions button.danger:hover { color: #fca5a5; background: rgba(239,68,68,0.1); }
.comment--reply {
    margin-left: 24px;
    border-left: 2px solid var(--accent-soft);
}
.comment-children {
    margin-left: 54px;
    padding-left: 16px;
    border-left: 2px solid var(--accent-soft);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.reply-form { margin-top: 12px; display: none; gap: 10px; }
.reply-form.open { display: flex; }

/* ==========================================================================
   Аутентификация
   ========================================================================== */
.auth-wrap {
    min-height: calc(100vh - var(--nav-h));
    display: grid;
    place-items: center;
    padding: 40px 20px;
}
.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 38px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    animation: fadeUp 0.5s var(--ease) both;
}
.auth-card__logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    border-radius: 16px;
    background: var(--gradient);
    display: grid;
    place-items: center;
    font-size: 1.7rem;
    color: #fff;
    box-shadow: var(--glow);
}
.auth-card h1 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 6px;
}
.auth-card__subtitle {
    text-align: center;
    color: var(--text-2);
    font-size: 0.92rem;
    margin-bottom: 28px;
}
.auth-switch {
    text-align: center;
    margin-top: 22px;
    font-size: 0.9rem;
    color: var(--text-2);
}
.auth-switch a { font-weight: 600; }

/* Капча на формах входа/регистрации */
.captcha { display: flex; gap: 10px; }
.captcha .input { flex: 1; min-width: 0; }
.captcha__img {
    width: 190px;
    height: auto;
    aspect-ratio: 19 / 7;
    flex: none;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-2);
    cursor: pointer;
}
.captcha__refresh {
    flex: none;
    padding: 0 14px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-2);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.captcha__refresh:hover { color: var(--text-0); border-color: var(--accent); }
.field.has-error .captcha .input,
.field.has-error .captcha__img {
    border-color: var(--danger);
}

/* ==========================================================================
   Профиль / ЛК
   ========================================================================== */
.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 30px;
    flex-wrap: wrap;
}
.profile-header__info { flex: 1; min-width: 200px; }
.profile-header__name { font-size: 1.6rem; margin-bottom: 4px; }
.profile-header__bio { color: var(--text-2); font-size: 0.95rem; max-width: 480px; }
.profile-header__stats {
    display: flex;
    gap: 28px;
    margin-top: 16px;
}
.stat { display: flex; flex-direction: column; }
.stat__num { font-size: 1.4rem; font-weight: 800; color: var(--text-0); }
.stat__label { font-size: 0.8rem; color: var(--text-3); }

.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.tab {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    color: var(--text-2);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--fast) var(--ease);
}
.tab:hover { color: var(--text-0); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; animation: fadeUp 0.4s var(--ease) both; }
.tab-panel.active { display: block; }

.my-posts { display: flex; flex-direction: column; gap: 14px; }
.my-post-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--fast) var(--ease);
}
.my-post-row:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.my-post-row__title { font-weight: 600; color: var(--text-0); font-size: 1rem; }
.my-post-row__meta { font-size: 0.82rem; color: var(--text-3); margin-top: 3px; }
.my-post-row__actions { display: flex; gap: 8px; }

/* ==========================================================================
   Админка
   ========================================================================== */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}
.stat-card {
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--fast) var(--ease);
    animation: fadeUp 0.5s var(--ease) both;
}
.stat-card:hover { border-color: var(--accent); box-shadow: var(--glow); }
.stat-card__icon { font-size: 1.6rem; margin-bottom: 12px; }
.stat-card__num { font-size: 2rem; font-weight: 800; color: var(--text-0); line-height: 1; }
.stat-card__label { font-size: 0.85rem; color: var(--text-2); margin-top: 6px; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}
.admin-table th, .admin-table td {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
}
.admin-table th { color: var(--text-2); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.admin-table td { color: var(--text-1); }
.admin-table tr:hover td { background: var(--surface); }
.admin-table .actions { display: flex; gap: 8px; }

/* ==========================================================================
   Toast-уведомления
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 380px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    color: var(--text-0);
    font-size: 0.92rem;
    font-weight: 500;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.4s var(--ease), opacity 0.4s var(--ease);
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast__icon { font-size: 1.2rem; }
.toast--success { border-left: 3px solid var(--success); }
.toast--error { border-left: 3px solid var(--danger); }
.toast--info { border-left: 3px solid var(--accent); }

/* ==========================================================================
   Анимации
   ========================================================================== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.94); }
    to { opacity: 1; transform: scale(1); }
}
.anim-fade-up { animation: fadeUp 0.5s var(--ease) both; }
.anim-fade-in { animation: fadeIn 0.4s var(--ease) both; }
.anim-scale-in { animation: scaleIn 0.4s var(--ease) both; }

/* Плавное появление при скролле (управляется JS) */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* Скрет-скелетон загрузки */
.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--bg-2);
    border-radius: var(--radius);
}
.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

/* Уважение к prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   Адаптивность
   ========================================================================== */
@media (max-width: 980px) {
    .layout-main { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        order: -1;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .widget { flex: 1; min-width: 260px; }
}

@media (max-width: 980px) {
    .admin-layout { grid-template-columns: 1fr !important; }
}

/* ==========================================================================
   Гамбургер-меню (мобильные)
   ========================================================================== */
.nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 200;
}
.nav-hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-1);
    transition: all 0.3s ease;
}
.nav-hamburger.is-active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.nav-hamburger.is-active span:nth-child(2) {
    opacity: 0;
}
.nav-hamburger.is-active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ==========================================================================
   Адаптивность
   ========================================================================== */
@media (max-width: 980px) {
    .layout-main { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        order: -1;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .widget { flex: 1; min-width: 260px; }
}

@media (max-width: 980px) {
    .admin-layout { grid-template-columns: 1fr !important; }
}

@media (max-width: 768px) {
    :root { --nav-h: 60px; }
    
    /* Гамбургер-меню */
    .nav-hamburger {
        display: flex;
    }
    
    .nav-links {
        position: fixed;
        top: var(--nav-h);
        left: 0;
        right: 0;
        background: rgba(15, 18, 24, 0.98);
        backdrop-filter: blur(16px);
        flex-direction: column;
        padding: 20px;
        gap: 8px;
        border-bottom: 1px solid var(--border);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 150;
        max-height: calc(100vh - var(--nav-h));
        overflow-y: auto;
    }
    
    .nav-links--open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-links a {
        display: block;
        padding: 12px 16px;
        border-radius: var(--radius);
        font-size: 1rem;
    }
    
    .nav-user__name { display: none; }
    .hero { padding: 36px 0 24px; }
    .feed-toolbar { flex-direction: column; align-items: stretch; }
    .search-box { max-width: none; }
    .post-grid { grid-template-columns: 1fr; }
    .profile-header { padding: 26px; gap: 18px; }
    .profile-header__stats { gap: 20px; }
    .comment--reply { margin-left: 24px; }
    .auth-card { padding: 28px 22px; }
    .toast-container { left: 16px; right: 16px; bottom: 16px; max-width: none; }
    .admin-table { display: block; overflow-x: auto; }
    .admin-stats { grid-template-columns: repeat(2, 1fr); }
    
    /* Капча на мобильных: поле ввода ниже картинки */
    .captcha {
        flex-direction: column;
        align-items: stretch;
    }
    .captcha__img {
        width: 100%;
        max-width: 260px;
        margin: 0 auto;
    }
    .captcha .input {
        width: 100%;
    }
}
