/* Continuous visual canvas for the ephemeral Home V4 study.
   Semantic sections remain intact; their backgrounds and ASCII scenes now overlap. */

.page-v4 {
  --flow-dark: var(--ink-strong);
  --flow-soft-start: clamp(150px, 13vw, 244px);
  --cathedral-enter: clamp(202px, 17vw, 328px);
  background: var(--flow-dark);
}

.page-v4 .continuous-flow {
  position: relative;
  isolation: isolate;
  overflow: clip;
  background:
    radial-gradient(ellipse 72% 16% at 18% 17%, rgba(233, 78, 27, 0.025), transparent 72%),
    radial-gradient(ellipse 76% 18% at 84% 48%, rgba(46, 42, 35, 0.025), transparent 74%),
    radial-gradient(ellipse 68% 16% at 24% 72%, rgba(233, 78, 27, 0.018), transparent 76%),
    var(--ascii-canvas);
}

/* A single neutral canvas replaces alternating section fills and dividers. */
.page-v4 .continuous-flow > .hero,
.page-v4 .continuous-flow > .trust-strip,
.page-v4 .continuous-flow > .offers-section,
.page-v4 .continuous-flow > .authority-section,
.page-v4 .continuous-flow > .contact-section {
  border-top: 0;
  border-bottom: 0;
  background: transparent;
}

.page-v4 .continuous-flow > .offers-section,
.page-v4 .continuous-flow > .authority-section,
.page-v4 .continuous-flow > .contact-section {
  overflow: visible;
}

.page-v4 .continuous-flow > .trust-strip {
  z-index: 4;
}

.page-v4 .continuous-flow > .offers-section {
  z-index: 1;
}

.page-v4 .continuous-flow > .authority-section {
  z-index: 2;
}

.page-v4 .continuous-flow > .contact-section {
  z-index: 1;
}

/* Plano Piloto dissolves before the trust statement instead of ending on a crop. */
.page-v4 .ascii-scene--hero {
  -webkit-mask-image:
    radial-gradient(
      ellipse 42% 34% at 50% 51%,
      rgba(0, 0, 0, 0.12) 0%,
      rgba(0, 0, 0, 0.18) 58%,
      rgba(0, 0, 0, 0.48) 78%,
      #000 100%
    ),
    linear-gradient(to bottom, #000 0%, #000 82%, rgba(0, 0, 0, 0.72) 91%, transparent 100%);
  mask-image:
    radial-gradient(
      ellipse 42% 34% at 50% 51%,
      rgba(0, 0, 0, 0.12) 0%,
      rgba(0, 0, 0, 0.18) 58%,
      rgba(0, 0, 0, 0.48) 78%,
      #000 100%
    ),
    linear-gradient(to bottom, #000 0%, #000 82%, rgba(0, 0, 0, 0.72) 91%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

/* No desktop, o centro protegido sobe e ganha presença; a composição mobile
   mantém a máscara própria definida no breakpoint abaixo. */
@media (min-width: 681px) {
  .page-v4 .ascii-scene--hero {
    -webkit-mask-image:
      radial-gradient(
        ellipse 42% 34% at 50% 47%,
        rgba(0, 0, 0, 0.18) 0%,
        rgba(0, 0, 0, 0.26) 58%,
        rgba(0, 0, 0, 0.56) 78%,
        #000 100%
      ),
      linear-gradient(to bottom, #000 0%, #000 82%, rgba(0, 0, 0, 0.72) 91%, transparent 100%);
    mask-image:
      radial-gradient(
        ellipse 42% 34% at 50% 47%,
        rgba(0, 0, 0, 0.18) 0%,
        rgba(0, 0, 0, 0.26) 58%,
        rgba(0, 0, 0, 0.56) 78%,
        #000 100%
      ),
      linear-gradient(to bottom, #000 0%, #000 82%, rgba(0, 0, 0, 0.72) 91%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
  }
}

/* Superquadras begin in the trust pause and dissolve while the bridge enters. */
.page-v4 .ascii-scene--superquadra {
  --scene-enter: clamp(96px, 8vw, 144px);
  --scene-exit: clamp(190px, 16vw, 286px);
  top: calc(0px - var(--scene-enter));
  right: 0;
  bottom: calc(0px - var(--scene-exit));
  left: 0;
  -webkit-mask-image:
    radial-gradient(ellipse 43% 31% at 54% 36%, transparent 0 34%, rgba(0, 0, 0, 0.32) 61%, #000 100%),
    linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.28) 9%, #000 19%, #000 72%, rgba(0, 0, 0, 0.34) 90%, transparent 100%);
  mask-image:
    radial-gradient(ellipse 43% 31% at 54% 36%, transparent 0 34%, rgba(0, 0, 0, 0.32) 61%, #000 100%),
    linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.28) 9%, #000 19%, #000 72%, rgba(0, 0, 0, 0.34) 90%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.page-v4 .ascii-scene--superquadra .ascii-scene__label {
  bottom: calc(var(--scene-exit) + 24px);
}

/* Ponte JK crosses the former offers/authority boundary and fades into the closing ramp. */
.page-v4 .ascii-scene--bridge {
  --scene-enter: clamp(170px, 14vw, 238px);
  --scene-exit: clamp(220px, 18vw, 320px);
  top: calc(0px - var(--scene-enter));
  right: 0;
  bottom: calc(0px - var(--scene-exit));
  left: 0;
  -webkit-mask-image:
    radial-gradient(ellipse 36% 25% at 43% 29%, transparent 0 31%, rgba(0, 0, 0, 0.3) 58%, #000 100%),
    linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.22) 11%, #000 23%, #000 68%, rgba(0, 0, 0, 0.3) 88%, transparent 100%);
  mask-image:
    radial-gradient(ellipse 36% 25% at 43% 29%, transparent 0 31%, rgba(0, 0, 0, 0.3) 58%, #000 100%),
    linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.22) 11%, #000 23%, #000 68%, rgba(0, 0, 0, 0.3) 88%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

/* A máscara desktop zera antes da borda inferior da arte. Isso dissolve os
   glifos de largura total antes da caixa do SVG e elimina a linha da costura. */
@media (min-width: 681px) {
  .page-v4 .ascii-scene--bridge {
    -webkit-mask-image:
      radial-gradient(ellipse 36% 25% at 43% 29%, transparent 0 31%, rgba(0, 0, 0, 0.3) 58%, #000 100%),
      linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.22) 11%, #000 23%, #000 55%, rgba(0, 0, 0, 0.35) 68%, transparent 76.5%);
    mask-image:
      radial-gradient(ellipse 36% 25% at 43% 29%, transparent 0 31%, rgba(0, 0, 0, 0.3) 58%, #000 100%),
      linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.22) 11%, #000 23%, #000 55%, rgba(0, 0, 0, 0.35) 68%, transparent 76.5%);
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
  }
}

.page-v4 .ascii-scene--bridge .ascii-scene__label {
  right: var(--gutter);
  bottom: calc(var(--scene-exit) + 26px);
  left: auto;
}

/* Content-local breathing zones protect long copy without washing out the bridge. */
@media (min-width: 1041px) {
  .page-v4 .authority-intro .authority-body,
  .page-v4 .leader-content {
    position: relative;
    isolation: isolate;
  }

  .page-v4 .authority-intro .authority-body,
  .page-v4 .leader-bio {
    color: color-mix(in srgb, var(--ink) 72%, var(--ink-muted));
  }

  .page-v4 .authority-intro .authority-body::before,
  .page-v4 .leader-content::before {
    opacity: 0.28;
    content: "";
    position: absolute;
    z-index: -1;
    pointer-events: none;
  }

  .page-v4 .authority-intro .authority-body::before {
    inset: -30px -42px;
    background: radial-gradient(
      ellipse at center,
      color-mix(in srgb, var(--ascii-canvas) 98%, transparent) 0%,
      color-mix(in srgb, var(--ascii-canvas) 88%, transparent) 58%,
      transparent 100%
    );
    filter: blur(11px);
  }

  .page-v4 .leader-content::before {
    inset: 14px -30px -30px;
    background: radial-gradient(
      ellipse at 50% 44%,
      color-mix(in srgb, var(--ascii-canvas) 96%, transparent) 0%,
      color-mix(in srgb, var(--ascii-canvas) 84%, transparent) 62%,
      transparent 100%
    );
    filter: blur(13px);
  }
}

/* Protege o título de ofertas sem lavar a paisagem da Superquadra. */
@media (min-width: 681px) {
  .page-v4 .offers-header {
    position: relative;
    isolation: isolate;
  }

  .page-v4 .offers-header::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -32px -56px;
    background: radial-gradient(
      ellipse at 50% 50%,
      color-mix(in srgb, var(--ascii-canvas) 96%, transparent) 0%,
      color-mix(in srgb, var(--ascii-canvas) 84%, transparent) 60%,
      transparent 100%
    );
    filter: blur(12px);
    pointer-events: none;
  }
}

/* The closing world starts behind the end of authority, without a dark section edge. */
.page-v4 .continuous-flow > .contact-section {
  padding-block: clamp(132px, 11vw, 180px) var(--section);
}

.page-v4 .continuous-flow > .contact-section::before {
  content: "";
  display: block;
  position: absolute;
  z-index: -2;
  top: -80px;
  right: 0;
  bottom: 0;
  left: 0;
  /* Keep the dark ramp close to the final CTA. */
  background: linear-gradient(
    to bottom,
    rgba(28, 25, 23, 0) 0%,
    rgba(28, 25, 23, 0.03) 10%,
    rgba(28, 25, 23, 0.16) 18%,
    rgba(28, 25, 23, 0.42) 26%,
    rgba(28, 25, 23, 0.72) 34%,
    rgba(28, 25, 23, 0.91) 44%,
    #1c1917 60%,
    #1c1917 100%
  );
  animation: none;
  transform: none;
  filter: none;
  opacity: 1;
  pointer-events: none;
}

.page-v4 .continuous-flow > .contact-section::after {
  content: "";
  display: block;
  position: absolute;
  z-index: -1;
  top: calc(0px - var(--flow-soft-start));
  right: 0;
  bottom: 0;
  left: 0;
  background: radial-gradient(ellipse 74% 48% at 50% 46%, rgba(255, 255, 255, 0.035), transparent 72%);
  pointer-events: none;
}

/* Catedral now belongs to the closing canvas and can emerge before the CTA content. */
.page-v4 .ascii-scene--cathedral {
  top: calc(0px - var(--cathedral-enter));
  right: auto;
  bottom: 0;
  left: 50%;
  width: min(calc(100% - (var(--gutter) * 2)), var(--container));
  overflow: visible;
  transform: translateX(-50%);
  -webkit-mask-image:
    radial-gradient(ellipse 38% 38% at 34% 58%, transparent 0 28%, rgba(0, 0, 0, 0.24) 52%, #000 100%),
    linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.12) 20%, #000 48%, #000 100%);
  mask-image:
    radial-gradient(ellipse 38% 38% at 34% 58%, transparent 0 28%, rgba(0, 0, 0, 0.24) 52%, #000 100%),
    linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.12) 20%, #000 48%, #000 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.page-v4 .ascii-scene--cathedral .ascii-scene__static,
.page-v4 .ascii-scene--cathedral .ascii-scene__motion {
  left: 4%;
  bottom: -18%;
  width: 92%;
}

@media (min-width: 681px) {
  .page-v4 .ascii-scene--cathedral {
    -webkit-mask-image:
      radial-gradient(ellipse 38% 38% at 30% 74%, transparent 0 28%, rgba(0, 0, 0, 0.24) 52%, #000 100%),
      linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.14) 9%, rgba(0, 0, 0, 0.32) 18%, #000 40%, #000 100%);
    mask-image:
      radial-gradient(ellipse 38% 38% at 30% 74%, transparent 0 28%, rgba(0, 0, 0, 0.24) 52%, #000 100%),
      linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.14) 9%, rgba(0, 0, 0, 0.32) 18%, #000 40%, #000 100%);
  }

  .page-v4 .ascii-scene--cathedral .ascii-scene__static,
  .page-v4 .ascii-scene--cathedral .ascii-scene__motion {
    bottom: 6%;
  }
}

.page-v4 .ascii-scene--cathedral .ascii-scene__label {
  top: auto;
  right: 28px;
  bottom: 26px;
}

/* The existing CTA card remains, but is embedded in the same dark atmosphere. */
.page-v4 .contact-panel {
  border: 1px solid rgba(255, 255, 255, 0.055);
  background: rgba(28, 25, 23, 0.84);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.025),
    0 30px 90px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.page-v4 .site-footer {
  border-top: 0;
  background: var(--flow-dark);
}

.page-v4 .site-footer__brand img {
  filter: invert(1) hue-rotate(172deg) saturate(2) brightness(0.914);
  opacity: 1;
}

.page-v4 .site-footer p,
.page-v4 .site-footer a {
  color: rgba(244, 242, 242, 0.62);
}

@media (max-width: 680px) {
  .page-v4 .continuous-flow > .contact-section::before {
    top: -24px;
  }

  .page-v4 {
    --flow-soft-start: 120px;
    --cathedral-enter: 168px;
  }

  .page-v4 .ascii-scene--hero {
    -webkit-mask-image:
      radial-gradient(
        ellipse 44% 27% at 50% 43%,
        rgba(0, 0, 0, 0.08) 0%,
        rgba(0, 0, 0, 0.16) 52%,
        rgba(0, 0, 0, 0.78) 80%,
        #000 100%
      ),
      linear-gradient(to bottom, #000 0%, #000 84%, rgba(0, 0, 0, 0.64) 93%, transparent 100%);
    mask-image:
      radial-gradient(
        ellipse 44% 27% at 50% 43%,
        rgba(0, 0, 0, 0.08) 0%,
        rgba(0, 0, 0, 0.16) 52%,
        rgba(0, 0, 0, 0.78) 80%,
        #000 100%
      ),
      linear-gradient(to bottom, #000 0%, #000 84%, rgba(0, 0, 0, 0.64) 93%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
  }

  .page-v4 .ascii-scene--superquadra {
    --scene-enter: 72px;
    --scene-exit: 132px;
  }

  .page-v4 .ascii-scene--bridge {
    --scene-enter: 112px;
    --scene-exit: 152px;
  }

  .page-v4 .continuous-flow > .contact-section {
    padding-block: 104px 72px;
  }

  .page-v4 .ascii-scene--cathedral {
    top: -168px;
    right: 0;
    left: 0;
    width: 100%;
    transform: none;
  }

  .page-v4 .ascii-scene--cathedral .ascii-scene__static,
  .page-v4 .ascii-scene--cathedral .ascii-scene__motion {
    left: calc(64% - 360px);
    bottom: -8%;
    width: 720px;
  }

  .page-v4 .contact-panel {
    box-shadow: 0 22px 58px rgba(0, 0, 0, 0.12);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-v4 .continuous-flow .ascii-scene img {
    animation: none !important;
  }
}
