/**
 * ICA Past Faculty Slider Styles
 * 
 * Optimized for performance with CSS Grid, scroll-snap,
 * and responsive design. Includes accessibility features.
 * Features faculty member cards with name, role, and credits.
 * 
 * INTEGRATES WITH SITE GRID RAILS SYSTEM:
 * - Uses grid-column: full-start / full-end for full-width edge-to-edge display
 * - Background spans entire viewport width
 * - Internal content has proper spacing via padding-inline
 * - Leverages CSS custom properties for consistent spacing
 * 
 * @package Illinois_Conservatory
 * @since 1.0.0
 */

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.ica-faculty-contain {
    contain: layout style paint; /* Self-contained component - no need to affect body */
}

/* ==========================================================================
   Component Containment
   ========================================================================== */

/* ==========================================================================
   Main Slider Wrapper - CLS Prevention
   ========================================================================== */

/* Main section - uses full grid rails for background */
.ica-faculty-section {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 10px 0; /* Only top/bottom margins */
    padding: 0;
    overflow: visible;
    box-sizing: border-box;
    /* Use .ica-faculty-contain utility class instead */
    min-height: 60vh;
    /* Use site grid rails system */
    grid-column: full-start / full-end;
}

/* Parent Container: Full width edge-to-edge */
.ica-faculty-container {
    /* Use full grid rails for edge-to-edge display */
    grid-column: full-start / full-end;
    width: 100%;
    max-width: none; /* Remove content size constraint */
    margin: 0; /* Remove auto margins */
    padding: 0; /* Remove padding constraints */
    box-sizing: border-box;
    min-width: 0; /* Allow shrinking */
    display: flex;
    flex-direction: column;
    gap: 0; /* No gap between children */
}

/* Remove all manual responsive margin rules - now handled by site grid rails */

/* Marquee Container - Independent of slider container */
.ica-faculty-marquee-container {
    width: 100%;
    overflow: hidden;
}

.ica-faculty-marquee {
    display: flex;
    align-items: center;
    white-space: nowrap;
    animation: ica-faculty-marquee-scroll 45s linear infinite;
}

.ica-faculty-marquee-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.ica-faculty-marquee-text {
    font-family: var(--font-ui, 'Termina', sans-serif);
    font-size: 50px;
    font-weight: 500;
    color: var(--ica-green-deep, #03332E);
    text-transform: uppercase;
    letter-spacing: 2px;
    flex-shrink: 0;
    white-space: nowrap;
}

.ica-faculty-marquee-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Marquee Animation - Starts visible and loops seamlessly */
@keyframes ica-faculty-marquee-scroll {
    0% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* Marquee continues on hover - no pause */

/* Mobile marquee text size and faster speed */
@media (max-width: 767px) {
    .ica-faculty-marquee-text {
        font-size: 34px;
    }
    
    .ica-faculty-marquee {
        animation: ica-faculty-marquee-scroll 25s linear infinite; /* Faster speed: 40s → 25s */
    }
}

/* 2nd Child: Faculty Container with Navigation Outside */
.ica-faculty-cards-container {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: row; /* Row layout: [nav-prev] [faculty-cards] [nav-next] */
    align-items: center; /* Center vertically */
    gap: 10px; /* Space between nav and faculty cards */
    /* Add internal padding for edge-to-edge layout */
    padding-inline: var(--wp--style--root--padding-left, 1rem)
                    var(--wp--style--root--padding-right, 1rem);
    box-sizing: border-box;
}

/* Navigation buttons - positioned outside faculty cards */
.ica-faculty-cards-container .ica-faculty-nav {
    flex-shrink: 0; /* Don't shrink navigation buttons */
}

/* Faculty cards wrapper - full width within faculty container */
.ica-faculty-cards-container .ica-faculty-wrapper {
    position: relative;
    /* Use .ica-faculty-contain utility class instead */
    overflow: visible;
    border-radius: 0;
    box-shadow: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex: 1; /* Take remaining space */
    min-width: 0; /* Allow flex item to shrink below content size */
}

/* 3rd Child: Progress Bar Container */
.ica-faculty-progress-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 50px; /* Use the larger margin value */
    padding: 0;
    width: 100%;
}


/* ==========================================================================
   Slider Track (Grid Layout)
   ========================================================================== */

.ica-faculty-track {
    display: grid;
    grid-auto-flow: column;
    overflow-x: auto;
    overflow-y: visible; /* Allow vertical hover effects */
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Firefox */
    gap: 0;
    padding: 5px 0; /* Add vertical padding for hover space */
    font-size: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    cursor: grab;
    user-select: none; /* Prevent text selection during drag */
    /* CLS Prevention: Reserve space and optimize rendering */
    min-height: 40vh;
    /* Use .ica-faculty-contain utility class instead */
    will-change: scroll-position;
    min-width: 0; /* Allow grid to shrink below content size */
    
    /* Hide scrollbar for Webkit browsers */
    &::-webkit-scrollbar {
        display: none;
    }
}

.ica-faculty-track:active {
    cursor: grabbing;
}

/* Smooth scrolling for users who prefer motion */
@media (prefers-reduced-motion: no-preference) {
    .ica-faculty-track {
        scroll-behavior: smooth;
    }
}

/* ==========================================================================
   Responsive Grid Columns
   ========================================================================== */

/* Mobile: 1 slide per view (below 600px) */
.ica-faculty-track {
    grid-auto-columns: 100%;
    gap: 10px;
}

/* Small Tablet: 2 slides per view (601px to 1080px) */
@media (min-width: 601px) {
    .ica-faculty-track {
        grid-auto-columns: calc(50% - 5px);
        gap: 10px;
    }
}

/* Desktop: 3 slides per view (1081px+) */
@media (min-width: 1081px) {
    .ica-faculty-track {
        grid-auto-columns: calc(33.333% - 10px);
        gap: 15px;
    }
}

/* Ultra: 4 slides per view (1600px+) */
@media (min-width: 1600px) {
    .ica-faculty-track {
        grid-auto-columns: calc(25% - 15px);
        gap: 20px;
    }
}

/* ==========================================================================
   Slider Items
   ========================================================================== */

/* Cloned slides are hidden from screen readers via aria-hidden attribute in JavaScript */

.ica-faculty-item {
    height: auto; /* Let content determine height */
    scroll-snap-align: start;
    position: relative;
    margin: 0;
    padding: 0;
    border: none;
    /* CLS Prevention: Reserve space and optimize rendering */
    /* Use .ica-faculty-contain utility class instead */
    display: block;
    width: 100%; /* Full width of grid column */
}
/* ==========================================================================
   Person Card Design
   ========================================================================== */

/* 1. The Main Card Container - Positioning Context Only */
.ica-faculty-card {
    position: relative; /* This is the positioning context */
    width: 100%;
    display: block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    aspect-ratio: 3 / 4; /* Keep aspect ratio for consistent card proportions */
    
    /* REMOVED - These were clipping the text box */
    /* border-radius: 30px; */
    /* overflow: hidden; */
}


/* 2. The Image Container - Rounded Image Only */
.ica-faculty-card-image-container {
    /* ADD THESE properties from .ica-faculty-card */
    position: relative; /* Use relative, not absolute */
    border-radius: 30px;
    overflow: hidden;
    
    /* REMOVED - These were causing layout issues */
    /* position: absolute; */
    /* top: 0; */
    /* left: 0; */
    /* right: 0; */
    /* bottom: 0; */
    /* aspect-ratio: 3 / 4; */
    width: 100%;
    height: 100%; /* Fill the parent card container */
}

.ica-faculty-card-image-container img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    background-color: #f5f5f5; /* Placeholder color while loading */
}

/* 3. The Text Box - Positioned below image, 35px from bottom */
.ica-faculty-card-info-box {
    position: absolute;        /* Positioned absolutely over the background image */
    bottom: 15px;             /* Positioned 15px from bottom of card */
    left: 50%;                /* Center horizontally */
    transform: translateX(-50%);
    width: 90%;               /* 90% width */
    z-index: 2;               /* Above the background image */
    background: #f9f6f4 !important; /* Solid background */
    color: var(--ica-green-deep, #03332E); /* Green text color */
    padding: 20px;             /* Space inside the box */
    text-align: center;        /* Center all text content */
    min-height: 80px;          /* Ensure consistent text box height */
    display: flex;
    flex-direction: column;
    justify-content: center;   /* Center content vertically */
    align-items: center;       /* Center content horizontally */
}

/* 4. The Text Styling - Green deep color for all text */
.ica-faculty-person-name {
    font-family: var(--font-ui, 'Termina', sans-serif) !important;
    font-size: 16px !important;
    font-weight: 600;          /* Extra bold for name */
    color: var(--ica-green-deep, #03332E); /* Green deep color */
    margin: 0 0 6px 0;        /* More space below the name */
    text-transform: uppercase;
    letter-spacing: 0.5px;    /* Slight letter spacing for elegance */
    line-height: 1.2;
}

.ica-faculty-person-credit {
    font-family: var( --font-body, sans-serif) !important;
    font-style: italic;
    font-weight: 500 !important;
    font-size: 12px;
    color: var(--ica-green-deep);
    margin: 0 0 4px 0;        /* Small space between credit and role */
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 500;
}

.ica-faculty-person-role {
    font-family: var( --font-body, sans-serif) !important;
    font-size: 12px;
    color: var(--ica-green-deep, #03332E); /* Green deep color */
    margin: 0;                /* No margin at bottom */
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 400;
}

/* ==========================================================================
   Responsive Person Card Design
   ========================================================================== */

/* REMOVED: Mobile media query that was breaking consistent design */

/* Medium mobile screens: Adjust font sizes */
@media (min-width: 481px) and (max-width: 767px) {
    .ica-faculty-person-name {
        font-size: 17px !important;
    }
    
    .ica-faculty-person-credit {
        font-size: 11px;
    }
    
    .ica-faculty-person-role {
        font-size: 10px;
    }
    
    
    .ica-faculty-marquee-icon {
        width: 40px;
        height: 40px;
    }
    
    .ica-faculty-marquee-content {
        gap: 15px;
    }
}

/* Large mobile/small tablet: Adjust person name font size */
@media (min-width: 768px) and (max-width: 850px) {
    .ica-faculty-person-name {
        font-size: 14px !important;
    }
}

/* Mobile: Adjust card size for smaller screens */
@media (max-width: 480px) {
    
    /* Responsive navigation buttons for small screens */
    .ica-faculty-cards-container .ica-faculty-nav {
        width: 32px !important;
        height: 32px !important;
    }
    
    .ica-faculty-cards-container .ica-faculty-nav span {
        font-size: 14px;
    }
    
    .ica-faculty-card-info-box {
        padding: 10px 08px 10px 08px;
        min-height: 70px;
    }
    .ica-faculty-person-credit,
    .ica-faculty-person-role {
        font-size: 14px;
        letter-spacing: 0.2px;
    }
    
    /* Mobile marquee adjustments */
    .ica-faculty-marquee-text {
        letter-spacing: 1px;
    }
    
    .ica-faculty-marquee-icon {
        width: 36px;
        height: 36px;
    }
    
    .ica-faculty-marquee-content {
        gap: 10px;
    }
    
}

/* Extra small screens: Even smaller navigation buttons */
@media (max-width: 410px) {
    .ica-faculty-cards-container .ica-faculty-nav {
        width: 28px;
        height: 28px;
    }
    
    .ica-faculty-cards-container .ica-faculty-nav span {
        font-size: 12px;
    }
}

/* Tablet: Medium adjustments */
@media (min-width: 851px) and (max-width: 1199px) {
    
    .ica-faculty-card-info-box {
        padding: 16px 18px 18px 18px;
        min-height: 75px;
    }
}

/* Desktop: Full styling */
@media (min-width: 1200px) {
    
    .ica-faculty-card-info-box {
        padding: 15px 10px 15px 10px;
        min-height: 80px;
    }
}


/* ==========================================================================
   Navigation Controls - Performance Optimized
   ========================================================================== */


.ica-faculty-cards-container .ica-faculty-nav {
    position: relative; /* Changed from absolute to relative */
    background: rgba(255, 255, 255, 0.9);
    color: var(--ica-green-deep, #03332E);
    border: 1px solid rgba(0, 0, 0, 0.08);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.14);
    z-index: 10;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto;
    /* Use .ica-faculty-contain utility class instead */
}

.ica-faculty-cards-container .ica-faculty-nav:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05); /* Removed translateY since we're using relative positioning */
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.2);
    will-change: transform, background-color;
}

.ica-faculty-cards-container .ica-faculty-nav:active {
    transform: scale(0.95); /* Removed translateY since we're using relative positioning */
}

.ica-faculty-cards-container .ica-faculty-nav:focus {
    outline: 2px solid var(--ica-green-deep, #03332E);
    outline-offset: 2px;
}

.ica-faculty-cards-container .ica-faculty-nav span {
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
}

/* Navigation buttons remain visible on all screen sizes */


/* ==========================================================================
   Progress Bar Container - Second Main Container
   ========================================================================== */


.ica-faculty-progress-container {
    position: relative;
    width: 200px;
    height: 4px;
    background: rgba(0, 0, 0, 0.1); /* Slightly darker background for better visibility */
    border-radius: 2px;
    overflow: hidden;
    z-index: 10;
    flex-shrink: 0; /* Prevent shrinking in flexbox */
}

.ica-faculty-progress-bar {
    height: 100%;
    background: var(--ica-green-deep, #03332E);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
    display: block; /* Ensure it's a block element */
    margin: 0; /* Remove any default margins */
    position: relative; /* Ensure proper positioning */
}

/* ==========================================================================
   Accessibility & Motion Preferences
   ========================================================================== */

/* Moved to consolidated reduced motion block at end of file */

/* High contrast mode support */
@media (prefers-contrast: high) {
    
    .ica-faculty-progress-container {
        background: #000;
    }
    
    .ica-faculty-progress-bar {
        background: #fff;
    }
}

/* ==========================================================================
   Focus Management
   ========================================================================== */

/* Focus management is handled by the navigation buttons themselves */

/* ==========================================================================
   Loading States - LCP Optimized
   ========================================================================== */

.ica-faculty-item__img {
    opacity: 1;
    transition: opacity 0.3s ease;
    /* LCP Optimization: Prevent layout shift */
    background-color: #f5f5f5;
    background-image: linear-gradient(90deg, #f0f0f0 25%, transparent 25%);
    background-size: 20px 20px;
    animation: shimmer 1.5s infinite;
}

.ica-faculty-item__img[loading="eager"] {
    /* Critical: First image for LCP */
    opacity: 1;
    background: none;
    animation: none;
}

.ica-faculty-item__img[loading="lazy"] {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.ica-faculty-item__img[loading="lazy"].loaded {
    opacity: 1;
    background: none;
    animation: none;
}

/* Shimmer loading animation */
@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}


/* ==========================================================================
   Accessibility - Screen Reader Support
   ========================================================================== */

.ica-faculty-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Core Web Vitals Optimizations
   ========================================================================== */

/* LCP optimization handled in PHP - no CSS interference needed */

/* Moved to consolidated reduced motion block at end of file */

/* Performance optimization for low-end devices */
@media (max-width: 768px) {
    /* Mobile optimizations handled by utility classes */
    
    .ica-faculty-item__img {
        will-change: auto; /* Reduce GPU usage on mobile */
    }
    
    /* Reduce animations on mobile for better performance */
}

/* High DPI display optimizations - removed incorrect image-rendering */

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ica-faculty-item__img {
        background-color: #2a2a2a; /* Darker placeholder */
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .ica-faculty-nav,
    .ica-faculty-progress-container {
        display: none;
    }
    
    .ica-faculty-track {
        overflow: visible;
        display: block;
    }
    
    .ica-faculty-item {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}

/* ==========================================================================
   Consolidated Accessibility & Motion Preferences
   ========================================================================== */

/* Respect user's motion preferences - consolidated from multiple locations */
@media (prefers-reduced-motion: reduce) {
    .ica-faculty-track {
        scroll-behavior: auto;
    }
    
    .ica-faculty-item__img {
        animation: none !important;
        transition: none !important;
    }
    
    .ica-faculty-progress-bar {
        transition: none !important;
    }
    
    .ica-faculty-nav {
        transition: none !important;
    }
    
    .ica-faculty-card {
        transition: none !important;
    }
}
