/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont,
                 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
                 'Open Sans', sans-serif;
    overflow-x: hidden;
    color: #1a1a2e;
}

/* =============================================
   HEADER & NAV
   ============================================= */
header {
    width: 100%;
}

nav {
    width: 100%;
}

/* Barra superior con logo + links */
#menu {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px clamp(16px, 5vw, 48px);
    position: relative;
}

#imagen-logo {
    flex-shrink: 0;
}

#logo_sahlafix {
    width: clamp(80px, 14vw, 150px);
    height: clamp(80px, 14vw, 150px);
    object-fit: contain;
    display: block;
}

/* Nav links */
#nav-links {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 28px);
    list-style: none;
    flex-wrap: wrap;
}

#nav-links li a {
    text-decoration: none;
    color: #0f3a5a;
    font-size: clamp(0.8rem, 1.5vw, 0.95rem);
    font-weight: 500;
    padding: 4px 2px;
    transition: color 0.2s;
}

#nav-links li a:hover {
    color: #1a8cca;
}

/* Botones CTA del nav */
.btn-nav {
    padding: 8px 18px !important;
    border-radius: 999px !important;
    font-weight: 600 !important;
    font-size: clamp(0.78rem, 1.4vw, 0.9rem) !important;
    transition: background 0.2s, color 0.2s !important;
}

.registrarse {
    background: #0f3a5a;
    color: white !important;
}

.registrarse:hover {
    background: #1a5a8a;
}

.inicio-sesion {
    border: 2px solid #0f3a5a;
    color: #0f3a5a !important;
}

.inicio-sesion:hover {
    background: #0f3a5a;
    color: white !important;
}

/* =============================================
   BOTÓN HAMBURGUESA (oculto en desktop)
   ============================================= */
#menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    z-index: 200;
}

#menu-toggle span {
    display: block;
    width: 26px;
    height: 2px;
    background: #0f3a5a;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Hamburguesa activa → X */
#menu-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
#menu-toggle.open span:nth-child(2) {
    opacity: 0;
}
#menu-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* =============================================
   CARRUSEL
   ============================================= */
#imagenes-categorias {
    width: 100%;
    height: clamp(200px, 45vw, 680px);
    overflow: hidden;
}

#categorias {
    width: 100%;
    height: 100%;
    display: flex;
    transition: transform 0.5s ease-in-out;
    will-change: transform;
}

.categorias {
    min-width: 100%;
    flex-shrink: 0;
    height: 100%;
    object-fit: cover;
}

/* =============================================
   SECCIÓN SERVICIOS
   ============================================= */
#Servicios {
    padding: clamp(40px, 8vw, 100px) clamp(16px, 5vw, 60px) clamp(60px, 10vw, 120px);
    text-align: center;
}

#Servicios h3 {
    display: inline-block;
    max-width: 860px;
    font-size: clamp(1.15rem, 3.5vw, 2rem);
    font-weight: 600;
    line-height: 1.4;
    color: #0f3a5a;
    background-color: aquamarine;
    border-radius: 20px;
    padding: clamp(14px, 3vw, 28px) clamp(18px, 4vw, 32px);
    margin-bottom: clamp(32px, 6vw, 60px);
}

/* Fotos servicios — desktop: posición absoluta / móvil: columna */
#servicios-fotos {
    position: relative;
    width: 100%;
    height: clamp(600px, 80vw, 1000px);
    max-width: 1100px;
    margin: 0 auto;
}

#servicios-fotos img {
    position: absolute;
    width: clamp(140px, 18vw, 300px);
    height: clamp(280px, 38vw, 650px);
    object-fit: cover;
    border-radius: 18px;
    opacity: 0;
    transform: translateY(60px);
    transition: opacity 0.9s ease, transform 0.9s ease;
    box-shadow: 0 12px 40px rgba(15,58,90,0.15);
}

#servicios-fotos img:nth-child(1) { top: 0;     left: 5%; }
#servicios-fotos img:nth-child(2) { top: 180px; right: 5%; }
#servicios-fotos img:nth-child(3) {
    top: 380px;
    left: 50%;
    transform: translate(-50%, 60px);
}

#servicios-fotos img.visible {
    opacity: 1;
    transform: translateY(0);
}

#servicios-fotos img:nth-child(3).visible {
    transform: translate(-50%, 0);
}

/* =============================================
   SECCIÓN FUNCIONAMIENTO
   ============================================= */
#Funcionamiento {
    width: 100%;
    padding: clamp(60px, 10vw, 120px) clamp(16px, 5vw, 60px);
    background: linear-gradient(180deg, #f4f8fb, #e8f1f6);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 40px;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

#Funcionamiento h2 {
    width: 100%;
    font-size: clamp(1.5rem, 4vw, 2.3rem);
    font-weight: 700;
    color: #0f3a5a;
    text-align: center;
    margin-bottom: 10px;
}

.func-subtitle {
    width: 100%;
    color: #4a6a80;
    text-align: center;
    margin-bottom: clamp(30px, 5vw, 60px);
    font-size: clamp(0.88rem, 2.2vw, 1.05rem);
    line-height: 1.6;
}

/* Steps */
.func-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    min-width: 260px;
    max-width: 480px;
}

.step {
    background: white;
    padding: clamp(14px, 2.5vw, 24px);
    border-radius: 18px;
    border: 1px solid #d4e4ef;
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.7s ease, transform 0.7s ease;
    box-shadow: 0 4px 16px rgba(15,58,90,0.06);
}

.step.visible {
    opacity: 1;
    transform: translateY(0);
}

.step span {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-bottom: 10px;
    background: #0f3a5a;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.step h4 {
    font-size: clamp(0.9rem, 2vw, 1.05rem);
    color: #0f3a5a;
    margin-bottom: 5px;
    font-weight: 600;
}

.step p {
    font-size: clamp(0.82rem, 1.8vw, 0.92rem);
    color: #5a768a;
    line-height: 1.55;
}

/* Video */
.func-video {
    flex: 1;
    min-width: min(100%, 300px);
    max-width: 820px;
    height: clamp(240px, 45vw, 680px);
    align-self: stretch;
}

.func-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 20px;
    box-shadow: 0 16px 50px rgba(15,58,90,0.18);
}

/* =============================================
   FOOTER
   ============================================= */
#site-footer {
    width: 100%;
    background-color: #0f3a5a;
    padding: clamp(28px, 6vw, 50px) 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #ffffff;
}

.footer-wrap {
    text-align: center;
}

#footer-imagen {
    width: clamp(100px, 25vw, 220px) !important;
    height: auto !important;
    margin-bottom: 14px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.footer-legal {
    font-size: clamp(0.78rem, 2vw, 0.92rem);
    color: #cce0f0;
    margin-top: 8px;
}

/* =============================================
   RESPONSIVE — TABLET (≤ 900px)
   ============================================= */
@media (max-width: 900px) {

    /* Funcionamiento en columna */
    #Funcionamiento {
        flex-direction: column;
        align-items: center;
    }

    .func-steps {
        max-width: 100%;
        width: 100%;
    }

    .func-video {
        width: 100%;
        max-width: 100%;
        min-width: unset;
        height: clamp(220px, 55vw, 440px);
    }

    /* Fotos servicios: columna apilada */
    #servicios-fotos {
        height: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    #servicios-fotos img {
        position: relative !important;
        width: min(85%, 380px) !important;
        height: clamp(200px, 55vw, 380px) !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        transform: translateY(60px) !important;
    }

    #servicios-fotos img.visible {
        transform: translateY(0) !important;
    }
}

/* =============================================
   RESPONSIVE — MÓVIL (≤ 640px)
   ============================================= */
@media (max-width: 640px) {

    /* Mostrar hamburguesa, ocultar links */
    #menu-toggle {
        display: flex;
    }

    #nav-links {
        display: none;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: white;
        box-shadow: 0 8px 24px rgba(0,0,0,0.1);
        z-index: 100;
        padding: 12px 0 20px;
    }

    #nav-links.open {
        display: flex;
    }

    #nav-links li {
        width: 100%;
    }

    #nav-links li a {
        display: block;
        padding: 12px clamp(16px, 5vw, 28px);
        font-size: 1rem;
        border-bottom: 1px solid #f0f4f8;
    }

    .btn-nav {
        border-radius: 0 !important;
    }

    /* Menu posición relativa para el dropdown */
    #menu {
        position: relative;
    }

    #imagenes-categorias {
        height: clamp(180px, 55vw, 340px);
    }

    #servicios-fotos img {
        width: 90% !important;
        height: clamp(180px, 60vw, 320px) !important;
    }

    .func-video {
        height: clamp(200px, 60vw, 320px);
    }
}

/* =============================================
   RESPONSIVE — MÓVIL PEQUEÑO (≤ 380px)
   ============================================= */
@media (max-width: 380px) {
    #logo_sahlafix {
        width: 70px;
        height: 70px;
    }

    #Servicios h3 {
        font-size: 1rem;
        padding: 12px 14px;
    }

    .step {
        padding: 12px;
    }
}