/* ==========================================================================
   DANIEL ZAMBRANO (@danielz.effects) - SCROLLFILM
   "Así nace un vídeo": frame sequence scrubbed by scroll (Apple-style).
   ========================================================================== */

.scrollfilm {
  position: relative;
  z-index: 20;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-subtle);
}

/* Tall scroll container: taller = slower, smoother scrub */
.sf-container {
  height: 350vh;
}

/* Sticky stage pins the canvas while the container scrolls past */
.sf-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.sf-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Legibility scrim: darkens both sides so left/right chapters stay readable */
.sf-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7, 7, 11, 0.55) 0%, rgba(7, 7, 11, 0) 20%, rgba(7, 7, 11, 0) 75%, rgba(7, 7, 11, 0.7) 100%),
    linear-gradient(90deg, rgba(7, 7, 11, 0.7) 0%, rgba(7, 7, 11, 0.15) 32%, rgba(7, 7, 11, 0) 50%, rgba(7, 7, 11, 0.15) 68%, rgba(7, 7, 11, 0.7) 100%);
}

/* --------------------------------------------------------------------------
   Chapters
   -------------------------------------------------------------------------- */
.sf-section {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  opacity: 0;
  pointer-events: none;
  will-change: opacity, transform;
}

.sf-section[data-side="left"]  { justify-content: flex-start; }
.sf-section[data-side="right"] { justify-content: flex-end; text-align: right; }

.sf-copy {
  max-width: 30rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.sf-section[data-side="right"] .sf-copy {
  align-items: flex-end;
}

.sf-kicker {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--color-cyan);
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.5);
}

.sf-title {
  font-family: 'Anton', var(--font-main);
  font-weight: 400;
  font-size: clamp(2.6rem, 6vw, 5.2rem);
  line-height: 0.98;
  text-transform: uppercase;
  color: var(--text-primary);
  filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.6));
}

.sf-text {
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  line-height: 1.5;
  color: #D4D4E0;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}

.sf-tool {
  display: inline-block;
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 229, 255, 0.45);
  background: rgba(7, 7, 11, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-primary);
}

.sf-section[data-side="right"] .sf-tool {
  align-self: flex-end;
}

.sf-cta {
  margin-top: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  padding: 0.8rem 1.4rem;
  border-radius: 999px;
  background: var(--gradient-ai-h);
  box-shadow: var(--glow-accent);
  transition: transform 0.3s var(--transition-smooth);
}

.sf-cta:hover {
  transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   Scroll hint, progress bar & dots
   -------------------------------------------------------------------------- */
.sf-hint {
  position: absolute;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.sf-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
}

.sf-progress > div {
  height: 100%;
  width: 0%;
  background: var(--gradient-ai-h);
  box-shadow: var(--glow-cyan);
}

.sf-dots {
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 5;
}

.sf-dots button {
  width: 6px;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.sf-dots button.active {
  width: 10px;
  height: 10px;
  margin-left: -2px;
  background: var(--color-cyan);
  box-shadow: 0 0 10px var(--color-cyan);
}

/* --------------------------------------------------------------------------
   Loading overlay
   -------------------------------------------------------------------------- */
.sf-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  transition: opacity 0.5s ease;
}

.sf-overlay.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.sf-bar-track {
  width: 12rem;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.sf-bar {
  height: 100%;
  width: 0%;
  background: var(--gradient-ai-h);
  transition: width 0.2s ease;
}

.sf-loading-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Desktop
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
  .sf-section {
    padding: 0 5rem;
  }

  .sf-dots {
    right: 2rem;
  }
}

/* --------------------------------------------------------------------------
   Mobile: text sits at the bottom so the car stays visible in the middle
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .sf-scrim {
    background: linear-gradient(180deg, rgba(7, 7, 11, 0.5) 0%, rgba(7, 7, 11, 0) 22%, rgba(7, 7, 11, 0) 45%, rgba(7, 7, 11, 0.92) 100%);
  }

  .sf-section,
  .sf-section[data-side="right"] {
    align-items: flex-end;
    justify-content: center;
    text-align: left;
    padding: 0 1.5rem 5.5rem;
  }

  .sf-section[data-side="right"] .sf-copy {
    align-items: flex-start;
  }

  .sf-section[data-side="right"] .sf-tool {
    align-self: flex-start;
  }

  .sf-title {
    font-size: clamp(2.2rem, 11vw, 3rem);
  }

  .sf-dots {
    right: 0.75rem;
  }

  .sf-hint {
    bottom: 1.25rem;
  }
}

/* ==========================================================================
   Vertical variant (volcán): 9:16 clip framed inside a phone on desktop,
   full-bleed on phones
   ========================================================================== */
.scrollfilm.is-vertical .sf-container {
  height: 300vh;
}

/* Warm ambient light behind the phone that matches the lava */
.sf-ambient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 40% 55% at 50% 55%, rgba(0, 229, 255, 0.20), transparent 70%),
    radial-gradient(ellipse 70% 70% at 50% 50%, rgba(123, 92, 255, 0.14), transparent 75%),
    var(--bg-primary);
}

.sf-phone {
  position: absolute;
  left: 50%;
  /* Centered in the space below the fixed header */
  top: calc(50% + var(--header-height) / 2);
  transform: translate(-50%, -50%);
  height: min(calc(100svh - var(--header-height) - 2.5rem), 820px);
  aspect-ratio: 9 / 16;
  border-radius: 2.4rem;
  padding: 0.55rem;
  background: linear-gradient(145deg, #2A2A36, #0E0E16 60%);
  box-shadow:
    0 0 0 1px rgba(237, 237, 242, 0.12),
    0 30px 80px rgba(0, 0, 0, 0.7),
    0 0 90px rgba(0, 229, 255, 0.18);
  z-index: 1;
}

.scrollfilm.is-vertical .sf-media {
  position: relative;
  border-radius: 1.9rem;
}

/* Minimal Reels-style UI on top of the clip */
.sf-phone-ui {
  position: absolute;
  inset: 0.55rem;
  border-radius: 1.9rem;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem 1.1rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, transparent 18%, transparent 80%, rgba(0, 0, 0, 0.45) 100%);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #fff;
}

.sf-phone-tag {
  align-self: flex-start;
  order: -1;
  letter-spacing: 0.1em;
  opacity: 0.85;
}

.sf-phone-handle {
  font-weight: 700;
}

/* Only the side columns need darkening around the phone */
.scrollfilm.is-vertical .sf-scrim {
  background: none;
}

.scrollfilm.is-vertical .sf-section {
  z-index: 2;
}

@media (min-width: 768px) {
  .scrollfilm.is-vertical .sf-copy {
    max-width: calc((100vw - min(100svh - var(--header-height) - 2.5rem, 820px) * 9 / 16) / 2 - 7rem);
    min-width: 14rem;
  }

  .scrollfilm.is-vertical .sf-title {
    font-size: clamp(2.2rem, 4.2vw, 4.2rem);
  }
}

@media (max-width: 767px) {
  .sf-phone {
    inset: 0;
    transform: none;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .scrollfilm.is-vertical .sf-media {
    position: absolute;
    border-radius: 0;
  }

  .sf-phone-ui {
    display: none;
  }

  .scrollfilm.is-vertical .sf-scrim {
    background: linear-gradient(180deg, rgba(7, 7, 11, 0.45) 0%, rgba(7, 7, 11, 0) 22%, rgba(7, 7, 11, 0) 45%, rgba(7, 7, 11, 0.92) 100%);
  }
}

/* --------------------------------------------------------------------------
   Plain variant: the clip already shows a phone, so no device frame around it
   -------------------------------------------------------------------------- */
.sf-phone.is-plain {
  padding: 0;
  background: none;
  border-radius: 1.6rem;
  box-shadow:
    0 0 0 1px rgba(237, 237, 242, 0.1),
    0 30px 80px rgba(0, 0, 0, 0.65),
    0 0 80px rgba(0, 229, 255, 0.14);
}

.sf-phone.is-plain .sf-media {
  border-radius: 1.6rem;
}

@media (max-width: 767px) {
  .sf-phone.is-plain,
  .sf-phone.is-plain .sf-media {
    border-radius: 0;
  }
}
