/* ===== Colores: modo oscuro (por defecto) y modo claro ===== */
:root,
:root[data-theme="dark"] {
  --bg: #09090a;
  --bg-alt: #121214;
  --card: #1a1a1d;
  --line: #34343a;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --red: #e11d38;
  --red-soft: #ff6b7d;
  --hero-end: #5c0a18;
  --header-bg: rgba(9, 9, 10, 0.92);
  --tile: #f4f4f5;
  --sep: rgba(255, 255, 255, 0.16);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-alt: #f4f4f6;
  --card: #ffffff;
  --line: #d4d4d8;
  --text: #18181b;
  --muted: #52525b;
  --red: #c4102b;
  --red-soft: #b4132b;
  --hero-end: #ffd9de;
  --header-bg: rgba(255, 255, 255, 0.94);
  --tile: #ffffff;
  --sep: rgba(0, 0, 0, 0.16);
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4rem;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.7 Poppins, system-ui, sans-serif;
  transition: background 0.2s, color 0.2s;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--red-soft);
  outline-offset: 3px;
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== Menú superior ===== */
header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--header-bg);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0.7rem 0;
  font-size: 0.9rem;
}

nav a {
  padding: 0 1.1rem;
  text-decoration: none;
  color: var(--muted);
}

/* Separadores suaves entre las opciones del menú */
nav a + a,
.acciones {
  border-left: 1px solid var(--sep);
}

.acciones {
  display: flex;
  gap: 0.5rem;
  padding-left: 1.1rem;
}

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

.tema,
.idioma {
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--red);
  border-radius: 99px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.tema:hover,
.idioma:hover {
  background: var(--red);
  color: #fff;
}

/* ===== Portada ===== */
.hero {
  padding: 4.5rem 0;
  background: linear-gradient(115deg, var(--bg) 40%, var(--hero-end) 100%);
}

.hero .wrap {
  display: flex;
  align-items: center;
  gap: 3rem;
}

.hero-text {
  flex: 1;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 1.1;
  font-weight: 700;
}

.role {
  margin-top: 1rem;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--red-soft);
}

.lead {
  margin-top: 1rem;
  max-width: 34em;
  color: var(--muted);
}

.foto {
  width: 240px;
  height: 240px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--red);
  box-shadow: 0 0 0 8px rgba(225, 29, 56, 0.15);
}

/* ===== Botones ===== */
.btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.btn {
  padding: 0.7rem 1.4rem;
  border: 1px solid var(--red);
  border-radius: 6px;
  font-weight: 500;
  text-decoration: none;
}

.btn.main {
  background: var(--red);
  color: #fff;
}

.btn.main:hover {
  filter: brightness(0.85);
}

.btn.alt:hover {
  background: rgba(225, 29, 56, 0.15);
}

/* ===== Redes (LinkedIn y GitHub) debajo de los botones ===== */
.redes {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.4rem;
}

.redes a {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.redes a:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.redes svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* ===== Cinta de tecnologías (solo debajo de la portada) ===== */
.logos {
  padding: 1.6rem 0 1.8rem;
  background: var(--bg-alt);
  border-top: 4px solid var(--red);
  border-bottom: 1px solid var(--line);
}

.logos-title {
  margin-bottom: 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.logos-viewport {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.logos-track {
  display: flex;
  width: max-content;
  padding: 0;
  list-style: none;
  animation: mover 45s linear infinite;
}

.logos-viewport:hover .logos-track {
  animation-play-state: paused;
}

.logos-track li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin-right: 2.2rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.logo {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: var(--tile);
  border: 1px solid var(--line);
}

@keyframes mover {
  to {
    transform: translateX(-50%);
  }
}

/* ===== Secciones (franjas alternadas para separarlas bien) ===== */
section {
  padding: 4.5rem 0;
  border-bottom: 1px solid var(--line);
}

section:nth-of-type(even) {
  background: var(--bg-alt);
}

h2 {
  margin-bottom: 2rem;
  padding-bottom: 0.7rem;
  border-bottom: 3px solid var(--red);
  width: fit-content;
  font-size: 1.7rem;
  font-weight: 700;
}

section p + p {
  margin-top: 1rem;
}

/* ===== Proyectos (tarjetas) ===== */
.project {
  margin-bottom: 1.2rem;
  padding: 1.4rem 1.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 10px;
}

.project h3 {
  font-size: 1.15rem;
  font-weight: 500;
}

.project p {
  max-width: 42em;
  margin: 0.3rem 0 0.7rem;
  color: var(--muted);
}

.project a {
  font-size: 0.95rem;
  color: var(--red-soft);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}

.tags span {
  padding: 0.1rem 0.7rem;
  border: 1px solid var(--red);
  border-radius: 99px;
  font-size: 0.8rem;
  color: var(--red-soft);
}

/* ===== Proyecto destacado ===== */
.project.featured {
  padding: 1.8rem;
  border: 2px solid var(--red);
  background: linear-gradient(135deg, rgba(225, 29, 56, 0.14), transparent 60%), var(--card);
  box-shadow: 0 0 0 4px rgba(225, 29, 56, 0.12);
}

.badge {
  display: inline-block;
  margin-bottom: 0.8rem;
  padding: 0.2rem 0.9rem;
  border-radius: 99px;
  background: var(--red);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge::before {
  content: "\2605  ";
}

.featured h3 {
  font-size: 1.4rem;
  font-weight: 700;
}

.highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.8rem;
  margin: 1.1rem 0;
  padding: 0;
  list-style: none;
}

.highlights li {
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.highlights strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
}

.highlights span {
  display: block;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ===== Habilidades (tarjetas) ===== */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.skills > div {
  padding: 1rem 1.2rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.skills h3 {
  margin-bottom: 0.3rem;
  font-size: 1rem;
  font-weight: 500;
}

.skills p {
  font-size: 0.95rem;
  color: var(--muted);
}

/* ===== Trayectoria ===== */
.item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.3rem 1rem;
  margin-bottom: 1rem;
  padding: 1.2rem 1.4rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.item > div {
  flex: 1;
  min-width: 260px;
}

.item ul {
  margin: 0.3rem 0 0 1.2rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.item p {
  font-size: 0.95rem;
  color: var(--muted);
}

.item time {
  font-size: 0.9rem;
  white-space: nowrap;
  color: var(--red-soft);
}

/* ===== Contacto y pie ===== */
.contact a {
  display: block;
  width: fit-content;
  margin: 0.3rem 0;
}

footer {
  padding: 2rem 0;
  border-top: 4px solid var(--red);
  font-size: 0.85rem;
  color: var(--muted);
}

/* ===== Botón para volver arriba ===== */
.subir {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 10;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s, filter 0.15s;
}

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

.subir:hover {
  filter: brightness(0.85);
}

.subir svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* ===== Accesibilidad: sin movimiento si el usuario lo pide ===== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .logos-track {
    animation: none;
  }

  .logos-viewport {
    overflow-x: auto;
  }
}

/* ===== Celular ===== */
@media (max-width: 640px) {
  nav a + a,
  .acciones {
    border-left: 0;
  }

  nav a {
    padding: 0 0.4rem;
  }

  .acciones {
    padding-left: 0;
  }

  nav {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }

  section {
    padding: 3rem 0;
  }

  .hero {
    padding: 2.5rem 0;
  }

  .hero .wrap {
    flex-direction: column-reverse;
    text-align: center;
    gap: 1.5rem;
  }

  .btns,
  .redes {
    justify-content: center;
  }

  .foto {
    width: 180px;
    height: 180px;
  }
}