/* ============================================
   CreceEnLinea.cl — Custom Styles
   ============================================ */

/* ── Base ── */
html { scroll-behavior: smooth; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #2563EB; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #1d4ed8; }

/* Selección de texto */
::selection { background-color: #2563EB; color: white; }

/* Scroll offset para header fijo + announcement bar */
section[id] { scroll-margin-top: 104px; }


/* ============================================
   ACCESIBILIDAD — Focus visible (WCAG 2.1 AA)
   ============================================ */

/* Ocultar skip-link hasta focus */
.skip-link {
    position: absolute;
    transform: translateY(-200%);
    transition: transform 0.2s ease;
}
.skip-link:focus {
    transform: translateY(0);
}

/* Focus visible global: anillo azul de alto contraste en todos
   los elementos interactivos al navegar con teclado */
:focus-visible {
    outline: 3px solid #2563EB;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Remover outline solo cuando hay :focus-visible (no en clicks) */
:focus:not(:focus-visible) {
    outline: none;
}

/* Focus para botones con fondo oscuro */
.btn-gradient:focus-visible,
button:focus-visible {
    outline: 3px solid #2563EB;
    outline-offset: 3px;
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.25);
}

/* Focus para links de navegación */
nav a:focus-visible,
footer a:focus-visible {
    outline: 2px solid #2563EB;
    outline-offset: 3px;
    border-radius: 6px;
    background-color: #eff6ff;
    color: #1d4ed8;
}

/* Focus en campos de formulario (ya tienen focus:ring de Tailwind,
   añadimos el anillo visible para modo teclado) */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid #2563EB;
    outline-offset: 0;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

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

/* Revertir sr-only en focus */
.focus\:not-sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}


/* ============================================
   GRADIENTE DE TEXTO
   ============================================ */
.gradient-text {
    background: linear-gradient(135deg, #2563EB 0%, #10B981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Fallback para impresión (los gradientes no imprimen bien) */
@media print {
    .gradient-text {
        -webkit-text-fill-color: #2563EB;
        background: none;
        color: #2563EB;
    }
}


/* ============================================
   BOTONES
   ============================================ */
.btn-gradient {
    background: linear-gradient(135deg, #2563EB, #1d4ed8);
    transition: all 0.2s ease;
}
.btn-gradient:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.40);
    transform: translateY(-1px);
}
.btn-gradient:active {
    transform: translateY(0);
}


/* ============================================
   CARDS
   ============================================ */
.card-hover {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 44px rgba(37, 99, 235, 0.12);
}

/* Nav link activo (JS lo asigna) */
.nav-link-active {
    color: #2563EB !important;
    background-color: #eff6ff !important;
}


/* ============================================
   MEJORA 1: Announcement bar con marquee
   ============================================ */
.announcement-bar { overflow: hidden; white-space: nowrap; }

.announcement-track {
    animation: scroll-marquee 30s linear infinite;
    display: inline-flex;
    align-items: center;
}
.announcement-bar:hover .announcement-track {
    animation-play-state: paused;
}
@keyframes scroll-marquee {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}


/* ============================================
   MEJORA 2: Mesh gradient blobs
   ============================================ */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.18;
    pointer-events: none;
    z-index: 0;
    animation: blob-float 10s ease-in-out infinite;
}
.blob-blue {
    width: 600px; height: 600px;
    background: radial-gradient(circle, #2563EB 0%, transparent 70%);
    top: -150px; right: -100px;
    animation-delay: 0s;
}
.blob-green {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #10B981 0%, transparent 70%);
    bottom: -80px; left: -80px;
    animation-delay: -5s;
}
@keyframes blob-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%       { transform: translate(20px, -20px) scale(1.04); }
    66%       { transform: translate(-15px, 15px) scale(0.97); }
}

/* Reducir movimiento si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {
    .blob { animation: none; }
    .announcement-track { animation: none; }
    [data-reveal] { transition: none; }
    .card-hover { transition: none; }
    .btn-gradient { transition: none; }
}


/* ============================================
   SCROLL REVEAL
   ============================================ */
[data-reveal] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}
[data-reveal].is-visible {
    opacity: 1;
    transform: translateY(0);
}


/* ============================================
   WHATSAPP FLOTANTE
   ============================================ */
.whatsapp-float {
    position: fixed;
    bottom: 28px; right: 28px;
    z-index: 999;
    width: 58px; height: 58px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.50);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
}
.whatsapp-float:hover {
    transform: scale(1.10) translateY(-2px);
    box-shadow: 0 10px 28px rgba(37, 211, 102, 0.60);
}
.whatsapp-float:focus-visible {
    outline: 3px solid white;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(37, 211, 102, 0.40);
}

.whatsapp-pulse {
    position: absolute; inset: 0;
    border-radius: 50%;
    background: #25D366;
    animation: wa-pulse 2.5s ease-out infinite;
}
@keyframes wa-pulse {
    0%   { transform: scale(1);   opacity: 0.6; }
    70%  { transform: scale(1.6); opacity: 0; }
    100% { transform: scale(1.6); opacity: 0; }
}

.whatsapp-tooltip {
    position: absolute;
    right: 68px;
    bottom: 50%;
    transform: translateY(50%);
    background: #1a1a2e;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.whatsapp-tooltip::after {
    content: '';
    position: absolute;
    left: 100%; top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-left-color: #1a1a2e;
}
.whatsapp-float:hover .whatsapp-tooltip { opacity: 1; }


/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    /* Ocultar elementos no imprimibles */
    .announcement-bar,
    header,
    .whatsapp-float,
    #faq button svg,
    [data-reveal] { opacity: 1 !important; transform: none !important; }

    /* Fondo blanco, texto negro */
    * { background: white !important; color: black !important; box-shadow: none !important; }

    /* Mostrar URLs de links */
    a[href]::after { content: " (" attr(href) ")"; font-size: 0.75em; color: #666; }
    a[href^="#"]::after { content: none; }

    /* Evitar cortes en tarjetas */
    .card-hover, section { break-inside: avoid; }
}


/* ── Ajustes responsive ── */
@media (max-width: 640px) {
    .whatsapp-float { bottom: 20px; right: 16px; width: 52px; height: 52px; }
    .whatsapp-tooltip { display: none; }
}


/* ── Gradiente de texto ── */
.gradient-text {
    background: linear-gradient(135deg, #2563EB 0%, #10B981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Botón con gradiente ── */
.btn-gradient {
    background: linear-gradient(135deg, #2563EB, #1d4ed8);
    transition: all 0.2s ease;
}
.btn-gradient:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.40);
    transform: translateY(-1px);
}

/* ── Card hover ── */
.card-hover { transition: transform 0.25s ease, box-shadow 0.25s ease; }
.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 44px rgba(37, 99, 235, 0.12);
}

/* ── Nav link activo ── */
.nav-link-active {
    color: #2563EB !important;
    background-color: #eff6ff !important;
}

/* ============================================
   MEJORA 1: Barra de anuncio con scroll
   ============================================ */
.announcement-bar { overflow: hidden; white-space: nowrap; }

.announcement-track {
    animation: scroll-marquee 30s linear infinite;
    display: inline-flex;
    align-items: center;
}

.announcement-bar:hover .announcement-track {
    animation-play-state: paused;
}

@keyframes scroll-marquee {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ============================================
   MEJORA 2: Mesh gradient blobs en Hero
   ============================================ */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.18;
    pointer-events: none;
    z-index: 0;
    animation: blob-float 10s ease-in-out infinite;
}

.blob-blue {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #2563EB 0%, transparent 70%);
    top: -150px;
    right: -100px;
    animation-delay: 0s;
}

.blob-green {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #10B981 0%, transparent 70%);
    bottom: -80px;
    left: -80px;
    animation-delay: -5s;
}

@keyframes blob-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%       { transform: translate(20px, -20px) scale(1.04); }
    66%       { transform: translate(-15px, 15px) scale(0.97); }
}

/* ============================================
   SCROLL REVEAL
   ============================================ */
[data-reveal] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-reveal].is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   WHATSAPP FLOTANTE
   ============================================ */
.whatsapp-float {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 999;
    width: 58px;
    height: 58px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.50);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
}

.whatsapp-float:hover {
    transform: scale(1.10) translateY(-2px);
    box-shadow: 0 10px 28px rgba(37, 211, 102, 0.60);
}

/* Anillo de pulse */
.whatsapp-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #25D366;
    animation: wa-pulse 2.5s ease-out infinite;
}

@keyframes wa-pulse {
    0%   { transform: scale(1);   opacity: 0.6; }
    70%  { transform: scale(1.6); opacity: 0; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* Tooltip */
.whatsapp-tooltip {
    position: absolute;
    right: 68px;
    bottom: 50%;
    transform: translateY(50%);
    background: #1a1a2e;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.whatsapp-tooltip::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-left-color: #1a1a2e;
}

.whatsapp-float:hover .whatsapp-tooltip { opacity: 1; }

/* ── Responsive adjustments ── */
@media (max-width: 640px) {
    .whatsapp-float { bottom: 20px; right: 16px; width: 52px; height: 52px; }
    .whatsapp-tooltip { display: none; }
}
