/* =============================================================================
   GRIFE FACAS SG - v9
   Secao "Do fogo a lamina": capitulos do processo com video trocados pelo scroll.
   Carregado depois do style-sg-v8.css.
============================================================================= */

.sg-proc {
  --sg-proc-p: 0;
  position: relative;
  height: calc(var(--sg-proc-count, 5) * 80vh + 100vh);
  background: var(--sg-bg);
}

.sg-proc__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

/* // Videos empilhados: so o capitulo ativo aparece */

.sg-proc__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--sg-bg);
}

.sg-proc__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.12);
  transition: opacity 1.2s var(--sg-ease), transform 9s linear;
  will-change: opacity, transform;
}

.sg-proc__video.is-active {
  opacity: 1;
  transform: scale(1);
}

.sg-proc__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 11, 11, 1) 0%, rgba(11, 11, 11, 0.4) 16%, rgba(11, 11, 11, 0.72) 42%, rgba(11, 11, 11, 0.82) 70%, rgba(11, 11, 11, 0.96) 100%);
  pointer-events: none;
}

/* // Granulado de pelicula, bem sutil */

.sg-proc__grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.09;
  mix-blend-mode: overlay;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%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");
}

/* // Conteudo */

.sg-proc__inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  padding: 96px 24px 128px;
}

.sg-proc__head {
  margin-bottom: 4vh;
}

.sg-proc__kicker,
.sg-proc__label {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.72rem;
  color: var(--sg-gold);
}

.sg-proc__heading {
  margin: 12px 0 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  line-height: 1;
  font-size: clamp(2rem, 4.2vw, 3.4rem);
  color: var(--sg-text);
}

.sg-proc__heading em,
.sg-proc__title em {
  font-style: italic;
  color: var(--sg-gold);
}

.sg-proc__chapters {
  display: grid;
  max-width: 34rem;
}

.sg-proc__chapter {
  grid-area: 1 / 1;
  visibility: hidden;
  transition: visibility 0s linear 0.6s;
}

.sg-proc__chapter.is-active {
  visibility: visible;
  transition-delay: 0s;
}

.sg-proc__chapter > * {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.6s var(--sg-ease), transform 0.9s var(--sg-ease);
}

.sg-proc__chapter.is-active > * {
  opacity: 1;
  transform: none;
}

.sg-proc__chapter.is-active > :nth-child(1) { transition-delay: 0.1s; }
.sg-proc__chapter.is-active > :nth-child(2) { transition-delay: 0.2s; }
.sg-proc__chapter.is-active > :nth-child(3) { transition-delay: 0.3s; }
.sg-proc__chapter.is-active > :nth-child(4) { transition-delay: 0.42s; }

.sg-proc__num {
  display: block;
  margin-bottom: 6px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(4.5rem, 11vw, 9.5rem);
  line-height: 0.82;
  color: transparent;
  -webkit-text-stroke: 1px var(--sg-gold-soft);
}

.sg-proc__title {
  margin: 14px 0 16px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  line-height: 1.05;
  font-size: clamp(1.9rem, 3.6vw, 3rem);
  color: var(--sg-text);
}

.sg-proc__text {
  margin: 0;
  max-width: 30rem;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--sg-muted);
}

/* // Trilha de etapas (mobile: horizontal no rodape) */

.sg-proc__rail {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 40px;
}

.sg-proc__steps {
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 14px 0 0;
  list-style: none;
}

.sg-proc__rail-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--sg-line);
}

.sg-proc__rail-fill {
  position: absolute;
  inset: 0;
  background: var(--sg-gold);
  transform-origin: left center;
  transform: scaleX(var(--sg-proc-p));
}

.sg-proc__step {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: rgba(244, 244, 244, 0.5);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.9);
  transition: color 0.5s var(--sg-ease);
}

.sg-proc__step.is-done,
.sg-proc__step.is-active {
  color: var(--sg-gold);
}

.sg-proc__step-num {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.05rem;
  line-height: 1;
}

.sg-proc__step-label {
  display: none;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.64rem;
}

.sg-proc__step.is-active .sg-proc__step-label {
  color: var(--sg-text);
}

/* // CTA: aparece ao chegar no ultimo capitulo */

.sg-proc__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
  transition: opacity 0.7s var(--sg-ease), transform 0.7s var(--sg-ease);
}

.sg-proc.is-ready:not(.is-last) .sg-proc__cta {
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}

@media (min-width: 768px) {
  .sg-proc__inner {
    padding: 120px 7vw 96px;
  }

  .sg-proc__text {
    font-size: 1.05rem;
  }

  .sg-proc__media::after {
    background:
      linear-gradient(180deg, rgba(11, 11, 11, 1) 0%, rgba(11, 11, 11, 0) 22%, rgba(11, 11, 11, 0) 70%, rgba(11, 11, 11, 0.95) 100%),
      linear-gradient(90deg, rgba(11, 11, 11, 0.94) 0%, rgba(11, 11, 11, 0.7) 32%, rgba(11, 11, 11, 0.12) 58%, rgba(11, 11, 11, 0.12) 70%, rgba(11, 11, 11, 0.82) 100%);
  }

  /* trilha vertical a direita */
  .sg-proc__rail {
    left: auto;
    right: 6vw;
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
  }

  .sg-proc__steps {
    flex-direction: column;
    gap: 30px;
    padding: 0 0 0 26px;
  }

  .sg-proc__rail-line {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: 1px;
    height: auto;
  }

  .sg-proc__rail-fill {
    transform-origin: center top;
    transform: scaleY(var(--sg-proc-p));
  }

  .sg-proc__step {
    flex-direction: row;
    align-items: baseline;
    gap: 14px;
  }

  .sg-proc__step-label {
    display: inline;
  }
}

/* // Sem JS ou com movimento reduzido: capitulos empilhados, sem scroll preso */

.sg-proc:not(.is-ready) {
  height: auto;
}

.sg-proc:not(.is-ready) .sg-proc__stage {
  position: relative;
  height: auto;
  min-height: 100vh;
}

.sg-proc:not(.is-ready) .sg-proc__rail {
  display: none;
}

.sg-proc:not(.is-ready) .sg-proc__chapters {
  gap: 48px;
}

.sg-proc:not(.is-ready) .sg-proc__chapter {
  grid-area: auto;
  visibility: visible;
}

.sg-proc:not(.is-ready) .sg-proc__chapter > * {
  opacity: 1;
  transform: none;
}

.sg-proc:not(.is-ready) .sg-proc__num {
  font-size: clamp(3rem, 8vw, 5rem);
}

@media (prefers-reduced-motion: reduce) {
  .sg-proc__video,
  .sg-proc__chapter > *,
  .sg-proc__cta {
    transition: opacity 0.3s linear;
    transform: none !important;
  }
}
