/**
 * MOSAIC.CSS
 * Estilos para a seção de mosaico interativo
 * Depende de base.css para tokens
 */

/* ===== MOSAIC ===== */
.fm {
    padding: clamp(64px, 12vw, 96px) 0;
}

.fm__head {
    padding-inline: 22px;
    margin-bottom: 22px;
    text-align: left;
}

.fm__head h2 {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: clamp(24px, 3vw, 32px);
    line-height: 1.25;
    color: var(--blue);
    margin: 0 0 32px 0;
}

.fm__head p {
    font-size: 18px;
    line-height: 1.33;
    color: var(--blue);
    margin: 0;
}

/* Layout geral: palco à esquerda + coluna de cards à direita - conforme Figma */
.fm__layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    padding: 0px 22px;
    gap: 16px;
    width: 1440px;
    height: 656px;
    margin: 0 auto;
    position: relative;
}

/* Palco com imagem estática - conforme Figma */
.fm__stage {
    position: relative;
    width: 520px;
    height: 656px;
    border-radius: 24px;
    overflow: hidden;
    background-position: center;
    background-size: cover;
    justify-content: flex-end;
    background-repeat: no-repeat;
    flex: none;
    order: 0;
    flex-grow: 0;
    padding: 16px 16px 32px 32px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.fm__stage:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* overlay (leve) + legenda no rodapé esquerdo */
.fm__stage::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, .35) 100%);
    pointer-events: none;
}

.fm__stage-caption {
    position: relative;
    z-index: 2;
    margin: 0 auto;
    width: 100%;
    height: 24px;
    font-family: var(--font-body);
    font-style: normal;
    font-weight: 400;
    font-size: 18px;
    line-height: 24px;
    color: #F7ECDD;
    flex: none;
    order: 1;
    align-self: stretch;
    flex-grow: 0;
}

/* Cards - Grid 2x2 conforme Figma */
.fm__cards {
    position: relative;
    width: 624px;
    height: 656px;
    flex: none;
    order: 1;
    flex-grow: 1;
}

.fm__card {
    position: absolute;
    width: 304px;
    height: 320px;
    border: 0;
    border-radius: 16px;
    padding: 16px;
    background: #e8e3d8;
    cursor: pointer;
    text-align: left;
    color: #fff;
    outline: none;
    isolation: isolate;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    gap: 10px;
}

/* Posicionamento específico dos cards conforme Figma */
.fm__card:nth-child(1) {
    left: 0px;
    top: 0px;
}

.fm__card:nth-child(2) {
    left: 320px;
    top: 0px;
}

.fm__card:nth-child(3) {
    left: 0px;
    top: 336px;
}

.fm__card:nth-child(4) {
    left: 320px;
    top: 336px;
}

/* overlay e rótulo */
.fm__card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(34, 59, 90, 0) 60.8%, #223B5A 100%);
    background-blend-mode: multiply, normal;
    border-radius: inherit;
    transition: opacity .2s ease;
}

/* Overlay com conteúdo que aparece no hover */
.fm__overlay {
    position: absolute;
    inset: 0;
    background: rgba(34, 59, 90, 0.95);
    border-radius: inherit;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 10;
}

.fm__overlay-title {
    font-family: var(--font-body);
    font-size: 18px;
    font-weight: 600;
    color: #F7ECDD;
    margin: 0 0 12px 0;
    line-height: 1.2;
}

.fm__overlay-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.fm__overlay-list li {
    font-family: var(--font-body);
    font-size: 14px;
    color: #F7ECDD;
    line-height: 1.4;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Botão de fechar overlay */
.fm__overlay-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #F7ECDD;
    border: 2px solid rgba(255, 255, 255, 0.3);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 15;
}

.fm__overlay-close:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

/* 5º card - controla o palco (removido) */
.fm__card--stage {
    display: none;
    /* Escondido no desktop */
}

/* Hover effect */
.fm__card:hover .fm__overlay,
.fm__stage:hover .fm__overlay {
    opacity: 1;
    visibility: visible;
}

.fm__card:hover .fm__icon {
    transform: rotate(45deg);
}

.fm__label {
    margin: 0 auto;
    width: 272px;
    height: 24px;
    font-family: var(--font-body);
    font-style: normal;
    font-weight: 400;
    font-size: 18px;
    line-height: 24px;
    color: #F7ECDD;
    flex: none;
    order: 1;
    align-self: stretch;
    flex-grow: 0;
    z-index: 1;
}

/* bolinha com + / – conforme Figma */
.fm__icon {
    margin: 0 auto;
    width: 28px;
    height: 28px;
    background: #F7ECDD;
    border-radius: 100px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: 10px;
    gap: 10px;
    flex: none;
    order: 0;
    flex-grow: 0;
    z-index: 2;
    background: #fff;
    color: var(--blue);
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
    transition: transform .15s ease, background-color .2s, color .2s;
}

/* estado ativo: muda + para – e destaca card */
.fm__card.is-active .fm__icon {
    background: var(--blue);
    color: var(--sand);
    transform: rotate(0);
}

.fm__card.is-active::after {
    opacity: .55;
}

/* Painel removido - funcionalidade simplificada */

.fm__cta {
    text-align: center;
    margin-top: 32px;
}

/* Responsivo para mosaico */
@media (max-width: 1024px) {
    .fm__layout {
        grid-template-columns: 1fr;
        padding-inline: 24px;
    }
}

@media (hover: hover) {
    .fm__card:hover .fm__icon {
        transform: rotate(90deg);
    }
}

/* ===== RESPONSIVIDADE MOBILE ===== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .fm__layout {
        width: 100%;
        max-width: 768px;
        padding: 0px 16px;
        flex-direction: column;
        height: auto;
        gap: 24px;
    }

    .fm__stage {
        width: 100%;
        height: 400px;
        order: 1;
    }

    .fm__cards {
        width: 100%;
        height: auto;
        order: 2;
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 16px;
    }

    .fm__card {
        position: relative !important;
        width: 100% !important;
        height: 200px;
        left: auto !important;
        top: auto !important;
    }

    /* Resetar posicionamento absoluto dos cards no tablet */
    .fm__card:nth-child(1),
    .fm__card:nth-child(2),
    .fm__card:nth-child(3),
    .fm__card:nth-child(4),
    .fm__card:nth-child(5) {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
    }

    .fm__stage-caption {
        width: 100%;
        text-align: center;
    }

    .fm__label {
        width: 100%;
        text-align: center;
    }
}

/* Mobile (até 768px) */
@media (max-width: 768px) {
    .fm {
        padding: 48px 0;
    }

    .fm__head {
        padding-inline: 16px;
        margin-bottom: 24px;
    }

    .fm__head h2 {
        font-size: 24px;
        margin-bottom: 16px;
    }

    .fm__head p {
        font-size: 16px;
    }

    .fm__layout {
        padding: 0px 16px;
        gap: 20px;
        flex-direction: column;
        width: 100%;
        height: auto;
    }

    .fm__stage {
        width: 100%;
        height: 250px;
        padding: 16px;
        border-radius: 16px;
        order: 1;
    }

    .fm__stage-caption {
        font-size: 16px;
        line-height: 20px;
        width: 100%;
    }

    .fm__cards {
        width: 100%;
        height: auto;
        order: 2;
        display: flex;
        flex-direction: column;
        gap: 12px;
        position: static;
    }

    .fm__card {
        position: relative !important;
        width: 100% !important;
        height: 150px;
        left: auto !important;
        top: auto !important;
        padding: 12px;
        margin-bottom: 0;
    }

    /* Resetar posicionamento absoluto dos cards individuais no mobile */
    .fm__card:nth-child(1),
    .fm__card:nth-child(2),
    .fm__card:nth-child(3),
    .fm__card:nth-child(4),
    .fm__card:nth-child(5) {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
    }

    .fm__label {
        font-size: 14px;
        line-height: 18px;
        width: 100%;
    }

    .fm__icon {
        width: 20px;
        height: 20px;
        padding: 4px;
    }

    .fm__cta {
        margin-top: 32px;
        text-align: center;
    }

    /* Overlay responsivo para mobile */
    .fm__overlay {
        padding: 12px;
    }

    .fm__overlay-title {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .fm__overlay-list {
        max-height: 120px;
        gap: 4px;
    }

    .fm__overlay-list li {
        font-size: 12px;
        padding: 3px 6px;
    }

    /* Mostrar 5º card no mobile */
    .fm__card--stage {
        display: flex;
    }

    /* Botão de fechar responsivo para mobile */
    .fm__overlay-close {
        width: 28px;
        height: 28px;
        font-size: 16px;
        top: 12px;
        right: 12px;
    }
}

/* Mobile pequeno (até 480px) */
@media (max-width: 480px) {
    .fm__layout {
        padding: 0px 12px;
    }

    .fm__stage {
        height: 28px0px;
        padding: 12px;
    }

    .fm__stage-caption {
        font-size: 14px;
        line-height: 18px;
    }

    .fm__card {
        height: 160px;
        padding: 10px;
    }

    .fm__label {
        font-size: 14px;
        line-height: 18px;
    }

    .fm__icon {
        width: 20px;
        height: 20px;
        padding: 4px;
    }
}
