/* ===== RESET Y BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0d0d0d;
  --bg2: #111111;
  --text: #f0f0f0;
  --text-soft: #666;
  --accent: #f0f0f0;
  --border: rgba(255,255,255,0.08);
  --font: 'Segoe UI', system-ui, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
}

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

/* ===== NAVBAR ===== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 48px;
  background: rgba(13,13,13,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-soft);
}

.nav-menu {
  list-style: none;
  display: flex;
  gap: 40px;
}

.nav-menu a {
  font-size: 0.82rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-soft);
  transition: color 0.2s;
}

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

/* ===== HERO / CARRUSEL ===== */
.hero {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 64px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.carousel {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 60px;
  overflow: hidden;
}

.carousel-track {
  position: absolute;
  inset: 0;
  display: flex;
  transition: transform 0.7s cubic-bezier(0.4,0,0.2,1);
}

.slide {
  min-width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: flex-end;
  background-size: cover;
  background-position: center;
}

/* Overlay oscuro sobre imagen */
.slide-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
}

.slide-content {
  position: relative;
  z-index: 1;
  padding: 0 64px 0 64px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 800px;
}

.slide h1 {
  font-size: clamp(2.8rem, 6vw, 5rem);
  font-weight: 300;
  letter-spacing: -2px;
  line-height: 1.1;
  color: var(--text);
}

.slide h1 span { color: rgba(255,255,255,0.5); font-style: italic; }

.slide p {
  font-size: 1rem;
  color: rgba(255,255,255,0.65);
  font-weight: 300;
  max-width: 480px;
}

.link-arrow {
  display: inline-block;
  font-size: 0.85rem;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.6);
  transition: color 0.2s, letter-spacing 0.2s;
}

.link-arrow:hover { color: var(--text); letter-spacing: 3px; }

.carousel-controls {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 64px;
  margin-top: 32px;
}

.carousel-controls button {
  background: none;
  border: 1px solid rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.6);
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.carousel-controls button:hover {
  border-color: var(--text);
  color: var(--text);
}

.carousel-dots { display: flex; gap: 8px; }

.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  border: 1px solid rgba(255,255,255,0.4);
}

.dot.active { background: var(--text); border-color: var(--text); transform: scale(1.3); }

/* ===== TRABAJOS ===== */
.trabajos { width: 100%; }

.trabajo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  min-height: 80vh;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.trabajo.inverso { direction: rtl; }
.trabajo.inverso > * { direction: ltr; }

.trabajo-imagen {
  width: 100%;
  min-height: 500px;
  height: 100%;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trabajo:hover .trabajo-imagen {
  filter: brightness(0.9);
}

.img-1 { background: linear-gradient(145deg, #1a1a2e, #4a3f6b); }
.img-2 { background: linear-gradient(145deg, #1c1c1c, #3a2a2a); }
.img-3 { background: linear-gradient(145deg, #0a1628, #1a3a4a); }
.img-4 { background: linear-gradient(145deg, #1a1a0a, #2a3a1a); }

.trabajo-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 80px 72px;
  gap: 20px;
  background: var(--bg2);
}

.trabajo-num {
  font-size: 0.72rem;
  letter-spacing: 4px;
  color: var(--text-soft);
  text-transform: uppercase;
}

.trabajo-info h2 {
  font-size: clamp(1.8rem, 3vw, 3rem);
  font-weight: 300;
  letter-spacing: -1px;
  line-height: 1.1;
}

.trabajo-info p {
  font-size: 0.95rem;
  color: var(--text-soft);
  font-weight: 300;
  max-width: 380px;
  line-height: 1.7;
}

.trabajo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trabajo-tags span {
  font-size: 0.72rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-soft);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 2px;
}

.btn-outline {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.82rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  width: fit-content;
  transition: color 0.2s, border-color 0.2s, letter-spacing 0.2s;
}

.btn-outline:hover {
  color: var(--text);
  border-color: var(--text);
  letter-spacing: 3px;
}

/* Dos botones lado a lado */
.trabajo-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 8px;
  align-items: center;
}

.trabajo-btns .btn-outline { margin-top: 0; }

.btn-github {
  color: var(--text-soft);
  opacity: 0.7;
}

.btn-github:hover { opacity: 1; letter-spacing: 2px; }

/* Preview: imagen subida o icono decorativo */
.trabajo-screenshot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  transition: transform 0.8s ease, opacity 0.3s;
  opacity: 0.92;
}

.trabajo:hover .trabajo-screenshot {
  transform: scale(1.04);
  opacity: 1;
}

/* Fallback icono cuando no hay imagen */
.trabajo-thumb-icon {
  width: 52px;
  height: 52px;
  color: rgba(255,255,255,0.15);
  transition: color 0.3s, transform 0.3s;
  position: relative;
  z-index: 1;
}

.trabajo:hover .trabajo-thumb-icon {
  color: rgba(255,255,255,0.4);
  transform: scale(1.1);
}

/* ===== CONTACTO ===== */
.contacto {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 120px 48px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.contacto h2 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 300;
  letter-spacing: -1.5px;
}

.contacto > p {
  color: var(--text-soft);
  font-size: 0.95rem;
  margin-bottom: 40px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  max-width: 560px;
}

.form input,
.form textarea {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.form input:focus,
.form textarea:focus { border-color: var(--text); }

.form input::placeholder,
.form textarea::placeholder { color: var(--text-soft); }

.form textarea { resize: none; margin-top: 0; }

.form button {
  margin-top: 40px;
  align-self: flex-start;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-soft);
  padding: 12px 32px;
  font-size: 0.8rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
  border-radius: 2px;
}

.form button:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ===== FOOTER ===== */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 48px;
  font-size: 0.75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-soft);
}

.footer-links { display: flex; gap: 32px; }
.footer-links a { transition: color 0.2s; }
.footer-links a:hover { color: var(--text); }

/* ===== ANIMACIÓN ENTRADA SCROLL ===== */
.trabajo-info, .trabajo-imagen {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.trabajo.visible .trabajo-info,
.trabajo.visible .trabajo-imagen {
  opacity: 1;
  transform: translateY(0);
}

.trabajo.visible .trabajo-imagen { transition-delay: 0.1s; }

/* ===== RESPONSIVE ===== */
@media (max-width: 860px) {
  .nav { padding: 18px 24px; }
  .nav-menu { gap: 24px; }

  /* Carrusel */
  .slide-content { padding: 0 24px; }
  .carousel-controls { padding: 0 24px; }

  /* Trabajos */
  .trabajo { grid-template-columns: 1fr; min-height: auto; }
  .trabajo.inverso { direction: ltr; }
  .trabajo-imagen { min-height: 260px; }
  .trabajo-info { padding: 48px 24px; }

  .contacto { padding: 80px 24px; }
  .footer { padding: 24px; flex-direction: column; gap: 16px; }
}
