/* ==========================================================================
   HANDEI S.A.C. | handei-pro.css
   Capa de experiencia que se carga DESPUÉS del CSS original (no lo reemplaza):
   A. Tokens · B. Esqueletos de carga · C. Pantalla de arranque
   D. Hero vivo (circuito + tablero) · E. Navegación adaptable
   F. Secciones por dispositivo · G. Modal / bottom-sheet · H. Dock móvil
   I. Escritorio grande y ultra ancho · J. Accesibilidad y movimiento reducido
   ========================================================================== */

/* ---------- A. TOKENS ---------- */
:root {
    --hp-steel-1: #1c2e47;
    --hp-steel-2: #0f2036;
    --hp-steel-edge: rgba(255, 255, 255, 0.10);
    --hp-led-green: #3ddc84;
    --hp-led-red: #e5383b;
    --hp-collar: #f2c230;
    --hp-sk-base: #e3eaf0;
    --hp-sk-hi: #f5f8fa;
    --hp-radius-lg: 20px;
    --hp-radius-md: 14px;
    --hp-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --hp-dock-h: 64px;
}

/* Superficies oscuras: el esqueleto se adapta al fondo */
.hero, .services-section, .stats-section, footer, .hp-boot, .modal-header {
    --hp-sk-base: rgba(255, 255, 255, 0.07);
    --hp-sk-hi: rgba(255, 255, 255, 0.16);
}

html { -webkit-text-size-adjust: 100%; }
body { overflow-x: clip; }
img { max-width: 100%; }

/* ---------- B. ESQUELETOS DE CARGA ---------- */
@keyframes hpShimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

.sk {
    display: block;
    background-color: var(--hp-sk-base);
    background-image: linear-gradient(100deg, transparent 25%, var(--hp-sk-hi) 50%, transparent 75%);
    background-size: 200% 100%;
    background-repeat: no-repeat;
    animation: hpShimmer 1.35s linear infinite;
    border-radius: 8px;
}

/* Contenedores de imagen: muestran esqueleto hasta que su imagen termina de cargar.
   Solo con JS activo (html.js) para que sin JS todo se vea normal. */
html.js .about-img,
html.js .portfolio-item,
html.js .supply-media,
html.js .modal-image-content,
html.js .brand-logo-css,
html.js .logo-badge { position: relative; }

html.js .about-img:not(.is-loaded)::after,
html.js .portfolio-item:not(.is-loaded)::after,
html.js .supply-media:not(.is-loaded)::after,
html.js .modal-image-content:not(.is-loaded)::after,
html.js .brand-logo-css:not(.is-loaded)::after,
html.js .logo-badge:not(.is-loaded)::after {
    content: '';
    position: absolute; inset: 0; z-index: 4;
    border-radius: inherit;
    background-color: var(--hp-sk-base);
    background-image: linear-gradient(100deg, transparent 25%, var(--hp-sk-hi) 50%, transparent 75%);
    background-size: 200% 100%;
    animation: hpShimmer 1.35s linear infinite;
    pointer-events: none;
}
html.js .about-img img,
html.js .portfolio-item img,
html.js .supply-media img,
html.js .modal-image-content img,
html.js .brand-logo-css img,
html.js .logo-badge img { transition: opacity 0.5s ease, transform 0.6s ease; }

html.js .about-img:not(.is-loaded) img,
html.js .portfolio-item:not(.is-loaded) img,
html.js .supply-media:not(.is-loaded) img,
html.js .modal-image-content:not(.is-loaded) img,
html.js .brand-logo-css:not(.is-loaded) img,
html.js .logo-badge:not(.is-loaded) img { opacity: 0; }

html.js .supply-media:not(.is-loaded) i { opacity: 0; }
html.js .brand-logo-css:not(.is-loaded) { min-width: 140px; min-height: 50px; border-radius: 10px; }
html.js .modal-image-content:not(.is-loaded) { min-height: 220px; border-radius: 12px; }
.modal-image-content img { aspect-ratio: 16 / 10; height: auto; }

/* Imagen que no existe: se reemplaza por un respaldo digno, nunca un ícono roto */
.modal-image-content.is-error,
.portfolio-item.is-error {
    background: linear-gradient(135deg, rgba(27, 94, 138, 0.08), rgba(91, 193, 232, 0.15));
    border-radius: 12px; min-height: 220px;
    display: grid; place-items: center;
}
.modal-image-content.is-error img,
.portfolio-item.is-error img { display: none; }
.modal-image-content.is-error::before,
.portfolio-item.is-error::before {
    content: '\f013'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
    font-size: 3rem; color: rgba(27, 94, 138, 0.35);
}

/* Íconos de Font Awesome: círculo de esqueleto hasta que la fuente de íconos llega */
html.js:not(.fa-ready) .service-icon i,
html.js:not(.fa-ready) .contact-icon i,
html.js:not(.fa-ready) .why-icon i,
html.js:not(.fa-ready) .social-links i,
html.js:not(.fa-ready) .hp-dock i,
html.js:not(.fa-ready) .menu-toggle i { visibility: hidden; }

html.js:not(.fa-ready) .service-icon,
html.js:not(.fa-ready) .contact-icon,
html.js:not(.fa-ready) .social-links a {
    background-color: var(--hp-sk-base);
    background-image: linear-gradient(100deg, transparent 25%, var(--hp-sk-hi) 50%, transparent 75%);
    background-size: 200% 100%;
    animation: hpShimmer 1.35s linear infinite;
}
html.js:not(.fa-ready) .why-icon {
    width: 3rem; height: 3rem; border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
}

/* Bloque de esqueleto del modal (texto que aún no se revela) */
.hp-sk-text { display: none; }
.modal-info-row.is-loading .modal-text-content { position: relative; }
.modal-info-row.is-loading .modal-text-content > :not(.hp-sk-text) { visibility: hidden; }
.modal-info-row.is-loading .hp-sk-text {
    display: flex; flex-direction: column; gap: 0.9rem;
    position: absolute; inset: 2.5rem;
}
.hp-sk-text .sk-h { height: 1.3rem; width: 55%; margin-bottom: 0.6rem; }
.hp-sk-text .sk-l { height: 0.85rem; }
.hp-sk-text .sk-l:nth-child(odd) { width: 92%; }
.hp-sk-text .sk-l:nth-child(even) { width: 76%; }
.modal-info-row .modal-text-content > :not(.hp-sk-text) { transition: opacity 0.35s ease; }
.modal-info-row.is-revealed .modal-text-content > :not(.hp-sk-text) { animation: hpFadeIn 0.4s ease both; }
@keyframes hpFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- C. PANTALLA DE ARRANQUE (esqueleto del primer pantallazo) ---------- */
.hp-boot { display: none; }
html.js .hp-boot {
    display: block;
    position: fixed; inset: 0; z-index: 3000;
    background: radial-gradient(120% 90% at 85% 10%, #13305a 0%, var(--color-dark) 55%);
    transition: opacity 0.5s ease, visibility 0.5s ease;
    /* Red de seguridad: si algo falla, se retira solo a los 6 s */
    animation: hpBootSafety 0s linear 6s forwards;
}
html.js.is-ready .hp-boot { opacity: 0; visibility: hidden; pointer-events: none; }
@keyframes hpBootSafety { to { opacity: 0; visibility: hidden; pointer-events: none; } }

.hp-boot-bar { display: flex; align-items: center; justify-content: space-between; padding-top: 1.5rem; }
.hp-boot-logo { display: flex; align-items: center; gap: 14px; }
.hp-boot-badge { width: 56px; height: 56px; border-radius: 15px; }
.hp-boot-brand { display: flex; flex-direction: column; gap: 8px; }
.hp-boot-brand .sk:first-child { width: 130px; height: 18px; }
.hp-boot-brand .sk:last-child { width: 160px; height: 8px; }
.hp-boot-nav { display: flex; align-items: center; gap: 2rem; }
.hp-boot-nav .sk { width: var(--w, 64px); height: 12px; border-radius: 6px; }
.hp-boot-nav .hp-boot-cta { width: 190px; height: 46px; border-radius: 50px; }
.hp-boot-burger { display: none; width: 30px; height: 26px; border-radius: 6px; }

.hp-boot-hero {
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: clamp(2rem, 4vw, 5rem); align-items: center;
    min-height: calc(100svh - 110px);
}
.hp-boot-copy { display: flex; flex-direction: column; gap: 1rem; max-width: 760px; }
.hp-boot-copy .sk-h1 { height: clamp(2rem, 1.1rem + 3.4vw, 4.2rem); width: var(--w, 90%); border-radius: 12px; }
.hp-boot-copy .sk-p { height: 0.95rem; width: var(--w, 80%); }
.hp-boot-copy .sk-h1 + .sk-p { margin-top: 1rem; }
.hp-boot-btns { display: flex; gap: 1.2rem; margin-top: 1.4rem; }
.hp-boot-btns .sk { width: 210px; height: 54px; border-radius: 50px; }
.hp-boot-panel { height: 400px; border-radius: var(--hp-radius-lg); }

.hp-sr {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- D. HERO VIVO ---------- */
.hero {
    height: auto;
    min-height: max(640px, 100svh);
    padding: clamp(7rem, 12vh, 9rem) 0 clamp(3.5rem, 8vh, 6rem);
    background: radial-gradient(120% 90% at 85% 10%, #13305a 0%, var(--color-dark) 55%);
    isolation: isolate;
}
/* Fotografía original como capa: aparece con fundido cuando ya descargó */
.hero::before {
    content: ''; position: absolute; inset: 0; z-index: -2;
    background:
        linear-gradient(to right, rgba(10, 25, 47, 0.94) 0%, rgba(10, 25, 47, 0.78) 50%, rgba(10, 25, 47, 0.55) 100%),
        url('https://images.unsplash.com/photo-1581092160562-40aa08e78837?auto=format&fit=crop&q=80') center / cover no-repeat;
    opacity: 0; transition: opacity 1.2s ease;
}
.hero.photo-ready::before { opacity: 1; }
/* Viñeta inferior para fundir con la sección siguiente */
.hero::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 120px; z-index: -1;
    background: linear-gradient(to bottom, transparent, rgba(10, 25, 47, 0.55));
    pointer-events: none;
}

.hero-circuit {
    position: absolute; inset: 0; z-index: -1;
    width: 100%; height: 100%; display: block;
    touch-action: pan-y;
}

.hero > .container { position: relative; z-index: 2; }
.hero-content { max-width: 760px; }
.hero h1 { font-size: clamp(2.1rem, 1.15rem + 3.5vw, 4.4rem); letter-spacing: -0.5px; }
.hero p { font-size: clamp(1rem, 0.92rem + 0.35vw, 1.2rem); max-width: 60ch; color: #c9d4df; }

/* La frase "Energía que Impulsa" se energiza al cargar: la corriente la recorre */
.hero h1 span {
    text-shadow: none;
    background-image: linear-gradient(90deg,
        var(--color-secondary) 0%, var(--color-secondary) 42%,
        #ffffff 48%, #ffffff 50%,
        rgba(255, 255, 255, 0.22) 56%, rgba(255, 255, 255, 0.22) 100%);
    background-size: 240% 100%;
    background-position: 100% 0;
    -webkit-background-clip: text; background-clip: text;
    color: transparent; -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 14px rgba(91, 193, 232, 0.35));
}
html.is-ready .hero h1 span { animation: hpEnergize 1.7s var(--hp-ease) 0.35s forwards; }
@keyframes hpEnergize { from { background-position: 100% 0; } to { background-position: 0% 0; } }
html:not(.js) .hero h1 span { background-position: 0 0; }

/* Tablero de atención rápida (estilo tablero eléctrico real) */
.hp-panel {
    position: relative;
    background: linear-gradient(160deg, var(--hp-steel-1), var(--hp-steel-2));
    border: 1px solid var(--hp-steel-edge);
    border-radius: var(--hp-radius-lg);
    padding: 2.2rem 1.8rem 1.6rem;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -1px 0 rgba(0, 0, 0, 0.4),
        0 30px 60px -20px rgba(0, 0, 0, 0.6);
    color: var(--color-white);
    animation: slideUp 1.4s ease forwards;
}
.hp-screw {
    position: absolute; width: 12px; height: 12px; border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #d9e1ea, #7b8796 70%);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.hp-screw::after {
    content: ''; position: absolute; left: 2px; right: 2px; top: 50%; height: 2px;
    margin-top: -1px; background: rgba(30, 40, 55, 0.7); transform: rotate(var(--r, 35deg));
}
.hp-screw:nth-of-type(1) { top: 12px; left: 12px; }
.hp-screw:nth-of-type(2) { top: 12px; right: 12px; --r: -20deg; }
.hp-screw:nth-of-type(3) { bottom: 12px; left: 12px; --r: 70deg; }
.hp-screw:nth-of-type(4) { bottom: 12px; right: 12px; --r: 10deg; }

/* El tablero vive dentro del hero: se neutraliza la regla genérica ".hero p" */
.hero .hp-panel p { margin: 0; max-width: none; animation: none; font-size: inherit; color: inherit; font-weight: inherit; }
.hp-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.hero .hp-status { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; font-weight: 600; color: #d6e4ef; }
.hp-led {
    width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0;
    background: var(--hp-led-green);
    box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.18), 0 0 12px rgba(61, 220, 132, 0.8);
    animation: hpLed 2.4s ease-in-out infinite;
}
@keyframes hpLed { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.hp-clock { font-size: 0.8rem; color: var(--color-text-light); font-variant-numeric: tabular-nums; white-space: nowrap; }

.hp-panel-title {
    color: var(--color-white); font-size: clamp(1.25rem, 1.05rem + 0.6vw, 1.6rem);
    font-weight: 800; margin-bottom: 1.2rem; letter-spacing: -0.2px;
}

.hp-actions { display: grid; gap: 0.75rem; }
.hp-act {
    display: grid; grid-template-columns: 50px 1fr; align-items: center; gap: 1rem;
    width: 100%; text-align: left; cursor: pointer;
    padding: 0.85rem 1rem; border-radius: var(--hp-radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--color-white); font-family: var(--font-body);
    transition: background 0.25s ease, border-color 0.25s ease, transform 0.15s ease;
}
.hp-act:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(91, 193, 232, 0.45); }
.hp-act:active { transform: translateY(1px); }
.hp-act strong { display: block; font-family: var(--font-heading); font-weight: 700; font-size: 1rem; line-height: 1.25; }
.hp-act small { display: block; font-size: 0.82rem; color: #a9b8c7; margin-top: 2px; }

/* Pulsadores industriales */
.hp-knob {
    position: relative; width: 46px; height: 46px; border-radius: 50%;
    display: grid; place-items: center;
    background: radial-gradient(circle at 50% 50%, #2a3a50 60%, #16233a 62%);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
}
.hp-knob::before {
    content: ''; width: 32px; height: 32px; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, var(--k-hi), var(--k) 55%, var(--k-lo) 100%);
    box-shadow: 0 3px 0 var(--k-lo), 0 6px 10px rgba(0, 0, 0, 0.45);
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.25s ease;
}
.hp-act:hover .hp-knob::before { filter: brightness(1.15) drop-shadow(0 0 8px var(--k)); }
.hp-act:active .hp-knob::before { transform: translateY(2px); box-shadow: 0 1px 0 var(--k-lo), 0 2px 4px rgba(0, 0, 0, 0.45); }

/* Paro de emergencia: hongo rojo sobre collar amarillo */
.hp-act--stop .hp-knob { background: radial-gradient(circle, var(--hp-collar) 62%, #b88d10 64%, #2a3a50 66%); }
.hp-act--stop { --k: #e5383b; --k-hi: #ff8a80; --k-lo: #8e1b1d; }
.hp-act--stop .hp-knob::before { width: 34px; height: 34px; }
.hp-act--go { --k: #2fbf71; --k-hi: #9af0bf; --k-lo: #166a3d; }
.hp-act--info { --k: #3aa7d8; --k-hi: #b6e6fa; --k-lo: #145c80; }

.hero .hp-panel-foot {
    margin-top: 1.1rem; padding-top: 1rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.12);
    font-size: 0.82rem; color: var(--color-text-light);
    display: flex; align-items: center; gap: 0.6rem;
}
.hp-panel-foot i { color: var(--color-secondary); }

/* Destello del formulario cuando el tablero lo prepara */
@keyframes hpFormPulse {
    0% { box-shadow: 0 0 0 0 rgba(91, 193, 232, 0.55), var(--shadow-md); }
    100% { box-shadow: 0 0 0 18px rgba(91, 193, 232, 0), var(--shadow-md); }
}
.contact-form.hp-armed { animation: hpFormPulse 1.1s ease-out 2; }

/* Distribución del hero por tamaño */
@media (min-width: 1100px) {
    .hero > .container {
        display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
        gap: clamp(2.5rem, 4vw, 5rem); align-items: center;
    }
    .hp-panel { max-width: 460px; justify-self: end; width: 100%; }
}
@media (max-width: 1099px) {
    .hp-panel { margin-top: 2.6rem; max-width: 760px; }
    .hp-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .hp-act { grid-template-columns: 1fr; justify-items: start; gap: 0.7rem; padding: 1rem; }
    .hp-boot-hero { grid-template-columns: 1fr; align-content: center; }
    .hp-boot-panel { height: 230px; }
}
@media (max-width: 700px) {
    .hp-actions { grid-template-columns: 1fr; gap: 0.6rem; }
    .hp-act { grid-template-columns: 44px 1fr; justify-items: stretch; padding: 0.75rem 0.9rem; }
    .hp-knob { width: 42px; height: 42px; }
    .hp-knob::before { width: 28px; height: 28px; }
    .hp-act--stop .hp-knob::before { width: 30px; height: 30px; }
    .hp-panel { padding: 1.9rem 1.2rem 1.2rem; margin-top: 2rem; }
    .hp-panel-head { flex-wrap: wrap; gap: 0.4rem 1rem; }
    .hp-boot-panel { height: 300px; }
    .hp-boot-btns .sk { flex: 1; width: auto; }
}
@media (max-width: 480px) {
    .hero { padding-top: 6.5rem; }
    .hp-boot-btns { flex-direction: column; }
}
/* Teléfonos en horizontal: sin trampas de 100vh */
@media (max-height: 520px) and (orientation: landscape) {
    .hero { min-height: auto; padding: 6.5rem 0 3rem; }
    .hp-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .hp-act { grid-template-columns: 1fr; }
    .hp-boot-hero { min-height: auto; padding-top: 3rem; }
    .hp-boot-panel { display: none; }
}

/* ---------- E. NAVEGACIÓN ADAPTABLE ---------- */
.nav-links a.is-active:not(.btn)::after { width: 100%; }
.nav-links a.is-active:not(.btn) { color: var(--color-secondary); }
header.scrolled .nav-links a.is-active:not(.btn) { color: var(--color-primary); }
.nav-extra { display: none; }
.menu-toggle { position: relative; z-index: 1003; width: 44px; height: 44px; display: none; place-items: center; border-radius: 12px; }
.hp-backdrop { display: none; }

/* Escritorio intermedio: el menú completo ya no cabe, se compacta antes de pasar a cajón */
@media (min-width: 1081px) and (max-width: 1240px) {
    .nav-links { gap: 1.3rem; }
    .nav-links a { font-size: 0.9rem; }
    .nav-links .btn { padding: 0.8rem 1.3rem; font-size: 0.8rem; }
    .logo-tagline { display: none; }
}

@media (max-width: 1080px) {
    header { padding: 1rem 0; }
    header.scrolled { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(255, 255, 255, 0.98); }
    .menu-toggle { display: grid; }
    body.nav-open .menu-toggle { color: var(--color-dark); }

    header .nav-links,
    header .nav-links.active {
        position: fixed; top: 0; right: 0; left: auto; bottom: 0;
        width: min(400px, 88vw); height: 100dvh; max-height: none;
        flex-direction: column; align-items: stretch; justify-content: flex-start;
        gap: 0; padding: 5.5rem 1.5rem calc(1.5rem + env(safe-area-inset-bottom));
        background: var(--color-white);
        box-shadow: -30px 0 60px rgba(10, 25, 47, 0.25);
        overflow-y: auto; overscroll-behavior: contain;
        z-index: 1002;
        transition: transform 0.45s var(--hp-ease), visibility 0.45s;
    }
    header .nav-links { transform: translateX(105%); visibility: hidden; }
    header .nav-links.active { transform: none; visibility: visible; }

    header .nav-links li { width: 100%; text-align: left; }
    header .nav-links li a:not(.btn) {
        display: flex; align-items: center; justify-content: space-between;
        padding: 1rem 0.25rem; font-size: 1.15rem; font-family: var(--font-heading); font-weight: 700;
        color: var(--color-dark); border-bottom: 1px solid #edf1f5;
    }
    header .nav-links li a:not(.btn)::after {
        content: '\f054'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: 0.75rem;
        position: static; width: auto; height: auto; background: none; color: var(--color-text-light);
        display: inline-block;
    }
    header .nav-links li a.is-active:not(.btn) { color: var(--color-primary); }
    header .nav-links li a.is-active:not(.btn)::after { color: var(--color-secondary); }
    header .nav-links .btn-primary { display: flex; width: 100%; margin: 1.5rem 0 0; }

    /* Escalonado al abrir: la lista aparece en cascada */
    header .nav-links li { opacity: 0; transform: translateX(16px); transition: opacity 0.35s ease, transform 0.45s var(--hp-ease); }
    header .nav-links.active li { opacity: 1; transform: none; }
    header .nav-links.active li:nth-child(2) { transition-delay: 0.04s; }
    header .nav-links.active li:nth-child(3) { transition-delay: 0.08s; }
    header .nav-links.active li:nth-child(4) { transition-delay: 0.12s; }
    header .nav-links.active li:nth-child(5) { transition-delay: 0.16s; }
    header .nav-links.active li:nth-child(6) { transition-delay: 0.20s; }
    header .nav-links.active li:nth-child(7) { transition-delay: 0.24s; }

    .nav-extra { display: block; margin-top: auto; padding-top: 2rem; }
    .nav-extra-card {
        background: var(--color-light); border-radius: var(--hp-radius-md); padding: 1.2rem;
        display: grid; gap: 0.7rem;
    }
    .nav-extra-card p { font-size: 0.9rem; color: var(--color-text); margin: 0; }
    .nav-extra-card p strong { color: var(--color-dark); font-family: var(--font-heading); }
    header .nav-links .nav-extra a {
        display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0.9rem;
        border-radius: 10px; background: var(--color-white); border: 1px solid #e2e8f0;
        font-weight: 600; font-size: 0.95rem; color: var(--color-dark);
    }
    header .nav-links .nav-extra a::after { display: none; }
    header .nav-links .nav-extra a i { color: var(--color-primary); width: 18px; text-align: center; }
    header .nav-links .nav-extra a.nav-extra-wa i { color: #1fa855; }

    .hp-backdrop {
        display: block; position: fixed; inset: 0; z-index: 1001;
        background: rgba(10, 25, 47, 0.55);
        opacity: 0; visibility: hidden; transition: opacity 0.35s ease, visibility 0.35s;
    }
    body.nav-open .hp-backdrop { opacity: 1; visibility: visible; }
    body.nav-open { overflow: hidden; }

    .hp-boot-nav { display: none; }
    .hp-boot-burger { display: block; }
}
@media (min-width: 769px) and (max-width: 1080px) {
    /* Tableta: cabecera transparente sobre el hero, igual que escritorio */
    header:not(.scrolled) { background: transparent; }
}
@media (max-width: 768px) {
    header:not(.scrolled) { background: rgba(10, 25, 47, 0.35); backdrop-filter: none; }
    header.scrolled { padding: 0.7rem 0; }
}

/* ---------- F. SECCIONES POR DISPOSITIVO ---------- */
/* Tipografía fluida: escala con la pantalla en lugar de saltar entre tamaños */
.section-padding { padding: clamp(3.5rem, 2rem + 6vw, 7rem) 0; }
.section-title h2 { font-size: clamp(1.6rem, 1.1rem + 2vw, 2.75rem); }
.section-title p { font-size: clamp(0.98rem, 0.92rem + 0.25vw, 1.12rem); }
.why-title h2, .brands-title h2, .cta-section h2 { font-size: clamp(1.65rem, 1rem + 2.6vw, 3.3rem); }
.stat-item h3 { font-size: clamp(2.3rem, 1.5rem + 3vw, 4.2rem); font-variant-numeric: tabular-nums; }
.about-content h3 { font-size: clamp(1.4rem, 1.1rem + 1vw, 2rem); }
.cta-section p { font-size: clamp(1rem, 0.9rem + 0.4vw, 1.2rem); }

/* Nosotros */
.about-content .section-title::after { left: 0; transform: none; }
.about-img {
    aspect-ratio: 4 / 5; max-height: 660px;
    border-radius: var(--hp-radius-lg); overflow: hidden; box-shadow: var(--shadow-lg);
}
.about-img picture { display: block; width: 100%; height: 100%; }
.about-img img { width: 100%; height: 100%; object-fit: cover; object-position: 45% 30%; }
.about-content p { text-align: left; }
@media (max-width: 992px) {
    .about-img { aspect-ratio: 16 / 11; max-height: 480px; }
    .about-grid { gap: 2.5rem; }
}
@media (max-width: 600px) {
    .about-img { aspect-ratio: 4 / 3.4; }
    .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .tabs::-webkit-scrollbar { display: none; }
    .tab-btn { white-space: nowrap; flex-shrink: 0; }
}

/* Servicios */
.service-card:focus-visible { outline: 3px solid var(--color-secondary); outline-offset: 4px; }
@media (min-width: 1100px) {
    .services-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 601px) and (max-width: 1099px) {
    .services-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
    .service-card { display: grid; grid-template-columns: 64px 1fr; text-align: left; gap: 0.2rem 1.2rem; padding: 1.6rem; align-items: start; }
    .service-icon { width: 64px; height: 64px; font-size: 1.7rem; margin: 0; grid-row: span 3; }
    .service-card h3 { margin-bottom: 0.4rem; }
    .service-card p { margin-bottom: 0.6rem; }
    .service-card .read-more { margin-top: 0; }
}
@media (max-width: 600px) {
    .services-grid { grid-template-columns: 1fr; gap: 0.75rem; margin-bottom: 2rem; }
    .service-card {
        display: grid; grid-template-columns: 52px 1fr 22px; align-items: center;
        gap: 0.15rem 1rem; padding: 1rem 1.1rem; text-align: left; border-radius: var(--hp-radius-md);
    }
    .service-icon { width: 52px; height: 52px; font-size: 1.35rem; margin: 0; grid-row: 1 / span 2; }
    .service-card h3 { font-size: 1rem; margin: 0; align-self: end; }
    .service-card p { font-size: 0.85rem; margin: 0; align-self: start; grid-column: 2; line-height: 1.45; }
    .service-card .read-more { grid-column: 3; grid-row: 1 / span 2; font-size: 0; margin: 0; align-self: center; }
    .service-card .read-more i { font-size: 0.95rem; }
    .services-extra-info { padding: 1.6rem 1.3rem; margin-top: 2.5rem; text-align: left; }
    .extra-info-col p { font-size: 0.98rem; }
    .extra-info-divider { width: 60px; }
}
@media (hover: none) {
    .service-card:hover { transform: none; }
    .service-card:active { transform: scale(0.985); border-color: var(--color-secondary); }
}

/* Proyectos */
.portfolio-overlay:has(h4:empty):has(p:empty) { display: none; }
@media (min-width: 1100px) {
    .portfolio-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .portfolio-item { height: auto; aspect-ratio: 3 / 4; }
}
@media (min-width: 601px) and (max-width: 1099px) {
    .portfolio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .portfolio-item { height: auto; aspect-ratio: 4 / 5; }
}
@media (max-width: 600px) {
    .portfolio-grid {
        display: flex; gap: 0.9rem; overflow-x: auto; scroll-snap-type: x mandatory;
        margin: 0 -1.2rem; padding: 0 1.2rem 1rem; scroll-padding: 0 1.2rem;
        scrollbar-width: none; -webkit-overflow-scrolling: touch;
    }
    .portfolio-grid::-webkit-scrollbar { display: none; }
    .portfolio-item { flex: 0 0 78%; height: auto; aspect-ratio: 3 / 4; scroll-snap-align: start; }
}
@media (hover: none) {
    .portfolio-overlay { opacity: 1; background: linear-gradient(to top, rgba(10, 25, 47, 0.85), transparent 55%); }
    .portfolio-overlay h4, .portfolio-overlay p { transform: none; }
    .portfolio-item:hover img { transform: none; }
}

/* Indicador de desplazamiento para carruseles táctiles */
.hp-dots { display: none; }
@media (max-width: 600px) {
    .hp-dots { display: flex; justify-content: center; gap: 6px; margin-top: 0.4rem; }
    .hp-dots span { width: 7px; height: 7px; border-radius: 4px; background: #cbd5e1; transition: width 0.3s var(--hp-ease), background 0.3s ease; }
    .hp-dots span.on { width: 22px; background: var(--color-primary); }
}

/* Por qué elegirnos */
@media (max-width: 600px) {
    .why-choose-section { padding: 3.5rem 0; }
    .why-title h2 { margin-bottom: 2rem; }
}

/* Marcas */
.brand-fallback { font-family: var(--font-heading); font-weight: 800; font-size: 1.6rem; color: #2d4f6e; letter-spacing: -0.3px; white-space: nowrap; }
@media (max-width: 600px) {
    .brands-section { padding: 3rem 0 3.5rem; }
    .brands-title h2 { margin-bottom: 2rem; }
    .brands-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 1rem; justify-items: center; }
    .brand-logo-css img { max-width: 120px; max-height: 40px; }
    .brand-ls, .brand-indeco { font-size: 1.45rem; }
    .brand-ls-sub { font-size: 0.75rem; }
    .brand-hidrostal, .brand-pedrollo { font-size: 1.35rem; }
    .brand-bahco { font-size: 1.2rem; }
    .brand-fallback { font-size: 1.2rem; white-space: normal; text-align: center; }
}

/* Suministros: en móvil, filas compactas (imagen pequeña + texto) en vez de círculos gigantes */
@media (max-width: 600px) {
    .supplies-list { gap: 1.4rem; }
    .supply-row, .supply-row.reverse {
        grid-template-columns: 92px 1fr; gap: 1rem; text-align: left; align-items: start;
        padding-bottom: 1.4rem; border-bottom: 1px solid #edf1f5;
    }
    .supply-row:last-child { border-bottom: 0; padding-bottom: 0; }
    .supply-row.reverse .supply-media { order: 0; }
    .supply-row.reverse .supply-body { order: 1; text-align: left; }
    .supply-media, .supply-row .supply-media {
        width: 92px; height: 92px; margin: 0;
        box-shadow: var(--shadow-md), inset 0 0 0 4px var(--color-white), inset 0 0 0 5px rgba(27, 94, 138, 0.12);
    }
    .supply-media img { padding: 8px; }
    .supply-media i { font-size: 1.9rem; }
    .supply-badge, .supply-row.reverse .supply-badge { margin: 0 0 0.35rem; }
    .supply-badge::before, .supply-row.reverse .supply-badge::before,
    .supply-row:hover .supply-badge::before, .supply-row.reverse:hover .supply-badge::before {
        width: 30px; height: 30px; left: -8px; right: auto; transform: translateY(-50%);
    }
    .supply-badge h3 { font-size: 1.08rem; }
    .supply-body p, .supply-row.reverse .supply-body p { font-size: 0.92rem; line-height: 1.55; margin: 0; }
    .supply-tag { margin-top: 0.55rem; font-size: 0.68rem; padding: 0.25rem 0.75rem; }
    .supply-row:hover .supply-media { transform: none; }
    .supplies-cta { margin-top: 2.5rem; }
}

/* Estadísticas: 2×2 en móvil en lugar de una columna larguísima */
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 1rem; }
    .stat-item p { font-size: 0.78rem; letter-spacing: 1px; }
}
@media (hover: none) {
    .hero, .stats-section { background-attachment: scroll; }
}

/* Testimonios: carrusel deslizable en móvil */
@media (min-width: 601px) and (max-width: 991px) {
    .testimonials-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .testimonials-grid .testimonial-card:last-child { grid-column: 1 / -1; max-width: 560px; justify-self: center; }
}
@media (max-width: 600px) {
    .testimonials-grid {
        display: flex; gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory;
        margin: 0 -1.2rem; padding: 0.5rem 1.2rem 1.2rem; scroll-padding: 0 1.2rem;
        scrollbar-width: none;
    }
    .testimonials-grid::-webkit-scrollbar { display: none; }
    .testimonial-card { flex: 0 0 86%; scroll-snap-align: start; padding: 2.2rem 1.5rem; }
    .testimonial-card:hover { transform: none; }
}

/* Contacto */
.contact-text a { overflow-wrap: anywhere; }
@media (min-width: 601px) and (max-width: 992px) {
    .contact-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 2rem; }
    .contact-info-item:last-child { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
    .contact-grid { gap: 2rem; }
    .contact-info-item { margin-bottom: 1.4rem; gap: 1rem; }
    .form-control { font-size: 16px; } /* evita el zoom automático de iOS */
}

/* Pie de página */
@media (min-width: 601px) and (max-width: 991px) {
    .footer-grid { grid-template-columns: 1fr 1fr; text-align: left; }
    .footer-about { grid-column: 1 / -1; }
    .footer-about p { margin-left: 0; }
    .social-links { justify-content: flex-start; }
}

/* ---------- G. MODAL / BOTTOM-SHEET ---------- */
.modal-body { overscroll-behavior: contain; }
@media (max-width: 600px) {
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal-container {
        max-height: 90dvh; border-radius: 22px 22px 0 0;
        transform: translateY(100%);
        transition: transform 0.45s var(--hp-ease);
    }
    .modal-overlay.active .modal-container { transform: translateY(0); }
    .modal-container.is-dragging { transition: none; }
    .modal-header { padding: 1.9rem 1.25rem 1.25rem; touch-action: none; }
    .modal-header::before {
        content: ''; position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
        width: 44px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.6);
    }
    .modal-header h3 { padding-right: 2.6rem; }
    .modal-close { top: 18px; right: 14px; width: 38px; height: 38px; }
    .modal-info-row { padding: 1.25rem 1.1rem; gap: 1.1rem; }
    .modal-text-content { padding: 1.3rem 1.2rem; }
    .modal-info-row.is-loading .hp-sk-text { inset: 1.3rem 1.2rem; }
    .modal-body { padding-bottom: env(safe-area-inset-bottom); }
}
@media (min-width: 601px) and (max-width: 992px) {
    .modal-info-row.is-loading .hp-sk-text { inset: 1.6rem; }
}

/* ---------- H. DOCK DE ACCIONES (móvil) ---------- */
.hp-dock { display: none; }
@media (max-width: 768px) {
    .hp-dock {
        display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 0.5rem;
        position: fixed; left: 0.75rem; right: 0.75rem;
        bottom: calc(0.75rem + env(safe-area-inset-bottom));
        z-index: 990; padding: 0.45rem;
        background: rgba(255, 255, 255, 0.96);
        border: 1px solid #e2e8f0; border-radius: 18px;
        box-shadow: 0 14px 40px -10px rgba(10, 25, 47, 0.35);
        transform: translateY(140%); transition: transform 0.45s var(--hp-ease);
    }
    .hp-dock.is-visible { transform: none; }
    body.nav-open .hp-dock, body.modal-open .hp-dock { transform: translateY(140%); }
    .hp-dock a {
        display: flex; align-items: center; justify-content: center; gap: 0.45rem;
        height: 46px; border-radius: 13px;
        font-family: var(--font-heading); font-weight: 700; font-size: 0.85rem; color: var(--color-dark);
        background: var(--color-light);
    }
    .hp-dock a i { font-size: 1.05rem; color: var(--color-primary); }
    .hp-dock .hp-dock-wa i { color: #1fa855; }
    .hp-dock .hp-dock-main { background: linear-gradient(135deg, var(--color-primary), var(--color-secondary)); color: var(--color-white); }
    .hp-dock .hp-dock-main i { color: var(--color-white); }
    .whatsapp-float { display: none; }
    footer { padding-bottom: calc(var(--hp-dock-h) + 2.5rem + env(safe-area-inset-bottom)); }
}
@media (max-width: 360px) {
    .hp-dock a span { font-size: 0.78rem; }
    .hp-dock a { gap: 0.3rem; }
}

/* ---------- I. ESCRITORIO GRANDE Y ULTRA ANCHO ---------- */
@media (min-width: 1440px) {
    .container { max-width: 1360px; }
}
@media (min-width: 1800px) {
    html { font-size: 17px; }
    .container { max-width: 1500px; }
    .hp-panel { max-width: 500px; }
}
@media (min-width: 2400px) {
    html { font-size: 19px; }
    .container { max-width: 1720px; }
}

/* ---------- J. ACCESIBILIDAD Y MOVIMIENTO REDUCIDO ---------- */
:focus-visible { outline: 3px solid var(--color-secondary); outline-offset: 3px; }
.btn:focus-visible, .hp-act:focus-visible { outline-offset: 4px; }
.menu-toggle:focus-visible { outline-offset: 0; }

@media (prefers-reduced-motion: reduce) {
    .sk, html.js [class]:not(.is-loaded)::after { animation: none !important; }
    .hero h1 span, html.is-ready .hero h1 span { animation: none; background-position: 0 0; }
    .hp-led { animation: none; }
    .hp-panel { animation: none; }
    header .nav-links li { transition: none; opacity: 1; transform: none; }
    .modal-container, .hp-dock { transition: none; }
    .contact-form.hp-armed { animation: none; }
}
