/* Prestige v39 — balanced vertical rhythm
   Loaded last to neutralize oversized spacing introduced by legacy layers. */

:root{
  --space-section-desktop: clamp(54px, 5.2vw, 72px);
  --space-section-laptop: 54px;
  --space-section-mobile: 42px;
  --space-heading-desktop: clamp(24px, 3vw, 38px);
  --space-heading-mobile: 24px;
  --space-grid-desktop: clamp(18px, 2.2vw, 28px);
}

/* Main content sections */
body.worldclass-v36 main > section,
body.worldclass-v36 .section,
body.v35-responsive-studio main > section,
body.v35-responsive-studio .section,
main > section.section,
section.section{
  padding-top: var(--space-section-desktop) !important;
  padding-bottom: var(--space-section-desktop) !important;
}

/* Do not double spacing where sections touch */
main > section + section,
main > .section + .section{
  margin-top: 0 !important;
}

/* Hero spacing stays prominent without creating a huge gap below it */
.hero,
.hero-slide,
.px-hero,
.prestige-hero-shell .px-hero{
  padding-top: clamp(58px, 6vw, 84px) !important;
  padding-bottom: clamp(46px, 5vw, 68px) !important;
}

.prestige-hero-shell + .section,
.hero + .section,
.hero-slide + .section,
.px-hero + .section{
  padding-top: clamp(46px, 4.5vw, 62px) !important;
}

/* Section heading rhythm */
.section-title,
.head,
.section-head,
.section-header,
.title-wrap{
  margin-top: 0 !important;
  margin-bottom: var(--space-heading-desktop) !important;
}

.section-title > :first-child,
.head > :first-child,
.section-head > :first-child,
.section-header > :first-child{
  margin-top: 0 !important;
}

.section-title > :last-child,
.head > :last-child,
.section-head > :last-child,
.section-header > :last-child{
  margin-bottom: 0 !important;
}

/* Prevent stacked text margins from inflating section height */
.section h1,
.section h2,
.section h3,
.section h4,
.section p,
.section ul,
.section ol{
  margin-top: 0;
}

.section p:last-child,
.card p:last-child,
.section ul:last-child,
.section ol:last-child{
  margin-bottom: 0 !important;
}

/* Grid and card spacing */
.grid-2,
.grid-3,
.grid-4,
.grid-5,
.stats-grid,
.home-services-grid,
.courses-grid,
.footer-grid,
.ai-section-grid,
.hero-grid,
.px-hero-grid,
.review-grid,
.project-grid,
.blog-grid{
  gap: var(--space-grid-desktop) !important;
}

.card,
.course-card,
.service-card,
.project-card,
.review-card,
.blog-card{
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* Common oversized component spacing */
.feature-band,
.brand-block,
.stats,
.form-wrap,
.home-services-section,
.prestige-ai-section,
.corporate-section,
.testimonials-section,
.faq-section{
  padding-top: var(--space-section-desktop) !important;
  padding-bottom: var(--space-section-desktop) !important;
}

.brand-block + .section,
.section + .brand-block,
.feature-band + .section,
.section + .feature-band{
  margin-top: 0 !important;
}

/* Compact content inside callout panels */
.corporate-box,
.ai-section-grid,
.form-card,
.contact-card,
.login-card{
  padding-top: clamp(24px, 3vw, 40px) !important;
  padding-bottom: clamp(24px, 3vw, 40px) !important;
}

/* Footer should feel complete, not detached */
.footer{
  margin-top: 0 !important;
  padding-top: clamp(48px, 5vw, 68px) !important;
  padding-bottom: 24px !important;
}

.footer-grid{
  margin-bottom: clamp(24px, 3vw, 38px) !important;
}

/* Remove empty legacy spacer elements */
.spacer:empty,
.section-spacer:empty,
.empty-space:empty,
.py-5:empty,
.my-5:empty{
  display:none !important;
}

@media (min-width:768px) and (max-width:1100px){
  body.worldclass-v36 main > section,
  body.worldclass-v36 .section,
  body.v35-responsive-studio main > section,
  body.v35-responsive-studio .section,
  main > section.section,
  section.section,
  .feature-band,
  .brand-block,
  .stats,
  .form-wrap,
  .home-services-section,
  .prestige-ai-section{
    padding-top: var(--space-section-laptop) !important;
    padding-bottom: var(--space-section-laptop) !important;
  }

  .hero,
  .hero-slide,
  .px-hero,
  .prestige-hero-shell .px-hero{
    padding-top: 58px !important;
    padding-bottom: 52px !important;
    min-height: auto !important;
  }

  .section-title,
  .head,
  .section-head,
  .section-header{
    margin-bottom: 28px !important;
  }
}

@media (max-width:767px){
  body.worldclass-v36 main > section,
  body.worldclass-v36 .section,
  body.v35-responsive-studio main > section,
  body.v35-responsive-studio .section,
  main > section.section,
  section.section,
  .feature-band,
  .brand-block,
  .stats,
  .form-wrap,
  .home-services-section,
  .prestige-ai-section,
  .corporate-section,
  .testimonials-section,
  .faq-section{
    padding-top: var(--space-section-mobile) !important;
    padding-bottom: var(--space-section-mobile) !important;
  }

  .hero,
  .hero-slide,
  .px-hero,
  .prestige-hero-shell .px-hero{
    padding-top: 42px !important;
    padding-bottom: 40px !important;
    min-height: auto !important;
  }

  .prestige-hero-shell + .section,
  .hero + .section,
  .hero-slide + .section,
  .px-hero + .section{
    padding-top: 38px !important;
  }

  .section-title,
  .head,
  .section-head,
  .section-header,
  .title-wrap{
    margin-bottom: var(--space-heading-mobile) !important;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .grid-5,
  .stats-grid,
  .home-services-grid,
  .courses-grid,
  .footer-grid,
  .ai-section-grid,
  .hero-grid,
  .px-hero-grid,
  .review-grid,
  .project-grid,
  .blog-grid{
    gap: 18px !important;
  }

  .footer{
    padding-top: 44px !important;
    padding-bottom: 88px !important;
  }
}
