/* WaySklad mobile density v1.1 — 2026-08-25 */

@media (max-width: 639px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  html[data-ws-page] main {
    overflow-x: clip;
  }

  /* Floating call button: it must remain accessible without covering the copy. */
  .ws-floating-call {
    right: 12px !important;
    bottom: 14px !important;
    padding: 11px !important;
    border-width: 1px !important;
  }

  .ws-floating-call svg {
    width: 22px !important;
    height: 22px !important;
  }

  /* Home: keep two useful cards per row, but stop long names from taking over. */
  html[data-ws-page="home"] .ws-home-popular-products {
    padding-inline: 8px !important;
  }

  html[data-ws-page="home"] .ws-product-card-grid {
    gap: 8px !important;
  }

  html[data-ws-page="home"] .ws-product-card {
    min-width: 0;
    border-radius: 12px !important;
  }

  html[data-ws-page="home"] .ws-product-card-image {
    height: 104px !important;
    padding: 7px !important;
  }

  html[data-ws-page="home"] .ws-product-card-image > button {
    top: 8px !important;
    right: 8px !important;
    width: 32px !important;
    height: 32px !important;
  }

  html[data-ws-page="home"] .ws-product-card-body {
    padding: 9px !important;
  }

  html[data-ws-page="home"] .ws-product-card-title {
    display: -webkit-box !important;
    min-height: 2.4em !important;
    margin-bottom: 7px !important;
    overflow: hidden !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    font-size: 12px !important;
    line-height: 1.2 !important;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
  }

  html[data-ws-page="home"] .ws-product-card-features {
    margin-bottom: 9px !important;
    font-size: 10px !important;
    line-height: 1.25 !important;
  }

  html[data-ws-page="home"] .ws-product-card-features > :nth-child(n + 3) {
    display: none !important;
  }

  html[data-ws-page="home"] .ws-product-card-footer {
    gap: 4px !important;
    align-items: flex-end !important;
  }

  html[data-ws-page="home"] .ws-product-card-price {
    white-space: nowrap;
    font-size: 16px !important;
    line-height: 1.05 !important;
    letter-spacing: -0.025em;
  }

  html[data-ws-page="home"] .ws-product-card-buy {
    gap: 4px !important;
    padding: 7px 8px !important;
    font-size: 10px !important;
    line-height: 1 !important;
  }

  html[data-ws-page="home"] .ws-product-card-buy svg {
    width: 14px !important;
    height: 14px !important;
  }

  /* Product header: more key information in the first viewport. */
  html[data-ws-page="product"] .ws-product-page {
    padding: 16px 12px 26px !important;
  }

  html[data-ws-page="product"] .ws-product-hero-grid {
    gap: 16px !important;
    margin-bottom: 24px !important;
  }

  html[data-ws-page="product"] .ws-product-main-image {
    min-height: 280px !important;
    padding: 12px !important;
    border-radius: 14px !important;
  }

  html[data-ws-page="product"] .ws-product-summary {
    padding: 14px !important;
    border-radius: 14px !important;
  }

  html[data-ws-page="product"] .ws-product-title {
    margin-top: 6px !important;
    font-size: 22px !important;
    line-height: 1.16 !important;
    letter-spacing: -0.02em;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
  }

  html[data-ws-page="product"] .ws-product-price {
    white-space: nowrap;
    font-size: 26px !important;
    line-height: 1.06 !important;
    letter-spacing: -0.025em;
  }

  html[data-ws-page="product"] .ws-product-quick-specs {
    margin-bottom: 16px !important;
    padding: 12px !important;
  }

  html[data-ws-page="product"] .ws-product-quick-specs > div:first-child {
    margin-bottom: 7px !important;
  }

  html[data-ws-page="product"] .ws-product-tabs > div {
    padding-inline: 12px !important;
  }

  html[data-ws-page="product"] .ws-product-tabs a {
    padding-block: 11px !important;
    font-size: 14px !important;
  }

  html[data-ws-page="product"] .ws-product-tabs .flex.min-w-max {
    gap: 18px !important;
  }

  /* Product description: preserve all SEO copy while making it human-sized. */
  html[data-ws-page="product"] .ws-product-description-stack {
    row-gap: 20px !important;
  }

  html[data-ws-page="product"] .ws-product-description-stack > section {
    padding: 14px !important;
    border-radius: 14px !important;
  }

  html[data-ws-page="product"] .ws-product-description-stack h2,
  html[data-ws-page="product"] .ws-product-description-content h2,
  html[data-ws-page="product"] .seo-rich-content h2 {
    margin-top: 22px !important;
    margin-bottom: 10px !important;
    font-size: 20px !important;
    line-height: 1.22 !important;
    letter-spacing: -0.015em;
  }

  html[data-ws-page="product"] .ws-product-description-stack section > h2:first-child,
  html[data-ws-page="product"] .ws-product-description-content > h2:first-child,
  html[data-ws-page="product"] .seo-rich-content > h2:first-child {
    margin-top: 0 !important;
  }

  html[data-ws-page="product"] .ws-product-description-stack h3,
  html[data-ws-page="product"] .ws-product-description-content h3,
  html[data-ws-page="product"] .seo-rich-content h3 {
    margin-top: 17px !important;
    margin-bottom: 7px !important;
    font-size: 16px !important;
    line-height: 1.3 !important;
  }

  html[data-ws-page="product"] .ws-product-description-stack p,
  html[data-ws-page="product"] .ws-product-description-stack li,
  html[data-ws-page="product"] .ws-product-description-content p,
  html[data-ws-page="product"] .ws-product-description-content li,
  html[data-ws-page="product"] .seo-rich-content p,
  html[data-ws-page="product"] .seo-rich-content li {
    margin-block: 7px !important;
    font-size: 15px !important;
    line-height: 1.52 !important;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
  }

  html[data-ws-page="product"] .ws-product-description-stack ul,
  html[data-ws-page="product"] .ws-product-description-stack ol,
  html[data-ws-page="product"] .seo-rich-content ul,
  html[data-ws-page="product"] .seo-rich-content ol {
    margin-block: 9px !important;
    padding-left: 21px !important;
  }

  html[data-ws-page="product"] .ws-product-description-stack p:empty,
  html[data-ws-page="product"] .seo-rich-content p:empty {
    display: none !important;
  }

  html[data-ws-page="product"] .ws-product-description-stack details {
    padding: 12px !important;
    border-radius: 12px !important;
  }

  html[data-ws-page="product"] .ws-product-description-stack summary {
    font-size: 14px !important;
    line-height: 1.35 !important;
  }

  /* Article typography: denser paragraphs and headings without tiny text. */
  html[data-ws-page="article"] .ws-article-page {
    padding: 14px 10px 24px !important;
  }

  html[data-ws-page="article"] .ws-article-detail {
    border-radius: 14px !important;
  }

  html[data-ws-page="article"] .ws-article-header {
    padding: 18px 14px !important;
  }

  html[data-ws-page="article"] .ws-article-title {
    font-size: 25px !important;
    line-height: 1.13 !important;
    letter-spacing: -0.025em !important;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
  }

  html[data-ws-page="article"] .ws-article-preview {
    margin-top: 12px !important;
    font-size: 15px !important;
    line-height: 1.55 !important;
  }

  html[data-ws-page="article"] .ws-article-layout {
    gap: 18px !important;
    padding: 18px 14px !important;
  }

  html[data-ws-page="article"] .ws-article-blocks > :not([hidden]) ~ :not([hidden]) {
    margin-top: 18px !important;
  }

  html[data-ws-page="article"] .ws-article-blocks h2,
  html[data-ws-page="article"] .ws-article-legacy h2 {
    margin-top: 24px !important;
    margin-bottom: 9px !important;
    font-size: 21px !important;
    line-height: 1.23 !important;
    letter-spacing: -0.015em;
  }

  html[data-ws-page="article"] .ws-article-blocks h3,
  html[data-ws-page="article"] .ws-article-legacy h3 {
    margin-top: 19px !important;
    margin-bottom: 7px !important;
    font-size: 18px !important;
    line-height: 1.28 !important;
  }

  html[data-ws-page="article"] .ws-article-blocks p,
  html[data-ws-page="article"] .ws-article-blocks li,
  html[data-ws-page="article"] .ws-article-blocks blockquote,
  html[data-ws-page="article"] .ws-article-legacy p,
  html[data-ws-page="article"] .ws-article-legacy li,
  html[data-ws-page="article"] .ws-article-legacy blockquote {
    margin-block: 7px !important;
    font-size: 15px !important;
    line-height: 1.55 !important;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
  }

  html[data-ws-page="article"] .ws-article-blocks aside,
  html[data-ws-page="article"] .ws-article-blocks blockquote {
    padding: 12px !important;
    border-radius: 12px !important;
  }

  html[data-ws-page="article"] .ws-article-blocks details summary {
    padding: 12px 13px !important;
    font-size: 14px !important;
    line-height: 1.35 !important;
  }

  html[data-ws-page="article"] .ws-article-blocks details > div {
    padding: 12px 13px !important;
    font-size: 14px !important;
    line-height: 1.55 !important;
  }

  /* Tables scroll horizontally. Columns stay readable instead of breaking words. */
  html[data-ws-page="article"] .ws-article-table {
    max-width: 100%;
    overflow-x: auto !important;
    border-radius: 12px !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  html[data-ws-page="article"] .ws-article-table::before {
    content: "Листайте таблицу вправо →";
    display: block;
    position: sticky;
    left: 0;
    width: max-content;
    padding: 7px 10px;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
  }

  html[data-ws-page="article"] .ws-article-table table {
    width: max-content !important;
    min-width: 680px !important;
    table-layout: auto !important;
    font-size: 13px !important;
  }

  html[data-ws-page="article"] .ws-article-table th,
  html[data-ws-page="article"] .ws-article-table td {
    min-width: 170px;
    padding: 10px 12px !important;
    line-height: 1.4 !important;
    white-space: normal;
    overflow-wrap: normal !important;
    word-break: normal !important;
    hyphens: none !important;
  }

  html[data-ws-page="article"] .ws-article-table th:first-child,
  html[data-ws-page="article"] .ws-article-table td:first-child {
    width: 48px;
    min-width: 48px;
    text-align: center;
  }

  /* Older article HTML can contain a raw table without the block wrapper. */
  html[data-ws-page="article"] .ws-article-legacy table {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    table-layout: auto !important;
    font-size: 13px !important;
    -webkit-overflow-scrolling: touch;
  }

  html[data-ws-page="article"] .ws-article-legacy th,
  html[data-ws-page="article"] .ws-article-legacy td {
    min-width: 170px !important;
    padding: 10px 12px !important;
    white-space: normal !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    hyphens: none !important;
  }

  html[data-ws-page="article"] .ws-article-legacy th:first-child,
  html[data-ws-page="article"] .ws-article-legacy td:first-child {
    width: 48px !important;
    min-width: 48px !important;
  }

  /* Fallbacks for components whose utility-class order differs between builds. */
  html[data-ws-page="product"] main h1 {
    font-size: 22px !important;
    line-height: 1.16 !important;
    letter-spacing: -0.02em !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    hyphens: none !important;
  }

  html[data-ws-page="product"] main #product-description,
  html[data-ws-page="product"] main .ws-product-description {
    padding: 14px !important;
  }

  html[data-ws-page="product"] main .seo-rich-content p,
  html[data-ws-page="product"] main .seo-rich-content li {
    margin-block: 7px !important;
    font-size: 15px !important;
    line-height: 1.52 !important;
  }

  html[data-ws-page="article"] article[data-lightbox-root="true"] h1,
  html[data-ws-page="article"] article.ws-article-detail h1 {
    font-size: 25px !important;
    line-height: 1.13 !important;
    letter-spacing: -0.025em !important;
  }

  html[data-ws-page="article"] article[data-lightbox-root="true"] p,
  html[data-ws-page="article"] article[data-lightbox-root="true"] li {
    font-size: 15px !important;
    line-height: 1.55 !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    hyphens: none !important;
  }
}
