/* skbpa:order.form — embedded (#order-form) ordering block.

   Self-contained like docs.center/card-block.css: this renders inside the
   Aspro product template, not inside the .skbpa-docs shell, so it re-declares
   the palette locally instead of inheriting tokens that are not in scope
   here. Everything is namespaced under .skbpa-order so it cannot leak into
   the surrounding theme. */

.skbpa-order {
  --skbpa-order-accent: #e36d38;
  --skbpa-order-accent-dark: #b14819;
  --skbpa-order-ink: #211d19;
  --skbpa-order-ink-soft: #5c564d;
  --skbpa-order-ink-faint: #918a7d;
  --skbpa-order-line: #e7e2da;
  --skbpa-order-surface: #ffffff;
  --skbpa-order-surface-2: #f4f2ef;
  --skbpa-order-danger: #c0392b;

  /* Dialog geometry. The block used to sit in the page flow; as a compact
     ordering surface it is centred, capped in width, and scrolls internally so
     a long accessory list never pushes the submit button off-screen. */
  margin: auto;
  padding: 0;
  border: 1px solid var(--skbpa-order-line);
  background: var(--skbpa-order-surface);
  color: var(--skbpa-order-ink);
  font-size: 15px;
  line-height: 1.5;
  width: min(680px, calc(100vw - 32px));
  max-width: min(680px, calc(100vw - 32px));
  max-height: min(88vh, 900px);
  /* svh = the SMALL viewport: the height with the mobile browser's URL bar
     SHOWN. With plain vh the box is sized against the tall viewport, so on a
     phone the bottom of the form sits under the browser chrome — the submit
     button among it. Older engines ignore this line and keep the vh value. */
  max-height: min(88svh, 900px);
  /* The dialog itself no longer scrolls; .skbpa-order__form does. That is what
     keeps the title and the close button in place instead of letting them
     scroll away, and what makes "open at the top" a property of one small
     element rather than of the whole surface. */
  overflow: hidden;
  position: relative;
}

/* display ONLY while open, and this is not a detail.
 *
 * A closed <dialog> is hidden by `display: none` in the browser's own
 * stylesheet — which any author declaration outranks. Putting `display: flex`
 * on `.skbpa-order` therefore un-hid the form: it rendered inline in the page,
 * 792px tall, between «Топ материалов» and the tabs, on every product page and
 * at every width. Caught by looking at a screenshot; the contract test could
 * not see it, because that test opens the dialog before measuring anything.
 *
 * The header/body/footer layout belongs to the open state, so it is declared
 * there and the closed state is left to the browser. */
.skbpa-order[open] {
  display: flex;
  flex-direction: column;
}

/* Background lock. showModal() makes the page behind inert to clicks but does
   NOT stop it scrolling, so on a phone a swipe over the backdrop scrolled the
   product page under the open form. The class is applied by script.js and
   removed on close, with the scroll position restored explicitly. */
html.skbpa-order-locked,
html.skbpa-order-locked body {
  overflow: hidden;
}

.skbpa-order::backdrop {
  background: rgba(24, 20, 16, 0.55);
}

.skbpa-order__close {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 3;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--skbpa-order-ink-faint);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.skbpa-order__close:hover,
.skbpa-order__close:focus-visible {
  background: var(--skbpa-order-surface-2);
  color: var(--skbpa-order-ink);
}

/* --- modification selector -------------------------------------------

   The restored «выбор модификации». Radios rather than a <select>: an
   engineer choosing a temperature range or a mounting variant needs to see
   the alternatives and their prices side by side, and on a priced axis the
   figure is the whole point of the choice. */

.skbpa-order__mods { margin: 18px 0 0; }

.skbpa-order__mod {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.skbpa-order__mod-legend {
  padding: 0;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--skbpa-order-ink-soft);
}

.skbpa-order__mod-legend i { color: var(--skbpa-order-accent); font-style: normal; }

.skbpa-order__mod-options { display: grid; gap: 8px; }

.skbpa-order__mod-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--skbpa-order-line);
  border-radius: 6px;
  cursor: pointer;
}

.skbpa-order__mod-option:hover { border-color: var(--skbpa-order-accent); }

.skbpa-order__mod-option:has(input:checked) {
  border-color: var(--skbpa-order-accent);
  background: #fdf6f2;
}

.skbpa-order__mod-option:has(input:focus-visible) {
  outline: 2px solid var(--skbpa-order-accent);
  outline-offset: 2px;
}

.skbpa-order__mod-label { flex: 1 1 auto; min-width: 0; }

.skbpa-order__mod-price {
  flex: 0 0 auto;
  font-weight: 700;
  white-space: nowrap;
}

.skbpa-order__mod-price--request {
  font-weight: 500;
  color: var(--skbpa-order-ink-faint);
}

.skbpa-order__on-request {
  font-weight: 600;
  color: var(--skbpa-order-ink-soft);
}

@media (max-width: 480px) {
  .skbpa-order__mod-option { flex-wrap: wrap; }
  .skbpa-order__mod-price { width: 100%; }
}

/* --- head / body / foot ----------------------------------------------

   The three bands the form is built from. The head and the foot do not
   scroll, so the visitor always knows what this surface is and can always
   reach both «Закрыть» and «Отправить заказ». */

.skbpa-order__title {
  flex: 0 0 auto;
  /* 64px on the right keeps the text clear of the close button. */
  margin: 0;
  padding: 20px 64px 6px 28px;
  font-size: 22px;
  font-weight: 700;
}
.skbpa-order__lead {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 28px 14px;
  border-bottom: 1px solid var(--skbpa-order-line);
  color: var(--skbpa-order-ink-soft);
  font-size: 14px;
}
.skbpa-order__form {
  /* min-height:0 is load-bearing: without it a flex child refuses to shrink
     below its content and the "scrolling body" silently becomes a tall box
     that overflows the dialog instead. */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 18px 28px 0;
}
.skbpa-order__success { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

/* --- main line ------------------------------------------------------- */

.skbpa-order__product {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--skbpa-order-surface-2);
  border: 1px solid var(--skbpa-order-line);
}
/* Specificity, not a bigger number.
 *
 * This rule already asked for 64x64 and was losing: the theme carries its own
 * `img { width: 100% }`, which is a class-level selector and beat a single
 * class here. The picture therefore rendered 306x221 on a 390px phone and the
 * product row cost 407px of a 1515px form — a quarter of the ordering surface
 * spent re-showing the device the visitor was already looking at when they
 * pressed «Заказать». Scoping under .skbpa-order wins the cascade honestly;
 * the sizes are unchanged from what was always intended. */
.skbpa-order .skbpa-order__product-img {
  width: 64px;
  height: 64px;
  min-width: 64px;
  max-width: 64px;
  object-fit: contain;
  background: #fff;
  flex: 0 0 auto;
}
.skbpa-order__product-main { flex: 1 1 auto; min-width: 0; }
.skbpa-order__product-name { font-weight: 600; overflow-wrap: break-word; }
.skbpa-order__product-price { margin-top: 4px; font-size: 17px; font-weight: 700; }
.skbpa-order__novat { font-size: 12px; font-weight: 400; color: var(--skbpa-order-ink-faint); }

.skbpa-order__qty { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.skbpa-order__qty-label { font-size: 12px; color: var(--skbpa-order-ink-faint); }
/* --- quantity stepper -------------------------------------------------
   One control, used for BOTH the main product and every accessory row (see
   skbpaUiQtyStepper()). The input stays a real number field -- keyboard entry
   and no-JS submission keep working; the buttons only add affordance. */

.skbpa-qty {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--skbpa-order-line);
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.skbpa-qty__btn {
  width: 40px;
  min-height: 40px;
  padding: 0;
  border: 0;
  background: #f5f7fa;
  color: var(--skbpa-order-ink);
  font: inherit;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: background .12s, color .12s;
}
.skbpa-qty__btn:hover:not(:disabled) { background: #e8edf3; color: var(--skbpa-order-accent-dark); }
.skbpa-qty__btn:focus-visible { outline: 2px solid var(--skbpa-order-accent); outline-offset: -2px; }
.skbpa-qty__btn:disabled { opacity: .38; cursor: default; }
.skbpa-qty__btn--minus { border-right: 1px solid var(--skbpa-order-line); }
.skbpa-qty__btn--plus { border-left: 1px solid var(--skbpa-order-line); }

.skbpa-qty__input {
  width: 56px;
  min-height: 40px;
  padding: 6px 4px;
  border: 0;
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}
.skbpa-qty__input::-webkit-outer-spin-button,
.skbpa-qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.skbpa-qty__input:focus-visible { outline: 2px solid var(--skbpa-order-accent); outline-offset: -2px; }

/* --- collapsible sections -------------------------------------------- */

.skbpa-order__extras, .skbpa-order__optional { margin-top: 14px; }

.skbpa-order__extras-toggle, .skbpa-order__optional-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 12px 14px; background: none; cursor: pointer;
  border: 1px dashed var(--skbpa-order-line);
  font: inherit; font-weight: 600; color: var(--skbpa-order-ink); text-align: left;
}
.skbpa-order__extras-toggle:hover, .skbpa-order__optional-toggle:hover {
  border-color: var(--skbpa-order-accent); color: var(--skbpa-order-accent-dark);
}
.skbpa-order__extras-hint {
  margin-left: auto; font-size: 12px; font-weight: 400; color: var(--skbpa-order-ink-faint);
}
.skbpa-order__extras-caret {
  width: 0; height: 0; flex-shrink: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform .15s ease;
}
[aria-expanded="true"] .skbpa-order__extras-caret { transform: rotate(90deg); }

.skbpa-order__extras-body, .skbpa-order__optional-body {
  padding: 14px; border: 1px solid var(--skbpa-order-line); border-top: 0;
}
.skbpa-order__extras-note { margin: 0 0 12px; font-size: 13px; color: var(--skbpa-order-ink-faint); }

.skbpa-order__extra {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--skbpa-order-line);
}
.skbpa-order__extra:first-of-type { border-top: 0; }
.skbpa-order__extra-img { width: 44px; height: 44px; object-fit: contain; background: #fff; flex-shrink: 0; }
.skbpa-order__extra-img--empty { background: var(--skbpa-order-surface-2); display: inline-block; }
.skbpa-order__extra-main { flex: 1 1 auto; min-width: 0; }
.skbpa-order__extra-name { font-size: 14px; overflow-wrap: break-word; }
.skbpa-order__extra-price { font-size: 13px; color: var(--skbpa-order-ink-soft); }

/* --- totals ----------------------------------------------------------- */

.skbpa-order__totals {
  margin-top: 18px; padding: 14px 16px;
  background: var(--skbpa-order-surface-2); border: 1px solid var(--skbpa-order-line);
}
.skbpa-order__total-row { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; }
.skbpa-order__total-row--muted { color: var(--skbpa-order-ink-soft); font-size: 14px; }
.skbpa-order__total-row--grand {
  margin-top: 6px; padding-top: 10px; font-size: 17px;
  border-top: 1px solid var(--skbpa-order-line);
}
.skbpa-order__totals-note { margin: 8px 0 0; font-size: 12px; color: var(--skbpa-order-ink-faint); }

/* --- fields ----------------------------------------------------------- */

.skbpa-order__fields {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 20px;
}
.skbpa-order__field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.skbpa-order__field--wide { grid-column: 1 / -1; margin-top: 14px; }
.skbpa-order__label { font-size: 13px; color: var(--skbpa-order-ink-soft); }
.skbpa-order__label i { color: var(--skbpa-order-accent); font-style: normal; }
.skbpa-order__input {
  width: 100%; padding: 10px 12px; font: inherit; color: inherit;
  border: 1px solid var(--skbpa-order-line); background: #fff;
}
.skbpa-order__input:focus { outline: 2px solid var(--skbpa-order-accent); outline-offset: -1px; }
.skbpa-order__textarea { resize: vertical; }

.skbpa-order__contact-hint { margin: 8px 0 0; font-size: 12px; color: var(--skbpa-order-ink-faint); }

.skbpa-order__error { display: block; min-height: 0; font-size: 12.5px; color: var(--skbpa-order-danger); }
.skbpa-order__error--block:not(:empty) { margin-top: 8px; }

/* The consent block itself lives in /local/assets/skbpa/legal.css so every
   form on the site renders it identically. Only the in-form spacing and the
   accent colour override belong here. */
.skbpa-order .skbpa-consent { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--skbpa-order-line); }
.skbpa-order .skbpa-consent__box { accent-color: var(--skbpa-order-accent); }
.skbpa-order .skbpa-consent__box:focus-visible { outline-color: var(--skbpa-order-accent); }
.skbpa-order .skbpa-consent__label i { color: var(--skbpa-order-accent); }
.skbpa-order .skbpa-consent__links a { color: var(--skbpa-order-accent-dark); }
.skbpa-order .skbpa-consent__links a:hover,
.skbpa-order .skbpa-consent__links a:focus-visible { color: var(--skbpa-order-accent); }

.skbpa-order__submit-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  /* Sticky rather than a separate flex band, because that needs no change to
     the markup: the row is the last child of the scrolling form and pins
     itself to its bottom edge. The negative margin lets the background span
     the form's padding so content scrolls UNDER the bar, not beside it. */
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 20px -28px 0;
  padding: 14px 28px;
  background: var(--skbpa-order-surface);
  border-top: 1px solid var(--skbpa-order-line);
}
.skbpa-order__submit {
  padding: 13px 34px; font: inherit; font-weight: 600; text-transform: uppercase;
  letter-spacing: .02em; cursor: pointer;
  border: 1px solid var(--skbpa-order-accent);
  background: var(--skbpa-order-accent); color: #fff;
}
.skbpa-order__submit:hover:not(:disabled) {
  background: var(--skbpa-order-accent-dark); border-color: var(--skbpa-order-accent-dark);
}
.skbpa-order__submit:disabled { opacity: .55; cursor: default; }
.skbpa-order__status { font-size: 14px; color: var(--skbpa-order-ink-soft); }

/* --- inline success --------------------------------------------------- */

.skbpa-order__success { text-align: center; padding: 34px 20px; }
.skbpa-order__success-icon {
  width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff; background: #4a9c5d;
}
.skbpa-order__success-title { margin: 0 0 6px; font-size: 20px; }
.skbpa-order__success-text { margin: 0; color: var(--skbpa-order-ink-soft); }

/* --- mobile ----------------------------------------------------------- */

@media (max-width: 700px) {
  /* Height is reclaimed from PADDING and from the lead's generosity, never
     from the controls: the 44px rules below are untouched, and the close
     button grew rather than shrank. */
  .skbpa-order { width: calc(100vw - 16px); max-width: calc(100vw - 16px); }
  .skbpa-order__title { padding: 14px 58px 4px 16px; font-size: 19px; }
  .skbpa-order__lead { padding: 0 16px 10px; font-size: 13px; }
  .skbpa-order__form { padding: 14px 16px 0; }
  .skbpa-order__submit-row { margin: 16px -16px 0; padding: 12px 16px; }
  .skbpa-order__fields { grid-template-columns: 1fr; }
  /* Thumbnail and name stay on one line; only the quantity stepper wraps
     beneath them. With the picture back at 64px there is room for both. */
  .skbpa-order__product { flex-wrap: wrap; gap: 12px; padding: 12px; }
  .skbpa-order__product-main { flex: 1 1 0; min-width: 0; }
  .skbpa-order__qty { width: 100%; align-items: flex-start; }
  .skbpa-order__extra { flex-wrap: wrap; }
  .skbpa-order__extra-main { flex: 1 1 100%; order: 1; }
  .skbpa-order__extra .skbpa-qty { order: 2; }
  /* Touch targets: 44px is the smallest comfortable tap area. */
  .skbpa-qty__btn { width: 44px; min-height: 44px; }
  .skbpa-qty__input { min-height: 44px; }
  .skbpa-order__submit { width: 100%; }
}
