/*
 * New design — product window, kind «unit» (#options[data-nd-kind="unit"]): a product sold by the unit on a popup
 * template with the platform's photo row and nothing to choose; the prototypes' M02. Docs: _private/docs/new-design-popups.md.
 * After css/new-design-popups.css (the shell and its components); every rule starts with the kind.
 */
/* ───────────── A product sold by the unit (data-nd-kind="unit"): the prototypes' M02 ─────────────
   Desktop: the photo with the description under it, and beside it a fixed action column — name, quantity and
   price in one panel, the buttons. Phone: one column. Built on the template's own .description row: its photo
   cell and its second cell, whatever their col-* classes */
@media (min-width: 861px) {
  body.nd-menu #options[data-nd-kind="unit"] {
    --pp-width: 900px;
    --pp-aside: 440px;
  }

  body.nd-menu #options[data-nd-kind="unit"] .modal-body:not(#\9) {
    padding: 0;
  }

  body.nd-menu #options[data-nd-kind="unit"] .modal-body > .description:not(#\9) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--pp-aside);
    align-items: start;
    margin: 0;
    position: relative;
  }

  /* the divider spans the row, inset like the prototypes' */
  body.nd-menu #options[data-nd-kind="unit"] .modal-body > .description: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="unit"] .modal-body > .description > :is(.dish_img, .nd-pp-aside):not(#\9) {
    flex: none;
    width: auto;
    max-width: none;
    padding: var(--pp-pad);
  }

  body.nd-menu #options[data-nd-kind="unit"] .modal-body > .description > .dish_img:not(#\9) {
    grid-column: 1;
    padding-top: 0;
    padding-inline: 0;
  }

  /* the photo reaches the window's top and side edges (its corner cut by the window's radius) */
  body.nd-menu #options[data-nd-kind="unit"] .dish_img img:not(#\9) {
    width: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    aspect-ratio: 3 / 2;
    border-radius: 0;
  }

  body.nd-menu #options[data-nd-kind="unit"] .dish_img > :not(img):not(#\9) {
    margin-inline: var(--pp-pad);
  }

  body.nd-menu #options[data-nd-kind="unit"] .dish_img > .desc:not(#\9) {
    margin-top: 14px;
  }

  body.nd-menu #options[data-nd-kind="unit"] .modal-body > .description > .nd-pp-aside:not(#\9) {
    grid-column: 2;
    display: flex;
    flex-direction: column;
  }

  /* two lines kept for the name, so the panel stays put under a short name or a long one */
  body.nd-menu #options[data-nd-kind="unit"] .nd-pp-aside > h3:not(#\9) {
    min-height: 1.3em;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    column-gap: .3em; /* the template's spaces between its name and its <small> fall out of a flex row */
  }
}

/* the quantity and the price share one panel (the prototypes' .m01-panel); the panel is drawn behind the two, in
   the aside's flow: the quantity row gets the panel's top, the price row its bottom */
body.nd-menu #options[data-nd-kind="unit"] .nd-pp-aside > .quantity:not(#\9) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 12px 0 0;
  padding: 16px 16px 0 !important;
  border: 1px solid rgba(0, 0, 0, .06);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: #fff;
  box-shadow: none;
}

body.nd-menu #options[data-nd-kind="unit"] .nd-pp-aside > .quantity > strong:not(#\9) {
  flex: 1 0 100%;
  margin: 0;
}

body.nd-menu #options[data-nd-kind="unit"] .nd-pp-aside > .quantity .ltr:not(#\9) {
  flex: 1 1 auto;
  margin: 0 !important;
}

body.nd-menu #options[data-nd-kind="unit"] .nd-pp-aside > .price_wrap:not(#\9) {
  padding: 16px;
  border: 1px solid rgba(0, 0, 0, .06);
  border-top: 0;
  border-radius: 0 0 18px 18px;
  background: #fff;
  box-shadow: none;
}

/* no quantity on this product (the engine hides the row): the panel is the price alone */
body.nd-menu #options[data-nd-kind="unit"] .nd-pp-aside > .quantity[style*="none"] + .price_wrap:not(#\9),
body.nd-menu #options[data-nd-kind="unit"] .nd-pp-aside:not(:has(> .quantity)) > .price_wrap:not(#\9) {
  margin-top: 20px;
  border-top: 1px solid rgba(0, 0, 0, .06);
  border-radius: 18px;
}

body.nd-menu #options[data-nd-kind="unit"] .nd-pp-aside > .discounts:empty {
  display: none;
}

@media (max-width: 860px) {
  /* phone: photo full width at the sheet's top, then name and description, then the panel */
  body.nd-menu #options[data-nd-kind="unit"] .modal-body:not(#\9) {
    padding-top: 0;
  }

  body.nd-menu #options[data-nd-kind="unit"] .modal-body > .description:not(#\9) {
    display: flex;
    flex-direction: column;
    margin: 0;
  }

  body.nd-menu #options[data-nd-kind="unit"] .modal-body > .description > :is(.dish_img, .nd-pp-aside):not(#\9) {
    display: contents;
  }

  body.nd-menu #options[data-nd-kind="unit"] .dish_img > img:not(#\9) {
    width: calc(100% + 2 * var(--pp-pad));
    max-width: none;
    max-height: none;
    margin: 0 calc(-1 * var(--pp-pad));
    aspect-ratio: 16 / 10;
    border-radius: 0;
  }

  /* the description is after the name in the DOM here (js/new-design-popups.js): the order on screen is the DOM's */
  body.nd-menu #options[data-nd-kind="unit"] .nd-pp-aside > h3:not(#\9) {
    margin-top: 14px;
    padding-inline-end: 0;
  }
}
