/**
 * Custom CSS - JM Mantenimiento y Construcciones
 * Estilos personalizados del proyecto
 *
 * Estructura:
 * 1. Variables y fuentes
 * 2. General / Body
 * 3. Navbar
 * 4. Hero
 * 5. Secciones
 * 6. Footer
 * 7. Formulario
 * 8. Utilidades
 * 9. Responsive
 */

/* ================================================
   1. VARIABLES Y FUENTES
   ================================================ */
:root {
    --color-primary: #333333;
    --color-secondary: #666666;
    --color-accent: #0d6efd;
    --color-bg: #ffffff;
    --color-bg-alt: #f8f9fa;
    --color-text: #333333;
    --color-text-light: #666666;
    --color-border: #dee2e6;
    --font-primary: 'Montserrat', sans-serif;
    --topbar-height: 34px;
    --navbar-height: 70px;
    --fixed-header-height: calc(var(--topbar-height) + var(--navbar-height));
}

html {
    scroll-padding-top: var(--fixed-header-height);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    color: var(--color-text);
    background-color: var(--color-bg);
}

/* body-padding: para páginas sin hero (navbar fija) */
.body-padding {
    padding-top: calc(var(--fixed-header-height) + 30px);
}

/* ================================================
   2. NAVBAR
   ================================================ */
.top-contact-bar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    width: 100%;
    min-height: var(--topbar-height);
    background-color: var(--color-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
}

.top-contact-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.top-contact-icon {
    width: 14px;
    height: 14px;
    display: block;
}

.top-contact-links a {
    color: #ffffff;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.top-contact-links a:hover,
.top-contact-links a:focus {
    color: #ffffff;
    opacity: 0.8;
}

.navbar {
    top: var(--topbar-height);
    background-color: #ffffff;
    min-height: var(--navbar-height);
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.navbar.scrolled {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-brand-text {
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--color-primary);
}

.navbar-logo {
    width: auto;
    max-width: 180px;
    display: block;
}

.footer-logo {
    width: auto;
    max-width: 180px;
    display: block;
}

.navbar .nav-link {
    color: var(--color-text);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    transition: color 0.2s ease;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: #d62828;
}

.offcanvas.offcanvas-end {
    top: var(--topbar-height);
    height: calc(100% - var(--topbar-height));
}

/* ================================================
   3. HERO
   ================================================ */
.hero {
    min-height: 80vh;
    background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)), url('../img/landing/portada-jm.jpg') center/cover no-repeat;
    padding-top: var(--fixed-header-height);
    color: #fff;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    opacity: 0;
    transform: translateY(18px);
    animation: heroFadeIn 0.9s ease forwards;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: #fff;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(18px);
    animation: heroFadeIn 0.9s ease forwards;
    animation-delay: 0.25s;
}

@keyframes heroFadeIn {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================================
   4. SECCIONES
   ================================================ */
.section h1,
.section h2 {
    font-weight: 700;
    margin-bottom: 1rem;
}

#reformas-integrales {
    background: linear-gradient(to bottom, transparent, var(--color-bg-alt));
}

.section-alt {
    background-color: var(--color-bg-alt);
}

.section-cta {
    background-color: var(--color-primary);
    color: #ffffff;
}

.section-cta h1,
.section-cta h2,
.section-cta h3,
.section-cta p {
    color: #ffffff;
}

.section-resultados {
    background-color: #d62828;
    color: #ffffff;
}

.section-resultados .bloque-title,
.section-resultados .resultado-item {
    color: #ffffff;
}

.section-financiacion {
    position: relative;
    overflow: visible;
    margin-top: 6rem;
    background-color: var(--color-primary);
    color: #ffffff;
}

.section-financiacion h1,
.section-financiacion h2,
.section-financiacion h3,
.section-financiacion p {
    color: #ffffff;
}

.section-financiacion .container {
    position: relative;
    z-index: 2;
}

.financiacion-obrero {
    position: absolute;
    right: clamp(1rem, 6vw, 6rem);
    bottom: 0;
    z-index: 1;
    width: clamp(220px, 26vw, 360px);
    max-width: 19%;
    pointer-events: none;
}

@media (max-width: 991.98px) {
    .section-financiacion {
        padding-bottom: clamp(22rem, 48vw, 30rem) !important;
        text-align: center;
    }

    .section-financiacion .text-start {
        text-align: center !important;
    }

    .financiacion-obrero {
        opacity: 1;
        right: 50%;
        bottom: 0;
        transform: translateX(50%);
        width: clamp(200px, 32vw, 260px);
        max-width: 70vw;
    }
}

/* Placeholder para imágenes (quitar cuando se usen imágenes reales) */
.placeholder-img {
    background-color: #e9ecef;
    border: 2px dashed #ced4da;
    border-radius: 8px;
    padding: 60px 20px;
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
}

.section-eyebrow {
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    color: var(--color-text-muted, #6c757d);
    margin-bottom: 0.5rem;
}

.intro-pretitle {
    color: #d62828;
    font-size: 1rem;
    text-transform: uppercase;
}

.card-servicio {
    display: flex;
    flex-direction: column;
}

.card-servicio-img {
    aspect-ratio: 4 / 3;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.card-servicio-body h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0;
}

.card-servicio-body h3 a {
    color: #000;
    text-decoration: none;
}

.card-servicio-body h3::after {
    content: "";
    display: block;
    width: 40px;
    height: 2px;
    background-color: #d62828;
    margin: 20px 0;
}

.card-servicio-body p {
    margin-bottom: 0;
}

.bloque-img {
    aspect-ratio: 4 / 3;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 240px;
}

.card-foto {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    margin-bottom: 1rem;
}

.bloque-foto {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.bloque-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.bloque-detalle .bloque-title {
    margin-bottom: 0;
}

.bloque-detalle .bloque-title::after {
    content: "";
    display: block;
    width: 40px;
    height: 2px;
    background-color: #d62828;
    margin: 20px 0;
}

.resultado-item {
    font-size: 1.2rem;
    font-weight: 700;
    color: #d62828;
    margin-bottom: 0;
}

.resultado-numero,
.resultado-label {
    display: block;
}

.resultado-numero {
    font-size: 3rem;
    line-height: 1;
}

.resultado-label {
    font-size: 1.3rem;
    line-height: 1.25;
    margin-top: 0.25rem;
}

.btn-rojo {
    background-color: #d62828;
    border-color: #d62828;
    color: #fff;
}

.btn-rojo:hover,
.btn-rojo:focus,
.btn-rojo:active {
    background-color: #b71c1c;
    border-color: #b71c1c;
    color: #fff;
}

.como-subtitle {
    font-size: 1.05rem;
    color: var(--color-text-light, #666666);
}

.paso-numero {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background-color: #d62828;
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.paso-titulo {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.paso-texto {
    font-size: 0.95rem;
    margin-bottom: 0;
}

.ventaja-icono {
    width: auto;
    max-width: 64px;
    height: auto;
    display: block;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(16px) scale(0.94);
    transition: opacity 0.55s ease, transform 0.55s ease;
    will-change: opacity, transform;
}

.ventaja-icono.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.ventaja-titulo {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.ventaja-texto {
    font-size: 0.95rem;
    margin-bottom: 0;
}

#por-que-elegirnos {
    margin-bottom: 4rem;
}

/* ================================================
   5. FOOTER
   ================================================ */
.footer {
    background-color: var(--color-primary);
    color: #ffffff;
    padding: 3rem 0 1.5rem;
}

.footer-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-text {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
}

.footer-email {
    overflow-wrap: anywhere;
}

.footer-contact-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.footer-contact-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    margin-top: 0.15rem;
}

.footer-text a,
.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-text a:hover,
.footer-links a:hover {
    color: #ffffff;
}

.footer-links li {
    margin-bottom: 0.4rem;
}

.footer-links a {
    font-size: 0.875rem;
}

.footer-legal {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 1rem;
}

.footer-legal a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.8rem;
}

.footer-legal a:hover {
    color: #ffffff;
}

.whatsapp-fixed {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 1040;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: #00E676;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.whatsapp-fixed:hover,
.whatsapp-fixed:focus {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.26);
}

.whatsapp-fixed img {
    width: 34px;
    height: 34px;
    display: block;
}

/* ================================================
   6. FORMULARIO
   ================================================ */
.form-control:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.form-check-label a {
    color: inherit;
    text-decoration: underline;
}

.thanks-phone-links a {
    color: #d62828;
    font-weight: 700;
    text-decoration: none;
}

.thanks-phone-links a:hover,
.thanks-phone-links a:focus {
    color: #b71c1c;
}

.contacto-slogan {
    color: #d62828;
    font-weight: 600;
}

.contact-form-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.contact-form-actions .form-check {
    flex: 1;
}

.contact-form-actions .btn {
    flex: 0 0 auto;
}

/* ================================================
   7. RESPONSIVE
   ================================================ */
@media (max-width: 991.98px) {
    .hero-title {
        font-size: 2rem;
    }

    .footer-brand-col {
        text-align: center;
    }

    .footer-brand-col .footer-logo {
        margin: 0 auto;
    }
}

@media (max-width: 767.98px) {
    .hero {
        min-height: 60vh;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .contact-form-actions {
        flex-direction: column;
    }

    .contact-form-actions .btn {
        align-self: flex-end;
    }

    .section-resultados .resultado-col:not(:last-child) {
        margin-bottom: 3rem;
    }

    .whatsapp-fixed {
        right: 1rem;
        bottom: 1rem;
        width: 56px;
        height: 56px;
    }

    .whatsapp-fixed img {
        width: 30px;
        height: 30px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-title,
    .hero-subtitle {
        opacity: 1;
        transform: none;
        animation: none;
    }

    .ventaja-icono {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
