/* ============================================================
   Сайт-визитка ООО «СМУ №17» — общие стили
   Чистый HTML/CSS/JS, открывается двойным кликом (file://)
   ============================================================ */

:root {
  --accent: #ea580c;            /* оранжевый — строительный акцент */
  --accent-dark: #c2410c;
  --ink: #1f2937;               /* основной тёмный текст */
  --muted: #6b7280;             /* приглушённый текст */
  --line: #e5e7eb;              /* рамки */
  --bg: #ffffff;
  --bg-soft: #f8fafc;           /* светлый фон секций */
  --dark: #111827;              /* шапка/подвал */
  --dark-soft: #1f2937;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
  --maxw: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  /* Подвал всегда прижат к низу окна, даже на коротких страницах
     (иначе он «висел» посередине экрана) */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body > .site-footer { margin-top: auto; }

/* ЭКСПЕРИМЕНТ: серый фон страницы, таблица внутри остаётся белой.
   Включается классом на <body> (напр. <body class="page-gray"> на странице «Пустотные плиты»). */
body.page-gray { background: #e5e7eb; }

a { color: inherit; text-decoration: none; }

/* ---------- Шапка ---------- */
.site-header {
  background: var(--dark);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
}

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .2px;
}
.logo-mark {
  width: 38px; height: 38px;
  border-radius: 9px;
  background: var(--accent);
  display: grid; place-items: center;
  font-size: 20px;
  object-fit: cover;
}
.logo-sub { display:block; font-size: 12px; font-weight: 400; color: #9ca3af; }

.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a {
  padding: 8px 12px;
  border-radius: 8px;
  color: #d1d5db;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.nav a:hover { background: #374151; color: #fff; }
.nav a.active { background: var(--accent); color: #fff; }

/* ---------- Герой (главная) ---------- */
.hero {
  background:
    linear-gradient(135deg, rgba(17,24,39,.88), rgba(17,24,39,.55)),
    repeating-linear-gradient(45deg, #1f2937 0 10px, #111827 10px 20px);
  color: #fff;
  padding: 72px 0 64px;
}
.hero-tag {
  display:inline-block;
  background: rgba(234,88,12,.18);
  color: #fdba74;
  border:1px solid rgba(234,88,12,.5);
  padding: 5px 12px; border-radius:999px;
  font-size: 13px; margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 46px);
  margin: 0 0 14px;
  line-height: 1.15;
}
.hero p {
  font-size: clamp(15px, 2.2vw, 18px);
  color: #d1d5db;
  max-width: 640px;
  margin: 0;
}

/* ---------- Секции ---------- */
.section { padding: 56px 0; }
.section-title { font-size: 26px; margin: 0 0 6px; }
.section-sub { color: var(--muted); margin: 0 0 28px; }

/* ---------- Карточки-кнопки разделов ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.card-link {
  display: block;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.card-link:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(234,88,12,.15);
}

/* Прайс-каталог на главной: ровно 3 раздела в строку, карточки крупнее */
#catalog-grid { grid-template-columns: repeat(3, 1fr); }
/* Единый размер всех карточек: за основу взят размер карточки «Строительство» */
#catalog-grid .card-link { padding: 28px; height: 226px; overflow: hidden; }
#catalog-grid .card-icon { width: 56px; height: 56px; font-size: 28px; }
#catalog-grid .card-link h3 { font-size: 20px; }
#catalog-grid .card-link p { font-size: 15px; }
#catalog-grid .card-arrow { font-size: 15px; }
@media (max-width: 900px) { #catalog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { #catalog-grid { grid-template-columns: 1fr; } }

/* Карточка с фоновой картинкой (например, ЖБИ): картинка на всю, заголовок вверху слева */
.card-bg {
  position: relative;
  min-height: 170px;
  display: flex;
  align-items: flex-start;
  overflow: hidden;
}
.card-bg-slide {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-size: cover;
  background-position: center;
  transition: opacity 1s ease;
}
/* Кадр целиком (section.bgFit = "contain"): без обрезки, по центру, с подложкой по краям */
.card-bg.bg-contain { background: var(--bg-soft); }
.card-bg.bg-contain .card-bg-slide {
  background-size: contain;
  background-repeat: no-repeat;
}
.card-bg h3 {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 8px 14px;
  background: rgba(17, 24, 39, .55);
  color: #fff;
  border-radius: 8px;
  font-size: 20px;
  letter-spacing: .3px;
}
.card-icon {
  width: 46px; height: 46px;
  border-radius: 11px;
  display: grid; place-items: center;
  font-size: 24px;
  background: #fff4ed;
  color: var(--accent);
  margin-bottom: 14px;
}
.card-link h3 { margin: 0 0 6px; font-size: 18px; }
.card-link p { margin: 0; color: var(--muted); font-size: 14px; }
.card-arrow { margin-top: 14px; color: var(--accent); font-weight: 700; font-size: 14px; }

/* Карточка с раскрывающимся выбором */
.card-menu { position: relative; cursor: pointer; user-select: none; }
.card-arrow-toggle::after { content: " ▾"; font-size: 11px; }
.card-menu.open .card-arrow-toggle::after { content: " ▴"; }
.card-dropdown {
  display: none;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  flex-direction: column;
  gap: 6px;
}
.card-menu.open .card-dropdown { display: flex; }
.dropdown-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  transition: background .15s, color .15s;
}
.dropdown-item:hover { background: var(--accent); color: #fff; }

/* ---------- Таблицы ---------- */
.table-page { padding: 48px 0 72px; }
.page-head { margin-bottom: 24px; }
.page-head .breadcrumb { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.page-head .breadcrumb a { color: var(--accent); }
.page-head h1 { margin: 0 0 8px; font-size: 30px; }
.page-head p { margin: 0; color: var(--muted); max-width: 640px; }

/* Шапка как невидимая таблица: 1 строка, 2 равные колонки */
.page-head-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
}
/* Невидимая таблица 3 строки × 2 столбца (страница «Строительство») */
.page-head-grid-3r {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: auto;
  gap: 24px;
  align-items: start;
}
.page-head-grid-3r > .head-cell { min-width: 0; }
/* Текст в ячейках страницы «Строительство» — по ширине ячейки (ровный правый край) */
.page-head-grid-3r > .head-cell p {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}
/* Пустой блок под фото: лёгкая серая заглушка-рамка */
.head-img-empty {
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
}
.page-head-col { min-width: 0; }
.page-head-col:not(.page-head-img) { align-self: start; }
.page-head-img {
  display: flex;
  justify-content: flex-end;
  height: 220px;          /* фикс. высота = высота первой картинки карусели */
  overflow: hidden;
}
.page-head-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;      /* слайды разной пропорции обрезаются, без «прыжков» */
  border-radius: 10px;
  display: block;
  cursor: pointer;        /* картинка кликабельна — открывает лайтбокс */
  transition: opacity .25s ease;
}
@media (max-width: 640px) {
  .page-head-grid { grid-template-columns: 1fr; }
  .page-head-img { justify-content: center; }
}

/* ---------- Лайтбокс (просмотр картинок в реальном размере) ---------- */
.lightbox {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, .88);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.lightbox.open { display: flex; }
.lb-img {
  max-width: 90vw;
  max-height: 86vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0,0,0,.6);
  transition: opacity .18s ease;
}
.lb-close {
  position: absolute;
  top: 16px;
  right: 22px;
  background: none;
  border: none;
  color: #fff;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
}
.lb-close:hover { color: #fdba74; }
.lb-prev, .lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  font-size: 42px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
.lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,.25); }

.table-wrap {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow);
}
/* В режиме секций общая рамка не нужна — каждая секция своя карточка */
.table-wrap.sections-mode {
  background: none;
  border: none;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}
.section-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}
.table-wrap.sections-mode > .section-card:last-child { margin-bottom: 0; }
.table-scroll { overflow-x: auto; }
.section-card .section-media {
  margin: 12px 18px 0;
}
table { width: 100%; border-collapse: collapse; min-width: 520px; }
thead th {
  background: var(--dark);
  color: #fff;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 14px 16px;
  white-space: nowrap;
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
  font-weight: 600;
}
tbody tr:nth-child(even) { background: var(--bg-soft); }
tbody tr:hover { background: #fff7f0; }
td.price { color: #dc2626; font-weight: 700; text-align: right; white-space: nowrap; }
th.price { text-align: center; }
table .num { text-align: right; white-space: nowrap; }
th.center, td.center { text-align: center; }

/* Разовая подсветка цен (data/price_colors.js): зелёный — цена обновлена
   из нового прайса, красный — не обновлялась. Снять — убрать подключение файла. */
td.price-new { color: #16a34a; font-weight: 700; }
td.price-old { color: #dc2626; font-weight: 700; }

/* Широкие таблицы (фундаменты: 6 колонок) — уменьшаем отступы, чтобы влезли */
.page-fundamenty .table-wrap table th,
.page-fundamenty .table-wrap table td {
  padding-left: 8px;
  padding-right: 8px;
}
/* В колонке «Размеры (см) ДхШхВ» буквы х должны оставаться маленькими (без text-transform) */
.page-fundamenty .table-wrap table thead th:nth-child(2) {
  text-transform: none;
}

.note { margin-top: 16px; color: var(--muted); font-size: 13px; }

/* Подпись про доставку под таблицей «Бетон» (страница «Раствор и бетон»):
   тем же шрифтом, что и заголовки таблицы — 15px, полужирный, чёрный текст,
   светло-зелёная подложка на всю ширину */
.page-rastvor .note {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  background: #bbf7d0;      /* светло-зелёный фон */
  padding: 8px 14px;
  border-radius: 6px;
  margin-top: 8px;
}
.page-rastvor .note:first-of-type { margin-top: 16px; }

/* ---------- Карточки-строки (квартиры и т.п.) ----------
   Вместо таблицы: карточки на всю ширину, внутри 3 равные колонки
   (текст + картинка + статус), визуально как строка таблицы */
.cards-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.data-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: center;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.data-card:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(234,88,12,.15);
}
.data-card-col {
  min-width: 0;
}
.data-card-text {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}
.data-card-img {
  display: flex;
  justify-content: center;
}
.data-card-img img {
  max-width: 100%;
  max-height: 90px;
  height: auto;
  border-radius: 8px;
  display: block;
  cursor: pointer;
}
.data-card-status {
  font-size: 16px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}
.data-card-status.status-available { color: #16a34a; }
.data-card-status.status-reserved { color: #dc2626; }

@media (max-width: 640px) {
  .data-card { grid-template-columns: 1fr; text-align: center; }
  .data-card-status { text-align: center; }
  .data-card-img img { margin: 0 auto; }
}

/* Секции внутри таблиц (заголовок над карточкой секции) */
.section-table-title {
  margin: 0 0 10px;
  font-size: 19px;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.table-wrap.sections-mode > .section-table-title { margin-top: 22px; }
.table-wrap.sections-mode > .section-table-title:first-child { margin-top: 0; }
/* Медиа-блок, вставленный напрямую в .table-wrap (страницы без секций, напр. Плиты) */
.table-wrap:not(.sections-mode) > .section-media { margin: 14px 18px 6px; }
/* Медиа-блок под заголовком секции: невидимая сетка 2 равные колонки */
.section-media {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: center;
}
.section-card .section-media { margin: 14px 18px 6px; }
.section-media-text {
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  /* Текст описания — по ширине ячейки (ровный правый край) */
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}
/* Ячейка с картинкой: картинка по центру ячейки (была прижата влево) */
.section-media-img {
  display: flex;
  justify-content: center;
}
.section-media-img img {
  max-width: 100%;
  max-height: 260px;
  width: auto;
  height: auto;
  border-radius: 10px;
  display: block;
}
.table-divider {
  border: none;
  border-top: 1px solid var(--accent);
  margin: 22px 18px 0;
  opacity: .55;
}

/* ---------- Заглушка "в разработке" ---------- */
.coming-soon {
  text-align: center;
  padding: 70px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--muted);
}
.coming-soon .big { font-size: 44px; margin-bottom: 12px; }
.coming-soon h2 { color: var(--ink); margin: 0 0 8px; }

/* ---------- Текстовый блок вместо таблицы ---------- */
.info-text {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 28px 22px;
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.6;
}

/* ---------- Контакты ---------- */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}
.contact-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--bg);
}
.contact-card h4 { margin: 0 0 6px; display:flex; gap:8px; align-items:center; }
.contact-card p { margin: 0; color: var(--muted); }
.contact-card.contact-card-main p { font-size: 18px; line-height: 1.6; }
.contact-card.contact-card-main .contact-title { font-weight: 800; margin: 0 0 12px; }
.contact-card.contact-card-main .contact-gap { margin: 0 0 16px; }

/* Блок контактов на страницах прайса (например, «Изделия для фундаментов») —
   те же карточки, что и на главной, в две колонки под текстом страницы */
.contacts-block { margin-top: 26px; }

/* Заголовок контактной карточки («ДЛЯ ОРГАНИЗАЦИЙ» и т.п.) — жёлтая подложка,
   как подпись про доставку на странице «Раствор и бетон» */
.contact-card.contact-card-main .contact-title {
  background: #fff176;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 6px;
}

/* ---------- Подвал ---------- */
.site-footer {
  background: var(--dark);
  color: #9ca3af;
  padding: 28px 0;
  font-size: 14px;
}
.footer-inner { display:flex; flex-wrap:wrap; gap:12px; justify-content:space-between; align-items:center; }
.site-footer a { color: #d1d5db; }
.site-footer a:hover { color: #fff; }

/* ---------- Кнопки ---------- */
.btn {
  display:inline-block;
  background: var(--accent);
  color:#fff;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 600;
  transition: background .15s;
}
.btn:hover { background: var(--accent-dark); }

/* ---------- Адаптив ---------- */
@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .hero { padding: 48px 0 40px; }
  .section { padding: 40px 0; }
  .contacts-grid { grid-template-columns: 1fr; }
}