@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

:root {
    --glass-bg: rgba(20, 20, 25, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --primary: #4D9B40;
    --accent: #65c454;
}

@custom-variant dark (&:where(.dark, .dark *));

body {
    transition: background-color 0.5s ease, color 0.5s ease;
    font-family: 'Space Grotesk', sans-serif;
    background-color: oklch(96.8% 0.007 247.896);
    color: #111;
    margin: 0;
    overflow-x: hidden;
}

html.dark body {
    background-color: #050505;
    color: #ffffff;
}

/* Canvas for Meteors */
#meteor-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.bento-card {
    /* Light Mode Defaults */
    background: rgba(255, 255, 255, 0);
    border: 1px solid rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 1.5rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    position: relative;
}

.bento-card.contact {
    border: 2px solid black;
    border-radius: 1.65rem;
}

/* Dark Mode Overrides */
html.dark .bento-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: none;
}

html.dark .bento-card.contact {
    border: 2px solid green;
    border-radius: 1.65rem;
}

.bento-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 20px 40px -15px rgba(77, 155, 64, 0.25);
}

/* Brillo interior (Hover) */
.bento-card::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: 0.5s;
    pointer-events: none;
}

html.dark .bento-card::before {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.03), transparent);
}

.bento-card:hover::before { left: 100%; }

.text-gradient {
    background: linear-gradient(to right, #1e293b, #64748b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

html.dark .text-gradient {
    background: linear-gradient(to right, #fff, #94a3b8);
}

.text-gradient-primary {
    background: linear-gradient(to right, #65c454, #4D9B40);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Specific Card adjustments */
.grid-bg-pattern {
    background-image: radial-gradient(rgba(0,0,0,.15) 1px, transparent 1px);
    background-size: 20px 20px;
}

html.dark .grid-bg-pattern {
    background-image: radial-gradient(rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Scrollbar Adaptativo */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.04); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

html.dark ::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.04); }
html.dark ::-webkit-scrollbar-thumb { background: #334155; }
html.dark ::-webkit-scrollbar-thumb:hover { background: #475569; }

.animate-wiggle {
    animation-name: wiggle;
    animation-duration: 1s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

@keyframes wiggle {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* --- MARQUEE (CARRUSEL INFINITO) STYLES --- */
@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-2140px); }
}

.marquee-container {
    width: 100%;
    display: flex;
    gap: 1.5rem;
    animation: marquee 15s linear infinite;
    will-change: transform;
}

.marquee-item {
    flex-shrink: 0;
    min-width: 250px;
    width: 250px;
    max-width: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
    transition: background-color 0.2s;
    mask-image: linear-gradient(to bottom, white 0%, white 50%, transparent 80%);
}

.marquee-item img {
    transition: all .5s;
}

.marquee-item:hover img {
    transform: scale(1.05);
}

.projects-card-wrapper {
    overflow: hidden;
    position: relative;
    mask-image: linear-gradient(to right, transparent, white 5%, white 95%, transparent);
}

/* --- ANIMACIÓN LLAMATIVA PARA STATS CARD --- */
#stats-card {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#stats-number, .label {
    transition: all 0.3s ease-out;
    will-change: transform;
    user-select: none;
}

#stats-card:hover #stats-number {
    transform: scale(1.3) translateY(8px) translateX(4px);
    background-image: linear-gradient(to top, var(--accent), rgba(56, 123, 44, 1));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

html.dark #stats-card:hover #stats-number {
    transform: scale(1.3) translateY(8px) translateX(4px);
    background-image: linear-gradient(to top, #ffffff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 15px rgba(101, 196, 84, 0.5);
}

#stats-card:hover .label {
    transform: scale(.8);
    color: #ccc;
}

html.dark #stats-card:hover .label {
    transform: scale(.8);
    color: #555;
}

#contact-section {
    border: 1px solid rgba(0, 201, 80, 0.3);
    background: rgba(0, 201, 80, 0.03);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 10;
    overflow: hidden;
    padding: 0;
    box-shadow: inset 0 0 100px rgba(0, 201, 80, 0.05);
}

#contact-section::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1.5rem;
    width: 300%;
    height: 300%;
    top: -100%;
    left: -100%;
    background: transparent;
    opacity: 0;
    filter: blur(10px);
    transition: opacity 0.4s;
    z-index: -2;
}

#contact-section::after {
    content: '';
    position: absolute;
    inset: 0px;
    border-radius: 1.4rem;
    background: transparent;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: -1;
    transition: all 0s;
}

html.dark #contact-section::after {
    background: linear-gradient(to bottom right, rgba(13, 84, 43, .05), rgba(1, 102, 48, .2));
}

#contact-section:hover::after {
    background: oklch(0.968 0.007 247.896);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.1);
    inset: 1.2px;
}

html.dark #contact-section:hover::after {
    background: linear-gradient(to bottom right, rgba(10, 10, 15, 1), rgba(5, 5, 10, 1));
    inset: 1.2px;
}

#contact-section:hover::before {
    background: conic-gradient(
        transparent 0%,
        transparent 30%,
        #65c454 50%,
        #4D9B40 70%,
        transparent 100%
    );
    opacity: 1;
    animation: border-spin 4s linear infinite;
}

#contact-section:hover {
    background: linear-gradient(to bottom right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1)) !important;
    transform: translateY(-5px) scale(1.01);
    box-shadow: 0 20px 40px -15px rgba(77, 155, 64, 0.2);
}

html.dark #contact-section:hover {
    background: black !important;
    transform: translateY(-5px) scale(1.01);
    box-shadow: 0 20px 40px -15px rgba(77, 155, 64, 0.2);
}

@keyframes border-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- ESTILOS PUNTOS HERO CARD --- */
.hero-dot {
    position: absolute;
    width: 2px;
    height: 2px;
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    transition: all 0.3s ease;
}

html.dark .hero-dot {
    background-color: rgba(255, 255, 255, 0.1);
}

.hero-dot.active {
    background-color: #000;
    box-shadow: 0 0 4px #000;
    opacity: 1;
    transform: scale(1.5);
}

html.dark .hero-dot.active {
    background-color: #4ade80;
    box-shadow: 0 0 4px #4ade80;
    opacity: 1;
    transform: scale(1.5);
}

.modal-container {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    overflow: hidden;
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
}

.modal-container.active {
    opacity: 1;
    pointer-events: auto;
}

/* Bloqueo total de scroll de fondo cuando hay un modal abierto */
html.modal-open,
body.modal-open {
    overflow: hidden !important;
    touch-action: none !important;
    overscroll-behavior: contain !important;
}



.modal-content {
    background: rgba(255, 255, 255, 0.98);
    border: none !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 0 !important;
    box-shadow: none;
    max-width: 100vw !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    padding: 1.25rem 1rem !important;
    opacity: 1;
    transform: translateY(0);
    transition-property: opacity, transform;
    transition-duration: var(--modal-duration, 0.4s);
    transition-timing-function: var(--modal-easing, cubic-bezier(0.4, 0, 0.2, 1));
}

html.dark .modal-content {
    background: linear-gradient(180deg, rgba(20, 20, 26, 0.96) 0%, rgba(12, 12, 16, 0.96) 100%);
    border: none !important;
    box-shadow: none;
}

@media (min-width: 768px) {
    .modal-container {
        padding: 1.5rem;
    }
    .modal-content {
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        border-radius: 1.5rem !important;
        box-shadow: 0 40px 80px rgba(0, 0, 0, 0.3) !important;
        max-width: 800px !important;
        max-height: 90vh !important;
        width: 90% !important;
        height: auto !important;
        padding: 2rem !important;
    }
    html.dark .modal-content {
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7) !important;
    }
}

.modal-content.modal-slide-in {
    opacity: 0 !important;
    transform: translateY(-50px);
}

/* --- MARQUEE VERTICAL PARA STACK --- */
@keyframes vertical-scroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

#stack-marquee-container {
    height: 100%;
    max-height: 250px;
    overflow: hidden;
    position: relative;
    mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
}

/* Evitar Auto-Zoom de iOS Safari en Campos de Formulario (Mobile) */
@media screen and (max-width: 767px) {
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

.stack-marquee-content {
    animation: vertical-scroll 25s linear infinite;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    width: 100%;
}

.stack-item {
    padding: 0.75rem;
    margin: 0;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: #333;
    transition: all 0.3s;
    cursor: pointer;
}

html.dark .stack-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #eee;
}

.stack-item:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.5);
    color: black;
}

html.dark .stack-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    color: white;
}

/* --- Botón de Tema --- */
.theme-toggle {
    position: fixed; bottom: 2rem; right: 2rem;
    width: 3.5rem; height: 3.5rem;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 50;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

html.dark .theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.theme-toggle:hover { transform: rotate(15deg) scale(1.1); }

.green { fill: rgba(77, 155, 64, 1); }
.white { fill: #111111; }
html.dark .white { fill: #ffffff; }

.gradient {
    mask-image: linear-gradient(to bottom, transparent 65px, black 110px, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 65px, black 110px, black 85%, transparent 100%);
}
