@font-face {
    font-family: 'Aeroblade';
    src: url('fuentes/Aeroblade DEMO.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Aero';
    src: url('fuentes/Aero.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-dark: #050505;
    --neon-cyan: #0ff;
    --neon-magenta: #f0f;
    --neon-yellow: #ff0;
    --text-color: #e0e0e0;
    /* Glow / tint tokens – retro mode overrides these to recolor the whole site */
    --glow-cyan-soft: rgba(0, 255, 255, 0.08);
    --glow-cyan-mid: rgba(0, 255, 255, 0.15);
    --glow-cyan-strong: rgba(0, 255, 255, 0.3);
    --glow-magenta-strong: rgba(255, 0, 255, 0.3);
    --glow-yellow-soft: rgba(255, 255, 0, 0.2);
    --tint-cyan-border: rgba(0, 255, 255, 0.4);
    --tint-cyan-bg: rgba(0, 255, 255, 0.04);
    --tint-cyan-line: rgba(0, 255, 255, 0.12);
    /* Custom fonts first, Google Fonts as a safe fallback if a file fails */
    --font-heading: 'Aeroblade', 'Orbitron', sans-serif;
    --font-body: 'Aero', 'Rajdhani', sans-serif;
    --font-mono: 'Fira Code', monospace;
}

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

html {
    width: 100%;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-color);
    font-family: var(--font-body);
    font-size: 18px;
    overflow-x: hidden;
    position: relative;
    width: 100%;
}

/* Background Effects */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.10) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    background-size: 100% 4px, 3px 100%;
    z-index: 9999;
    opacity: 0.6;
    pointer-events: none;
}

/* Canvas digital-rain background */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.5;
    pointer-events: none;
}

/* Canvas for the Three.js floating-hardware background */
#bg3d-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.55;
    pointer-events: none;
}

#bg3d-canvas[hidden] {
    display: none;
}

.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 200vw;
    height: 200vh;
    background-image:
        linear-gradient(var(--neon-cyan) 1px, transparent 1px),
        linear-gradient(90deg, var(--neon-cyan) 1px, transparent 1px);
    background-size: 50px 50px;
    background-position: center bottom;
    opacity: 0.04;
    transform: perspective(500px) rotateX(60deg) translateY(-100px) translateZ(-200px);
    z-index: -2;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% {
        transform: perspective(500px) rotateX(60deg) translateY(0) translateZ(-200px);
    }

    100% {
        transform: perspective(500px) rotateX(60deg) translateY(50px) translateZ(-200px);
    }
}

@keyframes flatGridMove {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(30px);
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: 110px 0 70px;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1,
h2,
h3 {
    font-family: var(--font-heading);
    letter-spacing: 2px;
}

.section-title {
    font-size: clamp(1.5rem, 6vw, 3rem);
    color: var(--neon-cyan);
    margin-bottom: 3rem;
    text-transform: uppercase;
    position: relative;
    display: inline-block;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Glitch Effect */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--neon-magenta);
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-2 7s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 var(--neon-cyan);
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 6s infinite linear alternate-reverse;
}

/* Section titles & footer: static accent instead of constant glitching –
   keeps the cyberpunk identity while the content stays calm and readable */
.section-title.glitch::before,
.footer h2.glitch::before {
    animation: none;
    background: transparent;
    clip: rect(auto, auto, auto, auto);
    left: 1px;
    top: 1px;
    color: var(--neon-magenta);
    text-shadow: none;
    opacity: 0.35;
    z-index: -1;
}

.section-title.glitch::after,
.footer h2.glitch::after {
    animation: none;
    content: '';
    background: linear-gradient(90deg, var(--neon-cyan), transparent);
    clip: rect(auto, auto, auto, auto);
    text-shadow: none;
    height: 2px;
    width: 60%;
    top: auto;
    bottom: -12px;
    left: 0;
}

@keyframes glitch-anim {
    0% {
        clip: rect(10px, 9999px, 86px, 0);
    }

    20% {
        clip: rect(62px, 9999px, 21px, 0);
    }

    40% {
        clip: rect(32px, 9999px, 10px, 0);
    }

    60% {
        clip: rect(89px, 9999px, 59px, 0);
    }

    80% {
        clip: rect(15px, 9999px, 34px, 0);
    }

    100% {
        clip: rect(54px, 9999px, 78px, 0);
    }
}

@keyframes glitch-anim-2 {
    0% {
        clip: rect(65px, 9999px, 100px, 0);
    }

    20% {
        clip: rect(2px, 9999px, 46px, 0);
    }

    40% {
        clip: rect(88px, 9999px, 22px, 0);
    }

    60% {
        clip: rect(14px, 9999px, 77px, 0);
    }

    80% {
        clip: rect(55px, 9999px, 12px, 0);
    }

    100% {
        clip: rect(96px, 9999px, 34px, 0);
    }
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1.5rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(5, 5, 5, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--neon-cyan);
    box-shadow: 0 0 20px var(--glow-cyan-soft);
    z-index: 200;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: 1px;
}

.logo span {
    color: var(--neon-cyan);
    text-shadow: 0 0 8px var(--neon-cyan);
}

/* Nav right group (lang button + hamburger) */
.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    margin: 0 1.5rem;
    font-weight: 500;
    text-transform: uppercase;
    transition: color 0.25s, text-shadow 0.25s;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--neon-yellow);
    box-shadow: 0 0 6px var(--neon-yellow);
    transition: width 0.3s ease;
}

.nav-links a:hover {
    color: var(--neon-yellow);
    text-shadow: 0 0 10px var(--neon-yellow);
}

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

.nav-links a.active {
    color: var(--neon-cyan);
    text-shadow: 0 0 10px var(--neon-cyan);
}

/* Hamburger button */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 7px 8px;
    transition: border-color 0.3s, box-shadow 0.3s;
    flex-shrink: 0;
}

.hamburger:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px var(--glow-cyan-strong);
}

.hamburger span {
    display: block;
    width: 26px;
    height: 2px;
    background: var(--neon-cyan);
    box-shadow: 0 0 6px var(--neon-cyan);
    transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1),
                opacity 0.35s ease,
                background 0.35s ease,
                box-shadow 0.35s ease;
    transform-origin: center;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
    background: var(--neon-magenta);
    box-shadow: 0 0 8px var(--neon-magenta);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
    background: var(--neon-magenta);
    box-shadow: 0 0 8px var(--neon-magenta);
}

/* Mobile nav backdrop */
.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 149;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Prevent scroll when mobile menu is open */
body.no-scroll {
    overflow: hidden;
}

/* Cyber Buttons */
.cyber-button {
    background: transparent;
    color: var(--neon-cyan);
    border: 2px solid var(--neon-cyan);
    padding: 0.8rem 2rem;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: 0.3s;
    text-decoration: none;
    display: inline-block;
}

.cyber-button.small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.cyber-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--neon-cyan);
    transition: 0.3s;
    z-index: -1;
}

.cyber-button:hover {
    color: var(--bg-dark);
    box-shadow: 0 0 15px var(--neon-cyan);
}

.cyber-button:hover::before {
    left: 0;
}

.cyber-button.primary {
    border-color: var(--neon-magenta);
    color: var(--neon-magenta);
}

.cyber-button.primary::before {
    background: var(--neon-magenta);
}

.cyber-button.primary:hover {
    color: var(--bg-dark);
    box-shadow: 0 0 20px var(--neon-magenta);
}

/* Social icon dock (footer) */
.social-dock {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px;
    background: rgba(10, 10, 10, 0.85);
    border: 1px solid var(--tint-cyan-border);
}

.dock-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    color: #8a8a8a;
    text-decoration: none;
    transition: color 0.25s ease;
}

.dock-icon svg {
    width: 20px;
    height: 20px;
    transition: transform 0.25s ease;
}

.dock-icon::before {
    content: '';
    position: absolute;
    inset: 4px;
    background: var(--tint-cyan-bg);
    border: 1px solid transparent;
    opacity: 0;
    transform: scale(0.9);
    transition: 0.25s ease;
}

.dock-icon::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    margin-bottom: 10px;
    padding: 4px 10px;
    background: var(--neon-cyan);
    color: var(--bg-dark);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 4px);
    transition: 0.25s ease;
}

.dock-underline {
    position: absolute;
    bottom: 6px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--neon-cyan);
    transform: translateX(-50%);
    transition: width 0.25s ease;
}

.dock-icon:hover,
.dock-icon:focus-visible {
    color: var(--neon-cyan);
}

.dock-icon:hover svg,
.dock-icon:focus-visible svg {
    transform: scale(1.12);
}

.dock-icon:hover::before,
.dock-icon:focus-visible::before {
    opacity: 1;
    border-color: var(--tint-cyan-border);
    transform: scale(1);
}

.dock-icon:hover::after,
.dock-icon:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

.dock-icon:hover .dock-underline,
.dock-icon:focus-visible .dock-underline {
    width: 14px;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 2rem 2rem;
    position: relative;
}

.hero-content {
    position: relative;
    padding: 2.5rem;
    max-width: 750px;
}

/* Four-corner bracket decoration */
.hero-corner {
    position: absolute;
    width: 28px;
    height: 28px;
    pointer-events: none;
}

.hero-corner.tl {
    top: 0;
    left: 0;
    border-top: 2px solid var(--neon-cyan);
    border-left: 2px solid var(--neon-cyan);
    box-shadow: -2px -2px 12px var(--glow-cyan-strong);
}

.hero-corner.br {
    bottom: 0;
    right: 0;
    border-bottom: 2px solid var(--neon-magenta);
    border-right: 2px solid var(--neon-magenta);
    box-shadow: 2px 2px 12px var(--glow-magenta-strong);
}

.hero-content::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 28px;
    height: 28px;
    border-top: 2px solid var(--neon-cyan);
    border-right: 2px solid var(--neon-cyan);
    box-shadow: 2px -2px 12px var(--glow-cyan-strong);
    pointer-events: none;
}

.hero-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 28px;
    height: 28px;
    border-bottom: 2px solid var(--neon-magenta);
    border-left: 2px solid var(--neon-magenta);
    box-shadow: -2px 2px 12px var(--glow-magenta-strong);
    pointer-events: none;
}

/* Blinking status badge */
.hero-badge {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--neon-yellow);
    text-shadow: 0 0 10px var(--neon-yellow);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    animation: blink 2.5s step-end infinite;
}

.hero h1 {
    font-size: clamp(2.5rem, 10vw, 5rem);
    color: var(--text-color);
    margin-bottom: 1rem;
    word-break: break-word;
}

.hero .subtitle {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    color: var(--neon-cyan);
    margin-bottom: 1.5rem;
    text-shadow: 0 0 5px var(--neon-cyan);
}

.hero .description {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto 2.5rem auto;
    line-height: 1.7;
    color: #c8c8c8;
}

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

/* Scroll-linked 3D tilt on the terminal window – vanilla recreation of a
   scroll-driven card reveal. .scroll-tilt-stage holds the perspective;
   .scroll-tilt-card gets the rotate/scale so the terminal-window's own
   .reveal/.visible transform (fade + slide) stays on its own element and
   never fights this one for the `transform` property. */
.scroll-tilt-stage {
    perspective: 1200px;
}

.scroll-tilt-card {
    transform: rotateX(var(--tilt-rotate, 14deg)) scale(var(--tilt-scale, 0.94));
    transform-origin: center top;
    will-change: transform;
}

/* Terminal / About Section */
.terminal-window {
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 5px;
    box-shadow: 0 0 20px var(--glow-cyan-soft);
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden;
}

.terminal-header {
    background: #1a1a1a;
    padding: 10px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #333;
}

.terminal-header .btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.terminal-header .close {
    background: #ff5f56;
}

.terminal-header .min {
    background: #ffbd2e;
}

.terminal-header .max {
    background: #27c93f;
}

.terminal-header .title {
    color: #aaa;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    margin-left: 15px;
}

.terminal-body {
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 1rem;
    color: #0f0;
    line-height: 1.7;
}

.terminal-body p {
    margin-bottom: 10px;
}

.terminal-body .prompt {
    color: var(--neon-cyan);
}

.terminal-body .output {
    color: #ccc;
    margin-left: 15px;
}

.terminal-body .output.highlight {
    color: var(--neon-yellow);
}

.cursor {
    display: inline-block;
    width: 10px;
    height: 1.2em;
    background-color: #0f0;
    vertical-align: middle;
    animation: blink 1s step-end infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Skills strip */
.skills-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    max-width: 800px;
    margin: 2rem auto 0;
}

.skill-badge {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--neon-cyan);
    border: 1px solid var(--tint-cyan-border);
    background: var(--tint-cyan-bg);
    padding: 0.4rem 0.9rem;
    letter-spacing: 1px;
    transition: color 0.25s, border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

.skill-badge:hover {
    color: var(--neon-yellow);
    border-color: var(--neon-yellow);
    box-shadow: 0 0 12px var(--glow-yellow-soft);
    transform: translateY(-3px);
}

/* Scroll reveal animation */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    will-change: opacity, transform;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Terminal boot print – lines appear sequentially when terminal reveals */
.terminal-window.reveal .terminal-body p {
    opacity: 0;
}

.terminal-window.visible .terminal-body p {
    animation: bootLine 0.45s ease forwards;
}

.terminal-window.visible .terminal-body p:nth-child(1) { animation-delay: 0.15s; }
.terminal-window.visible .terminal-body p:nth-child(2) { animation-delay: 0.35s; }
.terminal-window.visible .terminal-body p:nth-child(3) { animation-delay: 0.55s; }
.terminal-window.visible .terminal-body p:nth-child(4) { animation-delay: 0.75s; }
.terminal-window.visible .terminal-body p:nth-child(5) { animation-delay: 0.95s; }
.terminal-window.visible .terminal-body p:nth-child(6) { animation-delay: 1.15s; }
.terminal-window.visible .terminal-body p:nth-child(7) { animation-delay: 1.35s; }
.terminal-window.visible .terminal-body p:nth-child(8) { animation-delay: 1.55s; }

@keyframes bootLine {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Projects Section */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.cyber-card {
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid #333;
    position: relative;
    padding: 30px;
    transition: 0.3s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.cyber-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    width: 20px;
    height: 2px;
    background: var(--neon-cyan);
    transition: 0.3s;
}

.cyber-card::after {
    content: '';
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 20px;
    height: 2px;
    background: var(--neon-magenta);
    transition: 0.3s;
}

.cyber-card:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px var(--glow-cyan-mid);
    transform: translateY(-3px);
}

.cyber-card:hover::before,
.cyber-card:hover::after {
    width: 100%;
}

.card-tag {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--neon-yellow);
    margin-bottom: 10px;
}

.card-content h3 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 15px;
}

.card-content p {
    color: #c8c8c8;
    margin-bottom: 25px;
    flex-grow: 1;
}

.cyber-link {
    color: var(--neon-cyan);
    text-decoration: none;
    font-family: var(--font-mono);
    font-weight: 500;
    transition: 0.3s;
}

/* Carousel (Proyectos / Certificaciones) – on desktop this is just a
   plain wrapper around the grid; the arrows/dots only activate below
   the 768px breakpoint, see the media query further down. */
.carousel {
    position: relative;
}

.carousel-arrow {
    display: none;
}

.carousel-dots {
    display: none;
}

.cyber-link:hover {
    color: var(--neon-magenta);
    text-shadow: 0 0 8px var(--neon-magenta);
}

/* Keyboard focus – visible outline for links and buttons */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--neon-yellow);
    outline-offset: 3px;
}

/* Footer & Contact */
.footer {
    text-align: center;
    padding: 80px 0 40px 0;
    border-top: 1px dashed #333;
    margin-top: 50px;
}

.footer h2 {
    font-size: 2.5rem;
    color: var(--neon-magenta);
    margin-bottom: 30px;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.copyright {
    font-family: var(--font-mono);
    color: #8a8a8a;
    font-size: 0.9rem;
}

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

@media (max-width: 1024px) {
    .hero h1 {
        font-size: 4rem;
    }

    .hero .subtitle {
        font-size: 1.5rem;
    }

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

    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Tablet / Mobile – hamburger breakpoint */
@media (max-width: 768px) {
    /* Flatten grid-bg on mobile for performance */
    .grid-bg {
        transform: none;
        width: 100vw;
        height: 100vh;
        background-size: 30px 30px;
        opacity: 0.04;
        animation: flatGridMove 10s linear infinite;
    }

    /* Canvas opacity reduced slightly on smaller screens */
    #bg-canvas {
        opacity: 0.4;
    }

    /* Sections already grow long from single-column stacking on mobile –
       tighten the vertical padding tuned for desktop's wide rows */
    .section {
        padding: 70px 0 50px;
    }

    .container {
        padding-left: 1.2rem;
        padding-right: 1.2rem;
    }

    /* --- Navbar row layout (no stacking) --- */
    .navbar {
        padding: 14px 18px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .logo {
        font-size: 1.1rem;
    }

    /* Show hamburger, hide desktop nav underline decoration */
    .hamburger {
        display: flex;
    }

    /* --- Side-drawer nav --- */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: min(300px, 82vw);
        height: 100dvh;
        background: rgba(5, 5, 5, 0.97);
        border-left: 2px solid var(--neon-cyan);
        box-shadow: -6px 0 40px var(--glow-cyan-mid);
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        padding: 5rem 2rem 2rem;
        gap: 0;
        transition: right 0.4s cubic-bezier(0.77, 0, 0.175, 1);
        z-index: 160;
        margin: 0;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links a {
        font-size: 1.15rem;
        margin: 0;
        padding: 0.9rem 0;
        width: 100%;
        border-bottom: 1px solid var(--tint-cyan-line);
        transition: color 0.2s ease, padding-left 0.2s ease;
        letter-spacing: 1px;
    }

    .nav-links a:last-child {
        border-bottom: none;
    }

    .nav-links a:hover {
        padding-left: 12px;
    }

    /* Disable the underline pseudo-element inside drawer */
    .nav-links a::after {
        display: none;
    }

    /* Language + retro buttons stay in nav-right row */
    #lang-toggle,
    #retro-toggle {
        font-size: 0.65rem;
        padding: 0.35rem 0.55rem;
        position: static;
        border-width: 1px;
    }

    .nav-right {
        gap: 0.5rem;
    }

    .logo {
        white-space: nowrap;
        margin-right: 0.5rem;
    }

    /* Hero tweaks */
    .hero {
        height: auto;
        min-height: 100svh;
        padding: 130px 1rem 60px;
    }

    .hero-content {
        padding: 1.5rem;
    }

    .hero-corner {
        width: 20px;
        height: 20px;
    }

    .hero-content::before,
    .hero-content::after {
        width: 20px;
        height: 20px;
    }

    .hero h1 {
        font-size: clamp(2rem, 10vw, 3.2rem);
    }

    .hero .subtitle {
        font-size: clamp(1rem, 4vw, 1.3rem);
    }

    .hero .description {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    /* Terminal */
    .terminal-window {
        max-width: 100%;
        border-radius: 0;
    }

    .terminal-body {
        font-size: 0.9rem;
        padding: 15px;
    }

    /* Cards – horizontal scroll-snap carousel instead of a vertical stack,
       so 6-7 project/certification cards don't turn the page into a wall
       of scrolling. Desktop keeps the grid untouched. */
    .projects-grid {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Side padding matches half the leftover space around an 88%-wide
           card (100% - 88% = 12%, split 6%/6%) so the first and last
           cards can scroll-snap fully centered too, not just the middle ones. */
        padding: 0 6% 4px;
    }

    .projects-grid::-webkit-scrollbar {
        display: none;
    }

    .projects-grid .cyber-card {
        flex: 0 0 88%;
        max-width: 340px;
        min-width: 0;
        padding: 22px;
        scroll-snap-align: center;
    }

    .projects-grid .card-content h3 {
        font-size: 1rem;
        overflow-wrap: break-word;
    }

    .carousel-arrow {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 34px;
        height: 34px;
        background: rgba(5, 5, 5, 0.85);
        border: 1px solid var(--tint-cyan-border);
        color: var(--neon-cyan);
        font-family: var(--font-mono);
        font-size: 1.3rem;
        line-height: 1;
        cursor: pointer;
        z-index: 5;
        transition: 0.25s;
    }

    .carousel-arrow.prev {
        left: 2px;
    }

    .carousel-arrow.next {
        right: 2px;
    }

    .carousel-arrow:hover:not(:disabled) {
        border-color: var(--neon-cyan);
        box-shadow: 0 0 12px var(--glow-cyan-mid);
    }

    .carousel-arrow:disabled {
        opacity: 0.3;
        cursor: default;
    }

    .carousel-dots {
        display: flex;
        justify-content: center;
        gap: 10px;
        margin-top: 18px;
    }

    .carousel-dot {
        width: 8px;
        height: 8px;
        padding: 0;
        background: transparent;
        border: 1px solid var(--tint-cyan-border);
        cursor: pointer;
        transition: 0.25s;
    }

    .carousel-dot.active {
        background: var(--neon-cyan);
        border-color: var(--neon-cyan);
        box-shadow: 0 0 8px var(--glow-cyan-mid);
    }

    /* Footer */
    .footer h2 {
        font-size: 1.8rem;
    }

    .social-links {
        gap: 12px;
    }

    .cyber-button {
        padding: 0.65rem 1.4rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 12px 12px;
    }

    .logo {
        font-size: 0.95rem;
    }

    #lang-toggle,
    #retro-toggle {
        font-size: 0.6rem;
        padding: 0.3rem 0.45rem;
    }

    .nav-right {
        gap: 0.4rem;
    }

    .hamburger {
        padding: 6px 6px;
    }

    .section-title {
        font-size: clamp(1.2rem, 5vw, 1.8rem);
        margin-bottom: 1.5rem;
    }

    .footer h2 {
        font-size: clamp(1.2rem, 5vw, 1.8rem);
    }

    .glitch::before {
        text-shadow: -1px 0 var(--neon-magenta);
        left: 1px;
    }

    .glitch::after {
        text-shadow: -1px 0 var(--neon-cyan);
        left: -1px;
    }

    .terminal-body {
        font-size: 0.8rem;
        overflow-x: hidden;
        word-wrap: break-word;
    }

    .terminal-body .output {
        margin-left: 5px;
    }

    .card-content h3 {
        font-size: 1.2rem;
    }

    .social-links {
        width: 100%;
    }
}

/* Very narrow screens: collapse the logo to just "DIEGO" so the
   nav buttons and hamburger always fit */
@media (max-width: 360px) {
    .logo {
        font-size: 0;
        margin-right: 0.25rem;
    }

    .logo span {
        font-size: 0.9rem;
    }
}

/* ============================================================
   ACCESSIBILITY – reduce motion for sensitive users
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

    .grid-bg {
        animation: none;
    }

    #bg-canvas {
        display: none;
    }

    .glitch::before,
    .glitch::after {
        display: none;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }

    .scroll-tilt-card {
        transform: none;
    }
}