/* Section: Sticky chrome (label + widget slot + close) */

.aptox-sticky-chrome {
  --aptox-sticky-slot-height: 90px;
  --aptox-sticky-bar-height: calc(var(--aptox-sticky-slot-height) + (2 * var(--space-xs, 8px)));

  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: calc(var(--z-menu, 1000) + 2);

  display: block;
  height: var(--aptox-sticky-bar-height);
  max-height: var(--aptox-sticky-bar-height);
  overflow: hidden;
  pointer-events: auto;

  background: var(--beige, #F3F1F0);
  border-top: 1px solid color-mix(in srgb, var(--dark, #1a1a1a) 8%, transparent);
  box-shadow: 0 -4px 16px color-mix(in srgb, var(--dark, #1a1a1a) 6%, transparent);
}

.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden),
.aptox-sticky-chrome.is-visible:not(.is-hidden) {
  visibility: visible;
  opacity: 1;
}

.aptox-sticky-chrome.is-hidden,
html.aptox-sticky-dismissed .aptox-sticky-chrome {
  display: none !important;
}

.aptox-sticky-chrome__inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-sm, 12px);

  height: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-xs, 8px) var(--space-sm, 12px);
  box-sizing: border-box;
}

.aptox-sticky-chrome__label {
  margin: 0;
  padding-right: var(--space-md, 20px);
  font-family: var(--font-display, inherit);
  font-size: var(--font-size-sm, 0.875rem);
  line-height: 1.1;
  color: var(--dark, #1a1a1a);
  white-space: nowrap;
}

.aptox-sticky-chrome__slot {
  position: relative;
  min-width: 0;
  width: 100%;
  height: var(--aptox-sticky-slot-height);
  max-height: var(--aptox-sticky-slot-height);
  overflow: hidden;
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aptox-sticky-chrome__slot > * {
  width: 100%;
  max-width: 100%;
  max-height: 100%;
}

.aptox-sticky-chrome__slot .wp-block-paragraph,
.aptox-sticky-chrome__slot p {
  margin: 0;
  width: 100%;
  text-align: center;
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--dark, #1a1a1a);
}

.aptox-sticky-chrome__slot ins.adsbygoogle {
  display: block !important;
  width: 100% !important;
  height: var(--aptox-sticky-slot-height, 90px) !important;
  max-height: var(--aptox-sticky-slot-height, 90px) !important;
}

.aptox-sticky-chrome .close {
  position: relative;
  top: auto;
  right: auto;
  flex-shrink: 0;
  background: transparent;
  border-radius: 0;
}

@media (max-width: 768px) {
  .aptox-sticky-chrome {
    --aptox-sticky-slot-height: 40px;
    --aptox-sticky-bar-height: calc(var(--aptox-sticky-slot-height) + (2 * var(--space-xxs, 4px)));
    height: var(--aptox-sticky-bar-height);
    max-height: var(--aptox-sticky-bar-height);
  }

  .aptox-sticky-chrome__inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: none;
    gap: var(--space-xxs, 4px);
    height: 100%;
    padding: var(--space-xxs, 4px) var(--space-xs, 8px);
  }

  .aptox-sticky-chrome__label {
    grid-column: auto;
    grid-row: auto;
    padding-right: var(--space-sm, 10px);
    font-size: var(--font-size-xs, 0.75rem);
  }

  .aptox-sticky-chrome__slot {
    grid-column: auto;
    grid-row: auto;
    width: 100%;
    height: var(--aptox-sticky-slot-height);
    max-height: var(--aptox-sticky-slot-height);
  }

  .aptox-sticky-chrome__slot ins.adsbygoogle {
    height: var(--aptox-sticky-slot-height) !important;
    max-height: var(--aptox-sticky-slot-height) !important;
  }

  .aptox-sticky-chrome .close {
    grid-column: auto;
    grid-row: auto;
    min-width: 1.5rem;
    min-height: 1.5rem;
    font-size: var(--font-size-lg, 1.125rem);
  }
}

/* Section: Lift fixed bottom UI when sticky bar is active */

html[data-aptox-sticky='active'],
html:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden)) {
  --aptox-sticky-bar-height: calc(90px + (2 * var(--space-xs, 8px)));
  --aptox-sticky-ui-gap: 16px;
}

html[data-aptox-sticky='active'] #menu-mob,
html[data-aptox-sticky='active'] .filter-nav,
html[data-aptox-sticky='active'] .post-share-stack {
  z-index: calc(var(--z-menu, 1000) + 1);
}

@media (min-width: 769px) {
  html[data-aptox-sticky='active'] .filter-nav,
  html:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden)) .filter-nav {
    bottom: var(--aptox-sticky-bar-height);
  }
}

@media (max-width: 1023px) {
  html[data-aptox-sticky='active'] .post-share-stack,
  html:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden)) .post-share-stack {
    bottom: var(--aptox-sticky-bar-height);
  }

  html[data-aptox-sticky='active'] .post-share-stack .back-to-top,
  html:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden)) .post-share-stack .back-to-top {
    --back-to-top-gap: 18px;
    bottom: calc(100% + var(--back-to-top-gap, 18px) + var(--aptox-sticky-ui-gap, 16px));
  }

  html[data-aptox-sticky='active'] .post-share-stack .back-to-top--recipe,
  html:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden)) .post-share-stack .back-to-top--recipe {
    --back-to-top-gap: 22px;
    bottom: calc(100% + var(--back-to-top-gap, 22px) + var(--aptox-sticky-ui-gap, 16px));
  }
}

@media (min-width: 1024px) {
  html[data-aptox-sticky='active'] .post-share-stack .back-to-top,
  html:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden)) .post-share-stack .back-to-top {
    bottom: calc(100% + var(--back-to-top-gap, 14px) + var(--aptox-sticky-ui-gap, 16px));
  }

  html[data-aptox-sticky='active'] .post-share-stack .back-to-top--recipe,
  html:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden)) .post-share-stack .back-to-top--recipe {
    bottom: calc(100% + var(--back-to-top-gap, 14px) + var(--aptox-sticky-ui-gap, 16px));
  }
}

@media (max-width: 768px) {
  html[data-aptox-sticky='active'],
  html:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden)) {
    --aptox-sticky-bar-height: calc(40px + (2 * var(--space-xxs, 4px)));
  }

  html:not([data-aptox-sticky='active']):not(:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden))) #menu-mob {
    bottom: 0 !important;
  }

  html:not([data-aptox-sticky='active']):not(:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden))) .filter-nav {
    bottom: 65px;
  }

  html:not([data-aptox-sticky='active']):not(:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden))) .filter-nav--casa,
  html:not([data-aptox-sticky='active']):not(:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden))) .filter-nav--celebre,
  html:not([data-aptox-sticky='active']):not(:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden))) .filter-nav--loja {
    bottom: 55px;
  }

  html:not([data-aptox-sticky='active']):not(:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden))) .post-share-stack {
    bottom: 60px;
  }

  html[data-aptox-sticky='active'] #menu-mob,
  html:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden)) #menu-mob {
    bottom: var(--aptox-sticky-bar-height, 0px) !important;
  }

  html[data-aptox-sticky='active'] .filter-nav,
  html:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden)) .filter-nav {
    bottom: calc(65px + var(--aptox-sticky-bar-height));
  }

  html[data-aptox-sticky='active'] .filter-nav--casa,
  html[data-aptox-sticky='active'] .filter-nav--celebre,
  html[data-aptox-sticky='active'] .filter-nav--loja,
  html:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden)) .filter-nav--casa,
  html:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden)) .filter-nav--celebre,
  html:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden)) .filter-nav--loja {
    bottom: calc(55px + var(--aptox-sticky-bar-height));
  }

  html[data-aptox-sticky='active'] .post-share-stack,
  html:has(.aptox-sticky-chrome[data-has-widget="true"]:not(.is-hidden)) .post-share-stack {
    bottom: calc(60px + var(--aptox-sticky-bar-height));
  }
}
