/* Fund Attributes Section - Apple-style carousel */

.fund-attributes-section {
  background: var(--color-black);
  position: relative;
  overflow: hidden;
  padding: 150px 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin: 0rem 0 50rem;
}

.fund-attributes-container {
  max-width: 100%;
}

.fund-attributes-header {
  text-align: center;
  margin-bottom: 60px;
  margin-left: auto;
  margin-right: auto;
}

/* Slider Container - Full Height with Scroll Animation */
.fund-attributes-slider {
  position: relative;
  width: 100%;
  height: 80vh;
  min-height: 900px;
  max-height: 1000px;
  overflow: visible;
  border-radius: 0;
  margin-left: auto;
  margin-right: auto;
  margin-top: -1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fund-attributes-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  width: 100%;
  height: 100%;
  position: relative;
  padding: 0;
  margin: 0 auto;
  box-sizing: border-box;
}

.fund-attributes-track::-webkit-scrollbar {
  display: none;
}

.fund-attributes-slide {
  position: absolute;
  width: calc(100vw - 2rem);
  height: 100%;
  box-sizing: border-box;
  opacity: 1;
  visibility: visible;
  transform: translateX(0) translateY(750px) translateZ(0);
  will-change: transform, opacity;
  z-index: 5;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  transition: none;
  /* Disable CSS transitions for GSAP control */
  padding: 1.5rem;
}

.fund-attributes-slide:last-child {
  margin-right: 0;
}

.fund-attributes-slide.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(0) translateY(0) translateZ(0);
  pointer-events: auto;
}

/* First slide - always below second slide */
.fund-attributes-slide:first-child {
  opacity: 1;
  visibility: visible;
  transform: translateX(0) translateY(0) translateZ(0);
  z-index: 5;
  pointer-events: auto;
}

/* Second slide - always above first slide, starts invisible */
.fund-attributes-slide:nth-child(2) {
  opacity: 0;
  visibility: visible;
  z-index: 10;
}

/* Inactive slides should not be interactive */
.fund-attributes-slide:not(.active) {
  pointer-events: none;
}

/* Add visual feedback for active slide with 3D effect */
.fund-attributes-slide:focus-within {
  transform: scale(1.02) translateZ(10px) rotateY(0deg);
}

/* Card Styling with enhanced 3D effects */
.fund-attributes-card {
  background: var(--color-black);
  border-radius: 24px;
  padding: 100px 80px 80px;
  height: 100%;
  min-height: 500px;
  max-height: max(550px, 60vh);
  display: flex;
  flex-direction: column;
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.25),
    0 8px 16px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
  min-width: 50vw;
  max-width: 1100px !important;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transform-style: preserve-3d;
  transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: auto;
  margin-right: auto;
}

#fund-card-1 {
  background-image: url('../sanity-images/fund-attributes-1.webp');
}

#fund-card-2 {
  background-image: url('../sanity-images/fund-attributes-2.webp');
}

.fund-attributes-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
}

.slide-title {
  font-family: var(--font-primary, 'Poppins', sans-serif);
  font-size: var(--section-header-size);
  font-weight: 600;
  color: var(--color-white);
  margin: 0 0 -1.25rem 0;
  text-align: left;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-weight: 400 !important;
}

/* Subtitle styling - more prominent and closer to title */
.slide-subtitle {
  font-size: 1.1rem !important;
  color: rgba(249, 249, 249, 0.85) !important;
  margin-bottom: 60px !important;
  font-weight: 400;
  text-align: left;
  line-height: 1.5;
}

#scale-occupancy-title {
  margin-bottom: 50px;
}

/* Add gradient overlay to improve disclaimer visibility */
.fund-attributes-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80%;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.5) 50%,
    rgba(0, 0, 0, 0.7) 100%
  );
  pointer-events: none;
  z-index: 1;
}

/* Ensure card content stays above overlay */
.fund-attributes-card > * {
  position: relative;
  z-index: 2;
}

/* Metrics Grid - Dynamic responsive grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 50px;
  flex: 1;
  align-items: center;
  /* Center grid items vertically */
  justify-items: stretch;
  /* Make all items the same width */
  width: 100%;
}

/* Make all metric tiles (including split) fill the grid cell height and width */
.metric-tile,
.split-tile {
  text-align: center;
  padding: 40px 35px;

  /* Glass Effect */
  --glass-radius: 16px;
  border-radius: var(--glass-radius);
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px) saturate(100%) brightness(0.9);
  -webkit-backdrop-filter: blur(10px) saturate(100%) brightness(0.8);
  box-shadow:
    0 8px 32px 0 rgba(0, 0, 0, 0.12),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 0 rgba(255, 255, 255, 0.06);
  border: none;

  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  max-height: 280px;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   GLASS EFFECT LAYERS
   ========================================= */

/* Gradient Border (Refraction) */
.metric-tile::before,
.split-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--glass-radius);
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.08) 25%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.08) 75%,
    rgba(255, 255, 255, 0.25) 100%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.7;
  transition: opacity 0.3s ease;
  z-index: 1;
}

/* Top Shine (Dome Effect) */
.metric-tile::after,
.split-tile::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0) 100%
  );
  opacity: 1;
  pointer-events: none;
  border-radius: var(--glass-radius) var(--glass-radius) 0 0;
  z-index: 1;
}

.metric-tile:hover,
.split-tile:hover {
  transform: translateY(-2px) translateZ(5px);
  background: rgba(0, 0, 0, 0.4);
  /* Slightly darker on hover for contrast */
  box-shadow:
    0 12px 40px 0 rgba(0, 0, 0, 0.18),
    0 2px 8px 0 rgba(255, 255, 255, 0.08),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 0 rgba(255, 255, 255, 0.08);
}

.metric-tile:hover::before,
.split-tile:hover::before {
  opacity: 1;
}

.metric-value {
  font-family: var(--font-primary, 'Poppins', sans-serif);
  font-size: 3.8rem;
  font-weight: 700;
  color: var(--color-accent-main);
  margin: 0 0 12px 0;
  line-height: 1;
  position: relative;
}

.metric-label {
  font-family: var(--font-secondary, 'Inter', sans-serif);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--color-white);
  line-height: 1.4;
  margin: 0;
  max-width: 275px !important;
  margin: 0 auto;
}

/* Split Tile Styling */
.split-tile {
  flex-direction: row;
  gap: 40px;
  padding: 35px 30px;
  align-items: center;
  justify-content: center;
  position: relative;
  /* Already has display: flex, height: 100%, width: 100% from above */
}

.split-tile > :first-child {
  position: relative;
}

.split-tile > :first-child::after {
  content: '';
  display: block;
  position: absolute;
  top: 5%;
  right: -20px;
  width: 1px;
  height: 90%;
  background: rgba(255, 255, 255, 0.1);
  z-index: 1;
}

.split-metric {
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1 1 0%;
}

.split-metric .metric-value {
  margin-bottom: 8px;
}

.split-metric .metric-value::after {
  width: 30px;
  height: 1.5px;
}

.split-metric .metric-label {
  font-size: 1rem;
  color: var(--color-white);
}

/* Card Footer */
.card-footer {
  margin-top: 40px;
  padding-top: 25px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footnote {
  font-family: var(--font-secondary, 'Inter', sans-serif);
  font-size: 0.9rem;
  color: var(--color-white);
  margin: 0;
  text-align: center;
  line-height: 1.4;
}

/* Controls */
.fund-attributes-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
}

/* Play/Pause Circle Container (Hidden - not used in scroll animation) */
.fund-play-pause-container {
  display: none;
}

.fund-slider-play-pause {
  display: none;
}

.fund-slider-play-pause i {
  display: none;
}

/* Dots Pill Container (Hidden - not used in scroll animation) */
.fund-dots-container {
  display: none;
}

/* Pagination Dots */
.fund-pagination-dots {
  display: flex;
  gap: 12px;
  align-items: center;
}

.fund-pagination-dot {
  background: none;
  border: none;
  height: 8px;
  min-width: 8px;
  border-radius: 5rem;
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255, 255, 255, 0.3);
  overflow: hidden;
  /* Clip the progress bar to the pill shape */
}

.fund-pagination-dot.active {
  width: 32px;
  background: rgba(255, 255, 255, 0.4);
}

.fund-pagination-dot:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

/* Progress Fill */
.dot-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--color-white);
  border-radius: 5rem;
  width: 8px;
  /* Start as a circle matching the dot height */
  min-width: 8px;
  /* Ensure minimum width for proper pill shape */
  transition:
    width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.2s ease;
  transform-origin: left;
  opacity: 0.9;
}

.fund-pagination-dot.active .dot-progress {
  opacity: 1;
}

.fund-pagination-dot.active .dot-progress.playing {
  /* Animation is now handled by JavaScript for precise timing */
  min-width: 8px;
  /* Ensure minimum width for proper pill shape */
}

.fund-pagination-dot.active .dot-progress.paused {
  animation-play-state: paused;
}

/* Simple progress fill animation */
@keyframes progress-fill {
  from {
    width: 8px;
  }

  to {
    width: 32px;
  }
}

/* Navigation Arrows (Hidden - not used in scroll animation) */
.fund-slider-btn {
  display: none;
}

.fund-slider-prev {
  left: 20px;
}

.fund-slider-next {
  right: 20px;
}

.fund-attributes-section:hover .fund-slider-btn {
  opacity: 1;
}

.fund-slider-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.05);
}

.fund-slider-btn svg {
  width: 16px;
  height: 16px;
  color: var(--color-white);
}

/* Tablet Styles */
@media (max-width: 1024px) {
  .fund-attributes-section {
    padding: 60px 0 80px;
    min-height: 1200px;
    max-height: 500px;
    margin-bottom: 0;
    padding-bottom: 0;
  }

  .fund-attributes-slider {
    min-height: 800px;
  }

  .fund-attributes-card {
    padding: 80px 70px 60px;
    min-height: none;
    max-height: none;
  }

  .metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 45px;
  }

  .metric-value {
    font-size: 3.4rem;
  }

  .slide-title {
    margin-bottom: 50px;
  }

  .fund-attributes-slide {
    width: calc(100vw - 0.5rem);
    padding: 1rem;
  }
}

/* Mobile Styles */
@media (max-width: 768px) {
  .fund-attributes-section {
    padding: 50px 0 60px;
  }

  .fund-attributes-container {
    padding: 0;
  }

  .fund-attributes-slider {
    height: auto;
    margin-bottom: 30px;
  }

  .fund-attributes-slide {
    height: auto;
  }

  /* Make first slide relative on mobile so container takes its height */
  .fund-attributes-slide:first-child {
    position: relative;
  }

  /* Align other slides to bottom so they are visible when pinned at bottom */
  .fund-attributes-slide:not(:first-child) {
    bottom: 0;
    top: auto;
  }

  .fund-attributes-card {
    padding: 40px 1.5rem 40px;
    height: auto;
    min-height: 70vh;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 35px;
  }

  .metric-tile {
    padding: 40px 35px;
  }

  .metric-value {
    font-size: 3rem;
  }

  .slide-title {
    margin-bottom: 40px;
  }

  .fund-slider-btn {
    width: 40px;
    height: 40px;
  }

  .fund-slider-btn svg {
    width: 16px;
    height: 16px;
  }

  .fund-play-pause-container {
    width: 44px;
    height: 44px;
  }

  .fund-dots-container {
    height: 44px;
    padding: 0 16px;
  }

  .fund-slider-prev {
    left: 16px;
  }

  .fund-slider-next {
    right: 16px;
  }

  .fund-attributes-track {
    padding: 0 1rem;
  }
}

/* Large Desktop - More columns for wider screens */
@media (min-width: 1400px) {
  .metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 60px;
  }
}

/* Extra Large Desktop - Even more columns for very wide screens */
@media (min-width: 1800px) {
  .metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 70px;
  }
}

/* Fine-tuned grid layouts for specific column counts */
.metrics-grid.grid-1-col {
  grid-template-columns: 1fr;
  justify-items: center;
}

.metrics-grid.grid-2-col {
  grid-template-columns: repeat(2, 1fr);
}

.metrics-grid.grid-3-col {
  grid-template-columns: repeat(3, 1fr);
}

.metrics-grid.grid-4-col {
  grid-template-columns: repeat(4, 1fr);
}

.metrics-grid.grid-5-col {
  grid-template-columns: repeat(5, 1fr);
}

/* Special handling for split tiles in different grid configurations */
.metrics-grid.grid-2-col .split-tile {
  grid-column: span 2;
}

.metrics-grid.grid-4-col .split-tile {
  grid-column: span 2;
}

.metrics-grid.grid-5-col .split-tile {
  grid-column: span 2;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .fund-attributes-track {
    scroll-behavior: auto;
  }

  .metric-tile,
  .fund-slider-btn,
  .fund-pagination-dot,
  .fund-play-pause-container,
  .fund-dots-container {
    transition: none;
  }

  .fund-pagination-dot.active .dot-progress {
    animation: none;
    width: 100%;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .fund-attributes-card {
    border: 2px solid var(--color-white);
  }

  .metric-tile {
    border: 1px solid rgba(255, 255, 255, 0.3);
  }

  .fund-slider-btn,
  .fund-slider-play-pause {
    border: 1px solid rgba(60, 60, 67, 0.3);
  }
}

/* Fund Attributes Disclaimers Section */
.fund-attributes-disclaimers {
  position: relative;
  bottom: 10rem;
  max-width: 1250px;
  width: 100%;
  margin: 0 auto;
  z-index: 2;
  opacity: 0;
  visibility: hidden;
  /* Initial state - GSAP controls visibility */
}

.fund-attributes-disclaimers .disclaimer {
  font-family: var(--font-secondary, 'Inter', sans-serif);
  font-size: 0.85rem;
  color: rgba(249, 249, 249, 0.6);
  line-height: 1.6;
  margin: 0 0 1.25rem 0;
  text-align: left;
}

.fund-attributes-disclaimers .disclaimer:last-child {
  margin-bottom: 0;
}

/* Tablet Styles for Disclaimers */
@media (max-width: 1024px) {
  .fund-attributes-disclaimers {
    padding: 0 70px;
    margin-top: 13rem;
  }
}

/* Mobile Styles for Disclaimers */
@media (max-width: 768px) {
  .fund-attributes-disclaimers {
    padding: 0 1.5rem;
    width: 100%;
    margin-bottom: -8rem;
  }

  .fund-attributes-disclaimers .disclaimer {
    font-size: 0.75rem;
    margin-bottom: 1rem;
  }
}
