/**
 * CSS Personalizado del Proyecto - INDEXO Energía
 * Tema oscuro con estética de ingeniería
 */

/* Estilos globales personalizados - INDEXO Energía */
:root {
    --color-primary: #E56020;
    --color-primary-hover: #C44E17;
    --color-secondary: #1A2027;
    --color-panel: #232A32;
    --color-text-light: #F3F4F6;
    --color-text-muted: #9CA3AF;
}

/* ==========================================
   FONDO DE CUADRÍCULA TIPO "INGENIERÍA"
   ========================================== */
.bg-grid {
    background-size: 40px 40px;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.25) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.25) 1px, transparent 1px);
    -webkit-mask-image: none;
    mask-image: none;
}

/* ==========================================
   BANNER ROTATIVO (CHART STACK)
   ========================================== */

/* --- MÓVIL: Carrusel horizontal con scroll snap --- */
.chart-stack {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding: 4px 0 8px;
    scrollbar-width: none;
}
.chart-stack::-webkit-scrollbar { display: none; }

.chart-card {
    flex: 0 0 92%;
    min-width: 92%;
    scroll-snap-align: center;
    position: relative;
    opacity: 1 !important;
    transform: none !important;
    z-index: 1 !important;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
}

.carousel-dots { display: flex; }

/* --- DESKTOP: Cascada diagonal (stack) --- */
@media (min-width: 1024px) {
    .chart-stack {
        display: block;
        position: relative;
        height: 480px;
        overflow: visible;
        scroll-snap-type: none;
        padding-bottom: 0;
    }

    .chart-card {
        position: absolute;
        flex: none;
        width: 85%;
        aspect-ratio: auto;
        display: block;
        transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
        will-change: transform, opacity, z-index;
    }

    .chart-card[data-pos="3"] {
        z-index: 10 !important;
        transform: translate(35%, -20px) !important;
        opacity: 0.5 !important;
    }
    .chart-card[data-pos="2"] {
        z-index: 20 !important;
        transform: translate(18%, 50px) !important;
        opacity: 0.75 !important;
    }
    .chart-card[data-pos="1"] {
        z-index: 30 !important;
        transform: translate(0, 120px) !important;
        opacity: 1 !important;
        box-shadow: 0 25px 50px -12px rgba(229, 96, 32, 0.15);
    }

    .carousel-dots { display: none !important; }
}

/* ==========================================
   ANIMACIONES SVG DE LAS TARJETAS
   ========================================== */
@keyframes drawLine {
    from { stroke-dashoffset: 1000; }
    to { stroke-dashoffset: 0; }
}
.animate-draw {
    stroke-dasharray: 1000;
    animation: drawLine 2s ease-out forwards;
}

@keyframes growBar {
    from { transform: scaleY(0); }
    to { transform: scaleY(1); }
}
.animate-bar {
    transform-origin: bottom;
    animation: growBar 1.5s ease-out forwards;
}

/* ==========================================
   CLASES DE MARCA LEGACY (compatibilidad)
   ========================================== */
.brand-primary-bg { background-color: var(--color-primary); }
.brand-primary-text { color: var(--color-primary); }
.brand-secondary-bg { background-color: var(--color-secondary); }
.brand-secondary-text { color: var(--color-secondary); }

.text-gradient {
    background: linear-gradient(45deg, var(--color-primary), #ff8a47);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==========================================
   HOVER Y TRANSICIONES
   ========================================== */
.card-hover {
    transition: all 0.3s ease-in-out;
}

.card-hover:hover {
    transform: translateY(-4px);
}

/* ==========================================
   RESPONSIVE MÓVILES
   ========================================== */
@media (max-width: 640px) {
    body {
        font-size: 16px;
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px;
    }
}

/* ==========================================
   ANIMACIONES GENERALES
   ========================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* ==========================================
   SCROLL Y NAVEGACIÓN
   ========================================== */
html {
    scroll-behavior: smooth;
}

a {
    transition: color 0.2s ease-in-out;
}

.hover-lift {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

/* ==========================================
   IMÁGENES Y CONTENIDO
   ========================================== */
img {
    max-width: 100%;
    height: auto;
}

.prose {
    color: var(--color-text-muted);
}

.prose h2 {
    margin-top: 2em;
    margin-bottom: 1em;
    font-weight: 700;
    color: var(--color-text-light);
}

.prose h3 {
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    font-weight: 600;
    color: var(--color-text-light);
}

/* ==========================================
   FORMULARIOS (Tema Oscuro)
   ========================================== */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(229, 96, 32, 0.2);
}

::placeholder {
    color: #6B7280;
    opacity: 1;
}

/* ==========================================
   SCROLLBAR PERSONALIZADA
   ========================================== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #1A2027;
}

::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4B5563;
}

/* ==========================================
   UTILIDADES
   ========================================== */
.text-balance {
    text-wrap: balance;
}

.container-narrow {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.btn-custom {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all 0.2s ease-in-out;
}

.loader {
    border: 3px solid #374151;
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================
   RESPONSIVE UTILITIES
   ========================================== */
@media (max-width: 768px) {
    .mobile-hidden {
        display: none;
    }
}

@media (min-width: 769px) {
    .desktop-hidden {
        display: none;
    }
}

@media print {
    header,
    footer,
    .no-print {
        display: none;
    }
}

/* ==========================================
   PARTÍCULAS DE ENERGÍA SVG (Global)
   ========================================== */
.indexo-particle-field {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.indexo-particle {
    position: absolute;
    bottom: -10px;
    display: block;
    line-height: 0;
    opacity: 0;
    animation: indexoFloat var(--p-dur, 25s) var(--p-del, 0s) linear infinite;
    will-change: transform, opacity;
}

@keyframes indexoFloat {
    0%   { transform: translateY(0) translateX(0); opacity: 0; }
    8%   { opacity: var(--p-op, 1); }
    85%  { opacity: var(--p-op, 1); }
    100% { transform: translateY(-105dvh) translateX(var(--p-drift, 0px)); opacity: 0; }
}

/* Fallback para navegadores sin soporte dvh */
@supports not (height: 1dvh) {
    @keyframes indexoFloat {
        0%   { transform: translateY(0) translateX(0); opacity: 0; }
        8%   { opacity: var(--p-op, 1); }
        85%  { opacity: var(--p-op, 1); }
        100% { transform: translateY(-105vh) translateX(var(--p-drift, 0px)); opacity: 0; }
    }
}

/* ==========================================
   ACENTOS DE CIRCUITO (Esquinas de sección)
   ========================================== */
.circuit-corner {
    position: absolute;
    color: #E56020;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.circuit-corner.visible {
    opacity: 1;
}

.circuit-corner--tl {
    top: 12px;
    left: 12px;
}

.circuit-corner--br {
    bottom: 12px;
    right: 12px;
}

/* ==========================================
   SCROLL REVEAL (Secciones)
   ========================================== */
.indexo-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.indexo-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Reduced-motion: show everything immediately */
@media (prefers-reduced-motion: reduce) {
    .indexo-particle-field,
    .circuit-corner {
        display: none !important;
    }
    .indexo-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
