/* ==========================================================================
   Cart drawer (OH-157): what stands under the lines of the cart and in the
   foot since the drawer stays open until it is closed.
   Markup: inc/woocommerce/woocommerce-mini-cart.php (drawer, foot) and
   inc/woocommerce/mini-cart-extras.php (gap to free shipping, «Passt dazu,
   ab Lager», delivery date); loaded on every page by mini-cart-extras.php.
   The older rules of the drawer are in style.css.
   Colours only from the --oh-* tokens, the font is inherited from style.css.
   ========================================================================== */

.oh-mini-cart {
  --oh-mc-pad: 15px; /* side padding of the drawer, as its rules in style.css */
  --oh-mc-gap: 16px; /* between the gap to free shipping and the suggestions */
  --oh-mc-space: 10px; /* inside a suggestion, under a title */
  --oh-mc-space-s: 8px; /* between two suggestions, icon and text */
  --oh-mc-line: 1px solid var(--oh-color6);
  --oh-mc-focus: 2px solid var(--oh-primary); /* keyboard focus */
  --oh-mc-radius: 8px; /* card of a suggestion */
  --oh-mc-radius-s: 5px; /* its picture, as the buttons of style.css */
  --oh-mc-thumb: 56px; /* picture of a suggestion */
  --oh-mc-tap: 44px; /* smallest touch target */
  --oh-mc-icon: 20px;
  --oh-mc-text: 14px;
  --oh-mc-small: 12px;
  --oh-mc-bar: 6px; /* height of the bar to free shipping */
  --oh-mc-pay-max: 40px; /* widest payment icon */
  --oh-mc-pay-gap: 6px;
  --oh-mc-button-text: 13px; /* as .btn in style.css */
}

/* The drawer is as high as the part of the screen the browser shows, so its
   foot with «Zur Kasse» is never under the bars of a phone browser; a
   browser without dvh keeps the 100vh of style.css. */
.oh-mini-cart .oh-mini-cart__panel {
  height: 100dvh;
}

.admin-bar .oh-mini-cart .oh-mini-cart__panel {
  height: calc(100dvh - 32px);
}

/* Head, lines and foot share the height: the lines take the room the foot
   leaves and scroll. Until 1.7.95 style.css gave head and foot fixed heights. */
.oh-mini-cart .oh-mini-cart__inner {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

.oh-mini-cart .oh-mini-cart__content {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  /* the end of the lines does not scroll the page behind the drawer */
  overscroll-behavior: contain;
}

.oh-mini-cart .oh-mini-cart__footer {
  flex: 0 0 auto;
  border-top: var(--oh-mc-line);
}

/* «Im Warenkorb» in the head after a product went in */
.oh-mini-cart__added {
  display: inline-flex;
  align-items: center;
  gap: var(--oh-mc-space-s);
}

.oh-mini-cart__added[hidden] {
  display: none;
}

.oh-mini-cart__added svg {
  flex: none;
  width: var(--oh-mc-icon);
  height: var(--oh-mc-icon);
}

/* Under the lines: the gap to free shipping and the suggestions */
.oh-mini-cart__extras {
  display: flex;
  flex-direction: column;
  gap: var(--oh-mc-gap);
  padding: var(--oh-mc-pad);
}

.oh-mini-cart__gap-text {
  margin: 0 0 var(--oh-mc-space-s);
  color: var(--oh-color4);
  font-size: var(--oh-mc-text);
  line-height: 1.4;
}

.oh-mini-cart__gap-bar {
  display: block;
  height: var(--oh-mc-bar);
  overflow: hidden;
  border-radius: var(--oh-mc-bar);
  background: var(--oh-color6);
}

.oh-mini-cart__gap-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--oh-primary);
}

.oh-mini-cart__gap.is-free .oh-mini-cart__gap-bar > span {
  background: var(--oh-secondary);
}

.oh-mini-cart__sugs-title {
  margin: 0 0 var(--oh-mc-space);
  color: var(--oh-color5);
  font-size: var(--oh-mc-small);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.oh-mini-cart__sugs-list {
  display: flex;
  flex-direction: column;
  gap: var(--oh-mc-space-s);
  margin: 0;
  padding: 0;
  list-style: none;
}

.oh-mini-cart-sug {
  display: grid;
  grid-template-columns: var(--oh-mc-thumb) minmax(0, 1fr) var(--oh-mc-tap);
  align-items: center;
  gap: var(--oh-mc-space);
  padding: var(--oh-mc-space-s);
  border: var(--oh-mc-line);
  border-radius: var(--oh-mc-radius);
}

.oh-mini-cart-sug__img {
  display: block;
  width: var(--oh-mc-thumb);
  height: var(--oh-mc-thumb);
  overflow: hidden;
  border-radius: var(--oh-mc-radius-s);
  background: var(--oh-color6);
}

.oh-mini-cart-sug__img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.oh-mini-cart-sug__body {
  min-width: 0;
}

.oh-mini-cart-sug__name,
.oh-mini-cart-sug__choice,
.oh-mini-cart-sug__price {
  margin: 0;
  font-size: var(--oh-mc-text);
  line-height: 1.3;
}

/* A long name takes two lines at most. */
.oh-mini-cart-sug__name {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.oh-mini-cart-sug__name a {
  color: var(--oh-color4);
  text-decoration: none;
}

.oh-mini-cart-sug__name a:hover,
.oh-mini-cart-sug__name a:focus-visible {
  text-decoration: underline;
}

.oh-mini-cart-sug__choice {
  color: var(--oh-color5);
  font-size: var(--oh-mc-small);
}

.oh-mini-cart-sug__price {
  margin-top: 2px;
  color: var(--oh-color4);
  font-weight: 600;
}

.oh-mini-cart-sug__price del {
  color: var(--oh-color5);
  font-weight: 400;
}

.oh-mini-cart-sug__price ins {
  text-decoration: none;
}

.oh-mini-cart-sug__price small {
  color: var(--oh-color5);
  font-size: var(--oh-mc-small);
  font-weight: 400;
  white-space: nowrap;
}

.oh-mini-cart-sug__add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--oh-mc-tap);
  height: var(--oh-mc-tap);
  padding: 0;
  border: 1px solid var(--oh-primary);
  border-radius: 50%;
  background: transparent;
  color: var(--oh-primary);
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease, opacity 0.25s ease;
}

.oh-mini-cart-sug__add:hover {
  background: var(--oh-primary);
  color: var(--oh-color6);
}

.oh-mini-cart-sug__add:focus-visible,
.oh-mini-cart-sug__name a:focus-visible {
  outline: var(--oh-mc-focus);
  outline-offset: 2px;
}

/* WooCommerce's add-to-cart.js marks the button while its request runs. */
.oh-mini-cart-sug__add.loading {
  opacity: 0.5;
  pointer-events: none;
}

.oh-mini-cart-sug__add svg {
  width: var(--oh-mc-icon);
  height: var(--oh-mc-icon);
}

/* Foot: delivery date above the shipping row */
.oh-mini-cart__delivery {
  display: flex;
  align-items: center;
  gap: var(--oh-mc-space-s);
  margin: 0;
  padding: var(--oh-mc-pad) var(--oh-mc-pad) 0;
  color: var(--oh-color4);
  font-size: var(--oh-mc-text);
  line-height: 1.4;
}

.oh-mini-cart__delivery svg {
  flex: none;
  width: var(--oh-mc-icon);
  height: var(--oh-mc-icon);
}

.oh-mini-cart__delivery + .oh-mini-cart__shipping {
  padding-top: 0;
}

/* «Zur Kasse» and «Weiter einkaufen» are as high as a touch target; .btn of
   style.css centres their text. */
.oh-mini-cart__buttons .btn {
  min-height: var(--oh-mc-tap);
}

/* «Weiter einkaufen»: a button, so it takes the font of the page itself. */
.oh-mini-cart__buttons button.btn {
  font: inherit;
  font-size: var(--oh-mc-button-text);
  font-weight: 600;
  line-height: 1;
}

.oh-mini-cart__buttons .btn:focus-visible {
  outline: var(--oh-mc-focus);
  outline-offset: 2px;
}

/* Payment methods in one row over the width of the drawer (base size in
   footer.css: 46 x 33 px), as in the buy box of the product page. */
.oh-mini-cart__payments.oh-payment-icons {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, var(--oh-mc-pay-max));
  justify-content: center;
  gap: var(--oh-mc-pay-gap);
  padding: 0 var(--oh-mc-pad) var(--oh-mc-pad);
}

.oh-mini-cart__payments .oh-payment-icon {
  width: 100%;
  height: auto;
  aspect-ratio: 46 / 33;
  /* the 5 px corner of the base size, scaled with the icon */
  border-radius: 10.87% / 15.15%;
}

/* On a low screen the lines of the cart need the room: the payment methods
   stand on the product page and in the checkout as well. */
@media (max-height: 640px) {
  .oh-mini-cart__payments.oh-payment-icons {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .oh-mini-cart-sug__add {
    transition: none;
  }
}
