/* =============================================================================
   Global responsive layer — mobile, tablet, small desktop
   Load LAST so these rules win over section styles where needed.
   ============================================================================= */

/* Prevent horizontal bleed; keep vertical scroll natural */
html {
  overflow-x: clip;
  scroll-padding-top: 5.5rem;
}

body {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.nav-open {
  overflow: hidden;
}

/* ----- Header & nav: tablet + phone — hamburger + full-screen overlay ----- */
@media (max-width: 1024px) {
  .header-menu-btn {
    display: inline-flex;
  }

  .header {
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 0.75rem;
    padding-top: 0.95rem;
    padding-bottom: 0.95rem;
    padding-left: calc(1.15rem + env(safe-area-inset-left, 0px));
    padding-right: calc(1.15rem + env(safe-area-inset-right, 0px));
  }

  .logo {
    font-size: clamp(1rem, 3.5vw, 1.25rem);
    flex-shrink: 0;
    min-width: 0;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    position: relative;
    z-index: 102;
  }

  .header-menu-btn {
    position: relative;
    z-index: 102;
  }

  /* Full-screen menu — replaces cramped horizontal strip on tablet/phone */
  .nav {
    position: fixed;
    inset: 0;
    z-index: 101;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    flex: none !important;
    width: 100%;
    min-width: 0;
    margin: 0 !important;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    padding: calc(4.75rem + env(safe-area-inset-top, 0px)) clamp(1.25rem, 4vw, 1.75rem) calc(1.5rem + env(safe-area-inset-bottom, 0px));
    gap: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(23, 23, 23, 0.97);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.3s ease,
      visibility 0.3s ease;
  }

  .header--nav-open .nav {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .header--nav-open {
    background: rgba(23, 23, 23, 0.94) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
  }

  .header--nav-open .logo,
  .header--nav-open .header-menu-btn {
    color: #ffffff !important;
  }

  .nav a {
    flex-shrink: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-align: left;
    padding: 1.05rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff !important;
  }

  .nav a:hover,
  .nav a:focus-visible {
    color: rgba(255, 255, 255, 0.72) !important;
  }

  .nav a .nav-projects-count {
    color: rgba(255, 255, 255, 0.88) !important;
  }

  .nav a.nav-reels {
    font-size: 0.875rem !important;
    letter-spacing: 0.06em !important;
  }

  .nav a:last-child {
    border-bottom: none;
  }
}

@media (max-width: 1024px) and (prefers-reduced-motion: reduce) {
  .nav {
    transition: none;
  }
}

/* ----- Hero (homepage): Framer corner layout ----- */
@media (max-width: 768px) {
  .hero {
    overflow-x: clip;
  }
}

/* ----- News article: comfortable offset under fixed header ----- */
@media (max-width: 768px) {
  .news-article-page main {
    padding-top: clamp(4.25rem, 14vw, 5.25rem);
  }
}

@media (max-width: 480px) {
  .news-article__header {
    padding-top: clamp(3.5rem, 12vw, 5rem);
  }

  .news-article__title {
    --article-title-size: clamp(1.65rem, 7vw, 2.35rem);
  }
}

/* =============================================================================
   Mobile layout hardening — prevent overflow, stack grids, fix hero overlap
   ============================================================================= */

@media (max-width: 768px) {
  img,
  video,
  picture,
  svg {
    max-width: 100%;
    height: auto;
  }

  .hero-content.hero-framer {
    min-height: calc(100svh - 4.7rem);
    height: auto;
    max-height: none;
  }

  .trusted-section,
  .about-showreel,
  .process-section,
  .services-section,
  .plans-section,
  .clients-section,
  .faq-section,
  .projects-section,
  .insights-section,
  .contact-section,
  .news-section,
  .svc-main,
  .svc-work-hero,
  .svc-work-sites,
  .svc-work-grid,
  .svc-menu,
  .footer {
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .framer-live {
    max-width: 100%;
    min-width: 0;
  }

  .projects-grid,
  .news-content,
  .news-page-grid,
  .news-col-stack,
  .project-card,
  .news-card,
  .trusted-container,
  .plans-grid,
  .svc-rows__list,
  .svc-work-sites__grid,
  .about-showreel__steps {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .svc-row,
  .svc-site-card,
  .about-step,
  .framer-live__canvas,
  .framer-rail {
    min-width: 0;
    max-width: 100%;
  }

  .project-card__frame,
  .project-card__media,
  .news-card-media,
  .news-card-img-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .footer-marquee {
    overflow-x: clip;
  }

  table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  html.imtheo-protected body {
    -webkit-user-select: auto;
    user-select: auto;
  }

  html.imtheo-protected [data-protect-media],
  html.imtheo-protected [data-protect-media] * {
    -webkit-user-select: none;
    user-select: none;
  }
}

@media (max-width: 480px) {
  .hero-content.hero-framer {
    min-height: calc(100svh - 4.5rem);
  }

  .project-card__title,
  .news-card-title {
    font-size: clamp(1.05rem, 5vw, 1.35rem);
  }
}
