/* 
 * UCF Carousel Stylesheet v1.3
 * Responsive image carousel with accessibility features and smooth animations
 * Implements 3-slide desktop layout with blurred previews and mobile-optimized single slide
 */

/* Ensure body uses theme variables for consistent theming */
body {
  background: var(--bg);
  color: var(--text);
  transition: background 240ms ease, color 240ms ease;
}

/* Main header layout with logo and title */
header { display:flex; align-items:center; gap:12px; margin-bottom:18px; }
.logo { height:56px; width:56px; background: linear-gradient(135deg,var(--accent), #7dd3fc); border-radius: var(--radius); display:flex; align-items:center; justify-content:center; font-weight:700; color:var(--accent-contrast); box-shadow: 0 4px 12px rgba(0,0,0,0.06); flex:0 0 56px; }
.hero { display:flex; flex-direction:column; gap:18px; margin-top:18px; }
.card { display:flex; gap:12px; align-items:center; justify-content:space-between; flex-wrap:wrap; }
.cta { display:flex; gap:12px; align-items:center; }
footer { margin-top:18px; color:var(--muted); font-size:0.9rem; display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; }

/* =============================
   Carousel Core Structure
   ============================= */

.ucf-carousel { margin-top: 18px; }

/* Main viewport container with constrained dimensions and hidden overflow */
.ucf-viewport {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  overflow: hidden; /* Contain absolutely positioned slides */
  border-radius: var(--radius);
  min-height: 220px;
  height: auto;
}

/* Track uses padding-bottom technique to maintain 16:9 aspect ratio */
.ucf-track {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

/* Base slide styling - absolutely positioned to fill track */
.ucf-slide {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: block;
  width: 100%;
  height: 100%;
  transition: all 420ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform, opacity, filter, left;
  opacity: 0;
  transform: translateX(0) scale(0.98);
  z-index: 0;
  pointer-events: none; /* Prevent interaction with inactive slides */
}

/* Active slide state - fully visible and interactive */
.ucf-slide.active {
  opacity: 1;
  transform: translateX(0) scale(1);
  z-index: 4;
  pointer-events: auto;
}

/* Adjacent slide states - positioned but hidden on mobile */
.ucf-slide.prev,
.ucf-slide.next {
  opacity: 0;
  z-index: 2;
}

/* Image handling with object-fit for consistent aspect ratio maintenance */
.ucf-slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* Maintain aspect ratio while filling container */
  display: block;
  border-radius: var(--radius);
  -webkit-user-drag: none; /* Prevent image dragging */
  max-width: 100%;
  max-height: 100%;
}

/* Overlay container system for captions and usernames */
.ucf-overlay { 
  position: absolute; 
  left: 12px; 
  right: 12px; 
  z-index: 6; 
  pointer-events: none; /* Allow clicks to pass through to underlying slide */
}

/* Username overlay positioned at top with semi-transparent background */
.ucf-username {
  top: 12px;
  font-weight: 700;
  font-size: 1rem;
  background: rgba(0,0,0,0.24);
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--accent-contrast);
  display: inline-block;
  max-width: fit-content;
}

/* Caption container positioned at bottom with flex alignment */
.ucf-caption { 
  bottom: 12px; 
  display: flex; 
  align-items: flex-end;
  justify-content: flex-start;
  pointer-events: none; 
}

/* Individual caption styling with gradient background and smooth transitions */
.ucf-caption-inner {
  max-width: calc(100% - 24px);
  padding: 10px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(0,0,0,0.42), rgba(0,0,0,0.28));
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
  line-height: 1.25;
  font-size: 0.95rem;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 260ms ease, transform 260ms ease;
  pointer-events: none;
}

/* Active slide caption visibility */
.ucf-slide.active .ucf-caption-inner {
  opacity: 1;
  transform: translateY(0);
}

/* Dot indicator styling for slide navigation */
.carousel-controls { text-align: center; margin-top: 10px; padding-bottom: 8px; }
.carousel-dot {
  display:inline-block;
  width:10px; height:10px; border-radius:50%;
  margin:0 6px;
  cursor:pointer;
  border: none;
  background: var(--muted);
  opacity: 0.18;
  transition: opacity 180ms ease, transform 180ms ease;
  min-width: 34px; min-height: 34px; display:inline-flex; align-items:center; justify-content:center;
}
.carousel-dot.active { opacity: 0.9; transform: scale(1.05); }
.carousel-dot:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; border-radius: 50%; }

/* Navigation arrow buttons with backdrop filter for glass effect */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 12;
  background: rgba(0,0,0,0.28);
  color: #fff;
  border: none;
  padding: 10px 12px;
  font-size: 20px;
  border-radius: 10px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 160ms ease, transform 120ms ease;
}
.carousel-arrow:hover { transform: translateY(-50%) scale(1.03); background: rgba(0,0,0,0.36); }
.carousel-arrow:focus-visible { outline: 3px solid var(--focus-ring); }
.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }

/* =============================
   Desktop-Specific Layout
   Implements 3-slide layout with active center and blurred previews
   ============================= */
@media(min-width:720px) {
  /* Center slides horizontally with constrained width */
  .ucf-slide {
    transition: all 420ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    width: 68%;
    left: 50%;
    transform: translateX(-50%) scale(0.98);
  }

  /* Active slide centered with full opacity */
  .ucf-slide.active { 
    transform: translateX(-50%) scale(1); 
    opacity: 1; 
    z-index: 4; 
    left: 50%;
  }

  /* Previous slide positioned left with blur and saturation effects */
  .ucf-slide.prev {
    left: 14%;
    transform: translateX(-50%) scale(0.92);
    filter: blur(4px) saturate(0.8) brightness(0.8);
    opacity: 0.85;
    width: 34%;
    z-index: 3;
    pointer-events: none;
  }

  /* Next slide positioned right with matching effects */
  .ucf-slide.next {
    left: 86%;
    transform: translateX(-50%) scale(0.92);
    filter: blur(4px) saturate(0.8) brightness(0.8);
    opacity: 0.85;
    width: 34%;
    z-index: 3;
    pointer-events: none;
  }

  /* Hidden slides with delayed opacity transition for smooth exit */
  .ucf-slide:not(.active):not(.prev):not(.next) {
    opacity: 0;
    transform: translateX(-50%) scale(0.9);
    z-index: 0;
    filter: none;
    pointer-events: none;
    transition: all 320ms cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 200ms ease 120ms;
  }
}

/* Mobile optimization for smaller screens */
@media (max-width: 420px) {
  .logo { height:48px; width:48px; font-size:0.9rem; }
  .ucf-viewport { min-height: 180px; }
  .ucf-caption-inner { padding:8px 10px; font-size:0.92rem; }
}