/**
 * UnderScope — Jump-link chips + mobile sticky CTA: review post pages
 *
 * Injected on single posts (reviews). Mobile:
 * - Top: compact sticky jump chips (~44px), horizontal scroll.
 * - Bottom (NEW template only): compact sticky UnderScope CTA bar.
 * Chip color: #296bef (exact). Labels never truncated; overflow = horizontal scroll.
 */

:root {
  --us-chip-height: 44px;
  --us-chip-gap: 11px;
  --us-chip-bg: #296bef;
  --us-chip-bg-hover: #1e5ad4;
  --us-chip-bg-active: #153fa8;
}

@media (max-width: 480px) {
  .us-sticky-cta__inner {
    padding: 7px 12px calc(7px + env(safe-area-inset-bottom, 0)) !important;
    gap: 8px;
  }

  .us-sticky-cta__label {
    font-size: 11.5px !important;
  }

  .us-sticky-cta__button {
    min-height: 36px !important;
    height: 36px !important;
    padding: 0 12px !important;
    font-size: 11.5px !important;
  }

  .rh-post-wrapper,
  .main-side .content,
  .single-post .rh-post-wrapper {
    padding-bottom: 58px !important;
  }
}

/* Section anchors: scroll-margin for chip/header offset */
#testing, #who-for, #comparisons, #faq, #verdict {
  scroll-margin-top: 120px;
}

/* Base: desktop chip bar */
.us-jumpbar-wrap {
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.us-jumpbar-inner {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  padding: 10px 16px;
}
.us-jumpbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--us-chip-gap);
}

@media (min-width: 768px) {
  .us-jumpbar {
    justify-content: center;
  }
}
.us-jumpbar a {
  flex: 0 0 auto;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--us-chip-bg);
  border-radius: 20px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.us-jumpbar a:hover {
  background: var(--us-chip-bg-hover);
}
.us-jumpbar a:active {
  background: var(--us-chip-bg-active);
}
.us-jumpbar a.active {
  background: var(--us-chip-bg-active);
  color: #fff;
}

@media (max-width: 767px) {
  /* Chip row wrapper — compact height, sticky when scrolled */
  .us-jumpbar-wrap {
    --us-chip-row-height: var(--us-chip-height);
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    box-sizing: border-box;
    background: transparent !important;
    border-bottom: none !important;
  }

  .us-jumpbar-inner {
    padding: 6px 12px !important;
    max-height: var(--us-chip-height) !important;
  }

  /* Chip row — single line, horizontal scroll, hide scrollbar */
  .us-jumpbar {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: var(--us-chip-gap) !important;
    height: calc(var(--us-chip-height) - 12px) !important;
    min-height: 32px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  .us-jumpbar::-webkit-scrollbar {
    display: none !important;
  }

  /* Individual chips — compact, tappable, #296bef, no truncation */
  .us-jumpbar a {
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: calc(var(--us-chip-height) - 12px) !important;
    min-height: 32px !important;
    max-height: 44px !important;
    padding: 0 14px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    text-overflow: clip !important;
    overflow: visible !important;
    border-radius: 22px !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  /* Sticky: applied by JS when scrolled past header */
  .us-jumpbar-wrap.us-sticky {
    position: sticky !important;
    top: var(--us-sticky-offset, 56px) !important;
    z-index: 998 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
  }

  /* Fallbacks for [data-us-jump-chips] if used elsewhere */
  [data-us-jump-chips],
  .us-jump-chips {
    display: flex !important;
    flex-wrap: nowrap !important;
    height: var(--us-chip-height) !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
  }
  [data-us-jump-chips]::-webkit-scrollbar,
  .us-jump-chips::-webkit-scrollbar {
    display: none !important;
  }

  /* Sticky bottom CTA overlap fix: content scrolls above sticky price bar */
  .rh-post-wrapper,
  .main-side .content,
  .single-post .rh-post-wrapper {
    padding-bottom: 56px !important;
  }

  /* ===== Mobile-only UnderScope price bar (new implementation) ===== */
  .us-pricebar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 8px;
    z-index: 9999;
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
    transition: transform .18s ease, opacity .18s ease;
  }

  .us-pricebar--visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .us-pricebar__inner {
    max-width: 420px;
    margin: 0 auto;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0)) !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .us-pricebar__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px !important;
    height: 36px !important;
    padding: 0 16px !important;
    border-radius: 999px !important;
    background: #296bef !important;
    color: #fff !important;
    font-size: 12px !important;
    line-height: 1 !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    box-shadow: 0 4px 12px rgba(41, 107, 239, 0.35) !important;
  }
}

/* ===== Tablet / Desktop: content-width jump bar + bottom price pill ===== */
@media (min-width: 768px) {
  /* Jump bar: content-width, transparent background */
  .us-jumpbar-wrap {
    width: auto !important;
    max-width: 860px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
    background: transparent !important;
    border-bottom: none !important;
  }

  .us-jumpbar-inner {
    padding: 10px 0 !important;
    max-height: none !important;
  }

  .us-jumpbar {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 10px !important;
    overflow: visible !important;
  }

  .us-jumpbar a {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 20px !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
    border-radius: 24px !important;
  }

  /* Sticky state: keep bar close to sticky header, but keep bar itself visually transparent */
  .us-jumpbar-wrap.us-sticky {
    position: sticky !important;
    top: var(--us-sticky-offset, 64px) !important;
    z-index: 998 !important;
  }

  /* Reserve space at bottom for sticky price bar */
  .rh-post-wrapper,
  .main-side .content,
  .single-post .rh-post-wrapper {
    padding-bottom: 68px !important;
  }

  /* Bottom sticky price pill: transparent bar, solid blue pill centered to article column */
  .us-pricebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 12px;
    z-index: 9999;
    display: block;
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.18s ease, opacity 0.18s ease;
  }

  .us-pricebar--visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .us-pricebar__inner {
    max-width: 860px;
    margin: 0 auto;
    padding: 8px 10px !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .us-pricebar__button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 42px !important;
    height: 42px !important;
    padding: 0 28px !important;
    border-radius: 999px !important;
    background: #296bef !important;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    box-shadow: 0 4px 16px rgba(41, 107, 239, 0.35) !important;
  }

  .us-pricebar__button:hover {
    opacity: 0.92 !important;
  }
}

/* Luxury Beauty CTA/offerbox overrides REMOVED — were breaking B. toys and other non-Luxury posts.
 * bareMinerals uses Luxury pattern which has its own offerbox CSS in wp:html. */

/* Comparison table: align columns (text, stars, CTA, rows) — equal width */
body.single .wp-block-rehub-comparison-table,
body.single .rh-compare-table-wrapper,
.single-post .wp-block-rehub-comparison-table,
.single-post .rh-compare-table-wrapper {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
  gap: 20px !important;
  align-items: stretch !important;
}
body.single .wp-block-rehub-comparison-item,
body.single .rh_compare_item,
body.single .rh-comparison-wrapper .rh_compare_item,
.single-post .wp-block-rehub-comparison-item,
.single-post .rh_compare_item,
.single-post .rh-comparison-wrapper .rh_compare_item {
  display: flex !important;
  flex-direction: column !important;
  min-height: 100% !important;
  align-items: stretch !important;
}
/* Table layout: align BOTTOM LINE, PROS, CONS rows across columns */
body.single .wp-block-rehub-comparison-table table,
body.single .rh-compare-table-wrapper table,
.single-post .wp-block-rehub-comparison-table table,
.single-post .rh-compare-table-wrapper table {
  table-layout: fixed !important;
  width: 100% !important;
}
body.single .wp-block-rehub-comparison-table td,
body.single .wp-block-rehub-comparison-table th,
body.single .rh-compare-table-wrapper td,
body.single .rh-compare-table-wrapper th,
.single-post .wp-block-rehub-comparison-table td,
.single-post .wp-block-rehub-comparison-table th,
.single-post .rh-compare-table-wrapper td,
.single-post .rh-compare-table-wrapper th {
  vertical-align: top !important;
  padding: 12px 14px !important;
}
body.single .wp-block-rehub-comparison-item a.re_btn,
body.single .wp-block-rehub-comparison-item a[href*="amazon"],
body.single .wp-block-rehub-comparison-item a[href*="amzn"],
body.single .rh_compare_item .re_btn,
body.single .rh_compare_item a[href*="amazon"],
.single-post .wp-block-rehub-comparison-item a.re_btn,
.single-post .wp-block-rehub-comparison-item a[href*="amazon"],
.single-post .wp-block-rehub-comparison-item a[href*="amzn"],
.single-post .rh_compare_item .re_btn,
.single-post .rh_compare_item a[href*="amazon"] {
  margin-top: auto !important;
  align-self: stretch !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
