/* ============================================
   ESTUDIO KREM — Landing Page
   Color Palette: Dark Brown + Cream/Gold
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Anton&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --bg-dark: #1A0A05;
  --bg-dark-alt: #2A1209;
  --cream: #F0E0B0;
  --cream-light: #F5EBC8;
  --cream-glow: rgba(240, 224, 176, 0.15);
  --cream-transparent: rgba(240, 224, 176, 0);
  --gold: #D4A843;
  --font-main: 'Outfit', sans-serif;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--cream);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Full-screen Container ---------- */
.loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  overflow: hidden;
}

/* ---------- Subtle background grain ---------- */
.loading-screen::before {
  content: '';
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

/* ---------- Radial glow behind content ---------- */
.loading-screen::after {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--cream-glow) 0%, transparent 70%);
  animation: pulseGlow 5s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.15); opacity: 0.8; }
}

/* ---------- Content wrapper ---------- */
.content-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* ---------- Main headline ---------- */
.headline {
  font-size: clamp(1rem, 2.5vw, 1.6rem);
  font-weight: 300;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0;
  animation: fadeInUp 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.3s forwards;
  text-align: center;
  line-height: 1.6;
}

.headline .line {
  display: block;
}

/* ---------- Krem drip container ---------- */
.krem-drip-section {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px 0 30px;
  min-height: 180px;
  opacity: 0;
  animation: fadeIn 1s ease 0.8s forwards;
}

/* ---------- Logo ---------- */
.logo-container {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 20px;
}

.logo-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 20px var(--cream-glow));
}

/* Logo floating animation */
.logo-float {
  animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-6px) rotate(2deg); }
  50% { transform: translateY(0) rotate(0deg); }
  75% { transform: translateY(-3px) rotate(-1deg); }
}

/* ---------- Krem text drip animation (Liquid Melting Ice Cream) ---------- */
.krem-drip-canvas {
  position: relative;
  width: 100%;
  max-width: 550px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.krem-text-wrapper {
  position: relative;
  display: inline-block;
  filter: url(#creamGoo);
  -webkit-filter: url(#creamGoo);
  padding: 20px 40px;
}

.krem-text {
  font-family: 'Anton', Impact, 'Arial Black', sans-serif;
  font-size: clamp(4.2rem, 13vw, 8.5rem);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cream);
  position: relative;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Individual letter styling for fluid liquid melting */
.krem-letter {
  display: inline-block;
  position: relative;
  animation: liquidMeltingCycle 6s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  transform-origin: 50% 20%;
  will-change: transform, opacity;
}

.krem-letter:nth-child(1) { animation-delay: 0s; }
.krem-letter:nth-child(2) { animation-delay: 0.18s; }
.krem-letter:nth-child(3) { animation-delay: 0.36s; }
.krem-letter:nth-child(4) { animation-delay: 0.54s; }

/* The Liquid Melting Ice Cream Cycle:
   Form smoothly -> Float & breathe -> Melt & stretch like thick liquid -> Flow downward -> Reform seamlessly
*/
@keyframes liquidMeltingCycle {
  /* 0% - 25%: Form & Rise up like fresh cream */
  0% {
    opacity: 0;
    transform: translateY(-40px) scaleY(0.4) scaleX(1.3);
  }
  12% {
    opacity: 0.9;
    transform: translateY(4px) scaleY(1.08) scaleX(0.95);
  }
  22% {
    opacity: 1;
    transform: translateY(0) scaleY(1) scaleX(1);
  }

  /* 22% - 48%: Creamy floating state (gentle breathing wave) */
  35% {
    opacity: 1;
    transform: translateY(-2px) scaleY(0.98) scaleX(1.02);
  }
  48% {
    opacity: 1;
    transform: translateY(0) scaleY(1) scaleX(1);
  }

  /* 48% - 78%: Smooth Ice Cream Melting (Stretching downwards) */
  58% {
    opacity: 1;
    transform: translateY(6px) scaleY(1.15) scaleX(0.92);
  }
  68% {
    opacity: 0.95;
    transform: translateY(22px) scaleY(1.5) scaleX(0.78);
  }
  78% {
    opacity: 0.7;
    transform: translateY(48px) scaleY(2.1) scaleX(0.55);
  }

  /* 78% - 100%: Drip away smoothly into the liquid below */
  88% {
    opacity: 0.2;
    transform: translateY(75px) scaleY(2.8) scaleX(0.3);
  }
  96%, 100% {
    opacity: 0;
    transform: translateY(100px) scaleY(3.5) scaleX(0.15);
  }
}

/* Viscous Drip droplets attached to letters */
.drip-drop {
  position: absolute;
  bottom: -8px;
  background: var(--cream);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  opacity: 0;
  animation: liquidDropFall 6s cubic-bezier(0.5, 0, 0.75, 0.7) infinite;
  pointer-events: none;
}

.drip-drop.d1 {
  width: 12px;
  height: 14px;
  left: 25%;
}

.drip-drop.d2 {
  width: 8px;
  height: 10px;
  left: 65%;
}

.drip-drop.d3 {
  width: 10px;
  height: 12px;
  left: 45%;
}

.krem-letter:nth-child(1) .d1 { animation-delay: 3.2s; }
.krem-letter:nth-child(1) .d2 { animation-delay: 3.8s; }

.krem-letter:nth-child(2) .d1 { animation-delay: 3.4s; }
.krem-letter:nth-child(2) .d2 { animation-delay: 4.0s; }

.krem-letter:nth-child(3) .d1 { animation-delay: 3.5s; }
.krem-letter:nth-child(3) .d2 { animation-delay: 4.1s; }

.krem-letter:nth-child(4) .d1 { animation-delay: 3.3s; }
.krem-letter:nth-child(4) .d2 { animation-delay: 3.9s; }
.krem-letter:nth-child(4) .d3 { animation-delay: 4.4s; }

@keyframes liquidDropFall {
  0%, 45% {
    opacity: 0;
    transform: translateY(0) scale(0.3, 0.3);
  }
  55% {
    opacity: 1;
    transform: translateY(4px) scale(1, 1.4);
  }
  75% {
    opacity: 0.9;
    transform: translateY(40px) scale(0.8, 2);
  }
  90% {
    opacity: 0.3;
    transform: translateY(85px) scale(0.4, 2.5);
  }
  100% {
    opacity: 0;
    transform: translateY(110px) scale(0.1, 3);
  }
}

/* Cream puddle that forms below */
.cream-puddle {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  height: 16px;
  background: radial-gradient(ellipse at center, var(--cream-light) 0%, var(--cream) 40%, transparent 75%);
  border-radius: 50%;
  filter: blur(2px);
  animation: liquidPuddlePulse 6s ease-in-out infinite;
}

@keyframes liquidPuddlePulse {
  0%, 20% { opacity: 0.1; transform: translateX(-50%) scale(0.4, 0.4); }
  45% { opacity: 0.5; transform: translateX(-50%) scale(0.9, 0.8); }
  75% { opacity: 0.95; transform: translateX(-50%) scale(1.3, 1.2); }
  92% { opacity: 0.7; transform: translateX(-50%) scale(1.1, 1); }
  100% { opacity: 0.1; transform: translateX(-50%) scale(0.4, 0.4); }
}

/* ---------- Cream streams (decorative falling lines) ---------- */
.cream-streams {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.cream-stream {
  position: absolute;
  top: -20%;
  width: 2px;
  height: 15%;
  background: linear-gradient(to bottom, transparent, var(--cream-light), transparent);
  opacity: 0;
  animation: streamFall linear infinite;
}

.cream-stream:nth-child(1) { left: 10%; animation-duration: 7s; animation-delay: 0s; opacity: 0.06; }
.cream-stream:nth-child(2) { left: 25%; animation-duration: 9s; animation-delay: 2s; opacity: 0.04; width: 1px; }
.cream-stream:nth-child(3) { left: 40%; animation-duration: 8s; animation-delay: 4s; opacity: 0.05; }
.cream-stream:nth-child(4) { left: 60%; animation-duration: 10s; animation-delay: 1s; opacity: 0.04; width: 1px; }
.cream-stream:nth-child(5) { left: 75%; animation-duration: 7.5s; animation-delay: 3s; opacity: 0.06; }
.cream-stream:nth-child(6) { left: 90%; animation-duration: 8.5s; animation-delay: 5s; opacity: 0.03; width: 3px; }
.cream-stream:nth-child(7) { left: 15%; animation-duration: 11s; animation-delay: 6s; opacity: 0.04; }
.cream-stream:nth-child(8) { left: 50%; animation-duration: 9.5s; animation-delay: 7s; opacity: 0.05; width: 1px; }
.cream-stream:nth-child(9) { left: 85%; animation-duration: 6.5s; animation-delay: 2.5s; opacity: 0.04; }
.cream-stream:nth-child(10) { left: 35%; animation-duration: 12s; animation-delay: 8s; opacity: 0.03; width: 2px; }

@keyframes streamFall {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  10% {
    opacity: var(--stream-opacity, 0.05);
  }
  90% {
    opacity: var(--stream-opacity, 0.05);
  }
  100% {
    transform: translateY(140vh);
    opacity: 0;
  }
}

/* ---------- "Próximamente" text ---------- */
.proximamente {
  font-size: clamp(0.65rem, 1.2vw, 0.85rem);
  font-weight: 400;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--cream);
  opacity: 0;
  animation: fadeInUp 1s cubic-bezier(0.22, 1, 0.36, 1) 1.5s forwards;
  margin-top: 10px;
}

/* Subtle shimmer on proximamente */
.proximamente::after {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cream), transparent);
  margin: 12px auto 0;
  animation: shimmerLine 3s ease-in-out infinite;
}

@keyframes shimmerLine {
  0%, 100% { opacity: 0.2; width: 30px; }
  50% { opacity: 0.6; width: 60px; }
}

/* ---------- Sparkle particles ---------- */
.sparkles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.sparkle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--cream);
  border-radius: 50%;
  opacity: 0;
  animation: sparkleFloat 6s ease-in-out infinite;
}

.sparkle:nth-child(1) { top: 20%; left: 15%; animation-delay: 0s; }
.sparkle:nth-child(2) { top: 60%; left: 80%; animation-delay: 1.5s; width: 2px; height: 2px; }
.sparkle:nth-child(3) { top: 30%; left: 70%; animation-delay: 3s; }
.sparkle:nth-child(4) { top: 75%; left: 25%; animation-delay: 4.5s; width: 2px; height: 2px; }
.sparkle:nth-child(5) { top: 45%; left: 90%; animation-delay: 2s; }
.sparkle:nth-child(6) { top: 85%; left: 50%; animation-delay: 3.5s; width: 2px; height: 2px; }
.sparkle:nth-child(7) { top: 10%; left: 60%; animation-delay: 5s; }
.sparkle:nth-child(8) { top: 50%; left: 5%; animation-delay: 1s; width: 2px; height: 2px; }

@keyframes sparkleFloat {
  0%, 100% {
    opacity: 0;
    transform: scale(0) translateY(0);
  }
  20% {
    opacity: 0.7;
    transform: scale(1) translateY(-5px);
  }
  50% {
    opacity: 0.3;
    transform: scale(0.8) translateY(-15px);
  }
  80% {
    opacity: 0;
    transform: scale(0) translateY(-25px);
  }
}

/* ---------- Utility animations ---------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Canvas drip (JS-driven) ---------- */
#creamCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ---------- Mobile adjustments ---------- */
@media (max-width: 600px) {
  .headline {
    font-size: clamp(0.75rem, 3.5vw, 1.1rem);
    letter-spacing: 0.1em;
    padding: 0 20px;
  }

  .krem-text {
    font-size: clamp(3rem, 15vw, 5rem);
  }

  .logo-container {
    width: 60px;
    height: 60px;
  }

  .proximamente {
    font-size: 0.6rem;
    letter-spacing: 0.25em;
  }

  .loading-screen::after {
    width: 350px;
    height: 350px;
  }
}

/* ---------- Separator line ---------- */
.separator {
  display: flex;
  align-items: center;
  gap: 15px;
  opacity: 0;
  animation: fadeInUp 1s cubic-bezier(0.22, 1, 0.36, 1) 0.6s forwards;
  margin: 5px 0;
}

.separator .line {
  width: 30px;
  height: 1px;
  background: var(--cream);
  opacity: 0.25;
}

.separator .diamond {
  width: 4px;
  height: 4px;
  background: var(--cream);
  transform: rotate(45deg);
  opacity: 0.4;
}
