/*
 * Дополнения к assets/style.css для динамических блоков Django:
 * вкладки исполнений, таблица типов серии, карточки с фото, чертежи, состояния форм.
 * Цвета подобраны под макет: тёмная база, графит, красные акценты.
 */
:root {
  --atl-red: #e3262f;
  --atl-red-soft: rgba(227, 38, 47, .14);
  --atl-line: rgba(255, 255, 255, .1);
  --atl-line-strong: rgba(255, 255, 255, .18);
  --atl-text: #f2f2f2;
  --atl-muted: #9a9ca3;
  --atl-panel: linear-gradient(160deg, #17181b 0%, #0f1012 100%);
}

/* Ловушка для ботов в формах */
.atl-hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

/* Состояния формы */
.form-success.is-visible { display: block !important; }
.form-success.is-error { color: #ff8a8f; border-color: rgba(255, 90, 99, .45); }
form.is-sending button[type="submit"] { opacity: .6; pointer-events: none; }
.check a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* Карточки серий с фото */
.atl-card { display: flex; flex-direction: column; }
.atl-card__media { display: flex; align-items: center; justify-content: center; height: 150px; margin: -4px 0 16px; border-radius: 10px; background: radial-gradient(circle at 50% 40%, rgba(255,255,255,.08), rgba(255,255,255,.01) 70%); overflow: hidden; }
.atl-card__media img { max-width: 88%; max-height: 132px; object-fit: contain; transition: transform .35s ease; }
.atl-card:hover .atl-card__media img { transform: scale(1.05); }
.atl-card h3 a, .product-card h3 a { color: inherit; text-decoration: none; }
.atl-card__sub { margin: -4px 0 8px; color: var(--atl-red); font-weight: 600; font-size: 14px; }
.atl-card__doc { margin: 0 0 14px; color: var(--atl-muted); font-size: 12px; letter-spacing: .04em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.atl-card > a:last-child { margin-top: auto; }

/* Обзор серии */
.atl-overview__subtitle { margin: -6px 0 14px; color: var(--atl-red); font-weight: 600; font-size: 18px; }
.atl-overview--noimage { grid-template-columns: 1fr !important; }
.atl-zoom { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.atl-zoom img { display: block; width: 100%; height: auto; }

/* Формула условного обозначения (текстом) */
.atl-formula { margin: 18px 0; padding: 18px 22px; border: 1px solid var(--atl-line); border-radius: 12px; background: rgba(255,255,255,.03); font: 700 clamp(18px, 2.4vw, 28px)/1.3 "Russo One", Inter, sans-serif; letter-spacing: .06em; color: var(--atl-text); overflow-x: auto; white-space: nowrap; }

.atl-spec-group { margin: 26px 0 10px; font-size: 15px; font-weight: 700; color: var(--atl-text); }

/* Таблица типов серии (как в ТЗ: визио / наименование / документ поставки) */
.atl-series { margin-top: 44px; }
.atl-series-table td { vertical-align: middle; }
.atl-series-table__img { display: flex; align-items: center; justify-content: center; width: 112px; height: 72px; border-radius: 8px; background: #fff; overflow: hidden; }
.atl-series-table__img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.atl-series-table__name { display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; }
.atl-series-table__name strong { font-size: 18px; color: var(--atl-text); }
.atl-series-table__name span { color: var(--atl-muted); font-size: 13px; }
.atl-series-table__name:hover strong { color: var(--atl-red); }
.atl-series-table__docs { white-space: nowrap; }
.atl-series-table__docs a { display: inline-block; margin: 2px 6px 2px 0; padding: 4px 10px; border: 1px solid var(--atl-line-strong); border-radius: 999px; color: var(--atl-text); font-size: 12px; text-decoration: none; }
.atl-series-table__docs a:hover { border-color: var(--atl-red); color: #fff; background: var(--atl-red-soft); }
.atl-series-table__docs .atl-series-table__more { border-color: var(--atl-red); }

/* Вкладки исполнений */
.atl-variants { margin-top: 44px; }
.atl-tabs__list { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding-bottom: 14px; border-bottom: 1px solid var(--atl-line); }
.atl-tabs__tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 1px solid var(--atl-line-strong); border-radius: 10px; background: rgba(255,255,255,.02); color: var(--atl-muted); font: 600 14px/1.2 Inter, sans-serif; cursor: pointer; transition: .2s; text-align: left; }
.atl-tabs__tab b { padding: 2px 7px; border-radius: 6px; background: rgba(255,255,255,.08); color: var(--atl-text); font-size: 12px; }
.atl-tabs__tab:hover { color: var(--atl-text); border-color: rgba(255,255,255,.35); }
.atl-tabs__tab.is-active { color: #fff; border-color: var(--atl-red); background: var(--atl-red-soft); box-shadow: 0 0 0 1px var(--atl-red) inset; }
.atl-tabs__tab.is-active b { background: var(--atl-red); }
.atl-tabs__panel { padding-top: 22px; }
.atl-tabs__panel[hidden] { display: none; }
.atl-variant { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 28px; align-items: start; }
.atl-variant__info h4 { margin: 0 0 12px; font-size: 20px; color: var(--atl-text); }
.atl-variant__info .rp15-table-wrap { margin: 14px 0 18px; }
.atl-variant__photo { display: block; max-width: 220px; margin: 0 0 14px; border-radius: 10px; background: #fff; padding: 8px; }
.atl-variant__table td, .atl-variant__table th { font-size: 13px; white-space: nowrap; }
.atl-variant__drawings { display: grid; gap: 16px; }
@media (max-width: 900px) { .atl-variant { grid-template-columns: 1fr; } }

/* Чертежи и галерея */
.atl-drawing { margin: 0; border: 1px solid var(--atl-line); border-radius: 12px; overflow: hidden; background: #fff; }
.atl-drawing figcaption { padding: 8px 12px; background: #111215; color: var(--atl-muted); font-size: 12px; }
.atl-gallery-section, .atl-docs-section { margin-top: 44px; }
.atl-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 18px; }
.atl-gallery .atl-zoom img { height: 220px; object-fit: contain; background: #fff; }
.atl-docs-section .docs-grid { margin-top: 18px; }

/* ---------- Правки после проверки на сайте ---------- */
.atl-card > .badge { align-self: flex-start; }
.atl-card h3 { margin-top: 18px; }
.atl-variant__note { margin: 0 0 14px; color: var(--atl-muted); font-size: 13px; }

/* Горизонтальная прокрутка фильтров каталога — без белой системной полосы */
.filters, [id$="Filters"] { scrollbar-width: thin; scrollbar-color: rgba(227,38,47,.6) transparent; }
.filters::-webkit-scrollbar, [id$="Filters"]::-webkit-scrollbar { height: 4px; }
.filters::-webkit-scrollbar-thumb, [id$="Filters"]::-webkit-scrollbar-thumb { background: rgba(227,38,47,.6); border-radius: 4px; }
.filters::-webkit-scrollbar-track, [id$="Filters"]::-webkit-scrollbar-track { background: transparent; }

/* Таблицы внутри панелей не распирают страницу */
.rp15-description, .atl-variant__info, .atl-variant__drawings, .atl-series { min-width: 0; }
.rp15-description .rp15-table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Исполнения: таблица и чертёж поровну, компактная таблица */
.atl-variant { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.atl-variant__table th, .atl-variant__table td { padding: 9px 10px !important; font-size: 12.5px !important; line-height: 1.35; letter-spacing: 0 !important; }
.atl-variant__table td:first-child { white-space: nowrap; }

/* Документы на странице серии */
.atl-docs-section .docs-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.atl-docs-section .doc { min-width: 0; }
.atl-docs-section .doc h3 { overflow-wrap: anywhere; }

@media (max-width: 1100px) {
  .atl-variant { grid-template-columns: minmax(0, 1fr); }
  .atl-variant__drawings { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
}

@media (max-width: 760px) {
  /* вкладки исполнений — одной прокручиваемой строкой */
  .atl-tabs__list { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -24px; padding-right: 24px; }
  .atl-tabs__list::-webkit-scrollbar { display: none; }
  .atl-tabs__tab { flex: 0 0 auto; white-space: nowrap; padding: 9px 13px; font-size: 13px; }

  /* таблица типов серии — карточками */
  .atl-series-table thead { display: none; }
  .atl-series-table, .atl-series-table tbody { display: block; width: 100%; }
  .atl-series-table tr { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 4px 14px; padding: 14px 0; border-bottom: 1px solid var(--atl-line); }
  .atl-series-table td { display: block; padding: 0 !important; border: 0 !important; }
  .atl-series-table td[data-label="Визио"] { grid-row: span 4; }
  .atl-series-table td:not([data-label="Визио"]):not([data-label="Наименование"]) { font-size: 12px; color: var(--atl-muted); }
  .atl-series-table__img { width: 96px; height: 72px; }
  .atl-series-table__docs { white-space: normal; }

  /* кнопка онлайн-чата не закрывает контент */
  .chat-launcher b { display: none; }
  .chat-launcher { padding: 0 !important; width: 52px; height: 52px; min-width: 0 !important; justify-content: center; }
}

@media (max-width: 480px) {
  .atl-variant__table th, .atl-variant__table td { padding: 8px 6px !important; font-size: 11.5px !important; }
  .atl-variant__table th:nth-child(3), .atl-variant__table td:nth-child(3),
  .atl-variant__table th:nth-child(4), .atl-variant__table td:nth-child(4) { display: none; }
}

/* ---- Блок «Технические каталоги» на страницах категорий.
   В дизайне эти стили были привязаны к странице .rectangular-page, здесь — для всех категорий. */
.catalog-downloads-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.catalog-download-card { min-width: 0; min-height: 300px; padding: 36px 38px; display: flex; flex-direction: column;
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px); }
.catalog-download-card h3 { margin: 0 0 16px; font-size: clamp(22px, 2.2vw, 30px); line-height: 1.22; }
.catalog-download-card p { max-width: 560px; margin: 0; color: #aaaab0; }
.catalog-download-card__actions { margin-top: auto; padding-top: 32px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.catalog-download-card__actions .btn { min-height: 48px; padding-inline: 20px; font-size: 12px; }
@media (min-width: 1101px) {
  .catalog-downloads-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .catalog-downloads-grid--3 .catalog-download-card { min-height: 280px; padding: 32px 30px; }
  .catalog-downloads-grid--3 .catalog-download-card h3 { font-size: clamp(21px, 1.7vw, 26px); }
}
@media (max-width: 900px) {
  .catalog-downloads-grid, .catalog-downloads-grid--3 { grid-template-columns: 1fr; }
  .catalog-download-card { min-height: 270px; }
}
@media (max-width: 650px) {
  .catalog-download-card { min-height: 0; padding: 28px 24px; }
  .catalog-download-card__actions { padding-top: 25px; align-items: stretch; flex-direction: column; }
  .catalog-download-card__actions .btn { width: 100%; }
}

/* Скрытые в редакторе разделы не показываются на сайте */
main [hidden] { display: none !important; }

/* Кнопка «Редактировать» для сотрудников */
.atl-staff-edit { position: fixed; left: 16px; bottom: 16px; z-index: 900; display: inline-flex; gap: 6px; align-items: center;
  padding: 9px 14px; background: #161b22; color: #fff; border: 1px solid rgba(255,255,255,.18); border-radius: 999px;
  font: 600 13px/1.2 Inter, system-ui, sans-serif; text-decoration: none; box-shadow: 0 8px 24px rgba(0,0,0,.4); opacity: .85; }
.atl-staff-edit:hover { opacity: 1; border-color: #e3262f; }
@media print { .atl-staff-edit { display: none; } }

/* Заголовки 2-го и следующих слайдов — h2 (на странице один h1), выглядят так же */
.hero h2.hero__h { max-width: 760px; margin: 26px 0 0; font-size: clamp(30px, 3.2vw, 50px); line-height: 1.06; letter-spacing: -0.02em; }
.hero h2.hero__h em { font-style: normal; color: var(--red2); text-shadow: 0 0 24px rgba(255, 15, 53, .28); }
@media (max-width: 700px) { .hero h2.hero__h { font-size: clamp(28px, 9vw, 38px); } }
