/* Shared layout and readable text sizes; the original theme keeps its colours and decoration. */
html[aria-busy="true"], html[aria-busy="true"] a { cursor: progress; }
html[aria-busy="true"]::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #b26b00;
  pointer-events: none;
  z-index: 2147483647;
}

.site-page {
  width: calc(100% - 16px);
  margin: 8px;
  overflow-wrap: anywhere;
  font-family: Verdana, Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background-image: url("/themes/-1-/background_spring.gif");
  background-repeat: repeat-x;
}

/* Keep the inherited table and control fonts after the move from quirks mode to HTML5. */
.site-page :where(table, input, select, textarea, button) {
  font-family: inherit;
  font-size: inherit;
}

/* Preserve the text sizes used by the imported Word pages. */
.site-page :where(:where(.legacy-font)) {
  font-size: 16px;
  line-height: 1.5;
}

.site-page :where(:where(.legacy-font)[data-size="1"]) {
  font-size: 14px;
}

.site-page :where(:where(.legacy-font)[data-size="3"]) {
  font-size: 18px;
}

.site-page :where(:where(.legacy-font) > :is(span, .legacy-inline)) {
  font-size: inherit;
}

/* The editor renders the page body as a wrapper inside its own iframe body. */
body:has(> [data-gjs-type="wrapper"].site-page) {
  margin: 0px;
}

.site-page #table2 {
  width: 100%;
}

.site-page p {
  max-width: 100%;
  box-sizing: border-box;
}

.site-layout,
.site-layout > tbody {
  display: block;
  width: 100%;
}

.site-layout > tbody > tr {
  display: grid;
  grid-template-columns: 165px 24px minmax(0, 1fr);
  align-items: start;
}

.site-layout > tbody > tr > td {
  display: block;
  width: auto;
  min-width: 0px;
}

.site-layout > tbody > tr > .site-content {
  width: 100%;
  max-width: 1000px;
  box-sizing: border-box;
  margin: 0 auto;
}

.site-layout > tbody > tr > .site-content--wide {
  max-width: none;
}

.site-content > table,
.site-content > .table-scroll > table,
.site-price-table {
  width: 100%;
}

/* The wrapper leaves the desktop table geometry unchanged. */
.table-scroll { display: contents; }

.site-price-table td:first-child {
  width: auto;
}

.site-price-table td:last-child {
  width: 20%;
}

.site-content img {
  max-width: 100%;
  height: auto;
}

.site-page .WordSection1 {
  width: 100%;
  box-sizing: border-box;
  max-width: 1200px;
  margin: 0 auto;
}

.home-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(300px, 34%, 420px);
  align-items: start;
  gap: 12px 20px;
  height: auto;
}

.home-columns > tbody,
.home-columns > tbody > tr {
  display: contents;
}

.home-columns > tbody > tr > td {
  display: block;
  width: auto;
  min-width: 0px;
}

.home-intro {
  grid-column: 1;
  grid-row: 1;
}

.home-tools {
  grid-column: 2;
  grid-row: 1;
}

/* Keep the existing widget link colours when the editor moves inline styles into classes. */
.home-tools #currency-widget > a,
.home-tools #news-widget > a {
  color: #000;
}

.home-tools .meta > div:last-of-type > a {
  color: #b26b00;
}

.backup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
  gap: 24px;
}

.backup-article {
  min-width: 0px;
}

/* New controls use the same plain fields, yellow fill and grey border as the currency block. */
.site-calculator {
  box-sizing: border-box;
  font-size: 16px;
  line-height: 1.5;
}

.backup-calculator {
  padding: 10px;
  border: 1px solid #ccc;
  background-color: #FFFFCC;
  font-family: Arial;
}

.site-calculator fieldset {
  border: 0;
  padding: 0px;
  margin: 0px;
  min-width: 0px;
}

.calculator-field {
  margin-top: 8px;
}

.calculator-field label,
.calculator-field input,
.calculator-field select {
  display: block;
}

.site-calculator input,
.site-calculator select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font: inherit;
}

.calculator-currencies {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.calculator-result {
  display: block;
  margin-top: 10px;
  font: inherit;
  font-weight: bold;
}

.calculator-note {
  margin: 8px 0 0;
}

@media (max-width: 1100px) {
  .home-columns,
  .backup-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-intro,
  .home-tools {
    grid-column: auto;
    grid-row: auto;
  }

  .backup-calculator {
    grid-row: 1;
  }

  /* Only wide data tables scroll; the surrounding article stays in the viewport. */
  .table-scroll {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }

  .table-scroll:focus-visible {
    outline: 2px solid #b26b00;
    outline-offset: 2px;
  }

  .table-scroll > table { width: 100%; min-width: 28rem; }
  .table-scroll[data-columns="2"] > table { min-width: 0; table-layout: fixed; }
  .table-scroll[data-columns="2"] > table > tbody > tr > td:last-child { width: 32% !important; }
  .table-scroll[data-columns="3"] > table { min-width: 36rem; }
  .table-scroll[data-columns="8"] > table { min-width: 56rem; }
  .table-scroll[data-columns="8"]::before {
    content: "↔ Прокрутите таблицу";
    display: block;
    position: sticky;
    left: 0;
    padding-block: 4px;
    font-size: 14px;
  }
  .site-page [role="main"] table:has(.table-scroll) { table-layout: fixed; width: 100%; }
  .backup-article table { table-layout: fixed; max-width: 100%; }

  .site-page [role="main"] p[style*="width:"] { width: auto !important; }
  .site-page hr { box-sizing: border-box; max-width: 100%; }
  .site-page :is(input, select, textarea, button) { max-width: 100%; box-sizing: border-box; }
  .site-page textarea { width: 100%; }
  .site-page :is([data-contact-form], [data-site-search]) blockquote { margin-inline: 0; }
  .site-page :is([data-contact-form], [data-site-search]) input:not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
    width: 100%;
    min-width: 0;
  }

  .site-page :is([data-contact-form], [data-site-search]) .legacy-control-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
}

@media (max-width: 600px) {
  .table-scroll[data-columns="3"]::before {
    content: "↔ Прокрутите таблицу";
    display: block;
    position: sticky;
    left: 0;
    padding-block: 4px;
    font-size: 14px;
  }
}

/* Keep the original GIF artwork, with enough space around it for a finger. */
@media (max-width: 1100px), (any-pointer: coarse) {
  .site-page .legacy-top-navigation {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
  }

  .site-page .legacy-top-navigation a,
  .site-layout > tbody > tr > td:first-child p a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    max-width: 100%;
    box-sizing: border-box;
    vertical-align: middle;
  }

  .site-page .legacy-top-navigation a img { margin-top: 0; }
  .site-layout > tbody > tr > td:first-child > p { height: auto !important; }
  .site-page :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, button) {
    min-height: 44px;
    font-size: 16px;
  }
  .site-page :is(input[type="submit"], input[type="reset"], button) { padding: 6px 12px; }
  .site-page .contact-choice { display: flex; align-items: center; min-height: 44px; cursor: pointer; }
}

@media (max-width: 900px) {
  .site-layout > tbody > tr {
    grid-template-columns: minmax(0, 1fr);
  }

  .site-layout > tbody > tr > td:nth-child(2) {
    display: none;
  }

  .site-layout > tbody > tr > td:first-child > p {
    width: auto !important;
    height: auto !important;
    margin-inline: 0 !important;
    margin-block: 8px;
  }

  .site-layout > tbody > tr > td:first-child > p:has(.left-nav-icon) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
  }

  .site-layout > tbody > tr > td:first-child br {
    display: none;
  }

  .site-layout > tbody > tr > td:first-child > p:has(> img[width="0"][height="0"]:only-child) { display: none; }

  /* These spans contain the old nonbreaking-space title indentation only. */
  .legacy-page-title .legacy-font[data-size="4"] > span[lang="en-us"]:first-child { display: none; }

  .site-page [data-contact-form] :is(table, tbody, tr, td) {
    display: block;
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
    text-align: start;
  }
  .site-page [data-contact-form] td:has(input, textarea, select) { padding-bottom: 12px; }

  .site-content :is(p.legacy-style-33, p[style*="text-align:justify"], p[style*="text-align: justify"]) {
    text-align: start !important;
  }
}
