:root {
    --background: #0d0d0d;
    --surface: #161616;
    --surface-light: #222222;
    --text: #e0e0e0;
    --muted: #777777;
    --accent: #c2185b;
    --accent-dark: #8b0050;
    --accent-alt: #e91e90;
    --muted-alt: #999999;
    --border: rgba(194, 24, 91, 0.15);
    --border-strong: rgba(194, 24, 91, 0.4);
    --max-width: 1100px;
    --cyan: #00e5ff;
    --green: #00e676;
    --purple: #b388ff;
    --yellow: #ffd740;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--background);
    color: var(--text);
    font-family:
        "JetBrains Mono",
        "Fira Code",
        "Cascadia Code",
        Consolas,
        monospace;
    line-height: 1.7;
}

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

.container {
    width: min(90%, var(--max-width));
    margin: 0 auto;
}

/* ── Skip to content ── */
.skip-link {
    position: fixed;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    padding: 0.6rem 1.2rem;
    background: var(--accent);
    color: #fff;
    border-radius: 0 0 4px 4px;
    font-family: monospace;
    font-size: 0.85rem;
    font-weight: 700;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
}

/* ── Scroll progress bar ── */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-alt), var(--cyan));
    z-index: 200;
    transition: width 0.05s linear;
}

/* ── Header ── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(13, 13, 13, 0.95);
    border-bottom: 1px solid var(--border-strong);
    backdrop-filter: blur(12px);
}

.navbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.logo {
    color: var(--accent);
    font-family: monospace;
    font-size: 1.15rem;
    font-weight: 700;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lang-button {
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: transparent;
    color: var(--muted-alt);
    font-family: monospace;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease;
}

.lang-button:hover {
    color: var(--accent-alt);
    border-color: var(--accent-alt);
    background: rgba(233, 30, 144, 0.05);
}

.menu-button {
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 1.6rem;
}

.nav-links {
    position: absolute;
    top: 72px;
    left: 0;
    width: 100%;
    display: none;
    flex-direction: column;
    gap: 0;
    list-style: none;
    padding: 1rem 5%;
    background: var(--surface);
    border-bottom: 1px solid var(--border-strong);
}

.nav-links li {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}

.nav-links li:last-child {
    border-bottom: 0;
}

.nav-links a {
    display: block;
    color: var(--muted-alt);
    font-family: monospace;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.nav-links a::before {
    content: "> ";
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

.nav-links a:hover::before {
    opacity: 1;
}

.nav-links a.active {
    color: var(--accent-alt);
}

.nav-links a.active::before {
    opacity: 1;
}

.nav-links.open {
    display: flex;
}

/* Desktop nav */
@media (min-width: 801px) {
    .nav-links {
        position: static;
        display: flex;
        flex-direction: row;
        width: auto;
        background: transparent;
        border: none;
        padding: 0;
        gap: 0;
    }

    .nav-links li {
        padding: 0;
        border: none;
    }

    .nav-links a {
        padding: 0.3rem 0.5rem;
        position: relative;
    }

    .nav-links a.active {
        color: var(--accent-alt);
    }

    .nav-links a.active::after {
        content: "";
        position: absolute;
        bottom: -4px;
        left: 0.5rem;
        right: 0.5rem;
        height: 2px;
        background: var(--accent-alt);
        border-radius: 1px;
    }

    .menu-button {
        display: none;
    }
}

/* ── Hero ── */
.hero {
    position: relative;
    min-height: calc(100vh - 72px);
    display: grid;
    align-items: center;
    overflow: hidden;
}

.hero canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.5;
}

.hero-content {
    position: relative;
    z-index: 1;
    padding: 5rem 0;
}

.eyebrow {
    margin-bottom: 1rem;
    color: var(--accent-alt);
    font-family: monospace;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.12rem;
}

.eyebrow::before {
    content: "$ ";
}

h1 {
    max-width: 800px;
    font-size: clamp(2.4rem, 7vw, 4.5rem);
    line-height: 1.1;
}

h1 .hero-name {
    color: var(--accent);
    position: relative;
    display: inline-block;
}

/* Glitch effect */
.hero-name:hover {
    animation: glitch 0.4s ease;
}

@keyframes glitch {
    0% { transform: translate(0); }
    10% { transform: translate(-2px, 2px); filter: hue-rotate(90deg); }
    20% { transform: translate(2px, -1px); }
    30% { transform: translate(-1px, -2px); filter: hue-rotate(0deg); }
    40% { transform: translate(1px, 1px); }
    50% { transform: translate(-2px, -1px); filter: hue-rotate(180deg); }
    60% { transform: translate(2px, 2px); }
    70% { transform: translate(0, -2px); filter: hue-rotate(0deg); }
    80% { transform: translate(-1px, 1px); }
    90% { transform: translate(1px, -1px); filter: hue-rotate(90deg); }
    100% { transform: translate(0); filter: hue-rotate(0deg); }
}

.hero-name::before,
.hero-name::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.hero-name:hover::before {
    opacity: 0.8;
    color: var(--cyan);
    animation: glitch-clip-1 0.4s ease;
    clip-path: inset(20% 0 40% 0);
    transform: translate(-3px, -1px);
}

.hero-name:hover::after {
    opacity: 0.8;
    color: var(--accent-alt);
    animation: glitch-clip-2 0.4s ease;
    clip-path: inset(60% 0 10% 0);
    transform: translate(3px, 1px);
}

@keyframes glitch-clip-1 {
    0% { clip-path: inset(20% 0 60% 0); transform: translate(-3px); }
    25% { clip-path: inset(40% 0 30% 0); transform: translate(2px); }
    50% { clip-path: inset(10% 0 70% 0); transform: translate(-1px); }
    75% { clip-path: inset(50% 0 20% 0); transform: translate(3px); }
    100% { clip-path: inset(20% 0 40% 0); transform: translate(0); }
}

@keyframes glitch-clip-2 {
    0% { clip-path: inset(60% 0 10% 0); transform: translate(3px); }
    25% { clip-path: inset(30% 0 40% 0); transform: translate(-2px); }
    50% { clip-path: inset(70% 0 5% 0); transform: translate(1px); }
    75% { clip-path: inset(15% 0 50% 0); transform: translate(-3px); }
    100% { clip-path: inset(60% 0 10% 0); transform: translate(0); }
}

/* Typewriter cursor */
.typewriter-cursor::after {
    content: "_";
    color: var(--accent-alt);
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.hero-description {
    max-width: 680px;
    margin-top: 1.5rem;
    color: var(--muted);
    font-size: 1rem;
}

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

.button {
    display: inline-block;
    padding: 0.7rem 1.2rem;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
    font-weight: 700;
    transition:
        background 0.2s ease,
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.button:hover {
    transform: translateY(-2px);
}

.primary-button {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.primary-button:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    box-shadow: 0 0 20px rgba(194, 24, 91, 0.3);
}

.secondary-button {
    color: var(--accent-alt);
    border-color: var(--accent-alt);
}

.secondary-button:hover {
    background: rgba(233, 30, 144, 0.08);
    box-shadow: 0 0 15px rgba(233, 30, 144, 0.15);
}

/* ── Sections ── */
.section {
    padding: 6rem 0;
}

.alternate-section {
    background: #0a0a0a;
}

.section h2 {
    margin-bottom: 1rem;
    font-size: clamp(1.6rem, 4vw, 2.5rem);
}

.section h2::before {
    content: "# ";
    color: var(--accent);
    font-family: monospace;
}

/* Section icons */
.section-icon {
    display: inline-block;
    width: 1.4em;
    height: 1.4em;
    vertical-align: middle;
    margin-right: 0.4rem;
    fill: var(--accent);
    transform: translateY(-2px);
}

.section-intro {
    max-width: 750px;
    margin-bottom: 2.5rem;
    color: var(--muted-alt);
}

/* ── Scroll reveal ── */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition:
        opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.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; }
.reveal-delay-6 { transition-delay: 0.6s; }

/* ── Grids ── */
.about-grid,
.projects-grid,
.ctf-grid,
.skills-grid {
    display: grid;
    gap: 1.5rem;
}

.about-grid {
    grid-template-columns: repeat(2, 1fr);
}

.projects-grid,
.ctf-grid {
    grid-template-columns: repeat(3, 1fr);
}

/* ── Cards ── */
.card,
.skill-card,
.project-card {
    padding: 1.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    transition:
        transform 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease;
}

.card:hover,
.skill-card:hover,
.project-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 0 25px rgba(194, 24, 91, 0.12);
}

.card h3,
.skill-card h3,
.project-card h3 {
    margin-bottom: 0.7rem;
    font-size: 1rem;
}

.card p,
.skill-card p,
.project-card p {
    color: var(--muted);
    font-size: 0.9rem;
}

/* Card icon */
.card-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 0.8rem;
    fill: var(--accent);
    opacity: 0.8;
}

/* Card category colors */
.project-card[data-category="cve"] { border-left: 3px solid #ff5252; }
.project-card[data-category="cve"]:hover { border-color: #ff5252; box-shadow: 0 0 20px rgba(255, 82, 82, 0.12); }

.project-card[data-category="project"] { border-left: 3px solid var(--cyan); }
.project-card[data-category="project"]:hover { border-color: var(--cyan); box-shadow: 0 0 20px rgba(0, 229, 255, 0.12); }

.project-card[data-category="talk"] { border-left: 3px solid var(--yellow); }
.project-card[data-category="talk"]:hover { border-color: var(--yellow); box-shadow: 0 0 20px rgba(255, 215, 64, 0.12); }

.project-card[data-category="event"] { border-left: 3px solid var(--green); }
.project-card[data-category="event"]:hover { border-color: var(--green); box-shadow: 0 0 20px rgba(0, 230, 118, 0.12); }

.project-card[data-category="education"] { border-left: 3px solid var(--purple); }
.project-card[data-category="education"]:hover { border-color: var(--purple); box-shadow: 0 0 20px rgba(179, 136, 255, 0.12); }

.project-type {
    display: inline-block;
    margin-bottom: 1rem;
    margin-right: 0.4rem;
    padding: 0.2rem 0.6rem;
    background: rgba(194, 24, 91, 0.1);
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    color: var(--accent);
    font-family: monospace;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}

/* Category-specific badge colors */
.project-card[data-category="cve"] .project-type {
    background: rgba(255, 82, 82, 0.1);
    border-color: rgba(255, 82, 82, 0.3);
    color: #ff5252;
}
.project-card[data-category="project"] .project-type {
    background: rgba(0, 229, 255, 0.1);
    border-color: rgba(0, 229, 255, 0.3);
    color: var(--cyan);
}
.project-card[data-category="talk"] .project-type {
    background: rgba(255, 215, 64, 0.1);
    border-color: rgba(255, 215, 64, 0.3);
    color: var(--yellow);
}
.project-card[data-category="event"] .project-type {
    background: rgba(0, 230, 118, 0.1);
    border-color: rgba(0, 230, 118, 0.3);
    color: var(--green);
}
.project-card[data-category="education"] .project-type {
    background: rgba(179, 136, 255, 0.1);
    border-color: rgba(179, 136, 255, 0.3);
    color: var(--purple);
}

.project-card a {
    display: inline-block;
    margin-top: 1.2rem;
    color: var(--accent-alt);
    font-family: monospace;
    font-weight: 700;
    font-size: 0.85rem;
}

.project-card a::before {
    content: "$ ";
    color: var(--accent);
}

/* ── Skills grid ── */
.skills-grid {
    grid-template-columns: repeat(3, 1fr);
}

.skill-card {
    position: relative;
    overflow: hidden;
}

.skill-card .skill-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 0.6rem;
    fill: var(--accent);
    opacity: 0.7;
}

.skill-tools {
    margin-top: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.skill-tag {
    padding: 0.15rem 0.5rem;
    background: rgba(194, 24, 91, 0.08);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 0.72rem;
    color: var(--muted-alt);
}

.skill-bar-wrapper {
    margin-top: 1rem;
}

.skill-bar-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
    font-size: 0.75rem;
    color: var(--muted-alt);
}

.skill-bar {
    height: 4px;
    background: var(--surface-light);
    border-radius: 2px;
    overflow: hidden;
}

.skill-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-alt));
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.skill-bar-fill.visible {
    width: var(--fill-width);
}

/* ── Achievement card ── */
.achievement-card {
    display: flex;
    gap: 2rem;
    align-items: center;
    margin-top: 2.5rem;
    padding: 1.6rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.achievement-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 0 25px rgba(194, 24, 91, 0.12);
}

.achievement-image {
    flex: 0 0 280px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.achievement-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.achievement-info {
    flex: 1;
}

.achievement-info h3 {
    margin-bottom: 0.7rem;
}

.achievement-info p {
    color: var(--muted);
}

#proyectos .projects-grid {
    grid-template-columns: 1fr;
}

#proyectos .achievement-card {
    border-left: 3px solid var(--cyan);
    margin-top: 0;
}

#proyectos .achievement-card:hover {
    border-color: var(--cyan);
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.12);
}

/* ── Contact section ── */
.contact-section {
    text-align: center;
}

.contact-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 2rem;
}

.contact-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-alt);
    font-family: monospace;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease;
}

.contact-links a svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.contact-links a::before {
    content: "";
}

.contact-links a:hover {
    border-color: var(--accent-alt);
    background: rgba(233, 30, 144, 0.05);
    box-shadow: 0 0 12px rgba(233, 30, 144, 0.1);
}

/* ── Timeline ── */
.timeline {
    position: relative;
    padding-left: 2.5rem;
    margin-top: 1rem;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-strong);
}

.timeline-item {
    position: relative;
    padding-bottom: 2.5rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -2.5rem;
    top: 0.35rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--background);
    z-index: 1;
    box-shadow: 0 0 8px rgba(194, 24, 91, 0.4);
}

.timeline-content {
    padding: 1.4rem 1.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.timeline-content:hover {
    transform: translateX(6px);
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(194, 24, 91, 0.08);
}

.timeline-date {
    display: inline-block;
    margin-bottom: 0.5rem;
    color: var(--accent-alt);
    font-family: monospace;
    font-size: 0.8rem;
    font-weight: 700;
}

.badge-current {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.5rem;
    background: var(--accent);
    border-radius: 3px;
    font-size: 0.7rem;
    color: #fff;
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(194, 24, 91, 0.4); }
    50% { opacity: 0.85; box-shadow: 0 0 0 6px rgba(194, 24, 91, 0); }
}

.timeline-content h3 {
    margin-bottom: 0.3rem;
    font-size: 1.05rem;
    color: var(--text);
}

.timeline-company {
    color: var(--accent);
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
}

.timeline-location {
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 0.6rem;
}

.timeline-content p:last-child {
    color: var(--muted);
    font-size: 0.9rem;
}

/* ── Footer ── */
footer {
    padding: 2.5rem 0;
    border-top: 1px solid var(--border-strong);
    color: var(--muted);
    font-family: monospace;
    font-size: 0.85rem;
    text-align: center;
}

footer::before {
    content: "/* ";
    color: var(--accent);
}

footer::after {
    content: " */";
    color: var(--accent);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer-socials {
    display: flex;
    gap: 1rem;
}

.footer-socials a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.footer-socials a svg {
    width: 16px;
    height: 16px;
    fill: var(--muted-alt);
    transition: fill 0.2s ease;
}

.footer-socials a:hover {
    border-color: var(--accent);
    background: rgba(194, 24, 91, 0.08);
}

.footer-socials a:hover svg {
    fill: var(--accent);
}

.back-to-top {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted-alt);
    font-family: monospace;
    font-size: 0.8rem;
    cursor: pointer;
    transition: color 0.2s ease;
    background: none;
    border: none;
}

.back-to-top:hover {
    color: var(--accent-alt);
}

.back-to-top svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    transition: transform 0.2s ease;
}

.back-to-top:hover svg {
    transform: translateY(-3px);
}

.footer-stack {
    font-size: 0.75rem;
    color: var(--muted);
}

/* ── Responsive ── */
@media (max-width: 800px) {
    .about-grid,
    .projects-grid,
    .ctf-grid,
    .skills-grid {
        grid-template-columns: 1fr;
    }

    .achievement-card {
        flex-direction: column;
    }

    .achievement-image {
        flex: none;
        width: 100%;
    }

    .achievement-image img {
        height: 180px;
    }

    .timeline {
        padding-left: 2rem;
    }

    .timeline-dot {
        left: -2rem;
        width: 12px;
        height: 12px;
    }

    .section {
        padding: 4rem 0;
    }

    .hero-content {
        padding: 3rem 0;
    }
}

@media (min-width: 801px) and (max-width: 1024px) {
    .projects-grid,
    .ctf-grid,
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
