/* ============================================================
   MOBILE.CSS — HERMANOS ALCARAZ TORROGLOSA
   Responsive styles — todas las páginas
   ============================================================ */

/* ══════════════════════════════════════════════════
   TABLET (≤1024px)
   ══════════════════════════════════════════════════ */
@media (max-width: 1024px) {

  /* NAV */
  .nav-item > a { padding: 0 14px; font-size: 12px; }

  /* INDEX */
  .somos { padding: 4rem 2rem; }
  .somos-grid { grid-template-columns: 1fr; gap: 3rem; }
  .somos-desc { max-width: 100%; }

  /* TARJETAS FLIP (index) — 4 tarjetas en 2x2 antes de pasar a 1 columna en móvil */
  .sv-cards-grid { grid-template-columns: repeat(2, 1fr); }

  /* FOOTER */
  .footer-main { grid-template-columns: 1fr 1fr; gap: 2rem; }
}

/* ══════════════════════════════════════════════════
   MÓVIL (≤768px)
   ══════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── TOPBAR ── */
  .topbar-inner { justify-content: center; gap: 1.4rem; flex-wrap: wrap; }
  .topbar-item:first-child { display: none; } /* Acceso clientes */
  .topbar-item { font-size: 11px; }

  /* ── HEADER ── */
  .header-inner { padding: 0 1.2rem; grid-template-columns: auto 1fr auto; }
  .logo-img { height: 30px; }
  .hamburger { display: flex; }

  /* ══ NAV MÓVIL — PANEL ══ */
  .nav {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 100vw;
    justify-self: stretch;
    background: linear-gradient(165deg, #00103A 0%, #00103A 100%);
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(.22,1,.36,1);
    overflow-y: auto; overflow-x: hidden;
    z-index: 1100;
    padding: 0;
    display: flex; flex-direction: column;
  }
  .nav.open { transform: translateX(0); }

  /* Banda superior del panel */
  .nav::before {
    content: '';
    display: block;
    height: 70px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.15);
  }

  /* Botón X de cierre */
  .nav-close {
    display: flex;
    position: absolute; top: 0; right: 0;
    width: 70px; height: 70px;
    align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    color: rgba(255,255,255,0.6); font-size: 20px;
    transition: color 0.2s, transform 0.25s;
    z-index: 10;
  }
  .nav-close:hover,
  .nav-close:active { color: #fff; transform: rotate(90deg); }

  /* Overlay oscuro detrás del panel */
  .nav-overlay {
    display: block;
    position: fixed; top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 1090;
    opacity: 0; visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .nav-overlay.open { opacity: 1; visibility: visible; }

  /* Lista de ítems */
  .nav-list { flex-direction: column; gap: 0; padding: 0.6rem 0 0; flex: 0 0 auto; }
  .nav-chevron { display: inline-block; }
  .desktop-chevron { display: none; }

  /* Animación de entrada */
  .nav-item {
    opacity: 0; transform: translateX(-18px);
    transition: opacity 0.32s ease, transform 0.32s ease;
    position: relative;
    border-bottom: 1px solid rgba(255,255,255,0.07);
  }
  .nav.open .nav-item { opacity: 1; transform: translateX(0); }
  .nav.open .nav-item:nth-child(1) { transition-delay: 0.07s; }
  .nav.open .nav-item:nth-child(2) { transition-delay: 0.13s; }
  .nav.open .nav-item:nth-child(3) { transition-delay: 0.19s; }
  .nav.open .nav-item:nth-child(4) { transition-delay: 0.25s; }

  /* Enlace principal de cada ítem */
  .nav-item > a {
    height: auto; line-height: 1.1;
    padding: 18px 1.4rem;
    border-bottom: none;
    font-family: var(--font-cond);
    font-size: 22px; font-weight: 800; letter-spacing: 0.02em;
    color: rgba(255,255,255,0.9);
    display: flex; align-items: center; justify-content: center;
    text-align: center;
    transition: color 0.22s ease, background 0.22s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .nav-item > a:active { background: rgba(255,255,255,0.04); }

  /* Ítems con dropdown: centrar texto + chevron pegado a la derecha */
  .nav-item.has-dropdown > a {
    justify-content: center;
    position: relative;
  }
  .nav-item.has-dropdown > a .nav-chevron {
    font-size: 17px;
    color: rgba(255,255,255,0.3);
    transition: transform 0.3s ease, color 0.3s ease;
    position: absolute; right: 1.4rem;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    padding: 14px; margin: -14px;
  }
  .nav-item.has-dropdown.open > a .nav-chevron {
    transform: rotate(180deg);
    color: var(--rojo);
  }
  .nav-item.has-dropdown.open > a { color: var(--rojo); }

  /* Dropdown de primer nivel */
  .dropdown {
    position: static; opacity: 1; visibility: visible;
    transform: none; border-top: none;
    background: rgba(0,0,0,0.2);
    margin: 0; padding: 0;
    max-height: 0; overflow: hidden;
    transition: max-height 0.38s cubic-bezier(.22,1,.36,1);
  }
  .nav-item.open > .dropdown { max-height: 500px; }

  .dropdown li { border-bottom: 1px solid rgba(255,255,255,0.05); }
  .dropdown li:last-child { border-bottom: none; }
  .dropdown li > a {
    padding: 15px 1.6rem;
    font-family: 'Archivo Narrow', sans-serif;
    font-size: 14px; font-weight: 600; letter-spacing: 0.04em;
    color: rgba(255,255,255,0.75);
    text-transform: none;
    display: flex; align-items: center; justify-content: center;
    text-align: center;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
  }
  .dropdown li > a:active { color: #fff; background: rgba(255,255,255,0.04); }

  /* Subdropdown */
  .subdropdown {
    position: static; opacity: 1; visibility: visible;
    transform: none;
    max-height: 0; overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0,0,0,0.18);
  }
  .has-subdropdown.open > .subdropdown { max-height: 300px; }

  .has-subdropdown > a {
    position: relative;
  }
  .has-subdropdown > a .nav-chevron {
    font-size: 14px;
    color: rgba(255,255,255,0.3);
    transition: transform 0.3s ease, color 0.3s ease;
    position: absolute; right: 1.6rem;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    padding: 14px; margin: -14px;
  }
  .has-subdropdown.open > a .nav-chevron { transform: rotate(180deg); color: var(--rojo); }

  .subdropdown li > a {
    padding: 14px 1.6rem;
    font-size: 13px; font-weight: 500;
    color: rgba(255,255,255,0.6);
    text-align: center; justify-content: center;
  }
  .subdropdown li > a:active { color: #fff; }

  /* Pie del panel */
  .nav-footer {
    display: block;
    margin-top: auto;
    padding: 1.4rem 1.6rem 2rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    opacity: 0;
    transition: opacity 0.4s ease 0.28s;
  }
  .nav.open .nav-footer { opacity: 1; }
  .nav-footer-item {
    display: flex; align-items: center; gap: 10px;
    font-family: 'Archivo Narrow', sans-serif; font-size: 13px;
    color: rgba(255,255,255,0.5); margin-bottom: 10px;
  }
  .nav-footer-item .ti { color: var(--rojo); font-size: 15px; flex-shrink: 0; }
  .nav-footer-item:last-child { margin-bottom: 0; }
  .nav-footer-item-highlight {
    background: rgba(218,41,28,0.12); border: 1px solid var(--rojo);
    border-radius: 4px; padding: 10px 12px; margin-bottom: 14px;
    color: #fff; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; transition: background 0.2s;
  }
  .nav-footer-item-highlight:active { background: rgba(218,41,28,0.25); }
  .nav-footer-item-highlight .ti { color: #fff; }

  /* ── HERO (index) ── */
  .hero { height: 75vw; min-height: 340px; max-height: 520px; }
  .hero-video { object-position: center bottom; transform: scale(1.35); transform-origin: center bottom; }
  .hero-title { font-size: clamp(22px, 7.5vw, 44px); margin-bottom: 2rem; }
  .hero-cta { width: 42px; height: 42px; font-size: 19px; }

  /* ── SOMOS (index) ── */
  .somos { padding: 3rem 1.2rem; }
  .somos-claim { font-size: 28px; line-height: 1.1; }
  .somos-desc { font-size: 15px; line-height: 1.75; }
  .somos-cifras { gap: 0.75rem; }
  .somos-cifra { padding: 1.2rem 1.4rem; }
  .somos-cifra-num { font-size: 36px; }
  .somos-cifra-icon { font-size: 22px; }
  .somos-cifra-label { font-size: 13px; }

  /* ── FLIP CARDS (index + servicios) ── */
  .sv-flip-section { padding: 2rem 1rem 3.5rem; }
  .sv-flip-label { padding: 0 0 1.2rem 4px; }
  .sv-cards-grid { grid-template-columns: 1fr; gap: 10px; }
  .sv-flip-card { aspect-ratio: 5/3; }
  .sv-flip-back { padding: 1.8rem 1.6rem; }
  .sv-flip-back-title { font-size: 20px; margin-bottom: 0.5rem; }
  .sv-flip-back-text { font-size: 13px; margin-bottom: 1rem; line-height: 1.6; }
  .sv-flip-back-btn { padding: 9px 20px; font-size: 10px; }

  /* ── FOOTER ── */
  /* FOOTER MÓVIL — Opción C: centrado, 3 cols de links compactas */
  .footer-main {
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    padding: 2rem 1.2rem 1.4rem;
    align-items: start;
  }
  /* Brand: fila completa centrada encima de los links */
  .footer-brand {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-bottom: 1.4rem;
    margin-bottom: 1.4rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .footer-logo-wrap { margin-bottom: 0; }
  .footer-logo { height: 30px; }
  .footer-divider { margin: 0.5rem auto 0.6rem; }
  .footer-address {
    font-size: 11px; line-height: 1.75; margin-bottom: 0.8rem;
    color: rgba(255,255,255,0.4);
    white-space: normal; text-align: center;
  }
  .footer-social { justify-content: center; margin-top: 0; }
  /* Las 3 columnas de links */
  .footer-col:not(.footer-brand) {
    padding: 0 3px;
  }
  .footer-heading {
    font-size: 10px; letter-spacing: 0.1em;
    margin-bottom: 0.7rem; padding-bottom: 5px;
    color: #DA291C; border-bottom-color: #DA291C;
  }
  .footer-links li { margin-bottom: 6px; }
  .footer-links a {
    font-size: 11.5px; line-height: 1.45;
    color: rgba(255,255,255,0.4);
    display: block;
  }
  .footer-links a::before { display: none; }
  .footer-nextgen { padding: 1.2rem 1.4rem; }
  .footer-nextgen p { font-size: 10.5px; }

  /* ── QUIÉNES SOMOS: tab bar sticky ──
     El header mide 75px; la tab bar se pega justo debajo */
  .qs-tabs { top: 75px !important; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .qs-tab { padding: 14px 22px; font-size: 11px; white-space: nowrap; }

  /* ── QUIÉNES SOMOS: Dashboard grupo en móvil ── */
  .gd-grid-area { grid-template-columns: 1fr 1fr !important; }
  .gd-card { height: 160px !important; }
  .gd-container { padding: 0 1.2rem !important; gap: 20px !important; }
  .gd-panel-sticky { padding: 2rem 1.5rem !important; min-height: 300px !important; }
  .gd-panel { top: 2rem !important; left: 1.5rem !important; right: 1.5rem !important; bottom: 2rem !important; }
  .gd-panel-title { font-size: 36px !important; }
  .gd-panel-desc { font-size: 15px !important; }

  /* ── LAVADERO: mapa side-by-side → apilado ── */
  .lv-mapas-grid { grid-template-columns: 1fr !important; }
  .lv-mapa-frame { height: 220px; }
  .lv-mapas { padding: 3rem 1.5rem; }

  /* ── CONTACTO: formulario full width ── */
  .ct-hero { grid-template-columns: 1fr; }
  .ct-hero-left { min-height: 200px; }
  .ct-hero-right { padding: 3rem 1.5rem; }
  .ct-body { grid-template-columns: 1fr; }
  .ct-info {
    border-right: none; border-bottom: 1px solid #c8cde3;
    padding: 2.5rem 1.4rem;
    flex-direction: row; flex-wrap: wrap; gap: 1.5rem;
  }
  .ct-form-wrap { padding: 2.5rem 1.4rem; }
  .ct-map-section { grid-template-columns: 1fr; }
  .ct-map-placeholder { border-right: none; border-bottom: 1px solid #c8cde3; }
  .ct-map-info { padding: 2rem 1.4rem; }
}

/* ══════════════════════════════════════════════════
   MÓVIL PEQUEÑO (≤480px)
   ══════════════════════════════════════════════════ */
@media (max-width: 480px) {

  /* Topbar oculto */
  .topbar { display: none; }

  /* Header */
  .header-inner { padding: 0 1rem; }
  .logo-img { height: 26px; }

  /* Hero */
  .hero { height: 82vw; min-height: 300px; max-height: 440px; }
  .hero-video { object-position: center bottom; transform: scale(1.35); transform-origin: center bottom; }
  .hero-title { font-size: clamp(20px, 8.5vw, 32px); letter-spacing: 0.03em; }

  /* Nav: fuente más pequeña en pantallas estrechas */
  .nav-item > a { font-size: 20px; padding: 16px 1.2rem 16px 1.4rem; }
  .dropdown li > a { padding: 14px 1.2rem 14px 1.8rem; }
  .subdropdown li > a { padding: 13px 1.2rem 13px 2.4rem; }

  /* Somos */
  .somos { padding: 2.5rem 1rem; }
  .somos-eyebrow { font-size: 9px; }
  .somos-claim { font-size: 24px; }
  .somos-desc { font-size: 14px; }
  .somos-cifra { padding: 1rem 1.2rem; }
  .somos-cifra-num { font-size: 32px; }
  .somos-cifra-icon { font-size: 20px; }
  .somos-cifra-label { font-size: 12px; }

  /* Flip cards */
  .sv-flip-section { padding: 1.6rem 0.8rem 3rem; }
  .sv-cards-grid { gap: 8px; }
  .sv-flip-card { aspect-ratio: 4/3; }
  .sv-flip-back-title { font-size: 18px; }
  .sv-flip-back-text { font-size: 12px; }

  /* Footer */
  .footer-main { padding: 1.6rem 0.8rem 1.2rem; }
  .footer-brand { padding-bottom: 1.2rem; margin-bottom: 1.2rem; }
  .footer-logo { height: 26px; }
  .footer-heading { font-size: 8px; letter-spacing: 0.1em; }
  .footer-links a { font-size: 9.5px; }
  .footer-address { font-size: 9.5px; }
  .footer-nextgen { padding: 1rem 0.8rem; }

  /* ── QUIÉNES SOMOS ── */
  /* Tab bar: más compacta */
  .qs-tabs { top: 68px !important; }
  .qs-tab { padding: 12px 16px; font-size: 10px; letter-spacing: 0.12em; }

  /* Dashboard grupo: una columna en pantallas muy pequeñas */
  .gd-grid-area { grid-template-columns: 1fr !important; }
  .gd-card { height: 140px !important; }
  .gd-title { font-size: 22px; }
  .gd-panel-num { font-size: 50px !important; }
  .gd-panel-title { font-size: 28px !important; }

  /* MVV/Valores: padding reducido */
  .mvv-hd { padding: 2.5rem 1rem 2rem !important; }
  .mv-card { padding: 2rem 1.2rem !important; min-height: 300px !important; }
  .mv-title { font-size: 26px !important; }
  .mv-txt { font-size: 14px !important; }
  .val-item { padding: 2rem 1.2rem !important; min-height: 240px !important; }

  /* ── SERVICIOS ── */
  /* Hero: la columna de stats apiladas */
  .sv-hero { padding: 2.5rem 1rem !important; }
  .sv-h1 { font-size: clamp(36px, 10vw, 48px) !important; }
  .sv-hero-desc { font-size: 14px !important; }
  .sv-hero-stat { padding: 0.9rem 1rem !important; gap: 0.8rem !important; }
  .sv-hero-stat-num { font-size: 30px !important; min-width: 60px !important; }

  /* Grid de tarjetas de servicio */
  .sv-card { min-height: 240px !important; padding: 1.6rem !important; }
  .sv-card-title { font-size: 24px !important; }
  .sv-card-txt { font-size: 13px !important; }
  .sv-card-num { font-size: 60px !important; }

  /* ── TRANSPORTE ── */
  .tr-hero { padding: 2.5rem 1rem !important; }
  .tr-h1 { font-size: clamp(36px, 10vw, 52px) !important; }
  .tr-hero-desc { font-size: 15px !important; }
  .tr-hero-feats { gap: 8px; }
  .tr-hero-feat { padding: 12px 14px; }
  .tr-section { padding: 2.5rem 1rem !important; }
  .tr-fotos-grid { grid-template-columns: 1fr !important; gap: 4px !important; }
  .tr-foto { aspect-ratio: 16/9; }
  .tr-productos { padding: 2.5rem 1rem !important; }
  .tr-prod-grid { grid-template-columns: 1fr 1fr !important; gap: 4px !important; }
  .tr-prod {
    min-height: 200px !important;
    /* En vez de anclar el contenido al fondo (como en escritorio), en móvil
       se ancla arriba: así el icono queda siempre a la misma altura en
       todas las tarjetas, sea cual sea la longitud del texto de debajo
       (p. ej. "Productos para construcción" tiene 3 líneas frente a las
       2 líneas del resto, y eso empujaba su icono hacia arriba). */
    justify-content: flex-start !important;
    padding-top: 1.8rem !important;
  }
  .tr-prod-svg { margin-bottom: 0.8rem !important; }
  .tr-prod-name { font-size: 14px; }
  .tr-prod-items { font-size: 11px; padding-bottom: 1.2rem !important; }
  .tr-conductores-cta { padding: 2.5rem 1rem !important; gap: 1.5rem !important; }
  .tr-cta-btn { width: 100%; justify-content: center; }

  /* ── LAVADERO ── */
  .lv-hero { padding: 2.5rem 1rem !important; }
  .lv-h1 { font-size: clamp(36px, 10vw, 52px) !important; }
  .lv-hero-desc { font-size: 15px !important; }
  .lv-hero-badges { gap: 8px; margin-top: 1.8rem; }
  .lv-badge { font-size: 10px; padding: 7px 14px; }
  .lv-inst { padding: 2rem 1.2rem !important; }
  .lv-inst-foto { height: 260px; }
  .lv-stats { grid-template-columns: 1fr 1fr !important; }
  .lv-stat { padding: 1.8rem 1rem; }
  .lv-stat-num { font-size: 36px; }
  .lv-proceso { padding: 2.5rem 1rem !important; }
  .lv-pasos { grid-template-columns: 1fr !important; }
  .lv-paso { border-right: none !important; border-top: 1px solid #c8cde3; padding: 1.8rem 1rem !important; }
  .lv-paso:first-child { border-top: none; }
  .lv-paso::after { display: none !important; }
  .lv-servicios { padding: 2.5rem 1rem !important; }
  .lv-servicios-grid { grid-template-columns: 1fr !important; }
  .lv-mapas { padding: 2.5rem 1rem !important; }
  .lv-mapa-card { padding: 1.6rem 1.2rem; }
  .lv-mapa-frame { height: 200px; }

  /* ── AGENCIA ── */
  .ag-hero { padding: 2.5rem 1rem !important; min-height: auto !important; }
  .ag-equipo { padding: 2.5rem 1rem !important; }
  .ag-equipo-grid { grid-template-columns: 1fr !important; }
  .ag-persona-foto { height: 220px !important; }
  .ag-servicios { padding: 2.5rem 1rem !important; }
  .ag-sv-grid { grid-template-columns: 1fr !important; }
  .ag-valores { padding: 2.5rem 1rem !important; }
  .ag-valores-grid { grid-template-columns: 1fr !important; }
  .ag-cifras { padding: 2.5rem 1rem !important; }
  .ag-almacenes { padding: 2.5rem 1rem !important; }
  .ag-galeria-flota { grid-template-columns: 1fr 1fr !important; }
  .ag-gf-foto { min-height: 140px !important; }
  .ag-h1 { font-size: clamp(34px, 10vw, 48px) !important; }

  /* ── CALIDAD ── */
  .ca-hero { padding: 2.5rem 1rem !important; }
  .ca-sellos { padding: 2.5rem 1rem !important; }
  .ca-cert-grid { grid-template-columns: 1fr !important; }
  .ca-politica { padding: 2.5rem 1rem !important; }
  .ca-politica-grid { grid-template-columns: 1fr !important; }
  .ca-compromiso { padding: 2.5rem 1rem !important; }
  .ca-comp-grid { grid-template-columns: 1fr 1fr !important; }
  .ca-comp-item { padding: 1.5rem 1rem !important; border-right: 1px solid rgba(0,16,58,0.12) !important; }
  .ca-comp-item:nth-child(2n) { border-right: none !important; }
  .ca-flip-card { aspect-ratio: 4/3 !important; }

  /* ── ÁREA CONDUCTORES ── */
  .ac-hero { grid-template-columns: 1fr !important; }
  .ac-hero-left { padding: 2.5rem 1rem !important; }
  .ac-stats { grid-template-columns: 1fr 1fr !important; }
  .ac-porq-grid { grid-template-columns: 1fr !important; }
  .ac-inst-grid { grid-template-columns: 1fr !important; }
  .ac-galeria { grid-template-columns: 1fr 1fr !important; }
  .ac-cv { padding: 2.5rem 1rem !important; }
  .ac-form { grid-template-columns: 1fr !important; }
  .ac-slider-slide { min-width: 100% !important; }

  /* ── CONTACTO ── */
  .ct-hero-h1 { font-size: clamp(36px, 10vw, 52px) !important; }
  .ct-hero-desc { font-size: 14px !important; }
  .ct-info { padding: 2rem 1rem !important; flex-direction: column !important; flex-wrap: nowrap !important; }
  .ct-form-wrap { padding: 2rem 1rem !important; }
  .ct-form { grid-template-columns: 1fr !important; }
  .ct-field.full { grid-column: 1 !important; }
  .ct-submit-wrap { justify-content: stretch !important; }
  .ct-submit { width: 100%; justify-content: center; }
  /* Input font-size 16px para evitar el zoom automático en iOS */
  .ct-input, textarea.ct-input, select.ct-input { font-size: 16px !important; }
  .ct-map-info { padding: 1.8rem 1rem !important; }
}