/* ============================================
   RETRATO — film
   decisions:
     mode: reform
     thesis: foco
     metaphor: open
     acts: 4
     scroll: y-film
     portal: mark-iris
     cuts: [mark-iris, slit, bloom-overtake]
     deck: scroll-slot
     seek: edge-rail
     tone: amethyst glass + gold (brand)
   ============================================ */

html.is-film {
  scroll-behavior: auto;
  scrollbar-width: none;
  --film-p: 0;
  --act-p: 0;
  --cut: 0;
  --iris: 0;
  --slit: 0;
  --bloom: 0;
  --frame-x: clamp(1.5rem, 7.5vw, 5.5rem);
  --frame-y: clamp(1rem, 3.2vh, 2.2rem);
  --header-h: 5.25rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html.is-film::-webkit-scrollbar,
html.is-film body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

html.is-film {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

html.is-film body {
  overflow: visible;
  min-height: 0;
}

.film-root {
  height: 1400vh;
  position: relative;
}

.film-stage {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
}

.film-strip {
  will-change: transform;
  height: 400svh;
  position: relative;
}

.act {
  height: 100svh;
  position: relative;
  overflow: hidden;
}

.act-frame {
  position: relative;
  z-index: 2;
  height: 100%;
  padding: calc(var(--header-h) + var(--frame-y)) var(--frame-x) calc(var(--frame-y) + 1.2rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
}

/* —— Void —— */
.act-void .hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.act-void .hero-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(calc(1.04 + var(--leave, 0) * 0.08));
  filter: saturate(1.05) contrast(1.05);
}

.act-void .hero-panel,
.act-void .hero-panel.liquid {
  width: min(36rem, 100%);
  margin: 0 auto;
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3.2vw, 2.2rem) clamp(1.4rem, 3.5vw, 2.4rem) clamp(1.55rem, 3.6vw, 2.5rem);
  text-align: center;
  overflow: visible;
  opacity: var(--in-panel, 1);
  transform: translate3d(0, calc((1 - var(--in-panel, 1)) * 28px), 0);
}

.act-void .hero-logo {
  opacity: var(--in-mark, 1);
  transform: translate3d(0, calc((1 - var(--in-mark, 1)) * 16px), 0) scale(calc(0.92 + var(--in-mark, 1) * 0.08));
}

.act-void .brand-word {
  opacity: var(--in-word, 1);
}

.act-void .gold-rule {
  opacity: var(--in-rule, 1);
  transform: scaleX(var(--in-rule, 1));
}

.act-void h1 {
  opacity: var(--in-title, 1);
  transform: translate3d(0, calc((1 - var(--in-title, 1)) * 18px), 0);
}

.act-void h1 em {
  font-style: italic;
  color: var(--gold-400);
}

.act-void .hero-lead {
  opacity: var(--in-lead, 1);
}

.act-void .cta-row {
  opacity: var(--in-cta, 1);
  transform: translate3d(0, calc((1 - var(--in-cta, 1)) * 14px), 0);
  margin-top: 1.35rem;
  padding-bottom: 0.15rem;
}

.act-void .cta-row .btn {
  min-width: 10.5rem;
  width: auto;
  flex: 1 1 auto;
}

.film-hint {
  margin: 1.25rem 0 0;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold-400);
  opacity: var(--in-hint, 0);
}

/* —— Deck —— */
.act-deck {
  background:
    radial-gradient(900px 500px at 80% 10%, rgba(155, 93, 229, 0.22), transparent 55%),
    linear-gradient(165deg, #1b0640 0%, #2e1065 55%, #13100f 100%);
}

.act-deck .section-head,
.act-story .section-head {
  max-width: 34rem;
  margin: 0 auto 1.4rem;
  text-align: center;
  opacity: var(--in-head, 1);
  transform: translate3d(0, calc((1 - var(--in-head, 1)) * 20px), 0);
}

.act-deck .section-head h2,
.act-story .section-head h2,
.act-close h2 {
  padding-inline: 0.2rem;
}

.deck-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 28rem;
}

.deck-card {
  position: absolute;
  inset: 0;
  opacity: var(--in, 0);
  transform: translate3d(0, calc((1 - var(--in, 0)) * 32px), 0) scale(calc(0.94 + var(--in, 0) * 0.06));
  filter: blur(calc((1 - var(--in, 0)) * 8px));
  pointer-events: none;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 0.4rem;
  align-items: stretch;
}

.deck-card.is-live {
  pointer-events: auto;
}

.deck-card img {
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
  object-fit: cover;
}

.deck-card .exp-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.2rem 1.1rem;
}

.deck-index {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  color: var(--gold-400);
  margin-bottom: 0.45rem;
}

.deck-ticks {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: rgba(250, 247, 245, 0.4);
}

.deck-ticks li {
  cursor: pointer;
  transition: color 0.35s var(--ease);
}

.deck-ticks li.is-on {
  color: var(--gold-400);
}

/* —— Story —— */
.act-story {
  background:
    radial-gradient(800px 480px at 12% 80%, rgba(212, 178, 106, 0.16), transparent 55%),
    linear-gradient(200deg, #2e1065 0%, #1b0640 48%, #13100f 100%);
}

.story-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}

.story-frame {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: var(--in, 0);
  transform: scale(calc(1.06 - var(--in, 0) * 0.06));
}

.story-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* —— Close —— */
.act-close {
  background:
    radial-gradient(700px 420px at 50% 0%, rgba(155, 93, 229, 0.28), transparent 60%),
    linear-gradient(180deg, #2e1065 0%, #1b0640 100%);
}

.act-close .contact-panel,
.act-close .contact-panel.liquid {
  width: min(40rem, 100%);
  margin: 0 auto;
  text-align: center;
  padding: clamp(1.6rem, 4vw, 2.8rem);
  overflow: visible;
  opacity: var(--in-panel, 1);
  transform: translate3d(0, calc((1 - var(--in-panel, 1)) * 24px), 0);
}

.act-close .eyebrow { opacity: var(--in-eye, 1); }
.act-close h2 { opacity: var(--in-title, 1); }
.act-close .section-lead { opacity: var(--in-lead, 1); }
.act-close .cta-row { opacity: var(--in-cta, 1); }
.act-close .contact-phone { opacity: var(--in-phone, 1); }

.act-close .footer {
  opacity: var(--in-foot, 1);
  padding-bottom: 0.4rem;
}

/* —— Cuts —— */
.film-cut {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 80;
  background: #1b0640;
  opacity: var(--cut, 0);
  -webkit-mask: radial-gradient(
    circle at 50% 46%,
    transparent calc(var(--iris, 0) * 72vmin),
    #000 calc(var(--iris, 0) * 72vmin + 10vmin)
  );
  mask: radial-gradient(
    circle at 50% 46%,
    transparent calc(var(--iris, 0) * 72vmin),
    #000 calc(var(--iris, 0) * 72vmin + 10vmin)
  );
}

.film-cut.is-slit {
  background: linear-gradient(
    90deg,
    #1b0640 0%,
    #1b0640 calc(50% - var(--slit, 0) * 50%),
    transparent calc(50% - var(--slit, 0) * 50%),
    transparent calc(50% + var(--slit, 0) * 50%),
    #1b0640 calc(50% + var(--slit, 0) * 50%),
    #1b0640 100%
  );
  -webkit-mask: none;
  mask: none;
}

.film-cut.is-bloom {
  background: radial-gradient(circle at 50% 48%, #d4b26a 0%, #9b5de5 42%, #1b0640 72%);
  opacity: var(--bloom, 0);
  -webkit-mask: none;
  mask: none;
}

/* —— Rail —— */
.film-rail {
  position: fixed;
  right: 1.05rem;
  top: 22vh;
  height: 56vh;
  width: 18px;
  z-index: 40;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

.film-rail-track {
  position: absolute;
  right: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--gold-400), var(--amethyst-500));
  opacity: 0.5;
}

.film-rail-thumb {
  position: absolute;
  right: 6px;
  width: 6px;
  height: 42px;
  border-radius: 99px;
  background: linear-gradient(180deg, #d4b26a, #9b5de5);
  top: calc(var(--film-p, 0) * (100% - 42px));
}

html.is-film .nav {
  animation: none;
  width: min(920px, calc(100% - var(--frame-x)));
}

html.is-film .hero-panel,
html.is-film .act-void .hero-panel {
  animation: none;
}

/* —— Laptop / mid —— */
@media (max-height: 860px) {
  html.is-film {
    --header-h: 4.6rem;
    --frame-y: 0.7rem;
  }

  .act-void .hero-logo {
    width: 72px;
    margin-bottom: 0.55rem;
  }

  .act-void .brand-word {
    font-size: clamp(1.35rem, 3.4vw, 1.75rem);
    letter-spacing: 0.18em;
  }

  .act-void h1 {
    font-size: clamp(1.55rem, 3.8vw, 2rem);
  }

  .act-void .hero-lead {
    margin-top: 0.5rem;
    font-size: 0.92rem;
  }

  .act-void .hero-panel,
  .act-void .hero-panel.liquid {
    padding: 1.1rem 1.25rem 1.35rem;
  }

  .act-void .cta-row {
    margin-top: 1rem;
  }

  .gold-rule {
    margin: 0.65rem auto;
  }
}

@media (max-width: 1500px) {
  html.is-film {
    --frame-x: clamp(1.75rem, 8.5vw, 6rem);
  }

  .act-void h1,
  .act-deck h2,
  .act-story h2,
  .act-close h2 {
    font-size: clamp(1.85rem, 4.2vw, 2.7rem);
  }

  .brand-word {
    font-size: clamp(1.55rem, 4vw, 2.2rem);
    letter-spacing: 0.2em;
  }
}

@media (max-width: 900px) {
  html.is-film {
    --frame-x: clamp(1.1rem, 5.5vw, 1.6rem);
    --header-h: 4.6rem;
  }

  .deck-card {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1.15fr) auto;
  }

  .deck-card img {
    min-height: 10rem;
  }

  .film-rail {
    display: none;
  }

  html.is-film .nav-links {
    display: none;
  }

  .act-close .btn-xl,
  .act-void .btn {
    width: 100%;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .orb,
  .hero-logo {
    animation: none !important;
  }

  .deck-card,
  .story-frame,
  .act-void .hero-panel,
  .act-close .contact-panel {
    filter: none;
  }
}
