:root {
    --bg-main: #050814;
    --bg-dark: #090d1f;
    --bg-card: rgba(19, 24, 51, 0.9);
    --accent: #35e2ff;
    --accent-secondary: #ff4bff;
    --text-main: #f2f4ff;
    --text-muted: #9ea4d4;
    --border-soft: rgba(255, 255, 255, 0.06);
    --shadow-soft: 0 20px 60px rgba(0, 0, 0, 0.6);
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-pill: 999px;
}

/* RESET SIMPLE */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: #02030a;
    color: var(--text-main);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* CANVAS DE ESTRELLAS + NEBULOSA */

#starsCanvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: -3;
    display: block;
}

/* GLOBAL LOADER */

#global-loader {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 20% 0%, #18224b 0, #050814 40%, #000000 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

#global-loader.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.7s ease;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loader-galaxy {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-right-color: var(--accent-secondary);
    animation: loader-spin 1.5s linear infinite;
    box-shadow: 0 0 20px rgba(53, 226, 255, 0.6);
}

.loader-content p {
    font-size: 0.95rem;
    color: var(--text-muted);
}

@keyframes loader-spin {
    to {
        transform: rotate(360deg);
    }
}

/* NAVBAR & HERO */

#hero {
    position: relative;
    height: 100vh;
    overflow: hidden;
    color: #fff;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 10%, rgba(90, 140, 255, 0.55), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(208, 90, 255, 0.55), transparent 60%),
        linear-gradient(to bottom, rgba(0, 0, 20, 0.7), #050814 85%);
    z-index: 1;
}

/* Ocultamos la galaxia antigua (estructura queda por si la quieres reusar) */
.galaxy-container {
    display: none;
}

/* NAVBAR */

.navbar {
    position: relative;
    z-index: 2;
    padding: 20px 7%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: "Orbitron", sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.nav-logo picture,
.nav-logo img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(53, 226, 255, 0.9));
}

/* Texto de logo con gradiente animado */
.logo-text-animated {
    background: linear-gradient(120deg,
        #4ae4ff,
        #7b5cff,
        #ff63d8,
        #ffae58,
        #4ae4ff);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: logo-gradient 8s ease infinite;
}

@keyframes logo-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 26px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    position: relative;
    transition: color 0.2s ease;
}

.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    border-radius: 999px;
    transition: width 0.25s ease;
}

.nav-links a:hover {
    color: #ffffff;
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.4rem;
}

/* HERO CONTENT */

.hero-content {
    position: relative;
    z-index: 2;
    height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    padding: 0 7%;
    gap: 40px;               /* espacio entre texto y video */
    flex-wrap: wrap;         /* se acomoda mejor en pantallas medias */
}

.hero-text {
    max-width: 640px;
    flex: 1 1 340px;
}

.hero-text h1 {
    font-family: "Orbitron", sans-serif;
    font-size: clamp(2.4rem, 4vw, 3.4rem);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.hero-text p {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 520px;
    margin-bottom: 22px;
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

/* COLUMNA DEL VIDEO EN EL HERO */

.hero-media {
    flex: 1 1 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-carousel {
    width: 100%;
    max-width: 480px;
    aspect-ratio: 16 / 9;
    border-radius: 24px;
    padding: 4px;
    background:
        radial-gradient(circle at 0 0, rgba(53, 226, 255, 0.3), transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(255, 75, 255, 0.3), transparent 55%),
        rgba(5, 8, 20, 0.9);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    overflow: hidden;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.video-carousel:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 1);
}

/* Video interno */

.video-carousel video {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 20px;
    object-fit: cover;
    background: #000;
}

/* Brillo animado suave en el borde */

.video-carousel::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: radial-gradient(circle at 10% 0%, rgba(255,255,255,0.14), transparent 55%);
    mix-blend-mode: screen;
    animation: videoGlow 4s ease-in-out infinite alternate;
}

@keyframes videoGlow {
    0% {
        opacity: 0.4;
    }
    100% {
        opacity: 0.9;
    }
}

/* BOTONES GALAXIA DINÁMICOS */

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        background 0.2s ease,
        border-color 0.2s ease;
}

.btn-primary {
    background: linear-gradient(120deg,
        #4ae4ff,
        #7b5cff,
        #ff63d8,
        #ffae58,
        #4ae4ff);
    background-size: 300% 300%;
    animation: galaxy-gradient 6s ease infinite;
    color: #050814;
    border: none;
    box-shadow: 0 0 22px rgba(130, 90, 255, 0.8);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 0 30px rgba(180, 120, 255, 1);
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.55);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.18);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-1px);
}

@keyframes galaxy-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.hero-info {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.hero-info i {
    color: var(--accent);
    margin-right: 5px;
}

.hero-logos {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hero-logos picture,
.hero-logos img {
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.7));
}

/* SECCIONES */

.section {
    padding: 80px 7%;
    position: relative;
    z-index: 2;
}

.section-dark {
    background: radial-gradient(circle at 0% 0%, #172041 0, #050814 45%, #02030a 100%);
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-header h2 {
    font-family: "Orbitron", sans-serif;
    font-size: 1.6rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.section-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* SOBRE */

.sobre-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr);
    gap: 32px;
}

.sobre-text h3 {
    font-size: 1.3rem;
    margin-bottom: 12px;
}

.sobre-text p {
    color: var(--text-muted);
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.sobre-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.sobre-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
}

.sobre-card h4 {
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.sobre-card p {
    font-size: 0.85rem;
}

.sobre-panel {
    background: radial-gradient(circle at 0 0, rgba(53, 226, 255, 0.15), transparent 60%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
    padding: 18px 20px;
    box-shadow: var(--shadow-soft);
}

.sobre-panel h4 {
    margin-bottom: 12px;
    font-size: 1rem;
}

.sobre-panel ul {
    list-style: none;
}

.sobre-panel li {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.sobre-panel li span {
    color: var(--text-main);
    font-weight: 500;
}

/* SERVICIOS */

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
}

.service-card {
    background: rgba(7, 11, 30, 0.95);
    border-radius: var(--radius-lg);
    padding: 18px 18px 22px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-soft);
    position: relative;
    overflow: hidden;
    cursor: default;
}

.service-card::before {
    content: "";
    position: absolute;
    top: -30%;
    right: -10%;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(53, 226, 255, 0.22), transparent 65%);
    opacity: 0.9;
    pointer-events: none;
}

.service-icon {
    font-size: 1.8rem;
    color: var(--accent);
    margin-bottom: 10px;
}

.service-card h3 {
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.service-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* PORTAFOLIO */

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.portfolio-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 18px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
}

.portfolio-card h3 {
    margin-bottom: 8px;
    font-size: 1.02rem;
}

.portfolio-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.portfolio-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    text-decoration: none;
    color: var(--accent);
}

.portfolio-link::after {
    content: "↗";
    font-size: 0.8rem;
}

/* REDES */

.social-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
}

.social-card {
    background: rgba(7, 10, 26, 0.95);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    border: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.social-card i {
    font-size: 1.4rem;
    color: var(--accent);
}

.social-card span {
    font-size: 0.95rem;
}

.social-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
    border-color: rgba(255, 255, 255, 0.2);
}

/* CONTACTO */

.contact-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.2fr);
    gap: 30px;
}

.contact-form {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
}

.form-group {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-group input,
.form-group textarea {
    background: rgba(7, 10, 26, 0.95);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 10px;
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent);
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.form-note {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.contact-info {
    padding: 10px 4px;
}

.contact-info h3 {
    margin-bottom: 10px;
}

.contact-info p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.contact-info i {
    color: var(--accent);
    margin-right: 5px;
}

/* FOOTER */

.footer {
    padding: 18px 7%;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: #040615;
}

/* CHATBOT MIRA */

#mira-widget {
    position: fixed;
    bottom: 18px;
    right: 18px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

/* Botón flotante */

#mira-toggle {
    width: 60px;
    height: 60px;
    border-radius: 999px;
    border: none;
    background: radial-gradient(circle at 30% 0, #ffffff 0, #ffe6ff 18%, #ff4bff 40%, #28104a 70%);
    box-shadow: 0 0 25px rgba(255, 75, 255, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
}

#mira-toggle picture,
#mira-toggle img {
    width: 70%;
    height: 70%;
    object-fit: contain;
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.9));
}

#mira-toggle:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 0 35px rgba(255, 75, 255, 1);
}

/* Ventana chat */

#mira-chat {
    width: 320px;
    max-height: 460px;
    background: rgba(5, 8, 20, 0.98);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8) translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#mira-chat.mira-chat-open {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1) translateY(0);
}

.mira-header {
    padding: 10px 10px 10px 12px;
    background: linear-gradient(120deg, #1a1036, #3e124f);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mira-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mira-header-info picture,
.mira-header-info img {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    object-fit: cover;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}

.mira-header-info h4 {
    font-size: 0.9rem;
}

.mira-header-info span {
    font-size: 0.75rem;
    color: #e5caff;
}

.mira-header-actions {
    display: flex;
    gap: 6px;
}

.mira-header-actions button {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

.mira-header-actions button#mira-voice-toggle.voice-off i {
    color: var(--text-muted);
}

.mira-messages {
    flex: 1;
    padding: 8px 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scroll-behavior: smooth;
}

.mira-msg {
    max-width: 85%;
    font-size: 0.8rem;
    padding: 7px 10px;
    border-radius: 12px;
    line-height: 1.3;
}

.mira-msg.user {
    align-self: flex-end;
    background: linear-gradient(120deg, #35e2ff, #ff4bff);
    color: #050814;
    border-bottom-right-radius: 4px;
}

.mira-msg.bot {
    align-self: flex-start;
    background: rgba(15, 20, 40, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: 4px;
}

/* Loader mini para el chat */

.mira-loading {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
}

.mira-loading.active {
    display: flex;
}

.loader-mini {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent);
    animation: loader-spin 0.8s linear infinite;
}

/* Input chat */

.mira-input-area {
    display: flex;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 6px 6px 10px;
    gap: 4px;
    background: rgba(6, 8, 20, 0.98);
}

.mira-input-area input {
    flex: 1;
    background: rgba(11, 16, 36, 0.98);
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 10px;
    color: var(--text-main);
    font-size: 0.8rem;
}

.mira-input-area input:focus {
    outline: none;
    border-color: var(--accent);
}

.mira-input-area button {
    border-radius: 999px;
    border: none;
    width: 30px;
    height: 30px;
    background: linear-gradient(120deg, var(--accent), var(--accent-secondary));
    color: #050814;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* RESPONSIVE */

@media (max-width: 900px) {
    .navbar {
        padding-inline: 5%;
    }
    .nav-links {
        position: absolute;
        top: 72px;
        right: 5%;
        flex-direction: column;
        background: rgba(4, 6, 20, 0.96);
        padding: 10px 14px;
        border-radius: 14px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        display: none;
    }
    .nav-links.nav-open {
        display: flex;
    }
    .nav-toggle {
        display: block;
    }
    .hero-content {
        padding-inline: 5%;
        flex-direction: column;      /* en móviles el video queda debajo del texto */
        justify-content: center;
    }
    .hero-text {
        text-align: left;
    }
    .hero-media {
        width: 100%;
        justify-content: flex-start;
    }
    .sobre-grid,
    .contact-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    #mira-chat {
        width: 100vw;
        max-height: 70vh;
    }
    #mira-widget {
        right: 12px;
        left: 12px;
        align-items: flex-end;
    }
}
