/* Impact page responsive polish (Impact.html).
   Mobile + tablet only; desktop keeps css/impact.css. */

/* Stage 1: "Education That Creates Opportunity" heading contrast.
   Root cause: .create h1 had no colour rule, so it inherited the default dark
   text which has weak contrast on the light green panel. Reuse the existing
   primary token rather than adding a new colour. */
.create h1 {
  color: var(--color-primary);
}

@media (max-width: 1024px) {
  /* Root cause: the hero used margin-left/right: 200px, collapsing to a
     sliver on phones and pushing content off-centre. */
  .impact-hero,
  .impact-hero2 {
    margin-left: var(--space-4);
    margin-right: var(--space-4);
    padding: 0 var(--space-3);
    gap: var(--space-4);
  }

  .impact-hero p,
  .impact-hero h1,
  .impact-hero h3 {
    max-width: 60ch;
    margin-left: auto;
    margin-right: auto;
  }

  .impact1 {
    margin-left: var(--space-4);
    margin-right: var(--space-4);
    padding: var(--space-5) var(--space-4);
    text-align: center;
  }

  /* Headings are flex containers; centre them at block level instead. */
  .impact1 h1,
  .impact1 h3 {
    display: block;
    text-align: center;
    font-size: 1.5rem;
    line-height: var(--line-height-heading);
    margin: 0 0 var(--space-3);
  }

  .impact-hero2 > div {
    min-width: 0;
  }

  .create {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
    margin: var(--space-5) var(--space-4) 0;
    padding: var(--space-4);
    text-align: center;
  }

  /* Stack the side-by-side text/image rows and make images fluid */
  .hero,
  .hero2,
  .hero3 {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-5);
    padding: var(--space-5) var(--space-4);
    margin-left: 0;
    margin-right: 0;
  }

  .hero-left,
  .hero-right,
  .hero2-left,
  .hero2-right,
  .hero3-left,
  .hero3-right {
    min-width: 0;
    text-align: center;
  }

  .hero-right img,
  .hero2-right img,
  .hero3-right img {
    width: 100%;
    max-width: 480px;
    height: auto;
    border-radius: var(--radius-lg);
  }

  .hero-left h2,
  .hero2-left h1,
  .hero3-left h1,
  .edu h1,
  .empower h1,
  .comm h1 {
    font-size: 1.5rem;
    line-height: var(--line-height-heading);
    margin: 0 0 var(--space-3);
  }

  .hero-left p,
  .hero2-left p,
  .hero3-left p,
  .edu-p {
    margin: 0;
    line-height: var(--line-height-base);
  }

  .story {
    flex-direction: column;
    align-items: center;
    gap: var(--space-5);
    margin: var(--space-6) var(--space-4);
    padding: var(--space-5) var(--space-4);
  }

  /* Root cause: .card-1 img had margin-left: 300px with 600x500 fixed size,
     so the gallery overflowed the viewport on every phone width. */
  .card-1 {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    padding: var(--space-4);
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    justify-items: center;
    text-align: center;
  }

  /* Stories of Change: text blocks read as one column and wrap naturally. */
  .card-1 h2,
  .card-1 h3 {
    width: 100%;
    max-width: 60ch;
    margin: var(--space-3) 0 0;
    font-size: 1.25rem;
    line-height: var(--line-height-heading);
    text-align: center;
  }

  .card-1 h2 {
    font-size: 1.15rem;
    margin-top: 0;
  }

  .card-1 p {
    width: 100%;
    max-width: 60ch;
    margin: 0;
    line-height: var(--line-height-base);
    text-align: center;
  }

  .card-1 img {
    width: 100%;
    max-width: 480px;
    height: auto;
    margin: 0 auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .card-1 {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
  }
}