/*
 * Mobile category discovery: these product-bearing categories contain long,
 * useful editorial descriptions. Keep the content and its links in the DOM,
 * but show the purchasable product grid first on small screens.
 *
 * Category IDs: Ruoka 59, Juomat 75, Kasvoöljyt ja seerumit 81,
 * Shampoot 102, D-vitamiini 219.
 */
@media (max-width: 767px) {
  html.category-59 #product-category #content,
  html.category-75 #product-category #content,
  html.category-81 #product-category #content,
  html.category-102 #product-category #content,
  html.category-219 #product-category #content {
    display: flex;
    flex-direction: column;
  }

  html.category-59 #product-category #content > .main-products-wrapper,
  html.category-75 #product-category #content > .main-products-wrapper,
  html.category-81 #product-category #content > .main-products-wrapper,
  html.category-102 #product-category #content > .main-products-wrapper,
  html.category-219 #product-category #content > .main-products-wrapper {
    order: 1;
  }

  html.category-59 #product-category #content > .category-description,
  html.category-75 #product-category #content > .category-description,
  html.category-81 #product-category #content > .category-description,
  html.category-102 #product-category #content > .category-description,
  html.category-219 #product-category #content > .category-description {
    order: 2;
    margin-top: 24px;
  }
}

/*
 * Ravintolisät: preserve the complete need-based navigation, but prevent the
 * narrow-screen one-column fallback from placing six rich cards before the
 * product grid.  The cards contain no images: a compact two-column grid keeps
 * every title, explanation and subcategory link visible and tappable.
 */
@media (max-width: 767px) {
  html.category-64 .need-based-navigation {
    margin: 20px 0 24px;
  }

  html.category-64 .need-based-navigation h2 {
    margin: 0 0 5px;
    font-size: 21px;
    line-height: 1.22;
  }

  html.category-64 .need-based-lead {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.35;
  }

  html.category-64 .need-based-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  html.category-64 .need-based-card {
    min-height: 0;
    padding: 10px;
  }

  html.category-64 .need-based-card h3 {
    margin: 0 0 5px;
    font-size: 16px;
    line-height: 1.22;
  }

  html.category-64 .need-based-card p {
    margin: 0 0 8px;
    font-size: 13px;
    line-height: 1.34;
  }

  html.category-64 .need-based-links {
    gap: 5px 8px;
  }

  html.category-64 .need-based-links a {
    font-size: 13px;
    line-height: 1.28;
  }
}

/*
 * Ravintolisät: retain one shopper-facing orientation paragraph, then the
 * need navigation and products. The two explanatory continuation paragraphs
 * remain server-rendered and follow the product list on mobile. This keeps
 * every word in the HTML without duplicating or hiding content.
 */
@media (max-width: 767px) {
  html.category-64 #product-category #content {
    display: flex;
    flex-direction: column;
  }

  html.category-64 .ravintolisat-intro {
    display: contents;
  }

  html.category-64 .ravintolisat-intro > p:nth-of-type(1) {
    order: 1;
  }

  html.category-64 .need-based-navigation {
    order: 2;
  }

  html.category-64 #content-top {
    order: 3;
  }

  html.category-64 .main-products-wrapper {
    order: 4;
  }

  html.category-64 .ravintolisat-intro > p:nth-of-type(2),
  html.category-64 .ravintolisat-intro > p:nth-of-type(3) {
    order: 5;
  }

  html.category-64 .category-description {
    order: 6;
  }
}
