/* =============================================================================
   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 (no hamburger) ----- */
@media (max-width: 1024px) and (min-width: 769px) {
  .header {
    align-items: center;
    padding-top: 1.15rem;
    padding-bottom: 1.15rem;
    padding-left: calc(1.5rem + env(safe-area-inset-left, 0px));
    padding-right: calc(1.5rem + env(safe-area-inset-right, 0px));
    gap: 0.75rem;
  }

  .logo {
    font-size: clamp(1.05rem, 3.5vw, 1.3rem);
    flex-shrink: 0;
    min-width: 0;
    white-space: nowrap;
  }

  .nav {
    margin-left: 1rem !important;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    row-gap: 0.4rem;
    gap: 0.45rem 0.85rem;
  }

  .nav a {
    font-size: clamp(0.65rem, 1.8vw, 0.78rem);
    padding: 0.35rem 0.15rem;
  }
}

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

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

  .logo {
    font-size: clamp(1rem, 4.2vw, 1.2rem);
    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 spaced-out horizontal strip */
  .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: 768px) and (prefers-reduced-motion: reduce) {
  .nav {
    transition: none;
  }
}

/* ----- Hero (homepage): tighten small phones ----- */
@media (max-width: 768px) {
  /* imTHEO: desktop uses clamp(32rem, 78vw, …) — on narrow viewports the 32rem floor clips the mark.
     Restore mobile-only sizing + stack so it stays visible above grain/noise. */
  .hero-bg-text {
    font-size: min(
      clamp(16vmin, min(47vw, 97.5vmin), 98vmin),
      calc((100vw - 3rem) / 2.68)
    );
    line-height: 1.05;
    white-space: nowrap;
    z-index: 2;
    overflow: visible;
  }

  .hero-grid,
  .hero-noise {
    z-index: 1;
  }

  .hero-content {
    z-index: 3;
  }

  .hero-services-list li {
    font-size: clamp(0.72rem, 2.8vw, 0.95rem);
  }

  .hero-description {
    font-size: clamp(0.85rem, 3.2vw, 1.05rem);
  }
}

@media (max-width: 480px) {
  .hero-heading {
    font-size: clamp(1.85rem, 9vw, 2.75rem);
  }
}

/* ----- 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);
  }
}
