/*
 * Final responsive safeguards.
 *
 * This stylesheet loads after the component styles. It keeps the homepage
 * compact and readable without changing the 4Apples design language.
 */

html {
  overflow-x: clip;
}

body {
  overflow-x: hidden;
}

img,
picture,
video,
iframe {
  max-width: 100%;
}

.ae-container,
.ae-hero__content,
.ae-hero__actions,
.ae-hero__trust,
.ae-floating-search {
  min-width: 0;
}

/* Compact front-page slider: shorter than the original 860px desktop hero. */
.ae-hero--home {
  min-height: clamp(560px, 72svh, 700px);
}

.ae-hero--home .ae-hero__content {
  padding-top: calc(var(--ae-topbar-height, 36px) + var(--ae-header-height, 82px) + 42px);
  padding-bottom: 44px;
}

.ae-hero--home h1 {
  max-width: 760px;
  margin: 14px 0 16px;
  font-size: clamp(2.5rem, 4.8vw, 5.25rem);
  letter-spacing: -.045em;
}

.ae-hero--home p {
  max-width: 650px;
  margin: 0;
  font-size: clamp(1rem, 1.25vw, 1.16rem);
  line-height: 1.6;
}

.ae-hero--home .ae-hero__actions {
  margin: 22px 0;
}

.ae-hero--home .ae-hero__trust {
  gap: 8px 10px;
  margin-top: 15px;
}

.ae-hero--home .ae-hero__trust span {
  padding: 6px 9px;
  font-size: .79rem;
}

.ae-hero--home .ae-floating-search {
  margin-top: 22px;
  padding: 10px;
}

.ae-hero--home .ae-hero-slider__meta {
  bottom: clamp(18px, 4vw, 52px);
}

/* Keep the five introductory metrics compact on medium-width screens. */
@media (max-width: 1024px) {
  .ae-hero--home {
    min-height: clamp(540px, 70svh, 640px);
  }

  .ae-hero--home .ae-hero__content {
    padding-top: calc(var(--ae-topbar-height, 36px) + var(--ae-header-height, 82px) + 30px);
    padding-bottom: 34px;
  }

  .ae-hero--home h1 {
    font-size: clamp(2.6rem, 6.5vw, 4.6rem);
  }

  .ae-hero--home .ae-floating-search {
    max-width: 630px;
  }

  .ae-hero--home .ae-hero-slider__meta {
    right: 18px;
    bottom: 22px;
  }

  .ae-stats__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .ae-hero--home {
    min-height: 570px;
  }

  .ae-hero--home .ae-hero__content {
    padding-top: calc(var(--ae-topbar-height, 34px) + var(--ae-header-height, 70px) + 24px);
    padding-bottom: 50px;
  }

  .ae-hero--home h1 {
    max-width: 620px;
    font-size: clamp(2.35rem, 10vw, 3.7rem);
  }

  .ae-hero--home p {
    max-width: 590px;
    font-size: .98rem;
  }

  .ae-hero--home .ae-hero__actions {
    gap: 10px;
    margin: 18px 0;
  }

  .ae-hero--home .ae-button {
    min-height: 44px;
    padding: 11px 18px;
  }

  .ae-hero--home .ae-hero__trust {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .ae-hero--home .ae-hero__trust span {
    justify-content: center;
    min-width: 0;
    padding: 6px;
    font-size: .68rem;
    line-height: 1.2;
    text-align: center;
  }

  .ae-hero--home .ae-floating-search {
    margin-top: 18px;
    border-radius: 18px;
  }

  .ae-hero--home .ae-hero-slider__meta {
    right: 14px;
    bottom: 16px;
    max-width: calc(100% - 28px);
    padding: 10px 12px;
  }

  .ae-hero--home .ae-hero-slider__meta strong {
    font-size: .82rem;
  }

  .ae-stats {
    margin-top: -38px;
  }

  .ae-stats__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .ae-stat {
    min-height: 118px;
    padding: 18px 12px;
  }
}

@media (max-width: 480px) {
  .ae-container {
    width: min(calc(100% - 24px), 1280px);
  }

  .ae-hero--home {
    min-height: 500px;
  }

  .ae-hero--home .ae-hero__content {
    padding-top: calc(var(--ae-topbar-height, 34px) + var(--ae-header-height, 70px) + 18px);
    padding-bottom: 28px;
  }

  .ae-hero--home .ae-kicker {
    font-size: .62rem;
  }

  .ae-hero--home h1 {
    margin: 10px 0 12px;
    font-size: clamp(2.05rem, 11vw, 3rem);
  }

  .ae-hero--home p {
    font-size: .9rem;
    line-height: 1.5;
  }

  .ae-hero--home .ae-hero__actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 16px 0;
  }

  .ae-hero--home .ae-button {
    width: 100%;
  }

  .ae-hero--home .ae-hero__trust,
  .ae-hero--home .ae-hero-slider__meta {
    display: none;
  }

  .ae-hero--home .ae-floating-search {
    margin-top: 14px;
    border-radius: 14px;
  }

  .ae-stats {
    margin-top: -22px;
  }

  .ae-stat {
    min-height: 104px;
    padding: 14px 10px;
  }

  .ae-stats__grid > :last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 360px) {
  .ae-hero--home h1 {
    font-size: 2rem;
  }

  .ae-hero--home .ae-button {
    padding-inline: 14px;
    font-size: .88rem;
  }
}
