/* ==========================================================================
   BEFORE-AFTER SECTION - HIGH PERFORMANCE RESPONSIVE STYLES
   ========================================================================== */
.before-after-section {
    padding: 90px 0;
    width: 100%;
    overflow: hidden;
}

.before-after-section .innerSpacing {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 48px;
}

.before-after-section .written-content {
    flex: 1 1 48%;
    min-width: 0;
    height: auto;
}

.written-content-intro {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 34px;
}

.written-content h2 {
    color: var(--sigcolor);
    font-size: 38px;
    font-family: var(--font1);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.12rem;
    line-height: 1.15;
}

.written-content p {
    font-family: var(--font1);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.6;
    color: var(--text-secondary-color);
    width: 90%;
}

.written-qualities-here {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 28px 24px;
}

.one-written-quality {
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.one-written-quality svg {
    width: 27px;
    height: 27px;
    flex-shrink: 0;
    color: var(--sigcolor);
}

.one-written-quality h3 {
    color: #111111;
    font-size: 15px;
    font-family: var(--font1);
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: -0.01em;
}

.one-written-quality p {
    font-family: var(--font1);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.55;
    color: var(--text-secondary-color);
    width: 100%;
    max-width: 100%;
}

/* ==========================================================================
   SLIDER CONTAINER & IMAGES
   ========================================================================== */
.before-after-section .before-after-container {
    flex: 1 1 52%;
    min-width: 0;
    max-width: 720px;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    position: relative;
}

.slider-container {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.14), 0 4px 16px -2px rgba(0, 0, 0, 0.06);
    cursor: ew-resize;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    background-color: #f3f5f8;
}

.before-image,
.after-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.before-image img,
.after-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    pointer-events: none;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    filter: saturate(120%) contrast(110%);
}

/* Initial clip-path matching JS state */
.after-image {
    clip-path: inset(0 0 0 50%);
}

.before-image {
    clip-path: inset(0 50% 0 0);
}

/* Styling the Before/After text badges */
.before-text,
.after-text {
    position: absolute;
    top: 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-primary-color);
    font-family: var(--font1);
    z-index: 5;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    transition: opacity 0.25s ease;
}

.before-text {
    left: 16px;
}

.after-text {
    right: 16px;
}

/* Divider Line */
.slider-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background-color: #ffffff;
    cursor: ew-resize;
    z-index: 3;
    transform: translateX(-50%);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

/* Draggable Hit Zone & SVG Line Container */
.slider-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 44px;
    height: 100%;
    margin-left: -22px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: transparent;
    z-index: 4;
    cursor: ew-resize;
    touch-action: none;
}

.pulse-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}

.pulse-container::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #ffffff;
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
    animation: pulse 1.6s infinite ease-out;
    pointer-events: none;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.7;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.6);
        opacity: 0;
    }
}

.slider-line svg {
    position: relative;
    width: 46px;
    height: 46px;
    z-index: 5;
    cursor: ew-resize;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.22));
    transition: transform 0.18s ease;
    border-radius: 50%;
}

.slider-line:hover svg,
.slider-container:active .slider-line svg {
    transform: scale(1.08);
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================================== */

/* Large Tablets & Small Desktops */
@media (max-width: 1400px) {
    .before-after-section {
        padding: 80px 0;
    }

    .before-after-section .innerSpacing {
        gap: 36px;
    }

    .written-content h2 {
        font-size: 34px;
        letter-spacing: -0.1rem;
    }

    .written-qualities-here {
        gap: 24px 20px;
    }
}

/* Medium Screens */
@media (max-width: 1200px) {
    .before-after-section {
        padding: 70px 0;
    }

    .before-after-section .innerSpacing {
        gap: 30px;
    }

    .written-content h2 {
        font-size: 30px;
        letter-spacing: -0.08rem;
    }

    .written-content p {
        font-size: 14px;
    }

    .written-qualities-here {
        gap: 20px 16px;
    }

    .one-written-quality h3 {
        font-size: 14px;
    }

    .one-written-quality p {
        font-size: 11.5px;
    }
}

/* Tablet Portrait & Smaller (Switch to vertical stack) */
@media (max-width: 992px) {
    .before-after-section {
        padding: 60px 0;
    }

    .before-after-section .innerSpacing {
        flex-direction: column;
        align-items: stretch;
        gap: 40px;
    }

    .before-after-section .written-content {
        width: 100%;
        flex: none;
    }

    .written-content-intro {
        margin-bottom: 28px;
        gap: 16px;
    }

    .written-content h2 {
        font-size: 32px;
        letter-spacing: -0.08rem;
    }

    .written-content p {
        font-size: 14px;
        max-width: 100%;
    }

    .written-qualities-here {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px 20px;
        width: 100%;
    }

    .before-after-section .before-after-container {
        flex: none;
        width: 100%;
        margin: 0 auto;
        aspect-ratio: 3 / 2;
    }
}

/* Small Tablets & Large Phones */
@media (max-width: 768px) {
    .before-after-section {
        padding: 50px 0;
    }

    .before-after-section .innerSpacing {
        gap: 34px;
    }

    .written-content-intro {
        margin-bottom: 24px;
        gap: 14px;
    }

    .written-content h2 {
        font-size: 28px;
        letter-spacing: -0.06rem;
    }

    .written-content p {
        font-size: 13.5px;
        line-height: 1.55;
    }

    .written-qualities-here {
        gap: 20px 16px;
    }

    .one-written-quality {
        gap: 8px;
    }

    .one-written-quality svg {
        width: 24px;
        height: 24px;
    }

    .one-written-quality h3 {
        font-size: 13.5px;
    }

    .one-written-quality p {
        font-size: 11px;
        line-height: 1.5;
    }

    .slider-container {
        border-radius: 14px;
    }

    .before-text,
    .after-text {
        top: 12px;
        font-size: 10.5px;
        padding: 5px 12px;
    }

    .before-text {
        left: 12px;
    }

    .after-text {
        right: 12px;
    }

    .pulse-container {
        width: 42px;
        height: 42px;
    }

    .pulse-container::before {
        width: 52px;
        height: 52px;
    }

    .slider-line svg {
        width: 42px;
        height: 42px;
    }
}

/* Standard Mobile Devices */
@media (max-width: 540px) {
    .before-after-section {
        padding: 42px 0;
    }

    .before-after-section .innerSpacing {
        gap: 28px;
    }

    .written-content-intro {
        margin-bottom: 20px;
        gap: 12px;
    }

    .written-content h2 {
        font-size: 25px;
        letter-spacing: -0.04rem;
        line-height: 1.2;
    }

    .written-content p {
        font-size: 13px;
        line-height: 1.5;
    }

    .written-qualities-here {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px 12px;
    }

    .one-written-quality {
        gap: 6px;
    }

    .one-written-quality svg {
        width: 22px;
        height: 22px;
    }

    .one-written-quality h3 {
        font-size: 13px;
    }

    .one-written-quality p {
        font-size: 11px;
        line-height: 1.45;
    }

    .before-after-section .before-after-container {
        aspect-ratio: 4 / 3;
    }

    .slider-container {
        border-radius: 12px;
    }

    .before-text,
    .after-text {
        top: 10px;
        font-size: 10px;
        padding: 4px 10px;
        border-radius: 4px;
    }

    .before-text {
        left: 10px;
    }

    .after-text {
        right: 10px;
    }

    .slider-line {
        width: 38px;
        margin-left: -19px;
    }

    .pulse-container {
        width: 36px;
        height: 36px;
    }

    .pulse-container::before {
        width: 46px;
        height: 46px;
    }

    .slider-line svg {
        width: 36px;
        height: 36px;
    }
}

/* Ultra Small / Compact Mobile Screens */
@media (max-width: 380px) {
    .written-content h2 {
        font-size: 22px;
    }

    .written-qualities-here {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .one-written-quality {
        gap: 4px;
    }
}