/* ============================================
   iMirly — Mobile.css v2
   Fix completo para móvil. Carga DESPUÉS de styles.css.
   Usa !important donde es necesario para sobreescribir
   estilos inline (style="...") del HTML.
   ============================================ */

/* ============================================
   0. PREVENIR OVERFLOW HORIZONTAL GLOBAL
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    width: 100%;
}

img, svg, video, iframe {
    max-width: 100%;
    height: auto;
}

/* ============================================
   1. HEADER Y MENÚ HAMBURGUESA
   ============================================ */
@media (max-width: 968px) {

    /* Nav container: logo + toggle visibles, menú oculto */
    .nav {
        height: 68px;
        padding: 0 1rem;
    }

    .nav__logo {
        width: 90px !important;
        height: auto !important;
    }

    /* Botón hamburguesa siempre visible */
    .nav__toggle {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 8px;
        z-index: 1001;
        flex-shrink: 0;
    }

    .nav__toggle span {
        display: block;
        width: 24px;
        height: 2px;
        background: #3f51b5;
        border-radius: 2px;
        transition: all 0.3s ease;
    }

    /* Menú desplegable — oculto por defecto */
    .nav__menu {
        position: fixed !important;
        top: 68px !important;
        left: 0 !important;
        width: 100% !important;
        background: #fff !important;
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 1rem !important;
        gap: 4px !important;
        box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
        z-index: 998 !important;

        /* Estado cerrado */
        transform: translateY(-110%) !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition: transform 0.3s ease, opacity 0.2s ease !important;
    }

    /* Estado abierto — clase añadida por main.js */
    .nav__menu.active {
        transform: translateY(0) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .nav__link {
        display: flex !important;
        align-items: center !important;
        padding: 0.85rem 1rem !important;
        font-size: 1rem !important;
        border-radius: 10px !important;
        min-height: 48px !important;
        width: 100% !important;
    }

    .nav__link:hover,
    .nav__link.active {
        background: #e0e0ff !important;
        color: #3f51b5 !important;
    }

    /* Tooltip disabled desactivado en móvil */
    .nav__link.disabled::after {
        display: none !important;
    }
}

/* ============================================
   2. HERO SECTION
   ============================================ */
@media (max-width: 968px) {

    .hero {
        padding-top: 88px !important;
        padding-bottom: 3rem !important;
        min-height: auto !important;
    }

    .hero--secondary {
        min-height: auto !important;
        padding-top: 88px !important;
        padding-bottom: 3rem !important;
    }

    /* Grid de 2 columnas → 1 columna */
    .hero__wrapper {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        padding: 0 !important;
        min-height: auto !important;
    }

    /* Ocultar mockup del teléfono en tablet/móvil */
    .hero__mockup {
        display: none !important;
    }

    .hero__illustration {
        display: none !important;
    }

    .hero__content {
        max-width: 100% !important;
    }

    /* Stats row */
    .hero__content > div[style*="display: flex"][style*="gap: 40px"] {
        gap: 24px !important;
        flex-wrap: wrap !important;
        margin-top: 2rem !important;
        padding-top: 1.5rem !important;
    }

    /* Botones en fila */
    div[style*="display: flex"][style*="gap: 16px"][style*="flex-wrap: wrap"] {
        flex-direction: column !important;
        gap: 12px !important;
    }
}

@media (max-width: 480px) {

    .hero__title {
        font-size: 2rem !important;
        line-height: 1.15 !important;
        letter-spacing: -0.3px !important;
    }

    .hero__subtitle {
        font-size: 1rem !important;
    }

    .hero__text {
        font-size: 0.95rem !important;
    }

    /* Botones hero a full width en móvil */
    .hero__content .btn,
    div[style*="display: flex"][style*="gap: 16px"] .btn {
        width: 100% !important;
        justify-content: center !important;
        padding: 14px 20px !important;
        font-size: 0.95rem !important;
    }

    /* Tag "Proyecto DAM 2025" */
    .hero__content > span {
        font-size: 0.78rem !important;
        padding: 6px 14px !important;
    }

    /* Decoraciones de fondo más pequeñas */
    .hero__decoration--1 {
        width: 180px !important;
        height: 180px !important;
    }
    .hero__decoration--2 {
        width: 120px !important;
        height: 120px !important;
    }
    .hero__decoration--3 {
        display: none !important;
    }
}

/* ============================================
   3. SECCIONES — espaciado
   ============================================ */
@media (max-width: 640px) {
    .section {
        padding: 3rem 0 !important;
    }

    .container {
        padding: 0 1rem !important;
    }

    .section__header {
        margin-bottom: 1.75rem !important;
    }

    .section__tag {
        font-size: 0.75rem !important;
        padding: 4px 12px !important;
    }

    .section__title {
        font-size: 1.75rem !important;
        line-height: 1.2 !important;
    }

    .section__description {
        font-size: 1rem !important;
    }

    .subsection__title {
        font-size: 1.2rem !important;
    }
}

/* ============================================
   4. GRIDS — todo a 1 columna en móvil
   Incluye los que tienen grid-template-columns inline
   ============================================ */
@media (max-width: 640px) {

    /* Value grid — inline style con repeat(4, 1fr) */
    .value-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Todos los grids con clases */
    .features,
    .problem-grid,
    .team-grid,
    .context-grid,
    .segments-grid,
    .concept-grid,
    .differentiation-grid,
    .dafo-grid,
    .competitors-grid,
    .advantages-grid,
    .targets-grid,
    .future-keys,
    .ux-pillars,
    .ui-showcase,
    .org-chart__roles,
    .conditions-cards,
    .premises-list,
    .indicators-grid,
    .conclusions-grid,
    .sales-pillars,
    .launch-phases,
    .forecast-timeline,
    .competitive-analysis,
    .conditions-list,
    .research-pillars,
    .validation-grid,
    .dafo-detailed,
    .marketing-strategies,
    .mission-wrapper,
    .target-wrapper,
    .wireframe-block,
    .accessibility-content,
    .product-overview,
    .market-potential,
    .value-proposition,
    .timeline-comparison,
    .source-tabs,
    .hr-plan__content,
    .permissions-status,
    .investment-content,
    .team-status {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Wireframe block reverse: anular direction rtl */
    .wireframe-block--reverse {
        direction: ltr !important;
    }

    /* Gallery */
    .gallery-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

/* En tablet (640-968px) — 2 columnas máximo */
@media (min-width: 641px) and (max-width: 968px) {
    .value-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }

    .features,
    .problem-grid,
    .team-grid,
    .segments-grid,
    .competitors-grid,
    .ux-pillars,
    .conclusions-grid,
    .dafo-grid,
    .dafo-detailed {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ============================================
   5. CARDS — padding y textos
   ============================================ */
@media (max-width: 640px) {

    .feature-card,
    .problem-card,
    .value-item,
    .team-card,
    .context-card,
    .segment-card,
    .concept-card,
    .diff-card,
    .dafo-card,
    .dafo-item,
    .advantage-card,
    .target-card,
    .competitor-card,
    .analysis-column,
    .legal-item,
    .conclusion-card,
    .closing-block,
    .ux-pillar,
    .ui-element,
    .accessibility-feature,
    .research-pillar,
    .launch-phase,
    .objectives-block,
    .mission-block,
    .wireframe-block__content {
        padding: 1.25rem !important;
    }

    /* Value items con inline style display:flex */
    .value-item {
        flex-direction: row !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }

    .value-item__icon {
        flex-shrink: 0 !important;
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
    }

    .feature-card__title,
    .problem-card__title,
    .context-card__title,
    .segment-card__title,
    .concept-card__title,
    .diff-card__title,
    .dafo-card__title,
    .ux-pillar__title,
    .research-pillar__title,
    .value-item__title {
        font-size: 1.05rem !important;
        margin-bottom: 0.4rem !important;
    }

    .feature-card__text,
    .problem-card__text,
    .context-card__text,
    .segment-card__text,
    .value-item__text,
    .ux-pillar__list li,
    .research-pillar__text {
        font-size: 0.92rem !important;
        line-height: 1.55 !important;
    }

    .problem-card__number {
        font-size: 2rem !important;
    }

    /* Iconos en cards */
    .feature-card__icon,
    .context-card__icon,
    .segment-card__icon,
    .diff-card__icon,
    .dafo-card__icon,
    .advantage-card__icon,
    .ux-pillar__icon {
        width: 44px !important;
        height: 44px !important;
        margin-bottom: 0.75rem !important;
    }
}

/* ============================================
   6. TABLAS — scroll horizontal
   ============================================ */
@media (max-width: 768px) {
    .comparison-table,
    .table-wrapper,
    table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
    }

    .comparison-table th,
    .comparison-table td,
    table th,
    table td {
        padding: 0.6rem 0.75rem !important;
        font-size: 0.82rem !important;
        white-space: normal !important;
        min-width: 90px !important;
    }

    /* Cabeceras de tabla más compactas */
    .comparison-table th {
        font-size: 0.78rem !important;
    }
}

/* ============================================
   7. QUOTE
   ============================================ */
@media (max-width: 480px) {
    .quote {
        padding: 1.5rem 1.25rem !important;
    }

    .quote__text {
        font-size: 1.05rem !important;
        line-height: 1.6 !important;
    }

    .quote--large .quote__text {
        font-size: 1.15rem !important;
    }
}

/* ============================================
   8. STATS DEL HERO (los números 4 / 2 / 1)
   ============================================ */
@media (max-width: 480px) {
    /* El div de stats tiene style inline con display:flex gap:40px */
    div[style*="gap: 40px"] {
        gap: 20px !important;
        flex-wrap: wrap !important;
    }

    div[style*="font-size: 2rem"][style*="font-weight: 700"] {
        font-size: 1.6rem !important;
    }
}

/* ============================================
   9. VALIDATION CARDS (diseno-ux.html)
   ============================================ */
@media (max-width: 640px) {
    .validation-card__visual {
        padding: 0 !important;
    }

    .validation-card__text {
        padding: 0 !important;
        font-size: 0.95rem !important;
    }

    .validation-result__box {
        padding: 1.25rem !important;
    }

    .validation-result__highlight {
        grid-template-columns: 1fr !important;
        padding: 1.25rem !important;
        gap: 1rem !important;
        text-align: center !important;
    }

    .validation-result__divider {
        width: 60px !important;
        height: 1px !important;
        margin: 0 auto !important;
    }

    .validation-result__number {
        font-size: 2.2rem !important;
    }
}

/* ============================================
   10. FOOTER (el inline generado por footer.js)
   ============================================ */
@media (max-width: 640px) {
    .footer {
        padding: 2.5rem 0 1.5rem !important;
    }

    /* Sobreescribir el flexbox inline de footer.js */
    .footer__content {
        flex-direction: column !important;
        gap: 2rem !important;
    }

    .footer__links {
        grid-template-columns: 1fr !important;
        min-width: unset !important;
        width: 100% !important;
        gap: 1.5rem !important;
    }

    .footer__bottom {
        flex-direction: column !important;
        text-align: center !important;
        gap: 8px !important;
    }

    .footer__brand {
        text-align: center !important;
    }

    /* Links del footer más grandes para touch */
    .footer__links a {
        padding: 6px 0 !important;
        min-height: 40px !important;
    }
}

/* ============================================
   11. FINAL CONCLUSION BLOCK
   ============================================ */
@media (max-width: 480px) {
    .final-conclusion {
        padding: 2rem 1.25rem !important;
        border-radius: 16px !important;
    }

    .final-conclusion h3 {
        font-size: 1.3rem !important;
    }

    .final-conclusion p {
        font-size: 0.95rem !important;
    }
}

/* ============================================
   12. EQUIPO — team cards
   ============================================ */
@media (max-width: 640px) {
    .team-card {
        text-align: center !important;
    }

    .team-card__avatar {
        margin: 0 auto 1rem !important;
    }

    .team-section__title,
    .work-section__title {
        font-size: 1.75rem !important;
    }

    .team-section__description {
        font-size: 1rem !important;
    }
}

/* ============================================
   13. FLOATING NAV — oculto en móvil
   ============================================ */
@media (max-width: 768px) {
    .floating-nav {
        display: none !important;
    }
}

/* ============================================
   14. DAFO Y ELEMENTOS ESPECÍFICOS
   ============================================ */
@media (max-width: 640px) {
    .dafo-item {
        padding: 1.25rem !important;
    }

    .dafo-item h4 {
        font-size: 1rem !important;
    }

    .dafo-item ul li {
        font-size: 0.9rem !important;
    }

    /* Positioning statement */
    .positioning-statement {
        padding: 1.25rem !important;
    }

    .positioning-statement__text {
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }

    /* Objectives list */
    .objective-item {
        font-size: 0.95rem !important;
    }

    /* Strategy step */
    .strategy-step {
        flex-direction: column !important;
        text-align: center !important;
    }

    .strategy-step__number {
        margin: 0 auto !important;
    }
}

/* ============================================
   15. MERCADO — elementos específicos con inline style
   ============================================ */
@media (max-width: 640px) {

    /* Grids con inline style de 2-3 columnas */
    div[style*="grid-template-columns: repeat(2"] {
        grid-template-columns: 1fr !important;
    }

    div[style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr !important;
    }

    div[style*="grid-template-columns: repeat(4"] {
        grid-template-columns: 1fr !important;
    }

    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    div[style*="grid-template-columns: 2fr 1fr"],
    div[style*="grid-template-columns: 1fr 2fr"],
    div[style*="grid-template-columns: 3fr 2fr"],
    div[style*="grid-template-columns: 2fr 3fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Flex rows con gap grandes que hacen overflow */
    div[style*="display: flex"][style*="gap: 2rem"],
    div[style*="display: flex"][style*="gap: 3rem"],
    div[style*="display: flex"][style*="gap: 32px"],
    div[style*="display: flex"][style*="gap: 48px"],
    div[style*="display: flex"][style*="gap: 60px"] {
        flex-direction: column !important;
        gap: 1rem !important;
    }

    /* Padding excesivo en elementos inline */
    div[style*="padding: 0 150px"],
    div[style*="padding: 0 100px"],
    div[style*="padding: 0 80px"],
    div[style*="padding: 0 60px"],
    div[style*="padding: 0 50px"] {
        padding: 0 !important;
    }
}

/* ============================================
   16. MODAL — mejor UX táctil
   ============================================ */
@media (max-width: 480px) {
    .modal {
        padding: 1rem !important;
    }

    .modal__close {
        top: -36px !important;
        font-size: 2rem !important;
        width: 36px !important;
        height: 36px !important;
    }

    .modal__content img {
        max-height: 80vh !important;
    }
}

/* ============================================
   17. TOUCH TARGETS MÍNIMOS (accesibilidad)
   ============================================ */
@media (max-width: 968px) {
    a, button {
        min-height: 44px;
    }

    .btn {
        min-height: 48px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

/* ============================================
   18. TIPOGRAFÍA GENERAL en móvil
   ============================================ */
@media (max-width: 480px) {
    h1 { font-size: 1.9rem !important; }
    h2 { font-size: 1.6rem !important; }
    h3 { font-size: 1.1rem !important; }
    h4 { font-size: 1rem !important; }

    p, li {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }

    /* Titulos con inline font-size grandes */
    [style*="font-size: 3rem"],
    [style*="font-size: 3.2rem"],
    [style*="font-size: 2.5rem"],
    [style*="font-size: 2rem"] {
        font-size: 1.75rem !important;
    }
}

/* ============================================
   19. APLICACION.HTML — pantallas de app
   ============================================ */
@media (max-width: 640px) {
    /* Bloques de features con flex horizontal */
    .screen-block,
    div[style*="display: grid"][style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        flex-direction: column !important;
    }
}

/* ============================================
   20. TECNOLOGIA.HTML
   ============================================ */
@media (max-width: 640px) {
    /* Stack tech pills / badges */
    .tech-stack,
    .tech-grid,
    div[style*="display: flex"][style*="flex-wrap: wrap"] {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
}

/* ============================================
   FIXES ESPECÍFICOS mercado-y-estrategia.html
   ============================================ */

/* values-row: columna en móvil */
@media (max-width: 640px) {
    .values-row {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .values-row .value-item {
        width: 100% !important;
        flex-shrink: unset !important;
    }
}

/* org-chart__roles: columna en móvil, wrap en tablet */
@media (max-width: 640px) {
    .org-chart__roles {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    .org-role {
        width: 100% !important;
        white-space: normal !important;
        flex-shrink: unset !important;
        justify-content: flex-start !important;
    }

    .org-role span {
        white-space: normal !important;
        font-size: 0.9rem !important;
    }
}

@media (min-width: 641px) and (max-width: 968px) {
    .org-chart__roles {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 12px !important;
    }

    .org-role {
        flex: 0 1 calc(50% - 6px) !important;
        white-space: normal !important;
    }
}