/**
 * UI/UX Fixes for Mr. Ramanagowda Associates Website
 * Version: 4.2 - Dynamic Slider Scroll Support
 */

/* ============================================
   GLOBAL & NAVIGATION
   ============================================ */
html {
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

/* ============================================
   HERO SLIDER - UNIFORM IMAGES
   ============================================ */
.legal-hero-slider-container {
    height: 500px;
    width: 100%;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.legal-hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease-in-out, visibility 0.8s ease-in-out;
}

.legal-hero-slide.active {
    opacity: 1;
    visibility: visible;
}

.legal-hero-image-card {
    width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.legal-hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.legal-hero-image.contain-image {
    object-fit: contain;
    padding: 20px;
    background: #f8f9fa;
}

/* ============================================
   SLIDER SYSTEM (Testimonials, Services, About)
   ============================================ */

/* Outer wrapper */
.slider-outer-wrapper {
    position: relative;
    padding: 0 70px;
    /* Space for arrows */
    margin: 0 auto;
    max-width: 1200px;
    box-sizing: border-box;
}

/* Viewport - SCROLLABLE */
.legal-slider-viewport {
    overflow-x: auto;
    /* Enable horizontal scroll */
    overflow-y: hidden;
    /* Hide vertical */
    width: 100%;
    position: relative;
    padding: 20px 0;
    /* Vertical breathing room */

    /* Scroll Behavior & Snapping */
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;

    /* Hide Scrollbar Cross-Browser */
    -ms-overflow-style: none;
    /* IE/Edge */
    scrollbar-width: none;
    /* Firefox */
}

/* Hide Scrollbar Chrome/Safari/Opera */
.legal-slider-viewport::-webkit-scrollbar {
    display: none;
}

/* Navigation Arrows */
.legal-slider-arrow {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 20 !important;
    width: 50px !important;
    height: 50px !important;
    background: var(--white) !important;
    color: var(--gold-primary) !important;
    border: 2px solid var(--gold-primary) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease !important;
}

.legal-slider-arrow:hover {
    background: var(--gold-primary) !important;
    color: var(--white) !important;
    transform: translateY(-50%) scale(1.1) !important;
    box-shadow: 0 6px 16px rgba(197, 154, 68, 0.4);
}

.legal-slider-arrow.disabled {
    opacity: 0.5 !important;
    pointer-events: none !important;
    cursor: default !important;
}

.legal-slider-arrow.prev {
    left: 10px !important;
}

.legal-slider-arrow.next {
    right: 10px !important;
    left: auto !important;
}

.legal-slider-arrow svg {
    width: 24px;
    height: 24px;
}

/* ============================================
   CARD LAYOUTS & GRIDS (FIXED & UNIFORM)
   ============================================ */

.legal-testimonials-grid,
.legal-services-grid {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    /* Ensure horizontal flow */
    width: auto !important;
    /* Allow expansion beyond viewport */
    min-width: 100%;
    /* At least full width */
    gap: 30px !important;
}

/* Card Geometry */
.legal-testimonial-card,
.legal-services-grid .legal-service-card {
    /* Fixed calculation */
    /* Viewport width based basis: calc(33% of parent) */
    /* Note: parent is grid, grid is wide. Percentages refer to parent width. */
    /* IF parent expands infinitely, percentage is meaningless or huge. */
    /* WE NEED TO USE VIEWPORT WIDTH RELATIVE UNITS or FLEX BASIS. */
    /* In native scroll, standard practice is to use flex: 0 0 width. */

    /* With 3 cards per view visible (with 30px gaps): */
    /* Available width = 100% of Viewport */
    /* Card Width = (100% - 2*30px) / 3 ? No. */
    /* 3 cards + 2 gaps visible? Or 3 full cards + overflow? */

    /* To calculate width relative to viewport, we can use `min-width` or `width` with `vw` or container queries. */
    /* But standard flex basis on a scroll container works if parent is 100%. */
    /* Wait. If `.legal-services-grid` width is `auto`, it grows to fit contents. */
    /* So `33%` of `auto` is undefined/content-based. */
    /* FIX: We need explicit widths for cards if scrolling. */

    flex: 0 0 300px;
    /* Fallback fixed width */
    /* Better: Use CSS Grid or careful Calc. */
    /* Let's try `flex: 0 0 calc((100vw - 140px - 60px) / 3)` ? */
    /* 100vw includes scrollbar. Wrapper is 1200px max. */

    /* REVISION: Keep flex basis percentage but ensure grid is 100%? */
    /* If grid is 100% and overflow auto is on VIEWPORT, items shrink to fit 100%. */
    /* We want them to OVERFLOW. */
    /* So Grid Width must be Large. */
    /* Or we use `min-width` on cards. */

    min-width: 300px;
    /* Ensure minimum width */
    /* AND allow them to scale up? */

    /* Let's use a robust responsive width strategy for sliding. */
    /* Calc based on container width is tricky in CSS if container scrolls. */
    /* Actually, a common trick: */
    /* Grid width: fit-content? */
    /* Let's set `flex: 0 0 32%` (approx 1/3) RELATIVE TO VIEWPORT? */
    /* Viewport is the containing block for fixed positioning but Grid is the parent. */

    /* SOLUTION: */
    /* We can leave grid width: max-content (or just auto). */
    /* Set card width: 350px (approx desktop). */
    /* This breaks "3 per view" dynamic scaling. */

    /* RETRYING OLD LOGIC: */
    /* Pre-scroll logic worked because grid was transformed. Width was 100%. Cards shrunk. */
    /* Now we want native scroll. Grid must be wider than viewport. */
    /* We can set card width: calc( ( 100% - 60px ) / 3 )? */
    /* If grid width is "100%", cards shrink to fit. */
    /* If we set `flex-shrink: 0`, cards STAY at that calculated width and overflow! */
    /* YES! Relative to what? 100% of Grid. Grid is 100% of Viewport? */
    /* If Grid is `display: flex; width: 100%`, and items are `flex-shrink: 0`, do they overflow? */
    /* Flexbox spec: If items don't fit, they overflow the container. */
    /* So Grid overflows Viewport? Yes. */
    /* So `flex: 0 0 calc(33.333% - 20px)` works IF percentage resolves to Viewport width. */
    /* It resolves to Grid width. If Grid is constrained to Viewport width (initially), it works. */
    /* Let's verify: `width: 100%` on Grid. */

    flex: 0 0 calc(33.333% - 20px);
    max-width: calc(33.333% - 20px);

    scroll-snap-align: start;

    /* Uniform Height - Minimized */
    height: auto;
    min-height: 320px;

    /* Internal Layout */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;

    padding: 25px 20px;
    margin: 0 !important;
    box-sizing: border-box;

    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    overflow: hidden;

    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.legal-testimonial-card:hover,
.legal-services-grid .legal-service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

/* Content Typography & Spacing */
.legal-service-icon,
.legal-quote-icon {
    margin-bottom: 15px;
    flex-shrink: 0;
}

.legal-service-title,
.legal-author-name {
    margin-bottom: 10px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
}

.legal-service-description,
.legal-testimonial-text {
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-light);
    flex-grow: 1;
}

.legal-testimonial-author {
    margin-top: 15px;
    text-align: center;
}

/* ============================================
   RESPONSIVENESS
   ============================================ */

/* Tablet (2 items) */
@media (max-width: 992px) {

    .legal-testimonial-card,
    .legal-services-grid .legal-service-card {
        flex: 0 0 calc(50% - 15px);
        max-width: calc(50% - 15px);
    }

    .slider-outer-wrapper {
        padding: 0 60px;
    }
}

/* Mobile (1 item) */
@media (max-width: 768px) {

    .legal-testimonial-card,
    .legal-services-grid .legal-service-card {
        flex: 0 0 100%;
        /* Full width */
        max-width: 100%;
        min-height: auto;
    }

    .legal-testimonials-grid,
    .legal-services-grid {
        gap: 20px !important;
        /* Small gap for peek if needed, or 0 */
    }

    .slider-outer-wrapper {
        padding: 0 50px;
    }

    .legal-slider-arrow {
        width: 40px !important;
        height: 40px !important;
    }

    .legal-hero-slider-container {
        height: 350px;
    }
}