/* The home page hero and its scroll animation (driven by js/home.js), plus the categories section below it. */

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.hero-wrapper {
  position: relative;
}

.hero-section {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fdfcfb; /* Clean base color */
  overflow: hidden;
}

.hero-image-container {
  position: relative;
  /* Higher than mesh (1) but lower than greeting (10) */
  z-index: 5;
  /* This prevents the "blur" from the mesh leaking in front */
  isolation: isolate;
  transform: scale(var(--phone-scale, 1));
  /* Crucial for smooth scroll-back performance */
  will-change: transform;
  transition: none;
  perspective: 2000px; /* Higher value = more realistic 3D depth */
  perspective-origin: center;
}

.phone-frame {
  position: relative;
  width: 280px;
  height: 580px;
  background: #1a1a1a;
  border-radius: 44px;
  padding: 14px;
  /* COMBINED SHADOW STACK */
  box-shadow:
    0 0 0 2px #3a3a3a,
    0 0 0 4px #1a1a1a,
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    /* This shadow reacts to the landing */ 0 var(--shadow-offset) 60px
      rgba(0, 0, 0, var(--shadow-opacity, 0.4));

  /* Critical for the 'snap' look */
  will-change: transform, filter, box-shadow;
}

.blue-overlay {
  position: absolute;
  inset: 0;
  background: var(--primary-blue);
  pointer-events: none;
  z-index: 5;
}

.phone-notch {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 26px;
  background: #1a1a1a;
  border-radius: 20px;
  z-index: 10;
  transition: opacity 0.15s;
}

.phone-screen {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  position: relative;
  transition: none;
}

.hero-image-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.hero-image-track {
  height: 100%;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.phone-home-bar {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.phone-dots {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  z-index: 5;
  transition: opacity 0.2s;
}
.phone-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transition: background 0.3s;
}
.phone-dot.active {
  background: rgba(255, 255, 255, 0.95);
}

/* ── Lock screen ─────────────────────────────────────────────────────────── */
.phone-lock-screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  overflow: hidden;
}
.phone-lock-screen.unlocked {
  transform: translateY(-100%);
}
.lock-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.8);
}
.lock-content {
  position: relative;
  z-index: 21;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 60px;
  color: white;
}
.lock-clock {
  font-size: 58px;
  font-weight: 200;
  line-height: 1;
}
.lock-hint {
  position: absolute;
  bottom: 20px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: 0.8;
  width: 100%;
  text-align: center;
  animation: pulse-swipe 2s infinite;
}
.lock-home-bar {
  position: absolute;
  bottom: 8px;
  width: 40px;
  height: 4px;
  background: white;
  border-radius: 10px;
  left: 50%;
  transform: translateX(-50%);
}
@keyframes pulse-swipe {
  0% {
    transform: translateY(0);
    opacity: 0.4;
  }
  50% {
    transform: translateY(-8px);
    opacity: 0.9;
  }
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
}

/* ── Greeting overlay ────────────────────────────────────────────────────── */
.intro-text-container {
  position: absolute;
  inset: 0;
  /* Higher than phone (2) and mesh (1) to lock the screen once the dive is done */
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  /* Match the phone's blue overlay exactly */
  background: var(--primary-blue);
  /* REMOVED backdrop-filter to ensure it's a solid color handover */
  opacity: 0;
  pointer-events: none;
  /* Snappier transition (0.3s) so it catches the phone's expansion perfectly */
  transition: opacity 0.3s ease;
  text-align: center;
  max-width: 100%;
}
.intro-text-container.visible {
  opacity: 1;
  pointer-events: auto;
}

#vara-container-greeting,
#vara-container-signature {
  min-height: 60px;
}
.signature-wrapper {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
  width: 60%;
}
.intro-text-container .lead {
  font-size: 1.1rem;
  line-height: 1.6;
  color: #333;
  max-width: 560px;
}

/* ── Scroll hint ─────────────────────────────────────────────────────────── */
.scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  font-size: 1rem;
  color: #aaa;
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
  animation: bounce-down 1.2s ease-in-out infinite;
}
.scroll-hint.visible {
  opacity: 1;
}
@keyframes bounce-down {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(8px);
  }
}

/* ── Categories ──────────────────────────────────────────────────────────── */
.categories-section {
  position: relative;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .phone-frame {
    width: 220px;
    height: 460px;
  }

  /* Leave the greeting as much of a phone's width as possible. */
  .intro-text-container {
    padding: 1.5rem 1rem;
  }
}

.circular-text-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 220px;
  height: 220px;
  z-index: 15;
  pointer-events: none;
  animation: spin-ring 20s linear infinite;
  transition: opacity 0.3s ease;
}

.circular-text-ring svg text {
  fill: #2d2d2d;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
}

@keyframes spin-ring {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.shaker-path-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

.salt-shaker {
  position: absolute;
  display: none;
  opacity: 0;
  width: 40px;
  transform-origin: center center;
}
#greeting-body {
  min-height: 3.5em;
  opacity: 0;
  word-break: break-word;
}

.intro-text-container::after {
  content: "";
  position: absolute;
  bottom: 35%;
  width: 60%;
  height: 2px;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0) 70%
  );
  transform: scaleX(0);
  transition: transform 2s ease;
}

.intro-text-container.visible::after {
  transform: scaleX(1);
}

.fluid-mesh-container {
  position: absolute;
  inset: -25%; /* Give them massive room to move */
  z-index: 1;
  transform: scale(var(--mesh-scale));
  filter: blur(80px); /* Lower blur = more defined color "punch" */
  pointer-events: none;
  background: #f0f0f0; /* A slightly grey base makes the colors "pop" harder than pure white */
  will-change: transform;
}

.mesh-blob {
  position: absolute;
  width: 90vw;
  height: 90vh;
  border-radius: 50%;
  /* This ensures colors don't wash out; they stay thick and vibrant */
  opacity: 0.85;
  mix-blend-mode: multiply;
}

/* --- DEEP PERUVIAN BLUE --- */
.color-1 {
  top: -20%;
  left: -10%;
  background: var(--primary-blue);
  animation: float-fluid-blue 15s infinite alternate ease-in-out;
}

/* --- VIBRANT PERUVIAN RED --- */
.color-2 {
  bottom: -20%;
  right: -10%;
  background: var(--primary-red);
  animation: float-fluid-red 12s infinite alternate-reverse ease-in-out;
}

/* --- THE "COLOR FILLER" BLUE --- */
/* This sits in the middle to ensure the screen is never "empty" */
.color-3 {
  top: 20%;
  right: 15%;
  background: var(--primary-blue);
  opacity: 0.6;
  width: 100vw;
  height: 100vh;
  animation: float-fluid-blue 25s infinite linear;
}

/* --- THE "COLOR FILLER" RED --- */
.color-4 {
  bottom: 10%;
  left: -5%;
  background: var(--primary-red);
  opacity: 0.5;
  width: 90vw;
  height: 90vh;
  animation: float-fluid-red 20s infinite linear;
}

/* --- ANIMATIONS (Faster and more movement) --- */

@keyframes float-fluid-blue {
  0% {
    transform: translate(0%, 0%) scale(1) rotate(0deg);
    border-radius: 40% 60% 70% 30% / 40% 40% 60% 60%;
  }
  100% {
    transform: translate(30%, 20%) scale(1.3) rotate(45deg);
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  }
}

@keyframes float-fluid-red {
  0% {
    transform: translate(0%, 0%) scale(1.2) rotate(0deg);
    border-radius: 70% 30% 50% 50% / 30% 30% 70% 70%;
  }
  100% {
    transform: translate(-35%, -25%) scale(1) rotate(-45deg);
    border-radius: 30% 70% 70% 30% / 50% 70% 30% 50%;
  }
}
