/* ==========================================================================
   Portfolio — Carousel Antes e Depois (Section V)
   Background #EFF4FF
   Card: 336px, gap: 24px
   Interação: handle arrastável revela "depois" por baixo do "antes"
   ========================================================================== */

.portfolio {
    padding: 72px 0 64px;
    background: #EFF4FF;
    overflow: hidden;
}

/* ===== Header ===== */

.portfolio__header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 80px;
    margin-bottom: 64px;
}

.portfolio__text {
    max-width: 488px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.portfolio__label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-text);
    font-weight: 400;
    font-size: 18px;
    line-height: 170%;
    letter-spacing: -0.01em;
    color: #252B37;
}

.portfolio__line {
    display: inline-block;
    width: 71px;
    height: 0;
    border-top: 1px solid var(--color-primary);
    flex-shrink: 0;
}

.portfolio__title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 32px;
    line-height: 38px;
    color: #252B37;
}

.portfolio__description {
    max-width: 488px;
    font-family: var(--font-text);
    font-weight: 400;
    font-size: 16px;
    line-height: 170%;
    letter-spacing: -0.01em;
    color: #252B37;
}

/* ===== Carousel ===== */

.portfolio__carousel {
    cursor: grab;
}

.portfolio__carousel.is-dragging {
    cursor: grabbing;
}

.portfolio__track {
    display: flex;
    align-items: center;
    gap: 24px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 30px 16px;

    scrollbar-width: none;
    -ms-overflow-style: none;
}

.portfolio__carousel.is-dragging .portfolio__track {
    scroll-behavior: auto;
}

.portfolio__track::-webkit-scrollbar {
    display: none;
}

/* ===== Cards ===== */

.portfolio__card {
    flex-shrink: 0;
    width: 336px;
    height: 442px;
    scroll-snap-align: start;
    position: relative;
}

/* Glass border — hover */
.portfolio__card::before {
    content: '';
    position: absolute;
    top: -16px;
    left: -16px;
    right: -16px;
    bottom: -16px;
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid #D5D7DA;
    border-radius: 20px;
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
}

.portfolio__card:hover::before {
    opacity: 1;
}

/* Inner */
.portfolio__card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
    transition: transform var(--transition-base);
}

.portfolio__card:hover .portfolio__card-inner {
    transform: scale(1.03);
}

/* Desativa scale durante drag do handle */
.portfolio__card--revealing .portfolio__card-inner {
    transform: none !important;
}

/* ===== Layers (antes / depois) ===== */

.portfolio__card-layer {
    position: absolute;
    inset: 0;
}

/* Depois — fundo (revelado ao arrastar) */
.portfolio__card-layer--after {
    z-index: 1;
    background:
        linear-gradient(180deg, rgba(19, 23, 26, 0) 50%, rgba(19, 23, 26, 0.8) 100%),
        #3d5068;
}

/* Antes — frente (recorta de baixo via clip-path) */
.portfolio__card-layer--before {
    z-index: 2;
    background:
        linear-gradient(180deg, rgba(19, 23, 26, 0) 40%, #13171A 82.36%),
        #2a3a52;
    /* clip-path controlado por JS: inset(0 0 X% 0) */
}

/* Placeholder SVG */
.portfolio__card-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.2);
}

/* Imagens reais (futuro) */
.portfolio__card-layer > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== Handle arrastável ===== */

.portfolio__card-handle {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    padding: 0 12px;
    cursor: ns-resize;
    touch-action: none;
    user-select: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
    transform: translateY(50%);
}

.portfolio__card:hover .portfolio__card-handle,
.portfolio__card--revealing .portfolio__card-handle {
    opacity: 1;
    pointer-events: auto;
}

.portfolio__card-handle-line {
    flex: 1;
    height: 2px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 1px;
}

.portfolio__card-handle-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    margin: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-white);
    border-radius: 200px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: box-shadow var(--transition-fast);
}

.portfolio__card-handle:hover .portfolio__card-handle-btn {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* ===== Badge ===== */

.portfolio__badge {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    height: 32px;
    background: #FAFAFA;
    border: 1px solid #E9EAEB;
    border-radius: 8px;
    pointer-events: none;
}

.portfolio__badge img {
    max-height: 24px;
    max-width: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* ===== Conteúdo (tag + título) ===== */

.portfolio__card-content {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.portfolio__card-tag {
    font-family: var(--font-text);
    font-weight: 400;
    font-size: 14px;
    line-height: 170%;
    letter-spacing: -0.01em;
    color: var(--color-white);
}

.portfolio__card-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 24px;
    line-height: 28px;
    color: var(--color-white);
}

/* ===== CTA ===== */

.portfolio__cta-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 64px;
}

.portfolio__cta-border {
    padding: 8px;
    border-radius: 16px;
    border: 1px solid transparent;
    background:
        linear-gradient(#EFF4FF, #EFF4FF) padding-box,
        linear-gradient(302.1deg, rgba(21, 94, 239, 0.39) 24.57%, rgba(21, 94, 239, 0) 70.33%) border-box;
}

.portfolio__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px 32px;
    background: #1F3A5F;
    color: var(--color-white);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 18px;
    line-height: 24px;
    border-radius: 12px;
    transition: background var(--transition-fast);
    white-space: nowrap;
}

.portfolio__cta:hover {
    background: #2a4f7a;
}

.portfolio__cta svg {
    width: 24px;
    height: 24px;
}

/* ===== Responsivo ===== */

@media (max-width: 1024px) {
    .portfolio {
        padding: 72px 0 64px;
    }

    .portfolio__header {
        gap: 40px;
    }

    .portfolio__title {
        font-size: 28px;
        line-height: 34px;
    }

    .portfolio__text {
        max-width: 400px;
    }

    .portfolio__card {
        width: 300px;
        height: 400px;
    }
}

@media (max-width: 768px) {
    .portfolio {
        padding: 56px 0 48px;
    }

    .portfolio__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 32px;
    }

    .portfolio__text {
        max-width: 100%;
    }

    .portfolio__description {
        max-width: 100%;
    }

    .portfolio__title {
        font-size: 26px;
        line-height: 34px;
    }

    .portfolio__label {
        font-size: 16px;
    }

    /* Gap menor pra dar espaço pro peek do próximo card */
    .portfolio__track {
        gap: 12px;
    }

    /* Card ocupa 80% do viewport — resta ~20% pra peek do próximo card */
    .portfolio__card {
        width: calc(80vw - 16px);
        height: auto;
        aspect-ratio: 27 / 37;
    }

    .portfolio__card-title {
        font-size: 20px;
        line-height: 24px;
    }

    .portfolio__card-content {
        bottom: 16px;
        left: 16px;
        right: 16px;
    }

    .portfolio__cta {
        padding: 16px 28px;
        font-size: 16px;
    }

    .portfolio__cta-wrapper {
        margin-top: 40px;
    }
}

@media (max-width: 480px) {
    .portfolio {
        padding: 48px 0 40px;
    }

    .portfolio__title {
        font-size: 24px;
        line-height: 30px;
    }

    .portfolio__card-title {
        font-size: 18px;
        line-height: 22px;
    }

    .portfolio__card-handle-btn {
        width: 36px;
        height: 36px;
    }

    .portfolio__card-handle-btn svg {
        width: 16px;
        height: 16px;
    }

    .portfolio__cta {
        white-space: normal;
        text-align: center;
    }

    .portfolio__cta-wrapper {
        margin-top: 32px;
    }
}
