/* Color Palette Variables based on PMS Cool Gray specs */
:root {
  --gray-dark: #454545;   /* Dark Gray / Cool Gray 11 */
  --gray-medium: #7f7f7f; /* Medium Gray / Cool Gray 8 */
  --gray-light: #e6e6e6;  /* Light Gray / Cool Gray 1 */
}

/* Ensure consistent box-sizing calculation across all browser engines */
.bubble-section-wrapper,
#bubble-wrap-container,
#bubble-wrap-container * {
  box-sizing: border-box;
}

/* Container Wrapper - Keeps bubbles contained within section boundaries */
.bubble-section-wrapper {
  position: relative;
  width: 100%;
  min-height: 380px;
  overflow: hidden;
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6rem 1rem;
}

/* Background grid container using CSS Grid to prevent edge overflow */
#bubble-wrap-container {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: grid;
  justify-content: center; /* Horizontally center grid */
  align-content: center;   /* Vertically center grid */
  gap: 10px;
  padding: 15px;
  z-index: 1;
  overflow: hidden;
}

/* Base Bubble Styling (PMS Cool Gray Palette) */
.bubble {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  user-select: none;
  background: radial-gradient(
    circle at 35% 30%, 
    rgba(255, 255, 255, 0.95) 0%, 
    rgba(230, 230, 230, 0.8) 25%,   /* Light Gray accent */
    rgba(127, 127, 127, 0.45) 60%,  /* Medium Gray transition */
    rgba(69, 69, 69, 0.65) 100%     /* Dark Gray shadow rim */
  );
  box-shadow: 
    inset 1px 2px 2px rgba(255, 255, 255, 0.9),
    inset -2px -4px 6px rgba(69, 69, 69, 0.35),
    2px 4px 8px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.5);
  transition: transform 0.08s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Highlights & Under-Rim Reflections */
.bubble::before {
  content: '';
  position: absolute;
  top: 12%;
  left: 20%;
  width: 35%;
  height: 25%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  filter: blur(0.5px);
  transform: rotate(-30deg);
}

.bubble::after {
  content: '';
  position: absolute;
  bottom: 12%;
  right: 18%;
  width: 40%;
  height: 20%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  filter: blur(1px);
}

.bubble:hover {
  transform: scale(1.04);
}

/* Popped Bubble State - Neutral Recess */
.bubble.popped {
  background: radial-gradient(
    circle at 50% 50%, 
    rgba(230, 230, 230, 0.15) 0%, 
    rgba(127, 127, 127, 0.25) 70%, 
    rgba(69, 69, 69, 0.4) 100%
  );
  box-shadow: 
    inset 1px 2px 5px rgba(69, 69, 69, 0.45),
    inset -1px -1px 3px rgba(255, 255, 255, 0.6),
    0 1px 2px rgba(0, 0, 0, 0.04);
  transform: scale(0.92) rotate(var(--rotation, 0deg));
  border-radius: 46% 54% 48% 52% / 53% 47% 53% 47%;
  cursor: default;
}

.bubble.popped::before {
  width: 65%;
  height: 2px;
  top: 48%;
  left: 17.5%;
  background: rgba(255, 255, 255, 0.7);
  transform: rotate(var(--rotation, 15deg));
  filter: blur(0.2px);
}

.bubble.popped::after {
  width: 2px;
  height: 55%;
  top: 22.5%;
  left: 49%;
  background: rgba(69, 69, 69, 0.3);
  transform: rotate(calc(var(--rotation, 15deg) + 75deg));
  filter: blur(0.2px);
}

/* Content Placement & Layering */
.bubble-section-wrapper .bubble-content {
  position: relative;
  z-index: 5;
  display: block;
  text-align: center;
  max-width: 800px;
  width: 100%;
  
  /* Allows clicks to pass through empty regions/Shadow DOM containers */
  pointer-events: none;
  
  /* Frosted Glass Effect */
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 2.5rem 2rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 8px 32px 0 rgba(69, 69, 69, 0.08);
}

/* Explicitly re-enable pointer-events on content slots and custom web components */
.bubble-section-wrapper .bubble-content h2,
.bubble-section-wrapper .bubble-content p,
.bubble-section-wrapper .bubble-content [slot="actions"],
.bubble-section-wrapper .bubble-content umd-element-call-to-action,
.bubble-section-wrapper .bubble-content a {
  pointer-events: auto !important;
}

/* Mute button for the pop sound (js/bubbles.js), pinned to this section's own top-right corner --
   same floating-pill look as the Pause/Play-animations button elsewhere on the page
   (.ldw-motion-btn--hero in css/main.css). Sits above both the bubble grid (z-index: 1) and the
   frosted-glass content card (z-index: 5, and pointer-events: none by default -- see above) so it
   stays clickable regardless of where it overlaps either one. The .ldw-motion-btn base class
   (css/main.css) supplies the font/color/icon layout, so this only adds position + background. */
/* Solid, theme-independent dark pill -- copied from .ldw-motion-btn--float's approach (css/main.css)
   rather than --hero/--banner's translucent-on-dark-backdrop one. This section's own background is
   plain white/light regardless of the sitewide Dark/Light preference (unlike the hero/banner, which
   really do sit on dark imagery), so a low-opacity black fill read as barely-there gray, and adding
   translucent white on top of that on hover made it read as even lighter, not clearly "pressed" --
   the opposite of what a hover state should do. A solid background fixes both at once. */
.ldw-motion-btn--bubble-audio {
  position: absolute;
  /* Always white, like .ldw-motion-btn--float -- the base class's var(--text-main) flips to
     black in light mode, which vanished against this pill's fixed dark background. */
  color: #FFFFFF;
  top: 1rem;
  right: 1rem;
  z-index: 6;
  height: 2.3rem;
  padding: 0 0.95rem;
  background: #111213;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}
.ldw-motion-btn--bubble-audio:hover { background: #2c2c2c; }
.ldw-motion-btn--bubble-audio:focus-visible { outline-color: #FFD200; }
@media (max-width: 640px) {
  /* icon-only on a phone, same treatment as .ldw-motion-btn--hero/--banner -- the label stays in
     the accessibility tree (clipped, not display:none) so screen-reader users still get it */
  .ldw-motion-btn--bubble-audio { width: 2.3rem; padding: 0; justify-content: center; }
  .ldw-motion-btn--bubble-audio .ldw-motion-btn__text { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  /* Tighter outer padding and smaller gap between bubbles */
  #bubble-wrap-container {
    padding: 5px;
    gap: 6px;
  }

  /* Reduce bubble size so significantly more fit into the viewport */
  .bubble {
    width: 32px;
    height: 32px;
  }

  /* Shrink outer section padding to allow maximum canvas width */
  .bubble-section-wrapper {
    padding: 5rem 1.5rem;
    min-height: 320px;
  }
}