/* ==========================================================================
   SoftPhase — Mobile & Tablet Responsive Layer
   Priority: phones and tablets (majority of traffic)
   ========================================================================== */

/* Grid / flex children must be allowed to shrink */
.hero-layout > *,
.split > *,
.container > *,
.container-wide > *,
.grid-2 > *,
.grid-3 > *,
.grid-4 > *,
.section-header,
.hero-copy,
.page-hero .container {
  min-width: 0;
  max-width: 100%;
}

h1, h2, h3, .h-display, .h1, .h2, .h3, .text-gradient {
  text-wrap: balance;
}

p, .lead, .text-sub {
  overflow-wrap: break-word;
}

/* --------------------------------------------------------------------------
   Typography — scale down on smaller screens
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
  .h-display {
    font-size: clamp(1.85rem, 6.8vw, 3rem);
    line-height: 1.2;
    letter-spacing: -0.025em;
  }

  .h1 {
    font-size: clamp(1.75rem, 5.5vw, 2.75rem);
  }

  .h2 {
    font-size: clamp(1.5rem, 4.8vw, 2.25rem);
    line-height: 1.25;
  }

  .h3 {
    font-size: clamp(1.2rem, 3.8vw, 1.6rem);
  }

  .lead {
    font-size: clamp(0.98rem, 2.8vw, 1.12rem);
    line-height: 1.65;
  }

  .section-header {
    margin-bottom: 2.5rem;
  }

  .eyebrow {
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    flex-wrap: wrap;
  }
}

@media (max-width: 575px) {
  .h-display {
    font-size: clamp(1.55rem, 7.2vw, 2.15rem);
    line-height: 1.22;
  }

  .h2 {
    font-size: clamp(1.35rem, 5.6vw, 1.85rem);
  }

  .page-hero .h-display {
    font-size: clamp(1.5rem, 6.8vw, 2rem);
  }
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero-title-static,
.hero-typed {
  display: block;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
}

.hero-typed {
  min-height: 1.25em;
  margin-top: 0.15em;
}

.hero-copy .typed-cursor {
  display: inline;
  width: auto;
  height: auto;
  font-weight: 300;
  color: var(--highlight) !important;
  background: none !important;
  opacity: 1;
  animation: typedBlink 0.9s step-end infinite;
}

@keyframes typedBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@media (max-width: 991px) {
  .hero {
    min-height: auto;
    padding: calc(var(--nav-h) + 1.25rem) 0 2.5rem;
  }

  .hero-layout {
    gap: 2rem;
  }

  /* Content before visual on mobile */
  .hero-copy {
    order: 1;
  }

  .hero-visual {
    order: 2;
    max-width: min(300px, 88vw);
    margin-top: 0.5rem;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
  }

  .stat-value {
    font-size: clamp(1.25rem, 4.5vw, 1.65rem);
  }

  .stat-label {
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .hero-actions {
    margin-top: 1.5rem;
  }

  .btn-lg {
    padding: 0.9rem 1.35rem;
    font-size: 0.92rem;
    white-space: normal;
    text-align: center;
  }
}

@media (max-width: 575px) {
  .hero-visual {
    max-width: min(260px, 92vw);
  }

  .float-chip {
    display: none;
  }

  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-stats .stat:nth-child(5) {
    grid-column: 1 / -1;
    max-width: 50%;
    margin-inline: auto;
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Layout containers
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
  .container,
  .container-wide {
    width: min(100% - 2rem, var(--container));
  }

  .section {
    padding: clamp(3.25rem, 8vw, 5rem) 0;
  }

  .split {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .split-visual {
    min-height: 280px;
  }

  .split-visual-inner {
    padding: 1.5rem;
  }

  .values-grid {
    grid-template-columns: 1fr;
  }

  .why-list {
    grid-template-columns: 1fr;
  }

  .process-track {
    grid-template-columns: 1fr;
  }

  .tech-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.75rem;
  }

  .tech-item {
    padding: 0.85rem 0.5rem;
  }

  .tech-item i {
    font-size: 1.5rem;
  }

  .tech-item span {
    font-size: 0.72rem;
  }
}

@media (max-width: 575px) {
  .container,
  .container-wide {
    width: min(100% - 1.25rem, var(--container));
  }

  .card {
    padding: 1.35rem;
  }

  .card-icon {
    width: 46px;
    height: 46px;
    font-size: 1.1rem;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    gap: 1rem;
  }
}

/* --------------------------------------------------------------------------
   Page hero (inner pages)
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
  .page-hero {
    padding: calc(var(--nav-h) + 2rem) 0 2.5rem;
    text-align: center;
  }

  .page-hero .lead {
    margin-inline: auto;
  }

  .breadcrumb {
    flex-wrap: wrap;
    justify-content: center;
    font-size: 0.8rem;
  }
}

/* --------------------------------------------------------------------------
   Buttons & CTAs
   -------------------------------------------------------------------------- */
@media (max-width: 575px) {
  .btn {
    white-space: normal;
    text-align: center;
  }

  .btn-group {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .btn-group .btn {
    width: 100%;
    justify-content: center;
  }

  .cta-banner {
    padding: 2rem 1.25rem;
    border-radius: var(--radius-lg);
  }

  .cta-banner .h2 {
    font-size: clamp(1.35rem, 5.5vw, 1.85rem);
  }
}

/* --------------------------------------------------------------------------
   Portfolio, blog, careers, contact
   -------------------------------------------------------------------------- */
@media (max-width: 575px) {
  .portfolio-filters {
    gap: 0.4rem;
  }

  .filter-btn {
    font-size: 0.78rem;
    padding: 0.5rem 0.85rem;
  }

  .portfolio-card {
    min-height: auto;
  }

  .portfolio-thumb {
    height: 140px;
  }

  .blog-thumb {
    height: 150px;
  }

  .job-card {
    flex-direction: column;
    align-items: stretch;
    padding: 1.25rem;
  }

  .job-card .btn {
    width: 100%;
    justify-content: center;
  }

  .form-card {
    padding: 1.25rem;
  }

  .contact-info-item .icon {
    width: 42px;
    height: 42px;
  }

  .map-embed {
    height: 220px;
  }

  .testimonial-card {
    padding: 1.5rem;
  }

  .testimonial-quote {
    font-size: 1rem;
  }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
  .footer {
    padding: 3rem 0 1.5rem;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 575px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

  .newsletter-form {
    flex-direction: column;
  }

  .newsletter-form .btn {
    width: 100%;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .footer-bottom-links {
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
  }

  .back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
  }
}

/* --------------------------------------------------------------------------
   Legal / prose
   -------------------------------------------------------------------------- */
@media (max-width: 575px) {
  .content-prose {
    padding: 0 0.25rem;
  }

  .content-prose h2 {
    font-size: 1.25rem;
  }
}

/* --------------------------------------------------------------------------
   Swiper / misc
   -------------------------------------------------------------------------- */
@media (max-width: 575px) {
  .swiper-testimonials {
    padding-bottom: 2.5rem !important;
  }

  .marquee-item {
    font-size: 0.85rem;
    gap: 0.45rem;
  }
}
