/* ELUN — Reorganização mobile (≤1023px) */

@media (max-width: 1023px) {
  :root {
    --logo-height: 36px;
    --logo-height-scrolled: 30px;
  }

  /* ─── Header: logo horizontal, sem offset vertical ─── */
  .nav:not(.scrolled) .nav-logo,
  .home-page .nav:not(.scrolled) .nav-logo {
    transform: none;
  }

  body.insights-page .nav {
    overflow: hidden;
  }

  body.insights-page .nav:not(.scrolled) .nav-logo {
    display: block;
    transform: none;
    overflow: hidden;
  }

  body.insights-page .nav:not(.scrolled) .nav-logo-img--light {
    height: var(--logo-height);
    width: auto;
    transform: none;
  }

  body.insights-page .nav.scrolled .nav-logo-img--dark {
    height: var(--logo-height-scrolled);
    width: auto;
  }

  .nav-toggle {
    min-width: var(--touch-min);
    min-height: var(--touch-min);
    margin-right: -0.375rem;
  }

  /* ─── Menu mobile: grade 2 colunas + CTA full width ─── */
  .mobile-menu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem 1rem;
    align-content: start;
    justify-items: stretch;
    padding:
      calc(var(--safe-top) + var(--nav-height) + 1rem)
      max(1rem, var(--page-gutter))
      calc(1.25rem + var(--safe-bottom));
  }

  .mobile-menu a:not(.btn) {
    width: 100%;
    justify-content: flex-start;
    font-size: 0.9375rem;
    padding: 0.75rem 0.875rem;
    border-radius: 2px;
    transition: background 0.2s var(--ease);
  }

  .mobile-menu a:not(.btn):active {
    background: rgba(255, 255, 255, 0.07);
  }

  .mobile-menu .btn-primary {
    grid-column: 1 / -1;
    margin-top: 0.875rem;
    width: 100%;
    max-width: none;
    justify-content: center;
  }

  /* ─── Heróis editoriais ─── */
  .insights-hero,
  .artigos-hero,
  .aplicacoes-hero,
  .lorawan-hero,
  .aiot-hero {
    padding: calc(var(--nav-height) + var(--safe-top) + 1.5rem) 0 2rem;
  }

  .insights-hero h1,
  .artigos-hero h1,
  .aplicacoes-hero h1,
  .lorawan-hero h1,
  .aiot-hero h1 {
    font-size: clamp(1.625rem, 5.5vw, 2.25rem);
  }

  .insights-hero-lead,
  .artigos-hero-lead,
  .aplicacoes-hero-lead,
  .lorawan-hero-lead,
  .aiot-hero-lead {
    font-size: 0.9375rem;
  }

  /* ─── Filtros: cabem na largura da tela ─── */
  .insights-toolbar {
    overflow: hidden;
    max-width: 100%;
  }

  .insights-toolbar .container {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    min-width: 0;
    max-width: 100%;
  }

  .insights-toolbar .container::-webkit-scrollbar {
    display: none;
  }

  .insights-filters {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 0.375rem;
    padding-bottom: 0.125rem;
  }

  .insights-filter {
    flex: 0 1 auto;
    max-width: 100%;
    min-height: 32px;
    padding: 0.3125rem 0.625rem;
    font-size: 0.6875rem;
    letter-spacing: 0.03em;
  }

  .insights-layout {
    padding-top: 0.75rem;
    gap: 1.5rem;
  }

  .insights-featured-card,
  .insight-card {
    padding: 1.25rem;
  }

  .insights-articles {
    gap: 2rem;
  }

  .insight-article {
    padding: 1.25rem;
    scroll-margin-top: calc(var(--nav-height-scrolled) + var(--safe-top) + 4rem);
  }

  /* ─── Artigo longo ─── */
  .artigo-layout {
    padding-top: 1.25rem;
    padding-bottom: 2.5rem;
    gap: 1.25rem;
  }

  .artigo-single-hero {
    padding: calc(var(--nav-height) + var(--safe-top) + 1.25rem) 0 1.75rem;
  }

  .artigo-single-hero h1 {
    font-size: clamp(1.5rem, 5.5vw, 2rem);
  }

  .artigo-toc {
    order: -1;
  }

  .artigo-content h2 {
    font-size: 1.25rem;
    scroll-margin-top: calc(var(--nav-height-scrolled) + var(--safe-top) + 0.75rem);
  }
}

/* ─── Telefones (≤767px) ─── */
@media (max-width: 767px) {
  :root {
    --section-py: 2.75rem;
    --page-gutter: 1rem;
    --hero-col-gap: 1.25rem;
    --logo-height: 32px;
    --logo-height-scrolled: 28px;
  }

  body.home-page {
    --section-py: 2.25rem;
  }

  body.home-page .about-visual {
    margin-top: -0.5rem;
  }

  /* Hero home */
  .hero {
    min-height: auto;
  }

  .hero-inner {
    padding-top: calc(var(--nav-height) + var(--safe-top) + 1.25rem);
    padding-bottom: 2rem;
    padding-left: var(--page-gutter);
    padding-right: var(--page-gutter);
  }

  .hero-headline {
    font-size: clamp(1.625rem, 7vw, 2.125rem);
    margin-bottom: 0.875rem;
  }

  .hero-subheadline {
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
    line-height: 1.55;
  }

  .hero-form {
    padding: 1.125rem;
  }

  .hero-form-header h2 {
    font-size: 1.0625rem;
  }

  /* Seções home */
  .section-title {
    font-size: clamp(1.5rem, 6.5vw, 2rem);
  }

  .section-subtitle {
    font-size: 0.9375rem;
    margin-top: 0.875rem;
  }

  .hub-header,
  .services-header,
  .cases-header,
  .methodology-header {
    margin-bottom: 1.5rem;
  }

  .hub-lead {
    font-size: 0.9375rem;
  }

  .hub-card {
    min-height: 188px;
    padding: 1.25rem;
  }

  .hub-card-title {
    font-size: 1.25rem;
  }

  .hub-card-desc {
    font-size: 0.8125rem;
  }

  .hub-grid {
    gap: 0.75rem;
  }

  .about-grid {
    gap: 1.5rem;
  }

  .about-visual {
    aspect-ratio: 4 / 3;
    order: -1;
  }

  .about-content p {
    font-size: 0.9375rem;
    margin-bottom: 1rem;
  }

  .about-highlight {
    margin-top: 1.25rem;
    padding-left: 1rem;
  }

  .about-highlight p {
    font-size: 1rem;
  }

  .service-card,
  .case-body {
    padding: 1.25rem;
  }

  .case-body h3 {
    font-size: 1rem;
  }

  .method-step {
    column-gap: 0.875rem;
  }

  .step-number {
    width: 40px;
    height: 40px;
    font-size: 0.875rem;
  }

  .faq-question {
    padding: 1rem 1.125rem;
    font-size: 0.875rem;
  }

  .faq-answer-inner {
    padding: 0 1.125rem 1rem;
    font-size: 0.8125rem;
  }

  /* Stats */
  .stats-grid {
    gap: 0.625rem;
  }

  .stat-item {
    padding: 1rem 0.75rem;
  }

  .stat-number {
    font-size: clamp(1.75rem, 8vw, 2.25rem);
  }

  /* Social proof */
  .social-proof {
    padding: 2rem 0;
  }

  .logo-item {
    width: 120px;
    height: 48px;
    padding: 0.375rem 0.75rem;
  }

  .logo-track {
    gap: 2.5rem;
  }

  /* Footer */
  .footer {
    padding: 2.25rem 0 calc(1.25rem + var(--safe-bottom));
  }

  .footer-grid {
    gap: 1.5rem;
  }

  .footer-brand img {
    height: 40px;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    text-align: left;
  }

  /* Flutuantes */
  .whatsapp-floater {
    right: max(1rem, var(--page-gutter));
    bottom: calc(1rem + var(--safe-bottom));
    width: 3.25rem;
    height: 3.25rem;
  }

  .section-nav {
    display: none !important;
  }

  /* Tags editoriais */
  .artigos-pain-tags,
  .aiot-hero-badges {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.25rem;
  }

  .artigos-pain-tags::-webkit-scrollbar,
  .aiot-hero-badges::-webkit-scrollbar {
    display: none;
  }

  .artigos-pain-tag,
  .aiot-badge {
    flex-shrink: 0;
  }

  .aiot-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.625rem;
  }

  .vision-inner {
    gap: 1.5rem;
  }

  .vision-visual {
    order: -1;
  }

  .insights-cta .btn,
  .cta-final .btn {
    width: 100%;
    max-width: 320px;
  }
}

@media (max-width: 479px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-menu {
    grid-template-columns: 1fr;
  }
}

/* ─── Super otimização mobile ─── */
@media (max-width: 1023px) {
  :root {
    --nav-height: 52px;
    --nav-height-scrolled: 48px;
    --section-py: 2.5rem;
    --touch-min: 48px;
  }

  main > section:not(.hero) {
    content-visibility: auto;
    contain-intrinsic-size: auto 480px;
  }

  .hero {
    content-visibility: visible;
    --page-gutter: 1.25rem;
  }

  .nav-logo {
    margin-left: -0.25rem;
  }

  .services-header-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .services-header-copy {
    gap: 0.25rem;
  }

  .services-header-visual img {
    aspect-ratio: 16 / 9;
    max-height: 200px;
    object-fit: cover;
  }

  .services-header,
  .cases-header,
  .hub-header,
  .methodology-header {
    margin-bottom: 1.25rem;
  }

  .reveal,
  .reveal.reveal-from-left,
  .reveal.reveal-from-right {
    transform: translate3d(0, 0.875rem, 0);
    transition-duration: 0.5s;
  }

  .reveal.reveal-from-left {
    transform: translate3d(-0.5rem, 0.875rem, 0);
  }

  .reveal.reveal-from-right {
    transform: translate3d(0.5rem, 0.875rem, 0);
  }

  .reveal.visible {
    will-change: auto;
  }

  .case-body .btn,
  .hero-actions .btn,
  .hero-form-submit {
    min-height: var(--touch-min);
  }
}

@media (max-width: 767px) {
  :root {
    --nav-height: 48px;
    --nav-height-scrolled: 44px;
    --section-py: 2rem;
    --page-gutter: 0.875rem;
    --hero-col-gap: 1rem;
    --logo-height: 30px;
    --logo-height-scrolled: 26px;
  }

  body.home-page {
    --section-py: 1.75rem;
  }

  .hero {
    --page-gutter: 1.5rem;
  }

  .hero-inner {
    padding-top: calc(var(--nav-height) + var(--safe-top) + 0.875rem);
    padding-bottom: 1.75rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .hero-overlay {
    background: linear-gradient(
      180deg,
      rgba(10, 10, 10, 0.94) 0%,
      rgba(10, 10, 10, 0.82) 42%,
      rgba(10, 10, 10, 0.94) 100%
    );
  }

  .hero-scroll {
    display: none;
  }

  .hero-headline {
    font-size: clamp(1.5rem, 6.8vw, 2rem);
    line-height: 1.12;
    margin-bottom: 0.625rem;
  }

  .hero-subheadline {
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1rem;
  }

  .hero-form {
    padding: 1rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .hero-form-grid {
    gap: 0.625rem;
    margin-bottom: 0.75rem;
  }

  .hero-form-header p {
    margin-bottom: 0.875rem;
    font-size: 0.8125rem;
  }

  .hero-field input {
    font-size: 16px;
    padding: 0.75rem 0.875rem;
  }

  .section-label {
    font-size: 0.625rem;
    margin-bottom: 0.5rem;
  }

  .section-title {
    font-size: clamp(1.375rem, 6vw, 1.75rem);
    line-height: 1.15;
  }

  .section-subtitle {
    font-size: 0.875rem;
    line-height: 1.55;
    margin-top: 0.5rem;
  }

  .hub-grid {
    grid-template-columns: 1fr !important;
    gap: 0.625rem;
  }

  .hub-card,
  .hub-card--cases,
  .hub-card--trends {
    grid-column: 1 !important;
    min-height: 156px;
    padding: 1rem;
  }

  .hub-card-title {
    font-size: 1.125rem;
  }

  .hub-card-desc {
    font-size: 0.75rem;
    line-height: 1.45;
  }

  .about-grid {
    gap: 1.125rem;
  }

  .about-visual {
    aspect-ratio: 3 / 4;
    max-height: 420px;
  }

  .about-content p {
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 0.875rem;
  }

  .about-highlight {
    margin-top: 1rem;
    padding-left: 0.875rem;
  }

  .about-highlight p {
    font-size: 0.9375rem;
  }

  .services-header-copy .section-subtitle {
    margin-top: 0;
  }

  .service-card {
    padding: 1.125rem;
  }

  .service-number {
    margin-bottom: 0.625rem;
    font-size: 0.625rem;
  }

  .service-title {
    font-size: 1rem;
    margin-bottom: 0.625rem;
  }

  .service-desc {
    font-size: 0.8125rem;
    line-height: 1.55;
    margin-bottom: 0.875rem;
  }

  .service-tag,
  .case-tech span {
    font-size: 0.625rem;
    padding: 0.25rem 0.5rem;
  }

  .cases-grid {
    gap: 0.875rem;
  }

  .case-image {
    aspect-ratio: 16 / 9;
  }

  .case-body {
    padding: 1.125rem;
  }

  .case-body h3 {
    font-size: 0.9375rem;
    line-height: 1.35;
  }

  .case-copy {
    font-size: 0.8125rem;
    line-height: 1.55;
  }

  .case-results {
    gap: 0.375rem;
    margin: 0.75rem 0 1rem;
  }

  .case-result-tag {
    font-size: 0.625rem;
    padding: 0.3125rem 0.5rem;
    line-height: 1.35;
  }

  .case-body .btn {
    width: 100%;
    justify-content: center;
  }

  .methodology-steps {
    gap: 1.125rem;
  }

  .methodology-steps::before {
    display: none;
  }

  .method-step {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 0.75rem;
  }

  .methodology-article-inner {
    padding: 1.125rem;
  }

  .methodology-article h3 {
    font-size: 1.0625rem;
  }

  .methodology-article p,
  .methodology-article-list li {
    font-size: 0.8125rem;
    line-height: 1.55;
  }

  .social-proof {
    padding: 1.75rem 0;
  }

  .social-proof-header {
    margin-bottom: 1.25rem;
  }

  .social-proof-text {
    font-size: 0.8125rem;
    line-height: 1.55;
  }

  .stats-grid {
    gap: 0.5rem;
  }

  .stat-item {
    padding: 0.875rem 0.625rem;
  }

  .stat-number {
    font-size: clamp(1.5rem, 7vw, 2rem);
  }

  .stat-label {
    font-size: 0.6875rem;
    line-height: 1.35;
  }

  .cta-final {
    padding: 2.5rem 0;
  }

  .cta-final-inner {
    gap: 1rem;
  }

  .cta-final p {
    font-size: 0.875rem;
  }

  .cta-final .btn {
    width: 100%;
    max-width: none;
  }

  .footer {
    padding: 2rem 0 calc(1rem + var(--safe-bottom));
  }

  .footer-col a,
  .footer-keywords a {
    font-size: 0.8125rem;
    line-height: 1.5;
  }

  .btn {
    min-height: var(--touch-min);
    padding: 0.75rem 1.125rem;
    font-size: 0.9375rem;
  }

  .mobile-menu {
    padding:
      calc(var(--safe-top) + var(--nav-height) + 0.75rem)
      max(0.875rem, var(--page-gutter))
      calc(1rem + var(--safe-bottom));
    gap: 0.375rem 0.75rem;
  }

  .mobile-menu a:not(.btn) {
    font-size: 0.875rem;
    padding: 0.6875rem 0.75rem;
    min-height: var(--touch-min);
  }

  .whatsapp-floater {
    width: 3rem;
    height: 3rem;
    right: max(0.875rem, var(--page-gutter));
    bottom: calc(0.875rem + var(--safe-bottom));
  }
}

@media (max-width: 374px) {
  :root {
    --page-gutter: 0.75rem;
  }

  .hero {
    --page-gutter: 1.25rem;
  }

  .hero-headline {
    font-size: 1.375rem;
  }

  .mobile-menu {
    gap: 0.25rem;
  }

  .stat-label {
    font-size: 0.625rem;
  }
}
