/* ===================================================
   THESERJS — V2  |  Dark portfolio
   =================================================== */

:root {
    --bg:        #080808;
    --bg-s:      #0e0e0e;
    --bg-card:   #131313;
    --green:     #00cc6a;
    --green-dim: rgba(0,204,106,0.12);
    --purple:    #a855f7;
    --purple-dim:rgba(168,85,247,0.12);
    --text:      #efefef;
    --muted:     #666;
    --border:    rgba(255,255,255,0.07);
    --sans:      'Space Grotesk', sans-serif;
    --mono:      'Space Mono', monospace;
    --ease:      cubic-bezier(0.16,1,0.3,1);
    --navbar-bg: rgba(8,8,8,0.88);
    --shadow-card: 0 8px 40px rgba(0,0,0,0.4);
}

/* ── LIGHT MODE ── */
body.light {
    --bg:        #f5f5f0;
    --bg-s:      #eeeee8;
    --bg-card:   #ffffff;
    --green:     #008c48;
    --green-dim: rgba(0,140,72,0.1);
    --purple:    #7c3aed;
    --purple-dim:rgba(124,58,237,0.1);
    --text:      #111111;
    --muted:     #777777;
    --border:    rgba(0,0,0,0.09);
    --navbar-bg: rgba(245,245,240,0.9);
    --shadow-card: 0 8px 40px rgba(0,0,0,0.1);
}

/* transición global al cambiar de modo */
body, body * {
    transition: background-color .35s var(--ease),
                color .35s var(--ease),
                border-color .35s var(--ease),
                box-shadow .35s var(--ease);
}
/* excepciones — animaciones no deben heredar la transición */
#particle-canvas, #noise-canvas, #cursor-dot, #cursor-ring,
.skill-fill, .glitch::before, .glitch::after {
    transition: none !important;
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    overflow-x: hidden;
    cursor: none;
}

img { display: block; max-width: 100%; }
a   { text-decoration: none; color: inherit; }
strong { color: var(--text); font-weight: 600; }

/* ───────────────────────────────────────────────
   CUSTOM CURSOR
   Chrome/Safari → mix-blend-mode: difference (efecto invertido)
   Firefox        → color sólido con sombra (Firefox no soporta
                    mix-blend-mode en position:fixed)
─────────────────────────────────────────────── */
#cursor-dot {
    width: 8px; height: 8px;
    background: #fff;
    border-radius: 50%;
    position: fixed; top: 0; left: 0;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%,-50%);
    mix-blend-mode: difference;
    transition: width .15s, height .15s;
    will-change: transform;
}
#cursor-ring {
    width: 38px; height: 38px;
    border: 1.5px solid #fff;
    border-radius: 50%;
    position: fixed; top: 0; left: 0;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%,-50%);
    mix-blend-mode: difference;
    transition: width .3s var(--ease), height .3s var(--ease);
    will-change: transform;
}
body.c-hover #cursor-dot  { width: 14px; height: 14px; }
body.c-hover #cursor-ring { width: 60px; height: 60px; }

/* ── Firefox: mix-blend-mode no funciona en fixed → fallback con color ── */
@supports (-moz-appearance: none) {
    #cursor-dot {
        mix-blend-mode: normal;
        background: var(--green);
        box-shadow: 0 0 0 1.5px rgba(0,0,0,.3), 0 0 8px rgba(0,204,106,.4);
    }
    #cursor-ring {
        mix-blend-mode: normal;
        border-color: var(--green);
        opacity: .6;
    }
    body.light #cursor-dot {
        background: #111;
        box-shadow: 0 0 0 1.5px rgba(255,255,255,.4), 0 0 6px rgba(0,0,0,.2);
    }
    body.light #cursor-ring { border-color: #333; opacity: .4; }
    body.c-hover #cursor-dot  { background: var(--purple); box-shadow: 0 0 0 1.5px rgba(0,0,0,.2), 0 0 12px rgba(168,85,247,.4); }
    body.c-hover #cursor-ring { border-color: var(--purple); }
}

/* ───────────────────────────────────────────────
   NOISE CANVAS
─────────────────────────────────────────────── */
#noise-canvas {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9990;
    opacity: .032;
}

/* ───────────────────────────────────────────────
   NAVBAR
─────────────────────────────────────────────── */
#navbar {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.4rem 2.5rem;
    transition: background .4s, backdrop-filter .4s, border-bottom .4s;
}
#navbar.scrolled {
    background: var(--navbar-bg);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

/* ── THEME TOGGLE SLIDER ── */
#theme-toggle {
    position: relative;
    width: 64px;
    height: 32px;
    border-radius: 999px;
    background: #1a1a2e;
    border: 1px solid rgba(255,255,255,.12);
    cursor: none;
    flex-shrink: 0;
    overflow: hidden;
    transition: background .5s, border-color .4s;
    padding: 0;
}
body.light #theme-toggle {
    background: #87ceeb;
    border-color: rgba(0,0,0,.1);
}

/* pista de fondo — estrellas (dark) o nubes (light) */
#theme-toggle::before {
    content: '✦  ·  ✦';
    position: absolute;
    top: 50%; left: 6px;
    transform: translateY(-50%);
    font-size: .5rem;
    color: rgba(255,255,255,.5);
    letter-spacing: 1px;
    transition: opacity .4s;
    pointer-events: none;
}
body.light #theme-toggle::before { opacity: 0; }

/* montañas — SVG inline via clip-path */
.toggle-mountains {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 14px;
    pointer-events: none;
    transition: opacity .4s;
}
.toggle-mountains svg {
    width: 100%; height: 100%;
    display: block;
}
body.light .toggle-mountains { opacity: 1; }
.toggle-mountains { opacity: 0; }

/* knob (círculo deslizante) */
.toggle-knob {
    position: absolute;
    top: 3px; left: 3px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: #ffd700;
    box-shadow: 0 0 8px rgba(255,215,0,.7), 0 0 20px rgba(255,215,0,.3);
    transition: transform .5s cubic-bezier(0.34,1.56,0.64,1),
                background .4s, box-shadow .4s;
    pointer-events: none;
    z-index: 2;
}
/* en dark mode el knob es la luna */
body:not(.light) .toggle-knob {
    background: #e8e8ff;
    box-shadow: 0 0 8px rgba(200,200,255,.6), 0 0 20px rgba(168,85,247,.3);
    /* "mordida" de luna con box-shadow interno */
    clip-path: circle(50%);
}
/* deslizado a la derecha = modo claro (sol) */
body.light .toggle-knob {
    transform: translateX(32px);
    background: #ffd700;
    box-shadow: 0 0 10px rgba(255,215,0,.9), 0 0 28px rgba(255,200,0,.5);
}

/* hide old svg icons */
.icon-moon, .icon-sun { display: none !important; }
.nav-logo {
    font-family: var(--mono);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: .1em;
    color: var(--text);
}
.nav-logo span { color: var(--green); }

#nav-links {
    display: flex;
    gap: 2.5rem;
}
.nav-link {
    font-size: .82rem;
    font-weight: 500;
    letter-spacing: .06em;
    color: var(--muted);
    position: relative;
    transition: color .2s;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -3px; left: 0;
    width: 0; height: 1px;
    background: var(--green);
    transition: width .3s var(--ease);
}
.nav-link:hover { color: var(--green); }
.nav-link:hover::after { width: 100%; }

#menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: 1px solid var(--border);
    padding: .55rem .65rem;
    border-radius: 6px;
    cursor: none;
}
#menu-btn span {
    display: block;
    width: 20px; height: 1.5px;
    background: var(--text);
    transition: transform .3s, opacity .3s;
}
#menu-btn.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
#menu-btn.open span:nth-child(2) { opacity: 0; }
#menu-btn.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ───────────────────────────────────────────────
   HERO
─────────────────────────────────────────────── */
#hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
#particle-canvas {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
}
.hero-grid-overlay {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(0,204,106,.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,204,106,.05) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    transition: none !important;
}
.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem;
}

/* badge */
.available-badge {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: var(--green-dim);
    border: 1px solid rgba(0,255,135,.25);
    color: var(--green);
    font-family: var(--mono);
    font-size: .75rem;
    letter-spacing: .12em;
    padding: .4rem 1.1rem;
    border-radius: 999px;
    margin-bottom: 2.2rem;
}
.pulse-dot {
    width: 7px; height: 7px;
    background: var(--green);
    border-radius: 50%;
    animation: pdot 1.6s ease-in-out infinite;
}
@keyframes pdot {
    0%,100% { opacity:1; transform:scale(1); }
    50%      { opacity:.3; transform:scale(.6); }
}

/* glitch title */
.hero-name { line-height: .9; margin-bottom: 1.6rem; }

.glitch {
    font-family: var(--mono);
    font-size: clamp(3.8rem, 13vw, 10rem);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.02em;
    display: block;
    position: relative;
    user-select: none;
}
.glitch.accent { color: var(--green); }

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}
.glitch::before {
    color: #ff2d78;
    animation: g1 4s infinite;
    clip-path: polygon(0 0,100% 0,100% 38%,0 38%);
    transform: translate(-3px,0);
}
.glitch::after {
    color: #00d4ff;
    animation: g2 4s infinite;
    clip-path: polygon(0 62%,100% 62%,100% 100%,0 100%);
    transform: translate(3px,0);
}
@keyframes g1 {
    0%,88%,100% { transform:translate(0); opacity:0; }
    89%          { transform:translate(-5px,1px); opacity:.9; }
    91%          { transform:translate(4px,-1px); opacity:.9; }
    93%          { transform:translate(0); opacity:0; }
}
@keyframes g2 {
    0%,85%,100% { transform:translate(0); opacity:0; }
    86%          { transform:translate(5px,-1px); opacity:.9; }
    88%          { transform:translate(-4px,1px); opacity:.9; }
    90%          { transform:translate(0); opacity:0; }
}

/* typewriter */
.typewriter-wrap {
    font-family: var(--mono);
    font-size: clamp(1rem, 2.5vw, 1.35rem);
    color: var(--muted);
    margin-bottom: 2.8rem;
    min-height: 2rem;
}
.tw-cursor { color: var(--green); animation: blink 1s step-end infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* hero buttons */
.hero-btns {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* scroll hint */
.scroll-hint {
    position: absolute;
    bottom: 2rem; left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    opacity: 0;
    animation: fadeInUp .6s 2.5s var(--ease) forwards;
}
.scroll-hint span {
    font-family: var(--mono);
    font-size: .6rem;
    letter-spacing: .4em;
    color: var(--muted);
    text-transform: uppercase;
}
.scroll-bar {
    width: 1px; height: 44px;
    background: linear-gradient(var(--muted), transparent);
    animation: sa 1.6s ease-in-out infinite;
}
@keyframes sa {
    0%   { transform:scaleY(0); transform-origin:top; }
    50%  { transform:scaleY(1); transform-origin:top; }
    51%  { transform-origin:bottom; }
    100% { transform:scaleY(0); transform-origin:bottom; }
}

/* ───────────────────────────────────────────────
   BUTTONS (shared)
─────────────────────────────────────────────── */
.btn-magnetic {
    display: inline-block;
    font-family: var(--sans);
    font-weight: 600;
    font-size: .875rem;
    letter-spacing: .05em;
    border-radius: 5px;
    cursor: none;
    transition: transform .12s, box-shadow .2s;
    position: relative;
}
.btn-primary {
    background: var(--green);
    color: #080808;
    padding: .9rem 2.2rem;
}
.btn-primary:hover { background: #00e87a; box-shadow: 0 0 24px rgba(0,255,135,.3); }
.btn-outline {
    border: 1.5px solid var(--border);
    color: var(--text);
    padding: .9rem 2.2rem;
}
.btn-outline:hover { border-color: var(--green); color: var(--green); }

/* ───────────────────────────────────────────────
   SHARED LAYOUT
─────────────────────────────────────────────── */
section { padding: 7rem 2rem; }
.container { max-width: 1100px; margin: 0 auto; }

.section-eyebrow {
    font-family: var(--mono);
    font-size: .78rem;
    color: var(--green);
    letter-spacing: .22em;
    margin-bottom: 3.5rem;
    opacity: .85;
}
.text-green { color: var(--green); }

/* ───────────────────────────────────────────────
   SOBRE MÍ
─────────────────────────────────────────────── */
#sobre-mi { background: var(--bg); }

.about-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 5rem;
    align-items: start;
}

/* photo */
.photo-wrap {
    position: relative;
    width: fit-content;
}
.photo-wrap img {
    width: 230px; height: 230px;
    object-fit: cover;
    border-radius: 14px;
    filter: grayscale(25%);
    transition: filter .4s;
}
.photo-wrap:hover img { filter: grayscale(0%); }
.photo-glow {
    position: absolute;
    inset: -8px;
    border: 1.5px solid var(--green);
    border-radius: 18px;
    opacity: .35;
    pointer-events: none;
    transition: opacity .3s;
}
.photo-wrap:hover .photo-glow { opacity: .7; }

/* stats */
.stats-row {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-top: 1.8rem;
}
.stat {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.stat-num {
    font-family: var(--mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--green);
    line-height: 1;
}
.stat-plus { font-family: var(--mono); font-size: 1.4rem; color: var(--green); }
.stat-label { font-size: .68rem; color: var(--muted); letter-spacing: .05em; }
.stat-divider { width: 1px; height: 36px; background: var(--border); }

/* text */
.about-right h2 {
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 1.5rem;
}
.about-right p {
    color: var(--muted);
    line-height: 1.85;
    font-size: .925rem;
    margin-bottom: .9rem;
}

/* pills */
.tech-pills {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1.8rem;
}
.pill {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--muted);
    font-family: var(--mono);
    font-size: .72rem;
    padding: .32rem .8rem;
    border-radius: 4px;
    transition: border-color .2s, color .2s, box-shadow .2s;
    cursor: default;
}
.pill:hover {
    border-color: var(--green);
    color: var(--green);
    box-shadow: 0 0 10px var(--green-dim);
}

/* ───────────────────────────────────────────────
   HABILIDADES
─────────────────────────────────────────────── */
#habilidades { background: var(--bg-s); }

.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.4rem;
}
.skill-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.6rem;
    transition: border-color .3s, box-shadow .3s;
    transform-style: preserve-3d;
    will-change: transform;
}
.skill-card:hover {
    border-color: rgba(0,255,135,.25);
    box-shadow: 0 0 30px rgba(0,255,135,.07);
}
.skill-card-top {
    display: flex;
    align-items: center;
    gap: .9rem;
    margin-bottom: .9rem;
}
.skill-icon {
    width: 40px; height: 40px;
    object-fit: contain;
}
.skill-card h3 {
    font-size: .95rem;
    font-weight: 600;
    color: var(--text);
}
.skill-card p {
    font-size: .78rem;
    color: var(--muted);
    line-height: 1.65;
    margin-bottom: 1rem;
}
.skill-bar {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: .4rem;
}
.skill-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--green), var(--purple));
    border-radius: 2px;
    transition: width 1.3s var(--ease);
}
.skill-pct {
    font-family: var(--mono);
    font-size: .68rem;
    color: var(--muted);
}

/* ───────────────────────────────────────────────
   PROYECTOS CTA
─────────────────────────────────────────────── */
#proyectos-cta {
    background: var(--bg);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.cta-box {
    max-width: 740px;
    margin: 0 auto;
    text-align: center;
}
.cta-eyebrow {
    font-family: var(--mono);
    font-size: .78rem;
    color: var(--green);
    letter-spacing: .22em;
    margin-bottom: 1.4rem;
}
.cta-heading {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 2.8rem;
}
.cta-heading em { font-style: normal; color: var(--green); }

/* ───────────────────────────────────────────────
   CONTACTO
─────────────────────────────────────────────── */
#contacto { background: var(--bg); }
.contact-wrap {
    max-width: 560px;
    margin: 0 auto;
    text-align: center;
}
.contact-wrap h2 { font-size: 3rem; font-weight: 700; margin-bottom: .8rem; }
.contact-wrap p  { color: var(--muted); font-size: .9rem; margin-bottom: 2rem; }

.contact-email {
    display: inline-block;
    font-family: var(--mono);
    font-size: .9rem;
    color: var(--green);
    border: 1px solid rgba(0,255,135,.3);
    padding: .9rem 2rem;
    border-radius: 5px;
    margin-bottom: 3rem;
    transition: background .2s, box-shadow .2s;
}
.contact-email:hover {
    background: var(--green-dim);
    box-shadow: 0 0 20px rgba(0,255,135,.15);
}

.socials { display: flex; justify-content: center; gap: 2rem; }
.social-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 500;
    transition: color .2s;
}
.social-item img {
    width: 22px; height: 22px;
    filter: brightness(0) invert(.5);
    transition: filter .2s;
}
.social-item:hover           { color: var(--green); }
.social-item:hover img       { filter: brightness(0) invert(1); }

/* ───────────────────────────────────────────────
   FOOTER
─────────────────────────────────────────────── */
footer {
    background: var(--bg-s);
    border-top: 1px solid var(--border);
    padding: 1.6rem 2.5rem;
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
footer span {
    font-family: var(--mono);
    font-size: .75rem;
    color: var(--muted);
}

/* ───────────────────────────────────────────────
   GSAP REVEAL — initial state set by JS, not CSS
   so content stays visible if JS/GSAP fails
─────────────────────────────────────────────── */
.gsap-reveal { opacity: 1; transform: translateY(0); }

/* ───────────────────────────────────────────────
   UTILS
─────────────────────────────────────────────── */
@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

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

@media (max-width: 700px) {
    #cursor-dot, #cursor-ring { display: none; }
    body { cursor: auto; }
    .btn-magnetic { cursor: pointer; }
    #menu-btn { display: flex; }
    #nav-links {
        display: none;
        flex-direction: column;
        gap: 0;
        position: absolute;
        top: 100%; left: 0; right: 0;
        background: rgba(8,8,8,.96);
        backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--border);
        padding: .5rem 0;
    }
    #nav-links.open { display: flex; }
    .nav-link { padding: .9rem 2.5rem; font-size: .9rem; }

    .about-grid { grid-template-columns: 1fr; gap: 2.5rem; }
    .photo-wrap img { width: 180px; height: 180px; }
    .skills-grid { grid-template-columns: 1fr; }
    .footer-inner { flex-direction: column; gap: .5rem; text-align: center; }
    section { padding: 5rem 1.5rem; }
}
