/* ========================================
   BerezSoft CMS — Default Theme
   Author: BerezSoft
   Version: 1.0.0
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400;14..32,450;14..32,500;14..32,600&display=swap');

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-bg: #FAF9F6;
    --color-surface: #FFFFFF;
    --color-text: #2A2A28;
    --color-text-muted: #7A7A72;
    --color-accent: #5A6E4A;
    --color-accent-hover: #D4A259;
    --color-border: #E6E4DF;
    --color-overlay: rgba(0, 0, 0, 0.5);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --max-width: 1200px;
    --max-width-article: 720px;
    --radius: 6px;
}

body {
    font-family: var(--font-main);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ==================== Иконки ==================== */
.icon {
    width: 24px;
    height: 24px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    max-width: 100%;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 32px; height: 32px; }
.icon-muted { color: var(--color-text-muted); }

/* ==================== Шапка ==================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(250, 249, 246, 0.94);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    transition: padding 0.3s;
    padding: 20px 24px;
}

.header.scrolled {
    padding: 4px 16px;
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 500;
    font-size: 18px;
    white-space: nowrap;
    transition: font-size 0.3s;
}
.header.scrolled .header-logo {
    font-size: 14px;
}

.header-logo img {
    height: 32px;
    width: auto;
    transition: height 0.3s;
}
.header.scrolled .header-logo img {
    height: 22px;
}

.header-nav {
    display: flex;
    gap: 4px;
    margin-left: auto;
    align-items: center;
    flex-wrap: wrap;
}

.header-nav a {
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 15px;
    transition: color 0.2s, background 0.2s, font-size 0.3s, padding 0.3s;
}
.header.scrolled .header-nav a {
    font-size: 13px;
    padding: 4px 10px;
}

.header-nav a:hover,
.header-nav a.active {
    color: var(--color-accent);
    background: rgba(90, 110, 74, 0.06);
}

.header-burger {
    display: none;
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    font-size: 24px;
    padding: 4px 8px;
    line-height: 1;
    letter-spacing: 2px;
}

/* ==================== Основной контент ==================== */
.main {
    flex: 1;
    width: 100%;
    margin: 0 auto;
    padding: 96px 24px 80px;
}

.main-wide {
    max-width: var(--max-width);
}

.main-narrow {
    max-width: var(--max-width-article);
}

/* ==================== Сетка постов ==================== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 48px 24px;
}

.post-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease;
}

.post-card:hover {
    transform: translateY(-2px);
}

.post-card-category {
    font-size: 11px;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 2px;
    font-weight: 500;
}

.post-card-date {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 10px;
}

.post-card-image {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius);
    margin-bottom: 10px;
    background: #e8e6e0;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-card:hover .post-card-image img {
    transform: scale(1.02);
}

.post-card-title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 36px 14px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.55));
    color: #fff;
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.25;
}

.post-card-excerpt {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* ==================== Пагинация ==================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 56px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: var(--radius);
    font-size: 14px;
    text-decoration: none;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    background: var(--color-surface);
    transition: background 0.15s;
}

.pagination a:hover { background: #f5f4f0; }
.pagination span.current {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
    font-weight: 500;
}
.pagination span.disabled { color: #ccc; cursor: default; }

/* ==================== Страница поста ==================== */
.article-header {
    margin-bottom: 32px;
}

.article-category {
    font-size: 13px;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.article-date {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.article-title {
    font-size: 2.2rem;
    font-weight: 450;
    line-height: 1.25;
    margin-bottom: 8px;
}

.article-featured-image {
    width: 100%;
    border-radius: var(--radius);
    margin-bottom: 32px;
}

.article-content {
    font-size: 1.05rem;
    line-height: 1.7;
}

.article-content h2 { font-size: 1.5rem; font-weight: 450; margin: 32px 0 12px; }
.article-content h3 { font-size: 1.2rem; font-weight: 450; margin: 24px 0 8px; }
.article-content p { margin-bottom: 16px; }
.article-content ul, .article-content ol { margin: 8px 0 20px 24px; }
.article-content li { margin-bottom: 4px; }
.article-content blockquote {
    margin: 20px 0;
    padding: 12px 20px;
    border-left: 3px solid var(--color-accent);
    background: rgba(90, 110, 74, 0.05);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--color-text-muted);
    font-style: italic;
}
.article-content code {
    background: #f0f0ec;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
.article-content img {
    max-width: 100%;
    border-radius: var(--radius);
    margin: 12px 0;
}
.article-content a {
    color: var(--color-accent);
    text-decoration: none;
    border-bottom: 1px dotted var(--color-accent);
    transition: color 0.2s, border-color 0.2s;
}
.article-content a:hover {
    color: var(--color-accent-hover);
    border-bottom-style: solid;
}

/* ==================== Аудиоплеер ==================== */
.audio-block {
    margin-top: 48px;
    padding: 20px 24px;
    background: #f5f4f0;
    border-radius: var(--radius);
}

.audio-block audio {
    width: 100%;
    max-width: 600px;
    border-radius: var(--radius);
}

.audio-block-title {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

/* ==================== Теги ==================== */
.tags-block {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-link {
    font-size: 13px;
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 4px 12px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    transition: color 0.2s, border-color 0.2s;
}

.tag-link:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
}

/* ==================== Подвал ==================== */
.footer {
    text-align: center; color: var(--color-text-muted); font-size: 13px;
    padding: 24px 24px 32px; margin-top: 48px;
    background: #FEF8F0;
    border-top: 2px solid var(--color-accent-hover);
}

/* ==================== Галерея ==================== */
.gallery-shortcode {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 24px 0;
}

/* ==================== Лайтбокс ==================== */
.lightbox-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.lightbox-overlay.active { opacity: 1; visibility: visible; }
.lightbox-overlay img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}
.lightbox-close {
    position: absolute; top: 20px; right: 24px;
    background: none; border: none; color: #fff;
    font-size: 32px; cursor: pointer; z-index: 10;
    line-height: 1; padding: 8px;
}
.lightbox-prev, .lightbox-next {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.12); border: none;
    color: #fff; font-size: 28px; cursor: pointer;
    padding: 12px 16px; border-radius: 6px; z-index: 10;
    transition: background 0.2s;
}
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,0.25); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-caption {
    position: absolute; bottom: 24px; left: 50%;
    transform: translateX(-50%); color: #ccc;
    font-size: 14px; text-align: center;
}

/* ==================== Адаптивность ==================== */
@media (max-width: 900px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 36px 16px;
    }
    .gallery-shortcode {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header { padding: 14px 16px; }
    .header.scrolled { padding: 4px 12px; }
    .header-burger { display: block; margin-left: auto; }
    .header-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(250, 249, 246, 0.98);
        backdrop-filter: blur(10px);
        flex-direction: column;
        padding: 12px 16px;
        border-bottom: 1px solid var(--color-border);
        gap: 0;
    }
    .header-nav.open { display: flex; }
    .header-nav a { padding: 12px 8px; font-size: 16px; }
    .header.scrolled .header-nav a { font-size: 14px; padding: 8px; }
}

@media (max-width: 600px) {
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .gallery-shortcode {
        grid-template-columns: repeat(2, 1fr);
    }
    .main { padding: 80px 16px 64px; }
    .article-title { font-size: 1.6rem; }
    .post-card-title-overlay { font-size: 1rem; }
    .footer { padding: 24px 16px 64px; margin-top: 64px; }
}
/* ==================== Подменю ==================== */
.nav-item.has-submenu {
    position: relative;
}

.submenu-arrow {
    font-size: 10px;
    margin-left: 4px;
    transition: transform 0.2s;
}

.nav-item.has-submenu:hover .submenu-arrow {
    transform: rotate(180deg);
}

.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    min-width: 180px;
    z-index: 1001;
    padding: 6px 0;
}

.nav-item.has-submenu:hover .submenu {
    display: block;
}

.submenu a {
    display: block;
    padding: 8px 16px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.submenu a:hover,
.submenu a.active {
    background: rgba(90, 110, 74, 0.06);
    color: var(--color-accent);
}

@media (max-width: 768px) {
    .submenu {
        position: static;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0 0 0 16px;
    }

    .submenu a {
        padding: 8px 12px;
        font-size: 15px;
    }

    .nav-item.has-submenu:hover .submenu {
        display: block;
    }

    .submenu-arrow {
        display: none;
    }
}

/* ==================== Авторизация ==================== */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.auth-card {
    background: var(--color-surface);
    border-radius: 12px;
    padding: 40px 32px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    width: 100%;
    max-width: 420px;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 500;
    text-align: center;
    margin-bottom: 4px;
}

.auth-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 15px;
    margin-top: 8px;
}

.auth-link {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--color-text-muted);
}

.auth-link a {
    color: var(--color-accent);
    text-decoration: none;
}

/* ==================== Профиль ==================== */
.profile-wrapper {
    max-width: 600px;
    margin: 0 auto;
}

.profile-title {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 24px;
}

.profile-card {
    background: var(--color-surface);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    text-align: center;
}

.profile-avatar {
    margin-bottom: 16px;
}

.profile-avatar img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-avatar-placeholder {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: #e8e6e0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    color: var(--color-text-muted);
}

.profile-login {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.profile-bio {
    color: var(--color-text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.profile-details {
    width: 100%;
    text-align: left;
    margin-top: 20px;
}

.profile-details td {
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
}

.profile-details td:first-child {
    color: var(--color-text-muted);
    width: 40%;
}

.profile-actions {
    margin-top: 24px;
    text-align: center;
}