*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --red: #C0392B;
    --red-light: #E74C3C;
    --bg: #111111;
    --bg-2: #1A1A1A;
    --bg-card: #222222;
    --bg-card-2: #2A2A2A;
    --text: #F0EDE8;
    --text-muted: #888888;
    --border: #2E2E2E;
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
}

/* SCROLLBAR */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--red);
    border-radius: 2px;
}

/* NAVBAR */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 5vw;
    background: rgba(17, 17, 17, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s;
}

nav.scrolled {
    border-color: var(--border);
}

.nav-logo {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.nav-logo span {
    color: var(--red-light);
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
}

.nav-links a {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text);
}

.nav-cta {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    background: var(--red);
    border: none;
    padding: 0.55rem 1.4rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
    letter-spacing: 0.03em;
}

.nav-cta:hover {
    background: var(--red-light);
}

/* HERO */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 0 5vw;
    position: relative;
    overflow: hidden;
}

.hero-bg-lines {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(192, 57, 43, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(192, 57, 43, 0.04) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

.hero-bg-glow {
    position: absolute;
    top: -10%;
    right: -5%;
    width: 50vw;
    height: 80vh;
    background: radial-gradient(ellipse at center, rgba(192, 57, 43, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
}

.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--red-light);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.hero-eyebrow::before {
    content: '';
    width: 32px;
    height: 1px;
    background: var(--red-light);
}

.hero-name {
    font-family: var(--font-display);
    font-size: clamp(3.5rem, 8vw, 7rem);
    font-weight: 700;
    line-height: 1.0;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: 0.3rem;
}

.hero-name .underline-red {
    position: relative;
    display: inline-block;
}

.hero-name .underline-red::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    height: 4px;
    background: var(--red);
    width: 0;
    animation: drawLine 0.9s 0.6s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

@keyframes drawLine {
    to {
        width: 100%;
    }
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    font-weight: 300;
    color: var(--text-muted);
    margin-top: 1.2rem;
    margin-bottom: 2rem;
    letter-spacing: -0.01em;
}

.hero-title strong {
    color: var(--text);
    font-weight: 500;
}

.hero-desc {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 520px;
    line-height: 1.75;
    margin-bottom: 3rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-tech-icons {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    /* detrás de todo el contenido del hero */
    overflow: hidden;
}

/* DESPUÉS — por esto: */
.tech-icon {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 140px;
    /* ← cambia este valor para ajustar el tamaño global */
    height: 140px;
    opacity: 0.13;
    transform: rotate(var(--r));
    animation: techFloat calc(var(--d, 1s) * 6 + 8s) ease-in-out infinite alternate;
    filter: grayscale(100%) blur(0.4px);
}

@keyframes techFloat {
    0% {
        transform: rotate(var(--r)) translateY(0px);
    }

    100% {
        transform: rotate(var(--r)) translateY(-10px);
    }
}

.btn-primary {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    background: var(--red);
    border: 1px solid var(--red);
    padding: 0.85rem 2rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
    letter-spacing: 0.03em;
    display: inline-block;
}

.btn-primary:hover {
    background: var(--red-light);
    transform: translateY(-1px);
}

.btn-ghost {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.85rem 2rem;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s, transform 0.15s;
    letter-spacing: 0.03em;
    display: inline-block;
}

.btn-ghost:hover {
    border-color: var(--text-muted);
    color: var(--text);
    transform: translateY(-1px);
}

.hero-scroll-hint {
    position: absolute;
    bottom: 2.5rem;
    left: 5vw;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.scroll-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--red);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.7);
    }
}

.hero-terminal {
    position: absolute;
    right: -1%;
    top: 50%;
    transform: translateY(-50%);
    width: 720px;
    height: 540px;
    z-index: 1;
    background: rgba(17, 17, 17, 0.92);
    border: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    box-shadow: 0 0 0 1px rgba(192, 57, 43, 0.1), 0 32px 80px rgba(0, 0, 0, 0.6);
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.terminal-dots {
    display: flex;
    gap: 0.35rem;
}

.t-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.t-dot--red {
    background: #C0392B;
}

.t-dot--yellow {
    background: #B7950B;
}

.t-dot--green {
    background: #1E8449;
}

.terminal-title {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    flex: 1;
    text-align: center;
}

.terminal-body {
    padding: 1rem 1.2rem 1.2rem;
    height: 500px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.tl-line {
    white-space: pre;
}

.tl-blank {
    height: 0.6em;
    flex-shrink: 0;
}

.tl-cmd {
    color: var(--text);
    font-weight: 500;
}

.tl-ok {
    color: #3D9970;
}

.tl-muted {
    color: #555555;
}

.tl-log {
    color: #666666;
}

.tl-start {
    color: #5D8AA8;
}

.tl-healthy {
    color: #3D9970;
    font-weight: 500;
}

.tl-done {
    color: var(--text);
    font-weight: 500;
}

.tl-cursor {
    color: var(--red-light);
    animation: blink 1.1s step-start infinite;
}

.tl-cmd-2 {
    color: var(--text);
    font-weight: 500;
    margin-top: 0.4em;
}

.tl-header {
    color: #4A4A4A;
    letter-spacing: 0.03em;
}

.terminal-body::-webkit-scrollbar {
    display: none;
}

.terminal-body {
    scrollbar-width: none;
}

.tl-row {
    color: #7A9EAF;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

@media (max-width: 1024px) {
    .hero-terminal {
        display: none;
    }
}

/* ABOUT / PHILOSOPHY */
#about {
    padding: 7rem 5vw;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
}

.section-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--red-light);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.15;
    color: var(--text);
    margin-bottom: 2.5rem;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    align-items: start;
}

.photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: start;
}

.about-photo {
    position: relative;
}

.about-photo-img {
    align-items: center;
    justify-content: center;
    width: 70%;
    aspect-ratio: 3/4;
    object-fit: cover;
    filter: grayscale(100%) brightness(1);
    display: block;
    transition: filter 0.4s;
}

.about-photo-frame {
    position: absolute;
    bottom: -12px;
    right: 116px;
    width: 70%;
    height: 90%;
    border: 1px solid var(--red);
    pointer-events: none;
    z-index: -1;
}

.about-text p {
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 1.5rem;
    font-size: 1.02rem;
}

.about-text p strong {
    color: var(--text);
    font-weight: 500;
}

.about-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 2.5rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--border);
}

.stat-num {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--red-light);
    letter-spacing: -0.03em;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.2rem;
}

/* STACK */
#stack {
    padding: 7rem 5vw;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.stack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1px;
    background: var(--border);
    margin-top: 3rem;
    border: 1px solid var(--border);
}

.stack-category {
    background: var(--bg-card);
    padding: 2rem;
    transition: background 0.2s;
}

.stack-category:hover {
    background: var(--bg-card-2);
}

.stack-cat-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--red-light);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border);
}

.stack-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.stack-tag {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text);
    background: var(--bg-2);
    border: 1px solid var(--border);
    padding: 0.35rem 0.75rem;
    letter-spacing: 0.02em;
    transition: border-color 0.2s, color 0.2s;
}

.stack-tag:hover {
    border-color: var(--red);
    color: var(--red-light);
}

/* EXPERIENCE */
#experience {
    padding: 7rem 5vw;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
}

.timeline {
    margin-top: 3.5rem;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border);
}

.timeline-item {
    padding-left: 2.5rem;
    padding-bottom: 3.5rem;
    position: relative;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -5px;
    top: 6px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--red);
    border: 2px solid var(--bg-2);
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.2);
}

.timeline-date {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--red-light);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.timeline-role {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.2rem;
    letter-spacing: -0.01em;
}

.timeline-company {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.timeline-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 560px;
}

.timeline-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 1rem;
}

.timeline-tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.2rem 0.6rem;
    letter-spacing: 0.05em;
}

/* PROJECTS */
#projects {
    padding: 7rem 5vw;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1px;
    background: var(--border);
    margin-top: 3rem;
    border: 1px solid var(--border);
}

.project-card {
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    transition: background 0.2s;
    cursor: pointer;
}

.project-card:hover {
    background: var(--bg-card-2);
}

.project-card:hover .project-img {
    filter: grayscale(100%) brightness(0.9);
}

.project-img-wrap {
    position: relative;
    overflow: hidden;
}

.project-img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    filter: grayscale(100%) brightness(0.7);
    transition: filter 0.4s;
    display: block;
}

/* Placeholder image */
.project-img-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #1e1e1e 0%, #2c2c2c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    filter: grayscale(100%);
}

.project-img-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(34, 34, 34, 0.9) 0%, transparent 60%);
}

.project-img-tag {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text);
    background: var(--red);
    padding: 0.25rem 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.project-body {
    padding: 1.6rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.6rem;
    letter-spacing: -0.01em;
}

.project-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.65;
    flex: 1;
}

.project-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.4rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--border);
}

.project-stack {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.project-stack-tag {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.15rem 0.5rem;
}

.project-link {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--red-light);
    text-decoration: none;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: color 0.2s;
}

.project-link:hover {
    color: var(--text);
}

/* CONTACT */
#contact {
    padding: 7rem 5vw;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5rem;
    margin-top: 3rem;
    align-items: start;
}

.contact-info p {
    color: var(--text-muted);
    line-height: 1.75;
    margin-bottom: 2rem;
    font-size: 1.02rem;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}

.contact-link:hover {
    color: var(--text);
}

.contact-link span {
    color: var(--red-light);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.form-input,
.form-textarea {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 0.85rem 1rem;
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    width: 100%;
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--red);
}

.form-textarea {
    height: 140px;
}

/* FOOTER */
footer {
    padding: 2rem 5vw;
    background: var(--bg);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-logo {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-logo span {
    color: var(--red-light);
}

.footer-copy {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* REVEAL ANIMATIONS */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .photo-placeholder {
        display: flex;
        justify-content: center;
    }

    .about-photo-img {
        width: 90%;
        object-fit: cover;
    }

    .nav-links {
        display: none;
    }

    .about-grid,
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .stack-grid {
        grid-template-columns: 1fr;
    }

    .hero-name {
        font-size: clamp(2.8rem, 12vw, 4rem);
    }

    .hero-tech-icons {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .hero-name .underline-red::after {
        animation: none;
        width: 100%;
    }

    .scroll-dot {
        animation: none;
    }
}