/* Mobile UX fixes — pk-profilplus.ru (max-width: 600px / 768px) */

@media screen and (max-width: 600px) {
  /* P0: iOS zoom prevention — inputs >= 16px */
  input.input,
  textarea.input,
  select.input,
  .input,
  input[type="text"],
  input[type="tel"],
  input[type="email"],
  input[type="number"],
  input[type="search"],
  textarea,
  select,
  .hero2__panel-form .input,
  .fence-selector input,
  .fence-selector textarea,
  .fence-selector select {
    font-size: 16px !important;
  }

  /* Header: keep phone text hidden (adaptiv), only icon; no flex-breaking tap rules */
  .header .tel-header .tel-mob,
  .header a.tel.tel-mob {
    display: none !important;
  }

  .header .tel-header {
    padding-right: 0;
    flex-shrink: 0;
  }

  .header .social {
    flex-shrink: 0;
    gap: 0.35rem;
  }

  .header .social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
  }

  .header .social img {
    width: 28px;
    height: 28px;
    pointer-events: none;
  }

  /* Promo banners: long titles overflowed / clipped under sticky CTA */
  .promo-item {
    aspect-ratio: auto;
    min-height: 240px;
    padding: 1.15rem 1rem 5.5rem;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }

  .promo-title {
    font-size: clamp(1.05rem, 5.2vw, 1.35rem);
    line-height: 1.15;
    margin-bottom: 0.5rem;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
  }

  .promo-title strong {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .promo-subtitle {
    font-size: 0.92rem;
    line-height: 1.35;
    max-width: 100%;
  }

  /* P0: sticky add-to-cart bar on product pages */
  .product-sticky-buy {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 13;
    grid-template-columns: 1fr auto;
    gap: 0.65em;
    align-items: center;
    padding: 0.65em 1rem;
    padding-bottom: calc(0.65em + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid #e3e3e3;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(8px);
  }

  .product-sticky-buy.is-visible {
    display: grid;
  }

  .product-sticky-buy__price {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
    color: #1a1a1a;
  }

  .product-sticky-buy__price .mvtforms2-price,
  .product-sticky-buy__price .msoptionsprice-cost {
    font-size: 1.15rem;
  }

  .product-sticky-buy__btn {
    min-height: 44px;
    padding: 0.65em 1.1em;
    white-space: nowrap;
    border: 0;
    cursor: pointer;
  }

  body.has-product-sticky-buy {
    padding-bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
  }

  /* P1: hero — keep primary + catalog; demote «Задать вопрос» to text */
  .hero2__actions {
    flex-wrap: wrap;
  }

  .hero2__actions a.hero2__secondary[href="#callback"],
  .hero2__actions a.bric:nth-child(3) {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    color: #fff !important;
    text-decoration: underline;
    padding: 0.35rem 0 !important;
    min-height: auto !important;
    width: 100%;
    justify-content: flex-start;
    font-size: 0.9rem;
  }

  /* P1: denser KSP on hero if grid */
  .hero2__ksp,
  .hero2__stats {
    font-size: 0.85em;
  }

  /* P1: quiz radios readable */
  .fence-selector label,
  .fence-selector__option,
  .fence-selector [class*="radio"] {
    font-size: 14px !important;
  }

  /* P2: clamp product card titles */
  .card .card-name,
  .card .card-name a,
  .card_txt .card-name a {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    min-height: 2.6em;
    line-height: 1.3;
  }
}

@media screen and (min-width: 601px) {
  .product-sticky-buy {
    display: none !important;
  }

  body.has-product-sticky-buy {
    padding-bottom: 0 !important;
  }
}

/* P1: tablet catalog — avoid cramped multi-column */
@media screen and (max-width: 768px) and (min-width: 601px) {
  .grid-3,
  .grid-4,
  .grid-5 {
    grid-template-columns: 1fr 1fr;
  }
}

@media screen and (max-width: 1024px) and (min-width: 769px) {
  .grid-4,
  .grid-5 {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
