/* Core Pillar 5: Tax Efficient Structure Section */


#pillar-portfolio-scale {
  --scrub-vh: 115;
  /* Reduced scroll distance */
  --p: 0;
  /* 0..1 entire section progress */
  --t: 0;
  /* 0..1 only in last 10% to shrink/dock */
  margin-top: -5rem;
  height: calc(var(--scrub-vh) * 1vh);
  position: relative;
  overflow: clip;
  background: var(--color-black);
}

/* Sticky container for the video */
#pillar-portfolio-scale .pillar-video-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* Video scaler - container shrinks to crop the video */
#pillar-portfolio-scale .video-scaler {
  position: absolute;
  /* Container shrinks - width matches Pillar 1, height made taller */
  /* Keep 15vw horizontal insets for 70% width */
  /* Reduce vertical insets for taller final height */
  top: calc(var(--p) * (30vh));
  /* Reduced from 15vh to 8vh + slide down */
  bottom: calc(var(--p) * 16vh);
  /* Reduced from 15vh to 8vh */
  left: calc(var(--p) * 15vw);
  right: calc(var(--p) * 15vw);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(var(--p) * 2.5rem);
  overflow: hidden;
  will-change: top, bottom, left, right, border-radius;
  z-index: 1;
}

/* Video stays at fixed viewport size - positioned absolutely */
#pillar-portfolio-scale .video-scaler .pillar-video {
  position: absolute;
  top: calc(var(--p) * - (8vh + 14vh));
  /* Counter the container offset */
  left: calc(var(--p) * -15vw);
  width: 100vw;
  /* Always full viewport width */
  height: 100vh;
  /* Always full viewport height */
  object-fit: cover;
  object-position: center center;
  display: block;
  pointer-events: none;
  filter: saturate(1.2) contrast(1.1);
}

/* Curtain removed for pillar 5 - no curtain effect */
#pillar-portfolio-scale .video-curtain {
  display: none;
}

/* Overlay with gradient for title visibility */
#pillar-portfolio-scale .pillar-video-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(to bottom,
      rgba(0, 0, 0, 0.9) 0%,
      rgba(0, 0, 0, 0.6) 50%,
      rgba(0, 0, 0, 0.2) 100%);
  backdrop-filter: contrast(1.1);
  padding: 2rem;
  pointer-events: none;
  z-index: 3;
  /* Above video-scaler so it doesn't scale with video */
  /* Start visible */
  opacity: 1;
}

/* Video Title - matches Pillar 3 styling */
#pillar-portfolio-scale .pillar-video-title {
  font-size: var(--section-header-size);
  line-height: 1.2;
  font-weight: 400;
  text-align: center;
  color: var(--color-white);
  max-width: 900px;
  margin: 0;
  letter-spacing: -0.03em;
  /* Start visible, will fade out with overlay */
  opacity: 1;
  transform: translateY(0);
}

#pillar-portfolio-scale .pillar-video-title .header-tag {
  text-align: center;
  margin: 2rem auto 0.2rem auto;
  max-width: 100%;
  color: var(--color-accent-main);
}

#pillar-portfolio-scale .pillar-video-title h3 {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

/* Pillar 5 Content Container */
#pillar5-content {
  max-width: 75vw;
  /* Match the final width of the scaled video */
  margin: -1rem auto 6rem;
  padding: 0 5rem 5rem;
  opacity: 0;
  /* Start hidden for animation */
  transform: translateY(30px);
}

/* Caption styling - matches Pillar 1 style */
#pillar5-content .caption {
  font-size: 0.9rem;
  font-weight: 100;
  color: var(--color-accent-main);
  margin-bottom: 2rem;
  text-align: left;
  margin-top: -4.5rem;
}

/* Two-column grid: one large point on left, two stacked on right */
.pillar5-points-grid {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 3rem;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

/* Main point - left column, larger text */
.pillar5-point-main {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pillar5-point-main p {
  font-size: clamp(1.5rem, 2vw, 2rem);
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.95);
  margin: 0;
  font-weight: 600;
}

/* Stacked points - right column, smaller text */
.pillar5-points-stacked {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  justify-content: center;
}

.pillar5-point-small p {
  font-size: clamp(1.125rem, 1.5vw, 1.25rem);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  font-weight: 400;
}

/* Responsive Design */
@media (max-width: 900px) {
  #pillar5-content {
    max-width: 85vw;
  }

  .pillar5-points-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .pillar5-point-main p {
    font-size: clamp(1.75rem, 3vw, 2.25rem);
  }

  .pillar5-point-small p {
    font-size: clamp(1.25rem, 2vw, 1.5rem);
  }

  /* Caption styling - matches Pillar 1 style */
  #pillar5-content .caption {
    margin-top: -13.5rem;
  }

  .pillar5-points-grid {
    margin-top: -2rem;
  }

  /* Video scaler - container shrinks to crop the video */
  #pillar-portfolio-scale .video-scaler {
    top: calc(var(--p) * 38vh);
    /* Reduced from 15vh to 8vh + slide down */
    bottom: calc(var(--p) * 32vh);
    /* Reduced from 15vh to 8vh */
    left: calc(var(--p) * 1vw);
    right: calc(var(--p) * 1vw);
  }

  /* Video stays at fixed viewport size - positioned absolutely */
  #pillar-portfolio-scale .video-scaler .pillar-video {
    position: absolute;
    top: 0;
    /* Reduced from 15vh to 8vh + slide down */
    bottom: 0;
    /* Reduced from 15vh to 8vh */
    left: 3rem;
    left: 0;
    right: calc(var(--p) * 1vw);
    width: 100vw;
    /* Always full viewport width */
    height: 100vh;
    /* Always full viewport height */
    object-fit: cover;
    object-position: center center;
    display: block;
    pointer-events: none;
    filter: saturate(1.2) contrast(1.1);
    padding-bottom: calc(var(--p) * 70vh);
  }
}

@media (max-width: 600px) {
  #pillar5-content {
    max-width: 90vw;
    padding: 0 1rem;
  }

  .pillar5-points-grid {
    gap: 1.25rem;
  }
}