/*
 * Versión tablet y móvil de conIAtec.
 *
 * Se carga después de style.css, tema.css y animaciones.css.
 *   - Tablet: hasta 1024 px (rejillas a 2 columnas).
 *   - Menú desplegable: hasta 900 px.
 *   - Móvil: hasta 640 px (todo a 1 columna, tipografía ajustada).
 */

/* ---------- Botón de menú (oculto en escritorio) ---------- */

.menu-toggle {
    display: none;
    position: relative;
    width: 46px;
    height: 46px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    padding: 0;
    flex: 0 0 auto;
}

.menu-toggle span {
    position: absolute;
    left: 12px;
    right: 12px;
    height: 2px;
    border-radius: 2px;
    background: #fff;
    transition: transform 0.3s ease, opacity 0.2s ease, top 0.3s ease;
}

.menu-toggle span:nth-child(1) { top: 15px; }
.menu-toggle span:nth-child(2) { top: 22px; }
.menu-toggle span:nth-child(3) { top: 29px; }

.menu-open .menu-toggle span:nth-child(1) { top: 22px; transform: rotate(45deg); }
.menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
.menu-open .menu-toggle span:nth-child(3) { top: 22px; transform: rotate(-45deg); }

body.no-scroll {
    overflow: hidden;
}

/* Al saltar a un apartado (p. ej. /servicios/#ciberseguridad), que el
   título no quede tapado por la cabecera fija. */
[id] {
    scroll-margin-top: var(--header-offset);
}

/* Las capas decorativas de brillo de las tarjetas no deben bloquear los
   clics de los botones y enlaces que hay debajo. */
.service-card-premium::before,
.service-card-premium::after,
.service-detail-card::after,
.case-card::after,
.contact-card::after,
.feature-list-card::after,
.tilt::before {
    pointer-events: none;
}

/* Las animaciones que entran desde un lateral no deben crear scroll horizontal. */
main {
    overflow-x: clip;
}

/* ---------- Logo de la cabecera ---------- */

.site-header .brand-mark img {
    width: auto;
    max-width: 100%;
    max-height: 65px;
    transition: max-height 0.35s ease;
}

.site-header.is-scrolled .brand-mark img {
    max-height: 54px;
}

/* ---------- Pie de página (todas las pantallas) ---------- */

/* Degradado suave: empieza algo más claro arriba y termina en el azul
   del pie un poco antes de la línea. De la línea hacia abajo, color sólido. */
.site-footer {
    margin-top: 0;
    background: linear-gradient(180deg, #11264a 0%, #0c1b3a 48%, #08152d 77%, #08152d 100%);
}

.footer-bottom {
    position: relative;
    background: #08152d;
    box-shadow: 0 0 0 100vmax #08152d;
    clip-path: inset(0 -100vmax);
}

.footer-logo {
    display: inline-block;
    margin-bottom: 1rem;
}

.footer-logo img {
    width: 170px;
    height: auto;
}

.footer-contact {
    list-style: none;
    padding: 0;
    margin: 1.2rem 0 0;
    display: grid;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
}

.footer-contact i {
    width: 1.2rem;
    color: var(--accent);
}

.footer-contact a:hover {
    color: #fff;
}

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    align-items: center;
    justify-content: space-between;
}

.footer-bottom p {
    margin: 0;
}

.footer-legal a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(242, 140, 40, 0.6);
}

.footer-legal a:hover {
    color: #fff;
}

/* ---------- Formulario: casilla de privacidad ---------- */

.form-check {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    margin: 0.4rem 0 0.8rem;
    font-size: 0.95rem;
    color: var(--t-text, inherit);
}

.form-check input {
    width: 18px;
    height: 18px;
    margin-top: 0.2rem;
    flex: 0 0 auto;
    accent-color: var(--accent);
}

.form-check a,
.form-legal a {
    color: var(--accent-blue);
    text-decoration: underline;
}

.form-legal {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--t-muted, #94a3b8);
}

/* ---------- Mapa de Contacto ---------- */

.contact-map {
    position: relative;
    margin-top: 1.75rem;
    height: 300px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--t-border, rgba(0, 0, 0, 0.08));
    box-shadow: var(--shadow-soft);
    background:
        radial-gradient(circle at 80% 0%, rgba(76, 139, 245, 0.18), transparent 50%),
        linear-gradient(180deg, var(--t-navy-1, #10234a) 0%, var(--t-navy-2, #0a1834) 100%);
}

.contact-map iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.contact-map-placeholder {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    text-align: center;
    color: #fff;
}

.contact-map-placeholder i {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.contact-map-placeholder strong {
    font-size: 1.15rem;
}

.contact-map-placeholder p {
    margin: 0 0 0.75rem;
    max-width: 22rem;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--t-navy-muted, #c9d6ea);
}

.contact-map-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.2rem;
    align-items: center;
    justify-content: center;
}

.contact-map-actions .button {
    width: auto;
    padding: 0.65rem 1.4rem;
}

.contact-map-link {
    color: #fff;
    font-size: 0.9rem;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(242, 140, 40, 0.7);
}

/* ---------- Página legal ---------- */

.legal-content {
    max-width: 52rem;
    color: var(--t-text);
    line-height: 1.75;
}

.legal-content h2 {
    margin: 2.6rem 0 0.8rem;
    font-size: 1.35rem;
    color: var(--t-ink);
}

.legal-content ul {
    padding-left: 1.2rem;
}

.legal-content li {
    margin-bottom: 0.45rem;
}

.legal-content a {
    color: #c25f00;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.legal-thanks {
    margin-top: 2.5rem;
    font-weight: 600;
    color: var(--t-ink);
}

/* =================================================================
   TABLET (hasta 1024 px)
   ================================================================= */

@media (max-width: 1024px) {
    :root {
        --section-space: 3.25rem;
    }

    .split-lead,
    .cases-header {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .service-cards-grid,
    .cases-grid-horizontal,
    .process-grid,
    .pillar-grid,
    .pillar-grid-wide,
    .service-pack-grid,
    .emprion-team-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Si queda una tarjeta suelta al final, ocupa todo el ancho. */
    .service-cards-grid > :last-child:nth-child(odd),
    .cases-grid-horizontal > :last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .case-card-feature {
        min-height: 0;
    }
}

/* =================================================================
   MENÚ DESPLEGABLE (hasta 900 px)
   ================================================================= */

@media (max-width: 900px) {
    :root {
        --header-offset: 74px;
    }

    .site-header,
    .site-header.is-scrolled {
        height: var(--header-offset);
    }

    .nav,
    .site-header .nav {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .brand {
        width: auto;
    }

    .brand-mark,
    .site-header.is-scrolled .brand-mark {
        width: auto;
        flex-basis: auto;
    }

    .site-header .brand-mark img,
    .site-header.is-scrolled .brand-mark img {
        max-height: 52px;
    }

    .menu-toggle {
        display: block;
    }

    .menu {
        position: fixed;
        top: var(--header-offset);
        left: 0;
        right: 0;
        width: auto;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0.35rem;
        padding: 1rem 1.25rem 1.5rem;
        background: rgba(4, 10, 24, 0.98);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 24px 40px rgba(2, 6, 16, 0.35);
        transform: translateY(-12px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
    }

    .menu-open .menu {
        transform: none;
        opacity: 1;
        visibility: visible;
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s;
    }

    .menu a {
        display: block;
        padding: 0.9rem 1rem;
        border-radius: 12px;
        font-size: 1.05rem;
    }

    .hero-business {
        padding: calc(var(--header-offset) + 4.5rem) 0 4.5rem;
    }

    .page-hero {
        padding: calc(var(--header-offset) + 3.5rem) 0 3.5rem;
    }

    .page-hero-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .contact-layout {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* =================================================================
   MÓVIL (hasta 640 px)
   ================================================================= */

@media (max-width: 640px) {
    :root {
        --section-space: 2.5rem;
        --fs-display: clamp(2.1rem, 9vw, 2.6rem);
        --fs-page-title: clamp(2rem, 8.5vw, 2.5rem);
        --fs-section-title: clamp(1.7rem, 7vw, 2.1rem);
    }

    .container {
        width: 100%;
        padding: 0 1.15rem;
    }

    .service-cards-grid,
    .cases-grid-horizontal,
    .process-grid,
    .pillar-grid,
    .pillar-grid-wide,
    .service-pack-grid,
    .emprion-team-grid,
    .signal-grid,
    .about-principles-grid,
    .team-grid,
    .story-grid {
        grid-template-columns: 1fr;
    }

    .service-cards-grid > :last-child:nth-child(odd),
    .cases-grid-horizontal > :last-child:nth-child(odd) {
        grid-column: auto;
    }

    .title-massive {
        font-size: var(--fs-section-title);
    }

    .subtitle-large {
        font-size: 1.02rem;
    }

    .hero-business-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-business-actions .button {
        width: 100%;
    }

    .service-card-premium,
    .case-card-feature,
    .process-card,
    .pillar-card,
    .contact-form-card,
    .emprion-team-card,
    .page-hero-card {
        padding: 1.5rem;
    }

    .case-metric-huge {
        font-size: 2.4rem;
    }

    .trust-banner {
        padding: 2rem 0;
    }

    .trust-list li {
        font-size: 1rem;
    }

    .service-secondary-band {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

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

    .legal-content h2 {
        font-size: 1.2rem;
    }

    .story-block {
        padding: 2rem 0;
    }
}
