/* ==========================================================================
   Amin Tahtah Toumi — Hojas de estilo del portfolio personal
   Dirección de diseño: Estilo editorial / Galería de arte minimalista claro
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Variables globales y sistema de diseño
   -------------------------------------------------------------------------- */
:root {
  /* Paleta de colores (Monocromático cálido) */
  --bg-primary: #FAF9F6;
  /* Color de fondo principal (Alabastro) */
  --bg-secondary: #FFFFFF;
  /* Blanco Puro */
  --bg-tertiary: #F1EFEA;
  /* Gris cálido suave para elementos de contraste */

  --text-primary: #121212;
  /* Negro mate / Carbón suave */
  --text-secondary: #706F6C;
  /* Gris cálido medio */
  --text-muted: #A8A6A1;
  /* Gris cálido claro para subtítulos y fechas */

  --border-color: #E4E3E0;
  /* Líneas finas divisoras */
  --border-dark: #121212;
  /* Acentos más oscuros */

  --focus-outline: rgba(18, 18, 18, 0.4);

  /* Tipografías */
  --font-title: 'Outfit', sans-serif;
  --font-subtitle: 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-accent: 'Playfair Display', serif;

  /* Estructura */
  --wrapper-width: 1280px;
  --header-height: 80px;

  /* Transiciones y suavizados */
  --transition-smooth: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.2s ease-out;
}

/* --------------------------------------------------------------------------
   2. Reset general y estilos base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
  overflow-x: clip;
  width: 100%;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: clip;
  width: 100%;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
  background-color: transparent;
  transition: var(--transition-fast);
}

button,
input,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
}

button {
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

/* Personalización de la barra de scroll */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Accesibilidad de foco */
*:focus-visible {
  outline: 2px solid var(--border-dark);
  outline-offset: 4px;
}

/* --------------------------------------------------------------------------
   3. Tipografía y clases de utilidad
   -------------------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  font-family: var(--font-title);
  font-weight: 700;
  line-height: 1.15;
}

p {
  color: var(--text-secondary);
}

.wrapper {
  max-width: var(--wrapper-width);
  margin: 0 auto;
  padding: 0 2rem;
}

.text-serif {
  font-family: var(--font-subtitle);
  font-style: italic;
  font-weight: 300;
}

.nobr {
  white-space: nowrap;
}

/* Estructura grid partida (Split): Izquierda (título) 1/3, Derecha (contenido) 2/3 */
.grid-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  border-top: 1px solid var(--border-color);
  padding-top: 3rem;
  padding-bottom: 3rem;
}

@media (min-width: 768px) {
  .grid-split {
    grid-template-columns: 1fr 2.5fr;
    gap: 4rem;
    padding-top: 5rem;
    padding-bottom: 5rem;
  }

  .section-label {
    position: sticky;
    top: calc(var(--header-height) + 2rem);
    height: fit-content;
  }
}

.section-label {
  font-family: var(--font-subtitle);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
}

.section-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 2rem;
  letter-spacing: -0.02em;
}

@media (min-width: 768px) {
  .section-title {
    font-size: 3.5rem;
  }
}

/* Cursor personalizado interactivo (solo ordenadores) */
.custom-cursor {
  width: 8px;
  height: 8px;
  background-color: var(--text-primary);
  border-radius: 50%;
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s, background-color 0.3s;
  mix-blend-mode: difference;
  display: none;
}

@media (pointer: fine) {
  .custom-cursor {
    display: block;
  }
}

.custom-cursor.hovered {
  width: 32px;
  height: 32px;
  background-color: rgba(255, 255, 255, 0.9);
}

/* Contenedor del canvas de fondo */
.canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

#ambientCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* --------------------------------------------------------------------------
   4. Cabecera y Navegación
   -------------------------------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  z-index: 100;
  background-color: rgba(250, 249, 246, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(228, 227, 224, 0.5);
  transition: var(--transition-smooth);
}

.site-header.scrolled {
  height: 70px;
  background-color: rgba(250, 249, 246, 0.95);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.02);
}

.header-container {
  max-width: var(--wrapper-width);
  margin: 0 auto;
  height: 100%;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  z-index: 101;
}

.logo-text {
  display: inline-block;
  position: relative;
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 28px;
  height: 28px;
  z-index: 101;
}

.burger-line {
  width: 100%;
  height: 2px;
  background-color: var(--text-primary);
  transition: var(--transition-smooth);
  transform-origin: center;
}

.site-nav {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  height: 100vh;
  background-color: var(--bg-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: var(--transition-smooth);
  z-index: 100;
}

.site-nav.open {
  right: 0;
}

.nav-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
}

.nav-link {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 700;
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--text-primary);
  transition: var(--transition-fast);
}

.nav-link:hover::after {
  width: 100%;
}

.nav-btn {
  background-color: var(--text-primary);
  color: var(--bg-primary);
  padding: 0.5rem 1.5rem;
  border-radius: 0;
  font-size: 1.5rem;
}

.nav-btn:hover {
  background-color: var(--text-secondary);
}

.nav-btn::after {
  display: none;
}

/* Estilos de navegación para ordenadores (Desktop) */
@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }

  .site-nav {
    position: static;
    width: auto;
    height: auto;
    background-color: transparent;
    transition: none;
  }

  .nav-list {
    flex-direction: row;
    gap: 2.5rem;
  }

  .nav-link {
    font-size: 0.95rem;
    font-family: var(--font-subtitle);
    font-weight: 500;
  }

  .nav-btn {
    font-size: 0.95rem;
    padding: 0.4rem 1.2rem;
  }
}

.lang-btn-toggle {
  text-transform: uppercase;
  padding: 0;
  letter-spacing: 0.05em;
}

/* --------------------------------------------------------------------------
   5. Sección de Bienvenida (Hero)
   -------------------------------------------------------------------------- */
/* Estilo inicial móvil: scroll estándar de la sección */
.hero-pin-container {
  position: relative;
  height: 150vh;
  width: 100%;
}

@media (min-width: 768px) {
  .hero-pin-container {
    height: 260vh;
  }
}

.hero-sticky-wrapper {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background-color: var(--bg-primary);
  padding-top: var(--header-height);
}

.hero-section {
  width: 100%;
  height: auto;
  min-height: 0;
  padding-top: 0;
  box-sizing: border-box;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 900px;
}

.hero-meta {
  display: none; /* Oculto en móviles para no duplicar con el header */
  font-family: var(--font-subtitle);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 2rem;
  color: var(--text-secondary);
}

.hero-title {
  font-size: clamp(1.6rem, 7vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .hero-meta {
    display: block; /* Visible en tablet y escritorio */
  }

  .hero-title {
    font-size: 3.5rem;
  }
}

@media (min-width: 1024px) {
  .hero-section {
    margin-top: calc(var(--header-height) / 2);
  }

  .hero-title {
    font-size: 4.2rem;
  }
}

.keyword-container {
  display: inline-block;
  vertical-align: bottom;
  height: 1.2em;
  overflow: hidden;
  position: relative;
  border-bottom: 2px solid var(--border-dark);
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: width;
}

.keyword-track {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.keyword-word {
  height: 1.2em;
  display: block;
  width: max-content;
  white-space: nowrap;
  line-height: 1.2;
  padding-right: 0.15em;
  /* Espaciado para evitar que se recorte la letra inclinada en itálica en el borde derecho */
}

.text-serif {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0;
}

.hero-subtitle {
  font-size: 1.15rem;
  line-height: 1.6;
  max-width: 600px;
  margin-bottom: 3rem;
  font-weight: 300;
  /* Arranca visible: ya no depende de .fade-in */
  opacity: 1;
  transform: translateY(0);
  /* Transición base que se usa entre cambios de texto */
  transition: opacity 0.3s ease, transform 0.3s ease;
  will-change: opacity, transform;
  /* Animación de entrada inicial al cargar la página (una sola vez) */
  animation: subtitleInitLoad 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.35s both;
}

@keyframes subtitleInitLoad {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Estado de salida: invisible y ligeramente desplazado hacia abajo */
.hero-subtitle.subtitle-exiting {
  opacity: 0 !important;
  transform: translateY(10px) !important;
  transition: opacity 0.25s ease, transform 0.25s ease;
  /* Desactivamos la animación inicial para que no interfiera */
  animation: none !important;
}

/* Estado de entrada: visible y en su posición natural */
.hero-subtitle.subtitle-entering {
  opacity: 1 !important;
  transform: translateY(0) !important;
  transition: opacity 0.35s ease, transform 0.35s ease;
  animation: none !important;
}



@media (min-width: 768px) {
  .hero-subtitle {
    font-size: 1.25rem;
  }
}

.hero-actions {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2.2rem;
  font-family: var(--font-subtitle);
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition-fast);
  border-radius: 0;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background-color: var(--text-primary);
  color: var(--bg-primary);
  border: 1px solid var(--text-primary);
}

.btn-primary:hover {
  background-color: transparent;
  color: var(--text-primary);
}

.btn-secondary {
  border: 1px solid var(--border-color);
  background-color: transparent;
  color: var(--text-primary);
}

.btn-secondary:hover {
  border-color: var(--text-primary);
}


.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 2rem;
  height: 60px;
  width: 1px;
  background-color: var(--border-color);
  overflow: hidden;
}

.scroll-line {
  display: block;
  width: 100%;
  height: 20px;
  background-color: var(--text-primary);
  animation: scrollDown 2s infinite ease-in-out;
}

@keyframes scrollDown {
  0% {
    transform: translateY(-20px);
  }

  50% {
    transform: translateY(60px);
  }

  100% {
    transform: translateY(-20px);
  }
}

/* --------------------------------------------------------------------------
   6. Sección Sobre mí
   -------------------------------------------------------------------------- */
.about-section {
  background-color: var(--bg-secondary);
}

.about-lead {
  font-size: 2rem;
  line-height: 1.2;
  font-weight: 600;
  margin-bottom: 2.5rem;
  max-width: 750px;
  letter-spacing: -0.02em;
}

@media (min-width: 768px) {
  .about-lead {
    font-size: 2.8rem;
  }
}




/* --------------------------------------------------------------------------
   8. Galería de Proyectos seleccionados
   -------------------------------------------------------------------------- */
.projects-section {
  background-color: var(--bg-secondary);
  padding: 0;
  /* Quitamos padding ya que lo controla el contenedor de scroll */
  overflow: visible;
}

.projects-pin-container {
  position: relative;
  height: auto;
  width: 100%;
}

.projects-sticky-wrapper {
  position: relative;
  height: auto;
  width: 100%;
  padding: 4rem 0;
  display: flex;
  align-items: flex-start;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

/* Degradado para difuminar el borde derecho y que no se corte bruscamente */
.projects-sticky-wrapper::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 12vw;
  background: linear-gradient(to right, transparent, var(--bg-secondary));
  pointer-events: none;
  z-index: 10;
}

.projects-horizontal-track {
  display: flex;
  flex-direction: column;
  height: auto;
  width: 100%;
  max-width: var(--wrapper-width);
  margin: 0 auto;
  padding: 0 2rem;
  gap: 4rem;
}

.project-slide {
  height: auto;
  width: 100%;
  display: flex;
  align-items: flex-start;
  flex-shrink: 0;
}

.intro-slide {
  border-top: none;
  padding-top: 0;
  width: 100%;
  min-width: 0;
  max-width: none;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 1.5rem;
}

.intro-slide .section-label {
  position: static;
  margin-bottom: 1rem;
}

.scroll-horizontal-hint {
  display: none; /* Ocultar en móvil, ya que no hay scroll horizontal */
}

.project-item {
  width: 100%;
  min-width: 0;
  max-width: none;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: flex-start;
}

.project-image-wrapper {
  position: relative;
  overflow: hidden;
  background-color: var(--bg-tertiary);
  aspect-ratio: 16 / 10;
  border: 1px solid var(--border-color);
}

.project-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%);
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), filter 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-image-wrapper:hover .project-img {
  filter: grayscale(0%);
  transform: scale(1.03);
}

.project-hover-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(18, 18, 18, 0.05);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: var(--transition-fast);
}

.project-image-wrapper:hover .project-hover-overlay {
  opacity: 1;
}

.project-view-link {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  padding: 0.8rem 1.8rem;
  font-family: var(--font-subtitle);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--border-color);
  pointer-events: none;
  /* Indicador visual de hover (se activa desde JS) */
}

.project-info {
  display: flex;
  flex-direction: column;
}

.project-meta {
  font-family: var(--font-subtitle);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
}

.project-title {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 1.2rem;
  letter-spacing: -0.02em;
}

.project-desc {
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.project-tech {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.project-tech span {
  font-size: 0.75rem;
  font-family: var(--font-body);
  font-weight: 500;
  padding: 0.3rem 0.8rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* Maquetación en escritorio: Galería con scroll horizontal fijado */
/* Maquetación en escritorio: Galería con scroll horizontal fijado */
@media (min-width: 1024px) {
  .projects-pin-container {
    height: 380vh;
  }
  .projects-sticky-wrapper {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 0;
    overflow: hidden;
    scroll-snap-type: none;
    align-items: center;
  }
  .projects-horizontal-track {
    flex-direction: row;
    height: 100%;
    width: max-content;
    max-width: none;
    padding: 0 10vw;
    gap: 10vw;
    will-change: transform;
    transition: transform 0.1s cubic-bezier(0.25, 1, 0.5, 1);
  }

  .project-slide {
    height: 100%;
    width: auto;
    align-items: center;
  }

  .intro-slide {
    width: 32vw;
    min-width: 380px;
    max-width: 500px;
    gap: 2rem;
    align-items: flex-start;
  }

  .intro-slide .section-label {
    margin-bottom: 2rem;
  }

  .scroll-horizontal-hint {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-subtitle);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-top: 3rem;
  }

  .scroll-horizontal-hint svg {
    animation: hintArrow 2s infinite ease-in-out;
  }

  @keyframes hintArrow {
    0% {
      transform: translateX(0);
    }
    50% {
      transform: translateX(8px);
    }
    100% {
      transform: translateX(0);
    }
  }

  .project-item {
    width: 70vw;
    max-width: 950px;
    grid-template-columns: 1.2fr 1fr;
    gap: 4rem;
    align-items: center;
    padding: 0;
  }

  .project-title {
    font-size: 2.5rem;
  }

  .project-image-wrapper {
    width: 100%;
    max-height: 500px;
  }
}

/* Ajustes de proporción para pantallas muy anchas */
@media (min-width: 1400px) {
  .project-item {
    width: 60vw;
    max-width: 1100px;
  }
}

/* --------------------------------------------------------------------------
   7b. Sección Manifiesto — Tipografía Cinética (scroll-driven parallax)
   -------------------------------------------------------------------------- */

/* Utilidad accesibilidad */

/* --------------------------------------------------------------------------
   7c. Skills Spotlight — Efecto Linterna con Ratón
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   9. Seccin de Contacto
   -------------------------------------------------------------------------- */


.contact-section {
  background-color: var(--bg-primary);
}

.contact-lead {
  font-size: 1.25rem;
  font-weight: 300;
  line-height: 1.6;
  max-width: 600px;
  margin-bottom: 2rem; /* Reducido de 3.5rem */
}

.contact-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 800px;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem; /* Reducido de 2rem */
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

@media (min-width: 768px) {
  .form-row {
    flex-direction: row;
    gap: 2rem;
  }
  
  .form-row .form-group {
    flex: 1;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

.form-label {
  font-family: var(--font-subtitle);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.form-input {
  border-bottom: 1px solid var(--border-color);
  padding: 0.6rem 0; /* Reducido de 0.8rem */
  width: 100%;
  border-radius: 0;
  transition: var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-bottom-color: var(--border-dark);
}

.form-textarea {
  min-height: 80px; /* Reducido de 120px */
  resize: vertical;
}

.form-error {
  display: none;
  font-size: 0.75rem;
  color: #c92a2a;
  margin-top: 0.25rem;
}

.form-group.has-error .form-input {
  border-bottom-color: #c92a2a;
}

.form-group.has-error .form-error {
  display: block;
}

.form-actions {
  margin-top: 1rem;
}

.btn-submit {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2rem;
}

@media (min-width: 768px) {
  .btn-submit {
    width: auto;
    gap: 3rem;
  }
}

.icon-arrow {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-submit:hover .icon-arrow {
  transform: translateX(6px);
}

.form-status {
  font-size: 0.95rem;
  margin-top: 1rem;
  font-weight: 500;
}

.form-status.success {
  color: #2b8a3e;
}

.form-status.error {
  color: #c92a2a;
}

.contact-icons-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  margin-top: 1.5rem;
}

@media (min-width: 768px) {
  .contact-icons-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }
}

.icon-link {
  color: var(--text-primary);
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pill-link {
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--border-color);
  border-radius: 50px;
  background-color: var(--bg-secondary);
  gap: 0.6rem;
  font-family: var(--font-subtitle);
  font-size: 0.85rem;
  font-weight: 500;
}

.pill-link:hover {
  background-color: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
  transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   10. Pie de página
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 3rem 0;
  background-color: var(--bg-secondary);
}

.footer-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

@media (min-width: 768px) {
  .footer-container {
    flex-direction: row;
  }
}

.footer-left,
.footer-right {
  text-align: center;
}

@media (min-width: 768px) {
  .footer-left {
    text-align: left;
  }
  .footer-right {
    text-align: right;
  }
}

/* --------------------------------------------------------------------------
   11. Animaciones y efectos de entrada gradual
   -------------------------------------------------------------------------- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.fade-in:nth-child(1) {
  animation-delay: 0.1s;
}

.fade-in:nth-child(2) {
  animation-delay: 0.2s;
}

.fade-in:nth-child(3) {
  animation-delay: 0.3s;
}

.fade-in:nth-child(4) {
  animation-delay: 0.4s;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scroll-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.scroll-reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   12. Animación del icono de menú móvil (Burger)
   -------------------------------------------------------------------------- */
.site-header.nav-open .burger-line:nth-child(1) {
  transform: translateY(4px) rotate(45deg);
}

.site-header.nav-open .burger-line:nth-child(2) {
  transform: translateY(-4px) rotate(-45deg);
}

html.modal-open, body.modal-open {
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   14. Perspectiva 3D y Efecto Inclinación
   -------------------------------------------------------------------------- */
.project-image-wrapper {
  perspective: 1000px;
}

.project-img {
  transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  /* Suaviza el movimiento del cursor */
  will-change: transform;
}

/* --------------------------------------------------------------------------
   15. Ventana Modal de Proyectos
   -------------------------------------------------------------------------- */
.project-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(250, 249, 246, 0.85);
  /* Alabastro con transparencia */
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

.modal-wrapper {
  position: relative;
  width: 90%;
  max-width: 1100px;
  max-height: 90vh;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 3rem;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.04);
  overflow-y: auto;
  z-index: 1001;
  transform: translateY(30px) scale(0.98);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-modal.open .modal-wrapper {
  transform: translateY(0) scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-fast);
  z-index: 1010;
}

.modal-close-btn:hover {
  background-color: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.modal-content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  margin-top: 1rem;
}

@media (min-width: 992px) {
  .modal-content-grid {
    grid-template-columns: 1.2fr 1fr;
    gap: 4rem;
  }
}

/* Galería del modal */
.modal-gallery {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.modal-main-image-container {
  aspect-ratio: 16 / 10;
  border: 1px solid var(--border-color);
  background-color: var(--bg-tertiary);
  overflow: hidden;
}

.modal-main-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  transition: opacity 0.3s ease;
  cursor: zoom-in;
}

.modal-thumbs {
  display: flex;
  gap: 1rem;
}

.thumb-btn {
  width: 80px;
  height: 50px;
  border: 1px solid var(--border-color);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  opacity: 0.5;
  transition: var(--transition-fast);
  background: none;
}

.thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-btn:hover,
.thumb-btn.active {
  opacity: 1;
  border-color: var(--border-dark);
}

/* Detalles del modal */
.modal-details {
  display: flex;
  flex-direction: column;
}

.modal-project-title {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.modal-project-role {
  font-family: var(--font-subtitle);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.modal-project-desc {
  font-size: 1.05rem;
  font-weight: 300;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.modal-info-section {
  margin-bottom: 1.5rem;
}

.modal-info-section:last-child {
  margin-bottom: 0;
}

.modal-section-subtitle {
  font-family: var(--font-subtitle);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.modal-project-tech-desc {
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Modificar hover principal de proyectos para que sea pulsable */
.project-item {
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   13. Preferencias de accesibilidad (Reducción de movimiento)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    background-attachment: initial !important;
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }

  .custom-cursor {
    display: none !important;
  }

  .scroll-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .fade-in {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .scroll-line {
    animation: none !important;
    transform: none !important;
  }

  }


/* --------------------------------------------------------------------------
   Nueva Sección: Servicios
   -------------------------------------------------------------------------- */
.services-section {
  padding-top: 4rem;
  padding-bottom: 4rem;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
}

.services-section .grid-split {
  border-top: none;
}

.services-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

@media (min-width: 768px) {
  .services-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
}

.service-card {
  padding: 2.5rem 2rem;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  transition: var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.service-card:hover {
  border-color: var(--text-primary);
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}

.service-icon {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.service-name {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 700;
}

.service-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   14. Marquesina de Tecnologías (Infinite Marquee)
   -------------------------------------------------------------------------- */
.tech-physics-section {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  width: 100%;
  position: relative;
  overflow: hidden;
}

.physics-container {
  position: relative;
  width: 100%;
  height: 70vh;
  min-height: 500px;
  max-height: 900px;
  overflow: hidden;
  touch-action: pan-y;
  /* El mouse constraint requiere que el lienzo de Matter capture los eventos,
     así que los elementos DOM físicos pasarán los clics al canvas debajo. */
}

.physics-bg-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-title);
  font-size: clamp(2.5rem, 8vw, 6.5rem);
  line-height: 1.1;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-primary);
  opacity: 0.08;
  pointer-events: none;
  text-align: center;
  user-select: none;
  z-index: 1;
  width: 90%;
}

/* El canvas de Matter.js se insertará dinámicamente y cubrirá el contenedor */
.physics-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10; /* Por encima de los elementos HTML para capturar ratón */
  /* Lo hacemos transparente porque Matter.js solo se usará para físicas y eventos, no renderizado visual (o render oculto) */
}

.physics-item {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--text-primary);
  user-select: none;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.8rem 1.6rem;
  border-radius: 40px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  /* Transform origin al centro para que coincida con el centro de masa de Matter.js */
  transform-origin: center center;
  will-change: transform;
  /* Pointer events none para que el click caiga sobre el canvas de Matter.js */
  pointer-events: none;
  z-index: 5;
}

.tech-icon {
  width: 26px;
  height: 26px;
  /* Sin filtro para mantener colores originales */
  pointer-events: none;
}

@media (max-width: 768px) {
  .physics-container {
    height: 60vh;
    min-height: 400px;
  }
  .physics-item {
    font-size: 1.1rem;
    padding: 0.6rem 1.2rem;
    gap: 0.5rem;
  }
  .tech-icon {
    width: 20px;
    height: 20px;
  }
}

/* Efecto de Onda Expansiva (Shockwave) */
.physics-shockwave {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  border: 4px solid var(--text-primary);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  opacity: 1;
  animation: shockwave-anim 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 11;
}

@keyframes shockwave-anim {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0.5; border-width: 8px; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; border-width: 0px; }
}

/* Indicador de fuera de pantalla para físicas */
.offscreen-indicator {
  position: absolute;
  top: 10px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 12px solid var(--indicator-color, #fff);
  opacity: 0;
  pointer-events: none;
  z-index: 15;
  transform: translateX(-50%);
  transition: opacity 0.2s ease;
  animation: float-pulse 0.8s ease-in-out infinite alternate;
}

.offscreen-indicator.visible {
  opacity: 1;
}

@keyframes float-pulse {
  0% { transform: translateX(-50%) translateY(0); filter: drop-shadow(0 0 4px var(--indicator-color, #fff)); }
  100% { transform: translateX(-50%) translateY(-5px); filter: drop-shadow(0 0 10px var(--indicator-color, #fff)); }
}

/* ==========================================================================
   15. Barra de progreso de scroll
   ========================================================================== */
#scrollProgressBar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--text-primary);
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 0 6px rgba(26, 26, 26, 0.25);
}

/* ==========================================================================
   16. Toast de notificación (copiar email, etc.)
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--text-primary);
  color: var(--bg-primary);
  font-family: var(--font-subtitle);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 0.75rem 1.5rem;
  border-radius: 100px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10000;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
  opacity: 0;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   17. Indicador de sección activa en la navegación
   ========================================================================== */
.nav-link {
  position: relative;
}

/* Línea animada bajo el enlace activo o en hover */
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0%;
  height: 1.5px;
  background: var(--text-primary);
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 2px;
}

.nav-link:hover::after,
.nav-link.active-section::after {
  width: 100%;
}

/* Botón de idioma y CTA de contacto no llevan indicador */
.lang-btn-toggle::after,
.nav-btn::after {
  display: none !important;
}

/* ==========================================================================
   18. Textura de grano editorial sobre el fondo (paper feel)
   ========================================================================== */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  /* Ruido SVG fractal inline: semilla fija para consistencia visual */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  /* Opacidad visible pero sutil: 6% da ese look de papel/grano editorial */
  opacity: 0.5;
  pointer-events: none;
  /* Por encima de todo el contenido excepto modales y toasts */
  z-index: 9000;
  /* Overlay hace que el grano solo oscurezca sin tapar los colores */
  mix-blend-mode: multiply;
}

/* ==========================================================================
   20. Botón de enlace externo en modal de proyectos
   ========================================================================== */
.modal-project-link-btn {
  margin-top: 1rem;
  align-self: start;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

@media (min-width: 768px) {
  .modal-project-link-btn {
    width: auto;
    gap: 3rem;
  }
}

.modal-project-link-btn:hover .icon-arrow {
  transform: translateX(6px);
}

/* ==========================================================================
   21. Lightbox de imagen ampliada del proyecto
   ========================================================================== */
.image-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1200; /* Por encima del modal de proyectos (1000) */
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.image-lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(250, 249, 246, 0.92); /* Alabastro con transparencia */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  cursor: zoom-out;
  transition: background-color 0.4s ease;
}

body.dark-mode .lightbox-backdrop {
  background-color: rgba(26, 26, 26, 0.92);
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 85vh;
  z-index: 1201;
  transform: scale(0.96);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  cursor: zoom-out;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.image-lightbox.open .lightbox-content {
  transform: scale(1);
}

.lightbox-content img {
  display: block;
  max-width: 100%;
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
}

.lightbox-close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 1202;
  transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.lightbox-close-btn:hover {
  background-color: var(--text-primary);
  color: var(--bg-primary);
  transform: scale(1.05);
}

@media (max-width: 768px) {
  .nobr {
    white-space: normal;
  }
  .modal-wrapper {
    padding: 1.5rem;
    width: 92%;
    max-height: 85vh;
  }
  .modal-close-btn {
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    background-color: var(--bg-secondary);
  }
  .lightbox-close-btn {
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
  }
  .lightbox-content {
    max-width: 95%;
    max-height: 75vh;
  }
  .lightbox-content img {
    max-height: 75vh;
  }
}

/* ==========================================================================
   22. Animación de cambio de idioma (Efecto foco/desenfoque)
   ========================================================================= */
.lang-transition-active {
  transition: opacity 0.2s cubic-bezier(0.25, 1, 0.5, 1), filter 0.2s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: opacity, filter;
}

.lang-switching {
  opacity: 0.15 !important;
  filter: blur(5px) !important;
}

/* ==========================================================================
   24. Sobre Mí - Layout
   ========================================================================= */
.about-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 3rem;
  align-items: start;
  margin-top: 2rem;
}

.about-text p {
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background-color: var(--bg-tertiary);
}

.about-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(100%);
  transition: filter 0.4s ease;
}

.about-image:hover {
  filter: grayscale(0%);
}

@media (max-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .about-image-wrapper {
    aspect-ratio: 1 / 1;
    order: -1; /* Poner la imagen arriba en móvil */
  }
}


/* ==========================================================================
   24. Toast Notifications
   ========================================================================= */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--text-primary);
  color: var(--bg-primary);
  padding: 12px 24px;
  border-radius: 30px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease, visibility 0.4s;
  z-index: 10000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}
