:root {
    --bg-main: #e8e4df;
    --bg-container: #f5f3f0;
    --text-main: #2a2623;
    --text-muted: #6f6862;
    --border-color: #d4cdc4;
    --border-emphasis: #4a4541;
    --surface-strong: #3d3834;
    --on-strong: #f5f3f0;
    --surface-chip: #524c47;
    --on-chip: #f5f3f0;
    --nav-hover-bg: #5c554f;
    --nav-hover-text: #f5f3f0;
    --block-header-bg: #4a4541;
    --block-header-text: #f5f3f0;
    --accent-red: #a83248;
    --accent-blue: #3d5a80;
    --accent-on: #faf8f6;
    --input-bg: #ebe6e0;
    --shadow: 0 4px 24px rgba(42, 38, 35, 0.06);
}

body.dark-mode {
    color-scheme: dark;
    --bg-main: #131210;
    --bg-container: #1c1a18;
    --text-main: #e8e4df;
    --text-muted: #9c948c;
    --border-color: #2e2b28;
    --border-emphasis: #4a4541;
    --surface-strong: #252220;
    --on-strong: #e8e4df;
    --surface-chip: #35312e;
    --on-chip: #e8e4df;
    --nav-hover-bg: #35312e;
    --nav-hover-text: #e8e4df;
    --block-header-bg: #35312e;
    --block-header-text: #e8e4df;
    --accent-red: #d4657a;
    --accent-blue: #8aa4c8;
    --accent-on: #faf8f6;
    --input-bg: #131210;
    --shadow: none;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: clip;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.5;
    transition: background-color 0.15s ease, color 0.15s ease;
    overflow-x: clip;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
}

.site-layout {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 14px;
    max-width: 1500px;
    margin: 0 auto;
    padding: 18px 12px 28px;
}

.site-main {
    flex: 1;
    min-width: 0;
    max-width: 1140px;
}

.ad-rail {
    width: 130px;
    flex-shrink: 0;
    position: sticky;
    top: 18px;
}

#page-container {
    width: 100%;
    background-color: var(--bg-container);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    border-radius: 4px;
    overflow: hidden;
}

/* Шапка */
header {
    padding: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    border-bottom: 2px solid var(--border-emphasis);
}

header h1 {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: -1.5px;
    color: var(--text-main);
    white-space: nowrap;
}

header h1 span {
    color: var(--accent-red);
}

header .logo {
    flex: 1;
    min-width: 0;
}

.header-controls {
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-date {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

#theme-toggle {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* Навигация */
.main-nav-tabs {
    background-color: var(--surface-strong);
}

.main-nav-tabs ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}

.main-nav-tabs li {
    flex-grow: 0;
}

.main-nav-tabs li a {
    display: block;
    padding: 16px 24px;
    color: var(--on-strong);
    font-weight: 800;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.main-nav-tabs li.active a {
    background-color: var(--accent-red);
    color: var(--accent-on);
}

.main-nav-tabs li:not(.active) a:hover {
    background-color: var(--nav-hover-bg);
    color: var(--nav-hover-text);
}

/* Сетка контента */
.portal-grid {
    display: flex;
    padding: 25px;
    gap: 25px;
}

.sidebar {
    width: 230px;
    flex-shrink: 0;
}

.main-content {
    flex-grow: 1;
    min-width: 0;
}

.portal-block {
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-container);
    border-radius: 4px;
    overflow: hidden;
}

.portal-block-header {
    background-color: var(--block-header-bg);
    color: var(--block-header-text);
    padding: 10px 15px;
    font-weight: 900;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.portal-block-content {
    padding: 15px;
    background-color: var(--bg-container);
    color: var(--text-main);
}

.side-menu {
    list-style: none;
}

.side-menu li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.side-menu li:last-child {
    border-bottom: none;
}

.side-menu li a {
    color: var(--text-main);
    font-weight: 700;
    font-size: 14px;
}

.side-menu li a:hover {
    color: var(--accent-red);
}

/* Агрессивная лента новостей */
.breaking-news-hero {
    background-color: var(--bg-main);
    border: 2px solid var(--accent-red);
    padding: 30px;
    border-radius: 4px;
    margin-bottom: 30px;
}

.badge-sensation {
    background-color: var(--accent-red);
    color: var(--accent-on);
    font-weight: 900;
    font-size: 11px;
    text-transform: uppercase;
    padding: 4px 10px;
    letter-spacing: 1px;
    display: inline-block;
    margin-bottom: 15px;
    border-radius: 2px;
}

.hero-title {
    font-size: 32px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -0.8px;
    margin-bottom: 15px;
}

.hero-title a {
    color: var(--text-main);
}

.hero-title a:hover {
    color: var(--accent-red);
}

.hero-lead {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.6;
}

.hero-meta {
    font-size: 13px;
    font-weight: 800;
    color: var(--accent-red);
    text-transform: uppercase;
}

.section-title {
    font-size: 22px;
    font-weight: 900;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-emphasis);
    padding-bottom: 6px;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.news-list {
    list-style: none;
}

.news-item {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.news-item:first-child { padding-top: 0; }
.news-item:last-child { border-bottom: none; }

.news-item-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
}

.news-time {
    font-size: 11px;
    font-weight: 900;
    color: var(--on-chip);
    background-color: var(--surface-chip);
    padding: 3px 8px;
    border-radius: 2px;
}

.news-badge {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--accent-red);
}

.news-title {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.35;
}

.news-title a {
    color: var(--text-main);
}

.news-title a:hover {
    color: var(--accent-blue);
}

/* Страница архива */
.archive-post-item {
    border-bottom: 1px solid var(--border-color);
    padding: 25px 0;
    display: flex;
    gap: 20px;
}

.archive-post-item:first-child { padding-top: 0; }
.archive-post-item:last-child { border-bottom: none; }

.archive-post-thumb {
    width: 180px;
    height: 110px;
    background-color: var(--bg-main);
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.archive-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.archive-post-content {
    flex-grow: 1;
}

.archive-post-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.3;
}

.archive-post-title a {
    color: var(--text-main);
}

.archive-post-title a:hover {
    color: var(--accent-red);
}

.archive-post-excerpt {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.archive-post-meta {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 700;
}

.pagination {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border-emphasis);
    display: flex;
    gap: 6px;
}

.pagination a, .pagination span {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-container);
    color: var(--text-main);
    font-weight: 700;
}

.pagination span.current {
    background-color: var(--accent-red);
    color: var(--accent-on);
    border-color: var(--accent-red);
}

/* Страница одиночного поста */
.article-container h1 {
    font-size: 34px;
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 15px;
}

.article-meta {
    font-size: 13px;
    color: var(--text-muted);
    padding: 12px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
}

.article-text {
    font-size: 17px;
    line-height: 1.7;
}

.article-text p {
    margin-bottom: 20px;
}

.media-box {
    background-color: var(--bg-main);
    padding: 20px;
    margin: 35px 0;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.media-box img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 12px auto;
}

.video-mock {
    width: 100%;
    height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-strong);
    color: var(--on-strong);
    font-weight: 700;
}

.media-caption {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

/* Реклама и футер */
.ad-top-leaderboard {
    width: 100%;
    margin-bottom: 12px;
}

.ad-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background-color: var(--bg-container);
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.02em;
    text-align: center;
    padding: 16px 12px;
    border-radius: 4px;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.ad-placeholder:hover {
    border-color: var(--accent-red);
    color: var(--text-main);
}

.ad-placeholder--top {
    min-height: 72px;
}

.ad-placeholder--side {
    min-height: 520px;
    padding: 20px 10px;
    line-height: 1.4;
}

footer {
    background-color: var(--surface-strong);
    color: var(--on-strong);
    padding: 35px;
    text-align: center;
    font-size: 13px;
}

@media (max-width: 1180px) {
    .ad-rail {
        display: none;
    }

    .site-layout {
        padding: 10px 10px 20px;
    }
}

@media (max-width: 900px) {
    .ad-top-leaderboard {
        margin-bottom: 10px;
    }

    #page-container {
        border: none;
        border-radius: 0;
        box-shadow: none;
    }

    header {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        gap: 12px;
    }

    .logo {
        min-width: 0;
        width: 100%;
    }

    header h1 {
        text-align: center;
        white-space: normal;
        font-size: 26px;
        letter-spacing: -1px;
        line-height: 1.1;
        word-break: break-word;
    }

    .header-controls {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
        min-width: 0;
    }

    .header-date {
        white-space: normal;
        line-height: 1.35;
        flex: 1;
        min-width: 0;
        font-size: 11px;
    }

    #theme-toggle {
        flex-shrink: 0;
    }

    .main-nav-tabs ul {
        flex-direction: column;
    }

    .main-nav-tabs li {
        width: 100%;
    }

    .main-nav-tabs li a {
        padding: 12px 15px;
        text-align: center;
        border-bottom: 1px solid var(--border-color);
    }

    .main-nav-tabs li:last-child a {
        border-bottom: none;
    }

    .portal-grid {
        flex-direction: column;
        padding: 15px;
        gap: 20px;
        align-items: stretch;
    }

    .main-content {
        order: -1;
        width: 100%;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
    }

    .portal-block,
    .breaking-news-hero,
    .news-list,
    .archive-post-item,
    .pagination {
        width: 100%;
        max-width: 100%;
    }

    .breaking-news-hero {
        padding: 18px;
    }

    .hero-title {
        font-size: 22px;
        letter-spacing: -0.5px;
    }

    .hero-lead {
        font-size: 15px;
    }

    .news-title {
        font-size: 18px;
    }

    .section-title {
        font-size: 18px;
    }

    .article-container h1 {
        font-size: 26px;
    }

    .article-meta {
        flex-direction: column;
        gap: 6px;
        align-items: flex-start;
    }

    .archive-post-item {
        flex-direction: column;
        gap: 15px;
    }

    .archive-post-thumb {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 10;
    }

    .pagination {
        flex-wrap: wrap;
    }

    footer {
        padding: 25px 15px;
    }

    .video-mock {
        height: 220px;
    }
}
.zoomable {
    cursor: zoom-in;
    transition: opacity 0.2s;
}
.zoomable:hover {
    opacity: 0.9;
}
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    overflow: hidden;
}
.modal-content {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    transform-origin: center center; /* Зум от центра */
    will-change: transform;
}
.modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000; /* Выше картинки */
    user-select: none;
}