/* ========================================
   БАЗОВЫЕ ПЕРЕМЕННЫЕ И СБРОС
   ======================================== */
:root {
    --bg: #f0f7f4;
    --card-bg: #ffffff;
    --text: #1e3a2f;
    --text-secondary: #5a7d6c;
    --accent: #2d8a56;
    --accent-hover: #237045;
    --accent-light: #e8f5ee;
    --border: #dce8e2;
    --radius: 16px;
    --shadow: 0 4px 16px rgba(45, 138, 86, 0.06);
    --shadow-hover: 0 8px 28px rgba(45, 138, 86, 0.12);
    --transition: 0.25s ease;
    --max-width: 600px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #e8f5ee 0%, #d4ede0 30%, #f0f7f4 70%, #c8e6d4 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    background-attachment: fixed;
}

.app-wrapper {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

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

/* ========================================
   КОМПОНЕНТЫ: КНОПКИ
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 8px 25px rgba(45, 138, 86, 0.3);
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 14px 35px rgba(45, 138, 86, 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-outline:hover {
    background: var(--accent-light);
}

/* ========================================
   КОМПОНЕНТЫ: КАРТОЧКА ПРОФИЛЯ
   ======================================== */
.profile-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px 20px;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--accent);
    padding: 3px;
    background: var(--accent-light);
    margin: 0 auto 14px;
    transition: transform var(--transition);
}

.profile-avatar:hover {
    transform: scale(1.03);
}

.profile-name {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-bio {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 400px;
    margin: 0 auto 14px;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-number {
    font-weight: 700;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ========================================
   КОМПОНЕНТЫ: ТВИТ (пост в блоге)
   ======================================== */
.tweet {
    display: flex;
    gap: 12px;
    padding: 16px 18px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.tweet:hover {
    background: #fafffc;
}

.tweet-avatar img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.tweet-content {
    flex: 1;
    min-width: 0;
}

.tweet-header {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.tweet-name {
    font-weight: 700;
}

.tweet-username,
.tweet-dot,
.tweet-date {
    color: var(--text-secondary);
}

.tweet-body {
    font-size: 0.95rem;
    line-height: 1.6;
}

.tweet-preview {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tweet-thumbnail {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    border-radius: 12px;
    margin: 10px 0 12px;
    border: 1px solid var(--border);
}

.read-more-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--accent);
    transition: gap var(--transition);
}

.read-more-link:hover {
    gap: 12px;
}

/* ========================================
   КОМПОНЕНТЫ: ПОЛНЫЙ ПОСТ
   ======================================== */
.post-full {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px 28px;
    box-shadow: var(--shadow);
}

.post-full-header {
    margin-bottom: 24px;
}

.post-full-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.post-full-author img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
    padding: 2px;
}

.post-full-author-name {
    font-weight: 700;
}

.post-full-author-username {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.post-full-title {
    font-size: 1.8rem;
    line-height: 1.3;
    margin-bottom: 12px;
}

.post-full-meta {
    display: flex;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.post-full-body {
    font-size: 1.05rem;
    line-height: 1.8;
}

.post-full-body p {
    margin-bottom: 16px;
}

.post-full-body p:last-child {
    margin-bottom: 0;
}

.post-full-body .post-image {
    margin: 28px 0;
    text-align: center;
}

.post-full-body .post-image img {
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform var(--transition);
}

.post-full-body .post-image img:hover {
    transform: scale(1.01);
}

.post-full-body .post-image figcaption {
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
}

.post-full-footer {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.post-tag {
    background: var(--accent-light);
    color: var(--accent);
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    transition: all var(--transition);
}

.post-tag:hover {
    background: var(--accent);
    color: #fff;
}

.post-share {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.share-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    transition: all var(--transition);
    font-size: 1rem;
}

.share-link:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-2px);
}

/* ========================================
   НАВИГАЦИЯ
   ======================================== */
.main-nav {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.95);
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 24px;
    padding: 0;
    margin: 0;
    justify-content: center;
}

.main-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 6px 0;
    transition: color var(--transition);
    border-bottom: 2px solid transparent;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

@media (max-width: 480px) {
    .main-nav ul {
        gap: 16px;
    }
    .main-nav a {
        font-size: 0.85rem;
    }
}
/* ========================================
   НАВИГАЦИЯ МЕЖДУ ПОСТАМИ
   ======================================== */
.post-nav {
    display: flex;
    gap: 16px;
    margin-top: 24px;
}

.post-nav-link {
    flex: 1;
    background: var(--card-bg);
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: all var(--transition);
}

.post-nav-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.post-nav-link.prev { text-align: left; }
.post-nav-link.next { text-align: right; margin-left: auto; }
.post-nav-link.placeholder { visibility: hidden; }

.post-nav-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.post-nav-title {
    font-weight: 600;
    font-size: 0.95rem;
}

/* ========================================
   ХЛЕБНЫЕ КРОШКИ
   ======================================== */
.breadcrumbs {
    padding: 12px 0 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.breadcrumbs ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.breadcrumbs li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.breadcrumbs li:not(:last-child)::after {
    content: '›';
    color: var(--text-secondary);
}

/* ========================================
   ХЕДЕР САЙТА
   ======================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}

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

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: var(--accent);
}

.back-link:hover {
    color: var(--accent-hover);
}

/* ========================================
   ФУТЕР
   ======================================== */
.site-footer {
    text-align: center;
    padding: 30px 0 20px;
}

/* ========================================
   COOKIE БАННЕР
   ======================================== */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: none;
    width: 90%;
    max-width: 600px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.cookie-banner.visible {
    display: block;
}

.cookie-banner.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
}

.cookie-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--border);
}

.cookie-icon {
    font-size: 1.6rem;
    color: var(--accent);
    flex-shrink: 0;
}

.cookie-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.cookie-actions {
    display: flex;
    gap: 8px;
}

.cookie-btn {
    padding: 8px 18px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
}

.cookie-btn-accept {
    background: var(--accent);
    color: #fff;
}

.cookie-btn-accept:hover {
    background: var(--accent-hover);
}

.cookie-btn-decline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.cookie-btn-decline:hover {
    background: #f5f5f5;
}

/* ========================================
   МОДАЛЬНОЕ ОКНО
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 4px;
    transition: all var(--transition);
}

.modal-close:hover {
    color: var(--text);
    background: #f0f0f0;
    border-radius: 50%;
}

.modal-body {
    padding: 20px 24px 24px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.modal-body h3 {
    color: var(--text);
    margin: 16px 0 8px;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body ul {
    margin: 8px 0 12px 20px;
}

/* ========================================
   ПОСЛЕДНИЕ ПОСТЫ (на главной)
   ======================================== */
.latest-posts {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.latest-posts-title {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.latest-posts-title i {
    color: var(--accent);
}

.latest-posts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.latest-post-item {
    display: block;
    background: var(--accent-light);
    padding: 14px 16px;
    border-radius: 12px;
    transition: all var(--transition);
    border: 1px solid transparent;
}

.latest-post-item:hover {
    background: #d4ede0;
    border-color: var(--accent);
    transform: translateX(4px);
}

.latest-post-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
}

.latest-post-title {
    font-weight: 600;
    color: var(--text);
}

.latest-post-excerpt {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.latest-posts-skeleton {
    background: var(--accent-light);
    padding: 14px 16px;
    border-radius: 12px;
}

.skeleton-line {
    height: 10px;
    background: #c8ddd2;
    border-radius: 4px;
    margin-bottom: 8px;
    animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-line-short { width: 30%; }
.skeleton-line-medium { width: 70%; }

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.all-posts-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.all-posts-link:hover {
    gap: 10px;
}

/* ========================================
   ГЛАВНАЯ СТРАНИЦА (карточка)
   ======================================== */
.home-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 40px 32px 32px;
    box-shadow: var(--shadow);
    text-align: center;
    margin: 20px 0;
    position: relative;
    border: 1px solid rgba(45, 138, 86, 0.08);
}

.home-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--accent);
    border-radius: 0 0 4px 4px;
}

.home-avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--accent);
    padding: 4px;
    background: var(--accent-light);
    margin: 0 auto 18px;  /* ← Убедитесь, что здесь auto */
    display: block;        /* ← Добавьте это */
    transition: transform var(--transition);
    flex-shrink: 0;        /* ← Добавьте это */
}

.home-avatar:hover {
    transform: scale(1.04);
}

/* Дополнительно, если аватарка всё ещё съезжает, добавьте обёртку */
.home-avatar-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 18px;
}

.home-avatar-wrapper .home-avatar {
    margin: 0;  /* Убираем margin у самой аватарки */
}

.home-name {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.home-role {
    color: var(--accent);
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 16px;
}

.home-bio {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 8px;
}

.contacts {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0 8px;
}

.contact-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 22px;
    border-radius: 50px;
    background: var(--accent-light);
    color: var(--text);
    font-weight: 500;
    transition: all var(--transition);
}

.contact-item i,
.contact-item svg {
    color: var(--accent);
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.contact-item:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-2px);
}

.contact-item:hover i,
.contact-item:hover svg {
    color: #fff;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 1.2rem;
    transition: all var(--transition);
}

.social-link:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-3px) scale(1.05);
}

.privacy-link {
    margin-top: 20px;
    font-size: 0.85rem;
}

.privacy-link a {
    color: var(--text-secondary);
    border-bottom: 1px dashed var(--text-secondary);
}

.privacy-link a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ========================================
   КНОПКА "ЗАГРУЗИТЬ ЕЩЁ"
   ======================================== */
.load-more {
    text-align: center;
    padding: 20px 0;
}

/* ========================================
   АДАПТИВНОСТЬ
   ======================================== */
@media (max-width: 600px) {
    .app-wrapper {
        padding: 0 12px;
    }
    
    .home-card {
        padding: 30px 18px 24px;
    }
    
    .home-avatar {
        width: 120px;
        height: 120px;
    }
    
    .home-name {
        font-size: 1.6rem;
    }
    
    .post-full {
        padding: 20px 16px;
    }
    
    .post-full-title {
        font-size: 1.4rem;
    }
    
    .post-full-body {
        font-size: 1rem;
    }
    
    .post-nav {
        flex-direction: column;
    }
    
    .post-nav-link.next {
        margin-left: 0;
    }
    
    .tweet {
        padding: 14px 14px;
    }
    
    .cookie-content {
        flex-direction: column;
        text-align: center;
    }
    
    .cookie-actions {
        width: 100%;
        justify-content: center;
    }
    
    .cookie-btn {
        flex: 1;
    }
    
    .modal {
        max-height: 90vh;
        border-radius: var(--radius) var(--radius) 0 0;
        margin-top: auto;
    }
    
    .tweet-thumbnail {
        max-height: 200px;
    }
}

@media (max-width: 400px) {
    .profile-stats {
        flex-direction: column;
        gap: 6px;
    }
    
    .stat {
        justify-content: center;
    }
}