:root {
    --color-bg-light: #f4f6f8;
    --color-surface: #ffffff;
    --color-text-dark: #1a1a1a;
    --color-text-medium: #525252;
    --color-graphite: #3d3d3d;
    --color-border: #e0e0e0;
    --color-accent-hover: #007bff;
}

/* CSS Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; scroll-behavior: smooth; font-smoothing: antialiased; -webkit-font-smoothing: antialiased; }
body {
    background-color: var(--color-bg-light);
    color: var(--color-text-dark);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    display: grid;
    place-items: center;
    min-height: 100vh;
}
.mono { font-family: 'JetBrains Mono', monospace; }

.container {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 20px;
}
.related-group-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    white-space: nowrap; /* Запрещает перенос текста */
    overflow: hidden;
    text-overflow: ellipsis; /* Если текст всё же слишком длинный, добавит ... */
}

.content-wrapper {
    text-align: center;
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}
@keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } }

/* =============== ХЕДЕР V2 (Парящий эффект) =============== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    background-color: transparent;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Стили для группировки сопутствующих товаров --- */
.related-group {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 20px;
    background-color: #fafafa;
}

.related-group[open] {
    border-color: #007bff;
}

.related-group-title {
    padding: 15px 20px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: #333;
    cursor: pointer;
    user-select: none;
    list-style: none; /* Убираем стандартный маркер summary */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Скрываем дефолтную стрелку браузера */
.related-group summary::-webkit-details-marker {
    display: none;
}

.related-group-title::after {
    content: '+';
    font-size: 20px;
    transition: transform 0.2s ease;
}

.related-group[open] .related-group-title::after {
    content: '−';
    transform: rotate(0deg);
}

.related-grid {
    padding: 0 20px 20px 20px;
    display: grid;
    gap: 15px;
}

@media (min-width: 768px) {
    .related-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

/* Визуальное отделение групп друг от друга */
.related-group + .related-group {
    margin-top: 10px;
}


.header--scrolled {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
}

.header-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 0.8rem;
    color: var(--color-text-medium);
    opacity: 0;
    transform: translateY(-15px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.header--scrolled .header-top-bar {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 60px;
    padding: 20px 0;
    transition: padding 0.3s ease;
}

.header--scrolled .header-container {
    padding: 15px 0;
}

.logo {
    font-family: 'Turbo', sans-serif;
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    letter-spacing: -0.02em;
    text-decoration: none;
    color: var(--color-graphite);
    font-weight: 400;
    z-index: 10;
    position: relative;
}

.nav .nav-list {
    display: flex;
    gap: 40px;
    list-style: none;
    font-size: 0.95rem;
    font-weight: 500;
    z-index: 10;
    position: relative;
}

.nav-list a {
    color: var(--color-text-medium);
    text-decoration: none;
    position: relative;
    transition: color 0.2s;
    white-space: nowrap;
}

.nav-list a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -6px;
    height: 2px;
    width: 0;
    background-color: var(--color-accent-hover);
    border-radius: 2px;
    transition: width 0.3s ease-out;
}

.nav-list a:hover {
    color: var(--color-graphite);
}
.nav-list a:hover::after { width: 100%; }

/* =============== КАРУСЕЛЬ НОВОСТЕЙ (автопрокрутка) =============== */
.news-section {
    padding: 60px 0 40px;
    background-color: var(--color-bg-light);
    border-top: 1px solid var(--color-border);
    overflow: hidden;
}
.news-title { font-size: 1.5rem; margin-bottom: 32px; text-align: center; font-weight: 500; color: var(--color-graphite); }

.carousel-track {
    display: flex;
    gap: 24px;
    overflow-x: visible;
    padding-bottom: 40px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    will-change: transform;
    animation: scrollNews 40s linear infinite;
}
.carousel-track::-webkit-scrollbar { display: none; }

.carousel-track:hover { animation-play-state: paused; }

@keyframes scrollNews {
    0% { transform: translateX(0); }
    100% { transform: translateX(-896px); }
}

.news-card {
    flex: 0 0 calc(100% - 48px);
    min-width: 320px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    scroll-snap-align: start;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    transition: all 0.3s ease;
}
.news-card:hover { transform: translateY(-8px); box-shadow: 0 20px 40px rgba(0,0,0,0.08); }
.news-image { width: 100%; height: 180px; background-size: cover; background-position: center; }
.news-card-content { padding: 24px; display: flex; flex-direction: column; gap: 8px; flex-grow: 1; }
.news-card-title { font-size: 1.25rem; font-weight: 600; margin: 0; color: var(--color-graphite); }
.news-date { font-size: 0.85rem; color: var(--color-text-medium); font-family: 'JetBrains Mono', monospace; }
.news-excerpt { color: var(--color-text-medium); font-size: 0.95rem; line-height: 1.5; flex-grow: 1; margin: 0; }
.news-link { align-self: flex-start; color: var(--color-accent-hover); text-decoration: none; font-size: 0.9rem; font-weight: 500; transition: color 0.2s; }
.news-link:hover { color: var(--color-graphite); }

.carousel-btn { display: none; }

/* =============== НОВАЯ ГЛАВНАЯ СЕТКА (ТАБЛИЧКИ) =============== */
.main-grid {
    display: grid;
    gap: 24px;
    margin-top: 60px;
}

@media (min-width: 900px) {
    .main-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-card--top { grid-column: 1 / -1; }
}

.grid-card {
    position: relative;
    height: 220px;
    background-color: var(--color-graphite);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: #fff;
    display: flex;
    align-items: flex-end;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-size: cover;
    background-position: center;
}

.grid-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(26, 26, 26, 0.8), transparent 60%);
    pointer-events: none;
}

.grid-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}

.grid-card h3 {
    font-size: 1.4rem;
    font-weight: 600;
    padding: 0 24px 16px;
    z-index: 1;
    position: relative;
    line-height: 1.2;
}

.grid-card p {
    font-size: 0.9rem;
    color: var(--color-text-medium);
    padding: 0 24px 24px;
    z-index: 1;
    position: relative;
    opacity: 0.9;
}

/* =============== БЛОК "О СИСТЕМЕ" =============== */
.about-system {
    grid-column: 1 / -1;
    margin-top: 60px;
    text-align: left;
    max-width: 800px;
    align-self: start;
}

.about-system h2 {
    font-size: 1.8rem;
    color: var(--color-graphite);
    margin-bottom: 20px;
    font-weight: 600;
}

.about-system p {
    color: var(--color-text-medium);
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 16px;
}

.system-features {
    display: grid;
    gap: 20px;
    margin-top: 32px;
}

.feature-item strong {
    display: block;
    color: var(--color-graphite);
    font-size: 1.1rem;
    margin-bottom: 6px;
}

.feature-item span {
    color: var(--color-text-medium);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Адаптация высоты карточек на очень широких мониторах */
@media (min-width: 1200px) {
    .grid-card { height: 260px; }
}

/* =============== ФОРМА И ФУТЕР =============== */
h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 600; margin-bottom: 16px; line-height: 1.1; color: var(--color-graphite); }
.subtitle { color: var(--color-text-medium); font-size: 1.1rem; margin-bottom: 32px; }
.tech-tags { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 40px; }
.tech-tags span { background-color: var(--color-bg-light); color: var(--color-text-medium); padding: 6px 12px; border-radius: 999px; font-size: 0.85rem; font-family: 'JetBrains Mono', monospace; font-weight: 500; border: 1px solid var(--color-border); }
.notify-form { display: flex; gap: 12px; align-items: stretch; flex-direction: column; margin-bottom: 40px; }
@media (min-width: 420px) { .notify-form { flex-direction: row; } }
.notify-form input { flex: 1; background-color: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-text-dark); padding: 16px 20px; border-radius: 8px; font-size: 1rem; transition: border-color 0.2s; }
.notify-form input:focus { outline: none; border-color: var(--color-accent-hover); box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1); }
.notify-form button { flex-shrink: 0; background-color: var(--color-graphite); color: #fff; border: none; padding: 0 32px; font-weight: 600; font-size: 1rem; border-radius: 8px; cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
.notify-form button:hover:not(:disabled) { background-color: #000; transform: translateY(-1px); }
.form-status { height: 20px; margin-top: 8px; font-size: 0.85rem; font-style: italic; }
.form-status.success { color: #28a745; }
.form-status.error { color: #dc3545; }
.footer { border-top: 1px solid var(--color-border); padding-top: 32px; color: var(--color-text-medium); font-size: 0.9rem; }
.contact-line { margin-top: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }


/* =============== СТИЛИ СТРАНИЦЫ ТОВАРА (НОВЫЙ КОД) =============== */

/* ОСНОВНАЯ СЕТКА СТРАНИЦЫ ТОВАРА */
.product-page {
    display: grid;
    gap: 40px;
    margin-top: 40px;
}

@media (min-width: 900px) {
    .product-page {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 899px) {
    .product-page {
        grid-template-columns: 1fr;
    }
}

/* СТИЛИ ГАЛЕРЕИ */
.product-gallery {
    position: relative;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
}

.gallery-main-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    position: relative;
    background-color: #000;
}

.gallery-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

.gallery-img:first-child {
    display: block;
}

/* Стрелочки навигации поверх изображения */
.gallery-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--color-border);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    color: var(--color-text-dark);
}

.gallery-btn:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gallery-btn--prev {
    left: 12px;
}

.gallery-btn--next {
    right: 12px;
}

/* Превьюшки под основным фото */
.gallery-thumbnails {
    display: flex;
    gap: 8px;
    padding: 12px;
    overflow-x: auto;
    background-color: var(--color-bg-light);
    scrollbar-width: none;
}

.gallery-thumbnails::-webkit-scrollbar {
    display: none;
}

.thumb-img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.thumb-img:hover,
.thumb-img.active {
    border-color: var(--color-accent-hover);
}

/* ИНФО О ТОВАРЕ */
.product-info {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.product-title {
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    color: var(--color-graphite);
    margin: 0;
    line-height: 1.2;
}

.product-sku {
    color: var(--color-text-medium);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
}

.product-price {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--color-graphite);
    margin: 0;
}

.product-currency {
    font-size: 1.2rem;
    opacity: 0.7;
    margin-left: 4px;
}

.product-desc p {
    color: var(--color-text-medium);
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 16px;
}

.buy-form {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 20px;
}

.qty-input {
    width: 80px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    text-align: center;
    font-size: 1rem;
}

.btn-buy {
    flex-shrink: 0;
    background-color: var(--color-graphite);
    color: #fff;
    border: none;
    padding: 0 32px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-buy:hover:not(:disabled) {
    background-color: #000;
    transform: translateY(-1px);
}

/* ХАРАКТЕРИСТИКИ (ТАБЛИЦА) */
.specs-title {
    font-size: 1.3rem;
    color: var(--color-graphite);
    margin: 24px 0 12px;
    font-weight: 600;
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.specs-table th,
.specs-table td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
}

.specs-table th {
    width: 30%;
    color: var(--color-text-medium);
    font-weight: 500;
    background-color: var(--color-bg-light);
}

.specs-table td {
    color: var(--color-text-dark);
    font-family: 'JetBrains Mono', monospace;
}

/* СОПУТСТВУЮЩИЕ ТОВАРЫ */
.related-section {
    margin-top: 80px;
}

.related-title {
    font-size: 1.5rem;
    color: var(--color-graphite);
    margin-bottom: 24px;
    font-weight: 600;
}

.related-grid {
    display: grid;
    gap: 20px;
}

@media (min-width: 768px) {
    .related-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

.related-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.related-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.related-name {
    font-weight: 600;
    color: var(--color-graphite);
    font-size: 1.05rem;
}

.related-sku {
    font-size: 0.85rem;
    color: var(--color-text-medium);
    font-family: 'JetBrains Mono', monospace;
}

.related-price {
    font-weight: 600;
    margin-top: auto;
    color: var(--color-graphite);
}

.btn-add-related {
    margin-top: 12px;
    padding: 8px 16px;
    background-color: var(--color-accent-hover);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.btn-add-related:hover {
    background-color: #0056b3;
}

/* ОБЛАСТЬ PDF (DATASHEETS) */
.datasheet-section {
    margin-top: 60px;
    border-top: 1px solid var(--color-border);
    padding-top: 40px;
}

.datasheet-title {
    font-size: 1.5rem;
    color: var(--color-graphite);
    margin-bottom: 20px;
    font-weight: 600;
}

.datasheet-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.datasheet-link {
    color: var(--color-text-dark);
    text-decoration: none;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.datasheet-link:hover {
    background-color: var(--color-bg-light);
    border-color: var(--color-accent-hover);
    transform: translateX(4px);
}