/* TCM Case Study Carousel Styles */

/* ===========================
   Elementor Widget Wrapper
   =========================== */

.tcm-csc-wrapper {
    width: 100%;
    max-width: 100%;
    position: relative;
    min-height: 600px;
    overflow: visible;
}

/* Elementor widget container fixes */
.elementor-widget-tcm_case_study_carousel {
    width: 100%;
    overflow: visible;
}

.elementor-widget-tcm_case_study_carousel .elementor-widget-container {
    width: 100%;
    max-width: 100%;
    overflow: visible;
}

/* ===========================
   Container
   =========================== */

.tcm-case-study-carousel-container {
    position: relative;
    width: 100%;
    overflow: visible;
    padding: 0;
    min-height: 600px;
}

/* Elementor editor improvements */
.elementor-editor-active .tcm-case-study-carousel-container {
    overflow: visible;
}

.elementor-editor-active .tcm-case-study-carousel-container .swiper {
    overflow: visible;
}

.elementor-editor-active .tcm-case-study-card {
    min-height: 500px;
}

/* Ensure slides are visible in editor */
.elementor-editor-active .swiper-slide {
    opacity: 1 !important;
    display: block !important;
    visibility: visible !important;
}

/* Fix slide width in editor */
.elementor-editor-active .swiper-slide-active {
    width: 100% !important;
}

/* Ensure content is visible */
.elementor-editor-active .tcm-csc-content {
    display: flex !important;
    opacity: 1 !important;
}

.elementor-editor-active .tcm-csc-text,
.elementor-editor-active .tcm-csc-image {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Make sure images display */
.elementor-editor-active .tcm-csc-image img {
    display: block !important;
    opacity: 1 !important;
}

/* ===========================
   Navigation Arrows
   =========================== */

.tcm-csc-nav-prev,
.tcm-csc-nav-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.tcm-csc-nav-prev:hover,
.tcm-csc-nav-next:hover {
    opacity: 0.7;
}

/* Position arrows in the 100px gap between slides */
.tcm-csc-nav-prev {
    left: -80px; /* Centered in left gap */
}

.tcm-csc-nav-next {
    right: -80px; /* Centered in right gap */
}

.tcm-csc-nav-prev img,
.tcm-csc-nav-next img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tcm-csc-nav-prev svg,
.tcm-csc-nav-next svg {
    width: 40px;
    height: 40px;
    color: #50DCC8;
}

.tcm-csc-nav-prev.swiper-button-disabled,
.tcm-csc-nav-next.swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===========================
   Swiper Container
   =========================== */

.tcm-case-study-carousel-container .swiper {
    overflow: visible;
    padding: 20px 0;
}

.tcm-case-study-carousel-container .swiper-wrapper {
    align-items: stretch;
    max-height: none !important; /* Override theme's swiper styles */
    height: auto !important;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.tcm-case-study-carousel-container .swiper-slide {
    height: auto;
    opacity: 0.4;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 80%;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.tcm-case-study-carousel-container .swiper-slide-active {
    opacity: 1;
}

/* Desktop: consistent slide widths - let Swiper handle sizing */
@media (min-width: 769px) {
    .tcm-case-study-carousel-container .swiper-slide {
        width: 85%;
    }
    
    .tcm-case-study-carousel-container .swiper-slide-active {
        width: 100%;
    }
}

/* ===========================
   Case Study Card
   =========================== */

.tcm-case-study-card {
    background: #2d2e47;
    border-radius: 30px;
    padding: 0;
    height: 100%;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    will-change: auto;
    transform: translateZ(0);
}

.tcm-csc-content {
    display: flex;
    gap: 0;
    align-items: stretch;
    flex: 1;
    position: relative;
}

.tcm-csc-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 60px;
    position: relative;
    z-index: 2;
}

.tcm-csc-image {
    flex: 0 0 45%;
    position: relative;
    overflow: hidden;
}

.tcm-csc-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 0 30px 30px 0;
}

/* ===========================
   Content Elements
   =========================== */

.tcm-csc-category {
    font-size: 14px;
    font-weight: 700;
    color: #50DCC8;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.tcm-csc-title {
    font-size: 48px;
    line-height: 56px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 30px 0;
}

.tcm-csc-excerpt {
    font-size: 18px;
    line-height: 28px;
    color: #ffffff;
    margin-bottom: 40px;
    flex: 1;
}

.tcm-csc-excerpt ul {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.tcm-csc-excerpt li {
    padding-left: 20px;
    position: relative;
    margin-bottom: 10px;
}

.tcm-csc-excerpt li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #50DCC8;
    font-weight: bold;
}

/* ===========================
   Read More Button (Gradient Border with Icon Style)
   =========================== */

.tcm-csc-read-more {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px 10px 20px;
    font-size: 20px;
    line-height: 20px;
    font-weight: 600;
    font-family: inherit;
    color: #ffffff;
    background: #232328;
    border: 1px solid transparent;
    background-image: 
        linear-gradient(#232328, #232328),
        linear-gradient(90deg, #A000FF 0%, #50DCC8 100%);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    border-radius: 50px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-start;
}

.tcm-csc-read-more:hover {
    background: linear-gradient(90deg, #A000FF 0%, #50DCC8 100%);
    color: #ffffff;
}

.tcm-csc-read-more svg {
    width: 30px;
    height: 30px;
    background: #A000FF;
    border-radius: 50%;
    padding: 6px;
    flex-shrink: 0;
    transition: background 0.3s ease;
}

.tcm-csc-read-more:hover svg {
    background: #A000FF;
}

.tcm-csc-read-more svg path,
.tcm-csc-read-more svg polyline {
    stroke: #ffffff;
    stroke-width: 2;
    fill: none;
}

/* ===========================
   Mobile Styles
   =========================== */

@media (max-width: 768px) {
    .tcm-case-study-carousel-container {
        padding: 0 20px;
        overflow: hidden;
    }
    
    .tcm-csc-nav-prev,
    .tcm-csc-nav-next {
        display: none;
    }
    
    .tcm-case-study-card {
        padding: 0;
    }
    
    .tcm-csc-content {
        flex-direction: column;
        gap: 0;
    }
    
    .tcm-csc-text {
        order: 2;
        padding: 40px 30px;
    }
    
    .tcm-csc-image {
        order: 1;
        flex: 0 0 auto;
        width: 100%;
        height: 300px;
    }
    
    .tcm-csc-image img {
        border-radius: 30px 30px 0 0;
    }
    
    .tcm-csc-category {
        font-size: 12px;
        margin-bottom: 15px;
    }
    
    .tcm-csc-title {
        font-size: 32px;
        line-height: 38px;
        margin-bottom: 20px;
    }
    
    .tcm-csc-excerpt {
        font-size: 16px;
        line-height: 24px;
        margin-bottom: 30px;
        /* Limit to 4 lines */
        display: -webkit-box;
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .tcm-csc-read-more {
        width: 60px;
        height: 60px;
        padding: 0;
        justify-content: center;
        background: linear-gradient(135deg, #A000FF 0%, #50DCC8 100%);
        border: none;
        border-radius: 50%;
        align-self: flex-start;
    }
    
    .tcm-csc-read-more svg {
        width: 24px;
        height: 24px;
        background: transparent;
        padding: 0;
    }
    
    /* Hide text on mobile, show only arrow icon */
    .tcm-csc-read-more-text {
        display: none;
    }
}

@media (min-width: 769px) {
    /* Show text on desktop */
    .tcm-csc-read-more-text {
        display: inline;
    }
}

/* ===========================
   Notice for Editor
   =========================== */

.tcm-csc-notice {
    background: #fff;
    border: 1px solid #ddd;
    border-left: 4px solid #ff6b6b;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
}

.tcm-csc-notice p {
    margin: 0;
    color: #333;
}


/* ===========================
   Custom Slider Base (no Swiper)
   =========================== */

/* Keep container behaviour identical but avoid any theme Swiper rules */
.tcm-case-study-carousel-container .tcm-csc-slider {
    overflow: visible;
    padding: 20px 0;
    position: relative;
    touch-action: pan-y;
}

/* Track behaves like Swiper wrapper */
.tcm-case-study-carousel-container .tcm-csc-track {
    display: flex;
    align-items: stretch;
    height: auto;
    will-change: transform;
    transform: translate3d(0,0,0);
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Slides behave like Swiper slides */
.tcm-case-study-carousel-container .tcm-csc-slide {
    height: auto;
    opacity: 0.4;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 66.6667%;
    flex: 0 0 auto;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.tcm-case-study-carousel-container .tcm-csc-slide.is-active {
    opacity: 1;
}

/* Desktop widths match existing Swiper styling */
@media (min-width: 769px) {
    .tcm-case-study-carousel-container .tcm-csc-slide {
        width: 85%;
    }
    .tcm-case-study-carousel-container .tcm-csc-slide.is-active {
        width: 100%;
    }
}

/* Match Swiper's spaceBetween using track gap */
@media (max-width: 768px) {
    .tcm-case-study-carousel-container .tcm-csc-slider {
        overflow: hidden;
    }
    .tcm-case-study-carousel-container .tcm-csc-track {
        gap: 16px;
    }
    /* Mobile: left-aligned, right peek only (~1/4 of next) */
    .tcm-case-study-carousel-container .tcm-csc-slide {
        width: 82%;
        flex: 0 0 82%;
    }
}
@media (min-width: 769px) {
    .tcm-case-study-carousel-container .tcm-csc-track {
        gap: 100px;
    }
}

/* Elementor editor visibility helpers for custom classes */
.elementor-editor-active .tcm-csc-slide {
    opacity: 1 !important;
    display: block !important;
    visibility: visible !important;
}
.elementor-editor-active .tcm-csc-slide.is-active {
    width: 100% !important;
}


/* ===== MOBILE FULL-BLEED RIGHT EDGE (LEFT INSET 20px) ===== */
@media (max-width:768px){

/* Make the carousel span the viewport regardless of parent padding */
.tcm-case-study-carousel-container{
    width:100vw !important;
    margin-left:calc(50% - 50vw) !important; /* pull to left edge */
    padding-left:20px !important;            /* keep 20px inset on left */
    padding-right:0 !important;              /* no right inset */
    box-sizing:border-box !important;
    overflow:visible !important;
}

.tcm-case-study-carousel-container .tcm-csc-slider{
    overflow:visible !important;
}

.tcm-case-study-carousel-container .tcm-csc-track{
    justify-content:flex-start !important;
    padding-left:0 !important;
}

/* Wide card + ~1/4 next card peek */
.tcm-case-study-carousel-container .tcm-csc-slide{
    width:84% !important;
    flex:0 0 84% !important;
    margin-right:16px !important;
}

.tcm-case-study-carousel-container .tcm-csc-slide:first-child{
    margin-left:0 !important;
}

}


/* ===== MOBILE: CATEGORY + TITLE ABOVE IMAGE (CONCEPT MATCH) ===== */
@media (max-width: 768px){
  .tcm-case-study-carousel-container .tcm-csc-content{
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "header"
      "image"
      "body" !important;
    gap: 0 !important;
  }

  /* let header/body become grid items without changing desktop */
  .tcm-case-study-carousel-container .tcm-csc-text{
    display: contents !important;
  }

  .tcm-case-study-carousel-container .tcm-csc-header{
    grid-area: header !important;
    padding: 40px 30px 0 30px !important;
  }

  .tcm-case-study-carousel-container .tcm-csc-image{
    grid-area: image !important;
    width: 100% !important;
    height: 300px !important;
  }

  .tcm-case-study-carousel-container .tcm-csc-image img{
    border-radius: 30px 30px 0 0 !important;
  }

  .tcm-case-study-carousel-container .tcm-csc-body{
    grid-area: body !important;
    padding: 0 30px 40px 30px !important;
  }

  /* remove old mobile order/padding side effects if present */
  .tcm-case-study-carousel-container .tcm-csc-text,
  .tcm-case-study-carousel-container .tcm-csc-image{
    order: initial !important;
  }
}


/* ===== MOBILE FINAL VISUAL TWEAKS ===== */
@media (max-width:768px){

/* remove radius on image + add spacing */
.tcm-case-study-carousel-container .tcm-csc-image{
    padding:30px 0 !important;
    border-radius:0 !important;
    overflow:visible !important;
    height:auto !important;
}

.tcm-case-study-carousel-container .tcm-csc-image img{
    border-radius:0 !important;
    width:100%;
    height:auto;
}

/* gradient 2px border around each card */
.tcm-case-study-carousel-container .tcm-case-study-card{
    position:relative;
    border-radius:30px;
    background:#2d2e47;
}

.tcm-case-study-carousel-container .tcm-case-study-card:before{
    content:"";
    position:absolute;
    inset:0;
    padding:2px;
    border-radius:30px;
    background:linear-gradient(135deg,#A000FF,#50DCC8);
    -webkit-mask:
      linear-gradient(#000 0 0) content-box,
      linear-gradient(#000 0 0);
    -webkit-mask-composite:xor;
            mask-composite:exclude;
    pointer-events:none;
}

}


/* ===== MOBILE BORDER FINAL FIX (image inside border) ===== */
@media (max-width:768px){

.tcm-case-study-carousel-container .tcm-case-study-card{
    position:relative;
    border-radius:30px;
    padding:2px !important;
    background:linear-gradient(135deg,#A000FF,#50DCC8) !important;
}

.tcm-case-study-carousel-container .tcm-case-study-card > .tcm-csc-content{
    background:#2d2e47 !important;
    border-radius:28px !important;
    overflow:hidden !important;
}

.tcm-case-study-carousel-container .tcm-csc-image{
    padding:30px 0 !important;
    background:#2d2e47 !important;
}

.tcm-case-study-carousel-container .tcm-csc-image img{
    border-radius:0 !important;
    display:block;
    width:100%;
}

}

