/* =========================
   VARIABLES
========================= */

:root {
    --background: #090b12;
    --background-light: #10131d;
    --card: #111521;
    --border: #252b3a;

    --text: #f4f5f7;
    --text-muted: #9da3b3;

    --accent: #9b6cff;
    --accent-light: #b999ff;

    --max-width: 1100px;
}


/* =========================
   RESET
========================= */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
}

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

img {
    max-width: 100%;
    display: block;
}


/* =========================
   GENERAL
========================= */

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

.section {
    padding: 110px 0;
    scroll-margin-top: 85px;
}

.section-label {
    color: var(--accent-light);
    font-size: 0.8rem;
    letter-spacing: 2px;
    margin-bottom: 20px;
}

.section-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.1;
    margin-bottom: 50px;
}


/* =========================
   NAVBAR
========================= */

.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;

    background: rgba(9, 11, 18, 0.85);
    backdrop-filter: blur(12px);

    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.nav-container {
    height: 70px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.2rem;
    font-weight: bold;
}

.logo span {
    color: var(--accent);
}

nav {
    display: flex;
    gap: 30px;
}

nav a {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: 0.3s;
}

nav a:hover {
    color: var(--text);
}

.language-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 20px;
}

.lang-button {
    appearance: none;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: bold;
    letter-spacing: 0.08em;
    padding: 6px 10px;
    transition: 0.3s ease;
}

.lang-button:hover,
.lang-button.is-active {
    border-color: var(--accent);
    color: var(--text);
    background: rgba(155, 108, 255, 0.12);
}


/* =========================
   HERO
========================= */

.hero {
    min-height: 100vh;

    display: flex;
    align-items: center;

    background:
        radial-gradient(
            circle at 80% 30%,
            rgba(155,108,255,0.15),
            transparent 35%
        );
}

.hero-content {
    padding-top: 70px;
}

.hero-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.75fr);
    align-items: center;
    gap: clamp(40px, 7vw, 90px);
}

.eyebrow {
    color: var(--accent-light);
    letter-spacing: 3px;
    font-size: 0.8rem;
    margin-bottom: 15px;
}

.hero h1 {
    font-size: clamp(3rem, 8vw, 6rem);
    line-height: 1;
    letter-spacing: -3px;
    margin-bottom: 25px;
}

.hero h1 span {
    color: var(--accent);
}

.hero h2 {
    font-size: 1.3rem;
    font-weight: normal;
    margin-bottom: 20px;
}

.hero-description {
    max-width: 650px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.portrait {
    width: min(100%, 330px);
    justify-self: end;
    perspective: 1000px;
}

.portrait-frame {
    position: relative;
    aspect-ratio: 1 / 1.08;
    overflow: hidden;
    isolation: isolate;
    border: 1px solid rgba(185, 153, 255, 0.45);
    border-radius: 50%;
    background:
        linear-gradient(145deg, rgba(155, 108, 255, 0.18), transparent 55%),
        var(--card);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
    transform: rotateX(var(--portrait-rotate-x, 0deg)) rotateY(var(--portrait-rotate-y, 0deg));
    transition: transform 220ms ease-out, border-color 220ms ease-out;
    transform-style: preserve-3d;
}

.portrait-frame::before,
.portrait-frame::after {
    position: absolute;
    z-index: -1;
    content: "";
    pointer-events: none;
}

.portrait-frame::before {
    inset: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.portrait-frame::after {
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.portrait-glow {
    position: absolute;
    width: 75%;
    aspect-ratio: 1;
    top: 10%;
    left: 12%;
    border-radius: 50%;
    background: var(--accent);
    filter: blur(85px);
    opacity: 0.28;
}

.portrait-image {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 53% 42%;
    transform: scale(1.18);
}

.portrait figcaption {
    color: var(--text-muted);
    font-family: "Courier New", monospace;
}

.portrait figcaption {
    margin-top: 12px;
    text-align: center;
    font-size: 0.75rem;
}


/* =========================
   BUTTONS
========================= */

.hero-buttons,
.project-buttons {
    display: flex;
    gap: 15px;
    margin-top: 35px;
}

.button {
    display: inline-flex;

    padding: 12px 22px;

    border-radius: 8px;

    font-size: 0.9rem;
    font-weight: bold;

    transition: 0.3s;
}

.button.primary {
    background: var(--accent);
    color: white;
}

.button.primary:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
}

.button.secondary {
    border: 1px solid var(--border);
    color: var(--text);
}

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


/* =========================
   PROJECT
========================= */

.projects-section {
    background: var(--background-light);
}

.project-card {
    display: grid;
    grid-template-columns: 1fr 1fr;

    background: var(--card);

    border: 1px solid var(--border);

    border-radius: 16px;

    overflow: hidden;
}

.project-image {
    background: #080a10;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 30px;
}

.project-info {
    padding: 50px;
}

.project-type {
    color: var(--accent-light);
    font-size: 0.75rem;
    letter-spacing: 2px;
    margin-bottom: 15px;
}

.project-info h3 {
    font-size: 2rem;
    margin-bottom: 20px;
}

.project-info p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.project-card:first-child {
    grid-column: 1 / -1;
}

.project-card-small {
    grid-template-columns: 1fr;
}

.project-placeholder {
    min-height: 180px;
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 45%, rgba(155, 108, 255, 0.24), transparent 40%),
        #080a10;
}

.placeholder-number {
    position: absolute;
    top: 14px;
    left: 18px;
    color: var(--text-muted);
    font-family: "Courier New", monospace;
    font-size: 0.8rem;
}

.placeholder-icon {
    color: var(--accent-light);
    font-family: "Courier New", monospace;
    font-size: 3rem;
}

.featured-placeholder-label {
    color: var(--text-muted);
    font-family: "Courier New", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
}

.project-status {
    display: inline-flex;
    margin-top: 22px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--accent-light);
    font-size: 0.75rem;
}

.project-buttons {
    flex-wrap: wrap;
}

.technologies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 25px;
}

.technologies span {
    background: #1a1f2c;
    border: 1px solid var(--border);

    padding: 6px 10px;

    border-radius: 6px;

    font-size: 0.75rem;
}

/* =========================
   TRAYECTORIA
========================= */

.journey-section {
    background:
        radial-gradient(circle at 90% 15%, rgba(155, 108, 255, 0.08), transparent 30%);
}

.journey-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.journey-column {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 20px;
}

.journey-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
}

.journey-heading-icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid rgba(155, 108, 255, 0.35);
    border-radius: 10px;
    color: var(--accent-light);
    background: rgba(155, 108, 255, 0.1);
    font-family: "Courier New", monospace;
    font-size: 0.8rem;
}

.journey-card {
    height: auto;
    padding: clamp(22px, 3vw, 34px);
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(17, 21, 33, 0.96), rgba(13, 16, 25, 0.96));
    transition: border-color 220ms ease, transform 220ms ease;
}

.journey-card:hover {
    transform: translateY(-4px);
    border-color: rgba(155, 108, 255, 0.6);
}

.journey-meta {
    margin-bottom: 12px;
    color: var(--accent-light);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
}

.journey-card h4 {
    margin-bottom: 14px;
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    line-height: 1.3;
}

.journey-card > p:not(.journey-meta) {
    color: var(--text-muted);
}

.journey-card .technologies {
    margin-top: 20px;
}

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

.js-enabled .reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 650ms ease, transform 650ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.js-enabled .reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.portrait.reveal {
    transform: perspective(1000px) translateY(0);
}

.js-enabled .portrait.reveal {
    transform: perspective(1000px) translateY(22px);
}

.js-enabled .portrait.reveal.is-visible {
    transform: perspective(1000px) translateY(0);
}

.journey-column:nth-child(2) {
    transition-delay: 120ms;
}


/* =========================
   CV
========================= */

.cv-section {
    border-bottom: 1px solid var(--border);
}

.cv-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cv-content .section-title {
    margin-bottom: 15px;
}

.cv-content p:not(.section-label) {
    color: var(--text-muted);
}


/* =========================
   CONTACT
========================= */

.contact-section {
    min-height: 50vh;
}

.contact-links {
    display: flex;
    gap: 30px;
    margin-top: 30px;
}

.contact-links a {
    color: var(--accent-light);
}

.contact-links a:hover {
    text-decoration: underline;
}


/* =========================
   FOOTER
========================= */

footer {
    border-top: 1px solid var(--border);
    padding: 30px 0;
}

footer .container {
    display: flex;
    justify-content: space-between;

    color: var(--text-muted);

    font-size: 0.8rem;
}


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

@media (max-width: 800px) {

    nav {
        max-width: calc(100vw - 130px);
        gap: 18px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    nav::-webkit-scrollbar {
        display: none;
    }

    nav a {
        flex: 0 0 auto;
        font-size: 0.8rem;
    }

    .section {
        padding: 80px 0;
    }

    .hero {
        min-height: auto;
        padding: 115px 0 65px;
    }

    .hero-layout {
        grid-template-columns: minmax(0, 1fr) minmax(220px, 0.72fr);
        gap: 35px;
    }

    .hero-content {
        padding-top: 0;
    }

    .hero h1 {
        font-size: clamp(2.8rem, 8vw, 4.5rem);
    }

    .portrait {
        width: 100%;
    }

    .journey-grid {
        grid-template-columns: 1fr;
        gap: 34px;
    }

    .journey-card {
        height: auto;
    }

    .project-card {
        grid-template-columns: 1fr;
    }

    .project-card:first-child {
        grid-column: auto;
    }

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

    .project-info {
        padding: 30px;
    }

    .cv-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 30px;
    }

    footer .container {
        flex-direction: column;
        gap: 10px;
    }

}

@media (max-width: 560px) {
    .hero-layout {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        letter-spacing: -2px;
    }

    .hero h2 {
        font-size: 1.1rem;
    }

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

    .portrait {
        width: min(82%, 330px);
        justify-self: center;
    }

    .hero-buttons {
        flex-wrap: wrap;
    }
}

/* =========================
   TERMINAL
========================= */

.terminal-section {
    padding: 60px 0 100px;
}

.terminal {
    background: #080a0f;

    border: 1px solid var(--border);

    border-radius: 12px;

    overflow: hidden;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.35);
}


/* Cabecera */

.terminal-header {
    height: 45px;

    background: #121620;

    border-bottom: 1px solid var(--border);

    display: flex;
    align-items: center;

    position: relative;
}

.terminal-buttons {
    display: flex;
    gap: 7px;

    padding-left: 15px;
}

.terminal-buttons span {
    width: 11px;
    height: 11px;

    border-radius: 50%;

    background: #555;
}

.terminal-title {
    position: absolute;

    left: 50%;

    transform: translateX(-50%);

    color: var(--text-muted);

    font-family: monospace;

    font-size: 0.8rem;
}


/* Cuerpo */

.terminal-body {
    padding: 25px;

    min-height: 300px;

    font-family: "Courier New", monospace;

    font-size: 0.9rem;

    color: #d9dce5;

    overflow-x: auto;
}

.terminal-welcome {
    color: var(--text-muted);

    margin-bottom: 20px;
}

.terminal-welcome strong {
    color: var(--accent-light);
}


/* Resultados */

#terminal-output {
    white-space: pre-wrap;

    line-height: 1.7;
}

#terminal-output div {
    margin-bottom: 8px;
}


/* Línea de comandos */

.terminal-line {
    display: flex;

    align-items: center;

    margin-top: 10px;
}

.terminal-prompt {
    color: var(--accent-light);

    margin-right: 10px;

    white-space: nowrap;
}

#terminal-input {
    flex: 1;

    background: transparent;

    border: none;

    outline: none;

    color: #f4f5f7;

    font-family: "Courier New", monospace;

    font-size: 0.9rem;

    caret-color: var(--accent);
}


/* Cursor */

#terminal-input::selection {
    background: var(--accent);
    color: white;
}


/* Responsive */

@media (max-width: 600px) {

    .terminal-section {
        padding: 40px 0 70px;
    }

    .terminal-body {
        padding: 20px;

        font-size: 0.78rem;

        min-height: 280px;
    }

    .terminal-prompt {
        font-size: 0.78rem;
    }

}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .js-enabled .reveal,
    .js-enabled .reveal.is-visible,
    .js-enabled .portrait.reveal,
    .js-enabled .portrait.reveal.is-visible {
        opacity: 1;
        transform: none;
    }
}