html, body {
    max-width: 100vw;
    overflow-x: clip;
}

/* --- CABECERA (HEADER) --- */
.site-header {
    position: sticky;
    top: 0;
    height: var(--header-height, 80px);
    background: rgba(18, 18, 18, 0.85);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    max-width: var(--container-width);
    margin-inline: auto;
}

.logo {
    text-decoration: none;
}

.logo-text {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.5em;
    color: white;
    display: flex;
    align-items: center;
    height: 100%;
}

.logo-x {
    font-family: var(--font-logo);
    font-size: 2.5rem;
    font-weight: 900;
}

.nav-list {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
}

.nav-link,
.nav-link:visited {
    color: var(--text-secondary, #a1a1aa);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link:focus {
    color: #ffffff;
}

.mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.5rem;
    cursor: pointer;
    z-index: 1001;
    width: 44px;
    height: 44px;
}

.mobile-toggle svg {
    width: 100%;
    height: 100%;
    display: block;
}

@media (max-width: 899px) {
    .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .main-nav {
        position: fixed;
        top: var(--header-height, 80px);
        right: 0;
        left: 0;
        transform: translateX(100%);
        width: 100%;
        max-width: 100%;
        height: calc(100dvh - var(--header-height, 80px));
        background: rgba(18, 18, 18, 0.95);
        backdrop-filter: blur(15px);
        visibility: hidden;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.3s;
        padding: 2rem;
        overflow-y: auto;
        z-index: 999;
    }

    .main-nav.is-open {
        transform: translateX(0);
        visibility: visible;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0s;
    }

    .nav-list {
        flex-direction: column;
        gap: 2rem;
        align-items: flex-start;
    }

    .nav-link {
        font-size: 1.25rem;
        padding: 0.5rem 0;
        display: block;
        width: 100%;
    }
}

@media (min-width: 768px) and (max-width: 899px) {
    .main-nav {
        left: auto;
        max-width: 320px;
        border-left: 1px solid rgba(255, 255, 255, 0.05);
    }
}

/* --- LAYOUT MACRO-ESPACIADO --- */
:root {
    --macro-padding: clamp(6rem, 10vw, 12rem);
    --gap-massive: clamp(4rem, 8vw, 8rem);
}

.macro-section {
    padding-block: var(--macro-padding);
}

.bg-elevated {
    background-color: #080808;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.section-header-macro {
    margin-bottom: var(--gap-massive);
}

/* --- HERO MACRO LAYOUT (DOMINIO RAÍZ) --- */
.hero-macro {
    position: relative;
    min-height: 100svh;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-overlay-dark {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(5,5,5,0.4) 0%, #050505 80%);
    z-index: 1;
}

.hero-content-macro {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    justify-content: center;
/*     margin-top: 2rem; */
}

@media (min-width: 1024px) {
    .hero-macro {
        align-items: center;
    }

    .hero-content-macro {
        max-width: 50%;
        margin-top: 0;
    }
}

@media (min-width: 1280px) {
    .hero-macro {
/*         padding-top: var(--header-height, 80px); */
    }
}

/* --- STICKY LAYOUT (FILOSOFÍA) --- */
.sticky-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4rem;
    align-items: start;
}

.sticky-sidebar {
    text-align: center;
}

.sticky-content {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

@media (min-width: 768px) {
    .page-b2b .sticky-sidebar {
        max-width: 540px;
        margin: 0 auto;
    }
}

@media (min-width: 1024px) {
    .sticky-layout {
        grid-template-columns: 4fr 7fr;
        gap: 6rem;
    }
    .sticky-sidebar {
        position: sticky;
        top: calc(var(--header-height, 80px) + 4rem);
        text-align: left;
    }
    .page-b2b .sticky-sidebar {
        max-width: none;
    }
}

@media (min-width: 1280px) {
    .sticky-layout {
        grid-template-columns: 1fr 1fr;
    }
}

/* --- Z-PATTERN (SOLUCIONES) --- */
.z-pattern-container {
    display: flex;
    flex-direction: column;
    gap: clamp(8rem, 15vw, 16rem);
}

.z-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    align-items: center;
}

.z-row .z-text {
    order: 2;
}

.z-row .z-visual-wrapper {
    order: 1;
}

@media (min-width: 1024px) {
    .z-row {
        grid-template-columns: 1fr 1fr;
        gap: var(--gap-massive);
    }

    .z-row .z-text,
    .z-row .z-visual-wrapper {
        order: 0;
    }

    .z-row.reverse .z-text {
        order: 2;
    }

    .z-row.reverse .z-visual-wrapper {
        order: 1;
    }
}

/* --- BENTO GRID --- */
.bento-wrapper {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
}

.bento-card {
    grid-column: span 12;
}

.card-full {
    grid-column: span 12 !important;
}

@media (min-width: 900px) {
    #servicios .bento-card:nth-of-type(1),
    #servicios .bento-card:nth-of-type(2) {
        grid-column: span 6;
    }
    #servicios .bento-card:nth-of-type(3) {
        grid-column: span 12;
    }
}

/* --- CONTACT Y FORM LAYOUTS --- */
.contact-macro-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4rem;
    align-items: center;
}

@media (min-width: 768px) and (max-width: 1023px) {
    .contact-macro-grid {
        max-width: 512px;
        margin-inline: auto;
    }
}

@media (min-width: 1024px) {
    .contact-macro-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8rem;
    }
}

.contact-wrapper {
    max-width: 700px;
    margin-inline: auto;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* --- PIE DE PÁGINA (FOOTER) --- */
.site-footer {
    background: #050505;
    padding-top: 4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    padding-bottom: 4rem;
}

.footer-col h4,
.footer-col h5 {
    color: white;
    margin: 0 0 1.5rem 0;
    font-size: 1.1rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
}

.footer-col .footer-logo .logo-text {
    height: 100%;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--text-secondary, #a1a1aa);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: white;
}

.tech-flex-bar {
    background: black;
    padding: 1rem 0;
    text-align: center;
    color: #444;
    border-top: 1px solid #111;
}

.tech-flex-bar a {
    color: inherit;
    text-decoration: none;
}

@media (min-width: 768px) and (max-width: 1023px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .footer-col:first-child {
        grid-column: 1 / -1;
    }
}

.footer-contact {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-block: 1rem;
}

.contact-item {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary, #a1a1aa);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.contact-item:hover {
    color: #ffffff;
}

.contact-item svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.footer-social {
    display: flex;
    gap: 1.25rem;
    margin-block: 1rem;
}

.footer-social a {
    color: var(--text-secondary, #a1a1aa);
    transition: color 0.2s, transform 0.2s;
    display: block;
}

.footer-social a:hover {
    color: #ffffff;
    transform: translateY(-2px);
}

.footer-social svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

@media (min-width: 1024px) {
    .footer-grid {
        /* Define 4 columnas exactas para evitar el auto-fit */
        grid-template-columns: repeat(3, 1fr);
    }
}
