/**
 * davito.dev - Cinematic Split-Screen Curtain Loader & Transition
 * Inspirado en el estilo editorial, minimalista y de alta costura de etornamahiator.com
 */

/* Contenedor Raíz de la Intro */
.intro-curtain-root {
  position: fixed;
  inset: 0;
  z-index: 99999;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  background-color: transparent;
  pointer-events: auto;
}

.intro-curtain-root.is-hidden {
  display: none !important;
}

/* Cortinas divididas en dos mitades (50% superior y 50% inferior) */
.curtain-panel {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50.5%; /* 50.5% para prevenir línea de 1px por subpíxel */
  background-color: #060607;
  z-index: 250;
  will-change: transform;
  transition: transform 1.15s cubic-bezier(0.77, 0, 0.175, 1);
}

.curtain-top {
  top: 0;
  transform: translateY(0%);
  border-bottom: 1px solid rgba(239, 230, 205, 0.08);
}

.curtain-bottom {
  bottom: 0;
  transform: translateY(0%);
  border-top: 1px solid rgba(239, 230, 205, 0.08);
}

/* Estado de apertura: las dos mitades se abren como un obturador de cine */
.intro-curtain-root.is-split .curtain-top {
  transform: translateY(-101%);
}

.intro-curtain-root.is-split .curtain-bottom {
  transform: translateY(101%);
}

/* Textura sutil de grano analógico y viñeta */
.curtain-grain {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 107, 74, 0.04) 0%, rgba(0, 0, 0, 0.6) 100%);
  pointer-events: none;
  opacity: 0.8;
}

/* Metadatos en las 4 esquinas (Chrome / Editorial Viewport) */
.intro-chrome {
  position: absolute;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.75rem;
  z-index: 260;
  color: #EFE6CD;
  font-family: var(--mono, "IBM Plex Mono", monospace);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.8s cubic-bezier(0.77, 0, 0.175, 1);
}

.intro-chrome-top {
  top: 0;
}

.intro-chrome-bottom {
  bottom: 0;
}

.intro-curtain-root.is-split .intro-chrome-top {
  opacity: 0;
  transform: translateY(-100%);
}

.intro-curtain-root.is-split .intro-chrome-bottom {
  opacity: 0;
  transform: translateY(100%);
}

.chrome-item {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.85;
}

.chrome-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #57f287;
  box-shadow: 0 0 8px #57f287;
  animation: chromeDotPulse 1.6s ease-in-out infinite alternate;
}

@keyframes chromeDotPulse {
  0% { opacity: 0.35; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1.1); }
}

/* Bloque Central de la Intro (Línea Divisoria y Contador) */
.intro-center-stage {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  transform: translateY(-50%);
  z-index: 255;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  transition: opacity 0.4s ease;
}

.intro-curtain-root.is-split .intro-center-stage {
  opacity: 0;
  pointer-events: none;
}

/* Tipografía de Marca Central */
.intro-brand-name {
  font-family: var(--sans, -apple-system, sans-serif);
  font-size: clamp(26px, 4.5vw, 48px);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #EFE6CD;
  margin-bottom: 24px;
  opacity: 0.95;
  display: flex;
  align-items: center;
  gap: 12px;
}

.intro-brand-name span.sub {
  font-family: var(--mono, monospace);
  font-size: clamp(10px, 1.2vw, 13px);
  font-weight: 400;
  color: rgba(239, 230, 205, 0.45);
  letter-spacing: 0.25em;
  margin-left: 6px;
}

/* Línea de Escala Hairline (se expande de 0 a 100% de ancho) */
.intro-hairline-track {
  width: 100%;
  height: 1px;
  background-color: rgba(239, 230, 205, 0.15);
  position: relative;
  overflow: visible;
}

.intro-hairline-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 1px;
  width: 100%;
  background: linear-gradient(90deg, transparent 0%, #EFE6CD 25%, #ff6b4a 50%, #00f0ff 75%, transparent 100%);
  transform-origin: center;
  transform: scaleX(0);
  transition: transform 0.1s linear;
  box-shadow: 0 0 12px rgba(239, 230, 205, 0.45);
}

/* Fila Inferior de Progreso y Acceso */
.intro-progress-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 26px;
  gap: 12px;
}

/* Contador Porcentual Monospace */
.intro-counter-val {
  font-family: var(--mono, monospace);
  font-size: clamp(13px, 1.6vw, 16px);
  letter-spacing: 0.28em;
  color: #EFE6CD;
  font-weight: 500;
  text-transform: uppercase;
}

/* Botón / Prompt Sutil de Entrada */
.intro-enter-prompt {
  font-family: var(--mono, monospace);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(239, 230, 205, 0.6);
  padding: 8px 18px;
  border: 1px solid rgba(239, 230, 205, 0.25);
  border-radius: var(--radius-sm, 4px);
  background: rgba(239, 230, 205, 0.04);
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.intro-enter-prompt.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.intro-enter-prompt:hover {
  color: #ffffff;
  border-color: #00f0ff;
  background: rgba(0, 240, 255, 0.08);
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.25);
}

.prompt-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

.intro-enter-prompt:hover .prompt-arrow {
  transform: translateX(4px);
}

/* Animación de Revelado en el Contenido Principal */
body.intro-active .app-container {
  opacity: 0;
  transform: scale(0.975);
  filter: blur(5px);
}

body.intro-opened .app-container {
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
  transition: opacity 1s cubic-bezier(0.22, 1, 0.36, 1) 0.15s, transform 1s cubic-bezier(0.22, 1, 0.36, 1) 0.15s, filter 0.8s ease 0.15s;
}

/* Adaptabilidad móvil */
@media (max-width: 768px) {
  .intro-chrome {
    padding: 1rem 1.25rem;
    font-size: 9.5px;
  }
  .intro-brand-name {
    margin-bottom: 18px;
    letter-spacing: 0.12em;
  }
  .intro-counter-val {
    font-size: 13px;
  }
  .intro-enter-prompt {
    font-size: 10px;
    padding: 7px 14px;
  }
}

/* Intro ya vista en esta sesión: no pintarla ni un instante */
html.skip-intro #intro-curtain { display: none !important; }
