/*
Theme Name: USE.by
Theme URI: https://use.by
Author: CreateMe
Description: Тема аренды мультимедийного оборудования USE.by. Вёрстка по HTML-аудиту, URL и тексты сохранены с Joomla.
Version: 1.2.10
Requires at least: 6.4
Tested up to: 6.8
Requires PHP: 8.1
Text Domain: use
License: GPL-2.0-or-later
*/

/* Mobile-first chrome: hide mobile controls on desktop only. */
@media (min-width: 1100px) {
  [data-mobile-only] {
    display: none !important;
  }
}

@media (max-width: 1099px) {
  [data-hub-grid] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

html,
body {
  margin: 0;
  padding: 0;
  background: #ffffff;
  color: #14181c;
  font-family: Manrope, Helvetica, Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.use-page-shell {
  width: 100%;
  min-height: 100vh;
  padding-bottom: 16px;
  background: #ffffff;
  color: #14181c;
  font-family: Manrope, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
p, span, a, li, button, input, textarea, select, label, td, th {
  font-family: inherit;
}

/* Mobile menu / modal scroll lock — keep overlay above page chrome. */
html.use-scroll-lock,
html.use-menu-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}

html.use-scroll-lock body,
html.use-menu-open body,
body.use-scroll-lock {
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;
}

[data-use-mobile-menu] {
  z-index: 10000 !important;
  width: 100% !important;
  height: 100% !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  overscroll-behavior: none !important;
  background: #ffffff !important;
}

[data-use-mobile-menu] [data-use-menu-scroll] {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

[data-use-modal-box] {
  z-index: 10001 !important;
  box-sizing: border-box;
}
[data-use-modal-box] > form,
[data-use-dropzone] {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
}
[data-use-file-hint] {
  color: #4c5561;
}

/* Blog / case article body — images and text share one column width. */
.use-article-body,
.use-legacy-content {
  font-family: inherit;
  color: #3c444e;
  font-size: 17px;
  line-height: 1.65;
}

.use-article-body > *:first-child {
  margin-top: 0;
}

.use-article-body p,
.use-legacy-content p {
  margin: 0 0 1.1em;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.use-article-body img,
.use-legacy-content img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 1.25em 0;
  border-radius: 16px;
}

.use-article-body figure,
.use-legacy-content figure {
  margin: 1.25em 0;
  max-width: 100%;
}

.use-article-body figure img,
.use-legacy-content figure img {
  margin: 0;
}

.use-article-body a {
  color: #2b96d9;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.use-article-body a:hover {
  color: #1c7dbb;
}

.use-article-body h2,
.use-article-body h3,
.use-legacy-content h2,
.use-legacy-content h3 {
  margin: 1.5em 0 0.55em;
  color: #14181c;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.use-article-body h2,
.use-legacy-content h2 {
  font-size: 28px;
}

.use-article-body h3,
.use-legacy-content h3 {
  font-size: 22px;
}

.use-article-body ul,
.use-article-body ol,
.use-legacy-content ul,
.use-legacy-content ol {
  margin: 0 0 1.1em;
  padding-left: 1.25em;
}

.use-article-body li,
.use-legacy-content li {
  margin: 0 0 0.35em;
}

@media (min-width: 720px) {
  [data-aside] {
    position: sticky !important;
    top: 24px;
    align-self: start;
  }

  /* Case/blog article grid must not create a sticky containing block. */
  [data-article-grid] {
    align-items: start;
  }
}

/* Catalog product cards: keep price/actions visible; equal card stretch. */
[data-product-grid]:not(:has([data-prod-title])) {
  align-items: stretch;
}

[data-product-card] {
  height: 100%;
  min-height: 0;
}

[data-product-card] > div:last-child {
  margin-top: auto;
  flex-shrink: 0;
}

/* --- Adaptive parity with audit v2 (wins over concatenated main.css leaks) --- */
@media (max-width: 1099px) {
  [data-desktop-only],
  [data-mega-nav] {
    display: none !important;
  }
  [data-mobile-only] {
    display: flex !important;
  }
  button[data-use-menu-open] {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
  }
  a[data-mobile-only][aria-label] {
    flex-shrink: 0 !important;
  }

  /* Homepage stats: clean 2×2, no catalog even-borders (matches Главная audit) */
  body.home div[data-stats-row] {
    gap: 26px 20px !important;
    padding-bottom: 0 !important;
  }
  body.home div[data-stats-row] > div {
    padding: 0 !important;
    border-left: none !important;
  }
  body.home div[data-stats-row] > div:nth-child(even) {
    padding-left: 0 !important;
    border-left: none !important;
  }

  /* Karaoke only: 2-col on tablet (audit); other catalogs keep auto-fit until 719 */
  div[data-product-grid][data-karaoke-grid] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  /* Cases: same stacked layout as homepage on every page */
  [data-cases-grid],
  [data-case-grid],
  [data-case-grid-rev],
  div[style*="grid-template-columns:1.4fr 1fr"],
  div[style*="grid-template-columns: 1.4fr 1fr"],
  div[style*="grid-template-columns:1fr 1.4fr"],
  div[style*="grid-template-columns: 1fr 1.4fr"] {
    grid-template-columns: 1fr !important;
  }
  a[data-zoom="case0"] {
    min-height: 360px !important;
  }
}

@media (max-width: 719px) {
  /* Catalog product cards typography (title is direct span) */
  div[data-product-card] > span:first-of-type {
    font-size: 16px !important;
  }
  div[data-product-card] > span:nth-of-type(2) {
    font-size: 12.5px !important;
    line-height: 1.4 !important;
  }
  a[data-details-btn] {
    display: none !important;
  }
  /* Keep «От N руб./сутки» on one line in narrow 2-col cards */
  div[data-product-card] > div:last-child > span:first-child {
    white-space: nowrap !important;
  }

  /* Hero shell: theme pages use <section>; home uses <div> like audit */
  section[style*="min(560px"],
  div[style*="min(560px"] {
    height: auto !important;
    min-height: 0 !important;
    padding-top: 12px !important;
    padding-bottom: 56px !important;
    width: calc(100% - 24px) !important;
  }

  /*
   * Hero title/text/CTA — audit mobile: 24px top (catalog + home).
   * Keep flex from stretching empty space under the CTA.
   */
  .use-page-shell [data-hero-copy],
  section[style*="min(560px"] > section,
  div[style*="min(560px"] > [data-hero-copy] {
    padding-top: 24px !important;
    align-items: flex-start !important;
    flex: 0 0 auto !important;
  }

  /* «Наши проекты»: catalog h2 { margin-bottom:22px } misaligns title vs «Все проекты» */
  [data-cases-preview] h2 {
    margin: 0 !important;
  }
  a[data-zoom="case0"] {
    min-height: 300px !important;
    padding: 20px !important;
  }

  /* Home hero subtitle must stay 18px — catalog CSS leaks 16.5px onto section heroes */
  body.home div[style*="min(560px"] p {
    font-size: 18px !important;
    line-height: 1.55 !important;
  }

  /*
   * Catalog CSS broadly zeroes [style*="margin-bottom:36px"] (hero CTA on category pages).
   * On home that also kills the equipment intro block margin → card sticks to paragraph.
   */
  body.home [style*="margin-bottom:36px"],
  body.home [style*="margin-bottom: 36px"] {
    margin-bottom: 36px !important;
  }

  /* Tender / lead modal: keep the file dropzone inside the card on phones */
  [data-use-modal-box] {
    padding: 12px !important;
    align-items: flex-start !important;
    padding-top: 16px !important;
  }
  [data-use-modal-box] > form {
    padding: 20px 16px !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  [data-use-file-hint] {
    flex: 1 1 100% !important;
  }
  [data-article-grid] {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 32px !important;
  }
  [data-aside] {
    position: static !important;
    width: 100% !important;
  }

  /* Photozone / hub galleries stay two columns on phones */
  [data-gallery] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  [data-hub-grid] {
    grid-template-columns: 1fr !important;
  }

  /* Number + nested plus share clamp; label is the column's last direct span */
  body.home div[data-stats-row] > div > span:first-child {
    font-size: clamp(34px, 3vw, 46px) !important;
    font-weight: 700 !important;
  }
  body.home div[data-stats-row] > div > span:first-child > span {
    font-size: inherit !important;
    font-weight: inherit !important;
  }
  body.home div[data-stats-row] > div > span:last-child {
    font-size: 15.5px !important;
    font-weight: 400 !important;
  }

  /* Match audit cascade: generic padding:20px wins over park's 22px */
  div[data-zoom="park"] {
    padding: 20px !important;
  }

  [data-desktop-only],
  [data-mega-nav] {
    display: none !important;
  }
}

/* Case photo cards — strong bottom shadow for white caption contrast. */
[data-case-scrim] {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(16, 20, 26, 0) 28%,
    rgba(16, 20, 26, 0.35) 52%,
    rgba(16, 20, 26, 0.72) 74%,
    rgba(16, 20, 26, 0.92) 100%
  );
}
[data-case-scrim="compact"] {
  background: linear-gradient(
    180deg,
    rgba(16, 20, 26, 0) 8%,
    rgba(16, 20, 26, 0.28) 32%,
    rgba(16, 20, 26, 0.7) 68%,
    rgba(16, 20, 26, 0.94) 100%
  );
}

/* Rich text from Meta Box WYSIWYG (FAQ / cards). */
.use-rich > p {
  margin: 0 0 0.75em;
}
.use-rich > p:last-child {
  margin-bottom: 0;
}
.use-rich > ul,
.use-rich > ol {
  margin: 0.4em 0 0.75em;
  padding-left: 1.25em;
}
.use-rich a {
  color: #2b96d9;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
