/* Mobile layout (variant "red menu and matryoshkas"). Applies only below 900px;
   on a computer the site looks exactly as before. Partner login is hidden on mobile. */
/* ---- shared mobile structure (all variants) ---- */
@media screen and (max-width: 900px) {
  *, *::before, *::after { box-sizing: border-box; }
  html, body { height: auto; }
  body { -webkit-text-size-adjust: 100%; background: #fff !important; }
  img { max-width: 100%; height: auto; }
  div.partner_enter_label, div.form_main { display: none !important; }

  /* home: absolute layout -> column */
  div.main_div {
    position: relative; margin: 0; width: auto; height: auto; left: 0; top: 0;
    background: #fff; font-size: 15px; display: flex; flex-direction: column;
  }
  div.main_div > br { display: none; }
  div.main_div div.main_text {
    position: static !important; width: auto !important;
    font-size: 15px !important; line-height: 1.55 !important;
  }
  div.main_div div.main_text > div { text-align: left !important; }
  div.main_div #footer, div.main_div .footer { position: static !important; height: auto; }

  /* inner: table layout -> column */
  #main { width: auto; height: auto; }
  #main, #main > tbody, #main > tbody > tr, #main > tbody > tr > td { display: block; }
  #main > tbody > tr:first-child { display: none; }
  #main td[style*="height: 139px"] { height: auto !important; }
  #content { padding: 0; background-image: none !important; }
  #content > table, #content > table > tbody { display: block; width: 100% !important; }
  #content > table > tbody > tr { display: flex; flex-direction: column; }
  #content > table > tbody > tr > td:first-child { display: contents; }
  #content > table > tbody > tr > td:first-child > br { display: none; }
  #body { display: block; width: auto; border: 0; }
  #body .label { font-size: 15px !important; line-height: 1.55 !important; }
  #body h1, #body h2 { font-size: 20px !important; }
  #footer { display: block; height: auto; }

  /* contacts: logo above each address */
  #body .label table, #body .label tbody, #body .label tr, #body .label td { display: block; width: auto; }
  #body .label table { border-spacing: 0; }
  #body .label td { padding: 0 !important; }
  #body .label td[style*="center"] img { max-height: 64px; width: auto !important; }
  #body .label tr:last-child td[style*="center"] { display: none; }

  /* language links */
  table.languages_top_main { margin: 0 !important; border-spacing: 0; }
  table.languages_top_main td a, table.languages_top_main td a:link,
  table.languages_top_main td a:visited { display: inline-block; padding: 6px 8px; font-size: 14px; }
}

/* ===== B. «Красное меню и матрёшки» ===== */
@media screen and (max-width: 900px) {
  /* home */
  div.main_div { flex-direction: row; flex-wrap: wrap; align-items: center; }
  div.main_div div.logo { order: 0; margin: 12px 16px; }
  div.main_div div.logo img { width: 110px; }
  div.main_div table.languages_top_main { order: 0; margin: 0 8px 0 auto !important; }
  div.main_div div.menu_on_main { order: 1; flex-basis: 100%; display: flex; width: auto; margin: 0; background: #C80B2D; }
  div.main_div::before {
    content: ""; order: 2; flex: 0 0 100%; max-width: 420px; margin-left: auto; height: 330px;
    background: #fff url(/images/main_bg_new.jpg) no-repeat right 0 top -50px / 640px auto;
  }
  div.main_div div.main_text {
    order: 3; flex: 0 0 auto; width: calc(100% - 24px) !important; margin: -6px 12px 28px; padding: 18px 16px;
    background: rgba(255,255,255,.94); box-shadow: 0 2px 14px rgba(0,0,0,.12); border-top: 3px solid #C80B2D;
    position: relative !important; left: 0 !important; top: 0 !important;
  }
  div.main_div::after {
    content: ""; order: 4; flex-basis: 100%; height: 80px;
    background: url(/images/main_bg_new.jpg) no-repeat center bottom;
  }
  div.main_div .footer { order: 5; flex-basis: 100%; }
  div.main_div #footer { order: 6; flex-basis: 100%; }

  /* inner */
  #header { width: auto; height: 120px !important; border: 0; background-size: auto 120px; background-position: left top; }
  #logo { top: 30px; left: 22px; width: 118px; }
  #logo img { width: 100%; }
  #uheader { display: none !important; }
  #content > table > tbody > tr { flex-direction: row; flex-wrap: wrap; }
  #content table.languages_top_main { order: 2; flex-basis: 100%; display: flex; justify-content: flex-end; padding: 6px 8px 0; box-sizing: border-box; }
  #content .mmenu_item_blue { order: 1; flex: 1 1 auto; background: #C80B2D; }
  #body { order: 3; flex-basis: 100%; padding: 8px 16px 24px; }
  #body .label td[style*="center"] { text-align: left !important; margin-top: 18px; padding-top: 18px !important; border-top: 1px solid #eee; }
  #body .label tr:first-child td[style*="center"] { margin-top: 0; padding-top: 0 !important; border: 0; }
  #body .label td:not([style*="center"]) { margin-top: 8px; }
  #footer { padding-top: 92px !important; background: #ededef url(/images/main_bg_new.jpg) no-repeat center top -528px; }

  /* red menu bar */
  .mmenu_item, .mmenu_item_blue { flex: 1 1 auto; width: auto; height: auto; line-height: 48px; text-align: center; }
  .mmenu_item a, .mmenu_item_blue a { color: #fff !important; font-size: 15px; font-weight: bold; display: block; }
  .mmenu_item.current a, .mmenu_item_blue.current a { box-shadow: inset 0 -4px 0 #f5c400; }

  #footer, div.main_div .footer, div.main_div #footer { padding: 14px 16px; background-color: #ededef; text-align: center; color: #999; }
  /* home pages: the khokhloma strip is already above, so the second footer
     block is plain (it only holds "© 2010" on the zh-tw page) */
  div.main_div #footer { background-image: none; padding: 0 16px 14px !important; }
}
