/* Business: keep legacy two-up excursion cards responsive without editing articles. */
/* The original articles use inline flex-basis:calc(50% - ...) with 250–270px
   minimums. The Business centre column is narrower, so flex wraps every card.
   Match both the 260px and 270px no-space inline variants. */
@media (min-width: 768px) {
  body.com-content.view-article .astroid-article-text
  div:is([style*="flex-wrap: wrap"], [style*="flex-wrap:wrap"]:has(> :is([style*="min-width:260px"], a[style*="min-width:270px"]))):has(> [style*="calc(50%"])
  {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: stretch;
  }
}

body.com-content.view-article .astroid-article-text
div:is([style*="flex-wrap: wrap"], [style*="flex-wrap:wrap"]:has(> :is([style*="min-width:260px"], a[style*="min-width:270px"]))):has(> [style*="calc(50%"])
> [style*="calc(50%"] {
  box-sizing: border-box;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100%;
}

@media (max-width: 767px) {
  body.com-content.view-article .astroid-article-text
  div:is([style*="flex-wrap: wrap"], [style*="flex-wrap:wrap"]:has(> :is([style*="min-width:260px"], a[style*="min-width:270px"]))):has(> [style*="calc(50%"])
  {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* Shopping cards have a fixed 132px picture; two cards in the Business
   centre column need a smaller rendered picture to leave room for text. */
@media (min-width: 768px) {
  body.com-content.view-article .astroid-article-text
  div:is([style*="flex-wrap: wrap"], [style*="flex-wrap:wrap"]:has(> :is([style*="min-width:260px"], a[style*="min-width:270px"]))):has(> a[style*="calc(50%"] > img[style*="132px"])
  > a > img[style*="132px"] {
    flex-basis: clamp(72px, 7vw, 94px) !important;
    width: clamp(72px, 7vw, 94px) !important;
    height: auto !important;
    min-height: 100%;
  }
  body.com-content.view-article .astroid-article-text
  div:is([style*="flex-wrap: wrap"], [style*="flex-wrap:wrap"]:has(> :is([style*="min-width:260px"], a[style*="min-width:270px"]))):has(> a[style*="calc(50%"] > img[style*="132px"])
  > a > span {
    padding: 8px !important;
  }
}

/* Astroid's generic small rule sets letter-spacing:1em. In the right-hand
   contact module that separates every letter of phone numbers and handles. */
.astroid-framework .rus-contact-card .rus-method small,
.astroid-framework .rus-contact-card .rus-method small.rus-phone {
  letter-spacing: normal !important;
  word-break: normal;
  text-align: left;
}

/* The legacy 23px inline heading is wider than the 170px article text area
   at 320px; reduce only this heading pattern at that breakpoint. */
@media (max-width: 360px) {
  body.com-content.view-article .astroid-article-text
  h2[style*="clamp(23px,3vw,29px)"] {
    font-size: 18px !important;
  }
}

/* Keep the original excursion title intact at 320px. The unbroken word
   "индивидуальная" is 254px wide at the template's default 28px. */
@media (max-width: 350px) {
  body.com-content.view-article.itemid-1496 .astroid-article-title h1 {
    font-size: 18px !important;
    line-height: 1.35 !important;
  }

  /* Preserve the titles; the template's 28px font overflows a 165px column. */
  body.com-content.view-article:is(.itemid-245,.itemid-209,.itemid-216,.itemid-1741,.itemid-1740)
  .astroid-article-title h1 {
    font-size: 18px !important;
    line-height: 1.35 !important;
  }

  /* Herbal Tour: keep the full title in the narrow 320px text column. */
  body.com-content.view-article.itemid-158.ekskursii-na-den-alias
  .astroid-article-title h1 {
    font-size: 18px !important;
    line-height: 1.35 !important;
  }

  /* Земля Королей: inline minimum widths and a 270px grid track exceed
     the article column on a 320px phone. */
  body.com-content.view-article.itemid-1507 .astroid-article-text
  div:is([style*="min-width: 260px"], [style*="min-width: 280px"]) {
    min-width: 0 !important;
    max-width: 100% !important;
    flex-basis: 100% !important;
  }
  body.com-content.view-article.itemid-1507 .astroid-article-text
  div[style*="grid-template-columns: repeat(auto-fit,minmax(270px,1fr))"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* Keep each word and the price readable after the cards become one column. */
  body.com-content.view-article.itemid-1507 .astroid-article-text
  div[style*="border: 1px solid #9fd7df"] > div:first-child {
    padding: 12px 10px !important;
  }
  body.com-content.view-article.itemid-1507 .astroid-article-text
  div[style*="border: 1px solid #9fd7df"] > div:first-child > div:first-child {
    font-size: 18px !important;
  }
  body.com-content.view-article.itemid-1507 .astroid-article-text
  div[style*="padding: 18px 20px 14px"][style*="background: #f9fdff"] {
    padding: 10px !important;
  }
  body.com-content.view-article.itemid-1507 .astroid-article-text
  div[style*="padding: 18px 20px 14px"] > div[style*="min-width: 260px"] {
    padding: 12px !important;
  }
  body.com-content.view-article.itemid-1507 .astroid-article-text
  div[style*="padding: 18px 20px 14px"] > div[style*="flex: 1 1 100%"] {
    padding: 10px !important;
    font-size: 14px !important;
  }
}

/* Two itinerary tables need one column as soon as the article column narrows. */
@media (max-width: 430px) {
  body.com-content.view-article:is(.itemid-1504,.itemid-1500,.itemid-658,.itemid-1503,.itemid-664)
  .astroid-article-text
  div[style*="grid-template-columns: minmax(140px,150px) minmax(0,1fr)"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
