/* ==========================================================================
   1. ДИЗАЙН-СИСТЕМА (ПЕРЕМЕННЫЕ) — легко менять цвета в одном месте
   ========================================================================== */
:root {
    --brand-red: #dc1414;
    --brand-red-hover: #b80f0f;
    --brand-red-soft: rgba(220, 20, 20, 0.12);
    --bg-dark: #0e0f12;
    --bg-surface: #ffffff;
    --bg-subtle: #f6f7f9;
    --text-main: #181a1f;
    --text-muted: #5c6370;
    --border-light: #e5e7eb;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.09);
    --shadow-red: 0 6px 18px rgba(220, 20, 20, 0.28);
    --transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ==========================================================================
   2. БАЗОВЫЕ НАСТРОЙКИ И СОВРЕМЕННАЯ ТИПОГРАФИКА
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
    font-size: clamp(14.5px, 1.1vw, 16px);
    line-height: 1.65;
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

img, video, iframe {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

/* Плавные адаптивные заголовки */
h1 {
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 18px;
    color: var(--text-main);
}

h2 {
    font-size: clamp(20px, 2.4vw, 26px);
    line-height: 1.28;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin-bottom: 14px;
}

h3 {
    font-size: clamp(17px, 1.8vw, 21px);
    line-height: 1.35;
    font-weight: 600;
    margin-bottom: 12px;
}

h4 {
    font-size: 16px;
    line-height: 1.4;
    font-weight: 600;
}

p {
    margin-bottom: 15px;
    color: #2b2f36;
}

a {
    transition: var(--transition);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
}

ul, ol {
    line-height: 1.7;
    padding-left: 22px;
    margin-bottom: 16px;
}

li::marker {
    color: var(--brand-red);
    font-weight: 700;
}

small, .small {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
}

/* ==========================================================================
   3. КНОПКИ И ЭЛЕМЕНТЫ УПРАВЛЕНИЯ (CTA)
   ========================================================================== */
button,
.btn,
input[type="submit"],
.tws-button,
.tws-article-buy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    min-height: 46px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    border: none;
    background: linear-gradient(135deg, var(--brand-red) 0%, #b30e0e 100%);
    color: #ffffff !important;
    box-shadow: var(--shadow-red);
    cursor: pointer;
    transition: var(--transition);
}

button:hover,
.btn:hover,
input[type="submit"]:hover,
.tws-button:hover,
.tws-article-buy-button:hover {
    background: linear-gradient(135deg, #f01818 0%, var(--brand-red-hover) 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(220, 20, 20, 0.36);
}

button:active,
.btn:active,
input[type="submit"]:active {
    transform: translateY(0);
}

/* ==========================================================================
   4. ФОРМЫ, ПОИСК И ПОДПИСКА
   ========================================================================== */
input[type="text"],
input[type="email"],
input[type="search"],
input[type="tel"],
input[type="number"],
select,
textarea {
    font-size: 16px !important; /* Защита от зума в iOS Safari */
    line-height: 1.4;
    padding: 11px 15px;
    min-height: 46px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-light);
    background-color: var(--bg-surface);
    color: var(--text-main);
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand-red);
    box-shadow: 0 0 0 4px var(--brand-red-soft);
}

/* ==========================================================================
   5. ЛЕВОЕ МЕНЮ (САЙДБАР) — избавляемся от «угловатого» вида
   ========================================================================== */
.tws-left-column,
aside {
    border-radius: var(--radius-md);
    overflow: hidden;
}

.tws-left-column ul,
aside ul {
    list-style: none;
    padding: 8px;
    margin: 0;
}

.tws-left-column li a,
aside li a {
    display: block;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    color: var(--text-main);
    border-left: 3px solid transparent;
    text-decoration: none;
}

.tws-left-column li a:hover,
aside li a:hover {
    background-color: var(--bg-subtle);
    border-left-color: var(--brand-red);
    color: var(--brand-red);
    padding-left: 18px;
}

/* ==========================================================================
   6. КАРТОЧКИ ТОВАРОВ, ПРОМО-БАННЕРЫ И ОПИСАНИЯ
   ========================================================================== */
.tws-article-list--item,
.tws-category-list--item {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 14px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.tws-article-list--item:hover,
.tws-category-list--item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(220, 20, 20, 0.25);
}

/* Легкий зум картинок при наведении */
.tws-article-list--item img,
.tws-category-list--item img {
    transition: transform 0.35s ease;
    border-radius: var(--radius-sm);
}

.tws-article-list--item:hover img,
.tws-category-list--item:hover img {
    transform: scale(1.03);
}

.tws-article-name,
.tws-article--name {
    font-size: 16px;
    line-height: 1.4;
    font-weight: 700;
    color: var(--text-main);
    margin: 12px 0 6px;
    display: block;
    text-decoration: none;
}

.tws-article-name:hover,
.tws-article--name:hover {
    color: var(--brand-red);
}

.tws-article-price {
    font-size: 20px;
    line-height: 1.25;
    font-weight: 800;
    color: var(--brand-red);
    letter-spacing: -0.01em;
    margin: 6px 0 10px;
}

/* Описания товаров */
.slot--article-description {
    padding: 20px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    margin-top: 20px;
}

.slot--article-description .tws-article-description--text-container {
    font-size: 15.5px;
    line-height: 1.7;
    max-height: none;
    max-width: 75ch; /* Оптимальная ширина строки для чтения */
}

.tws-article-description--show-more > button {
    display: none;
}

/* ==========================================================================
   7. ФУТЕР — более благородный оттенок и читаемость ссылок
   ========================================================================== */
footer {
    background: linear-gradient(180deg, #cc1010 0%, #9c0a0a 100%) !important;
    padding: 40px 20px 28px;
}

footer a {
    color: rgba(255, 255, 255, 0.88) !important;
    text-decoration: none;
    display: inline-block;
    padding: 3px 0;
}

footer a:hover {
    color: #ffffff !important;
    transform: translateX(3px);
}

/* ==========================================================================
   8. АДАПТИВ: ПЛАНШЕТЫ И СМАРТФОНЫ (до 768px)
   ========================================================================== */
@media only screen and (max-width: 768px) {

    .tws-layout-container,
    .tws-page-container {
        padding-left: 12px !important;
        padding-right: 12px !important;
        width: 100% !important;
    }

    /* Сайдбар не сжимает контент */
    .tws-left-column,
    aside {
        width: 100% !important;
        margin-bottom: 18px;
        box-shadow: var(--shadow-sm);
    }

    .slot--article-description {
        padding: 16px 14px;
    }

    /* Футер -> 2 ровные колонки вместо 7 узких полос */
    footer .tws-grid,
    footer .tws-layout-row {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px 14px !important;
    }
}

/* ==========================================================================
   9. АДАПТИВ: УЗКИЕ СМАРТФОНЫ (до 480px)
   ========================================================================== */
@media only screen and (max-width: 480px) {

    body {
        font-size: 15px;
    }

    .tws-article-name,
    .tws-article--name {
        font-size: 16px;
    }

    .tws-article-price {
        font-size: 19px;
    }

    /* Все кнопки в формах и карточках на всю ширину под палец */
    button,
    .btn,
    input[type="submit"],
    .tws-article-buy-button {
        width: 100%;
    }

    /* Убираем hover-прыжки на сенсорных экранах */
    .tws-article-list--item:hover,
    .tws-category-list--item:hover {
        transform: none;
    }
}

/* ==========================================================================
   ИСПРАВЛЕНИЯ ДЛЯ СТРАНИЦ КАТЕГОРИЙ / BLACK FRIDAY (twsList)
   ========================================================================== */

/* 1. Верхний промо-блок (картинка + описание справа) */
.tws-article-group--description,
.tws-category-description,
.slot--article-group-description {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 28px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

/* Аккуратные красные плашки ("BUY:", "Get ALL the following for FREE:") */
.tws-article-group--description span[style*="background"],
.tws-category-description span[style*="background"],
.tws-article-group--description mark {
    display: inline-block;
    padding: 4px 12px !important;
    border-radius: 6px;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-bottom: 8px;
    line-height: 1.3;
}

/* Отступы между картинкой и текстом, если они в таблице */
.tws-article-group--description table,
.tws-category-description table {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 24px 0;
}

.tws-article-group--description td,
.tws-category-description td {
    vertical-align: top;
}

/* 2. Исправляем обрезку картинки в карточке товара */
.tws-article-list--item .tws-article-list--image-container,
.tws-article-list--item .tws-img-container {
    background: #0e0f12;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4 / 5; /* Вертикальная пропорция под ваши промо-баннеры */
    display: flex;
    align-items: center;
    justify-content: center;
}

.tws-article-list--item :is(.tws-article-list--image-container, .tws-img-container) img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important; /* Картинка больше НЕ обрезается */
    object-position: center;
}

/* 3. Красивый бейдж скидки (-22%) */
.tws-article-list--discount,
.tws-discount-badge,
.tws-article-labels span {
    border-radius: 6px !important;
    padding: 4px 10px !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    box-shadow: 0 2px 8px rgba(220, 20, 20, 0.35);
}

/* 4. Убираем «сломанный» вид пустой панели фильтров над товарами */
.tws-article-list--controls,
.tws-list-toolbar {
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Если панель сортировки на промо-странице вообще не нужна — раскомментируйте 3 строки ниже: */
/*
.tws-article-list--controls {
    display: none !important;
}
*/

/* 5. Заголовок раздела ("Smokeless Range - Home Simulator...") */
.tws-article-group--name,
.tws-article-list--heading {
    text-align: center;
    font-size: clamp(20px, 2.2vw, 26px);
    font-weight: 800;
    margin: 28px 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

/* 6. Мобильная вёрстка описания категории и каталога */
@media only screen and (max-width: 768px) {
    :is(.tws-article-group--description, .tws-category-description, .slot--article-group-description) {
        padding: 14px;
    }

    /* Промо-таблица из редактора категории складывается в одну колонку. */
    :is(.tws-article-group--description, .tws-category-description, .slot--article-group-description) table:not(:where(table table)) {
        display: block !important;
        width: 100% !important;
        border-spacing: 0 !important;
    }

    :is(.tws-article-group--description, .tws-category-description, .slot--article-group-description) table:not(:where(table table)) > :is(tbody, tr),
    :is(.tws-article-group--description, .tws-category-description, .slot--article-group-description) table:not(:where(table table)) > tbody > tr {
        display: block !important;
        width: 100% !important;
    }

    :is(.tws-article-group--description, .tws-category-description, .slot--article-group-description) table:not(:where(table table)) > tr > td,
    :is(.tws-article-group--description, .tws-category-description, .slot--article-group-description) table:not(:where(table table)) > tbody > tr > td {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        overflow-wrap: anywhere;
    }

    :is(.tws-article-group--description, .tws-category-description, .slot--article-group-description) table:not(:where(table table)) > tr > td + td,
    :is(.tws-article-group--description, .tws-category-description, .slot--article-group-description) table:not(:where(table table)) > tbody > tr > td + td {
        margin-top: 16px !important;
    }

    :is(.tws-article-group--description, .tws-category-description, .slot--article-group-description) table:not(:where(table table)) img {
        display: block !important;
        float: none !important;
        width: auto !important;
        max-width: 100% !important;
        height: auto !important;
        margin-inline: auto;
    }

    /* Сетка применяется только к контейнеру с карточками. */
    :is(
        .tws-article-list--grid,
        .tws-article-list:has(> .tws-article-list--item),
        .tws-article-list ul:has(> .tws-article-list--item)
    ) {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 16px !important;
    }

    .tws-article-list--item {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        float: none !important;
    }

    .tws-article-list--item :is(.tws-article-list--image-container, .tws-img-container) {
        aspect-ratio: auto !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
    }

    .tws-article-list--item :is(.tws-article-list--image-container, .tws-img-container) img {
        display: block !important;
        position: static !important;
        width: auto !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 360px !important;
        transform: none !important;
    }

    .tws-article-list--controls,
    .tws-list-toolbar {
        flex-wrap: wrap;
        grid-column: 1 / -1 !important;
    }

    .tws-article-list--controls:empty,
    .tws-list-toolbar:empty {
        display: none !important;
    }
}

/* Black Friday 5: мобильная вёрстка страницы Bountiful. */
@media (max-width: 768px) {
    body.articlegroup-6896487 .tws-custom-page .customPageHtml table {
        display: block !important;
        width: 100% !important;
        border-spacing: 0;
    }

    body.articlegroup-6896487 .tws-custom-page .customPageHtml table > tbody,
    body.articlegroup-6896487 .tws-custom-page .customPageHtml table > tbody > tr,
    body.articlegroup-6896487 .tws-custom-page .customPageHtml table > tbody > tr > td {
        display: block !important;
        width: 100% !important;
        max-width: 100%;
    }

    body.articlegroup-6896487 .tws-custom-page .customPageHtml table > tbody > tr > td {
        padding: 0 !important;
    }

    body.articlegroup-6896487 .tws-custom-page .customPageHtml td + td {
        margin-top: 20px;
        overflow-wrap: anywhere;
    }

    body.articlegroup-6896487 .tws-custom-page .customPageHtml td:first-child > img {
        display: block;
        width: min(100%, 360px) !important;
        height: auto !important;
        margin-inline: auto;
        border-radius: 10px;
    }

    body.articlegroup-6896487 .tws-custom-page .customPageHtml ul {
        padding-inline-start: 1.25rem;
    }

    body.articlegroup-6896487 .tws-custom-page .customPageArticleList .tws-list--type-grid {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 16px;
        margin-inline: 0 !important;
    }

    body.articlegroup-6896487 .tws-custom-page .tws-list--type-grid > .tws-list--grid-item {
        float: none !important;
        width: 100% !important;
        min-width: 0;
        max-width: 100% !important;
        margin-inline: 0 !important;
        padding-inline: 0 !important;
    }

    body.articlegroup-6896487 .tws-custom-page .tws-list--grid-item > .thumbnail {
        width: 100%;
        min-width: 0;
        margin-inline: 0;
    }

    body.articlegroup-6896487 .tws-custom-page
    .tws-list:has(> .tws-list--type-grid > .tws-list--grid-item:only-child) > .tws-list-controls {
        display: none !important;
    }

    body.articlegroup-6896487 footer .row:has(> .bountiful--footer-left) {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
        gap: 20px 16px;
        margin-inline: 0;
    }

    body.articlegroup-6896487 footer .row:has(> .bountiful--footer-left)::before,
    body.articlegroup-6896487 footer .row:has(> .bountiful--footer-left)::after {
        content: none;
    }

    body.articlegroup-6896487 footer .row:has(> .bountiful--footer-left) > div {
        width: auto !important;
        min-width: 0;
        padding-inline: 0;
        text-align: start;
        overflow-wrap: anywhere;
    }
}

@media (max-width: 340px) {
    body.articlegroup-6896487 footer .row:has(> .bountiful--footer-left) {
        grid-template-columns: minmax(0, 1fr);
    }
}
