:root {
    --bg-dark: #0a0a0c;
    --bg-card: #151518;
    --accent-cyan: #00f2ff;
    --accent-green: #00ff41;
    --text-main: #e0e0e0;
    --text-dim: #94a3b8;
    --glow: 0 0 15px rgba(0, 242, 255, 0.3);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    background-image: linear-gradient(rgba(0, 242, 255, 0.03) 1px, transparent 1px), 
                      linear-gradient(90deg, rgba(0, 242, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* Scanline effect */
.scanline {
    width: 100%;
    height: 100px;
    z-index: 9999;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0) 0%, rgba(0, 242, 255, 0.02) 50%, rgba(0, 0, 0, 0) 100%);
    opacity: 0.1;
    position: fixed;
    bottom: 100%;
    animation: scanline 8s linear infinite;
    pointer-events: none;
}

@keyframes scanline {
    0% { bottom: 100%; }
    100% { bottom: -100px; }
}

/* Nav */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(10, 10, 12, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 242, 255, 0.1);
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Fira Code', monospace;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--accent-cyan);
    text-decoration: none;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: 'Fira Code', monospace;
    transition: color 0.3s;
}

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

.menu-toggle {
    display: none;
}

.lang-toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.lang-btn {
    border: 1px solid rgba(0, 242, 255, 0.5);
    background: transparent;
    color: var(--accent-cyan);
    font-family: 'Fira Code', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 6px;
    padding: 0.24rem 0.45rem;
    cursor: pointer;
    line-height: 1;
}

.lang-btn.is-active {
    background: var(--accent-cyan);
    color: var(--bg-dark);
}

/* Hero Section */
.hero {
    padding: 180px 2rem 100px;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: center;
}

.terminal-text {
    font-family: 'Fira Code', monospace;
    color: var(--accent-green);
    margin-bottom: 0.5rem;
}

.glitch {
    font-size: 4.5rem;
    font-weight: 900;
    text-transform: uppercase;
    position: relative;
    color: white;
}

.role {
    font-size: 1.8rem;
    color: var(--accent-cyan);
    margin-bottom: 1.5rem;
    font-family: 'Fira Code', monospace;
}

.description {
    max-width: 600px;
    color: var(--text-dim);
}

.description p {
    margin-bottom: 1rem;
}

.hero-cta {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 0.8rem 2rem;
    text-decoration: none;
    font-family: 'Fira Code', monospace;
    font-weight: bold;
    border-radius: 4px;
    transition: all 0.3s;
}

.btn.primary {
    background: var(--accent-cyan);
    color: var(--bg-dark);
}

.btn.secondary {
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--glow);
}

.meta-card {
    background: var(--bg-card);
    border: 1px solid rgba(0, 242, 255, 0.18);
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    overflow: hidden;
}

.meta-window-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid rgba(0, 242, 255, 0.12);
    background: rgba(0, 0, 0, 0.28);
}

.window-dots {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.28);
}

.dot-red { background: #ffe07a; }
.dot-green { background: #5eff19; }
.dot-pink { background: #ff007f; }

.window-title {
    color: var(--text-dim);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
}

.meta-window-body {
    padding: 1.1rem 1rem 1rem;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.6rem;
}

.meta-item span:first-child {
    color: var(--accent-green);
}

/* Sections Global */
.section-title {
    font-family: 'Fira Code', monospace;
    font-size: 2rem;
    text-align: center;
    margin: 4rem 0 3rem;
    color: var(--accent-cyan);
}

.section-title::before { content: "> "; color: var(--accent-green); }

/* Projects */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 16px;
    overflow: hidden;
    transition: 0.3s;
}

.project-card:hover {
    border-color: var(--accent-cyan);
    transform: scale(1.02);
}

.project-window-top {
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.32);
}

.project-window-dots {
    display: flex;
    align-items: center;
    gap: 10px;
}

.project-window-dots .dot {
    width: 14px;
    height: 14px;
}

.project-image {
    padding: 12px 12px 0;
}

.project-image img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    object-position: center;
    opacity: 0.8;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.35);
}

.project-image img.project-img-contain {
    object-fit: contain;
    background: rgba(0, 0, 0, 0.35);
}

.project-info {
    padding: 1.5rem;
}

.project-info h4 {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
    color: var(--accent-cyan);
}

.project-info p {
    font-size: 0.9rem;
    color: var(--text-dim);
    height: 80px;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
    align-items: center;
}

.tech-stack span {
    font-size: 0.7rem;
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent-cyan);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
}

.tech-stack .tech-icon {
    width: 34px;
    height: 34px;
    border-radius: 0;
    background: transparent;
    border: none;
    padding: 0;
    object-fit: contain;
}

.project-links {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
}

.project-links a, .private-repo {
    font-size: 0.8rem;
    text-decoration: none;
    color: white;
    font-family: 'Fira Code', monospace;
}

.private-repo { color: var(--text-dim); font-style: italic; }

.pending-deploy {
    font-size: 0.75rem;
    color: #ffe07a;
    border: 1px dashed rgba(255, 224, 122, 0.55);
    background: rgba(255, 224, 122, 0.08);
    border-radius: 6px;
    padding: 2px 8px;
    font-family: 'Fira Code', monospace;
}

/* Skills */
.skills-container {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 260px));
    justify-content: center;
    gap: 2rem;
    padding: 0 2rem;
}

.skill-category h5 {
    color: var(--accent-green);
    margin-bottom: 1rem;
    font-family: 'Fira Code', monospace;
    border-bottom: 1px solid rgba(0, 255, 65, 0.2);
    padding-bottom: 5px;
}

.skill-category {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    overflow: hidden;
}

.skill-window-top {
    min-height: 44px;
    height: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.32);
}

.skill-window-dots {
    display: flex;
    align-items: center;
    gap: 10px;
}

.skill-window-dots .dot {
    width: 14px;
    height: 14px;
}

.skill-window-top h5 {
    margin: 0;
    padding: 0;
    border: none;
    font-size: 0.95rem;
    line-height: 1.15;
    flex: 1;
    min-width: 0;
    color: var(--accent-cyan);
}

.skill-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 1rem 1.1rem;
}

.skill-list span {
    font-size: 0.9rem;
    color: var(--text-dim);
}

.skill-list span::before { content: "• "; color: var(--accent-cyan); }

/* --- CERTIFICADOS CARRUSEL --- */
    .certs-section {
        margin-top: 48px;
        opacity: 0.92;
    }
    .certs-note {
        text-align: center;
        max-width: 520px;
        margin: -4px auto 22px auto;
        color: #c7c2d9;
        line-height: 1.4;
        font-size: 0.92rem;
    }
    .cert-title {
        font-size: 0.7rem;
        text-align: center;
        width: 100%;
        display: block;
        margin-top: 7px;
    }
    .cert-desc {
        font-size: 0.55rem;
        text-align: center;
        width: 100%;
        display: block;
    }
    .icon-cards {
            position: relative;
            width: 48vw;
            height: 32vw;
            max-width: 320px;
            max-height: 190px;
            margin: 0 auto;
            color: white;
            perspective: 1000px;
            transform-origin: center;
            filter: saturate(0.85);
            opacity: 0.9;
            cursor: grab;
            --carousel-depth: 30vw;
            touch-action: pan-y;
            user-select: none;
            -webkit-user-select: none;
        }
        .icon-cards--dragging {
            cursor: grabbing;
        }
    .icon-cards__content {
        position: absolute;
        width: 100%;
        height: 100%;
        transform-origin: center;
        transform-style: preserve-3d;
        transform: translateZ(calc(-1 * var(--carousel-depth))) rotateY(var(--carousel-angle, 0deg));
        transition: transform 0.9s cubic-bezier(0.77, 0, 0.175, 1);
    }
    .icon-cards--dragging .icon-cards__content {
        transition: none;
    }
    .icon-cards__item {
        position: absolute;
        top: 0;
        left: 0;
        width: 60vw;
        height: 40vw;
        max-width: 380px;
        max-height: 220px;
        box-shadow: none;
        border-radius: 6px;
        transform-origin: center;
        background: transparent;
        transform: rotateY(var(--item-angle, 0deg)) translateZ(var(--carousel-depth));
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 3rem;
    }
    .icon-cards__item .cert-card.main {
        min-width: 200px;
        max-width: 260px;
        min-height: 140px;
        padding: 18px 12px;
    
        box-sizing: border-box;
    }
    .icon-cards__item .cert-img {
        max-width: 370px;
        max-height: 180px;
        border-radius: 4px;
        box-shadow: none;
        pointer-events: none;
        user-select: none;
        -webkit-user-drag: none;
    }

/* Footer */
footer {
    margin-top: 100px;
    background: #050505;
    padding: 4rem 2rem;
    border-top: 1px solid rgba(0, 242, 255, 0.1);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 3rem;
}

.contact-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-cyan);
    text-decoration: none;
    margin-top: 1rem;
    font-family: 'Fira Code', monospace;
}

.system-status {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.online { color: var(--accent-green); animation: blink 1s infinite; }

@keyframes blink { 50% { opacity: 0.3; } }

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        padding: calc(0.95rem + env(safe-area-inset-top)) 1.1rem 0.9rem;
    }
    .menu-toggle {
        display: block;
    }
    .lang-toggle { margin-left: auto; margin-right: 0.8rem; }
    .lang-btn {
        font-size: 0.68rem;
        padding: 0.2rem 0.36rem;
    }
    .hero { padding: calc(205px + env(safe-area-inset-top)) 1.4rem 90px; }
    .hero-content { grid-template-columns: 1fr; text-align: center; }
    .glitch { font-size: 2.5rem; }
    .nav-links { display: none; }
    .description { margin: 0 auto; }
}

/* Desktop scale up */
@media (min-width: 1024px) {
    body { font-size: 15px; }

    .nav-container,
    .hero,
    .projects-grid,
    .skills-container,
    .footer-content {
        max-width: 1360px;
    }

    .logo { font-size: 1.08rem; }
    .nav-links a { font-size: 0.85rem; }

    .hero {
        padding: 200px 2.5rem 120px;
    }

    .hero-text {
        max-width: 980px;
    }

    .terminal-text {
        font-size: 0.98rem;
        margin-bottom: 1rem;
    }

    .glitch { font-size: 4.8rem; }
    .role { font-size: 2rem; }

    .description {
        max-width: 900px;
    }

    .description p {
        font-size: 0.98rem;
        line-height: 1.62;
    }

    .btn {
        font-size: 0.92rem;
        padding: 0.9rem 2rem;
    }

    .section-title { font-size: 1.95rem; }

    .project-info h4 { font-size: 1.22rem; }
    .project-info p {
        font-size: 0.88rem;
        height: auto;
        min-height: 96px;
    }

    .tech-stack span { font-size: 0.8rem; }
    .tech-stack .tech-icon {
        width: 38px;
        height: 38px;
    }
    .project-links a,
    .private-repo { font-size: 0.78rem; }

    .skill-category h5 { font-size: 0.9rem; }
    .skill-list span { font-size: 0.84rem; }

    .cert-title { font-size: 0.82rem; }
    .cert-desc { font-size: 0.64rem; }

    .contact-btn { font-size: 0.8rem; }
    .system-status { font-size: 0.76rem; }
}

/* --- RESPONSIVE QUERIES --- */
@media (max-width: 900px) {
    section { scroll-margin-top: calc(110px + env(safe-area-inset-top)); }
    main { max-width: 99vw; }
    .projects-grid { grid-template-columns: 1fr; gap: 20px; }
    .skills-container {
        grid-template-columns: repeat(auto-fit, minmax(220px, 280px));
        justify-content: center;
        gap: 1rem;
        padding: 0 1rem;
    }
    .skill-window-top {
        min-height: 48px;
        padding: 8px 12px;
        gap: 8px;
    }
    .skill-window-dots { gap: 7px; }
    .skill-window-dots .dot {
        width: 11px;
        height: 11px;
    }
    .skill-window-top h5 {
        font-size: 0.9rem;
        line-height: 1.2;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    /* Carrusel: centrado perfecto y proporcion estable (tabla/phone) */
    .icon-cards {
        width: 100vw;
        max-width: 100vw;
        height: clamp(260px, 56vw, 420px);
        max-height: none;
        margin: 8px auto;
        display: flex;
        align-items: center;
        justify-content: center;
        --carousel-depth: 36vw;
    }
    .icon-cards__item {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .icon-cards__item .cert-card.main {
        min-width: 160px;
        max-width: min(88vw, 520px);
        min-height: 120px;
        height: auto;
        padding: 14px 12px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        box-sizing: border-box;
    }
    .icon-cards__item .cert-img {
        width: 100%;
        height: auto;
        max-width: 86vw;
        max-height: clamp(140px, 36vw, 260px);
        object-fit: contain;
    }

    .icon-cards__content {
        height: 100%;
    }
}

/* --- MOBILE CARRUSEL FIX: 650px --- */
@media (max-width: 650px) {
    main { padding: 2vw 1vw 6vw 1vw; border-radius: 10px; }
    header { border-radius: 10px 10px 0 0; }
    footer { border-radius: 0 0 10px 10px; }
    .welcome-block, #about { padding: 15px 4vw 8px 4vw; }
    .hero { padding-top: calc(188px + env(safe-area-inset-top)); }
    .skills-list { gap: 6px; justify-content: flex-start; }
    .skill-badge { font-size: 0.72rem; padding: 5px 9px; border-width: 1.5px; }
    .skill-window-top {
        min-height: 44px;
        padding: 7px 10px;
    }
    .skill-window-top h5 {
        font-size: 0.84rem;
    }

    /* ==== Carrusel movil centrado y sin recortes ==== */
    .icon-cards {
        width: 100vw;
        max-width: 100vw;
        height: clamp(240px, 62vw, 440px);
        margin: 10px auto;
        display: flex;
        align-items: center;
        justify-content: center;
        --carousel-depth: 50vw;
    }
    .icon-cards__item {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .icon-cards__item .cert-card.main {
        min-width: 120px;
        max-width: 94vw;
        min-height: 100px;
        height: auto;
        max-height: none;
        padding: 4vw 3vw;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        box-sizing: border-box;
    }
    .icon-cards__item .cert-img {
        width: 100%;
        height: auto;
        max-width: 90vw;
        max-height: clamp(120px, 40vw, 240px);
        object-fit: contain;
    }

    /* ==== FIN CARRUSEL MOVIL ==== */
}