/*
 * The unavailable product state, with the values of the app's product card
 * (apps/web/src/features/menu/components/MenuItemCard/MenuItemCard.module.css).
 * availability.js sets data-alopizza-unavailable on the loop card, the button widget and the link.
 */

:root {
  --alopizza-ink: #1e1e1e;
  --alopizza-cta-radius: 9px;
  --alopizza-unavailable-outline: #e9ecef;
  --alopizza-unavailable-image-opacity: 0.35;
  --alopizza-unavailable-text-opacity: 0.3;
}

/*
 * Loop card: outline, faded image, faded text. The outline goes on the template's root container,
 * which carries the card's radius; the loop item around it is square.
 */
.e-loop-item[data-alopizza-unavailable] > .elementor-element {
  box-shadow: inset 0 0 0 2px var(--alopizza-unavailable-outline);
}

/*
 * Every widget fades except the image widgets, whose picture fades less than their text, and the
 * marked button. The loop cards show the price in a second button widget, which fades with the text.
 */
.e-loop-item[data-alopizza-unavailable] .elementor-widget:not(.elementor-widget-image, .elementor-widget-image-box, [data-alopizza-unavailable]),
.e-loop-item[data-alopizza-unavailable] .elementor-image-box-content {
  opacity: var(--alopizza-unavailable-text-opacity);
}

.e-loop-item[data-alopizza-unavailable] .elementor-widget-image img,
.e-loop-item[data-alopizza-unavailable] .elementor-widget-image-box img {
  opacity: var(--alopizza-unavailable-image-opacity);
}

/*
 * The button, in a loop card or on its own. The site paints its buttons on the widget's container
 * (the link inside is transparent), so the grey goes on the container and the link is cleared.
 * !important because Elementor styles each button with per-element selectors that no selector here
 * can outrank.
 */
.elementor-widget-button[data-alopizza-unavailable] > .elementor-widget-container {
  border-color: transparent !important;
  border-radius: var(--alopizza-cta-radius);
  background: color-mix(in srgb, var(--alopizza-ink) 10%, transparent) !important;
  box-shadow: none !important;
}

.elementor-widget-button[data-alopizza-unavailable] .elementor-button,
.elementor-widget-button[data-alopizza-unavailable] .elementor-button:hover,
.elementor-widget-button[data-alopizza-unavailable] .elementor-button:focus {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  color: color-mix(in srgb, var(--alopizza-ink) 50%, transparent) !important;
  cursor: default;
  pointer-events: none;
}

.elementor-widget-button[data-alopizza-unavailable] .elementor-button svg {
  fill: currentcolor;
}
