/* Mobile Optimization & Custom Menu */
html,
body {
    overflow-x: hidden;
    width: 100%;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    z-index: 2000;
}

.menu-toggle .bar {
    width: 30px;
    height: 2px;
    background-color: #fff;
    transition: 0.3s ease;
}

.mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    /* Fallback */
    height: 100dvh;
    /* Dynamic Viewport Height */
    background: rgba(5, 5, 5, 0.98);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    clip-path: circle(0% at top right);
    transition: clip-path 0.8s cubic-bezier(0.77, 0, 0.175, 1);
    pointer-events: none;
}

/* Evitar que el centrado corte el contenido superior si el menú es muy largo */
.mobile-nav>* {
    flex-shrink: 0;
}

.mobile-nav.active {
    clip-path: circle(150% at top right);
    pointer-events: all;
}

/* Viewfinder aesthetic for mobile menu */
.viewfinder-frame {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

.viewfinder-frame::before,
.viewfinder-frame::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border: 2px solid #ff3f05;
}

.viewfinder-frame::before {
    top: -2px;
    left: -2px;
    border-right: 0;
    border-bottom: 0;
}

.viewfinder-frame::after {
    bottom: -2px;
    right: -2px;
    border-left: 0;
    border-top: 0;
}

.rec-dot {
    position: absolute;
    top: 40px;
    left: 40px;
    color: #ff0000;
    font-weight: 900;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1600;
}

.rec-dot::before {
    content: '';
    width: 12px;
    height: 12px;
    background-color: #ff0000;
    border-radius: 50%;
    animation: blink 1s infinite;
}

.menu-exit {
    position: absolute;
    top: 40px;
    right: 40px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1600;
}

.menu-exit:hover {
    color: #ff3f05;
    transform: scale(1.1);
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.mobile-links {
    list-style: none;
    text-align: center;
    z-index: 1700;
    padding: 0;
}

.mobile-links li {
    margin: 20px 0;
}

.mobile-links a {
    font-size: 1.8rem;
    font-weight: 900;
    text-transform: uppercase;
    display: block;
    color: #fff;
    text-decoration: none;
}

.mobile-submenu {
    list-style: none !important;
    list-style-type: none !important;
    margin-top: 15px;
    padding: 0;
    opacity: 1 !important;
    visibility: visible !important;
    position: static !important;
    transform: none !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    display: block !important;
    text-shadow: none !important;
}

.mobile-submenu a {
    -webkit-tap-highlight-color: transparent;
    outline: none !important;
    text-decoration: none !important;
}

.mobile-submenu li {
    margin: 10px 0 !important;
}

.mobile-submenu a {
    font-size: 1rem !important;
    font-weight: 400 !important;
    opacity: 0.6;
    letter-spacing: 2px;
}

.mobile-submenu a.active,
.mobile-submenu a:hover {
    opacity: 1 !important;
    color: var(--accent-color) !important;
    background: transparent !important;
}

.mobile-links a:hover {
    color: #ff3f05;
}

.menu-toggle.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

@media (max-width: 992px) {

    .about,
    .portfolio,
    .services,
    section {
        padding: 40px 0 !important;
    }

    .services-grid {
        gap: 60px !important
    }

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

    .project-info {
        opacity: 1 !important;
        transform: translateY(0) !important;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    }

    .project-info h3,
    .project-info p {
        transform: translateY(20px);
        opacity: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .hero {
        height: 100vh;
        height: 100svh; /* Small viewport height to account for mobile bars */
        height: 100dvh; /* Dynamic viewport height if supported */
    }

    .hero h1 {
        font-size: 5rem;
    }

    .about-experience {
        transform: scale(0.8);
        right: 0;
        bottom: 0;
    }

    /* Centering services on mobile and removing container constraints */
    .service-card {
        flex-direction: column !important;
        gap: 40px;
        align-items: center !important;
        text-align: center !important;
        width: 100%;
    }

    .service-image {
        display: block !important;
        height: auto !important;
        width: 100% !important;
        max-width: 450px !important;
        background: none !important;
        box-shadow: none !important;
        margin: 0 auto !important;
        overflow: visible !important;
    }

    .service-image img {
        width: 100% !important;
        height: auto !important;
        display: block !important;
        margin: 0 auto !important;
        border-radius: 12px !important;
        /* Rounded corners on the image itself */
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5) !important;
    }

    .service-content {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .service-content h3 {
        font-size: 2.5rem !important;
    }

    /* Compatibility Fix for background-clip */
    .hero h1 {
        -webkit-background-clip: text;
        background-clip: text;
    }

    /* Avoid horizontal scroll on about */
    .about-flex {
        flex-direction: column !important;
        gap: 40px;
    }

    .about-image {
        width: 100%;
        height: 450px !important;
        max-width: 500px;
        margin: 0 auto !important;
    }

    .about-text {
        text-align: center;
    }

    .about-text p,
    .about-text .lead {
        margin-bottom: 20px !important;
    }

    .about-stats {
        justify-content: center;
        margin-top: 30px !important;
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 3.5rem;
    }

    .section-title h2 {
        font-size: 2rem;
        margin-bottom: 30px !important;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2.8rem;
    }

    .about-image {
        height: 350px !important;
    }

    .section-title h2 {
        font-size: 1.8rem;
    }

    .about-text .lead {
        font-size: 1.4rem;
    }
}

@media (max-width: 580px) {

    /* Contact: stack Instagram + Facebook en columna en móvil */
    .contact-row-2 {
        grid-template-columns: 1fr;
    }
}

/* ─── Hero Offer Bar – Mobile ────────────────────────────────── */
@media (max-width: 992px) {
    .hero-offer-bar {
        height: 160px; /* Doubled from previous mobile height */
        bottom: 0;
    }

    .offer-bar-inner {
        flex-direction: row; /* Back to single row */
        justify-content: space-between;
        align-items: center;
        padding: 0 15px;
        gap: 12px;
    }

    .offer-text {
        font-size: 0.95rem;
        text-align: center;
        white-space: normal; /* Allow text to wrap if stacked */
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .offer-badge {
        font-size: 0.8rem;
        padding: 6px 14px;
    }

    .offer-whatsapp-btn {
        padding: 0;
        width: 54px;
        height: 54px;
        min-width: 54px; /* Force circular size */
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .offer-whatsapp-btn span {
        display: none; /* Hide text on mobile button */
    }

    .offer-label {
        flex: 1; /* Let the label/text take the middle space */
        min-width: 0;
    }

    .hero-bottom-fade {
        bottom: 0;
        height: 400px; /* Taller fade for taller banner */
    }
}

@media (max-width: 480px) {
    .hero-offer-bar {
        height: 140px; /* Doubled from previous small mobile height */
    }

    .offer-text {
        display: block !important;
        font-size: 0.8rem;
        line-height: 1.3;
        flex: 1;
        min-width: 0;
        color: #fff;
    }

    .offer-badge {
        font-size: 0.7rem;
        padding: 4px 10px;
    }

    .offer-whatsapp-btn {
        width: 48px;
        height: 48px;
        min-width: 48px;
        border-radius: 50%;
        padding: 0;
    }

    .offer-badge-img {
        max-height: 50px; /* Smaller to fit single row nicely */
    }

    .hero-bottom-fade {
        bottom: 0;
        height: 300px;
    }

    .offer-badge-img {
        max-height: 100px;
    }
}