/* Deterministic mobile stability layer. No measured negative margins, no generic image pulling. */

html,
body {
  max-width: 100%;
  overflow-x: hidden !important;
}

@media (max-width: 899px) {
  body.gb-home-revision,
  body.gb-home-revision main,
  body.gb-home-revision main section {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* Program cleanup approved on iPhone. */
  body.gb-home-revision .program-card .program-copy > span {
    display: none !important;
  }

  body.gb-home-revision .program-card .program-copy a {
    width: 100% !important;
    min-height: 64px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 0 18px !important;
    margin-top: 18px !important;
    font-size: 12px !important;
    line-height: 1.1 !important;
    letter-spacing: .075em !important;
    white-space: nowrap !important;
  }

  /* Only exact sections tagged by mobile-stability.js are tightened. */
  body.gb-home-revision .gb-mobile-section-school,
  body.gb-home-revision .gb-mobile-section-professors,
  body.gb-home-revision .gb-mobile-section-schedule,
  body.gb-home-revision .gb-mobile-section-location,
  body.gb-home-revision .gb-mobile-section-faq,
  body.gb-home-revision .gb-mobile-section-legacy {
    min-height: 0 !important;
    height: auto !important;
    max-width: 100vw !important;
    overflow: hidden !important;
  }

  body.gb-home-revision .gb-mobile-section-school,
  body.gb-home-revision .gb-mobile-section-professors,
  body.gb-home-revision .gb-mobile-section-location,
  body.gb-home-revision .gb-mobile-section-faq {
    padding-top: 56px !important;
    padding-bottom: 56px !important;
  }

  body.gb-home-revision .gb-mobile-section-schedule {
    padding-top: 52px !important;
    padding-bottom: 52px !important;
  }

  body.gb-home-revision .gb-mobile-section-school > *,
  body.gb-home-revision .gb-mobile-section-professors > *,
  body.gb-home-revision .gb-mobile-section-location > *,
  body.gb-home-revision .gb-mobile-section-faq > * {
    min-height: 0 !important;
    height: auto !important;
  }

  /* A ESCOLA: fill the existing visual void with copy, without moving the cards below. */
  body.gb-home-revision .gb-mobile-section-school {
    position: relative !important;
    isolation: isolate !important;
  }

  body.gb-home-revision .gb-mobile-section-school::after {
    content: "";
    position: absolute;
    z-index: 0;
    width: min(82vw, 620px);
    aspect-ratio: 1;
    right: -31vw;
    top: 88px;
    border-radius: 50%;
    border: 1px solid rgba(255, 64, 73, .09);
    box-shadow:
      0 0 0 54px rgba(255, 64, 73, .016),
      0 0 0 108px rgba(255, 64, 73, .010),
      0 0 100px rgba(223, 26, 48, .055);
    pointer-events: none;
    animation: gb-school-orbit 13s ease-in-out infinite alternate;
  }

  body.gb-home-revision .gb-mobile-section-school .gb-school-intro-copy {
    position: absolute !important;
    z-index: 2 !important;
    top: 132px !important;
    left: 30px !important;
    right: 30px !important;
    max-width: 650px !important;
    pointer-events: none;
  }

  body.gb-home-revision .gb-mobile-section-school .gb-school-intro-copy h2 {
    margin: 0 0 24px !important;
    max-width: 100% !important;
    color: #fff !important;
    font-family: "Barlow Condensed", "Arial Narrow", Impact, sans-serif !important;
    font-size: clamp(54px, 14.2vw, 74px) !important;
    font-weight: 800 !important;
    line-height: .88 !important;
    letter-spacing: -.045em !important;
    text-transform: uppercase !important;
    text-wrap: balance !important;
  }

  body.gb-home-revision .gb-mobile-section-school .gb-school-intro-copy p {
    margin: 0 !important;
    max-width: 92% !important;
    color: rgba(255,255,255,.62) !important;
    font-family: "Manrope", Arial, sans-serif !important;
    font-size: clamp(16px, 4.55vw, 20px) !important;
    line-height: 1.55 !important;
    letter-spacing: -.01em !important;
  }

  /* Professor photos: preserve the full portrait instead of cover-cropping. */
  body.gb-home-revision .gb-mobile-section-professors img.gb-professor-mobile-photo {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;
    object-position: center center !important;
    transform: none !important;
  }

  /* New team photo: crop toward people, not ceiling, without overflowing the figure. */
  body.gb-home-revision .gb-team-photo-safe {
    overflow: hidden !important;
  }

  body.gb-home-revision .gb-team-photo-safe img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center 72% !important;
    transform: scale(1.08) !important;
    transform-origin: center 72% !important;
  }

  /* Legacy stats: keep each row inside the phone width and stop label/description overlap. */
  body.gb-home-revision .gb-legacy-stats-safe {
    width: 100% !important;
    max-width: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  body.gb-home-revision .gb-legacy-stat-row {
    width: 100% !important;
    max-width: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(122px, .9fr) minmax(0, 1.25fr) !important;
    align-items: center !important;
    gap: 14px !important;
  }

  body.gb-home-revision .gb-legacy-stat-label {
    max-width: 100% !important;
    font-size: clamp(34px, 10vw, 46px) !important;
    line-height: .92 !important;
    letter-spacing: -.035em !important;
    white-space: normal !important;
  }

  body.gb-home-revision .gb-legacy-stat-row > :not(.gb-legacy-stat-label) {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-wrap: anywhere !important;
  }

  /* Prevent oversized headings from widening the viewport. */
  body.gb-home-revision main h1,
  body.gb-home-revision main h2,
  body.gb-home-revision main h3,
  body.gb-home-revision main p,
  body.gb-home-revision main div,
  body.gb-home-revision main article,
  body.gb-home-revision main figure {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

@keyframes gb-school-orbit {
  from { transform: translate3d(0,0,0) scale(.985); opacity: .72; }
  to { transform: translate3d(-10px,7px,0) scale(1.02); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  body.gb-home-revision .gb-mobile-section-school::after {
    animation: none !important;
  }
}
