/*
 * Prestige Coding & Technology Limited
 * V40 — Natural content height authority
 * Prevents flex/grid siblings from inheriting the height of the tallest item.
 */

/* Grid containers must size each item from its own content. */
:where(
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-5,
  .form-grid,
  .footer-grid,
  .home-services-grid,
  .services-grid,
  .courses-grid,
  .projects-grid,
  .blog-grid,
  .team-grid,
  .testimonial-grid,
  .stats-grid,
  .locations-grid,
  .partners-grid,
  .pricing-grid,
  .feature-grid,
  .benefits-grid,
  .contact-grid,
  .admission-grid,
  .children-grid,
  .ai-mini-grid,
  .ai-feature-list,
  .px-journey-grid
) {
  align-items: start !important;
  align-content: start !important;
  grid-auto-rows: max-content !important;
}

/* Direct grid children should never stretch to the row height. */
:where(
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-5,
  .form-grid,
  .footer-grid,
  .home-services-grid,
  .services-grid,
  .courses-grid,
  .projects-grid,
  .blog-grid,
  .team-grid,
  .testimonial-grid,
  .stats-grid,
  .locations-grid,
  .partners-grid,
  .pricing-grid,
  .feature-grid,
  .benefits-grid,
  .contact-grid,
  .admission-grid,
  .children-grid,
  .ai-mini-grid,
  .px-journey-grid
) > * {
  align-self: start !important;
  height: auto !important;
  min-height: 0 !important;
}

/* Common card and panel components retain their natural content height. */
:where(
  .card,
  .service-pro-card,
  .course-card,
  .project-card,
  .blog-card,
  .team-card,
  .review-card,
  .testimonial-card,
  .stat-card,
  .location-card,
  .partner-card,
  .pricing-card,
  .feature-card,
  .benefit-card,
  .contact-card,
  .form-card,
  .admission-card,
  .children-card,
  .corporate-box,
  .ai-showcase-card,
  .ai-orbit-card,
  .px-command,
  .px-journey-card,
  article.card
) {
  height: auto !important;
  min-height: 0 !important;
  align-self: start !important;
}

/* Flex rows: siblings keep independent heights rather than stretching. */
:where(
  .corporate-box,
  .review-head,
  .ai-showcase-header,
  .ai-section-grid,
  .hero-grid,
  .px-hero-grid,
  .ai-hero-grid,
  .contact-row,
  .feature-row,
  .content-row,
  .split-layout,
  .two-column,
  .three-column
) {
  align-items: flex-start !important;
}

/* Preserve intentional vertical centring only in hero layouts. */
:where(.hero-grid, .px-hero-grid, .ai-hero-grid, .ai-section-grid) {
  align-items: center !important;
}

/* Internal flex card structures must not force the card to fill a sibling. */
:where(
  .card,
  .service-pro-card,
  .course-card,
  .project-card,
  .blog-card,
  .team-card,
  .testimonial-card,
  .pricing-card
) {
  justify-content: flex-start !important;
}

:where(
  .card,
  .service-pro-card,
  .course-card,
  .project-card,
  .blog-card,
  .team-card,
  .testimonial-card,
  .pricing-card
) > :last-child {
  margin-bottom: 0;
}

/* Undo legacy 100% height rules on card internals. */
:where(
  .course-body,
  .card-body,
  .service-body,
  .project-body,
  .blog-body,
  .testimonial-body,
  .pricing-body,
  .owl-item > article,
  .owl-item > .card
) {
  height: auto !important;
  min-height: 0 !important;
}

/* Owl Carousel otherwise stretches every slide to the tallest slide. */
.owl-carousel .owl-stage {
  display: flex !important;
  align-items: flex-start !important;
}

.owl-carousel .owl-item {
  align-self: flex-start !important;
  height: auto !important;
  min-height: 0 !important;
}

.owl-carousel .owl-item > * {
  height: auto !important;
  min-height: 0 !important;
}

/* Bootstrap-style rows/columns and generic flex wrappers. */
:where(.row, .flex-row, .cards-row, .content-flex) {
  align-items: flex-start !important;
}

:where(.row, .flex-row, .cards-row, .content-flex) > * {
  align-self: flex-start !important;
  height: auto !important;
}

/* Keep media naturally sized; never use a card's inherited height. */
:where(.card, .course-card, .project-card, .blog-card) img {
  height: auto;
}

/* Mobile and laptop retain the same independent-height rule. */
@media (max-width: 767px) {
  :where(.grid-2, .grid-3, .grid-4, .grid-5, .form-grid, .footer-grid) > * {
    width: 100%;
    height: auto !important;
  }
}
