/* Peritajes Responsive para Elementor Pro */
html, body { max-width: 100%; }
body.pep-fix-overflow { overflow-x: clip; }
body.pep-responsive-media img,
body.pep-responsive-media video,
body.pep-responsive-media iframe,
body.pep-responsive-media svg { max-width: 100%; }
body.pep-responsive-media img, body.pep-responsive-media video { height: auto; }

/* Evita franjas laterales creadas por wrappers del tema o Elementor. */
body.pep-responsive-enabled,
body.pep-responsive-enabled #page,
body.pep-responsive-enabled .site,
body.pep-responsive-enabled .site-content,
body.pep-responsive-enabled .elementor-location-header,
body.pep-responsive-enabled .elementor-location-footer {
    width: 100%;
    max-width: 100%;
}
body.pep-responsive-enabled .elementor-location-header > .elementor-element,
body.pep-responsive-enabled .elementor-location-footer > .elementor-element {
    width: 100% !important;
    max-width: none !important;
    margin-inline: 0 !important;
}

/* Elementor containers and legacy sections */
body.pep-responsive-enabled .e-con,
body.pep-responsive-enabled .elementor-section > .elementor-container {
    min-width: 0;
}
body.pep-responsive-enabled .elementor-widget,
body.pep-responsive-enabled .elementor-widget-container,
body.pep-responsive-enabled .elementor-column,
body.pep-responsive-enabled .elementor-column-wrap { min-width: 0; }

/* MacBook Air 13 and common notebooks */
@media (min-width: 1366px) and (max-width: 1512px) {
    body.pep-responsive-enabled .e-con.e-con-boxed > .e-con-inner,
    body.pep-responsive-enabled .elementor-section.elementor-section-boxed > .elementor-container,
    body.pep-responsive-enabled header .e-con-inner,
    body.pep-responsive-enabled footer .e-con-inner {
        max-width: var(--pep-width-13) !important;
        width: calc(100% - (var(--pep-padding-13) * 2));
    }
    /* Mantiene fondos full-width. El espacio se aplica solo al contenido interno. */
    body.pep-responsive-enabled .e-con.e-con-full,
    body.pep-responsive-enabled .elementor-section.elementor-section-full_width,
    body.pep-responsive-enabled .elementor-location-header,
    body.pep-responsive-enabled .elementor-location-footer {
        width: 100% !important;
        max-width: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* MacBook Air/Pro 14 and medium desktop */
@media (min-width: 1513px) and (max-width: 1728px) {
    body.pep-responsive-enabled .e-con.e-con-boxed > .e-con-inner,
    body.pep-responsive-enabled .elementor-section.elementor-section-boxed > .elementor-container,
    body.pep-responsive-enabled header .e-con-inner,
    body.pep-responsive-enabled footer .e-con-inner {
        max-width: var(--pep-width-14) !important;
        width: calc(100% - (var(--pep-padding-14) * 2));
    }
    /* Mantiene fondos full-width. El espacio se aplica solo al contenido interno. */
    body.pep-responsive-enabled .e-con.e-con-full,
    body.pep-responsive-enabled .elementor-section.elementor-section-full_width,
    body.pep-responsive-enabled .elementor-location-header,
    body.pep-responsive-enabled .elementor-location-footer {
        width: 100% !important;
        max-width: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* Fluid typography while preserving Elementor choices */
@media (min-width: 1025px) and (max-width: 1728px) {
    body.pep-fluid-typography .elementor-heading-title.elementor-size-xxl,
    body.pep-fluid-typography h1.elementor-heading-title { font-size: clamp(42px, 3.15vw, 60px); line-height: 1.12; }
    body.pep-fluid-typography h2.elementor-heading-title { font-size: clamp(32px, 2.45vw, 46px); line-height: 1.18; }
    body.pep-fluid-typography h3.elementor-heading-title { font-size: clamp(24px, 1.8vw, 34px); }
    body.pep-fluid-typography .elementor-widget-text-editor { font-size: clamp(16px, 1.05vw, 18px); }
}

/* Hero: applies to common semantic classes and first prominent section */
@media (min-width: 1025px) and (max-width: 1728px) {
    body.pep-responsive-enabled :is(.hero, .hero-section, .hero-peritajes, .banner-principal, [class*="hero-"]) {
        min-height: var(--pep-hero-min-height);
        display: flex;
        align-items: center;
    }
}

/* Elementor Pro Theme Builder header */
@media (min-width: 1025px) and (max-width: 1728px) {
    body.pep-compact-header .elementor-location-header > .elementor-element,
    body.pep-compact-header header.elementor-location-header {
        min-height: var(--pep-header-height);
    }
    body.pep-compact-header .elementor-nav-menu--main .elementor-item { white-space: nowrap; }
    body.pep-compact-header .elementor-location-header .elementor-widget-image img { max-height: calc(var(--pep-header-height) - 22px); width: auto; }
}

/* Elementor Pro forms */
body.pep-optimize-forms .elementor-widget-form .elementor-form { width: 100%; max-width: var(--pep-form-max-width); }
body.pep-optimize-forms .elementor-field-group { min-width: 0; }
body.pep-optimize-forms .elementor-field,
body.pep-optimize-forms .elementor-button { min-height: 48px; }
body.pep-optimize-forms .elementor-field-textual { max-width: 100%; }
body.pep-optimize-forms .elementor-g-recaptcha { max-width: 100%; overflow: hidden; }

/* Cards and service grids. Add servicios-grid to the parent for deterministic behavior. */
@media (min-width: 1025px) and (max-width: 1728px) {
    body.pep-optimize-cards :is(.servicios-grid, .services-grid, .tarjetas-servicios) {
        display: grid !important;
        grid-template-columns: repeat(var(--pep-services-columns), minmax(0, 1fr));
        gap: clamp(20px, 2vw, 34px);
    }
    body.pep-optimize-cards :is(.servicios-grid, .services-grid, .tarjetas-servicios) > * { height: 100%; min-width: 0; }
}

/* Presets */
body.pep-preset-compact { --pep-section-space: 56px; }
body.pep-preset-balanced { --pep-section-space: 76px; }
body.pep-preset-spacious { --pep-section-space: 96px; }
@media (min-width: 1025px) and (max-width: 1728px) {
    body.pep-responsive-enabled :is(.pep-auto-spacing, .seccion-peritajes) { padding-top: var(--pep-section-space); padding-bottom: var(--pep-section-space); }
}

/* Tablet and mobile safety */
@media (max-width: 1024px) {
    body.pep-responsive-enabled .e-con,
    body.pep-responsive-enabled .elementor-section { max-width: 100%; }
    body.pep-mobile-stack :is(.pep-stack-mobile, .columnas-contacto, .detalle-servicio) { flex-direction: column !important; }
    body.pep-optimize-forms .elementor-widget-form .elementor-form { max-width: 100%; }
}
@media (max-width: 767px) {
    body.pep-responsive-enabled .e-con,
    body.pep-responsive-enabled .elementor-section { --padding-left: 20px; --padding-right: 20px; }
    body.pep-fluid-typography h1.elementor-heading-title { font-size: clamp(34px, 10vw, 46px); }
    body.pep-fluid-typography h2.elementor-heading-title { font-size: clamp(28px, 8vw, 38px); }
    body.pep-optimize-forms .elementor-field-group { width: 100% !important; }
}

body.pep-debug-outline .pep-overflowing-element { outline: 3px solid currentColor !important; outline-offset: -3px; }
