/* Страница справочника: структура как /novosti/ — ограниченная ширина, сайдбар справа */

/* Якоря: при переходе по ссылкам заголовок не прячется под фикс. хедером */
.reference-section[id] {
    scroll-margin-top: 1.5rem;
}

.main-content .container {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 15px;
    padding-right: 15px;
}

.reference-page {
    padding: 0 0 2rem;
}

/* Шапка страницы (как news-page__header) */
.reference-page__header {
    text-align: left;
    margin: 0 0 3rem 0;
    padding: 0 0 2rem 0;
    border-bottom: 1px solid #e5e5e5;
    background: transparent !important;
    border-radius: 0 !important;
}

.reference-page__title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1rem;
    line-height: 1.2;
    background: transparent !important;
}

.reference-page__description {
    font-size: 1.1rem;
    color: #666;
    max-width: 100%;
    margin: 0;
    line-height: 1.6;
}

.reference-page__header::before,
.reference-page__header::after {
    content: none !important;
    display: none !important;
}

/* Layout: контент + сайдбар (как news-page__layout) */
.reference-page__layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

/* Контент слева — строго в одну колонку, секции друг под другом; не сжимать ниже разумного */
.reference-page__content {
    flex: 1 1 auto;
    min-width: min(100%, 480px);
    display: flex !important;
    flex-direction: column !important;
    width: 100%;
    max-width: 100%;
    column-count: 1 !important;
    columns: 1 !important;
}

.reference-page__content > section,
.reference-page__content > .reference-section {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
}

/* Сайдбар справочника в стиле новостей (news-single-sidebar подключается из news-single.css) */
.reference-sidebar .news-sidebar-widget__list.reference-sidebar__list li {
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

.reference-sidebar .news-sidebar-widget__list.reference-sidebar__list li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.reference-sidebar .news-sidebar-widget__list a {
    display: block;
}

.reference-sidebar .news-sidebar-widget__list a i {
    margin-right: 0.5rem;
    width: 16px;
    text-align: center;
}

/* Сайдбар при скролле остаётся видимым */
.reference-page .news-single-sidebar.reference-sidebar {
    position: sticky;
    top: 1rem;
    align-self: flex-start;
}

/* Секции справочника */
.reference-section {
    padding: 0;
    background: #fff;
    border-bottom: 1px solid #ccc;
}

.reference-section--alt {
    background: #f9f9f9;
}

.reference-section__header {
    margin-bottom: 2rem;
}

.reference-section__title {
    font-size: 1.8rem;
    font-weight: bold;
    color: #000;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #ccc;
    padding-bottom: 0.5rem;
}

.reference-section__title i {
    color: #f4ce47;
    margin-right: 0.5rem;
}

.reference-section__description {
    font-size: 1rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

/* Сетка карточек — строго одна колонка (приоритет над общими стилями) */
.reference-page .reference-grid,
.reference-section .reference-grid,
.reference-page__content .reference-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: auto !important;
    gap: 1.5rem;
}

.reference-page .reference-card,
.reference-section .reference-card {
    max-width: 100% !important;
    width: 100% !important;
}

/* Карточки справочника — лёгкий акцент при наведении */
.reference-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: visible;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.reference-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-color: #d0d0d0;
}

.reference-card__header {
    background: #f8f9fa;
    border-bottom: 1px solid #ccc;
    padding: 1rem 1.5rem;
}

.reference-card__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.reference-card__header h3 {
    margin: 0;
    color: #000;
    font-size: 1.2rem;
    font-weight: bold;
}

.reference-card__catalog-link {
    font-size: 0.9rem;
    color: #0066cc;
    text-decoration: none;
    white-space: nowrap;
}

.reference-card__catalog-link:hover {
    text-decoration: underline;
}

.reference-card__link-block {
    margin: 0 0 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.reference-card__link-block a {
    color: #0066cc;
    text-decoration: none;
}

.reference-card__link-block a:hover {
    text-decoration: underline;
}

.reference-card__content {
    padding: 1.5rem;
    overflow: visible;
    min-width: 0;
}

.reference-card {
    min-width: 0;
    overflow: visible;
}

/* Элементы справочника */
/* Список ГОСТов — компактно и удобно сканировать */
.reference-gost-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.reference-gost-list li {
    padding: 0.5rem 0 0.5rem 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #333;
    border-left: 3px solid transparent;
    margin-left: 0;
    transition: background 0.2s, border-color 0.2s;
}

.reference-gost-list li:hover {
    background: #f8f9fa;
    border-left-color: #f4ce47;
}

.reference-gost-list li + li {
    border-bottom: none;
    margin-top: 0;
}

.reference-gost-list strong {
    font-weight: 600;
    color: #1a1a1a;
}

.reference-gost-list a {
    color: #0066cc;
    text-decoration: none;
}

.reference-gost-list a:hover {
    text-decoration: underline;
}

/* Подзаголовок группы в списке ГОСТов */
.reference-gost-list__title {
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    color: #555 !important;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 1rem !important;
    padding-top: 0.75rem !important;
    border-left: none !important;
    background: none !important;
    list-style: none;
}

.reference-gost-list__title:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Марки стали и изделия — компактнее, удобнее читать */
.steel-mark,
.product-item {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.steel-mark:last-child,
.product-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.steel-mark strong,
.product-item strong {
    display: inline;
    color: #1a1a1a;
    font-size: 1rem;
    font-weight: 600;
    margin-right: 0.25rem;
}

.steel-mark strong::after,
.product-item strong::after {
    content: " — ";
    font-weight: 400;
    color: #666;
}

.steel-mark p,
.product-item p {
    display: inline;
    margin: 0;
    color: #555;
    line-height: 1.55;
    font-size: 0.95rem;
}

/* Чтобы длинное описание переносилось аккуратно */
.steel-mark,
.product-item {
    line-height: 1.55;
}

/* Таблицы размеров */
/* Таблицы: не сжимать до вертикального текста; при нехватке места — горизонтальная прокрутка */
.reference-card__content {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.size-table {
    width: 100%;
    max-width: 100%;
    min-width: 420px;
    table-layout: auto;
    border-collapse: collapse;
    border: 1px solid #ccc;
    background: #fff;
}

.size-table th,
.size-table td {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    min-width: 0;
}

.size-table th:first-child,
.size-table td:first-child {
    white-space: nowrap;
}

/* Последняя колонка (Применение) — минимум места, чтобы текст был виден */
.size-table td:last-child,
.size-table th:last-child {
    min-width: 11rem;
}

.size-row {
    border-bottom: 1px solid #e8e8e8;
}

.size-row:nth-child(even) {
    background: #fafafa;
}

.size-row:hover {
    background-color: #f0f4f8 !important;
}

.size-row--header {
    background: #f4ce47;
    font-weight: bold;
    color: #000;
}

.size-row--header th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: bold;
    border-right: 1px solid #ccc;
}

.size-row--header th:last-child {
    border-right: none;
}

.size-row td {
    padding: 0.75rem 1rem;
    border-right: 1px solid #ccc;
    font-size: 0.9rem;
    line-height: 1.4;
}

.size-row td:last-child {
    border-right: none;
}

.size-row:last-child {
    border-bottom: none;
}

/* Контактная секция */
.reference-contact {
    background: linear-gradient(135deg, #333 0%, #555 100%);
    color: #fff;
    padding: 2rem;
    margin-top: 2rem;
    text-align: center;
}

.reference-contact__content {
    max-width: 600px;
    margin: 0 auto;
}

.reference-contact__content h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    font-weight: bold;
}

.reference-contact__content p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
    line-height: 1.5;
}

.reference-contact__button {
    display: inline-block;
    background: #f4ce47;
    color: #000;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.reference-contact__button:hover {
    background: #fff;
    transform: translateY(-2px);
}

/* Мобильная навигация */
/* Адаптивность: как на /novosti/ — сайдбар уходит вниз */
@media (max-width: 992px) {
    .reference-page__layout {
        flex-direction: column;
    }

    .reference-page .news-single-sidebar.reference-sidebar {
        width: 100%;
        order: -1; /* Сайдбар сверху на планшетах/мобильных */
    }
}

@media (max-width: 768px) {
    .reference-page {
        padding: 1rem 0;
    }

    .reference-page__header {
        margin-bottom: 2rem;
        padding-bottom: 1rem;
    }

    .reference-page__title {
        font-size: 1.75rem;
    }

    .reference-page__description {
        font-size: 1rem;
    }

    .reference-section {
        padding: 1.5rem 0;
    }

    .reference-section__title {
        font-size: 1.6rem;
    }

    .reference-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .reference-card__content {
        padding: 1rem;
    }

    .reference-contact {
        padding: 2rem 1rem;
    }

    .reference-contact__content h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .reference-page__title {
        font-size: 1.5rem;
    }

    .reference-section__title {
        font-size: 1.4rem;
    }

    .size-row td,
    .size-table th {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .reference-card__header h3 {
        font-size: 1.1rem;
    }
}

/* Плавная прокрутка к якорям */
html {
    scroll-behavior: smooth;
}

/* Активные состояния для навигации */
.reference-nav__link:focus {
    outline: 2px solid #f4ce47;
    outline-offset: 2px;
}

/* Принудительно одна колонка — максимальная специфичность */
body .main-content .container .reference-page .reference-page__layout .reference-page__content .reference-section .reference-grid {
    grid-template-columns: 1fr !important;
    -ms-grid-columns: 1fr !important;
}
body .main-content .container .reference-page .reference-page__content .reference-section .reference-grid .reference-card {
    -ms-grid-column: 1;
    grid-column: 1;
}