/* Prevent overscroll chaining */
html,
body {
  overscroll-behavior-y: contain;
  overflow-x: hidden;
}

@media screen and (max-width: 768px) {
  body {
    font-size: 16px;
    /* Increased base font size for mobile */
  }

  .page-title {
    font-size: 1.5rem;
  }

  .section-title {
    font-size: 1.4rem;
  }

  .main-content {
    padding: 1rem !important;
    gap: 2rem !important;
  }

  /* Scale down container widths */
  div[style*="max-width: 60%"] {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Scale down flex layouts */
  div[style*="display: flex"] {
    flex-direction: column !important;
    align-items: center !important;
    gap: 1rem !important;
  }

  .screenshot-img {
    width: 100% !important;
    height: auto !important;
  }

  /* Scale down margins */
  div[style*="margin-top: 6rem"],
  div[style*="margin-top: 4rem"],
  div[style*="margin-bottom: 4rem"] {
    margin-top: 2rem !important;
    margin-bottom: 2rem !important;
  }

  img {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Scale down padding in containers */
  div[style*="padding: 2rem"] {
    padding: 1rem !important;
  }

  /* Center images and their containers */
  a[href*="Twine/"] {
    text-align: center !important;
    padding: 0 !important;
    margin: 2rem auto !important;
    display: block !important;
    width: 100% !important;
  }

  /* Center the testimonial paragraph */
  div[style*="text-align: center"] {
    text-align: center !important;
    padding: 0 1rem !important;
  }

  div[style*="text-align: center"] p {
    text-align: center !important;
    display: block !important;
    margin: 0 auto !important;
    max-width: 100% !important;
  }

  /* Override inline text-align for testimonial */
  div[style*="text-align: center"] p[style*="text-align: left"] {
    text-align: center !important;
  }

  .container {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* Mobile footer sizing */
  .site-footer {
    padding: 1.5rem 0 1rem !important;
    font-size: 0.875rem !important;
  }

  .site-footer nav {
    font-size: 0.875rem !important;
  }

  .site-footer nav a,
  .site-footer nav .link-text {
    font-size: 0.875rem !important;
  }

  .site-footer p {
    font-size: 0.75rem !important;
    margin-top: 0.5rem !important;
  }
}

@media screen and (max-width: 480px) {
  body {
    font-size: 14px;
    /* Increased base font size for smaller mobile */
  }

  .page-title {
    font-size: 1.3rem;
  }

  .section-title {
    font-size: 1.2rem;
  }

  p {
    font-size: 1rem !important;
    /* Increased paragraph font size for mobile */
  }

  .site-footer {
    padding: 1rem 0 0.75rem !important;
  }

  .site-footer nav {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .site-footer nav span {
    margin: 0 0.25rem;
  }
}

/* Center images in mobile landscape view */
@media screen and (max-height: 500px) and (orientation: landscape) {
  a[href*="Twine/"] {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    padding: 0 !important;
    margin: 2rem auto !important;
  }

  .screenshot-img {
    width: auto !important;
    max-width: 90vw !important;
    height: auto !important;
    margin: 0 auto !important;
    display: block !important;
  }
}