:root {
    --bg: #0b0b16;
    --bg2: #14142b;
    --bg3: #1d1d3d;
    --line: #4a4a7a;
    --line-dark: #232345;
    --text: #e9e6f7;
    --muted: #a8a4d4;
    --gold: #ffd23f;
    --gold2: #ff8b3d;
    --green: #4ce07a;
    --pink: #ff4d97;
    --cyan: #3ddcff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    image-rendering: pixelated;
}

html {
    scroll-behavior: smooth;
}

::selection {
    background: var(--gold);
    color: #111;
}

::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg2);
}

::-webkit-scrollbar-thumb {
    background: var(--line);
    border: 3px solid var(--bg2);
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    overflow-x: hidden;
    position: relative;
    width: 100%;
}

body.menu-open{
    overflow:hidden;
}

h1,
h2,
h3,
.logo,
.nav-links a,
.btn,
.tag,
.section-label,
.stage-tag {
    font-family: 'Press Start 2P', monospace;
    text-transform: uppercase;
}

/* ===== BACKDROP LAYERS ===== */
#pixel-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(var(--line-dark) 1px, transparent 1px),
        linear-gradient(90deg, var(--line-dark) 1px, transparent 1px);
    background-size: 32px 32px;
    opacity: .35;
    z-index: 0;
    pointer-events: none;
}

#matrix-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: .22;
    pointer-events: none;
}

#scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
    background: repeating-linear-gradient(to bottom,
            rgba(0, 0, 0, 0.18) 0px, rgba(0, 0, 0, 0.18) 2px,
            transparent 2px, transparent 4px);
    mix-blend-mode: multiply;
    animation: flicker 6s infinite steps(2);
}

@keyframes flicker {

    0%,
    96%,
    100% {
        opacity: 1;
    }

    97% {
        opacity: .85;
    }

    98% {
        opacity: 1;
    }
}

.page {
    position: relative;
    z-index: 2;
}

/* ===== NAV ===== */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 5%;
    background: var(--bg2);
    border-bottom: 4px solid var(--line);
    box-shadow: 0 4px 0 0 var(--line-dark);
}

.skill-count{
    font-family:'Press Start 2P';
    font-size:9px;
    color:var(--green);
    margin-top:6px;
    display:block;
}

.logo {
    font-size: 12px;
    letter-spacing: 1px;
    color: var(--gold);
    text-shadow: 2px 2px 0 var(--line-dark);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    cursor: pointer;
}

.logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    image-rendering: pixelated;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    gap: 26px;
    font-size: 11px;
    color: #c9c6e8;
}

.nav-links a {
    color: inherit;
    text-decoration: none;
    opacity: .85;
    position: relative;
    padding: 4px 0 4px 16px;
    /* espacio reservado a la izquierda para el marcador */
}

.nav-links a::before {
    content: "▸";
    color: var(--pink);
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scale(0);
    opacity: 0;
    transition: transform .12s, opacity .12s;
}

.nav-links a:hover {
    color: var(--gold);
    opacity: 1;
}

.nav-links a:hover::before {
    transform: translateY(-50%) scale(1);
    opacity: 1;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    width: 30px;
    height: 22px;
    position: relative;
    cursor: pointer;
    z-index: 60;
}

.nav-toggle span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--text);
}

.nav-toggle span:nth-child(1) {
    top: 0;
}

.nav-toggle span:nth-child(2) {
    top: 9px;
}

.nav-toggle span:nth-child(3) {
    top: 18px;
}

.nav-toggle.open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
    background: var(--gold);
}

.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
    background: var(--gold);
}

section {
    position: relative;
    width: 100%;
    padding: 110px 5%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-bottom: 4px solid var(--line-dark);
    overflow: hidden;
}

#hero {
    min-height: 100vh;
    padding: 90px 5% 60px;
    background: rgba(20, 20, 43, 0.6);
}

#about {
    background: rgba(20, 20, 43, 0.55);
}

#skills {
    background: rgba(11, 11, 22, 0.55);
}

#projects {
    background: rgba(20, 20, 43, 0.4);
}

#contact {
    background: rgba(20, 20, 43, 0.6);
}

canvas#sphere {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -52%);
    z-index: 1;
    pointer-events: none;
    max-width: 100%;
}

.hero-inner {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 40px;
    width: 100%;
}

.stage-tag {
    display: inline-block;
    font-size: 10px;
    color: var(--bg);
    background: var(--gold);
    padding: 6px 10px;
    margin-bottom: 18px;
    box-shadow: 3px 3px 0 var(--line-dark);
}

.hero-text {
    max-width: 100%;
}

.hero-text h1 {
    font-size: clamp(18px, 4vw, 36px);
    line-height: 1.7;
    max-width: 640px;
    text-shadow: 3px 3px 0 var(--line-dark);
    word-wrap: break-word;
}

.hero-text h1 .fade {
    color: var(--cyan);
}

.cursor-blink {
    display: inline-block;
    width: 12px;
    height: 20px;
    background: var(--pink);
    margin-left: 6px;
    animation: cursorBlink 1s steps(1) infinite;
    vertical-align: middle;
}

@keyframes cursorBlink {
    50% {
        opacity: 0;
    }
}

.side-info {
    max-width: 290px;
    text-align: left;
    background: var(--bg2);
    padding: 20px;
    border: 3px solid var(--line);
    width: 100%;
}

.side-info p {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: #c9c6e8;
    line-height: 1.6;
    margin-bottom: 20px;
}

.cta-row {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}

/* ===== BUTTONS (pixel-corner, press effect) ===== */
.btn {
    background: var(--gold);
    color: #111;
    border: none;
    padding: 14px 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 1px;
    text-decoration: none;
    display: inline-block;
    box-shadow: 4px 4px 0 var(--line-dark), 0 0 0 3px #000 inset;
    transition: transform .08s, box-shadow .08s;
    font-family: 'Press Start 2P', monospace;
    text-align: center;
}

.btn:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--line-dark), 0 0 0 3px #000 inset;
    background: var(--gold2);
}

.btn:active {
    transform: translate(4px, 4px);
    box-shadow: 0 0 0 var(--line-dark), 0 0 0 3px #000 inset;
}

.btn.btn-cv {
    background: var(--green);
}

.btn.btn-cv:hover {
    background: #38b866;
}

.btn.btn-github {
    background: var(--pink);
    color: #fff;
}

.btn.btn-github:hover {
    background: #e63e85;
}

.scroll-cue {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-family: 'Press Start 2P';
    color: var(--muted);
    z-index: 2;
    text-align: center;
}

.scroll-cue .arrow {
    display: block;
    margin-top: 8px;
    animation: bob .6s steps(2) infinite;
    color: var(--gold);
}

@keyframes bob {
    50% {
        transform: translateY(4px);
    }
}

/* ===== SECTION HEADS ===== */
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 50px;
    flex-wrap: wrap;
    gap: 20px;
}

.section-label {
    font-size: 11px;
    color: var(--gold);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-label::before {
    content: "■";
    color: var(--pink);
}

.section-head h2 {
    font-size: clamp(18px, 3vw, 28px);
    max-width: 600px;
    line-height: 1.7;
    text-shadow: 2px 2px 0 var(--line-dark);
}

.section-head p {
    font-family: 'Inter', sans-serif;
    color: var(--muted);
    font-size: 15px;
    max-width: 320px;
    text-align: right;
}

/* ===== PROJECTS ===== */
.work-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.work-card {
    background: var(--bg2);
    border: 3px solid var(--line);
    padding: 16px;
    display: flex;
    flex-direction: column;
    transition: transform .12s, border-color .12s, box-shadow .12s;
    position: relative;
}

.work-card:hover {
    border-color: var(--cyan);
    transform: translate(-4px, -4px);
    box-shadow: 6px 6px 0 var(--line-dark);
}

.work-body {
    padding: 16px 4px 4px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.work-num {
    font-family: 'Press Start 2P';
    font-size: 10px;
    color: var(--bg);
    background: var(--gold);
    display: inline-block;
    padding: 4px 8px;
    margin-bottom: 12px;
    width: fit-content;
}

/* ===== NEW: project icon + title header ===== */
.work-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 10px;
}

.work-icon {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
}

.work-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.work-card:hover .work-icon {
    border-color: var(--cyan);
}

.work-card h3 {
    font-family: 'Press Start 2P';
    font-size: 25px;
    color: var(--text);
    line-height: 1.5;
}

.work-card span.role {
    font-family: 'Inter', sans-serif;
    color: var(--muted);
    font-size: 17px;
    margin-top: 4px;
    line-height: 1.5;
}

.work-tags {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.work-tags span {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    color: var(--cyan);
    border: 2px solid var(--line);
    padding: 3px 8px;
    border-radius: 3px;
}

.work-link {
    margin-top: 16px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: var(--gold);
    text-decoration: none;
}

.work-link:hover {
    color: var(--gold2);
}

.work-link::before {
    content: "▶ ";
}

.work-status {
    margin-top: 16px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: var(--green);
}

/* .work-status::before {
    content: "●●● ";
    animation: blinkDot 1.2s steps(2) infinite;
} */

@keyframes blinkDot {
    50% {
        opacity: .3;
    }
}

/* ===== ABOUT ===== */
.about-grid {
    display: flex;
    gap: 50px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.about-photo {
    width: 220px;
    height: 260px;
    background: linear-gradient(160deg, var(--bg3), var(--bg));
    border: 3px solid var(--line);
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.about-photo-img {
    width: 70%;
    height: 70%;
    object-fit: contain;
    image-rendering: pixelated;
}

.about-text {
    max-width: 640px;
}

.about-text p {
    font-family: 'Inter', sans-serif;
    color: #c9c6e8;
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 18px;
}

.stat-row {
    display: flex;
    gap: 24px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.stat {
    background: var(--bg2);
    border: 2px solid var(--line);
    font-size: 18px;
    padding: 14px 18px;
    flex: 1;
    min-width: 130px;
}

.stat h4 {
    font-family: 'Press Start 2P';
    font-size: 18px;
    color: var(--gold);
}

.stat span {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: var(--muted);
}

/* ===== SKILLS ===== */
.skills-wrap {
    display: flex;
    flex-direction: column;
}

.skill-category {
    display: flex;
    gap: 30px;
    padding: 26px 0;
    border-top: 2px dashed var(--line-dark);
    align-items: flex-start;
    flex-wrap: wrap;
}

.skill-category:last-child {
    border-bottom: 2px dashed var(--line-dark);
}

.skill-label {
    font-family: 'Press Start 2P';
    font-size: 13px;
    color: var(--gold2);
    width: 150px;
    flex-shrink: 0;
    padding-top: 8px;
    line-height: 1.8;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 2px solid var(--line);
    background: var(--bg2);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #e4dfff;
    border-radius: 4px;
    transition: transform .1s, border-color .1s;
}

.badge:hover {
    border-color: var(--cyan);
    transform: translate(-2px, -2px);
    box-shadow: 3px 3px 0 var(--line-dark);
}

/* ===== CONTACT ===== */
#contact {
    align-items: center;
    text-align: center;
}

#contact h2 {
    font-size: clamp(20px, 5vw, 40px);
    line-height: 1.8;
    margin-bottom: 20px;
    text-shadow: 3px 3px 0 var(--line-dark);
}

#contact .sub {
    font-family: 'Inter', sans-serif;
    color: var(--muted);
    font-size: 16px;
    margin-bottom: 30px;
}

#contact .email {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    border-bottom: 2px solid var(--line);
    display: inline-block;
    padding-bottom: 6px;
    margin-bottom: 40px;
    text-decoration: none;
    word-break: break-all;
}

#contact .email:hover {
    color: var(--gold);
    border-color: var(--gold);
}

.socials {
    display: flex;
    gap: 30px;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    color: var(--muted);
    font-size: 15px;
    flex-wrap: wrap;
}

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

.socials a:hover {
    color: var(--gold);
}

footer {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 26px 5%;
    font-family: 'Press Start 2P';
    font-size: 10px;
    color: var(--muted);
    background: var(--bg2);
    border-top: 4px solid var(--line);
    line-height: 1.8;
    word-wrap: break-word;
}

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

@media(max-width:900px) {
    .work-grid {
        grid-template-columns: 1fr;
    }
}

@media(max-width:800px){
    .section-head{flex-direction:column;align-items:flex-start;}
    .section-head p{text-align:left;}

    .nav-links{
        display:none;
        position:fixed;
        top:0;
        left:0;
        right:0;
        bottom:0;
        width:100%;
        height:100vh;
        background:var(--bg2);
        flex-direction:column;
        align-items:center;
        justify-content:center;
        gap:10px;
        padding:0;
        z-index:40;
        overflow-y:auto;
    }
    .nav-links.open{display:flex;}
    .nav-links a{
        padding:16px 5%;
        font-size:16px;
    }

    .nav-toggle{display:block;}
    .hero-inner{flex-direction:column;align-items:flex-start;}
    .side-info{max-width:100%;}
}

@media(max-width:700px) {
    section {
        padding: 80px 6% 50px;
    }

    #hero {
        min-height: 100svh;
        padding: 100px 6% 90px;
        justify-content: flex-start;
    }

    .stage-tag {
        font-size: 9px;
    }

    .scroll-cue {
        bottom: 16px;
    }

    .hero-inner {
        margin-bottom: 20px;
    }

    .hero-text h1 {
        font-size: clamp(16px, 6vw, 28px);
    }

    .about-photo {
        width: 100%;
        max-width: 180px;
        height: 180px;
        margin: 0 auto;
    }

    .about-grid {
        gap: 28px;
    }

    .skill-category {
        flex-direction: column;
        gap: 12px;
        padding: 18px 0;
    }

    .skill-label {
        width: auto;
        padding-top: 0;
    }

    canvas#sphere {
        transform: translate(-50%, -52%) scale(.4);
        opacity: .6;
    }

    .cta-row {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .cta-row .btn {
        text-align: center;
        width: 100%;
    }

    .stat-row {
        gap: 14px;
    }

    .stat {
        min-width: 100px;
        padding: 12px 14px;
    }

    .stat h4 {
        font-size: 18px;
    }

    .logo {
        font-size: 10px;
    }

    .logo-img {
        width: 32px;
        height: 32px;
    }

    footer {
        font-size: 8px;
        padding: 20px 4%;
    }

    .work-card h3 {
        font-size: 12px;
    }

    .work-icon {
        width: 44px;
        height: 44px;
    }
}

@media(max-width:420px) {
    .hero-text h1 {
        font-size: clamp(15px, 6vw, 22px);
    }

    .section-head h2 {
        font-size: clamp(15px, 4vw, 20px);
    }

    #contact h2 {
        font-size: clamp(17px, 6vw, 26px);
    }

    .stat-row {
        flex-direction: column;
    }

    .stat {
        width: 100%;
    }

    canvas#sphere {
        transform: translate(-50%, -52%) scale(.32);
    }

    .work-icon {
        width: 40px;
        height: 40px;
    }

    .work-card h3 {
        font-size: 11px;
    }
}