/* ============ VARIABLES ============ */
:root {
    --bg: #0f0b1a;
    --bg-soft: #171124;
    --bg-card: rgba(27, 20, 43, 0.88);
    --bg-card-2: rgba(35, 26, 58, 0.92);

    --primary: #9b7bff;
    --primary-2: #7c5cff;
    --primary-soft: rgba(155, 123, 255, 0.16);

    --text: #f4f1ff;
    --text-soft: #c9c1dd;
    --muted: #8f86a8;

    --border: rgba(155, 123, 255, 0.16);
    --border-strong: rgba(155, 123, 255, 0.28);

    --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.2);

    --radius: 22px;
    --radius-sm: 14px;

    --container: 1120px;
    --transition: 0.25s ease;
}

/* ============ RESET ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Outfit", sans-serif;
    background:
        radial-gradient(circle at top, rgba(155, 123, 255, 0.16), transparent 30%),
        radial-gradient(circle at 80% 20%, rgba(124, 92, 255, 0.12), transparent 25%),
        linear-gradient(180deg, #0f0b1a 0%, #0c0914 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* ============ CONTENEDOR GENERAL ============ */
section,
header,
footer {
    width: min(100% - 32px, var(--container));
    margin: 0 auto;
}

/* ============ NAVBAR ============ */
.nav {
    position: sticky;
    top: 18px;
    z-index: 1000;
    margin-top: 18px;
    padding: 16px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    background: rgba(18, 13, 31, 0.72);
    backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
}

.nav-logo {
    font-family: "DM Serif Display", serif;
    font-size: 1.2rem;
    letter-spacing: 0.4px;
    color: var(--text);
    transition: var(--transition);
}

.nav-logo:hover {
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 22px;
    align-items: center;
}

.nav-links a {
    color: var(--text-soft);
    font-size: 0.98rem;
    transition: var(--transition);
    position: relative;
}

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

.nav-links a:hover {
    color: var(--text);
}

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

.nav-toggle {
    display: none;
    color: var(--text);
    font-size: 1.3rem;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
}

/* ============ HERO ============ */
.hero {
    position: relative;
    margin-top: 24px;
    min-height: 78vh;
    display: grid;
    align-items: center;
    padding: 90px 0 60px;
    overflow: hidden;
}

.hero-inner {
    max-width: 760px;
    position: relative;
    z-index: 2;
}

.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.9rem;
    color: var(--primary);
    background: var(--primary-soft);
    border: 1px solid rgba(155, 123, 255, 0.24);
}

.hero-title {
    font-family: "DM Serif Display", serif;
    font-size: clamp(3rem, 8vw, 6rem);
    line-height: 0.95;
    letter-spacing: 0.4px;
    margin-bottom: 18px;
    text-wrap: balance;
}

.hero-title em {
    font-style: normal;
    background: linear-gradient(90deg, #f7f3ff 0%, #cbb8ff 35%, #9b7bff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-sub {
    max-width: 640px;
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    color: var(--text-soft);
    margin-bottom: 28px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.btn-primary,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 999px;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
    color: #fff;
    box-shadow: 0 12px 30px rgba(124, 92, 255, 0.28);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 38px rgba(124, 92, 255, 0.36);
}

.btn-ghost {
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: rgba(155, 123, 255, 0.08);
    border-color: var(--border-strong);
    transform: translateY(-2px);
}

.hero-deco {
    position: absolute;
    inset: auto -120px -160px auto;
    width: 460px;
    height: 460px;
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(155, 123, 255, 0.22) 0%, rgba(155, 123, 255, 0.06) 35%, transparent 70%);
    filter: blur(10px);
    pointer-events: none;
    z-index: 1;
}

/* ============ SECTIONS ============ */
.section {
    padding: 38px 0 18px;
}

.section-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 22px;
}

.section-title {
    font-family: "DM Serif Display", serif;
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    letter-spacing: 0.3px;
}

.section-count {
    color: var(--muted);
    font-family: "DM Mono", monospace;
    font-size: 0.92rem;
}

/* ============ PROJECT CARDS ============ */
#projects-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.project-card {
    padding: 20px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-card:nth-child(2) {
    animation-delay: 0.1s;
}

.project-card:nth-child(3) {
    animation-delay: 0.2s;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.project-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
}

.project-title {
    font-size: 1.2rem;
    font-weight: 500;
}

.project-desc {
    color: var(--text-soft);
    font-size: 0.95rem;
}

/* ============ MODAL ============ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 8, 20, 0.75);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    width: min(90%, 700px);
    padding: 28px;
    border-radius: var(--radius);
    background: var(--bg-card-2);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 90vh;
    overflow-y: auto;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    align-self: flex-end;
    font-size: 1.2rem;
    color: var(--text-soft);
}

.modal-tag {
    display: inline-flex;
    align-items: center;
    width: 100px;
    gap: 8px;
    margin-bottom: 18px;
    padding: 4px 7px;
    border-radius: 999px;
    font-size: 0.9rem;
    color: var(--primary);
    background: var(--primary-soft);
    border: 1px solid rgba(155, 123, 100, 0.24);
}

.modal-tech-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-tech-title {
    color: var(--text);
    font-weight: 500;
    font-size: 1rem;
}

.modal-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.modal-tech-pill {
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 0.9rem;
    transition: var(--transition);
}

.modal-tech-pill:hover {
    background: rgba(155, 123, 255, 0.12);
    border-color: var(--border-strong);
    color: var(--text);
}

/* ============ GALERÍA DEL MODAL ============ */
.modal-gallery {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-gallery-title {
    color: var(--text);
    font-weight: 500;
    font-size: 1rem;
}

.gallery {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gallery-track-wrapper {
    flex: 1;
    overflow: hidden;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    aspect-ratio: 16 / 9;
    background: rgba(0, 0, 0, 0.25);
    position: relative;
}

.gallery-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.gallery-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: var(--radius-sm);
}

.gallery-img.active {
    opacity: 1;
}

.gallery-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-soft);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.gallery-btn:hover {
    background: rgba(155, 123, 255, 0.12);
    border-color: var(--border-strong);
    color: var(--text);
}

.gallery-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.gallery-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: none;
    background: var(--border-strong);
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.gallery-dot.active {
    background: var(--primary);
    transform: scale(1.4);
}

/* responsive */
@media (max-width: 900px) {
    #projects-container {
        grid-template-columns: 1fr;
    }
}

/* ============ SKILLS ============ */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.skill-group {
    padding: 22px;
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--bg-card-2) 0%, rgba(22, 16, 37, 0.94) 100%);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
}

.skill-group-label {
    font-family: "DM Mono", monospace;
    font-size: 0.88rem;
    color: var(--primary);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.skill-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.skill-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px;
    border-radius: 999px;
    font-size: 0.95rem;
    color: var(--text-soft);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: var(--transition);
}

.skill-pill i {
    font-size: 1.1rem;
    line-height: 1;
}

.devicon-express-original {
    color: #ffffff;
}

.skill-pill:hover {
    transform: translateY(-2px);
    color: var(--text);
    border-color: rgba(155, 123, 255, 0.28);
    background: rgba(155, 123, 255, 0.1);
}

/* ============ ABOUT ============ */
.about-block {
    display: grid;
    grid-template-columns: 1.4fr 0.6fr;
    gap: 20px;
    align-items: center;
    padding: 24px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
}

#bio {
    color: var(--text-soft);
    font-size: 1.02rem;
    max-width: 68ch;
}

.avatar {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: 28px;
    justify-self: end;
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
    background: rgba(255, 255, 255, 0.03);
}

/* ============ CONTACTO ============ */
.contact-block {
    padding: 24px;
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(27, 20, 43, 0.95), rgba(19, 14, 31, 0.95));
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
}

.contact-sub {
    color: var(--text-soft);
    margin-bottom: 18px;
    max-width: 60ch;
}

.contact-form {
    display: flex;
    position: relative;
    flex-wrap: wrap;
    gap: 12px;
}

.contact-input {
    flex: 1 1 200px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    transition: var(--transition);
}

/* .contact-link {
    display: inline-flex;
    align-items: center;
    min-height: 46px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    transition: var(--transition);
}

.contact-link:hover {
    transform: translateY(-2px);
    border-color: rgba(155, 123, 255, 0.3);
    background: rgba(155, 123, 255, 0.08);
} */

/* ============ FOOTER ============ */
.footer {
    padding: 28px 0 42px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--text-soft);
    border-top: 1px solid rgba(155, 123, 255, 0.12);
    margin-top: 40px;
}

.footer-txt {
    font-size: 0.95rem;
}

.muted {
    color: var(--muted);
}

/* ============ STARS CANVAS ============ */
#stars-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* ============ SCROLL REVEAL ============ */

/* Estado inicial */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}

/* Estado visible — se activa con JS */
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Variantes de dirección (opcionales) */
.reveal-left {
    opacity: 0;
    transform: translateX(-28px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}

.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(28px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}

.reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Delays escalonados — para grupos de elementos */
.reveal-delay-1 {
    transition-delay: 0.1s;
}

.reveal-delay-2 {
    transition-delay: 0.2s;
}

.reveal-delay-3 {
    transition-delay: 0.3s;
}

.reveal-delay-4 {
    transition-delay: 0.4s;
}

.reveal-delay-5 {
    transition-delay: 0.5s;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
    .skills-grid {
        grid-template-columns: 1fr;
    }

    .about-block {
        grid-template-columns: 1fr;
    }

    .avatar {
        justify-self: start;
    }
}

@media (max-width: 720px) {
    .nav {
        border-radius: 28px;
        padding: 14px 16px;
    }

    .nav-links {
        display: none;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .hero {
        min-height: auto;
        padding: 70px 0 40px;
    }

    .section-header {
        align-items: start;
        flex-direction: column;
    }

    .footer {
        flex-direction: column;
    }
}

@media (max-width: 480px) {

    section,
    header,
    footer {
        width: min(100% - 20px, var(--container));
    }

    .hero-title {
        font-size: 2.8rem;
    }

    .skill-group,
    .contact-block,
    .about-block {
        padding: 18px;
    }

    .btn-primary,
    .btn-ghost,
    .contact-link {
        width: 100%;
    }

    .hero-actions,
    .contact-links {
        flex-direction: column;
    }
}