/* ═══════════════════════════════════════════════════════
   Mobile / Tablet Responsive Patch — appended LAST
   No existing rule above is modified. Desktop render
   stays byte-identical.
   ═══════════════════════════════════════════════════════ */

/* ─── Tablet (≤ 1024px) ─────────────────────────────── */
@media (max-width: 1024px) {
  body { font-size: 15px; }
  .section { padding: 80px 0; }
  .container { padding: 0 20px; }

  /* category cards */
  .category-card { padding: 16px 20px; }
  .categories__grid { gap: 10px; }

  /* contact inner stacks earlier */
  .contact__inner { gap: 48px; }

  /* safety for any fixed-width hero children */
  .hero__title { line-height: 1.1; }
}

/* ─── Mobile (≤ 768px) ──────────────────────────────── */
@media (max-width: 768px) {
  :root { --nav-h: 60px; }

  body { font-size: 14.5px; }
  .container { padding: 0 16px; }
  .section { padding: 56px 0; }

  /* NAVBAR */
  .navbar__inner { gap: 12px; }
  .navbar__logo .logo-text { font-size: 1.05rem; }
  .logo-icon { width: 32px; height: 32px; font-size: 0.9rem; }
  .navbar__links { display: none; }
  .navbar__links.mobile-open { display: flex; }
  .navbar__actions { gap: 6px; }
  .navbar__actions .btn--primary { padding: 9px 14px; font-size: 0.78rem; }
  .btn-icon { width: 36px; height: 36px; }
  .hamburger { display: flex; padding: 6px; }
  .hamburger span { width: 20px; }

  /* search bar */
  .search-bar__inner { padding: 10px 12px; }
  .search-bar__inner input { font-size: 0.95rem; }

  /* HERO */
  .hero { min-height: 92vh; padding-top: var(--nav-h); }
  .hero__content { padding: 56px 12px 36px; }
  .hero__badge { font-size: 0.72rem; padding: 5px 12px; margin-bottom: 18px; }
  .hero__title { font-size: clamp(1.9rem, 8vw, 2.8rem); margin-bottom: 16px; }
  .hero__subtitle { font-size: 0.95rem; margin-bottom: 28px; }
  .hero__cta { gap: 10px; margin-bottom: 36px; }
  .hero__cta .btn { padding: 12px 20px; font-size: 0.88rem; }
  .hero__stats { padding: 16px 20px; gap: 18px; }
  .hero__stats .stat__number { font-size: 1.5rem; }
  .hero__stats .stat__label { font-size: 0.72rem; }
  .stat__divider { display: none; }
  .hero__scroll { bottom: 22px; }
  .hero__scroll a { width: 36px; height: 36px; }

  /* SECTION HEADERS */
  .section__header { margin-bottom: 36px; }
  .section__title { font-size: clamp(1.4rem, 6vw, 2rem); margin-bottom: 10px; }
  .section__desc { font-size: 0.92rem; padding: 0 8px; }

  /* CATEGORIES */
  .categories__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .category-card { padding: 14px 10px; min-width: 0; width: 100%; gap: 4px; }
  .category-card__icon { width: 40px; height: 40px; font-size: 1.1rem; border-radius: 10px; }
  .category-card span { font-size: 0.75rem; text-align: center; }
  .category-card__count { top: 4px; right: 4px; font-size: 0.65rem; padding: 1px 5px; }

  /* CATALOG TOOLBAR */
  .catalog__toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 20px;
  }
  .catalog__controls {
    width: 100%;
    justify-content: space-between;
  }
  .sort-select { flex: 1; }
  .sort-select select {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.85rem;
  }
  .view-btn { width: 36px; height: 36px; }

  /* CATALOG GRID — single column on mobile for readability */
  .catalog__grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .catalog__grid.list-layout { grid-template-columns: 1fr; }
  .product-card { max-width: 100%; }
  .product-card__img-placeholder { height: 200px; }
  .product-card__body { padding: 16px; }
  .product-card__name { font-size: 0.95rem; }
  .product-card__desc { font-size: 0.82rem; }
  .product-card__footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .product-card__footer > div:last-child {
    flex-direction: column;
    width: 100%;
  }
  .product-card__footer button {
    width: 100%;
    justify-content: center;
  }
  .product-card__price { font-size: 1.15rem; }

  /* PROCESS STEPS — stack vertically */
  .process__steps {
    flex-direction: column;
    align-items: stretch;
  }
  .process__step {
    max-width: 100%;
    min-width: 0;
    padding: 24px 16px;
    background: var(--clr-surface2);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius);
  }
  .process__step .step__icon {
    width: 56px; height: 56px;
    font-size: 1.4rem;
  }
  .process__connector {
    width: 2px; height: 28px;
    background: linear-gradient(180deg, rgba(124,58,237,0.3), rgba(124,58,237,0.6));
    margin: 0 auto;
  }
  .process__connector::after {
    right: -4px; top: auto; bottom: -4px;
    transform: rotate(135deg);
  }

  /* MATERIALS — fix the flex+grid conflict so cards stack */
  .materials__grid {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 14px;
  }
  /* Override the inline `grid-template-columns: repeat(4,1fr)` declared on the
     filamentos sections so they stay readable on phones. Visual look stays. */
  .materials__grid[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .material-card { padding: 0; }
  .material-card h4 {
    font-size: 1rem;
    padding: 16px 16px 0;
  }
  .material-card p {
    font-size: 0.82rem;
    padding: 0 16px 14px;
  }
  .material-card ul { padding: 0 16px 16px; }
  .material-card ul li { font-size: 0.78rem; }
  /* Filamento cards have an inline-styled image; keep size but stop overflow */
  .material-card img {
    max-width: 100% !important;
    max-height: 220px !important;
    width: auto;
    height: auto;
  }
  /* Buttons inside filamento cards: full width tap target */
  .material-card button {
    width: calc(100% - 24px);
    margin-top: 8px;
    margin-bottom: 12px;
  }

  /* subfilamentos header */
  .subfilamentos { text-align: center; margin-bottom: 18px; }
  .subfilamentos h1 {
    font-size: 1.25rem;
    padding: 0 12px;
  }

  /* TESTIMONIALS */
  .testimonials__grid { grid-template-columns: 1fr; gap: 16px; }
  .testimonial-card { padding: 22px; }

  /* CONTACT */
  .contact__inner { grid-template-columns: 1fr; gap: 32px; }
  .contact__info { text-align: left; }
  .contact__info .section__title { text-align: left; }
  .contact__channels { gap: 10px; }
  .contact-channel { padding: 14px 16px; gap: 12px; }
  .contact-channel i { width: 38px; height: 38px; font-size: 1.15rem; }
  .contact-channel strong { font-size: 0.9rem; }
  .contact-channel span { font-size: 0.78rem; }

  .contact__form { padding: 22px 18px; gap: 14px; border-radius: var(--radius); }
  .contact__form h2 { font-size: 1.3rem; margin-bottom: 6px; }
  .form-group { margin-bottom: 12px; }
  .form-group label { font-size: 0.82rem; }
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 12px 14px;
    font-size: 0.92rem;
    border-radius: 10px;
  }
  .form-group textarea { rows: 4; min-height: 100px; }
  #pedidoForm button[type="submit"] { width: 100%; }

  /* FOOTER */
  .footer { padding-top: 48px; }
  .footer__inner {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-bottom: 32px;
    text-align: left;
  }
  .footer__brand p { font-size: 0.85rem; }
  .footer__links h4 { font-size: 0.85rem; margin-bottom: 14px; }
  .footer__links a { font-size: 0.83rem; }
  .footer__bottom { padding: 16px 0; }
  .footer__bottom .container {
    flex-direction: column;
    text-align: center;
    gap: 4px;
  }
  .footer__bottom p { font-size: 0.75rem; }

  /* MODAL */
  .modal { padding: 12px; align-items: flex-end; }
  .modal__content { max-height: 92vh; border-radius: var(--radius) var(--radius) 0 0; }
  .modal__body { padding: 22px 18px; }
  .modal__img {
    max-height: 200px !important;
    margin-bottom: 14px;
    border-radius: 10px;
  }
  .modal__img img { max-height: 200px !important; }
  .modal__close {
    top: 10px; right: 10px;
    width: 32px; height: 32px;
    background: rgba(0,0,0,0.4);
  }
  .modal__title { font-size: 1.25rem; margin-bottom: 10px; }
  .modal__desc { font-size: 0.88rem; line-height: 1.6; }
  .modal__specs { grid-template-columns: 1fr; gap: 8px; margin-bottom: 18px; }
  .spec-item { padding: 10px 12px; }
  .modal__price { font-size: 1.4rem !important; }
  .modal__footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .modal__footer a,
  .modal__footer button {
    flex: 1 1 100% !important;
    width: 100%;
    padding: 12px 14px !important;
    font-size: 0.88rem !important;
  }

  /* FLOATING BUTTONS */
  .whatsapp-float {
    width: 46px; height: 46px;
    font-size: 1.3rem;
    bottom: 76px; right: 16px;
  }
  .back-to-top {
    width: 40px; height: 40px;
    bottom: 18px; right: 16px;
    font-size: 0.9rem;
  }

  /* AOS — disable heavy fade offsets on small screens to avoid layout jumps */
  [data-aos] { transition-duration: 0.4s !important; }
}

/* ─── Small phones (≤ 480px) ────────────────────────── */
@media (max-width: 480px) {
  body { font-size: 14px; }
  .container { padding: 0 14px; }
  .section { padding: 48px 0; }

  /* hero cta full-width buttons for big tap targets */
  .hero__cta { flex-direction: column; width: 100%; }
  .hero__cta .btn { width: 100%; justify-content: center; }

  /* categories 2 columns instead of 3 on tiny screens */
  .categories__grid { grid-template-columns: repeat(2, 1fr); }

  /* make form inputs a bit bigger for thumbs */
  .form-group input,
  .form-group select,
  .form-group textarea { font-size: 16px; /* prevents iOS zoom */ }

  /* smaller hero badge */
  .hero__badge { font-size: 0.68rem; padding: 4px 10px; }

  /* modal footer buttons: stack always */
  .modal__footer { gap: 8px; }
}

/* ─── Ultra-small (≤ 360px) safety ──────────────────── */
@media (max-width: 360px) {
  .hero__title { font-size: 1.6rem; }
  .subfilamentos h1 { font-size: 1.05rem; }
  .modal__title { font-size: 1.1rem; }
  .categories__grid { grid-template-columns: 1fr 1fr; }
  .category-card__icon { width: 36px; height: 36px; }
}

/* ─── Reduced motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .particle { animation: none !important; opacity: 0.3; }
  .hero__scroll a { animation: none !important; }
  .whatsapp-float { animation: none !important; }
}
