/* =========================================================
   PANEL DE EXPERTOS
   Archivo: expertos_panel.css

   Objetivo de esta versión:
   - Mantener las tarjetas elegantes tipo glass / iPhone.
   - Mostrar una descripción recortada inicialmente para que
     todas las tarjetas se vean ordenadas.
   - Agregar un botón circular en la esquina inferior derecha.
   - Al pasar el mouse sobre el botón, cambia a un azul sutil.
   - Al dar clic, la tarjeta se expande y muestra toda la descripción.
   - Justificar el texto de las descripciones.
========================================================= */


/* =========================================================
   SECCIÓN GENERAL
========================================================= */

.expertos-section {
    padding: 58px 0 66px;
    overflow: hidden;
    position: relative;
}

.expertos-section::before {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    right: -170px;
    top: 70px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 113, 227, 0.08), transparent 70%);
    pointer-events: none;
}

.expertos-section::after {
    content: "";
    position: absolute;
    width: 360px;
    height: 360px;
    left: -150px;
    bottom: 30px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.07), transparent 70%);
    pointer-events: none;
}

.expertos-section__head {
    position: relative;
    z-index: 2;
    margin-bottom: 30px;
}


/* =========================================================
   GRID DE EXPERTOS
========================================================= */

.expertos-grid {
    display: grid;

    /* Tres columnas en pantallas grandes. */
    grid-template-columns: repeat(3, minmax(250px, 1fr));

    gap: 22px;

    position: relative;
    z-index: 2;

    max-width: 1180px;
    margin: 0 auto;

    /* Evita que una tarjeta obligue a las demás a estirarse visualmente. */
    align-items: start;
}


/* =========================================================
   TARJETA DE EXPERTO
========================================================= */

.experto-card {
    position: relative;

    padding: 18px;

    min-height: auto;

    border-radius: 26px;

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.88),
            rgba(245, 247, 250, 0.68)
        );

    border: 1px solid rgba(255, 255, 255, 0.86);

    box-shadow:
        0 18px 46px rgba(15, 23, 42, 0.10),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);

    backdrop-filter: blur(20px) saturate(125%);
    -webkit-backdrop-filter: blur(20px) saturate(125%);

    /* Oculta brillos decorativos que salen del borde redondeado. */
    overflow: hidden;

    transition:
        transform 0.28s ease,
        box-shadow 0.28s ease,
        border-color 0.28s ease;
}

.experto-card:hover {
    transform: translateY(-6px);
    border-color: rgba(255, 255, 255, 0.98);
    box-shadow:
        0 26px 65px rgba(15, 23, 42, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

/* Estado visual cuando la tarjeta está desplegada. */
.experto-card.is-expanded {
    border-color: rgba(0, 113, 227, 0.20);
    box-shadow:
        0 30px 76px rgba(15, 23, 42, 0.16),
        0 0 0 1px rgba(0, 113, 227, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.98);
}


/* =========================================================
   BRILLOS INTERNOS
========================================================= */

.experto-card__glow {
    position: absolute;
    border-radius: 999px;
    filter: blur(18px);
    opacity: 0.28;
    pointer-events: none;
    animation: expertoGlowFloat 8s ease-in-out infinite alternate;
}

.experto-card__glow--one {
    width: 150px;
    height: 150px;
    left: -60px;
    bottom: -60px;
    background: rgba(255, 255, 255, 0.42);
}

.experto-card__glow--two {
    width: 190px;
    height: 190px;
    right: -75px;
    top: -75px;
    background: rgba(0, 113, 227, 0.10);
    animation-delay: 1.2s;
}


/* =========================================================
   FOTO DEL EXPERTO
========================================================= */

.experto-card__photo-wrap {
    position: relative;
    z-index: 2;

    width: 100%;
    height: 215px;

    border-radius: 22px;

    background:
        linear-gradient(
            135deg,
            rgba(241, 245, 249, 0.95),
            rgba(255, 255, 255, 0.90)
        );

    overflow: hidden;

    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow:
        0 14px 28px rgba(15, 23, 42, 0.11),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* Imagen real cargada desde Django Admin. */
.experto-card__photo {
    width: 100%;
    height: 100%;
    display: block;

    /* contain permite que la imagen se vea completa sin recortar rostros. */
    object-fit: contain;

    /* Fondo blanco por si la imagen no llena todo el espacio. */
    background: #ffffff;

    object-position: center center;

    /* Sin zoom: evita que la foto parezca recortada al pasar el mouse. */
    transform: none;
}

/* Se deja fijo para evitar zoom accidental en las fotos del panel. */
.experto-card:hover .experto-card__photo {
    transform: none;
}


/* Avatar automático si no existe foto. */
.experto-card__avatar {
    width: 100%;
    height: 100%;

    display: grid;
    place-items: center;

    background:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.32), transparent 34%),
        linear-gradient(135deg, #007aff, #7c3aed);

    color: #ffffff;
    font-size: 4rem;
    font-weight: 900;
    text-transform: uppercase;
}


/* =========================================================
   CONTENIDO DEL EXPERTO
========================================================= */

.experto-card__content {
    position: relative;
    z-index: 2;

    /* Padding inferior extra para que el botón circular no tape el texto. */
    padding: 18px 2px 42px;
}

.experto-card__degree {
    display: inline-flex;
    width: fit-content;

    margin-bottom: 12px;
    padding: 7px 12px;

    border-radius: 999px;

    background: rgba(0, 113, 227, 0.10);
    border: 1px solid rgba(0, 113, 227, 0.16);

    color: var(--blue, #007aff);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.10em;
    text-transform: uppercase;

    max-width: 100%;
    line-height: 1.25;
}

.experto-card__content h3 {
    margin: 0 0 10px;

    color: #101828;

    font-size: clamp(1.28rem, 2vw, 1.72rem);
    line-height: 1.08;
    font-weight: 900;
}

/* Contenedor que permite recortar o desplegar la descripción con animación. */
.experto-card__description-wrap {
    position: relative;

    /* Altura inicial aproximada para 7 líneas de texto. */
    max-height: 10.4rem;

    overflow: hidden;

    transition:
        max-height 0.42s ease,
        opacity 0.28s ease;
}

/* Degradado inferior para indicar que hay más contenido oculto. */
.experto-card__description-wrap::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 42px;

    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0),
        rgba(255, 255, 255, 0.92)
    );

    pointer-events: none;

    transition: opacity 0.25s ease;
}

/* Descripción profesional. */
.experto-card__description {
    margin: 0;

    color: #536071;

    font-size: 0.92rem;
    line-height: 1.58;

    /* Justifica el texto de las tarjetas como pediste. */
    text-align: justify;
    text-justify: inter-word;

    /* Ayuda a que el justificado se vea mejor en textos largos. */
    hyphens: auto;
}

/* Cuando la tarjeta está desplegada, se muestra toda la información. */
.experto-card.is-expanded .experto-card__description-wrap {
    max-height: 1800px;
}

/* Al desplegar, se quita el degradado porque ya no hay texto oculto. */
.experto-card.is-expanded .experto-card__description-wrap::after {
    opacity: 0;
}


/* =========================================================
   BOTÓN CIRCULAR PARA VER MÁS / VER MENOS
========================================================= */

.experto-card__toggle {
    position: absolute;
    z-index: 4;
    right: 18px;
    bottom: 18px;

    width: 40px;
    height: 40px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 999px;

    border: 1px solid rgba(148, 163, 184, 0.34);

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.92),
            rgba(248, 250, 252, 0.78)
        );

    color: #64748b;

    box-shadow:
        0 10px 22px rgba(15, 23, 42, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);

    cursor: pointer;

    transition:
        transform 0.22s ease,
        background 0.22s ease,
        color 0.22s ease,
        border-color 0.22s ease,
        box-shadow 0.22s ease;
}

/* Hover: azul sutil, no agresivo. */
.experto-card__toggle:hover {
    transform: translateY(-2px);

    background:
        linear-gradient(
            135deg,
            rgba(0, 113, 227, 0.14),
            rgba(219, 234, 254, 0.86)
        );

    color: var(--blue, #007aff);
    border-color: rgba(0, 113, 227, 0.26);

    box-shadow:
        0 14px 28px rgba(0, 113, 227, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

/* Permite navegar con teclado y ver claramente el foco. */
.experto-card__toggle:focus-visible {
    outline: 3px solid rgba(0, 113, 227, 0.28);
    outline-offset: 3px;
}

/* Estilo activo cuando la tarjeta ya está abierta. */
.experto-card.is-expanded .experto-card__toggle {
    background:
        linear-gradient(
            135deg,
            rgba(0, 113, 227, 0.18),
            rgba(219, 234, 254, 0.92)
        );

    color: var(--blue, #007aff);
    border-color: rgba(0, 113, 227, 0.30);
}

/* Ícono de flecha dentro del botón. */
.experto-card__toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-size: 1.15rem;
    font-weight: 900;
    line-height: 1;

    transform: translateY(-1px);

    transition: transform 0.25s ease;
}

/* Al abrir, la flecha gira hacia arriba. */
.experto-card.is-expanded .experto-card__toggle-icon {
    transform: translateY(0) rotate(180deg);
}

/* JS agrega esta clase si la descripción no necesita botón. */
.experto-card__toggle.is-hidden {
    display: none;
}


/* =========================================================
   ESTADO VACÍO
========================================================= */

.expertos-empty {
    position: relative;
    z-index: 2;

    width: min(760px, 100%);
    margin: 0 auto;

    padding: 40px 30px;

    text-align: center;

    border-radius: 28px;

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.86),
            rgba(245, 247, 250, 0.68)
        );

    border: 1px solid rgba(255, 255, 255, 0.84);

    box-shadow:
        0 22px 60px rgba(15, 23, 42, 0.10),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);

    backdrop-filter: blur(20px) saturate(125%);
    -webkit-backdrop-filter: blur(20px) saturate(125%);
}

.expertos-empty span {
    display: inline-flex;
    width: fit-content;

    margin-bottom: 14px;
    padding: 8px 13px;

    border-radius: 999px;

    background: rgba(0, 113, 227, 0.10);
    border: 1px solid rgba(0, 113, 227, 0.14);

    color: var(--blue, #007aff);
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.expertos-empty h3 {
    margin: 0 0 12px;

    color: #101828;

    font-size: clamp(1.55rem, 3vw, 2.2rem);
    line-height: 1.08;
    font-weight: 900;
}

.expertos-empty p {
    width: min(600px, 100%);
    margin: 0 auto;

    color: #536071;
    font-size: 0.96rem;
    line-height: 1.65;
}


/* =========================================================
   ANIMACIONES
========================================================= */

@keyframes expertoGlowFloat {
    from {
        transform: translate3d(0, 0, 0) scale(1);
    }

    to {
        transform: translate3d(14px, -12px, 0) scale(1.05);
    }
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1100px) {
    .expertos-grid {
        grid-template-columns: repeat(2, minmax(250px, 1fr));
        max-width: 820px;
    }
}

@media (max-width: 720px) {
    .expertos-section {
        padding: 48px 0 58px;
    }

    .expertos-grid {
        grid-template-columns: 1fr;
        max-width: 420px;
        gap: 18px;
    }

    .experto-card {
        padding: 16px;
        border-radius: 24px;
    }

    .experto-card__photo-wrap {
        height: 230px;
        border-radius: 20px;
    }

    .experto-card__content {
        padding-bottom: 44px;
    }

    .experto-card__content h3 {
        font-size: 1.45rem;
    }

    .experto-card__description {
        font-size: 0.91rem;
        line-height: 1.62;
    }

    .experto-card__description-wrap {
        max-height: 11.8rem;
    }

    .experto-card__toggle {
        right: 16px;
        bottom: 16px;
    }
}

@media (max-width: 420px) {
    .experto-card__photo-wrap {
        height: 210px;
    }

    .experto-card__degree {
        font-size: 0.62rem;
    }

    .experto-card__toggle {
        width: 38px;
        height: 38px;
    }
}
