/* Keep the desktop hero composition while placing the buttons after the portrait on phones. */
.home-hero {
  grid-template-areas: "copy visual" "actions visual";
  grid-template-rows: auto auto;
  row-gap: 0;
}
.home-hero > .hero-copy { grid-area: copy; }
.home-hero > .portrait-stage { grid-area: visual; grid-row: 1 / span 2; }
.home-hero > .hero-actions { grid-area: actions; margin-top: 32px; }

/* Mobile layout corrections: keep the canvas fixed to the viewport. */
@media (max-width: 700px) {
  html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overscroll-behavior-x: none;
  }

  body { position: relative; }
  .wrap { width: calc(100% - 32px); max-width: 100%; }
  main, section, .header, .footer { min-width: 0; }
  img, svg, video, canvas { max-width: 100%; }

  /* Compact first screen: intro, portrait, then both equal calls to action. */
  .home-hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "copy" "portrait" "actions";
    grid-template-rows: auto auto auto;
    grid-template-areas: "copy" "portrait" "actions";
    gap: 14px;
    padding-block: 24px 30px;
    overflow: hidden;
  }
  .home-hero > .hero-copy { grid-area: copy; min-width: 0; }
  .home-hero > .portrait-stage { grid-area: portrait; grid-row: auto; }
  .home-hero > .hero-actions { grid-area: actions; }
  .home-hero .hero-copy .eyebrow { margin-bottom: 10px; font-size: 9px; letter-spacing: 1px; }
  .home-hero .hero-copy h1 {
    max-width: none;
    font-size: clamp(38px, 10vw, 52px);
    line-height: 1.03;
  }
  .home-hero .hero-copy > p {
    max-width: 38ch;
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.5;
  }
  .home-hero .portrait-stage {
    position: relative;
    justify-self: center;
    width: min(100%, 310px);
    height: clamp(260px, 78vw, 320px);
    min-height: 0;
    margin: 0 auto;
    overflow: hidden;
    perspective: none;
  }
  .home-hero .portrait-stage-image {
    inset: 0 8px 8px;
    border-radius: 46% 46% 18px 18px;
    transform: none !important;
  }
  .home-hero .portrait-stage-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 15%;
  }
  .home-hero .stage-orbit {
    z-index: 2;
    inset: 8% 3% 12%;
    width: auto;
    height: auto;
    clip-path: none;
    border-radius: 50%;
    transform: rotate(-24deg);
    animation: photo-orbit 16s ease-in-out infinite;
  }
  .home-hero .orbit-two {
    inset: 2% 10% 5%;
    transform: rotate(24deg);
    animation: photo-orbit-other 19s ease-in-out infinite;
  }
  .home-hero .photo-spark { display: none; }
  .home-hero .silver-satellite {
    width: 30px;
    height: 30px;
    left: 3%;
    top: 19%;
    z-index: 3;
  }
  .home-hero .stage-halo { max-width: 100%; }
  .home-hero .hero-actions {
    display: grid;
    margin-top: 0;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 9px;
    width: 100%;
    margin: 0;
  }
  .home-hero .hero-actions .btn,
  .home-hero .hero-actions .btn.light {
    min-width: 0;
    min-height: 48px;
    padding: 10px 9px;
    font-size: 12px;
    line-height: 1.3;
    text-align: center;
  }

  /* Keep infographic artwork elegant and prevent oversized sprite icons. */
  .profile-metric {
    min-height: 180px;
    padding: 14px;
    grid-template-rows: 44px auto 1fr;
    gap: 9px;
  }
  .profile-metric .metric-icon {
    width: 44px;
    height: 44px;
    max-width: 44px;
    aspect-ratio: 1;
    justify-self: start;
    border-radius: 50%;
    background-size: 200% 200%;
  }
  .profile-metric strong { font-size: clamp(25px, 7vw, 31px); }
  .profile-metric > span { font-size: 12px; line-height: 1.45; }

  /* Keep wide art and cards inside the viewport on every section. */
  .page-hero, .agency-case, .iceberg-section, .contact, .lab-canvas { min-width: 0; }
  .service-grid, .product-grid, .direction-grid, .process, .steps { min-width: 0; }
  .service-card, .product-card, .direction-card { min-width: 0; }
  .case-references, .case-gallery, .cert-track, .cert-slider { max-width: 100%; }
  .footer { gap: 12px; }
  .footlinks { row-gap: 8px; }
}

@media (max-width: 380px) {
  .wrap { width: calc(100% - 26px); }
  .home-hero .portrait-stage { width: min(100%, 285px); height: 270px; }
  .home-hero .hero-actions .btn,
  .home-hero .hero-actions .btn.light { font-size: 11px; padding-inline: 6px; }
  .nav { gap: 5px; font-size: 10px; }
}

@media (max-width: 700px) {
  .page-hero { padding-block: 38px 28px; }
  .page-hero .eyebrow { margin-bottom: 20px; font-size: 9px; letter-spacing: 1.3px; }
  .page-hero h1 { max-width: 100%; font-size: clamp(32px, 8.4vw, 40px); line-height: 1.12; letter-spacing: -.045em; }
  .page-hero h1 em { font-size: 1em; }
  .page-hero > p { max-width: 38ch; margin-top: 18px; font-size: 15px; line-height: 1.6; }
}
@media (max-width: 380px) { .page-hero h1 { font-size: 32px; } .page-hero > p { font-size: 14px; } }
