@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,600;0,700;1,600&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ===== variables de color ===== */
:root {
    --rojo: #8B0000;
    --rojo-claro: #a51212;
    --azul: #0047AB;
    --azul-claro: #1a5fc9;
    --fondo-oscuro: #1a1a1a;
    --fondo: #2C2C2C;
    --texto: #e6e6e6;
    --texto-suave: #b3b3b3;
    --borde: #3a3a3a;
    --sombra: 0 10px 30px rgba(0, 0, 0, 0.35);
    --radio: 14px;
}

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

html {
    scroll-behavior: smooth;
}

section {
    scroll-margin-top: 90px;
}

body {
    background-color: var(--fondo);
    background-image:
        radial-gradient(ellipse 600px 300px at 15% 10%, rgba(139, 0, 0, 0.18), transparent),
        radial-gradient(ellipse 700px 350px at 85% 30%, rgba(0, 71, 171, 0.15), transparent),
        radial-gradient(ellipse 500px 250px at 50% 90%, rgba(0, 71, 171, 0.08), transparent);
    background-attachment: fixed;
    color: var(--texto);
    font-family: "Montserrat", sans-serif;
    text-align: center;
    line-height: 1.7;
}

/* ===== tipografia (jerarquia visual) ===== */
h1 {
    font-family: "Playfair Display", serif;
    font-style: italic;
    font-weight: 700;
    color: var(--texto);
    line-height: 1.25;
}

section > h1 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.8rem;
    display: inline-block;
}

section > h1::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--rojo), var(--azul));
}

h2 {
    font-family: "Montserrat", sans-serif;
    color: var(--azul-claro);
    font-weight: 600;
    font-size: 1.25rem;
}

h3 {
    font-family: "Montserrat", sans-serif;
    color: var(--rojo-claro);
    font-weight: 600;
    font-size: 1.05rem;
}

p,
li,
a {
    font-family: "Montserrat", sans-serif;
}

p {
    color: var(--texto-suave);
}

strong {
    color: var(--texto);
}

a {
    color: var(--azul-claro);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--rojo-claro);
}

::selection {
    background-color: var(--azul);
    color: #fff;
}

/* ===== navegacion ===== */
header {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: rgba(26, 26, 26, 0.94);
    backdrop-filter: blur(6px);
    padding: 0.9rem 1rem;
    border-bottom: 2px solid var(--rojo);
}

nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

nav a {
    display: inline-block;
    padding: 0.4rem 0.95rem;
    color: var(--texto);
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background-color 0.25s, color 0.25s, transform 0.25s;
}

nav a:hover {
    color: var(--texto);
    background-color: var(--rojo);
    transform: translateY(-2px);
}

nav a.active {
    background-color: var(--azul);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 71, 171, 0.45);
}

/* ===== selector de idioma ===== */
.lang-switch {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    display: flex;
    gap: 0.35rem;
    z-index: 2;
}

.lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.2rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--texto-suave);
    border: 1px solid var(--borde);
    background-color: var(--fondo-oscuro);
    transition: background-color 0.25s, color 0.25s, border-color 0.25s, transform 0.25s;
}

.lang-btn:hover {
    color: var(--texto);
    border-color: var(--rojo);
    transform: translateY(-2px);
}

.lang-btn.active {
    background-color: var(--azul);
    border-color: var(--azul);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 71, 171, 0.45);
}

/* ===== separadores ===== */
hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--rojo), var(--azul), transparent);
    margin: 3rem auto;
    max-width: 80%;
}

/* ===== secciones ===== */
section {
    padding: 2.5rem 1.25rem;
    max-width: 900px;
    margin: 0 auto;
}

/* ===== hero / inicio ===== */
.hero {
    padding: 5rem 1.25rem 3rem;
}

.hero-kicker {
    color: var(--rojo-claro);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.hero h1 {
    font-size: clamp(2.4rem, 6vw, 4rem);
    margin-bottom: 1.25rem;
}

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

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* ===== botones ===== */
.boton,
button,
input[type="submit"] {
    display: inline-block;
    padding: 0.8rem 1.9rem;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-family: "Montserrat", sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background-color: var(--rojo);
    text-decoration: none;
    transition: transform 0.25s, background-color 0.25s, box-shadow 0.25s, color 0.25s;
}

.boton:hover,
button:hover {
    transform: translateY(-3px);
    color: #fff;
    background-color: var(--rojo-claro);
    box-shadow: 0 8px 22px rgba(139, 0, 0, 0.4);
}

.boton:active,
button:active {
    transform: translateY(0);
}

.boton:focus-visible,
button:focus-visible {
    outline: 3px solid var(--azul-claro);
    outline-offset: 3px;
}

.boton.azul {
    background-color: var(--azul);
}

.boton.azul:hover {
    background-color: var(--azul-claro);
    box-shadow: 0 8px 22px rgba(0, 71, 171, 0.4);
}

.boton.contorno {
    background-color: transparent;
    border: 2px solid var(--azul-claro);
    color: var(--azul-claro);
}

.boton.contorno:hover {
    background-color: var(--azul);
    border-color: var(--azul);
    color: #fff;
    box-shadow: 0 8px 22px rgba(0, 71, 171, 0.4);
}

/* ===== efecto terminal (maquina de escribir) ===== */
.typing {
    background-color: rgba(26, 26, 26, 0.75);
    border: 1px solid var(--borde);
    border-left: 4px solid var(--azul);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    max-width: 720px;
    margin: 0.5rem auto;
    text-align: left;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.95rem;
    color: var(--texto);
    min-height: 3.2rem;
    white-space: pre-wrap;
    word-break: break-word;
}


.typing::before {
    content: "> ";
    color: var(--rojo-claro);
    font-weight: 700;
}

.typing::after {
    content: "";
    display: inline-block;
    width: 10px;
    height: 1.1em;
    margin-left: 2px;
    vertical-align: text-bottom;
    background-color: var(--azul-claro);
    animation: parpadeo 0.8s step-end infinite;
}

.typing.done::after {
    display: none;
}

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

/* ===== Efecto máquina de escribir sin fondo ===== */
/* ===== Efecto máquina de escribir ===== */

.typing-titulo {
    display: inline-block;
    width: 0;
    text-align: center;

    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;

    padding: 1rem 1.25rem;
    font-family: "JetBrains Mono", monospace;
    color: var(--texto);
    min-height: 3.2rem;

    animation: escribir 3s steps(30, end) forwards;
}

/* Cursor | */
.typing-titulo::after {
    content: "|";
    display: inline-block;
    margin-left: 2px;
    animation: cursor 0.7s step-end infinite;
}

/* Escritura */
@keyframes escribir {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

/* Parpadeo del cursor */
@keyframes cursor {
    50% {
        opacity: 0;
    }
}

/* ===== habilidades ===== */
.habilidades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.habilidad {
    background-color: var(--fondo-oscuro);
    border: 1px solid var(--borde);
    border-top: 4px solid var(--azul);
    border-radius: var(--radio);
    padding: 1.5rem;
    text-align: left;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.habilidad:hover {
    transform: translateY(-5px);
    border-color: var(--rojo);
    box-shadow: var(--sombra);
}

.habilidad h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.habilidad p {
    font-size: 0.95rem;
}

/* ===== listas (proyectos y estudios) ===== */
ul {
    list-style: none;
    max-width: 640px;
    margin: 1.25rem auto;
    text-align: left;
}

li {
    background-color: var(--fondo-oscuro);
    border-left: 4px solid var(--rojo);
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.9rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.25s, border-color 0.25s;
}

li:hover {
    transform: translateX(4px);
    border-color: var(--azul);
}

/* ===== linea del tiempo ===== */
.timeline-card {
    position: relative;
    text-align: left;
    margin-top: 1.5rem;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.timeline-card::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 24px;
    width: 4px;
    border-radius: 4px;
    background: linear-gradient(180deg, var(--azul), var(--rojo));
}

.timeline-item {
    position: relative;
    background-color: var(--fondo-oscuro);
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    margin-left: 56px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.timeline-item::before {
    content: "";
    position: absolute;
    top: 1.4rem;
    left: -42px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--azul);
    border: 3px solid var(--fondo-oscuro);
    box-shadow: 0 0 0 3px var(--azul);
    transition: background-color 0.3s, box-shadow 0.3s;
}

.timeline-item:nth-child(even)::before {
    background-color: var(--rojo);
    box-shadow: 0 0 0 3px var(--rojo);
}

.timeline-item:hover {
    transform: translateX(6px);
    border-color: var(--azul);
    box-shadow: var(--sombra);
}

.timeline-item h3 {
    display: inline-block;
    padding: 0.15rem 0.7rem;
    margin-bottom: 0.5rem;
    border-radius: 999px;
    background-color: rgba(139, 0, 0, 0.15);
    border: 1px solid rgba(139, 0, 0, 0.35);
}

.timeline-item:nth-child(even) h3 {
    background-color: rgba(0, 71, 171, 0.15);
    border-color: rgba(0, 71, 171, 0.35);
}

.timeline-item p {
    font-size: 0.95rem;
}

.timeline-item a {
    color: var(--azul-claro);
}

.timeline-item a:hover {
    color: var(--rojo-claro);
}

/* ===== contacto ===== */
.contact-card {
    background-color: var(--fondo-oscuro);
    border: 1px solid var(--borde);
    border-top: 4px solid var(--rojo);
    border-radius: 18px;
    padding: 2.75rem 1.5rem;
    max-width: 640px;
    margin: 0 auto;
    box-shadow: var(--sombra);
}

.contact-actions {
    margin-top: 1.5rem;
}

.fondo-cuadriculado {
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 30px 30px;
  background-color: var(--fondo);
  width: 100%;
  padding: 3rem 2rem;
  border-radius: var(--radio);
  border: 1px solid var(--borde);
  position: relative;
  overflow: hidden;
}

/* Para que el contenido se vea por encima del fondo */
.fondo-cuadriculado > * {
  position: relative;
  z-index: 1;
}

/* Efecto de brillo sutil en las esquinas */
.fondo-cuadriculado::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(139, 0, 0, 0.05), transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(0, 71, 171, 0.05), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* Ajuste responsive */
@media (max-width: 600px) {
  .fondo-cuadriculado {
    padding: 2rem 1rem;
    border-radius: 10px;
  }
}

/* ===== footer ===== */
.footer {
    margin-top: 3rem;
    padding: 2rem 1.25rem;
    background-color: var(--fondo-oscuro);
    border-top: 2px solid var(--azul);
    text-align: center;
}

.footer p {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.footer-boton {
    display: block;
    text-align: center;
    font-size: 1rem;
    color: var(--texto);
    margin: 0.35rem auto;
    font-weight: 500;
    transition: color 0.2s ease, transform 0.2s ease;
}

.footer-boton:hover {
    color: var(--rojo-claro);
    transform: translateY(-1px);
}

/* ===== animaciones al hacer scroll ===== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

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

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    html {
        scroll-behavior: auto;
    }
}

/* ===== responsive ===== */
@media (max-width: 600px) {
    header {
        position: static;
        padding: 0.75rem 0.5rem;
    }

    .lang-switch {
        position: relative;
        top: auto;
        right: auto;
        transform: none;
        justify-content: center;
        margin-bottom: 0.6rem;
    }

    nav {
        gap: 0.2rem;
    }

    nav a {
        padding: 0.3rem 0.7rem;
        font-size: 0.8rem;
    }

    .hero {
        padding: 3rem 1rem 2rem;
    }

    section {
        padding: 1.75rem 1rem;
    }

    hr {
        margin: 2rem auto;
    }

    .timeline-card::before {
        left: 16px;
    }

    .timeline-item {
        margin-left: 40px;
        padding: 1rem 1.1rem;
    }

    .timeline-item::before {
        left: -32px;
        width: 14px;
        height: 14px;
    }
}
/* ===== dropdown de navegación ===== */
.dropdown-nav {
    display: inline-block;
    position: relative;
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.25s, color 0.25s, transform 0.25s;
}

.dropdown-nav summary {
    list-style: none;
    display: inline-block;
    color: var(--texto);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.25s;
}

.dropdown-nav summary::-webkit-details-marker {
    display: none;
}

/* Flecha eliminada */
.dropdown-nav summary::after {
    display: none;
}

.dropdown-nav:hover {
    color: var(--texto);
    background-color: var(--rojo);
    transform: translateY(-2px);
}

.dropdown-nav:hover summary {
    color: #fff;
}

.dropdown-nav .submenu {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 160px;
    background-color: var(--fondo-oscuro);
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    padding: 0.4rem 0;
    margin: 0;
    list-style: none;
    box-shadow: var(--sombra);
    z-index: 20;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
    transform: translateX(-50%) translateY(-5px);
}

.dropdown-nav[open] .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-nav .submenu li {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
    transform: none !important;
}

.dropdown-nav .submenu li a {
    display: block;
    padding: 0.5rem 1.2rem;
    color: var(--texto-suave);
    font-size: 0.85rem;
    font-weight: 400;
    border-radius: 0;
    transition: background-color 0.2s, color 0.2s;
}

.dropdown-nav .submenu li a:hover {
    background-color: var(--azul);
    color: #fff;
    transform: none;
}

.dropdown-nav .submenu li:first-child a {
    border-radius: var(--radio) var(--radio) 0 0;
}

.dropdown-nav .submenu li:last-child a {
    border-radius: 0 0 var(--radio) var(--radio);
}

/* ===== responsive para dropdown ===== */
@media (max-width: 600px) {
    .dropdown-nav .submenu {
        left: 0;
        transform: none;
        min-width: 140px;
    }
    
    .dropdown-nav[open] .submenu {
        transform: none;
    }
}

.boton-rotado {
    display: inline-block;
    transform: rotate(90deg);
}