/* ==========================================================
   HC Inmobiliaria - BASE
   Tokens de diseño, reset, tipografía, botones, secciones y
   utilidades compartidas por todo el sitio.
   ========================================================== */

:root {
    /* ---- Marca (identidad HC: rojo coral del logo) ---- */
    --color-primary: #E74735;          /* acento de marca: íconos, precios, texto grande */
    --color-primary-dark: #B53322;     /* hover de botones y texto rojo sobre --color-primary-light (5.3:1) */
    --color-primary-light: #fdeceb;    /* fondos de chips / estados activos */
    --color-primary-600: #CE3B2A;      /* rojo de acción accesible: blanco encima 4.9:1; sobre --color-bg 4.6:1 */
    --color-primary-rgb: 231, 71, 53;  /* para rgba(var(--color-primary-rgb), .2) */

    /* ---- Neutros (grises cálidos) ---- */
    --color-ink: #1d1c1b;              /* titulares (16:1 sobre --color-bg) */
    --color-dark: #2a2826;
    --color-text: #45413d;             /* texto de lectura (9.6:1) */
    --color-text-light: #6b6661;       /* texto secundario (5.4:1 sobre --color-bg) */
    --color-bg: #faf9f7;               /* fondo general: blanco cálido */
    --color-white: #ffffff;
    --color-surface: #ffffff;          /* tarjetas, paneles, controles */
    --color-surface-alt: #f5f2ee;      /* secciones alternas, hovers suaves */
    --color-line: #ebe7e2;             /* bordes finos de tarjetas y divisores */
    --color-line-strong: #d6d0c9;      /* bordes de controles de formulario */
    --color-footer: #1c1a19;
    --color-whatsapp: #25D366;         /* solo elementos de WhatsApp (ícono / flotante) */
    --color-whatsapp-dark: #10804a;    /* botones de WhatsApp con texto: blanco encima 5:1 */

    /* ---- Tipografía ---- */
    --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --fs-xs: 0.75rem;
    --fs-sm: 0.875rem;
    --fs-base: 1rem;
    --fs-md: 1.125rem;
    --fs-lg: 1.25rem;
    --fs-xl: 1.5rem;
    --fs-2xl: clamp(1.6rem, 1.2rem + 1.4vw, 2.25rem);
    --fs-3xl: clamp(2rem, 1.4rem + 2.4vw, 3rem);
    --fs-display: clamp(2.3rem, 1.3rem + 4vw, 4rem);
    --lh-tight: 1.12;
    --lh-snug: 1.3;
    --lh-body: 1.65;
    --tracking-tight: -0.022em;
    --tracking-wide: 0.12em;

    /* ---- Espaciado ---- */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;
    --space-9: 96px;

    /* ---- Formas ---- */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 999px;

    /* ---- Sombras (suaves, en capas, tono cálido; nada de negro duro) ---- */
    --shadow-xs: 0 1px 2px rgba(28, 25, 23, 0.06);
    --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.04), 0 2px 8px rgba(28, 25, 23, 0.05);
    --shadow: 0 1px 3px rgba(28, 25, 23, 0.05), 0 8px 24px rgba(28, 25, 23, 0.07);
    --shadow-hover: 0 2px 6px rgba(28, 25, 23, 0.06), 0 16px 36px rgba(28, 25, 23, 0.11);
    --shadow-lg: 0 4px 10px rgba(28, 25, 23, 0.05), 0 24px 48px rgba(28, 25, 23, 0.13);
    --shadow-primary: 0 2px 4px rgba(231, 71, 53, 0.16), 0 10px 24px rgba(231, 71, 53, 0.26);

    /* ---- Movimiento ---- */
    --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
    --dur-fast: 150ms;
    --dur: 220ms;
    --dur-slow: 400ms;
    --transition: all var(--dur) var(--ease-out);

    /* ---- Accesibilidad / layout ---- */
    --focus-ring: 0 0 0 3px rgba(231, 71, 53, 0.32);
    --header-h: 76px;
    --container-max: 1240px;
}

/* Pantallas chicas: header más bajo (lo usan el nav y el scroll a anclas) */
@media (max-width: 992px) {
    :root { --header-h: 68px; }
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-h) + var(--space-4));
}
@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

/* Sin scroll horizontal. "clip" (a diferencia de "hidden") no convierte al
   body en contenedor de scroll, así el header sticky sigue funcionando.
   "hidden" queda de respaldo para navegadores viejos. */
html, body {
    max-width: 100%;
    overflow-x: hidden;
    overflow-x: clip;
}

body {
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: var(--lh-body);
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

a { text-decoration: none; color: inherit; }

ul { list-style: none; }

:where(button) { font-family: inherit; }

::selection {
    background: var(--color-primary-600);
    color: var(--color-white);
}

/* Foco visible para todo lo interactivo (teclado) */
:focus-visible {
    outline: 2px solid var(--color-primary-600);
    outline-offset: 3px;
}

/* Solo para lectores de pantalla */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===================== TIPOGRAFÍA ===================== */
h1, h2, h3, h4, h5, h6 {
    color: var(--color-ink);
    font-weight: 700;
    line-height: var(--lh-tight);
    letter-spacing: var(--tracking-tight);
    text-wrap: balance;
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-xl); line-height: var(--lh-snug); }
h3 { font-size: var(--fs-lg); line-height: var(--lh-snug); }
h4 { font-size: var(--fs-md); line-height: var(--lh-snug); }
h5, h6 { font-size: var(--fs-base); line-height: var(--lh-snug); }

/* Titulares sobre la foto del hero de la home: heredan el blanco de su
   contenedor (home.css puede definir su propio color, carga después). */
.hero h1,
.hero h2 { color: inherit; }

p { text-wrap: pretty; }

strong, b { font-weight: 600; }

/* Sobretítulo (eyebrow): mayúsculas chicas en rojo con una línea fina */
.eyebrow,
.section-header span.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--color-primary-600);
    font-size: var(--fs-xs);
    font-weight: 700;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}
.eyebrow::before,
.section-header span.eyebrow::before {
    content: '';
    width: 24px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
}

/* ===================== CONTENEDOR ===================== */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--space-5);
}

/* ===================== BOTONES ===================== */
/* Pill de 48px de alto (sm 40px, lg 56px). El alto sale del padding para que
   las variantes compactas de otros componentes (popups del mapa) sigan andando. */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 14px 26px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.005em;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition:
        background-color var(--dur) var(--ease-out),
        border-color var(--dur) var(--ease-out),
        color var(--dur) var(--ease-out),
        box-shadow var(--dur) var(--ease-out),
        transform var(--dur) var(--ease-out);
}
.btn i { font-size: 1.05em; line-height: 1; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled,
.btn[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }

/* Primario: rojo de acción accesible (texto blanco AA) */
.btn--primary {
    background: var(--color-primary-600);
    color: var(--color-white);
    box-shadow: var(--shadow-xs);
}
.btn--primary:hover {
    background: var(--color-primary-dark);
    color: var(--color-white);
    box-shadow: var(--shadow-primary);
}

/* Claro: para fondos oscuros o de color (hero, banner CTA) */
.btn--light {
    background: var(--color-white);
    color: var(--color-ink);
    box-shadow: var(--shadow-sm);
}
.btn--light:hover {
    background: var(--color-white);
    color: var(--color-primary-dark);
    box-shadow: var(--shadow-lg);
}

/* Contorno rojo */
.btn--outline {
    background: transparent;
    color: var(--color-primary-600);
    border-color: var(--color-primary-600);
}
.btn--outline:hover {
    background: var(--color-primary-600);
    color: var(--color-white);
    box-shadow: var(--shadow-primary);
}

/* Fantasma: acción secundaria neutra sobre fondos claros */
.btn--ghost {
    background: transparent;
    color: var(--color-ink);
    border-color: var(--color-line-strong);
}
.btn--ghost:hover {
    background: var(--color-surface);
    border-color: var(--color-ink);
    color: var(--color-ink);
}

/* WhatsApp: verde oscurecido para que el texto blanco pase AA */
.btn--whatsapp {
    background: var(--color-whatsapp-dark);
    color: var(--color-white);
    box-shadow: var(--shadow-xs);
}
.btn--whatsapp:hover {
    background: #0c6b3d;
    color: var(--color-white);
    box-shadow: 0 2px 4px rgba(16, 128, 74, 0.18), 0 10px 24px rgba(16, 128, 74, 0.28);
}

/* Tamaños */
.btn--sm { padding: 11px 18px; font-size: var(--fs-sm); }
.btn--lg { padding: 17px 32px; font-size: var(--fs-base); }
.btn--block { width: 100%; }

/* ===================== FORMULARIOS (base genérica) ===================== */
/* Especificidad cero (:where) a propósito: el buscador, el formulario de
   contacto y el de la ficha ajustan sus reglas sin pelear con esta base. */
:where(label) {
    display: block;
    margin-bottom: 6px;
    color: var(--color-ink);
    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: var(--lh-snug);
}
:where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="hidden"], [type="submit"], [type="button"], [type="reset"], [type="image"]), select, textarea) {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--color-line-strong);
    border-radius: var(--radius-sm);
    background-color: var(--color-surface);
    color: var(--color-ink);
    font: inherit;
    font-size: 16px;               /* 16px evita el zoom automático de iOS */
    line-height: 1.4;
    transition:
        border-color var(--dur-fast) var(--ease-out),
        box-shadow var(--dur-fast) var(--ease-out);
}
:where(textarea) {
    min-height: 120px;
    resize: vertical;
    line-height: var(--lh-body);
}
:where(input, textarea)::placeholder {
    color: var(--color-text-light);
    opacity: 1;
}
:where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="hidden"], [type="submit"], [type="button"], [type="reset"], [type="image"]), select, textarea):focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
}
:where(input, select, textarea):disabled {
    background-color: var(--color-surface-alt);
    color: var(--color-text-light);
    cursor: not-allowed;
}

/* ===================== SECCIONES ===================== */
/* Solo padding vertical: .section se combina con .container (contacto, ficha) */
.section { padding-block: var(--space-9); }
.section--gray {
    background: var(--color-surface);
    border-block: 1px solid var(--color-line);
}

/* Encabezado de sección centrado: eyebrow + h2 + p */
.section-header {
    max-width: 680px;
    margin: 0 auto var(--space-7);
    text-align: center;
}
.section-header:not(.section-header--split) span.eyebrow::after,
.section-header:not(.section-header--split) .eyebrow::after {
    content: '';
    width: 24px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
}
.section-header h2 {
    margin: var(--space-3) 0;
    font-size: var(--fs-2xl);
    line-height: var(--lh-tight);
}
.section-header p {
    color: var(--color-text-light);
    font-size: 1.0625rem;
}
.section-header > :last-child { margin-bottom: 0; }

/* Variante: título a la izquierda y acciones a la derecha */
.section-header--split {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-5) var(--space-6);
    max-width: none;
    text-align: left;
}
.section-header--split p { max-width: 560px; }
.section-header__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
}

/* ===================== CHIP DE ÍCONO ===================== */
.icon-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 1.1rem;
    line-height: 1;
}
.icon-chip--round { border-radius: 50%; }
.icon-chip--sm { width: 40px; height: 40px; font-size: 1rem; }
.icon-chip--lg { width: 48px; height: 48px; font-size: 1.2rem; border-radius: var(--radius-md); }
.icon-chip--dark { background: rgba(255, 255, 255, 0.07); color: var(--color-primary); }  /* sobre fondos oscuros */

/* ===================== EMPTY STATE ===================== */
.empty-state {
    grid-column: 1 / -1;           /* si queda dentro de una grilla, ocupa todo el ancho */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    max-width: 560px;
    margin-inline: auto;
    padding: var(--space-8) var(--space-5);
    text-align: center;
    color: var(--color-text-light);
    background: var(--color-surface);
    border: 1px dashed var(--color-line-strong);
    border-radius: var(--radius-lg);
}
.empty-state > i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: var(--space-2);
    border-radius: 50%;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 1.75rem;
}
.empty-state h2,
.empty-state h3 { font-size: var(--fs-lg); }
.empty-state p { max-width: 42ch; }
.empty-state .btn { margin-top: var(--space-3); }

/* ===================== MOVIMIENTO REDUCIDO ===================== */
/* Los tokens de duración van a ~0: todo lo que use --transition / --dur
   queda sin animación sin necesidad de !important. */
@media (prefers-reduced-motion: reduce) {
    :root {
        --dur-fast: 1ms;
        --dur: 1ms;
        --dur-slow: 1ms;
        --transition: none;
    }
    *, *::before, *::after {
        animation-duration: 1ms;
        animation-iteration-count: 1;
        transition-duration: 1ms;
        scroll-behavior: auto;
    }
    .btn:hover { transform: none; }
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 992px) {
    .section { padding-block: var(--space-8); }
}

@media (max-width: 768px) {
    .container { padding-inline: 20px; }
    .section-header { margin-bottom: var(--space-6); }
    .section-header--split {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .section { padding-block: 56px; }
    .btn { padding-inline: 22px; white-space: normal; }
    .btn--sm { padding-inline: 16px; }
    .btn--lg { padding-inline: 26px; }
    .empty-state { padding: var(--space-7) var(--space-4); }
}
