/* ============================================
   GESTORÍA SAN MIGUEL - Custom Styles
   WCAG 2.1 AA Compliant
   ============================================ */

/* ============================================
   ACCESIBILIDAD (WCAG 2.1 AA)
   ============================================ */

/* Skip link (saltar al contenido principal) */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: #1d5af1;
    color: #fff;
    padding: 12px 20px;
    z-index: 100;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 8px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: top 0.2s ease;
}
.skip-link:focus {
    top: 0;
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

/* Clase sr-only para textos visibles solo a 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;
}

/* Focus visible mejorado (cumple WCAG 2.4.7) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible {
    outline: 3px solid #fbbf24;
    outline-offset: 3px;
    border-radius: 4px;
}

/* Foco en botones oscuros - mejor contraste */
.bg-primary-600:focus-visible,
.bg-primary-700:focus-visible,
.bg-dark-900 a:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

/* Respeto a preferencia de reducción de movimiento (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .hero-shape,
    .animate-scroll-dot {
        animation: none !important;
    }
    [data-animate] {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Modo alto contraste (Windows/Edge High Contrast Mode) */
@media (forced-colors: active) {
    .nav-link,
    a,
    button {
        forced-color-adjust: auto;
    }
    [data-lucide] {
        forced-color-adjust: auto;
    }
}

/* Asegurar contraste mínimo en enlaces del texto */
a:not([class]) {
    color: #1545de;
    text-decoration: underline;
}
a:not([class]):hover {
    color: #142156;
}



/* ---- Animations ---- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(-40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes heroFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

@keyframes scrollDot {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(8px); }
}

@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.animate-fade-in {
    animation: fadeIn 0.8s ease-out both;
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out both;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.8s ease-out both;
}

.animate-scroll-dot {
    animation: scrollDot 1.5s ease-in-out infinite;
}

/* Hero shapes */
.hero-shape {
    animation: heroFloat 6s ease-in-out infinite;
}

/* Hero cards hover */
.hero-card {
    transition: transform 0.5s ease, box-shadow 0.5s ease;
}
.hero-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

/* ---- Navbar ---- */
#navbar {
    background: transparent;
}

#navbar.scrolled {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Nav links - default state (on transparent bg) - WCAG AA contrast */
.nav-link {
    color: #ffffff;
}
.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}
.nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
}

.nav-logo-text { color: #ffffff; }
.nav-logo-sub { color: #e5e7eb; }

/* Nav links - scrolled state (on white bg) */
#navbar.scrolled .nav-link {
    color: #4b5563;
}
#navbar.scrolled .nav-link:hover {
    color: #1d5af1;
    background: #eef5ff;
}
#navbar.scrolled .nav-link.active {
    color: #1d5af1;
    background: #eef5ff;
}
#navbar.scrolled .nav-logo-text { color: #111827; }
#navbar.scrolled .nav-logo-sub { color: #9ca3af; }

/* ---- Scroll animations ---- */
[data-animate] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

[data-animate="fade-up"].visible {
    opacity: 1;
    transform: translateY(0);
}

[data-animate="fade-right"] {
    transform: translateX(-30px);
}
[data-animate="fade-right"].visible {
    opacity: 1;
    transform: translateX(0);
}

[data-animate="fade-left"] {
    transform: translateX(30px);
}
[data-animate="fade-left"].visible {
    opacity: 1;
    transform: translateX(0);
}

/* ---- Service cards ---- */
.service-card {
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, currentColor, transparent);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.service-card:hover::before {
    opacity: 0.3;
}

/* ---- Counter ---- */
.counter {
    font-variant-numeric: tabular-nums;
}

/* ---- FAQ ---- */
.faq-toggle .transition-transform {
    transition: transform 0.3s ease;
}

.faq-item.open .faq-toggle .transition-transform {
    transform: rotate(180deg);
}

/* ---- Form ---- */
input:focus, textarea:focus, select:focus {
    box-shadow: 0 0 0 3px rgba(29, 90, 241, 0.1);
}

/* ---- Cookie banner ---- */
#cookie-banner.show {
    transform: translateY(0);
}

/* ---- Smooth scrolling ---- */
html {
    scroll-behavior: smooth;
}

/* ---- Selection ---- */
::selection {
    background: #1d5af1;
    color: #fff;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c5c5c5;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* ---- Responsive adjustments ---- */
@media (max-width: 768px) {
    .hero-shape {
        display: none;
    }
}

/* ---- Print ---- */
@media print {
    nav, .fixed, #cookie-banner, footer { display: none !important; }
    section { page-break-inside: avoid; }
}
