/*
 * New design — product window, kind «platform» (#options[data-nd-kind="platform"]): the platform's own window
 * (old-product-template, menu-templates.php), either branch of product_popup_side_image; the prototypes' M02 with the
 * choices panel. Docs: _private/docs/new-design-popups.md. After css/new-design-popups.css; every rule starts with the kind.
 * js/new-design-popups-legacy.js names the roles (.nd-pp-host/media/aside/panel) the shell composes in two columns.
 */
body.nd-menu #options[data-nd-kind="platform"] .nd-pp-aside .description:not(#\9) {
  margin: 0;
  padding: 0;
}

/* the price per kilo under the name (by weight) */
body.nd-menu #options[data-nd-kind="platform"] .nd-pp-aside .price_per_kilo:not(#\9) {
  margin: 4px 0 0 !important;
  color: var(--pp-ink);
  font-size: .95rem;
  font-weight: 800;
}

body.nd-menu #options[data-nd-kind="platform"] .nd-pp-aside .price_per_kilo span:not(#\9) {
  font-size: inherit;
  font-weight: inherit;
}

/* the platform's window: the quantity cell (label over the stepper, the unit after it) and the price band under it;
   by weight, the average weight beside the quantity and weight | price as one band */
body.nd-menu #options[data-nd-kind="platform"] .nd-pp-panel > div > .row:not(#\9) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10px 10px minmax(0, 1fr);
  row-gap: 12px;
  margin: 0;
}

body.nd-menu #options[data-nd-kind="platform"] .nd-pp-panel > div > .row > *:not(#\9) {
  grid-column: 1 / -1;
  flex: none;
  width: auto;
  max-width: none;
  margin: 0 !important; /* the template's mb-2 / mb-3 */
  padding: 0;
}

body.nd-menu #options[data-nd-kind="platform"] .nd-pp-panel > div > .row > .price:not(#\9) {
  padding: 13px 16px;
}

body.nd-menu #options[data-nd-kind="platform"] .nd-pp-panel > div > .row > :has(> .ltr):not(#\9) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 10px;
}

body.nd-menu #options[data-nd-kind="platform"] .nd-pp-panel > div > .row > :has(> .ltr) > h4:not(#\9) {
  flex: 1 0 100%;
}

body.nd-menu #options[data-nd-kind="platform"] .nd-pp-panel > div > .row > :has(> .ltr) > .ltr:not(#\9) {
  flex: 1 1 0;
  min-width: 0 !important;
}

body.nd-menu #options[data-nd-kind="platform"] .nd-pp-panel > div > .row > :has(> .ltr) > .units:not(#\9) {
  order: 1;
}

body.nd-menu #options.nd-pp-weighed[data-nd-kind="platform"] .nd-pp-panel > div > .row > .by_weight:not(.weight):not(#\9) {
  grid-column: 1;
}

body.nd-menu #options.nd-pp-weighed[data-nd-kind="platform"] .nd-pp-panel > div > .row > :has(> .ltr):not(#\9) {
  grid-column: 4;
  align-self: start;
}

body.nd-menu #options.nd-pp-weighed[data-nd-kind="platform"] .nd-pp-panel .unit_weight:not(#\9) {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 !important;
}

body.nd-menu #options.nd-pp-weighed[data-nd-kind="platform"] .nd-pp-panel .unit_weight select:not(#\9) {
  flex: 1 1 0;
  min-width: 0;
}

body.nd-menu #options.nd-pp-weighed[data-nd-kind="platform"] .nd-pp-panel > div > .row > .weight:not(#\9) {
  grid-column: 1 / 3;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  padding: 13px 12px;
  border-start-start-radius: 12px;
  border-end-start-radius: 12px;
  background: var(--pp-sunk) !important;
  box-shadow: none;
}

body.nd-menu #options.nd-pp-weighed[data-nd-kind="platform"] .nd-pp-panel > div > .row > .price:not(#\9) {
  grid-column: 3 / 5;
  border-start-start-radius: 0;
  border-end-start-radius: 0;
  border-inline-start: 1px solid #e2e2e2;
}

/* no quantity on this product (the engine hides the panel and shows the price under the name) */
body.nd-menu #options[data-nd-kind="platform"] .description > .price.no_quantity:not(#\9) {
  margin-top: 20px;
}

@media (min-width: 861px) {
  /* the photo on top's branch: .modal-body is the grid, the photo's row only a box, the action column takes the
     row's second cell and what follows it (four rows at most, the last absorbs a taller photo) */
  body.nd-menu #options[data-nd-kind="platform"].nd-pp-split.nd-pp-flat:not(.nd-pp-one) .modal-body:not(#\9) {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--pp-aside);
    grid-template-rows: auto auto auto auto 1fr;
    align-items: start;
  }

  body.nd-menu #options[data-nd-kind="platform"].nd-pp-split.nd-pp-flat:not(.nd-pp-one) .nd-pp-host:not(#\9) {
    display: contents;
  }

  body.nd-menu #options[data-nd-kind="platform"].nd-pp-split.nd-pp-flat:not(.nd-pp-one) .modal-body:not(#\9)::before {
    content: "";
    position: absolute;
    top: var(--pp-pad);
    bottom: var(--pp-pad);
    inset-inline-start: calc(100% - var(--pp-aside));
    width: 1px;
    background: rgba(0, 0, 0, .06);
  }

  body.nd-menu #options[data-nd-kind="platform"].nd-pp-split.nd-pp-flat:not(.nd-pp-one) .nd-pp-media:not(#\9) {
    grid-row: 1 / -1;
  }

  body.nd-menu #options[data-nd-kind="platform"].nd-pp-split.nd-pp-flat:not(.nd-pp-one) .nd-pp-aside:not(#\9) {
    grid-row: auto;
    padding-bottom: 0;
  }

  body.nd-menu #options[data-nd-kind="platform"].nd-pp-split.nd-pp-flat:not(.nd-pp-one) .modal-body > :not(.nd-pp-host):not(#\9) {
    grid-column: 2;
    width: auto;
    margin-inline: var(--pp-pad);
  }

  body.nd-menu #options[data-nd-kind="platform"].nd-pp-split.nd-pp-flat:not(.nd-pp-one) .modal-body > :not(.nd-pp-host) .buttons:not(#\9) {
    width: auto;
  }
}

/* The legacy side-image-off template nests its no-quantity price in a row. Keep it in flow
   and reserve the logical end corner for the shell's close control (front.css positions it absolutely). */
body.nd-menu #options[data-nd-kind="platform"] .nd-pp-aside > .row > .price.no_quantity:not(#\9) {
  position: static;
  inset: auto;
  flex: 0 1 auto;
  width: auto;
  max-width: 100%;
  margin: 0;
  padding: 10px 12px;
  line-height: 1.3;
}

@media (min-width: 861px) {
  body.nd-menu #options[data-nd-kind="platform"] .nd-pp-aside > .row > .price.no_quantity:not(#\9) {
    max-width: calc(100% - 64px);
    margin-inline-end: 64px;
  }
}
