/* Base Mobile Styles (< 768px) */
.hpa-tabs,
.hpa-aside-cards {
  display: none;
}

.hpa-accordion-collapse {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease-in-out, opacity 0.35s ease-in-out;
  opacity: 0;
}

.hpa-item.active .hpa-accordion-collapse {
  opacity: 1;
  /* max-height handled dynamically via JavaScript for smooth animation */
}

/* Toggle Arrow Rotation */
.hpa-header-arrow svg {
  transition: transform 0.3s ease;
}

.hpa-item.active .hpa-header-arrow svg {
  transform: rotate(180deg);
}

/* Desktop Layout (768px+) */
@media (min-width: 768px) {
  /* Hide Mobile Accordion Structure */
  .hpa-item {
    display: none !important;
  }

  /* Show Desktop Tabs & Cards */
  .hpa-tabs,
  .hpa-aside-cards {
    display: block;
  }

  /* Aside Card Fade Animation */
  .hpa-aside-card {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
  }

  .hpa-aside-card.active {
    display: block;
    opacity: 1;
  }

  @supports (display: grid) {
    /* Overlay cards in same space for seamless cross-fading */
    .hpa-aside-cards {
      display: grid;
      grid-template-columns: 1fr;
    }

    .hpa-aside-card {
      grid-area: 1 / 1;
      display: block;
      visibility: hidden;
      opacity: 0;
      pointer-events: none;
    }

    .hpa-aside-card.active {
      visibility: visible;
      opacity: 1;
      pointer-events: auto;
    }
  }
}

.hpa-title-icon {
  margin-top: 3px;
  flex: 0 0 22px;
  max-width: 22px;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.hpa-tab.active .hpa-title-icon, .hpa-item.active .hpa-title-icon {
  opacity: 1;
}
.hpa-tab h3, .hpa-item h3 {
  color: #EFECFF;
  font-size: 28px;
  line-height: 1.14;
  opacity: 0.4;
  transition: opacity 0.3s ease;
}
.hpa-tab.active h3, .hpa-item.active h3 {
  opacity: 1;
}
.hpa-container p, .hpa-container ol, .hpa-container ul {
  color: rgba(194, 191, 210, 0.74);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
}
.hpa-container p:last-child, .hpa-container ol:last-child, .hpa-container ul:last-child {
  margin-bottom: 0;
}
@media (max-width: 767px) {
  .hpa-item {
    margin-bottom: 10px;
    padding: 20px;
    border: 1px solid rgba(194, 191, 210, 0.74);
    border-radius: 20px;
  }
  .hpa-item .hpa-header {
    display: flex;
    flex-direction: row-reverse;
    align-items: start;
    gap: 10px;
  }
  .hpa-item.active .hpa-header {
    display: block;
  }
  .hpa-header-icons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
  }
  .hpa-header-arrow {
    max-width: 20px;
    display: flex;
    justify-content: center;
  }
  .hpa-main-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    padding: 10px;
    border-radius: 41px;
    border: 0.942px solid #3B3B45;
    background: #141024;
  }
}
@media (min-width: 768px) {
  .hpa-container-outer {
    margin: 50px auto;
  }
  .hpa-container {
    display: flex;
    gap: 72px;
  }
  .hpa-tabs {
    flex: 0 0 calc(40% - 36px);
    max-width: calc(40% - 36px);
  }
  .hpa-tab {
    margin-bottom: 63px;
    cursor: pointer;
  }
  .hpa-tab-header {
    display: flex;
    gap: 10px;
  }
  .hpa-main-text {
    max-height: 0;
    opacity: 0;
    overflow: hidden; /* Prevents text overflow while height is 0 */
    visibility: hidden; /* Hides content from screen readers & focus when closed */
    transition: max-height 0.6s ease, opacity 0.6s ease, visibility 0.6s ease;
    padding-left: 32px;
  }
  .hpa-tab.active .hpa-main-text {
    max-height: 1000px; /* Set higher than the maximum expected content height */
    opacity: 1;
    visibility: visible;
    margin-top: 10px;
  }
  .hpa-aside-cards {
    flex: 0 0 calc(60% - 36px);
    max-width: calc(60% - 36px);
  }
  .hpa-header-arrow {
    display: none;
  }
  .hpa-aside-card-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    max-width: 750px;
    border-radius: 82px;
    border: 0.942px solid #3B3B45;
    background: #141024;
  }
  .hpa-item h3 {
    font-size: 33px;
    line-height: 1.15;
    letter-spacing: -1.583px;
  }
}