/* ==========================================================================
   1. RESET, TIPOGRAFÍA Y CONTENEDOR MAESTRO
   ========================================================================== */
.cd-main-layout {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    color: #333;
    line-height: 1.6;
    background-color: #fff;
    overflow-x: hidden; /* Evita desbordes y scrolls laterales raros en smartphones */
}

.cd-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* ==========================================================================
   2. HERO SECTION (ADAPTABLE)
   ========================================================================== */
.cd-hero {
    min-height: 400px;
    height: 60vh; /* Altura proporcional al dispositivo */
    background-size: cover;
    background-position: center;
    background-attachment: scroll; /* Evita saltos y parpadeos en iOS y Android */
    display: flex;
    align-items: center;
    text-align: center;
    color: #fff;
    padding: 40px 0;
    box-sizing: border-box;
}

.cd-hero-content { 
    width: 100%; 
}

.cd-hero h1 { 
    font-size: clamp(1.8rem, 5vw, 3.5rem); /* Texto fluido que no se corta en móvil */
    font-weight: 800; 
    margin: 15px 0; 
    line-height: 1.2;
    padding: 0 10px;
}

.cd-badge { 
    background: #c5a47e; 
    padding: 6px 16px; 
    border-radius: 20px; 
    font-size: clamp(0.7rem, 1.5vw, 0.85rem); 
    text-transform: uppercase; 
    letter-spacing: 1px;
    display: inline-block;
}

.cd-separator { 
    width: 60px; 
    height: 4px; 
    background: #c5a47e; 
    margin: 0 auto; 
    border-radius: 2px;
}

/* ==========================================================================
   3. SECCIÓN INTRODUCCIÓN (GRID FLUIDO)
   ========================================================================== */
.cd-intro-section { 
    padding: clamp(40px, 8vw, 80px) 0; 
}

.cd-grid-intro {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Reorganización orgánica */
    gap: 40px;
    align-items: center;
}

.cd-intro-text p { 
    margin-bottom: 20px; 
    font-size: 1.05rem; 
    color: #555; 
}

.cd-intro-visual img { 
    width: 100%; 
    max-width: 420px; 
    display: block; 
    margin: 0 auto; 
    filter: drop-shadow(0 15px 30px rgba(0,0,0,0.12)); 
}

/* ==========================================================================
   4. SHOWCASE DE MODELOS (TARJETAS EN REJILLA)
   ========================================================================== */
.cd-full-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: 380px;
}

.cd-model-card {
    position: relative;
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

.cd-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
    color: #fff;
    transition: all 0.4s ease;
}

.cd-model-card:hover .cd-card-overlay { 
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.5) 100%); 
}

.cd-card-overlay h3 { 
    font-size: 0.95rem; 
    margin-bottom: 8px; 
    line-height: 1.4; 
    font-weight: 400;
}

.cd-card-overlay p { 
    font-weight: 800; 
    text-transform: uppercase; 
    color: #c5a47e; 
    letter-spacing: 0.5px;
    margin: 0;
}

/* ==========================================================================
   5. TABLA COMPARATIVA PREMIUM (PROTECCIÓN CONTRA DESBORDES)
   ========================================================================== */
.cd-comparison-table { 
    padding: clamp(40px, 8vw, 80px) 0;
    background-color: #fafafa;
}

.cd-section-title { 
    text-align: center; 
    margin-bottom: 30px; 
    font-size: clamp(1.4rem, 4vw, 2.2rem);
    font-weight: 800; 
    color: #1a1a1a; 
}

/* Wrapper deslizante para el dedo */
.cd-table-wrapper {
    width: 100%;
    overflow-x: auto; 
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    -webkit-overflow-scrolling: touch; /* Inercia fluida en iOS */
}

.cd-exact-table { 
    width: 100%; 
    border-collapse: separate; /* Obligatorio para que funcione 'sticky' de forma limpia */
    border-spacing: 0;
    min-width: 800px; /* Impide que las columnas de datos colapsen */
}

.cd-exact-table th {
    padding: 15px 10px;
    background: #ffffff;
    border-bottom: 2px solid #eef0f2;
}

.cd-exact-table th img { 
    height: 70px; 
    width: auto;
    display: block; 
    margin: 0 auto 10px; 
    object-fit: contain;
}

.cd-model-title { 
    display: block; 
    font-size: 0.8rem; 
    color: #1a1a1a; 
    font-weight: 800;
}

.cd-exact-table td { 
    padding: 14px 10px; 
    text-align: center; 
    border-bottom: 1px solid #f0f0f0; 
    font-size: 0.85rem; 
    color: #555;
    background: #ffffff; /* Evita transparencias al mover el scroll */
}

/* --------------------------------------------------------------------------
   SOLUCIÓN MAESTRA: ANCLAJE Y CAPAS PARA MÓVILES (PRIMERA COLUMNA FIXED)
   -------------------------------------------------------------------------- */

/* Fuerza a la primera celda de cualquier fila del cuerpo a quedarse fija a la izquierda */
.cd-exact-table tbody tr td:first-child,
.cd-feature-name { 
    text-align: left !important; 
    font-weight: 700 !important; 
    color: #1a1a1a !important; 
    background-color: #ffffff !important; /* Capa blanca sólida que bloquea la visión trasera */
    position: sticky !important; 
    left: 0 !important;
    z-index: 10 !important; /* Capa superior sobre los datos */
    box-shadow: 4px 0 8px rgba(0, 0, 0, 0.04) !important; /* Sombra que indica scroll */
    border-right: 1px solid #eaeaea !important;
    width: 210px !important; 
    min-width: 210px !important;
}

/* Asegura el mismo comportamiento en la esquina vacía superior izquierda */
.cd-exact-table thead tr th:first-child,
.cd-feature-column {
    position: sticky !important;
    left: 0 !important;
    background-color: #ffffff !important;
    z-index: 11 !important; /* Un nivel por encima para intersecciones */
    border-right: 1px solid #eaeaea !important;
    width: 210px !important;
    min-width: 210px !important;
}

/* Forzar fuentes correctas en la primera celda */
.cd-exact-table tbody tr td:first-child {
    font-size: 0.85rem !important;
}

/* Iconos de estado */
.icon-check, .cd-check { 
    color: #28a745; 
    font-weight: bold; 
    font-size: 1.1rem;
}
.icon-cross { 
    color: #dc3545; 
    font-weight: bold; 
    font-size: 1.1rem;
}

/* ==========================================================================
   6. MEDIAS QUERIES (BREAKPOINTS RESPONSIVE)
   ========================================================================== */

/* Tablets Horizontales y Laptops */
@media (max-width: 1024px) {
    .cd-full-grid { 
        grid-template-columns: repeat(2, 1fr); 
        height: auto; 
    }
    .cd-model-card { 
        height: 280px; 
    }
}

/* Tablets Verticales */
@media (max-width: 768px) {
    .cd-grid-intro { 
        grid-template-columns: 1fr; 
        text-align: center; 
        gap: 30px;
    }
    .cd-intro-visual img {
        max-width: 320px;
    }
    .cd-hero {
        height: 50vh;
        min-height: 350px;
    }
}

/* Smartphones (Modo Vertical) */
@media (max-width: 480px) {
    .cd-full-grid { 
        grid-template-columns: 1fr; /* Una tarjeta por línea para mejor legibilidad */
    }
    .cd-model-card { 
        height: 220px; 
    }
    .cd-card-overlay {
        padding: 16px;
    }
    .cd-comparison-table {
        padding: 40px 0;
    }
}