@import url("/assets/index-DEZzWTou-base.css");

/* Shared desktop/mobile geometry fixes */
html,
body {
  max-width: 100%;
  overflow-x: hidden !important;
}

main {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
}

.hero,
.map-concept,
.academy,
.executive-presence,
.education-hero,
.software-hero {
  contain: paint;
}

.map-grid {
  inset: 0 !important;
  transform: perspective(600px) rotateX(54deg) rotate(-9deg) scale(1.12) !important;
  transform-origin: center;
}

@media (min-width: 1101px) {
  .gallery {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 12px;
  }
}

@media (min-width: 761px) and (max-width: 1100px) {
  .gallery {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

/* Mobile stability patch */
@media (max-width: 760px), (pointer: coarse) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
    position: relative;
  }

  body > main,
  main,
  main > section,
  main > header,
  main > footer,
  section,
  footer {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  main *,
  section * {
    min-width: 0;
  }

  body > main,
  main {
    overflow-x: hidden !important;
  }

  .accessibility-tools {
    width: auto !important;
    max-width: calc(100% - 24px) !important;
    right: 12px !important;
    left: 12px !important;
    box-sizing: border-box !important;
  }

  .scroll-progress {
    width: var(--scroll-progress) !important;
    max-width: 100% !important;
  }

  .motion-reveal,
  .motion-reveal.is-visible {
    opacity: 1 !important;
    visibility: visible !important;
    filter: none !important;
    transform: none !important;
    transition: none !important;
  }

  .education-hub,
  .education-hub-heading,
  .education-stage-cards,
  .education-stage-cards a,
  .education-page,
  .education-browser,
  .education-grid,
  .education-grid article,
  .software-grid article,
  .service-list article,
  .technology-stack article {
    content-visibility: visible !important;
    contain: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
  }

  .hero-image,
  .nav-wrap,
  .academy-orbit,
  .education-stage-cards a,
  .education-grid article,
  .software-grid article,
  .service-list article,
  .technology-stack article,
  .primary-button::before,
  .contact-button::before {
    animation: none !important;
    transition: none !important;
  }

  .primary-button::before,
  .contact-button::before,
  .project-card::after,
  .executive-presence::before,
  .education-hero::after,
  .software-hero::before {
    display: none !important;
  }

  .map-grid {
    inset: 0 !important;
    transform: none !important;
  }

  main,
  section,
  footer,
  .education-hub,
  .education-page {
    max-width: 100%;
    overflow-x: hidden !important;
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .project-card {
    width: 100% !important;
    max-width: 100% !important;
    content-visibility: auto !important;
    contain-intrinsic-size: auto 310px;
    touch-action: manipulation;
  }

  .identity-aliases,
  .contact-numbers,
  .telegram-card,
  .map-concept,
  .technology-stack,
  .education-stage-cards {
    width: 100% !important;
    max-width: 100% !important;
    overflow-wrap: anywhere;
  }

  .lightbox {
    inset: 0 !important;
    width: 100% !important;
    height: 100dvh !important;
    max-width: none !important;
    padding: 58px 10px 38px !important;
    background: #02080b !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    animation: none !important;
    transition: none !important;
    overflow: hidden !important;
    touch-action: manipulation;
  }

  .lightbox-image {
    width: calc(100vw - 20px) !important;
    height: calc(100dvh - 105px) !important;
    max-width: 100% !important;
    contain: layout paint size;
  }

  .lightbox-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  .lightbox > button {
    position: fixed !important;
    top: 8px !important;
    left: 10px !important;
    z-index: 2;
    background: #102329 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
