/* ==========================================================================
   CRISTCAM — Base y sistema de diseño
   Tokens, reset, tipografía y componentes reutilizables (prefijo .ui-).
   Se carga en todas las páginas ANTES del CSS propio de cada página.
   ========================================================================== */

:root {
    /* Marca */
    --primary: #f27405;
    --primary-light: #ff9434;
    --primary-dark: #d6620a;
    --primary-transparent: rgba(242, 116, 5, 0.1);
    --primary-50: #fff5ec;
    --primary-100: #ffe6d1;

    /* Neutros */
    --ink: #0e1014;
    --ink-2: #171a20;
    --ink-3: #22262e;
    --fg: #16181d;
    --muted: #5d6471;
    --line: #e6e8ec;
    --line-dark: rgba(255, 255, 255, 0.1);
    --surface: #ffffff;
    --surface-soft: #f6f7f9;

    /* Heredados (páginas aún no rediseñadas) */
    --secondary: #2c3e50;
    --light: #f8f9fa;
    --white: #ffffff;
    --dark: #1a1a1a;
    --gray: #6c757d;
    --light-gray: #e9ecef;

    /* Tipografía */
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Inter Tight', 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
    --concrete: #ecebe7;
    --concrete-2: #f6f5f2;

    /* Forma y profundidad */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
    --shadow-md: 0 8px 24px -6px rgba(16, 24, 40, 0.12);
    --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, 0.22);
    --shadow-glow: 0 10px 30px -8px rgba(242, 116, 5, 0.55);

    /* Layout */
    --header-h: 76px;
    --section-y: clamp(64px, 7vw, 104px);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (max-width: 992px) {
    :root {
        --header-h: 66px;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 16px);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    color: var(--secondary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img {
    max-width: 100%;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

::selection {
    background: var(--primary);
    color: #fff;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.ui-container {
    width: min(100% - 48px, 1240px);
    margin-inline: auto;
}

@media (max-width: 600px) {
    .ui-container {
        width: calc(100% - 32px);
    }
}

/* --------------------------------------------------------------------------
   Componentes
   -------------------------------------------------------------------------- */

/* Botones */
.ui-btn {
    --btn-bg: var(--ink);
    --btn-fg: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 52px;
    padding: 0 26px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: var(--btn-bg);
    color: var(--btn-fg);
    font: 600 15px/1 var(--font-body);
    letter-spacing: -0.01em;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background-color 0.2s, color 0.2s, border-color 0.2s;
}

.ui-btn i {
    font-size: 0.9em;
    transition: transform 0.3s var(--ease);
}

.ui-btn:hover {
    transform: none;
}

.ui-btn:hover .fa-arrow-right {
    transform: translateX(3px);
}

.ui-btn--primary {
    --btn-bg: var(--primary);
}

.ui-btn--primary:hover {
    --btn-bg: var(--primary-dark);
}

.ui-btn--light {
    --btn-bg: #fff;
    --btn-fg: var(--ink);
}

.ui-btn--ghost {
    --btn-bg: transparent;
    --btn-fg: var(--fg);
    border-color: var(--line);
}

.ui-btn--ghost:hover {
    border-color: var(--fg);
}

.ui-btn--ghost-light {
    --btn-bg: rgba(255, 255, 255, 0.08);
    --btn-fg: #fff;
    border-color: rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ui-btn--ghost-light:hover {
    --btn-bg: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.6);
}

.ui-btn--sm {
    height: 42px;
    padding: 0 18px;
    font-size: 14px;
}

/* Etiqueta superior de sección */
.ui-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    color: var(--primary);
    font: 600 13px/1 var(--font-body);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.ui-eyebrow::before {
    content: '';
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
}

/* Cápsula de estado */
.ui-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    font: 500 13px/1 var(--font-body);
}

.ui-pill__dot {
    position: relative;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3ddc84;
}

.ui-pill__dot::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: #3ddc84;
    opacity: 0.4;
    animation: ui-ping 2s var(--ease) infinite;
}

@keyframes ui-ping {
    0% { transform: scale(0.6); opacity: 0.5; }
    100% { transform: scale(2); opacity: 0; }
}

/* Encabezado de sección */
.ui-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px 48px;
    margin-bottom: clamp(40px, 5vw, 64px);
}

.ui-section-head__text {
    max-width: 680px;
}

.ui-section-head--center {
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.ui-title {
    color: var(--fg);
    font: 700 clamp(2rem, 1.3rem + 2.6vw, 3.25rem)/1.08 var(--font-display);
    letter-spacing: -0.035em;
    text-wrap: balance;
}

.ui-lead {
    margin-top: 18px;
    color: var(--muted);
    font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    line-height: 1.7;
    text-wrap: pretty;
}

.ui-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--fg);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid currentColor;
    padding-bottom: 2px;
    transition: color 0.2s, gap 0.3s var(--ease);
}

.ui-link:hover {
    color: var(--primary);
    gap: 12px;
}

/* --------------------------------------------------------------------------
   Componentes de sección compartidos (prefijo hx-)
   -------------------------------------------------------------------------- */
.hx-mono {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
}

.hx-label {
    margin-bottom: 10px;
    color: var(--primary);
}

.hx-title {
    color: var(--ink);
    font: 700 clamp(1.75rem, 1.25rem + 1.5vw, 2.5rem)/1.15 var(--font-display);
    letter-spacing: -0.02em;
    text-wrap: balance;
}

.hx-title em {
    font-style: normal;
}

.hx-title--dark {
    color: var(--ink);
}

.hx-head {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 0 48px;
    margin-bottom: clamp(32px, 4vw, 52px);
}

.hx-head .hx-label {
    grid-column: 1 / -1;
}

.hx-head--center {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
}

.hx-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(14, 16, 20, 0.25);
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
    transition: gap 0.3s var(--ease), border-color 0.3s, color 0.3s;
}

.hx-link:hover {
    gap: 16px;
    border-color: var(--primary);
    color: var(--primary);
}

.hx-btn-lg {
    height: 60px;
    padding: 0 32px;
    font-size: 16px;
}

.hx-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 10px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 0 rgba(242, 116, 5, 0.6);
    animation: hx-pulse 2s infinite;
    vertical-align: middle;
}

@keyframes hx-pulse {
    70% { box-shadow: 0 0 0 10px rgba(242, 116, 5, 0); }
    100% { box-shadow: 0 0 0 0 rgba(242, 116, 5, 0); }
}

/* Esquinas de plano técnico */
.hx-corner {
    position: absolute;
    width: 26px;
    height: 26px;
    border: 0 solid var(--primary);
    pointer-events: none;
}

.hx-corner--tl { top: 18px; left: 18px; border-top-width: 2px; border-left-width: 2px; }
.hx-corner--tr { top: 18px; right: 18px; border-top-width: 2px; border-right-width: 2px; }
.hx-corner--bl { bottom: 18px; left: 18px; border-bottom-width: 2px; border-left-width: 2px; }
.hx-corner--br { bottom: 18px; right: 18px; border-bottom-width: 2px; border-right-width: 2px; }

/* CTA final: panel oscuro con foto real de la flota (partial cta.html) */
.hx-cta {
    padding: var(--section-y) 0;
    background: var(--surface);
}

.hx-cta__panel {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    min-height: 380px;
    overflow: hidden;
    border-radius: 10px;
    background: var(--ink);
    color: #fff;
}

.hx-cta__content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(32px, 5vw, 64px);
}

.hx-cta__label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #ffa652;
    font-size: 14px;
    font-weight: 600;
}

.hx-cta__label::before {
    content: '';
    width: 22px;
    height: 2px;
    background: var(--primary);
}

.hx-cta__title {
    margin-top: 12px;
    color: #fff;
    font: 700 clamp(1.8rem, 1.3rem + 1.6vw, 2.6rem)/1.12 var(--font-display);
    letter-spacing: -0.025em;
    text-wrap: balance;
}

.hx-cta__lead {
    max-width: 480px;
    margin-top: 14px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 1.02rem;
    line-height: 1.7;
}

.hx-cta__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
}

.hx-cta__actions .fa-whatsapp {
    color: #25d366;
    font-size: 1.2em;
}

.hx-cta__facts {
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

.hx-cta__facts span {
    margin: 0 8px;
    color: var(--primary);
}

.hx-cta__media {
    position: relative;
    min-height: 280px;
}

.hx-cta__media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* La foto se funde con el panel oscuro */
.hx-cta__media::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(90deg, var(--ink) 0%, rgba(14, 16, 20, 0.35) 30%, rgba(14, 16, 20, 0) 60%);
}

.hx-cta__call {
    position: absolute;
    right: 24px;
    bottom: 24px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px 12px 12px;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 16px 32px -14px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s var(--ease);
}

.hx-cta__call:hover {
    transform: translateY(-2px);
}

.hx-cta__call small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.hx-cta__call-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
}

@media (max-width: 900px) {
    .hx-cta__panel {
        grid-template-columns: 1fr;
    }

    .hx-cta__media {
        order: -1;
        min-height: 220px;
    }

    .hx-cta__media::before {
        background: linear-gradient(0deg, var(--ink) 0%, rgba(14, 16, 20, 0) 55%);
    }

    .hx-cta__call {
        left: 16px;
        right: auto;
        bottom: 16px;
    }
}

@media (max-width: 520px) {
    .hx-cta__actions .ui-btn {
        width: 100%;
    }
}

/* --------------------------------------------------------------------------
   Animación de entrada: main.js marca con .reveal-pending solo los elementos
   [data-reveal] que están bajo la primera pantalla (sin parpadeo al cargar)
   -------------------------------------------------------------------------- */
.reveal-pending {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
    transition-delay: var(--reveal-delay, 0s);
}

.reveal-pending.is-visible {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal-pending {
        opacity: 1;
        transform: none;
    }
}

/* --------------------------------------------------------------------------
   Utilidades
   -------------------------------------------------------------------------- */

/* Textura de grano (concreto) sobre toda la página: body.has-grain */
.has-grain::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 3000;
    pointer-events: none;
    opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Inclinación 3D ([data-tilt], controlada por main.js) */
[data-tilt] {
    transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transform-style: preserve-3d;
    transition: transform 0.6s var(--ease);
    will-change: transform;
}

[data-tilt].is-tilting {
    transition: transform 0.12s linear;
}

/* Botón magnético ([data-magnetic]) */
[data-magnetic] {
    translate: var(--mx, 0) var(--my, 0);
    transition: translate 0.4s var(--ease), transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background-color 0.2s, color 0.2s, border-color 0.2s;
}

/* Campo trampa antispam: invisible para personas, visible para bots */
.hp-field {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    opacity: 0;
}

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

/* Página 404 */
.not-found {
    min-height: 60vh;
    display: flex;
    align-items: center;
    padding: 140px 0 80px;
    text-align: center;
}

.not-found h1 {
    font: 800 clamp(4rem, 10vw, 7rem)/1 var(--font-display);
    letter-spacing: -0.04em;
    color: var(--primary);
}

.not-found p {
    font-size: 1.2rem;
    margin: 16px 0 32px;
    color: var(--muted);
}

/* --------------------------------------------------------------------------
   Encabezado de páginas internas (texto + foto real enmarcada)
   -------------------------------------------------------------------------- */
.hx-page-hero {
    padding: calc(var(--header-h) + clamp(40px, 6vw, 72px)) 0 clamp(48px, 6vw, 80px);
    background:
        radial-gradient(700px circle at 100% 0%, rgba(242, 116, 5, 0.08), transparent 60%),
        var(--surface);
    border-bottom: 1px solid var(--line);
}

body:not(.index-page) .hx-page-hero {
    margin-top: calc(var(--header-h) * -1);
}

.hx-page-hero__grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    align-items: center;
    gap: clamp(36px, 6vw, 88px);
}

.hx-breadcrumb {
    display: flex;
    gap: 8px;
    margin-bottom: 22px;
    color: var(--muted);
    font-size: 13px;
}

.hx-breadcrumb a {
    color: var(--muted);
    text-decoration: none;
}

.hx-breadcrumb a:hover {
    color: var(--primary);
}

.hx-breadcrumb [aria-current] {
    color: var(--fg);
    font-weight: 600;
}

.hx-page-hero__title {
    color: var(--ink);
    font: 700 clamp(2rem, 1.4rem + 1.9vw, 3rem)/1.1 var(--font-display);
    letter-spacing: -0.03em;
    text-wrap: balance;
}

.hx-page-hero__lead {
    max-width: 560px;
    margin-top: 18px;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
}

.hx-page-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
    list-style: none;
}

.hx-page-hero__meta li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--fg);
    font-size: 13px;
    font-weight: 500;
}

.hx-page-hero__meta i {
    color: var(--primary);
    font-size: 12px;
}

.hx-page-hero__media {
    position: relative;
}

.hx-page-hero__media img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 30px 60px -30px rgba(14, 16, 20, 0.45);
}

.hx-page-hero__badge {
    position: absolute;
    left: -24px;
    bottom: 28px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1px solid rgba(14, 16, 20, 0.06);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 20px 40px -20px rgba(14, 16, 20, 0.35);
}

.hx-page-hero__badge strong {
    color: var(--ink);
    font: 700 1.9rem/1 var(--font-display);
    letter-spacing: -0.04em;
}

.hx-page-hero__badge span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

@media (max-width: 900px) {
    .hx-page-hero__grid {
        grid-template-columns: 1fr;
    }

    .hx-page-hero__badge {
        left: 16px;
        bottom: 16px;
    }
}
