/*
 * Content Typography Styles
 * Manual prose utility for Tailwind CSS v4 compatibility
 */

.entry-content {
  font-family: "mozaic-geo-variable", sans-serif;
  font-weight: 300;

  h2,
  h3,
  h4 {
    font-weight: 500;
    color: #1b4799;
    margin-bottom: 1rem;
  }

  h5,
  h6 {
    font-weight: 400;
    margin-bottom: 1rem;
  }

  p {
    margin-bottom: 1rem;
  }

  /* Link Styles */
  a {
    color: #1b4799;
    text-decoration: underline;
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
  }

  a:hover {
    color: #d8575f;
    text-decoration-color: #d8575f;
  }

  a:focus {
    outline: 2px solid #1b4799;
    outline-offset: 2px;
    border-radius: 2px;
  }

  h2 {
    font-size: clamp(1.5rem, 2.25vw, 2.25rem);
    line-height: 1.25;
  }

  h2:not(:first-child) {
    margin-top: 2rem;
  }

  h3 {
    font-size: clamp(1.25rem, 1.75vw, 1.875rem);
    line-height: 1.25;
  }

  h4 {
    font-size: clamp(1.125rem, 1.5vw, 1.5rem);
    line-height: 1.25;
  }

  h5 {
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    line-height: 1.25;
  }

  h6 {
    font-size: clamp(0.875rem, 1vw, 1rem);
    line-height: 1;
  }

  .wp-block-buttons {
    margin-bottom: 2rem;
  }

  .wp-block-image:not(.no-style) {
    display: flex;
    flex-direction: column;
    align-items: center;
    img {
      border-radius: 2rem;
      box-shadow: 8px 8px 16px 0px rgba(27, 71, 153, 0.05);
    }

    figcaption {
      font-size: 0.875rem;
      color: #666;
      margin-top: 0.5rem;
    }
  }

  .wp-block-table table {
    margin: 2rem 0;
    border-collapse: collapse;
    thead {
      border-bottom: 1px solid #ddd;
    }
    th {
      color: white;
      background: #d8575f;
      border: none;
      text-align: left;
    }

    td {
      border: none;
      text-align: left;
      min-width: 200px;
      padding: 0.5rem 0;
    }

    tbody {
      td {
        border-bottom: 1px solid #ddd;
      }
    }

    tfoot {
      border-top: 2px solid #d8575f;
    }
  }

  ul.wp-block-list {
    list-style: disc;
    padding-inline-start: 1.5rem;
    margin-bottom: 2rem;

    li {
      margin-bottom: 0.5rem;
    }
  }

  ol.wp-block-list {
    list-style: decimal;
    padding-inline-start: 1.5rem;
    margin-bottom: 2rem;

    li {
      margin-bottom: 0.5rem;
    }
  }

  .wp-block-gallery {
    figure {
      overflow: hidden;
      cursor: pointer;
    }

    img {
      border-radius: 0;
      transition: transform 0.3s ease;
      cursor: pointer;
    }

    figure:hover img {
      transform: scale(1.05);
    }

    figcaption {
      font-size: 0.875rem;
      color: #666;
      margin-top: 0.5rem;
      display: none;
    }
  }

  /* YouTube Embed Performance Optimizations */
  .wp-block-embed,
  .wp-block-embed__wrapper {
    /* Use transform3d to enable hardware acceleration */
    transform: translateZ(0);
    /* Prevent layout shifts */
    will-change: auto;
    /* Isolate the embed to its own layer */
    isolation: isolate;
  }

  .wp-block-embed iframe[src*="youtube"],
  .wp-block-embed iframe[src*="youtu.be"] {
    /* Hardware acceleration for smooth scrolling */
    transform: translateZ(0);
    /* Reduce browser repaints during scroll */
    backface-visibility: hidden;
    /* Optimize for smooth animations */
    will-change: transform;
    /* Contain layout changes within the iframe */
    contain: layout style paint;
  }

  /* Container for responsive YouTube embeds */
  .wp-block-embed.is-type-video,
  .wp-block-embed.wp-block-embed-youtube {
    position: relative;
    /* Add some breathing room around embeds */
    margin: 2rem 0;
    /* Smooth any container transforms */
    transition: transform 0.3s ease-out;
  }

  /* Reduce scroll jank on mobile */
  @media (max-width: 768px) {
    .wp-block-embed iframe[src*="youtube"],
    .wp-block-embed iframe[src*="youtu.be"] {
      /* More aggressive hardware acceleration on mobile */
      transform: translate3d(0, 0, 0);
      /* Optimize for mobile scroll performance */
      -webkit-transform: translate3d(0, 0, 0);
    }
  }

  /* Chat Bubble Blockquote Styles */
  blockquote {
    position: relative;
    background-color: #e0ebf7;
    padding: clamp(1rem, 10vw, 4rem) 10vw;
    margin: 2rem -10vw;
    border-radius: 1rem;
    border: none;
    font-style: normal;
    font-size: 1rem;
    font-weight: 300;
    margin-bottom: clamp(2rem, 7.5vw, 6rem);
  }

  blockquote::after {
    content: "";
    position: absolute;
    top: 100%; /* Position at bottom of container */
    left: 10%; /* 10% from left edge */
    width: 15%; /* 10% of container width */
    max-width: 100px;
    height: auto;
    aspect-ratio: 2.2; /* Maintain SVG proportions */
    background-image: url("../images/talk-bubble-tail-blue.svg");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
  }

  @media (max-width: 768px) {
    blockquote {
      margin: 2rem 0;
    }
  }

  .uagb-faq-item {
    border: none !important;
    box-shadow: 8px 8px 16px 0px rgba(27, 71, 153, 0.05) !important;
    background: white;
    border-radius: clamp(1rem, 1.5vw, 2rem) !important;
    padding: clamp(0.5rem, 1.5vw, 3rem) !important;
  }

  .uagb-faq-questions-button h3 {
    font-size: clamp(1.125rem, 1vw, 1.5rem) !important;
    font-weight: 500;
    max-width: 80%;
  }

  .uagb-icon {
    margin: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    right: clamp(0.5rem, 1.5vw, 1rem);
    transform: translateY(-50%);
    width: clamp(1.5rem, 3vw, 2rem) !important;
    height: clamp(1.5rem, 3vw, 2rem) !important;
    background-color: #d8575f;
    border-radius: 50%;
    color: white;
    font-size: 1rem;
    line-height: 2rem;
    text-align: center;
    font-weight: bold;
    transition: transform 0.3s ease;
    transform-origin: center;

    svg {
      color: white;
      fill: currentColor;
    }
  }

  .uagb-faq-item-active .uagb-icon {
    transform: translateY(-50%) rotate(180deg);
  }

  .uagb-icon-active {
    display: none !important;
  }

  .uagb-faq-questions-button {
    position: relative;
  }
}

/* Gallery Lightbox Styles - Outside .entry-content for global access */
.gallery-lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.gallery-lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lightbox-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  cursor: pointer;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
}

.lightbox-swiper {
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-swiper .swiper-slide {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: calc(90vh - 100px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.lightbox-caption {
  margin-top: 1rem;
  padding: 0 2rem;
  color: white;
  font-size: 0.875rem;
  text-align: center;
  max-width: 600px;
  line-height: 1.4;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: background-color 0.2s ease;
  z-index: 10;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
  .lightbox-content,
  .lightbox-swiper {
    max-width: 95vw;
    max-height: 95vh;
  }

  .lightbox-image {
    max-height: calc(95vh - 80px);
  }

  .lightbox-close {
    top: 10px;
    right: 10px;
  }

  .lightbox-caption {
    padding: 0 1rem;
    margin-top: 0.5rem;
  }
}
