/* =========================================================
   Hashed System — Tablet-only responsive corrections
   Scope: 768px–1023px only.
   Desktop (1024px+) and mobile (<=767px) are intentionally untouched.
   ========================================================= */
@media (min-width: 768px) and (max-width: 1023px) {
  /* Shared safety: prevent fixed-width children from creating horizontal overflow. */
  body,
  main,
  main > div,
  section {
    min-width: 0;
  }

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

  /* Section title rows: at tablet width, never squeeze a heading beside its
     supporting paragraph. The heading gets the full row; copy follows below. */
  section [class~="md:flex-row"][class~="md:items-end"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  section [class~="md:flex-row"][class~="md:items-end"] > * {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* When a tablet section has a heading + supporting copy, give the heading
     the full row and place the copy directly underneath it. */
  .hs-tablet-stack-heading {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .hs-tablet-stack-heading > * {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* =========================
     HOME / FRONT PAGE
     ========================= */
  body.home .grid.grid-cols-2.md\:grid-cols-4,
  body.page-template-page-home .grid.grid-cols-2.md\:grid-cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1rem !important;
  }

  body.home .grid.grid-cols-2.md\:grid-cols-4 > *,
  body.page-template-page-home .grid.grid-cols-2.md\:grid-cols-4 > * {
    min-width: 0 !important;
  }

  body.home .grid.grid-cols-2.md\:grid-cols-4 > * > *,
  body.page-template-page-home .grid.grid-cols-2.md\:grid-cols-4 > * > * {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* =========================
     AI DEVELOPMENT
     ========================= */
  body.page-template-page-ai-development .hs-ai-metric-strip,
  body.page-template-page-ai-development .grid.grid-cols-4,
  body.page-template-page-ai-development [class~="md:grid-cols-4"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.page-template-page-ai-development .hs-ai-metric-strip > *,
  body.page-template-page-ai-development [class~="md:grid-cols-4"] > * {
    min-width: 0 !important;
  }

  body.page-template-page-ai-development .hs-ai-metric-strip .font-metric-callout,
  body.page-template-page-ai-development .hs-ai-metric-strip .text-metric-callout {
    font-size: clamp(30px, 4vw, 42px) !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  /* =========================
     AI INTEGRATION
     ========================= */
  body.page-template-page-ai-integration-services [class~="md:grid-cols-3"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.page-template-page-ai-integration-services [class~="md:grid-cols-3"] > * {
    min-width: 0 !important;
  }

  body.page-template-page-ai-integration-services .font-display-hero,
  body.page-template-page-ai-integration-services .text-display-hero {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* =========================
     SAAS DEVELOPMENT
     ========================= */
  body.page-template-page-saas-development .grid.grid-cols-3,
  body.page-template-page-saas-development [class~="md:grid-cols-3"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.page-template-page-saas-development .grid.grid-cols-3 > *,
  body.page-template-page-saas-development [class~="md:grid-cols-3"] > * {
    min-width: 0 !important;
  }

  /* =========================
     CUSTOM SOFTWARE DEVELOPMENT
     ========================= */
  body.page-template-page-custom-software-development .hs-stitch-template .text-display-hero,
  body.page-template-page-custom-software-development .hs-stitch-template .font-display-hero {
    width: 100% !important;
    max-width: 100% !important;
    font-size: 42px !important;
    line-height: 1.1 !important;
    overflow-wrap: anywhere;
  }

  body.page-template-page-custom-software-development .hs-stitch-template .text-body-lg,
  body.page-template-page-custom-software-development .hs-stitch-template .font-body-lg {
    width: 100% !important;
    max-width: 100% !important;
  }

  body.page-template-page-custom-software-development .hs-stitch-template [class~="md:grid-cols-2"],
  body.page-template-page-custom-software-development .hs-stitch-template [class~="md:grid-cols-3"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.page-template-page-custom-software-development .hs-stitch-template [class~="md:grid-cols-2"] > *,
  body.page-template-page-custom-software-development .hs-stitch-template [class~="md:grid-cols-3"] > * {
    min-width: 0 !important;
  }

  /* =========================
     ENTERPRISE SOFTWARE
     (enterprise-application-development template)
     ========================= */
  body.page-template-page-enterprise-application-development [class~="md:grid-cols-2"],
  body.page-template-page-enterprise-application-development [class~="md:grid-cols-3"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.page-template-page-enterprise-application-development [class~="md:grid-cols-5"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.page-template-page-enterprise-application-development [class~="md:grid-cols-2"] > *,
  body.page-template-page-enterprise-application-development [class~="md:grid-cols-3"] > *,
  body.page-template-page-enterprise-application-development [class~="md:grid-cols-5"] > * {
    min-width: 0 !important;
  }

  body.page-template-page-enterprise-application-development .font-display-hero,
  body.page-template-page-enterprise-application-development .text-display-hero,
  body.page-template-page-enterprise-application-development .font-headline-lg,
  body.page-template-page-enterprise-application-development .text-headline-lg {
    max-width: 100% !important;
  }

  /* =========================
     FINTECH / SOVEREIGN BANKING
     ========================= */
  body.page-template-page-fintech-sovereign-banking .hs-stitch-template .grid {
    min-width: 0 !important;
  }

  body.page-template-page-fintech-sovereign-banking .hs-stitch-template [class~="md:grid-cols-2"],
  body.page-template-page-fintech-sovereign-banking .hs-stitch-template [class~="md:grid-cols-3"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.page-template-page-fintech-sovereign-banking .hs-stitch-template [class~="md:grid-cols-2"] > *,
  body.page-template-page-fintech-sovereign-banking .hs-stitch-template [class~="md:grid-cols-3"] > * {
    min-width: 0 !important;
  }

  /* FAQ: no fixed/min content width on tablet. */
  body.page-template-page-fintech-sovereign-banking .hs-stitch-template .space-y-4,
  body.page-template-page-fintech-sovereign-banking .hs-stitch-template .rounded-xl {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body.page-template-page-fintech-sovereign-banking .hs-stitch-template .rounded-xl.bg-surface-card\/75 > button {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: flex-start !important;
    gap: .75rem !important;
  }

  body.page-template-page-fintech-sovereign-banking .hs-stitch-template .rounded-xl.bg-surface-card\/75 > button > span:first-child {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
  }

  body.page-template-page-fintech-sovereign-banking .hs-stitch-template .rounded-xl.bg-surface-card\/75 > button > .arrow-icon {
    flex: 0 0 20px !important;
  }

  body.page-template-page-fintech-sovereign-banking .hs-stitch-template .rounded-xl.bg-surface-card\/75 > div:not(.hidden) {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-wrap: anywhere !important;
  }

  /* =========================
     REAL ESTATE / PROPTECH
     ========================= */
  body.page-template-page-real-estate-proptech .font-display-hero,
  body.page-template-page-real-estate-proptech .text-display-hero {
    max-width: 100% !important;
    width: 100% !important;
  }

  body.page-template-page-real-estate-proptech [class~="md:grid-cols-3"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.page-template-page-real-estate-proptech [class~="md:grid-cols-3"] > * {
    min-width: 0 !important;
  }

  /* =========================
     ABOUT US
     ========================= */
  body.page-template-page-about-us .counter-flex {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body.page-template-page-about-us [class~="md:grid-cols-3"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.page-template-page-about-us [class~="md:grid-cols-3"] > *,
  body.page-template-page-about-us .counter-flex > * {
    min-width: 0 !important;
  }

  /* Section headers such as “Regional Presence…” stack instead of squeezing
     the heading and description into two narrow columns. */
  body.page-template-page-about-us [class~="md:flex-row"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  body.page-template-page-about-us [class~="md:flex-row"] > * {
    width: 100% !important;
    max-width: 100% !important;
  }
}
