/* =========================================
   VARIABLES
   ========================================= */
:root {
  --background: #e0e5ec;
  --foreground: #f0f2f5;
  --muted: #d1d9e6;
  --text: #2d3436;
  --text-muted: #4a5568;
  --accent: #ff4757;
  --accent-foreground: #ffffff;
  --border-shadow: #babecc;
  --border-light: #ffffff;
  --border-dark: #a3b1c6;

  --shadow-card: 8px 8px 16px var(--border-shadow), -8px -8px 16px var(--border-light);
  --shadow-floating: 12px 12px 24px var(--border-shadow), -12px -12px 24px var(--border-light), inset 1px 1px 0 rgba(255,255,255,0.5);
  --shadow-pressed: inset 6px 6px 12px var(--border-shadow), inset -6px -6px 12px var(--border-light);
  --shadow-recessed: inset 4px 4px 8px var(--border-shadow), inset -4px -4px 8px var(--border-light);
  --shadow-sharp: 4px 4px 8px rgba(0,0,0,0.15), -1px -1px 1px rgba(255,255,255,0.8);

  --ease-mech: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* =========================================
   BASE Y RESET
   ========================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--background);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

/* =========================================
   UTILIDADES
   ========================================= */
.mono {
  font-family: 'JetBrains Mono', monospace;
}

.label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.container {
  max-width: 90rem;
  margin: 0 auto;
  padding: 0 24px;
}

@media (min-width: 1024px) {
  .container {
    padding: 0 48px;
  }
}

/* =========================================
   NAV (Actualizado para ESAP y Docente)
   ========================================= */
nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(224, 229, 236, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-dark);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  gap: 16px;
}

@media (min-width: 1024px) {
  .nav-inner {
    padding: 16px 48px;
  }
}

/* Lado Izquierdo: ESAP */
.brand-esap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.esap-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.esap-info {
  display: flex;
  flex-direction: column;
}

.esap-title {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.esap-subtitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin-top: 2px;
}

/* Lado Derecho: Docente */
.brand-prof {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: right;
}

.prof-info {
  display: flex;
  flex-direction: column;
}

.prof-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.2;
}

.prof-role {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.prof-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--background);
  box-shadow: var(--shadow-sharp);
}

/* Responsive Nav para móviles */
@media (max-width: 768px) {
  .nav-inner {
    flex-direction: column;
    text-align: center;
    padding: 20px 24px;
  }

  .brand-esap {
    flex-direction: column;
    gap: 8px;
  }

  .brand-prof {
    flex-direction: column-reverse;
    text-align: center;
    gap: 8px;
  }

  .esap-title {
    font-size: 1rem;
  }
}

/* =========================================
   BARRA DE NAVEGACIÓN DE RUTAS (SIGUIENTE / ANTERIOR)
   ========================================= */
.route-nav {
  width: 100%;
  padding: 8px 30px 0 30px;
}

.route-nav-inner {
  max-width: 90rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Botón base de ruta (usado por siguiente y anterior) - versión compacta */
.route-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--background);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms var(--ease-mech), box-shadow 150ms var(--ease-mech), color 150ms;
}

/* Ícono circular de la flecha - versión compacta */
.route-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--background);
  box-shadow: var(--shadow-card);
  transition: transform 150ms var(--ease-mech), box-shadow 150ms var(--ease-mech), color 150ms;
}

/* Texto del botón (etiqueta pequeña + destino) */
.route-btn-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.route-btn-text small {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.route-btn-text strong {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* Estado BLOQUEADO (flecha anterior en el index) */
.route-btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: var(--shadow-pressed);
  pointer-events: none;
}

.route-btn.is-disabled .route-btn-icon {
  color: var(--text-muted);
  box-shadow: var(--shadow-recessed);
}

/* Estado ACTIVO: botón siguiente */
.route-btn-next .route-btn-icon {
  background: var(--accent);
  color: var(--accent-foreground);
  box-shadow: 4px 4px 8px rgba(166, 50, 60, 0.4), -4px -4px 8px rgba(255, 100, 110, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.route-btn-next:hover {
  transform: translateY(-2px);
  color: var(--accent);
}

.route-btn-next:hover .route-btn-icon {
  transform: translateX(3px);
}

.route-btn-next:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-pressed);
}

/* Indicador central de posición actual */
.route-nav-position {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 6px 16px;
  border-radius: 9999px;
  background: var(--foreground);
  box-shadow: var(--shadow-recessed);
  white-space: nowrap;
}

/* Responsive de la barra de rutas para móviles */
@media (max-width: 768px) {
  .route-nav {
    padding: 12px 30px 0 30px;
  }

  .route-nav-inner {
    justify-content: space-between;
  }

  .route-nav-position {
    display: none;
  }

  .route-btn {
    padding: 6px 10px;
    gap: 8px;
  }

  .route-btn-icon {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }

  .route-btn-text strong {
    font-size: 0.78rem;
  }
}

/* Ajuste de seguridad para pantallas muy pequeñas (ej. iPhone SE) */
@media (max-width: 380px) {
  .route-nav {
    padding: 10px 16px 0 16px;
  }

  .route-btn-text small {
    font-size: 0.55rem;
  }

  .route-btn-text strong {
    font-size: 0.72rem;
  }
}

/* =========================================
   BANNER DE PRESENTACIÓN - IMAGEN CON ENTRADA DINÁMICA
   ========================================= */
.presentation-banner {
  width: 100%;
  /* Margen izquierdo y derecho de 30px estrictos como se solicitó */
  padding: 30px 30px;
  box-sizing: border-box;
}

/* Marco que contiene la imagen: controla el recorte del brillo y las esquinas */
.presentation-banner-frame {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: var(--shadow-card); /* Integración con el estilo neumórfico general */
}

.presentation-banner-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 16px;

  /* Estado inicial: oculta y "recogida" antes de aparecer */
  opacity: 0;
  transform: translateY(30px) scale(0.96);
  filter: blur(4px);

  /* Aparece con un efecto de revelado suave y elegante */
  animation: presentationImageReveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 0.4s;
}

@keyframes presentationImageReveal {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
    filter: blur(4px);
  }

  60% {
    opacity: 1;
    filter: blur(0);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
    box-shadow: var(--shadow-floating);
  }
}

/* Destello de luz que recorre la imagen justo después de aparecer */
.presentation-banner-frame::after {
  content: '';
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.65) 50%, transparent 100%);
  transform: skewX(-20deg);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  animation: presentationBannerShine 1.2s ease-in-out forwards;
  animation-delay: 1.6s;
}

@keyframes presentationBannerShine {
  0% {
    left: -60%;
    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  100% {
    left: 130%;
    opacity: 0;
  }
}

/* Línea de acento que se dibuja bajo la imagen al finalizar */
.presentation-banner-frame::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #ff7a85);
  transform: translateX(-50%);
  z-index: 3;
  animation: presentationAccentGrow 0.6s ease-out forwards;
  animation-delay: 1.7s;
}

@keyframes presentationAccentGrow {
  to {
    width: 60%;
    max-width: 220px; /* Responsive: se adapta al ancho en móviles */
  }
}

/* Ajustes específicos para telefonía móvil */
@media (max-width: 768px) {
  .presentation-banner {
    /* Se mantiene el margen de 30px solicitado, pero se ajusta el margen vertical para pantallas pequeñas */
    margin: 16px 30px 24px 30px;
  }

  .presentation-banner-frame {
    border-radius: 12px; /* Bordes un poco más sutiles en móvil */
  }

  .presentation-banner-img {
    border-radius: 12px;
  }
}

/* Ajuste de seguridad para pantallas muy pequeñas (ej. iPhone SE) */
@media (max-width: 380px) {
  .presentation-banner {
    margin: 12px 16px 20px 16px; /* Margen reducido solo en pantallas extremadamente pequeñas para evitar que la imagen quede diminuta */
  }
}

/* =========================================
   HERO
   ========================================= */
.hero {
  padding: 72px 0 64px;
  position: relative;
  z-index: 1;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: center;
}

@media (min-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1.3fr 1fr;
    gap: 56px;
  }
}

.eyebrow-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: var(--foreground);
  box-shadow: var(--shadow-card);
  margin-bottom: 22px;
}

.led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px 2px rgba(34, 197, 94, 0.7);
  animation: pulse 2.2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }

  50% {
    opacity: 0.45;
  }
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  filter: drop-shadow(0 1px 1px #ffffff);
}

@media (min-width: 640px) {
  h1 {
    font-size: 3.25rem;
  }
}

@media (min-width: 1024px) {
  h1 {
    font-size: 3.75rem;
  }
}

.hero p.sub {
  margin-top: 20px;
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 38ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 32px;
}

/* Device Panel */
.device {
  border-radius: 24px;
  background: var(--text);
  padding: 14px;
  box-shadow: var(--shadow-floating);
  position: relative;
  transition: transform 400ms var(--ease-mech);
}

.device:hover {
  transform: scale(1.015);
}

.device::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background-image: url("https://www.transparenttextures.com/patterns/carbon-fibre.png");
  opacity: 0.15;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.device-screen {
  border-radius: 14px;
  background: #161a1d;
  padding: 24px;
  position: relative;
  overflow: hidden;
  min-height: 280px;
}

.device-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(18,16,16,0) 50%, rgba(0,0,0,0.25) 50%);
  background-size: 100% 4px;
  pointer-events: none;
}

.device-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #8b98a8;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.device-dots {
  display: flex;
  gap: 6px;
}

.device-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3a4148;
}

.device-metric-big {
  color: #f0f2f5;
  font-size: 3.25rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
  line-height: 1;
}

.device-metric-label {
  color: #8b98a8;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  margin-top: 8px;
  position: relative;
  z-index: 1;
}

.device-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 64px;
  margin-top: 26px;
  position: relative;
  z-index: 1;
}

.device-bars div {
  flex: 1;
  background: linear-gradient(to top, #ff4757, #ff7a85);
  border-radius: 2px;
  opacity: 0.85;
}

/* =========================================
   BOTONES
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  height: 52px;
  padding: 0 28px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 150ms var(--ease-mech), box-shadow 150ms var(--ease-mech), filter 150ms;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-foreground);
  box-shadow: 4px 4px 8px rgba(166,50,60,0.4), -4px -4px 8px rgba(255,100,110,0.35);
  border: 1px solid rgba(255,255,255,0.2);
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-primary:active {
  transform: translateY(2px);
  box-shadow: var(--shadow-pressed);
}

.btn-secondary {
  background: var(--background);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

.btn-secondary:hover {
  color: var(--accent);
}

.btn-secondary:active {
  transform: translateY(2px);
  box-shadow: var(--shadow-pressed);
}

/* =========================================
   FOOTER
   ========================================= */
footer {
  padding: 10px 0;
  border-top: 1px solid var(--border-dark);
  position: relative;
  z-index: 1;
}

.footer-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

@media (min-width: 640px) {
  .footer-row {
    flex-direction: row;
    align-items: center;
  }
}

.footer-row .label {
  font-size: 0.7rem;
}

/* =========================================
   EXTRAS
   ========================================= */
::selection {
  background: var(--accent);
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}