/* =====================================================================
   style.css — общие стили витрины (главная, категория, статья)
   Отступы — по шкале 4 / 8 / 12 / 16 / 24 / 32 px (переменные ниже).
   ===================================================================== */

:root {
    --accent: #c00;
    --accent-hover: #ff4a4e;
    --tint: #fcdcdc;          /* фон выделенных тизеров */
    --tint-border: #f7a9a9;
    --text: #222;
    --muted: #888;
    --line: #e7e7e7;
    --placeholder: #eee;      /* фон под картинкой, пока она грузится */

    --s1: 4px;
    --s2: 8px;
    --s3: 12px;
    --s4: 16px;
    --s5: 24px;
    --s6: 32px;

    --col-gap: 32px;          /* между основной колонкой и сайдбаром */
    --grid-gap: 20px;         /* между тизерами в сетках */
    --thumb: 100px;           /* миниатюры в списках и строках */
    --teaser-title: 19px;
}

/* ---------- Сброс ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

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

body {
    font-family: Roboto, Arial, sans-serif;
    color: var(--text);
    background: #fff;
    line-height: 1.5;
    overflow-x: hidden;
}

img, video { display: block; max-width: 100%; }
a { color: inherit; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--s4);
}

/* ---------- Шапка ---------- */
.top-header {
    border-bottom: 2px solid var(--line);
    margin-bottom: var(--s5);
}

.menu-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: var(--s4);
    min-height: 56px;
}

.menu-left {
    display: flex;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.menu-left::-webkit-scrollbar { display: none; }

.menu-left a {
    padding: 0 var(--s3);
    border-right: 1px solid #ccc;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}
.menu-left a:first-child { padding-left: 0; }
.menu-left a:last-child { border-right: 0; }
.menu-left a:hover { color: var(--accent-hover); text-decoration: underline; }

.menu-center { text-align: center; }
.logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .02em;
    text-decoration: none;
    white-space: nowrap;
}

.menu-right { justify-self: end; color: #999; }

/* ---------- Основной блок: колонка + сайдбар ---------- */
.main-content-block {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: var(--col-gap);
    align-items: start;
}

/* ---------- Главная новость (превью) ---------- */
.featured-image-container {
    position: relative;
    overflow: hidden;
    margin-bottom: var(--s3);
    background: var(--placeholder);
}
.featured-image {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.featured-title {
    margin-bottom: var(--s2);
    font-size: 26px;
    font-weight: 500;
    line-height: 1.25;
    color: #000;
}
.featured-title a { text-decoration: none; }
.featured-title a:hover { text-decoration: underline; }

.featured-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s4);
    margin-bottom: var(--s4);
    font-size: 13px;
    color: var(--muted);
}

.read-more-btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 3px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}
.read-more-btn:hover { background: #a00; }

/* ---------- Общее для всех тизеров ---------- */
.teaser-link { text-decoration: none; color: inherit; }

.tizer-img, .tizer-img-inline, .in-article-img, .mixed-img, .grid-tizer-img {
    object-fit: cover;
    background: var(--placeholder);
}

.tizer-text, .tizer-text-inline-img, .in-article-text, .mixed-text-title, .grid-tizer-text {
    font-size: var(--teaser-title);
    font-weight: 500;
    line-height: 1.3;
    color: #000;
}

.tizer-meta {
    display: block;
    margin-top: var(--s1);
    font-size: 12px;
    color: var(--muted);
}

.teaser-link:hover :is(.tizer-text, .tizer-text-inline-img, .in-article-text, .mixed-text-title, .grid-tizer-text) {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Тизер под превью и внутри текста статьи */
.in-article-tizers { margin-top: var(--s5); }
.in-article-tizers-wrapper { margin: var(--s5) 0; }

.in-article-tizer-item {
    padding: var(--s3);
    background: var(--tint);
    border: 1px solid var(--tint);
}
.in-article-tizer-item:hover { border-color: var(--tint-border); }

.in-article-link {
    display: flex;
    align-items: center;
    gap: var(--s3);
}
.in-article-img {
    flex: 0 0 var(--thumb);
    width: var(--thumb);
    height: var(--thumb);
}

/* ---------- Сайдбар ---------- */
.tizers-top-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s4);
    margin-bottom: var(--s2);
}

/* Крупные тизеры верхнего ряда (главная) */
.large-tizer-in-row {
    display: block;
    padding-bottom: var(--s3);
    border-bottom: 1px solid #eee;
}
.large-tizer-in-row .tizer-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    margin-bottom: var(--s2);
}

/* Карточки-сетки в верхнем ряду сайдбара (статья) */
.tizers-top-row .grid-tizer-item { height: 100%; }

/* Вертикальный список с миниатюрами */
.small-tizer-with-thumb {
    display: flex;
    align-items: center;
    gap: var(--s3);
    padding: var(--s3) 0;
    border-bottom: 1px solid #eee;
}
.tizers-vertical-list > .small-tizer-with-thumb:last-child { border-bottom: 0; }
.tizer-img-inline {
    flex: 0 0 var(--thumb);
    width: var(--thumb);
    height: var(--thumb);
}
.tizer-text-inline-img { flex: 1; min-width: 0; }

#side-tizers-load-more:empty { display: none; }

/* ---------- Лента под основным блоком ---------- */
.separator {
    height: 1px;
    margin: var(--s6) 0;
    border: 0;
    background: var(--line);
}

.section-title {
    margin-bottom: var(--s4);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    color: #000;
}

.bottom-tizers-grid {
    display: grid;
    gap: var(--grid-gap);
}
.three-tizers-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.four-tizers-grid  { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.grid-tizer-item {
    display: flex;
    flex-direction: column;
    border: 1px solid #d6d6d6;
}
.grid-tizer-item:hover { border-color: #bbb; }

.grid-tizer-img-container { background: var(--placeholder); }
.grid-tizer-img {
    width: 100%;
    aspect-ratio: 4 / 3;
}

.grid-tizer-text-block { padding: var(--s3) var(--s4) var(--s4); }

/* Строки по два горизонтальных тизера */
.mixed-row-two-cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--grid-gap);
}
.mixed-row-two-cols + .mixed-row-two-cols { margin-top: var(--grid-gap); }

.mixed-tizer-item {
    display: flex;
    align-items: center;
    gap: var(--s3);
    padding: var(--s3);
    border: 1px solid #e3e3e3;
}
.mixed-tizer-item:hover { border-color: #bbb; }
.mixed-img {
    flex: 0 0 var(--thumb);
    width: var(--thumb);
    height: var(--thumb);
}
.mixed-text-block { flex: 1; min-width: 0; }

/* ---------- Подгрузка и подвал ---------- */
.loading-spinner {
    padding: var(--s5) 0;
    text-align: center;
    color: #555;
}
.loader {
    width: 30px;
    height: 30px;
    margin: 0 auto var(--s2);
    border: 4px solid #f3f3f3;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.loader-side { padding: var(--s3) 0; }
.loader-small {
    width: 20px;
    height: 20px;
    margin: 0 auto;
    border: 3px solid #f3f3f3;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .loader, .loader-small { animation-duration: 3s; }
}

#end-of-content-sentinel { height: 1px; }

.footer {
    margin-top: var(--s6);
    padding: var(--s5) var(--s4);
    border-top: 1px solid #eee;
    text-align: center;
    font-size: 12px;
    color: #999;
}

/* =====================================================================
   Адаптивность
   ===================================================================== */

/* Планшеты и узкие ноутбуки */
@media (max-width: 1024px) {
    :root { --col-gap: 24px; --teaser-title: 17px; --thumb: 88px; }
    .four-tizers-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Телефоны и планшеты в портрете */
@media (max-width: 768px) {
    :root { --grid-gap: 16px; --teaser-title: 17px; --thumb: 88px; }

    .menu-bar {
        grid-template-columns: 1fr;
        gap: var(--s2);
        padding-block: var(--s3);
    }
    .menu-center { order: -1; }
    .menu-left { justify-content: flex-start; }
    .menu-right { display: none; }

    .main-content-block { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }

    .featured-title { font-size: 22px; }
    .separator { margin: var(--s5) 0; }

    .three-tizers-grid { grid-template-columns: minmax(0, 1fr); }
    .mixed-row-two-cols { grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
    .mixed-row-two-cols + .mixed-row-two-cols { margin-top: var(--s3); }
}

@media (max-width: 420px) {
    :root { --teaser-title: 16px; --thumb: 80px; }
    .container { padding: 0 var(--s3); }
    .four-tizers-grid { gap: var(--s3); }
    .grid-tizer-text-block { padding: var(--s2) var(--s3) var(--s3); }
    .tizers-top-row { gap: var(--s3); }
}

/* ---------- «Читайте также»: 4 статьи сайта в ряд ---------- */
.read-also-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--grid-gap); }
.read-also-item { display: flex; flex-direction: column; gap: var(--s2); text-decoration: none; color: inherit; }
.read-also-img { aspect-ratio: 16 / 10; overflow: hidden; background: var(--placeholder); }
.read-also-img img { width: 100%; height: 100%; object-fit: cover; }
.read-also-cat { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.read-also-title { font-size: 17px; font-weight: 700; line-height: 1.3; color: #000; }
.read-also-item:hover .read-also-title { color: var(--accent-hover); text-decoration: underline; }
@media (max-width: 1024px) { .read-also-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .read-also-title { font-size: 15px; } }
