/* ============================================================
   Codexia — Sistema de diseño
   Tesis: "El cumplimiento como sello de autoridad."
   Navy institucional + oro (sello de validación) + Garamond.
   ============================================================ */

:root {
    /* Marca */
    --navy-900: #030839;
    --navy-800: #060c44;
    --navy-700: #0a1250;
    --navy-600: #121a63;
    --gold-700: #9a6206; /* texto-acento sobre fondo claro (AA) */
    --gold-600: #b8730a; /* acento medio sobre claro (large text AA) */
    --gold-500: #ffac27; /* relleno / acento sobre navy */
    --gold-400: #ffb84a;
    --gold-300: #ffc869;
    --paper:    #fbfaf7;
    --ink:      #0a0a0a;
    --sub:      #595965;

    /* Acentos de producto (solo dentro de su sección) */
    --plux: #3b82f6;
    --befy: #f5b222;

    /* Ritmo */
    --shell-x: clamp(1.25rem, 4vw, 3rem);
    --shell-max: 1440px;

    /* Líneas finas sobre navy / papel */
    --line-light: rgba(255, 255, 255, 0.10);
    --line-dark:  rgba(3, 8, 57, 0.10);
}

* { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

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

/* Sin scroll horizontal accidental en ningún breakpoint */
html, body { overflow-x: hidden; max-width: 100%; }

body { font-feature-settings: "ss01", "cv01"; }

/* Contenedor maestro */
.shell {
    width: 100%;
    max-width: min(100%, var(--shell-max));
    margin-inline: auto;
    padding-inline: var(--shell-x);
}

/* Cifras fiscales: tabulares, siempre alineadas */
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* Display Garamond con cursiva dorada para los acentos.
   Por defecto, acento sobre fondo CLARO (oro profundo, legible).
   Dentro de una sección oscura usar .on-dark para el oro brillante. */
.display { font-family: "EB Garamond", Georgia, serif; letter-spacing: -0.01em; }
.seal-word {
    font-family: "EB Garamond", Georgia, serif;
    font-style: italic;
    color: var(--gold-600);
}
.on-dark .seal-word, .seal-word.on-dark { color: var(--gold-400); }

/* Eyebrow / etiqueta de sección */
.eyebrow {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

/* Foco accesible coherente */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--gold-500);
    outline-offset: 3px;
    border-radius: 4px;
}

/* Glass sobre navy */
.glass {
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    border: 1px solid var(--line-light);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

/* Resplandor ambiental dorado del hero */
.aura {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    opacity: 0.5;
}

/* Barra de progreso de scroll */
#scroll-bar {
    position: fixed; top: 0; left: 0;
    height: 2px; width: 0%;
    background: linear-gradient(90deg, var(--gold-500), var(--gold-300));
    z-index: 200; pointer-events: none;
    transition: width 0.08s linear;
}

/* Revelado al hacer scroll — visible por defecto (a prueba de no-JS);
   solo se oculta cuando el documento declara que hay JS (html.js). */
.reveal { opacity: 1; transform: none; }
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"] { transition-delay: .08s; }
.reveal[data-d="2"] { transition-delay: .16s; }
.reveal[data-d="3"] { transition-delay: .24s; }
.reveal[data-d="4"] { transition-delay: .32s; }
@media (prefers-reduced-motion: reduce) {
    .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* Tarjetas con lift */
.card-lift { transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease; }
.card-lift:hover { transform: translateY(-5px); }

/* Subrayado dorado animado en enlaces de cuerpo */
.ulink { background-image: linear-gradient(var(--gold-500), var(--gold-500));
    background-size: 0% 1.5px; background-repeat: no-repeat; background-position: 0 100%;
    transition: background-size .3s ease; padding-bottom: 1px; }
.ulink:hover { background-size: 100% 1.5px; }

/* Flecha que avanza en "Ver más" */
.go .arr { display: inline-block; transition: transform .2s ease; }
.go:hover .arr { transform: translateX(4px); }

/* ============================================================
   FIRMA VISUAL — Comprobante fiscal electrónico "vivo"
   Estado base = APROBADO (lo que ven con reduced-motion).
   La secuencia cinemática se activa solo con movimiento permitido.
   ============================================================ */

.ecf {
    --row-stagger: 0ms;
    position: relative;
}
.ecf__line { opacity: 1; transform: none; }
.ecf__sign-path { stroke-dasharray: 1; stroke-dashoffset: 0; }
.ecf__status .step { opacity: 1; }
.ecf__status .step--ok { color: var(--gold-300); }
.ecf__seal {
    opacity: 1; transform: rotate(-11deg) scale(1);
}
.ecf__qr { opacity: 1; }
.ecf__total { color: var(--gold-300); }
.ecf__progress { width: 100%; }

@media (prefers-reduced-motion: no-preference) {
    /* Estados iniciales (ocultos) y animaciones que terminan en APROBADO */
    .ecf__card { animation: ecf-card .7s cubic-bezier(.16,.84,.44,1) both; }

    .ecf__line { opacity: 0; transform: translateY(8px);
        animation: ecf-row .5s ease forwards; animation-delay: var(--row-stagger); }

    .ecf__sign-path { stroke-dasharray: 240; stroke-dashoffset: 240;
        animation: ecf-sign 1s ease forwards 1.7s; }

    .ecf__status .step { opacity: .3; }
    .ecf__status .step--recv { animation: ecf-step .4s ease forwards 2.4s; }
    .ecf__status .step--ok   { color: var(--gold-300); animation: ecf-step .4s ease forwards 3.25s; }
    .ecf__progress { width: 0%; animation: ecf-progress 1s ease forwards 2.5s; }

    .ecf__seal { opacity: 0; transform: rotate(-30deg) scale(1.5);
        animation: ecf-stamp .55s cubic-bezier(.2,1.3,.5,1) forwards 3.25s; }
    .ecf__qr { opacity: 0; animation: ecf-fade .5s ease forwards 3.5s; }
    .ecf__total { color: #fff; animation: ecf-gold .5s ease forwards 3.4s; }
}

@keyframes ecf-card { from { opacity: 0; transform: translateY(24px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes ecf-row  { to { opacity: 1; transform: none; } }
@keyframes ecf-sign { to { stroke-dashoffset: 0; } }
@keyframes ecf-step { to { opacity: 1; } }
@keyframes ecf-progress { to { width: 100%; } }
@keyframes ecf-fade { to { opacity: 1; } }
@keyframes ecf-gold { to { color: var(--gold-300); } }
@keyframes ecf-stamp {
    0% { opacity: 0; transform: rotate(-30deg) scale(1.5); }
    60% { opacity: 1; }
    100% { opacity: 1; transform: rotate(-11deg) scale(1); }
}

/* Pulso sutil del sello al terminar (ambiente, no distrae) */
@media (prefers-reduced-motion: no-preference) {
    .ecf__seal-ring { animation: seal-pulse 3.2s ease-in-out 4s infinite; }
}
@keyframes seal-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,172,39,0); } 50% { box-shadow: 0 0 0 6px rgba(255,172,39,.10); } }

/* Tagline rotativo del hero */
.rotator { transition: opacity .4s ease; }

/* ============================================================
   FORMULARIO DE CONTACTO (.cx-form)
   ============================================================ */
.cx-field { position: relative; }
.cx-input {
    width: 100%;
    border-radius: 0.85rem;
    border: 1px solid var(--line-dark);
    background: #fff;
    padding: 0.95rem 1.05rem;
    font-size: 16px; /* evita zoom en iOS */
    color: var(--ink);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.cx-input::placeholder { color: #9a9aa5; }
.cx-input:focus {
    outline: none;
    border-color: var(--gold-500);
    box-shadow: 0 0 0 4px rgba(255,172,39,0.18);
}
.cx-input--dark {
    background: rgba(255,255,255,0.05);
    border-color: var(--line-light);
    color: #fff;
}
.cx-input--dark::placeholder { color: rgba(255,255,255,0.45); }
.cx-hp { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; overflow: hidden; }
.cx-status { font-size: 0.9rem; min-height: 1.2rem; }

/* ============================================================
   FLUJO DGII — "El viaje de tu factura"
   Estado base (reduced-motion / sin JS) = todo activo + sello puesto.
   ============================================================ */
.flow { position: relative; }

/* Nodo (círculo con ícono). Estado base = "activo" (para reduced-motion / sin JS). */
.flow-node-ring {
    position: relative;
    display: grid; place-items: center;
    height: 4.25rem; width: 4.25rem;
    border-radius: 9999px;
    background: rgba(255,255,255,0.05);
    border: 1.5px solid rgba(255,172,39,0.5);
    color: var(--gold-300);
    box-shadow: 0 0 22px 0 rgba(255,172,39,0.14);
    transition: border-color .4s ease, box-shadow .4s ease, color .4s ease;
}

/* Conector con "corriente" dorada que se propaga (scale). */
.flow-conn { position: relative; overflow: hidden; border-radius: 9999px; background: rgba(255,255,255,0.12); }
.flow-fill {
    position: absolute; inset: 0;
    background: linear-gradient(90deg, var(--gold-600), var(--gold-300));
    transform: scaleX(1); transform-origin: left; border-radius: inherit;
}
.flow-fill--v {
    background: linear-gradient(180deg, var(--gold-600), var(--gold-300));
    transform: scaleY(1); transform-origin: top;
}

/* Sello de aprobación del flujo: siempre visible (es el premio); hace "pop" al validar. */
.flow-seal { transform: rotate(-9deg) scale(1); opacity: 1; }
.flow-seal-glow { box-shadow: 0 0 0 0 rgba(255,172,39,0); }

@media (prefers-reduced-motion: no-preference) {
    .flow[data-anim="on"] .flow-node-ring {
        animation: flow-node 7s ease-in-out infinite;
        border-color: rgba(255,255,255,0.14); color: rgba(255,200,105,0.45);
        box-shadow: 0 0 0 0 rgba(255,172,39,0);
    }
    .flow[data-anim="on"] .flow-node-ring[data-i="0"] { animation-delay: 0s; }
    .flow[data-anim="on"] .flow-node-ring[data-i="1"] { animation-delay: 1.1s; }
    .flow[data-anim="on"] .flow-node-ring[data-i="2"] { animation-delay: 2.4s; }
    .flow[data-anim="on"] .flow-node-ring[data-i="3"] { animation-delay: 3.7s; }

    .flow[data-anim="on"] .flow-fill   { animation: flow-fill-x 7s ease infinite; transform: scaleX(0); }
    .flow[data-anim="on"] .flow-fill--v{ animation: flow-fill-y 7s ease infinite; transform: scaleY(0); }
    .flow[data-anim="on"] .flow-fill[data-i="0"] { animation-delay: 0.5s; }
    .flow[data-anim="on"] .flow-fill[data-i="1"] { animation-delay: 1.8s; }
    .flow[data-anim="on"] .flow-fill[data-i="2"] { animation-delay: 3.1s; }

    .flow[data-anim="on"] .flow-seal { animation: flow-stamp 7s ease-in-out infinite; }
}

@keyframes flow-node {
    0%, 6%   { border-color: rgba(255,255,255,0.14); color: rgba(255,200,105,0.45); box-shadow: 0 0 0 0 rgba(255,172,39,0); transform: scale(1); }
    11%      { border-color: var(--gold-500); color: var(--gold-300); box-shadow: 0 0 0 7px rgba(255,172,39,0.14); transform: scale(1.07); }
    22%, 92% { border-color: rgba(255,172,39,0.55); color: var(--gold-300); box-shadow: 0 0 26px 0 rgba(255,172,39,0.2); transform: scale(1); }
    100%     { border-color: rgba(255,255,255,0.14); color: rgba(255,200,105,0.45); box-shadow: 0 0 0 0 rgba(255,172,39,0); transform: scale(1); }
}
@keyframes flow-fill-x { 0%,7% { transform: scaleX(0); } 19% { transform: scaleX(1); } 94% { transform: scaleX(1); } 100% { transform: scaleX(0); } }
@keyframes flow-fill-y { 0%,7% { transform: scaleY(0); } 19% { transform: scaleY(1); } 94% { transform: scaleY(1); } 100% { transform: scaleY(0); } }
@keyframes flow-stamp {
    0%, 42%  { transform: rotate(-9deg) scale(1); }
    50%      { transform: rotate(-9deg) scale(1.22); }
    60%, 100%{ transform: rotate(-9deg) scale(1); }
}
@media (prefers-reduced-motion: no-preference) {
    .flow[data-anim="on"] .flow-seal-glow { animation: flow-seal-glow 7s ease-in-out infinite; }
}
@keyframes flow-seal-glow {
    0%, 42%   { box-shadow: 0 0 0 0 rgba(255,172,39,0); }
    52%       { box-shadow: 0 0 0 8px rgba(255,172,39,0.18); }
    62%, 100% { box-shadow: 0 0 22px 0 rgba(255,172,39,0.25); }
}

/* ============================================================
   ÉXITO DEL FORMULARIO — sello dorado que se estampa + check
   ============================================================ */
.cx-form--done { display: flex; align-items: center; justify-content: center; }
.cx-ok { text-align: center; }
.cx-ok__seal {
    margin-inline: auto;
    display: grid; place-items: center;
    height: 5rem; width: 5rem;
    border-radius: 9999px;
    border: 2px solid var(--gold-500);
    background: var(--navy-800);
    box-shadow: 0 10px 30px -10px rgba(255, 172, 39, 0.35);
}
.cx-ok__title {
    font-family: "EB Garamond", Georgia, serif;
    margin-top: 1.5rem; font-size: 1.7rem; font-weight: 500; color: #fff;
}
.cx-ok__text {
    margin-top: 0.5rem; font-size: 0.95rem; line-height: 1.55;
    color: rgba(255, 255, 255, 0.6);
    max-width: 24rem; margin-inline: auto;
}

@media (prefers-reduced-motion: no-preference) {
    .cx-ok__seal  { animation: cxok-stamp 0.6s cubic-bezier(.2,1.3,.5,1) both, cxok-glow 2.6s ease-in-out 1.1s infinite; }
    .cx-ok__check { stroke-dasharray: 32; stroke-dashoffset: 32; animation: cxok-check 0.55s ease forwards 0.35s; }
    .cx-ok__title { opacity: 0; animation: cxok-up 0.55s ease forwards 0.5s; }
    .cx-ok__text  { opacity: 0; animation: cxok-up 0.55s ease forwards 0.64s; }
}
@keyframes cxok-stamp {
    0%   { opacity: 0; transform: rotate(-16deg) scale(1.5); }
    60%  { opacity: 1; }
    100% { opacity: 1; transform: rotate(0) scale(1); }
}
@keyframes cxok-check { to { stroke-dashoffset: 0; } }
@keyframes cxok-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes cxok-glow {
    0%, 100% { box-shadow: 0 10px 30px -10px rgba(255,172,39,.35), 0 0 0 0 rgba(255,172,39,0); }
    50%      { box-shadow: 0 10px 30px -10px rgba(255,172,39,.35), 0 0 0 10px rgba(255,172,39,.08); }
}

/* ============================================================
   WhatsApp demo — interfaz fiel (dark mode) + conversación animada
   ============================================================ */
.wa {
    display: flex; flex-direction: column;
    height: 460px;
    border-radius: 1.1rem; overflow: hidden;
    background: #0b141a;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 30px 70px -25px rgba(0, 0, 0, 0.65);
}
/* Barra superior */
.wa__bar { display: flex; align-items: center; gap: 0.6rem; background: #202c33; padding: 0.55rem 0.75rem; }
.wa__back { width: 1.05rem; height: 1.05rem; color: #aebac1; flex-shrink: 0; }
.wa__avatar {
    height: 2.1rem; width: 2.1rem; border-radius: 9999px;
    display: grid; place-items: center; flex-shrink: 0;
    background: linear-gradient(135deg, #7a8a99, #3b4a54);
    color: #fff; font-size: 0.72rem; font-weight: 600; letter-spacing: .02em;
}
.wa__peer { flex: 1; min-width: 0; }
.wa__name { font-size: 0.86rem; font-weight: 600; color: #e9edef; line-height: 1.15; }
.wa__status { font-size: 0.7rem; color: #8696a0; line-height: 1.2; margin-top: 1px; min-height: 0.85rem; }
.wa__status--typing { color: #25d366; }
.wa__actions { display: flex; gap: 0.95rem; color: #aebac1; }
.wa__actions svg { width: 1.15rem; height: 1.15rem; }
/* Cuerpo del chat */
.wa__body {
    flex: 1; min-height: 0; overflow-y: auto;
    display: flex; flex-direction: column; gap: 0.3rem;
    padding: 0.85rem 0.8rem;
    background-color: #0b141a;
    background-image: radial-gradient(rgba(255,255,255,0.018) 1px, transparent 1px);
    background-size: 22px 22px;
    scrollbar-width: none;
}
.wa__body::-webkit-scrollbar { display: none; }
.wa__spacer { flex: 1 1 auto; min-height: 0; }
/* Burbujas */
.wa__bubble {
    max-width: 82%; padding: 0.38rem 0.55rem 0.28rem;
    border-radius: 0.5rem; font-size: 0.8rem; line-height: 1.36;
    color: #e9edef; white-space: pre-wrap; word-wrap: break-word;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.18);
    animation: wa-pop 0.22s ease both;
}
.wa__bubble--in  { align-self: flex-start; background: #202c33; border-top-left-radius: 0; }
.wa__bubble--out { align-self: flex-end;   background: #005c4b; border-top-right-radius: 0; }
.wa__meta { display: block; text-align: right; font-size: 0.6rem; color: rgba(233, 237, 239, 0.5); margin-top: 1px; }
.wa__checks { color: #53bdeb; letter-spacing: -2px; }
/* Indicador "escribiendo" */
.wa__typing { align-self: flex-start; background: #202c33; border-top-left-radius: 0; border-radius: 0.5rem; padding: 0.55rem 0.65rem; display: inline-flex; gap: 4px; animation: wa-pop 0.22s ease both; }
.wa__typing span { width: 6px; height: 6px; border-radius: 9999px; background: #8696a0; animation: wa-dot 1.25s infinite; }
.wa__typing span:nth-child(2) { animation-delay: 0.18s; }
.wa__typing span:nth-child(3) { animation-delay: 0.36s; }
/* Barra de entrada */
.wa__compose { display: flex; align-items: center; gap: 0.5rem; background: #202c33; padding: 0.5rem 0.6rem; }
.wa__field { flex: 1; min-width: 0; background: #2a3942; border-radius: 1.1rem; padding: 0.5rem 0.8rem; min-height: 2.1rem; display: flex; align-items: center; font-size: 0.8rem; color: #e9edef; overflow: hidden; }
.wa__placeholder { color: #8696a0; }
.wa__typed { white-space: pre; }
.wa__caret { display: inline-block; width: 1.5px; height: 0.95rem; background: #25d366; margin-left: 1px; opacity: 0; }
.wa__caret--on { animation: wa-caret 1.05s steps(1) infinite; }
.wa__send { height: 2.1rem; width: 2.1rem; border-radius: 9999px; background: #00a884; display: grid; place-items: center; color: #0b141a; flex-shrink: 0; border: 0; }
.wa__send svg { width: 1.05rem; height: 1.05rem; }
.wa__ico-send { display: none; }
.wa__send--ready .wa__ico-mic { display: none; }
.wa__send--ready .wa__ico-send { display: block; }

@keyframes wa-pop { from { opacity: 0; transform: translateY(5px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes wa-dot { 0%, 60%, 100% { opacity: 0.35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@keyframes wa-caret { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
/* Plantillas interactivas: botones de respuesta */
.wa__menu { align-self: flex-start; width: 82%; max-width: 82%; display: flex; flex-direction: column; gap: 3px; margin-top: 1px; animation: wa-pop 0.22s ease both; }
.wa__btn {
    display: flex; align-items: center; justify-content: center; gap: 0.4rem;
    background: #202c33; color: #53bdeb; font-size: 0.8rem; font-weight: 500;
    padding: 0.5rem 0.6rem; border-radius: 0.5rem; box-shadow: 0 1px 0.5px rgba(0,0,0,.18);
}
.wa__btn svg { width: 0.85rem; height: 0.85rem; }
.wa__btn--pick { background: #2a3942; }
/* Plantillas interactivas: lista (servicios con precio) */
.wa__list { align-self: flex-start; width: 82%; max-width: 82%; margin-top: 1px; background: #111b21; border-radius: 0.6rem; overflow: hidden; box-shadow: 0 1px 0.5px rgba(0,0,0,.18); animation: wa-pop 0.22s ease both; }
.wa__list-head { padding: 0.45rem 0.7rem; font-size: 0.64rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #8696a0; }
.wa__list-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.5rem 0.7rem; border-top: 1px solid rgba(255,255,255,.05); }
.wa__list-row--pick { background: #2a3942; }
.wa__list-txt { min-width: 0; }
.wa__list-t { font-size: 0.8rem; color: #e9edef; font-weight: 500; }
.wa__list-d { font-size: 0.68rem; color: #8696a0; margin-top: 1px; }
.wa__list-radio { width: 0.95rem; height: 0.95rem; border-radius: 9999px; border: 1.5px solid #54656f; flex-shrink: 0; }
.wa__list-row--pick .wa__list-radio { border-color: #00a884; background: radial-gradient(#00a884 42%, transparent 46%); }
.wa__collapsing { animation: wa-fadeout 0.26s ease forwards; }
@keyframes wa-fadeout { to { opacity: 0; transform: translateY(-3px); } }

@media (prefers-reduced-motion: reduce) {
    .wa__bubble, .wa__typing, .wa__menu, .wa__list { animation: none; }
    .wa__typing span { animation: none; }
    .wa__caret--on { animation: none; opacity: 1; }
}
