/* Mobile and tablet behavior for the GroMatrix theme */
@media (max-width: 980px) {
  body,
  .services-page {
    overflow-x: hidden;
  }

  .hw-section,
  .hw-timeline,
  .hw-timeline-item {
    max-width: 100%;
    overflow-x: hidden;
  }

  .navbar {
    height: 72px;
    padding: 0 12px;
  }

  .navbar-inner {
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    padding: 0 12px;
  }

  .nav-menu,
  .nav-call {
    display: none !important;
  }

  .nav-right {
    justify-self: end;
  }

  .nav-toggle {
    display: flex !important;
  }

  .mobile-menu {
    top: 0;
    padding-top: 86px;
  }

  .mobile-menu-inner {
    width: min(520px, calc(100% - 32px));
  }

  .mobile-links {
    gap: 10px;
  }

  .mobile-links ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .mobile-links .mobile-menu-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .mobile-links .mobile-menu-list > li {
    list-style: none;
  }

  .mobile-links .mobile-menu-list > li > a {
    display: block;
    font-family: "Poppins", sans-serif;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-0);
    text-decoration: none;
    padding: 10px 0;
  }

  .mobile-links .mobile-menu-list > .current-menu-item > a,
  .mobile-links .mobile-menu-list > .current_page_item > a,
  .mobile-links .mobile-menu-list > .current_page_parent > a,
  .mobile-links .mobile-menu-list > .current_page_ancestor > a,
  .mobile-links .mobile-menu-list > .current-menu-ancestor > a,
  .mobile-links .mobile-menu-list > .current-menu-parent > a {
    color: var(--accent);
  }

  .mobile-links a {
    font-size: 20px;
    line-height: 1.2;
    padding: 10px 0;
  }

  .services-hero {
    min-height: auto;
    padding-top: clamp(120px, 24vw, 170px);
    padding-bottom: 68px;
  }

  /* Keep first section locked to one viewport on mobile/tablet pages. */
  .services-page > section.services-hero:first-child {
    height: 100vh;
    height: 100dvh;
    min-height: 100svh;
    box-sizing: border-box;
  }

  .hero-inner {
    max-width: 100%;
  }

  .pillars-panels,
  .why-list,
  .faq-list {
    grid-template-columns: 1fr;
  }

  .hw-timeline {
    gap: 16px;
  }

  .hw-timeline::before {
    left: 24px;
  }

  .hw-timeline-item {
    grid-template-columns: 48px 1fr;
    align-items: start;
  }

  .hw-timeline-item .hw-spacer {
    display: none;
  }

  .hw-timeline-item.left .hw-content,
  .hw-timeline-item.right .hw-content {
    grid-column: 2;
    max-width: 100%;
  }

  .hw-timeline-item .hw-dot {
    grid-column: 1;
    justify-self: center;
  }

  .blog-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-row {
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
  }

  /* Fail-safe only when reveal JS is not active */
  body:not(.gm-reveal-ready) .blog-hero .hero-inner {
    opacity: 1 !important;
    transform: none !important;
  }

  body:not(.gm-reveal-ready) .blog-listing .blog-card {
    opacity: 1 !important;
    transform: none !important;
  }

  body:not(.gm-reveal-ready) .services-list .service-block .reveal,
  body:not(.gm-reveal-ready) .services-list .service-block .reveal-list li {
    opacity: 1 !important;
    transform: none !important;
  }
}

@media (max-width: 700px) {
  .navbar {
    height: 64px;
  }

  .services-hero {
    padding-top: 110px;
    padding-bottom: 56px;
  }

  .services-page > section.services-hero:first-child {
    height: 100vh;
    height: 100dvh;
    min-height: 100svh;
    box-sizing: border-box;
  }

  .services-hero h1 {
    font-size: clamp(34px, 9vw, 48px);
  }

  /* First-hero rotating word: align to line start on mobile */
  .services-page > section.services-hero:first-child h1 .hero-rotate,
  .services-page > section.services-hero:first-child h2 .hero-rotate {
    display: block;
    margin-left: 0;
    min-width: 0;
  }

  /* Home page: align swapping word under "Business" in mobile */
  .home .services-hero h1 .hero-rotate,
  .home .services-hero h2 .hero-rotate {
    display: block;
    margin-left: 0;
    min-width: 0;
  }

  /* About page: align swapping word under "grow with" in mobile */
  .page-about .services-hero h1 .hero-rotate,
  .page-about .services-hero h2 .hero-rotate,
  .page-template-page-about .services-hero h1 .hero-rotate,
  .page-template-page-about .services-hero h2 .hero-rotate {
    display: block;
    margin-left: 0;
    min-width: 0;
  }

  .services-hero p {
    font-size: 16px;
  }

  .blog-list {
    grid-template-columns: 1fr;
  }

  /* About page: keep Mission and Vision aligned on the same left edge */
  .mission-vision-block:first-child,
  .mission-vision-block:last-child {
    padding-right: 0;
    padding-left: 0;
  }

  /* About page: What We Believe cards */
  .beliefs-grid {
    gap: 20px;
    justify-items: center;
  }

  .belief-card {
    padding: 36px 26px 32px;
    min-height: 0;
    gap: 12px;
    --fold: 40px;
    width: min(100%, 280px);
  }

  .belief-card:nth-child(1),
  .belief-card:nth-child(2),
  .belief-card:nth-child(3),
  .belief-card:nth-child(4) {
    min-height: 0;
  }

  .belief-title {
    font-size: clamp(22px, 6vw, 26px);
  }

  .belief-desc {
    font-size: 17px;
    line-height: 1.7;
  }

  .belief-icon {
    width: 114px;
    height: 114px;
  }
}

/* How We Work: enforce natural height and page-level scrolling */
.hw-section--auto,
.hw-section--auto .hw-timeline--auto,
.hw-section--auto .hw-timeline-item,
.hw-section--auto .hw-content {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  overflow-y: visible !important;
}

/* First viewport consistency across all pages (mobile/tablet) */
@media (max-width: 980px) {
  .services-page > section.services-hero:first-child {
    position: relative;
    isolation: isolate;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100svh !important;
    box-sizing: border-box;
    padding: clamp(104px, 20vh, 146px) 7vw clamp(48px, 10vh, 86px) !important;
    overflow: hidden !important;
  }

  .services-page > section.services-hero:first-child::before {
    content: "";
    position: absolute;
    inset: -10%;
    background:
      radial-gradient(720px 420px at 16% 20%, rgba(5, 175, 161, 0.20), transparent 66%),
      radial-gradient(680px 420px at 84% 78%, rgba(15, 23, 42, 0.10), transparent 70%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 251, 249, 0.92));
    filter: blur(24px);
    transform: scale(1.08);
    z-index: 0;
    pointer-events: none;
  }

  .services-page > section.services-hero:first-child::after {
    z-index: 1;
  }

  .services-page > section.services-hero:first-child > * {
    position: relative;
    z-index: 2;
  }

  .services-page > section.services-hero:first-child .hero-inner {
    margin-top: clamp(24px, 4vh, 48px) !important;
  }

  .home .services-page > section.services-hero:first-child {
    padding-top: clamp(48px, 9vh, 70px) !important;
    padding-bottom: clamp(24px, 5vh, 40px) !important;
  }

  .home .services-page > section.services-hero:first-child h2 {
    margin: 0;
    font-size: clamp(30px, 8vw, 46px);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: var(--text-0);
  }

  .home .services-page > section.services-hero:first-child .hero-desc {
    margin: 0;
    max-width: 1120px;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.65;
    color: var(--text-1);
  }

  .home .services-page > section.services-hero:first-child h1,
  .home .services-page > section.services-hero:first-child .hero-sub,
  .home .services-page > section.services-hero:first-child .hero-cta {
    margin: 0;
  }

  .home .services-page > section.services-hero:first-child .hero-sub {
    line-height: 1.7;
  }

  /* Home page only: tighten vertical stack so CTA stays inside first viewport */
  .home .services-page > section.services-hero:first-child .hero-inner {
    margin-top: 0 !important;
    gap: clamp(8px, 1.4vh, 14px) !important;
  }
}
