/* ДЕЛСНАБ — адаптивная вёрстка */
:root {
  --ds-px: 40px;
  --ds-py: 96px;
  --ds-gap: 64px;
}

@media (max-width: 1024px) {
  :root {
    --ds-px: 28px;
    --ds-py: 72px;
    --ds-gap: 40px;
  }
}

@media (max-width: 767px) {
  :root {
    --ds-px: 16px;
    --ds-py: 56px;
    --ds-gap: 28px;
  }
}

.ds-section-tight {
  padding-bottom: 24px !important;
}

@media (max-width: 767px) {
  .ds-section-tight {
    padding-bottom: 16px !important;
  }
}

/* ——— контейнеры секций ——— */
.ds-section,
#catalog,
#portfolio,
footer .ds-section {
  padding-left: var(--ds-px) !important;
  padding-right: var(--ds-px) !important;
}

.ds-section {
  padding-top: var(--ds-py) !important;
  padding-bottom: var(--ds-py) !important;
}

#catalog,
#portfolio {
  padding-top: var(--ds-py) !important;
  padding-bottom: var(--ds-py) !important;
}

#portfolio {
  padding-top: calc(var(--ds-py) - 16px) !important;
}

footer .ds-section {
  padding-top: calc(var(--ds-py) - 32px) !important;
  padding-bottom: var(--ds-px) !important;
}

#contacts .ds-section {
  padding-top: var(--ds-py) !important;
  padding-bottom: var(--ds-py) !important;
}

/* ——— типографика ——— */
.ds-h2,
#catalog h2,
#portfolio h2,
#about h2,
#contacts h2 {
  font-size: clamp(28px, 5vw, 42px) !important;
}

#top h1 {
  font-size: clamp(34px, 7.5vw, 62px) !important;
}

#contacts h2 {
  font-size: clamp(30px, 6vw, 52px) !important;
}

/* ——— сетки ——— */
.ds-grid-2 {
  display: grid;
}

@media (max-width: 1024px) {
  .ds-grid-2 {
    grid-template-columns: 1fr !important;
    gap: var(--ds-gap) !important;
  }
}

.ds-grid-3 {
  display: grid;
}

@media (max-width: 1024px) {
  .ds-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
  }
}

@media (max-width: 600px) {
  .ds-grid-3 {
    grid-template-columns: 1fr !important;
  }
}

.ds-grid-4 {
  display: grid;
}

@media (max-width: 1200px) {
  .ds-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 600px) {
  .ds-grid-4 {
    grid-template-columns: 1fr !important;
  }
}

/* каталог bento */
[data-cat-grid] {
  display: grid;
}

@media (max-width: 1200px) {
  [data-cat-grid] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-rows: minmax(240px, auto) !important;
  }

  [data-cat-grid] [data-featured] {
    grid-column: span 2 !important;
    grid-row: span 1 !important;
    min-height: 360px;
  }

  [data-cat-grid] [data-featured] h3 {
    font-size: clamp(24px, 4vw, 34px) !important;
  }
}

@media (max-width: 640px) {
  [data-cat-grid] {
    grid-template-columns: 1fr !important;
    grid-auto-rows: auto !important;
    gap: 14px !important;
  }

  [data-cat-grid] [data-featured] {
    grid-column: span 1 !important;
    min-height: 300px;
  }

  [data-cat-grid] [data-featured] > div:last-child {
    padding: 24px !important;
  }
}

/* портфолио */
#portfolio .ds-grid-3 {
  grid-auto-rows: minmax(200px, auto) !important;
}

@media (max-width: 767px) {
  #portfolio .ds-grid-3 {
    grid-auto-rows: minmax(180px, auto) !important;
    gap: 14px !important;
  }
}

/* about stats */
#about .ds-about-stats {
  gap: 20px !important;
}

@media (max-width: 600px) {
  #about .ds-about-stats {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
}

/* contacts footer row */
#contacts .ds-contacts-row {
  gap: 20px !important;
}

@media (max-width: 767px) {
  #contacts .ds-contacts-row {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
}

/* footer */
.ds-footer-grid {
  display: grid;
}

@media (max-width: 1024px) {
  .ds-footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 32px !important;
  }
}

@media (max-width: 560px) {
  .ds-footer-grid {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }
}

/* ——— header ——— */
#ds-header-inner {
  padding-left: var(--ds-px) !important;
  padding-right: var(--ds-px) !important;
}

#ds-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #ddd6cb;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  flex-shrink: 0;
  justify-self: end;
}

#ds-menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: #17150f;
  border-radius: 2px;
  position: relative;
  transition: background 0.25s;
}

#ds-menu-btn span::before,
#ds-menu-btn span::after {
  content: '';
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: #17150f;
  border-radius: 2px;
  transition: transform 0.25s, top 0.25s, opacity 0.25s;
}

#ds-menu-btn span::before {
  top: -6px;
}

#ds-menu-btn span::after {
  top: 6px;
}

#ds-root[data-menu-open] #ds-menu-btn span {
  background: transparent;
}

#ds-root[data-menu-open] #ds-menu-btn span::before {
  top: 0;
  transform: rotate(45deg);
}

#ds-root[data-menu-open] #ds-menu-btn span::after {
  top: 0;
  transform: rotate(-45deg);
}

#ds-mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(15, 14, 10, 0.96);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  padding: calc(84px + env(safe-area-inset-top, 0px)) var(--ds-px) calc(24px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
}

#ds-mobile-nav[hidden] {
  display: none !important;
}

#ds-mobile-nav a {
  font-family: 'Onest', sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 7vw, 36px);
  color: #fff;
  text-decoration: none;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#ds-mobile-nav .ds-mobile-meta {
  margin-top: auto;
  padding-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#ds-mobile-nav .ds-mobile-meta a {
  font-size: 22px;
  border: none;
  padding: 0;
}

#ds-mobile-nav .ds-mobile-call {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Onest', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  background: #E8590C;
  border: none;
  padding: 16px 24px;
  border-radius: 12px;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(232, 89, 12, 0.34);
}

@media (max-width: 860px) {
  #ds-header-inner {
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    gap: 12px !important;
    height: 72px !important;
  }

  #ds-nav {
    display: none !important;
  }

  #ds-header-actions {
    display: none !important;
  }

  #ds-menu-btn {
    display: inline-flex !important;
  }

  #ds-header-inner > a span:first-child {
    font-size: 22px !important;
  }

  #ds-hero-switch {
    right: 14px;
  }
}

#ds-root[data-hero-v2="1"][data-header-ghost="1"] #ds-menu-btn {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

#ds-root[data-hero-v2="1"][data-header-ghost="1"] #ds-menu-btn span,
#ds-root[data-hero-v2="1"][data-header-ghost="1"] #ds-menu-btn span::before,
#ds-root[data-hero-v2="1"][data-header-ghost="1"] #ds-menu-btn span::after {
  background: #fff;
}

#ds-root[data-hero-v2="1"][data-header-ghost="1"][data-menu-open] #ds-menu-btn span {
  background: transparent;
}

/* ——— hero v1 ——— */
#top .ds-hero-v1-inner {
  padding-top: calc(72px + 16px) !important;
  padding-bottom: var(--ds-py) !important;
}

@media (max-width: 1024px) {
  #top .ds-hero-v1-inner {
    padding-top: calc(72px + 8px) !important;
  }
}

#top .ds-hero-v1-stats {
  flex-wrap: wrap;
  gap: 24px !important;
}

@media (max-width: 600px) {
  #top .ds-hero-v1-stats {
    gap: 16px !important;
  }

  #top .ds-hero-v1-stats > div[style*='width:1px'] {
    display: none;
  }
}

#top .ds-hero-v1-badge {
  position: relative !important;
  left: auto !important;
  bottom: auto !important;
  margin-top: 16px;
  animation: none !important;
}

@media (max-width: 767px) {
  #top [data-parallax='-0.05'] {
    transform: none !important;
  }
}

/* ——— hero v2 ——— */
@media (max-width: 767px) {
  #ds-v2-card-1 {
    left: 3% !important;
    right: auto !important;
    top: 13% !important;
    bottom: auto !important;
    width: calc(50% - 0.5rem) !important;
    height: 22% !important;
  }

  #ds-v2-card-2 {
    right: 3% !important;
    left: auto !important;
    top: 13% !important;
    bottom: auto !important;
    width: calc(50% - 0.5rem) !important;
    height: 22% !important;
  }

  #ds-v2-card-3 {
    left: 3% !important;
    right: auto !important;
    bottom: 13% !important;
    top: auto !important;
    width: calc(50% - 0.5rem) !important;
    height: 22% !important;
  }

  #ds-v2-card-4 {
    right: 3% !important;
    left: auto !important;
    bottom: 13% !important;
    top: auto !important;
    width: calc(50% - 0.5rem) !important;
    height: 22% !important;
  }

  #ds-v2-card-1 div:last-child,
  #ds-v2-card-2 div:last-child,
  #ds-v2-card-3 div:last-child,
  #ds-v2-card-4 div:last-child {
    font-size: 9px !important;
    left: 10px !important;
    right: 10px !important;
    bottom: 10px !important;
  }

  #ds-v2-grid > div:nth-child(2),
  #ds-v2-grid > div:nth-child(3) {
    display: none;
  }

  #ds-v2-content h1.ds-v2-fade {
    font-size: clamp(40px, 14vw, 96px) !important;
  }

  #ds-v2-content .ds-v2-fade:nth-child(2) {
    letter-spacing: 0.16em !important;
    margin: 16px 0 24px !important;
  }

  #ds-v2-frame-caption {
    left: 12px !important;
    bottom: 12px !important;
  }

  #ds-v2-frame-caption div:nth-child(2) {
    font-size: 22px !important;
  }

  #ds-root[data-hero-v2='1'] #ds-steel-marquee {
    display: none;
  }

  #ds-hero-v2 [data-v2-marquee] {
    flex-wrap: nowrap;
  }

  #ds-v2-video-btn span:last-child {
    font-size: 10px !important;
  }
}

@media (max-width: 480px) {
  #ds-v2-content .ds-v2-fade[style*='display:flex'] {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
  }

  #ds-v2-content .ds-v2-fade[style*='display:flex'] a {
    justify-content: center !important;
    width: 100%;
  }
}

/* ——— storyboard ——— */
[data-storyboard] {
  height: 340vh;
}

@media (max-width: 767px) {
  [data-storyboard] {
    height: 280vh;
  }

  [data-storyboard] .ds-section {
    padding-left: var(--ds-px) !important;
    padding-right: var(--ds-px) !important;
  }

  [data-sb-track] {
    padding-left: var(--ds-px) !important;
    padding-right: var(--ds-px) !important;
    height: clamp(260px, 46vh, 360px) !important;
  }

  [data-sb-panel] {
    width: min(88vw, 420px) !important;
    margin-right: 16px !important;
    padding: 24px !important;
  }
}

/* ——— прочее ——— */
#ds-top {
  right: var(--ds-px) !important;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
}

@media (max-width: 767px) {
  #ds-top {
    width: 48px !important;
    height: 48px !important;
    right: 16px !important;
  }

  #ds-hero-switch [data-hero-tab] {
    width: 34px !important;
    height: 34px !important;
    font-size: 12px !important;
  }

  [data-supply-stat] {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  [data-supply-stat] > div:first-child {
    min-width: 0 !important;
    font-size: 32px !important;
  }
}

@media (max-width: 767px) {
  #ds-v2-video-modal {
    padding: 16px !important;
  }

  #ds-v2-video-modal p {
    font-size: 16px !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE FIX v2 — полная доводка
   ═══════════════════════════════════════════════════════════ */

/* 1. Тест-переключатель «1 / 2»: скрыть на телефоне */
@media (max-width: 860px) {
  #ds-hero-switch { display: none !important; }
}

@media (max-width: 767px) {

  /* 2. Лого-ссылка: минимальная тач-зона 44px */
  #ds-header-inner > a {
    min-height: 44px;
    justify-content: center;
    padding: 2px 0;
  }

  /* 3. Hero v2: убрать плавающие карточки с нечитаемыми подписями */
  #ds-v2-cards { display: none !important; }

  /* 4. Hero v2: подзаголовок «Металлоконструкции для…» — читаемый */
  #ds-v2-content p.ds-v2-fade {
    font-size: clamp(13px, 3.5vw, 16px) !important;
    letter-spacing: 0.12em !important;
    margin: 14px 0 22px !important;
  }

  /* 5. Кнопка «Смотреть производство»: тач-зона */
  #ds-v2-video-btn {
    min-height: 44px;
    padding: 10px 0 !important;
  }
  #ds-v2-video-btn > span:last-child {
    font-size: 12px !important;
    letter-spacing: 0.14em !important;
  }

  /* 6+7. Все 11px-элементы → 13px (dc-runtime пишет «font-size: 11px» с пробелом)
     Покрывает: чипы storyboard, подписи стат-карточек, caption hero v2 */
  [style*="font-size: 11px"] {
    font-size: 13px !important;
    letter-spacing: 0.06em !important;
  }
  /* Storyboard chip: чуть большие отступы */
  [data-sb-panel] > div:first-child > div:last-child {
    font-size: 13px !important;
    padding: 6px 12px !important;
  }

  /* 8. 3D-виджет: скрыть подсказку «перетащите для вращения» */
  #ds-hero3d > div:last-child {
    display: none !important;
  }

  /* 9. Footer: nav-ссылки — тач-зона */
  .ds-footer-grid a {
    display: block;
    padding: 9px 0 !important;
    line-height: 1.4 !important;
  }

  /* 10. Footer: email в блоке контактов */
  footer a[href^="mailto"] {
    display: inline-block;
    padding: 8px 0 !important;
    font-size: 15px !important;
  }

  /* 11. Footer bottom bar: «Политика» / «Карта сайта» */
  footer > div > div:last-child a {
    display: inline-block;
    padding: 8px 0 !important;
    min-height: 40px;
    line-height: 24px;
  }

  /* 12. Contacts: email */
  #contacts a[href^="mailto"] {
    display: block;
    padding: 8px 0 !important;
    font-size: 18px !important;
  }

  /* 13. Supply stats: текстовые подписи */
  [data-supply-stat] > div:last-child {
    font-size: 13px !important;
    line-height: 1.4 !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   ADVANTAGES GRID — 2 карточки в ряд на мобильном
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .ds-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }
  /* Уменьшить внутренние отступы карточек преимуществ */
  section.ds-section > .ds-grid-3 > div {
    padding: 20px 14px !important;
  }
  section.ds-section > .ds-grid-3 > div > div[style*="font-size:30px"],
  section.ds-section > .ds-grid-3 > div > div[style*="font-size: 30px"] {
    font-size: 22px !important;
    margin-bottom: 10px !important;
  }
  section.ds-section > .ds-grid-3 > div > div[style*="font-size:20px"],
  section.ds-section > .ds-grid-3 > div > div[style*="font-size: 20px"] {
    font-size: 15px !important;
    margin-bottom: 6px !important;
  }
  section.ds-section > .ds-grid-3 > div > p {
    font-size: 13px !important;
    line-height: 1.5 !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE NAV FIX — dc-runtime (React) drops the `hidden` attr
   because `hidden=""` is falsy → removeAttribute("hidden").
   Switch to data-menu-open on #ds-root for visibility control.
   ═══════════════════════════════════════════════════════════ */
#ds-mobile-nav {
  display: none !important;
}
#ds-root[data-menu-open] #ds-mobile-nav {
  display: flex !important;
}
