/* =====================================================
   VARIABLES GENERALES
===================================================== */

:root {
    --violeta: #7c3aed;
    --violeta-claro: #a855f7;
    --violeta-oscuro: #5b21b6;
    --glow-violeta: rgba(168, 85, 247, 0.42);
    --negro: #111;
    --negro-profundo: #09090f;
    --texto-suave: #aaa;
    --blanco: #fff;
    --radio: 22px;
    --max-width: 1100px;
    --header-height: 70px;
}

/* =====================================================
   RESET / BASE
===================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: none !important;
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}

html,
body {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--blanco);
    line-height: 1.6;
    background:
        radial-gradient(circle at 12% 18%, rgba(168, 85, 247, 0.15), transparent 26%),
        radial-gradient(circle at 88% 62%, rgba(124, 58, 237, 0.12), transparent 28%),
        linear-gradient(135deg, #f7f7f9 0%, #eceaf2 50%, #f7f7f9 100%);
}

button,
a,
label {
    font: inherit;
}

input,
textarea {
    user-select: text;
    -webkit-user-select: text;
}

::selection {
    background-color: var(--violeta-claro);
    color: var(--blanco);
}

main,
.footer {
    position: relative;
    z-index: 2;
}

/* =====================================================
   FONDO GENERAL: GRILLA, GLOW Y PARTÍCULAS
===================================================== */

.page-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-grid {
    position: absolute;
    inset: 0;
    opacity: 0.22;
    background-image:
        linear-gradient(rgba(124, 58, 237, 0.18) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124, 58, 237, 0.18) 1px, transparent 1px);
    background-size: 54px 54px;
    mask-image: linear-gradient(to bottom, black, transparent 85%);
    animation: gridMove 18s linear infinite;
}

.bg-orb {
    position: absolute;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    filter: blur(48px);
    opacity: 0.34;
    animation: orbFloat 10s ease-in-out infinite alternate;
}

.orb-uno {
    top: 10%;
    left: -100px;
    background-color: var(--violeta-claro);
}

.orb-dos {
    right: -120px;
    bottom: 8%;
    background-color: var(--violeta-oscuro);
    animation-delay: -4s;
}

.particles {
    position: absolute;
    inset: 0;
}

.particles span {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: rgba(124, 58, 237, 0.58);
    box-shadow: 0 0 18px rgba(168, 85, 247, 0.8);
    animation: particleFloat linear infinite;
}

/* =====================================================
   CURSOR PERSONALIZADO
===================================================== */

.custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    display: block;
    width: 18px;
    height: 18px;
    border: 1px solid rgba(168, 85, 247, 0.9);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%);
    mix-blend-mode: screen;
    backdrop-filter: blur(1px);
    box-shadow: 0 0 22px rgba(168, 85, 247, 0.55);
    transition:
        width 0.18s ease,
        height 0.18s ease,
        opacity 0.18s ease,
        background-color 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.custom-cursor.cursor-visible {
    opacity: 1;
}

.custom-cursor.cursor-hover {
    width: 46px;
    height: 46px;
    border-color: rgba(255, 255, 255, 0.95);
    background-color: rgba(168, 85, 247, 0.18);
    box-shadow:
        0 0 32px rgba(168, 85, 247, 0.75),
        inset 0 0 12px rgba(255, 255, 255, 0.35);
}

@media (hover: none), (pointer: coarse) {
    * {
        cursor: auto !important;
    }

    .custom-cursor {
        display: none !important;
    }
}

/* =====================================================
   HEADER / NAVBAR
===================================================== */

.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: rgba(11, 11, 18, 0.9);
    border-bottom: 1px solid rgba(168, 85, 247, 0.22);
    backdrop-filter: blur(18px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.navbar {
    max-width: var(--max-width);
    min-height: var(--header-height);
    margin: auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

.logo h2 {
    color: transparent;
    background: linear-gradient(90deg, var(--violeta), var(--violeta-claro), #111, var(--violeta));
    background-size: 260% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: gradientShift 5s ease infinite;
}

.logo img {
    display: block;
    width: auto;
    max-height: 42px;
}

.logo:hover {
    opacity: 0.82;
    transform: translateY(-1px);
    filter: drop-shadow(0 0 14px rgba(168, 85, 247, 0.55));
}

#menu-toggle {
    display: none;
}

.menu-icon {
    display: none;
    flex-direction: column;
    gap: 5px;
}

.menu-icon span {
    width: 28px;
    height: 3px;
    background-color: var(--blanco);
    border-radius: 5px;
    transition: transform 0.3s ease, opacity 0.3s ease, background-color 0.2s ease;
}

.menu-icon:hover span {
    background-color: var(--violeta-claro);
}

#menu-toggle:checked ~ .menu-icon span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

#menu-toggle:checked ~ .menu-icon span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

#menu-toggle:checked ~ .menu-icon span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

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

.nav-links a {
    position: relative;
    padding: 8px 2px;
    color: var(--blanco);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.nav-links a::after {
    content: "";
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--violeta), var(--violeta-claro), white);
    box-shadow: 0 0 12px var(--glow-violeta);
    transition: width 0.25s ease;
}

.nav-links a:hover {
    color: var(--violeta-claro);
    text-shadow: 0 0 16px var(--glow-violeta);
}

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

/* =====================================================
   PÁGINA 404
===================================================== */

main.page-404 {
    flex: 1 0 auto;
    min-height: calc(100vh - var(--header-height) - 118px);
    display: grid;
    place-items: center;
    padding: calc(var(--header-height) + 28px) 20px 40px;
    text-align: center;
    background:
        radial-gradient(circle at 8% 20%, rgba(124, 58, 237, 0.35), transparent 24%),
        radial-gradient(circle at 92% 80%, rgba(124, 58, 237, 0.28), transparent 26%),
        linear-gradient(rgba(168, 85, 247, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(168, 85, 247, 0.045) 1px, transparent 1px),
        #111;
    background-size:
        auto,
        auto,
        42px 42px,
        42px 42px,
        auto;
}

.page-404 .box {
    position: relative;
    width: min(90vw, 420px);
    height: 260px;
    overflow: hidden;
    border: 2px solid var(--violeta);
    border-radius: 18px;
    background: rgba(24, 24, 24, 0.92);
    box-shadow:
        0 0 30px rgba(124, 58, 237, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.page-404 h1 {
    margin-top: 45px;
    color: var(--blanco);
    font-size: 28px;
}

.page-404 p {
    color: var(--texto-suave);
}

.page-404 #btn {
    position: absolute;
    left: 50%;
    top: 65%;
    padding: 12px 18px;
    border: 0;
    border-radius: 999px;
    background: var(--violeta);
    color: var(--blanco);
    font-weight: 700;
    transform: translate(-50%, -50%);
    transition:
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}

.page-404 #btn:hover {
    background: var(--violeta-claro);
    box-shadow: 0 0 18px rgba(168, 85, 247, 0.55);
}

.page-404 #msg {
    display: none;
    margin-top: 20px;
    color: var(--violeta-claro);
    font-weight: 700;
}

/* =====================================================
   FOOTER
===================================================== */

.footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 35px 40px;
    border-top: 1px solid rgba(168, 85, 247, 0.22);
    background-color: rgba(11, 11, 18, 0.96);
    color: var(--blanco);
    font-size: 14px;
}

.footer p {
    max-width: var(--max-width);
    margin: auto;
    color: #888;
    transition: color 0.3s ease;
}

.footer p:hover {
    color: #ccc;
}

/* =====================================================
   RESPONSIVE
===================================================== */

@media (max-width: 768px) {
    .navbar {
        position: relative;
    }

    .menu-icon {
        display: flex;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 20px;
        right: 20px;
        width: auto;
        padding: 20px;
        display: flex;
        flex-direction: column;
        gap: 15px;
        border: 1px solid rgba(168, 85, 247, 0.22);
        border-radius: 0 0 18px 18px;
        background-color: rgba(11, 11, 18, 0.96);
        box-shadow: 0 18px 34px rgba(0, 0, 0, 0.26);
        backdrop-filter: blur(18px);
        opacity: 0;
        pointer-events: none;
        transform: translateY(-8px);
        transition: opacity 0.25s ease, transform 0.25s ease;
    }

    #menu-toggle:checked ~ .nav-links {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    main.page-404 {
        min-height: calc(100vh - var(--header-height) - 210px);
        padding: calc(var(--header-height) + 24px) 16px 34px;
    }

    .page-404 .box {
        height: 250px;
    }

    .footer {
        flex-direction: column;
        align-items: flex-start;
        padding: 28px 24px;
    }
}

/* =====================================================
   KEYFRAMES
===================================================== */

@keyframes gridMove {
    from { background-position: 0 0; }
    to { background-position: 54px 54px; }
}

@keyframes orbFloat {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to { transform: translate3d(36px, -26px, 0) scale(1.12); }
}

@keyframes particleFloat {
    0% { transform: translateY(0) scale(0.7); opacity: 0; }
    18% { opacity: 1; }
    100% { transform: translateY(-120px) scale(1.2); opacity: 0; }
}

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

/* =====================================================
   ACCESIBILIDAD: REDUCIR MOVIMIENTO
===================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
