/* =========================================
   MIRROR DESKTOP CONTENT — KTSA Website
   
   Filosofía: Mostrar el MISMO contenido que desktop
   en toda pantalla, pero dejar que el LAYOUT se
   adapte naturalmente al tamaño del dispositivo.
   
   - Contenido: títulos desktop, todos los párrafos → visible siempre
   - Layout: fluido y responsivo (se apila en móvil)
   - Tipografía: fluid con clamp() para cualquier pantalla
   - Overflow: nunca se desborda del viewport
   
   Carga DESPUÉS de fixes.css.
   Para revertir: comentar el <link> en index.html.
   ========================================= */


/* ===========================================
   0. GLOBAL — Prevenir overflow horizontal
      que es la causa raíz del footer cortado
      y elementos descentrados.
   =========================================== */

/* life-text-box compact spacing — ALL screen sizes */
.life-text-box {
  min-height: auto !important;
  padding: 20px 18px 18px !important;
  gap: 6px !important;
}
.life-text-box p {
  margin: 8px 0 !important;
}

@media (max-width: 1024px) {
  /* --- A. Todo elemento debe respetar el viewport --- */
  *, *::before, *::after {
    box-sizing: border-box !important;
  }
  
  /* --- B. Elementos con anchos fijos que desbordan --- */
  .why-logo img {
    width: clamp(340px, 80vw, 500px) !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
  }
  
  /* life-text-box: keep desktop overlap layout, just cap max-width */
  .life-text-box {
    max-width: min(480px, calc(100vw - 32px)) !important;
  }
  
  /* --- C. Paddings excesivos en carouseles --- */
  .testimonials-carousel-wrapper {
    padding-left: 36px !important;
    padding-right: 36px !important;
  }
  
  .blogs-carousel-wrapper,
  .blogs-section-full .blogs-carousel-wrapper {
    padding-left: 36px !important;
    padding-right: 36px !important;
  }
  
  /* --- D. Textos que no deben hacer wrap --- */
  .btn-outline,
  .hero-cta-btn,
  .why-cta-btn,
  .life-cta-btn,
  .wwd-banner-cta,
  .footer-btn {
    white-space: normal !important;
    word-wrap: break-word !important;
  }

  /* --- D2. Hero CTA: compact like desktop --- */
  .hero-cta-btn {
    width: auto !important;
    min-height: auto !important;
    padding: 8px 24px !important;
    font-size: 14px !important;
  }
  
  /* --- E. EVP panel padding excesivo --- */
  .evp-panel {
    padding: 16px !important;
    gap: 16px !important;
    grid-template-columns: 1fr !important;
  }
  
  /* --- F. Overflow correcto (clip, no hidden) --- */
  /* --- F. NO overflow on html/body — let the viewport scroll naturally.
       Only individual sections clip their own overflow.
       Setting overflow-x on html or body can create a scroll container
       that miscalculates total scrollable height on mobile browsers. --- */
  
  section {
    overflow-x: clip !important;
    overflow-y: visible !important;
  }
  
  main, #main-content {
    overflow: visible !important;
    height: auto !important;
  }
  
  /* --- G. Footer siempre visible --- */
  footer,
  footer.footer-gris {
    display: block !important;
    visibility: visible !important;
    overflow: visible !important;
    position: relative !important;
    height: auto !important;
    max-height: none !important;
  }
  
  /* --- H. Mas-hero overflow --- */
  .ktsa-mas .mas-hero {
    overflow: visible !important;
    min-height: auto !important;
  }
  
  /* --- I. Hero: clip not hidden (avoid scroll container) --- */
  .hero {
    overflow: clip !important;
  }
  
  /* --- J. Catch-all: no direct child of body wider than viewport --- */
  body > header,
  body > nav,
  body > main,
  body > footer,
  body > .sideNavigationBar {
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }
}


/* ===========================================
   1. HERO — Siempre mostrar .hero-content
      (ocultar versión móvil simplificada)
   =========================================== */

/* --- 1-A. TÍTULOS HOMOLOGADOS EN MÓVIL ---
   Todos los títulos de sección usan el mismo clamp
   para que se vean del mismo tamaño en móvil. */
@media (max-width: 1024px) {
  .hero h1,
  .hero-main-title,
  .why-title,
  .why-title-desktop,
  .wwd-title,
  .wwd-title-desktop,
  .life-title,
  .life-title-desktop,
  .evp-title,
  .evp-title-desktop,
  .mas-title,
  .voices-title {
    font-size: clamp(24px, 5.5vw, 36px) !important;
    line-height: 1.2 !important;
  }
  
  /* Spans internos heredan tamaño del padre */
  .why-title span,
  .wwd-title span,
  .life-title span,
  .evp-title span,
  .evp-title .accent,
  .evp-title .evp-title-accent,
  .evp-title-desktop span,
  .evp-title-desktop .accent,
  .evp-title-desktop .evp-title-accent,
  .evp-blue,
  .evp-cyan,
  .mas-title span,
  .voices-title span {
    font-size: inherit !important;
  }
}

@media (max-width: 1024px) {
  .hero .hero-content {
    display: block !important;
  }
  .hero .hero-mobile-text {
    display: none !important;
  }
  .hero-mobile-box {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .hero p br {
    display: none;
  }
}


/* ===========================================
   1-B. FEATURE BAND — Alineación desktop
        (styles.css centra todo a ≤768px;
         override para mantener layout desktop)
   =========================================== */

@media (max-width: 1024px) {
  /* Mantener alineación izquierda como desktop */
  .feature-band .contenido-izquierda,
  .feature-band .contenido-derecha {
    text-align: left !important;
  }

  /* Subtítulo "WHAT SETS US APART" centrado en móvil */
  .feature-band .feature-band-subtitle {
    text-align: center !important;
  }

  .feature-band .title-multiline,
  h2.title-multiline.feature-band-main-title {
    text-align: left !important;
    line-height: 0.8 !important;
    font-size: clamp(42px, 5.5vw, 60px) !important;
  }

  .feature-band .botones {
    justify-content: flex-start !important;
  }

  /* Contenido derecho: justificar texto como desktop */
  .feature-band .contenido-derecha p {
    text-align: justify !important;
  }
}


/* ===========================================
   2. WHY KTSA — Mostrar contenido desktop
   =========================================== */

@media (max-width: 1024px) {
  .why-ktsa .why-title-desktop,
  .why-ktsa .why-card-desktop {
    display: block !important;
  }
  .why-ktsa .why-logo {
    display: flex !important;
  }
  .why-ktsa .why-title-mobile,
  .why-ktsa .why-card-mobile {
    display: none !important;
  }
}


/* ===========================================
   3. WHAT WE DO — Títulos desktop + cards 
      estilo desktop (sin acordeón)
   =========================================== */

@media (max-width: 1024px) {
  .wwd-title-desktop,
  .wwd-subtitle-desktop {
    display: block !important;
  }
  .wwd-title-mobile,
  .wwd-subtitle-mobile {
    display: none !important;
  }
}

/* Cards: grid 2×2 con estilo desktop (no acordeón) */
@media (max-width: 1024px) {
  .what-we-do .wwd-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }
  
  .wwd-card {
    perspective: none !important;
    height: auto !important;
    aspect-ratio: auto !important;
    min-height: 280px !important;
    background: var(--white) !important;
    border: 3px solid #1E49E2 !important;
    overflow: hidden !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
    border-radius: 0 !important;
    cursor: default !important;
  }
  
  .wwd-card-inner {
    transform: none !important;
    transform-style: flat !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
  }
  
  .wwd-card-front {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    padding: 18px 14px 10px !important;
    border: none !important;
    box-shadow: none !important;
    background: var(--white) !important;
    backface-visibility: visible !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    text-align: left !important;
    flex-shrink: 0 !important;
  }
  
  .wwd-card-front::before {
    display: block !important;
    left: 0 !important;
    top: 70px !important;
    height: 36px !important;
    width: 8px !important;
    background: #1E49E2 !important;
    border-radius: 0 !important;
  }
  
  .wwd-card-back {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    flex: 1 !important;
    transform: none !important;
    backface-visibility: visible !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 14px 16px !important;
    align-items: flex-start !important;
    text-align: left !important;
    justify-content: space-between !important;
    color: inherit !important;
  }
  
  .wwd-card-back .wwd-card-title {
    display: none !important;
  }
  
  .wwd-card-back .wwd-card-text {
    color: #333 !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
    margin-bottom: 12px !important;
    flex: 1 !important;
    min-height: auto !important;
    padding-bottom: 0 !important;
  }
  
  .wwd-card-icon {
    width: 44px !important;
    height: 44px !important;
    border: 3px solid #1E49E2 !important;
    border-radius: 50% !important;
    display: grid !important;
    margin-bottom: 12px !important;
    background: transparent !important;
  }
  
  .wwd-card-front .wwd-card-title {
    font-size: 16px !important;
    margin: 0 0 12px !important;
    line-height: 1.25 !important;
    font-weight: 700 !important;
  }
  
  .flip-hint {
    display: none !important;
  }
}

/* Móvil: cards más compactas */
@media (max-width: 640px) {
  .what-we-do .wwd-grid {
    gap: 10px !important;
  }
  
  .wwd-card {
    aspect-ratio: auto !important;
    min-height: 220px !important;
  }
  
  .wwd-card-front {
    padding: 12px 10px 6px !important;
  }
  
  .wwd-card-icon {
    width: 32px !important;
    height: 32px !important;
  }
  
  .wwd-card-front .wwd-card-title {
    font-size: 12px !important;
    margin: 0 0 8px !important;
  }
  
  .wwd-card-back .wwd-card-text {
    font-size: 10.5px !important;
    line-height: 1.4 !important;
  }
  
  .wwd-card-back {
    padding: 0 10px 12px !important;
  }
  
  .wwd-card-front::before {
    top: 56px !important;
    height: 28px !important;
    width: 6px !important;
  }
}

/* <380px: 1 columna */
@media (max-width: 380px) {
  .what-we-do .wwd-grid {
    grid-template-columns: 1fr !important;
  }
  
  .wwd-card {
    aspect-ratio: auto !important;
    min-height: 260px !important;
  }
}


/* ===========================================
   4. LIFE AT KTSA — Título desktop + todos
      los párrafos visibles + layout overlap
   =========================================== */

@media (max-width: 1024px) {
  .life-ktsa .life-title-desktop {
    display: block !important;
  }
  .life-ktsa .life-title-mobile {
    display: none !important;
  }
  
  /* Mostrar TODOS los párrafos como en desktop */
  .life-text-box p:not(.life-lead) {
    display: block !important;
  }
  
  /* Image must be wide enough and tall enough to be visible behind box */
  .life-media {
    width: 100% !important;
    height: auto !important;
    min-height: 300px !important;
  }
  
  .life-media img {
    width: 100% !important;
    height: auto !important;
    min-height: 300px !important;
    object-fit: cover !important;
  }
  
  /* Text box: preserve desktop overlap at bottom-right + compact spacing */
  .life-text-box {
    position: absolute !important;
    bottom: 0 !important;
    right: 0 !important;
    left: auto !important;
    width: 50% !important;
    max-width: min(480px, calc(100vw - 32px)) !important;
    box-sizing: border-box !important;
    min-height: auto !important;
    padding: 20px 18px 18px !important;
    gap: 6px !important;
  }
  .life-text-box p {
    margin: 8px 0 !important;
  }
}

/* smaller phones: box takes more width but still overlaps */
@media (max-width: 640px) {
  .life-text-box {
    width: 70% !important;
    padding: 16px 14px !important;
    min-height: auto !important;
    gap: 4px !important;
  }
  .life-text-box p {
    margin: 6px 0 !important;
  }
  
  .life-text-box p:not(.life-lead) {
    font-size: 12px !important;
    line-height: 1.5 !important;
  }
  
  .life-text-box .life-lead {
    font-size: 14px !important;
  }
  
  .life-media {
    min-height: 480px !important;
  }
  
  .life-media img {
    min-height: 480px !important;
  }
}

/* iPhone SE and very narrow: stack vertically */
@media (max-width: 380px) {
  .life-content {
    display: flex !important;
    flex-direction: column !important;
  }
  
  .life-media {
    width: 100% !important;
    min-height: 200px !important;
    height: auto !important;
  }
  
  .life-media img {
    min-height: 200px !important;
    height: auto !important;
  }
  
  .life-text-box {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    bottom: auto !important;
    right: auto !important;
    min-height: auto !important;
    padding: 16px 14px !important;
    gap: 4px !important;
  }
  .life-text-box p {
    margin: 6px 0 !important;
  }
}


/* ===========================================
   5. EVP — Título y texto desktop + fix
      overflow del accent a 48px
   =========================================== */

@media (max-width: 1024px) {
  .evp-title-desktop,
  .evp-text-desktop {
    display: block !important;
  }
  .evp-title-mobile,
  .evp-text-mobile {
    display: none !important;
  }
  
  /* font-size now set by unified title rule in section 1-A */
  .evp-title,
  .evp-title-desktop {
    text-align: left !important;
  }
}


/* ===========================================
   6. VOICES — Título desktop visible
   =========================================== */

/* NOTE: voices-blogs.css carga DESPUÉS de este archivo.
   Los overrides finales de Voices (alineación, grid) están
   en el <style> inline de index.html que es lo último. */

@media (max-width: 1024px) {
  .voices-title .voices-title-desktop {
    display: inline !important;
  }
  .voices-title > .t-pink {
    display: inline !important;
  }
  .voices-title .voices-title-mobile {
    display: none !important;
  }
  .voices-subtitle.voices-subtitle-desktop {
    display: block !important;
  }
  .video-description {
    display: block !important;
  }
  .video-description-mobile {
    display: none !important;
  }
}


/* ===========================================
   7. FOOTER — Todo visible, nada cortado
   =========================================== */

@media (max-width: 1024px) {
  /* Ensure footer itself is never clipped */
  .footer-gris {
    overflow: visible !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Stack all columns in 1 column on phones */
  .footer-wrap {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  /* All columns full-width */
  .footer-col {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  /* Badges row: wrap and scale */
  .footer-badges {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }
  
  .footer-badges img {
    height: auto !important;
    max-height: 60px !important;
    max-width: 45% !important;
    object-fit: contain !important;
  }

  /* Legal section fully visible */
  .footer-legal {
    overflow: visible !important;
    width: 100% !important;
    box-sizing: border-box !important;
    /* Safe-area padding for iPhones with home indicator / Android gesture bar */
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)) !important;
  }
  
  .footer-legal p {
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Long email link can break */
  .col-contact a {
    word-break: break-all !important;
  }
}
