/* ============================================
   RESPONSIVE — móvil y tablet
   ============================================ */

/* Evitar scroll horizontal */
html {
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: clip;
}

img,
video,
iframe,
canvas,
svg {
    max-width: 100%;
    height: auto;
}

/* --- Tablet (≤1024px) --- */
@media (max-width: 1024px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .about-grid,
    .contact-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .about-visual {
        min-height: 280px;
    }

    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* --- Móvil (≤768px) --- */
@media (max-width: 768px) {
    body {
        padding-top: 64px;
        font-size: 15px;
    }

    .container,
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Navbar */
    .site-nav {
        height: 64px;
        padding: 0.75rem 1rem;
    }

    .site-nav.is-scrolled {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .brand {
        font-size: 0.78rem;
        letter-spacing: 0.04em;
        line-height: 1.2;
        max-width: calc(100vw - 72px);
        align-items: center;
        gap: 0.55rem;
    }

    .brand-logo-wrap {
        width: 58px;
        height: 58px;
        padding: 6px;
        border-radius: 13px;
    }

    .brand-logo {
        max-height: 44px;
    }

    .footer-logo {
        max-width: 220px;
        max-height: 72px;
    }

    .brand-name {
        font-size: 0.72rem;
    }

    .brand-tagline {
        font-size: 0.52rem;
    }

    .brand-mark {
        font-size: 1.35rem;
        margin-right: 6px;
        flex-shrink: 0;
    }

    /* Navbar + menú móvil sólido (sin transparencia) */
    .site-nav {
        z-index: 1200;
    }

    .site-nav .brand,
    .site-nav .nav-toggle {
        position: relative;
        z-index: 1202;
    }

    .nav-links {
        position: fixed;
        inset: 0;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        margin: 0;
        padding: calc(64px + 2.5rem) 1.5rem 2rem;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2rem;
        background: #040c10;
        background-color: #040c10;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        transform: translateX(100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1201;
        border: none;
        box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
        list-style: none;
    }

    .nav-links:not(.is-open) {
        visibility: hidden;
        pointer-events: none;
    }

    .nav-links.is-open {
        display: flex;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(0);
        background: #040c10;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
    }

    .nav-links a {
        display: block;
        font-size: 1.15rem;
        padding: 14px 20px;
        color: rgba(237, 243, 241, 0.92);
        border-radius: var(--border-radius-md);
    }

    .nav-links a.active,
    .nav-links a:hover {
        color: var(--color-gold);
        background: rgba(8, 116, 167, 0.15);
    }

    .nav-toggle {
        min-width: 44px;
        min-height: 44px;
        align-items: center;
        justify-content: center;
    }

    /* Hero inicio */
    .hero-3d {
        min-height: auto;
        padding: 100px 1rem 72px;
    }

    .hero-grid {
        gap: 1.5rem;
    }

    .hero-title {
        font-size: clamp(1.85rem, 8.5vw, 2.75rem);
    }

    .hero-word {
        white-space: normal;
    }

    .hero-copy {
        font-size: 1rem;
        margin: 1.25rem 0;
    }

    .hero-eyebrow {
        font-size: 0.65rem;
        letter-spacing: 0.14em;
        line-height: 1.5;
    }

    .actions,
    .hero-actions,
    .page-cta-actions,
    .detail-actions {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .actions .btn,
    .hero-actions .btn,
    .page-cta-actions .btn,
    .detail-actions .btn {
        width: 100%;
        justify-content: center;
        padding: 14px 18px;
    }

    /* Visor 3D */
    .viewer-shell {
        min-height: 0;
        border-radius: var(--border-radius-md);
    }

    .viewer-frame {
        transform: none !important;
        min-height: 0;
    }

    .viewer-stage,
    #model-canvas,
    .viewer-media--embed {
        height: min(52vw, 320px) !important;
        min-height: 260px !important;
    }

    .viewer-label {
        font-size: 0.58rem;
        left: 12px;
        top: 12px;
        right: 12px;
    }

    .viewer-corners span {
        width: 16px;
        height: 16px;
    }

    .viewer-corners span:nth-child(1),
    .viewer-corners span:nth-child(2) {
        top: 10px;
    }

    .viewer-corners span:nth-child(3),
    .viewer-corners span:nth-child(4) {
        bottom: 52px;
    }

    .live-state {
        bottom: 50px;
        right: 12px;
        font-size: 0.62rem;
    }

    .control-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }

    .control-group {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 8px;
    }

    .control-group label {
        width: 100%;
        margin-bottom: 2px;
    }

    .control-button {
        min-height: 40px;
        padding: 8px 12px;
        font-size: 0.72rem;
    }

    .control-group input[type="range"] {
        width: 100%;
        margin-top: 4px;
    }

    /* Marquee */
    .hero-marquee {
        position: relative;
        margin-top: 1.5rem;
    }

    .marquee-item {
        font-size: 0.72rem;
        gap: 1.25rem;
        padding-right: 1.25rem;
        letter-spacing: 0.12em;
    }

    /* Carrusel */
    .carousel-section {
        padding: 60px 1rem;
    }

    .carousel-3d-scene {
        height: auto;
        min-height: 420px;
        perspective: 800px;
    }

    .carousel-3d-slide {
        width: 94%;
        margin-left: -47%;
        margin-top: -100px;
    }

    .carousel-3d-card-inner {
        padding: 1.25rem;
    }

    .carousel-3d-title {
        font-size: 1.15rem;
    }

    .carousel-3d-desc {
        font-size: 0.88rem;
    }

    .carousel-controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
    }

    .carousel-arrow {
        min-width: 44px;
        min-height: 44px;
    }

    /* Stats y secciones */
    .stats-section,
    .services-preview {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .stat-number {
        font-size: 2.25rem;
    }

    .service-preview-grid {
        gap: 1rem;
    }

    /* Páginas internas */
    .page-hero {
        padding: 96px 1rem 48px;
    }

    .page-hero h1 {
        font-size: clamp(1.75rem, 7vw, 2.5rem);
    }

    .page-hero .hero-copy {
        font-size: 0.95rem;
    }

    .section {
        padding: 2.5rem 0;
    }

    .page-cta {
        padding: 48px 1rem;
    }

    .about-content,
    .contact-panel,
    .contact-form-card,
    .content-box {
        padding: var(--spacing-lg);
    }

    .about-visual {
        min-height: 220px;
    }

    .about-visual i {
        font-size: 3.5rem;
    }

    .values-grid,
    .company-info-grid,
    .cards-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .card-img-placeholder {
        height: 220px;
    }

    .products-layout {
        gap: var(--spacing-md);
    }

    .filter-sidebar {
        padding: var(--spacing-md);
    }

    .map-container iframe {
        height: 260px;
    }

    .detail-media {
        min-height: 240px;
    }

    .detail-intro {
        font-size: 1rem;
    }

    .budget-table {
        font-size: 0.88rem;
    }

    .breadcrumb-list {
        padding: 0 1rem;
        font-size: 0.78rem;
    }

    /* Footer */
    .footer {
        padding: 2.5rem 0 2rem;
    }

    .footer-grid {
        gap: 2rem;
        grid-template-columns: 1fr;
    }

    /* WhatsApp flotante */
    .whatsapp-float {
        bottom: max(16px, env(safe-area-inset-bottom));
        right: max(16px, env(safe-area-inset-right));
        width: 52px;
        height: 52px;
    }

    .whatsapp-float svg {
        width: 28px;
        height: 28px;
    }
}

/* --- Móvil pequeño (≤480px) --- */
@media (max-width: 480px) {
    .brand {
        font-size: 0.68rem;
    }

    .hero-3d {
        padding-top: 88px;
        padding-bottom: 64px;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .viewer-stage,
    #model-canvas,
    .viewer-media--embed {
        min-height: 220px !important;
    }

    .carousel-3d-scene {
        min-height: 380px;
    }

    .carousel-3d-slide {
        margin-top: -80px;
    }

    .carousel-index-num {
        font-size: 2.5rem;
    }

    .carousel-meta-tag {
        font-size: 0.62rem;
        padding: 4px 8px;
    }

    .section-heading {
        margin-bottom: 2rem;
    }

    .section-heading h2 {
        font-size: 1.5rem;
    }

    .btn {
        font-size: 0.72rem;
        letter-spacing: 0.06em;
    }

    .contact-item {
        gap: var(--spacing-sm);
    }

    .contact-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .card-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

/* --- Pantallas muy estrechas (≤360px) --- */
@media (max-width: 360px) {
    .brand {
        font-size: 0.62rem;
    }

    .hero-title {
        font-size: 1.55rem;
    }
}

/* Desactivar efectos pesados en pantallas táctiles */
@media (hover: none) and (pointer: coarse) {
    .viewer-frame {
        transform: none !important;
    }

    .viewer-shell::after {
        animation: none;
    }

    .card:hover {
        transform: none;
    }
}
