/* ==========================================================
   QUIMIKA · CATÁLOGO DE MIEMBROS
   Vistas 1, 2 y 3 columnas · fotos 4:5 · acciones independientes
========================================================== */

/* Cuadrícula: una columna por defecto */
.profiles {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(12px, 2.2vw, 24px);
    width: 100%;
    max-width: 1100px;
    margin: 0 auto 30px;
}

.profiles[data-view="two"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profiles[data-view="three"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(6px, 1.5vw, 18px);
}

@media (min-width: 800px) {
    .profiles[data-view="list"] {
        max-width: 580px;
    }
}

/* Tarjeta y fotografía */
.q-member {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    width: 100%;
    min-width: 0;
    aspect-ratio: 4 / 5;
    border-radius: 22px;
    background: #241e2c;
    color: #fff;
    box-shadow: 0 12px 35px rgba(0, 0, 0, .14);
}

.q-member-photo {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform .35s ease;
}

.q-member:hover .q-member-photo {
    transform: scale(1.035);
}

.q-member-no-photo {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #4d3d6e, #1b1624);
    color: rgba(255, 255, 255, .6);
    font-size: 4rem;
}

/* Sombra progresiva sobre la imagen para mejorar la lectura */
.q-member::after {
    content: "";
    position: absolute;
    inset: 25% 0 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 0, 0, .20) 25%,
        rgba(0, 0, 0, .65) 68%,
        rgba(0, 0, 0, .91) 100%
    );
}

/* Enlace invisible: abarca foto y datos, sin envolver los botones */
.q-member-link {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: block;
    border-radius: inherit;
    cursor: pointer;
}

.q-member-link:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -5px;
}

/* Identificador del miembro: en la parte superior */
.q-member-top {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.q-member-tag {
    padding: 7px 11px;
    border: 1px solid rgba(255, 255, 255, .27);
    border-radius: 999px;
    background: rgba(12, 12, 16, .5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .09em;
}

/* Datos siempre anclados abajo, sin alterar el área del enlace */
.q-member-info {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: clamp(13px, 3.4vw, 26px);
    color: #fff;
    pointer-events: none;
}

.q-member-name {
    margin: 0;
    color: #fff;
    font-family: Outfit, 'DM Sans', sans-serif;
    font-size: clamp(22px, 4.2vw, 34px);
    font-weight: 750;
    letter-spacing: -.03em;
    line-height: 1.08;
    text-shadow: 0 2px 9px rgba(0, 0, 0, .45);
}

.q-member-place,
.q-member-looking {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: rgba(255, 255, 255, .92);
    font-size: clamp(12px, 2vw, 15px);
    line-height: 1.35;
}

.q-member-looking strong {
    color: #fff;
}

.q-member-info .lucide {
    width: 15px;
    height: 15px;
    flex: none;
}

/* Tres acciones a partes iguales, ocupando todo el ancho disponible */
.q-member-actions {
    position: relative;
    z-index: 4;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    margin-top: 14px;
    pointer-events: auto;
}

.q-member-actions .q-member-action {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 52px;
    padding: 0 8px;
    border: 1px solid rgba(255, 255, 255, .34);
    border-radius: 15px;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    text-decoration: none;
    cursor: pointer;
    pointer-events: auto;
    transition: background .2s ease, transform .2s ease;
}

.q-member-actions .q-member-action:hover {
    background: rgba(255, 255, 255, .28);
    transform: translateY(-2px);
}

.q-member-actions .q-member-action:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* Regla específica para vencer el icono pequeño de .q-member-info */
.q-member-actions .q-member-action .lucide {
    width: 24px;
    height: 24px;
    flex: none;
    stroke-width: 1.9;
}

/* Logo oficial de WhatsApp alojado como SVG */
.q-member-actions .q-whatsapp {
    border-color: #25d366;
    background: #25d366;
}

.q-member-actions .q-whatsapp:hover {
    background: #1ebe5d;
}

.q-member-actions .q-whatsapp img {
    display: block;
    width: 26px;
    height: 26px;
    flex: none;
    filter: invert(1);
}

.q-member-actions .q-member-action[aria-pressed="true"] {
    border-color: #ffb5d2;
    background: rgba(255, 87, 145, .33);
    color: #ffd2df;
}

.q-member-actions .q-member-action:disabled {
    opacity: .5;
    cursor: wait;
}

/* Selector de distribución */
.controls {
    display: flex;
    gap: 6px;
}

.controls .view-btn {
    min-width: 48px;
    min-height: 42px;
    border: 1px solid var(--stroke, rgba(204, 204, 204, .33));
    border-radius: 12px;
    background: var(--panel, #fff);
    color: var(--text, #222);
    font-weight: 750;
    cursor: pointer;
}

.controls .view-btn[aria-pressed="true"] {
    border-color: var(--purple, #8b5cf6);
    background: var(--purple, #8b5cf6);
    color: #fff;
}

/* Filtros y selectores agrupados a la derecha: 1, Filtros, 2, 3. */
body[data-page="explorar"] .toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

body[data-page="explorar"] .toolbar .controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    flex-wrap: wrap;
    max-width: 100%;
    min-width: 0;
    margin-left: auto;
}

body[data-page="explorar"] .controls .view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 11px;
    font: inherit;
    font-weight: 750;
}

.controls .view-btn svg {
    display: block;
    width: 18px;
    height: 18px;
    flex: none;
}

.controls .view-btn:focus-visible {
    outline: 3px solid var(--purple, #8b5cf6);
    outline-offset: 3px;
}

/* Menos texto en dos columnas; en tres tambien se ocultan las acciones.
   Los nodos se conservan para volver a la vista completa sin recargar la API. */
.profiles[data-view="two"] .q-member-looking,
.profiles[data-view="three"] .q-member-looking,
.profiles[data-view="three"] .q-member-actions {
    display: none;
}

.profiles[data-view="three"] .q-member-info {
    padding: clamp(7px, 1.5vw, 18px);
    gap: 4px;
}

.profiles[data-view="three"] .q-member-name {
    overflow: hidden;
    font-size: clamp(12px, 2vw, 24px);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profiles[data-view="three"] .q-member-place {
    display: block;
    overflow: hidden;
    font-size: clamp(10px, 1.1vw, 13px);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profiles[data-view="three"] .q-member-place .lucide {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 4px;
    vertical-align: -2px;
}

.profiles[data-view="three"] .q-member::after {
    inset: 42% 0 0;
}

/* Movil: respeta las tres distribuciones elegidas por el miembro. */
@media (max-width: 600px) {
    .profiles {
        gap: 8px;
    }

    .q-member {
        border-radius: 15px;
    }

    .q-member-top {
        top: 9px;
        left: 9px;
        right: 9px;
    }

    .q-member-tag {
        padding: 5px 7px;
        font-size: 9px;
    }

    .q-member-info {
        padding: 10px;
        gap: 3px;
    }

    .q-member-actions {
        gap: 5px;
        margin-top: 7px;
    }

    .q-member-actions .q-member-action {
        min-height: 35px;
        padding: 0 3px;
        border-radius: 9px;
    }

    .q-member-actions .q-member-action .lucide {
        width: 19px;
        height: 19px;
    }

    .q-member-actions .q-whatsapp img {
        width: 20px;
        height: 20px;
    }

    .profiles[data-view="two"] .q-member-name {
        font-size: clamp(14px, 3.6vw, 21px);
    }

    .profiles[data-view="two"] .q-member-place,
    .profiles[data-view="two"] .q-member-looking {
        font-size: 10px;
    }

    .profiles[data-view="two"] .q-member-info .lucide {
        width: 12px;
        height: 12px;
    }

    .profiles[data-view="two"] .q-member-actions .q-member-action .lucide {
        width: 19px;
        height: 19px;
    }

    .profiles[data-view="three"] .q-member {
        border-radius: 10px;
    }

    .profiles[data-view="three"] .q-member-info {
        padding: 7px;
        gap: 3px;
    }

    .profiles[data-view="three"] .q-member-name {
        font-size: clamp(12px, 3vw, 18px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .q-member-photo,
    .q-member-action {
        transition: none !important;
    }
}

#perfiles .q-member-info {
    min-width: 0;
}

#perfiles .q-member-place {
    display: block;
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#perfiles .q-member-place svg {
    display: inline-block;
    vertical-align: middle;
    margin-right: 5px;
}