/* ==========================================================================
   Formadores Kelluwün — galería + ficha modal
   ========================================================================== */

.kw-formadores {
    --kwf-accent: #A9557F;
    --kwf-accent-strong: #743653;
    --kwf-name: #1A291E;
    --kwf-image-bg: #D8CEBD;
    --kwf-modal-bg: #F1EADC;
    --kwf-modal-text: #1A291E;
    --kwf-tint: rgba(169, 85, 127, 0.08);
    --kwf-soft: rgba(116, 54, 83, 0.14);
    --kwf-columns: 3;
    --kwf-aspect: 1 / 1;
    position: relative;
    width: 100%;
    color: var(--kwf-name);
}

/* Variante Choyün: acentos verdes y fotografías más editoriales. */
.kw-formadores--choyun {
    --kwf-accent: #2F6B4F;
    --kwf-accent-strong: #1B4332;
    --kwf-name: #123F33;
    --kwf-image-bg: #D9E3D4;
    --kwf-tint: rgba(47, 107, 79, 0.1);
    --kwf-soft: rgba(27, 67, 50, 0.12);
}

.kw-formadores *,
.kw-formadores *::before,
.kw-formadores *::after {
    box-sizing: border-box;
}

.kw-formadores-grid {
    display: grid;
    grid-template-columns: repeat(var(--kwf-columns), minmax(0, 1fr));
    gap: clamp(24px, 3.4vw, 48px) clamp(18px, 2.4vw, 34px);
}

.kw-formadores .kw-formador {
    appearance: none;
    -webkit-appearance: none;
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    white-space: normal;
    cursor: pointer;
}

.kw-formadores .kw-formador:hover,
.kw-formadores .kw-formador:focus {
    background-color: transparent !important;
    border-color: transparent;
    box-shadow: none;
    color: inherit;
}

.kw-formador:focus {
    outline: none;
}

.kw-formador:focus-visible .kw-formador-media {
    outline: 2px solid var(--kwf-accent);
    outline-offset: 4px;
}

.kw-formador-media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: var(--kwf-aspect);
    overflow: hidden;
    background: var(--kwf-image-bg);
}

.kw-formador-media::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(17, 17, 14, 0) 48%, rgba(17, 17, 14, 0.58) 100%),
        linear-gradient(180deg, var(--kwf-tint), transparent 42%);
    opacity: 0.9;
    transition: opacity 0.5s ease;
}

.kw-formador-media img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0;
    object-fit: cover;
    object-position: center 22%;
    filter: saturate(0.82) contrast(1.02);
    transform: scale(1.001);
    transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.6s ease;
}

.kw-formador:hover .kw-formador-media img,
.kw-formador:focus-visible .kw-formador-media img {
    transform: scale(1.045);
    filter: saturate(1) contrast(1.02);
}

.kw-formador-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: rgba(26, 41, 30, 0.5);
    font-size: clamp(48px, 7vw, 86px);
    font-weight: 500;
    letter-spacing: -0.04em;
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.45), transparent 42%),
        var(--kwf-image-bg);
}

.kw-formador-view {
    position: absolute;
    z-index: 2;
    left: clamp(14px, 1.4vw, 20px);
    bottom: clamp(14px, 1.4vw, 20px);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 13px;
    border: 1px solid rgba(255, 255, 255, 0.48);
    border-radius: 999px;
    color: #FFF9F0;
    font-family: "Cordelina", "Instrument Serif", Georgia, serif !important;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.03em;
    line-height: 1;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.35s ease, transform 0.35s ease, background-color 0.35s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.kw-formador-view > span {
    font-size: 12px;
    line-height: 1;
}

.kw-formador:hover .kw-formador-view,
.kw-formador:focus-visible .kw-formador-view {
    opacity: 1;
    transform: translateY(0);
    background: var(--kwf-accent-strong);
}

.kw-formador-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    padding-top: 15px;
}

.kw-formador-role {
    display: block;
    color: var(--kwf-accent-strong);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    line-height: 1.35;
    text-transform: uppercase;
}

.kw-formador-name {
    display: block;
    color: var(--kwf-name);
    font-size: clamp(18px, 1.55vw, 22px);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.18;
    text-wrap: balance;
}

.kw-formador-desc {
    display: none !important;
}

.kw-formadores-empty {
    margin: 0;
    color: #5C6158;
    font-size: 15px;
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */

.kw-formadores-modal {
    position: fixed;
    z-index: 100000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: clamp(14px, 3vw, 42px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.kw-formadores-modal.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.kw-formadores-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 15, 12, 0.72);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
    cursor: pointer;
}

.kw-formadores-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 1080px);
    max-height: min(90vh, 780px);
    overflow: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    background: var(--kwf-modal-bg);
    color: var(--kwf-modal-text);
    box-shadow: 0 32px 90px rgba(5, 8, 6, 0.3);
    transform: translateY(18px) scale(0.992);
    opacity: 0;
    transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.35s ease;
    scrollbar-width: thin;
}

.kw-formadores-modal.is-open .kw-formadores-dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.kw-formadores-dialog:focus {
    outline: none;
}

.kw-formadores-dialog-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
    min-height: 520px;
}

.kw-formadores-photo {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    margin: 0;
    overflow: hidden;
    background: var(--kwf-image-bg);
}

.kw-formadores-dialog.kw-no-photo .kw-formadores-photo {
    display: none;
}

.kw-formadores-dialog.kw-no-photo .kw-formadores-dialog-grid {
    grid-template-columns: 1fr;
}

.kw-formadores-photo img {
    display: block;
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
    object-position: center 20%;
}

.kw-formadores-photo::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(17, 17, 14, 0) 58%, rgba(17, 17, 14, 0.32));
}

.kw-formadores-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(30px, 4.2vw, 62px);
}

.kw-formadores-role {
    margin: 0 0 14px;
    color: var(--kwf-accent-strong);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.18em;
    line-height: 1.4;
    text-transform: uppercase;
}

.kw-formadores-name {
    margin: 0 0 22px;
    color: var(--kwf-modal-text);
    font-size: clamp(30px, 3.8vw, 52px);
    font-weight: 500;
    letter-spacing: -0.035em;
    line-height: 0.98;
    text-wrap: balance;
}

.kw-formadores-desc {
    max-width: 54ch;
    color: color-mix(in srgb, var(--kwf-modal-text) 76%, transparent);
    font-size: clamp(14px, 1.18vw, 16px);
    line-height: 1.68;
}

.kw-formadores-desc p {
    margin: 0 0 1em;
}

.kw-formadores-desc p:last-child {
    margin-bottom: 0;
}

.kw-formadores .kw-formadores-close {
    appearance: none;
    position: absolute;
    z-index: 3;
    top: 14px;
    right: 14px;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(26, 41, 30, 0.22);
    border-radius: 50%;
    background: rgba(241, 234, 220, 0.9);
    color: var(--kwf-modal-text);
    font-family: "Cordelina", "Instrument Serif", Georgia, serif !important;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.kw-formadores-close:hover {
    background: var(--kwf-accent-strong);
    color: #FFF9F0;
    transform: rotate(90deg);
}

.kw-formadores-close:focus-visible {
    outline: 2px solid var(--kwf-accent);
    outline-offset: 3px;
}

.kw-formadores-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: clamp(28px, 4vw, 44px);
    padding-top: 20px;
    border-top: 1px solid color-mix(in srgb, var(--kwf-modal-text) 18%, transparent);
}

.kw-formadores .kw-formadores-prev,
.kw-formadores .kw-formadores-next {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 7px 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--kwf-modal-text);
    font-family: "Cordelina", "Instrument Serif", Georgia, serif !important;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.03em;
    line-height: 1;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.25s ease, opacity 0.25s ease;
}

.kw-formadores .kw-formadores-prev:hover,
.kw-formadores .kw-formadores-next:hover {
    background: var(--kwf-soft);
    color: var(--kwf-modal-text);
}

.kw-formadores-prev:focus-visible,
.kw-formadores-next:focus-visible {
    outline: 2px solid var(--kwf-accent);
    outline-offset: 4px;
}

.kw-formadores-count {
    color: color-mix(in srgb, var(--kwf-modal-text) 50%, transparent);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    line-height: 1;
    white-space: nowrap;
}

body.kw-modal-open {
    overflow: hidden !important;
}

@media (max-width: 1024px) {
    .kw-formadores--cols-4 .kw-formadores-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .kw-formadores--cols-3 .kw-formadores-grid,
    .kw-formadores--cols-4 .kw-formadores-grid {
        gap: 30px 20px;
    }
}

@media (max-width: 860px) {
    .kw-formadores-grid,
    .kw-formadores--cols-3 .kw-formadores-grid,
    .kw-formadores--cols-4 .kw-formadores-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kw-formador-view {
        opacity: 1;
        transform: translateY(0);
        padding: 7px 10px;
        background: var(--kwf-accent-strong);
        font-size: 13px;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }

    .kw-formadores-dialog-grid {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .kw-formadores-photo {
        display: block;
    }

    .kw-formadores-photo img {
        flex: none;
        min-height: 0;
        height: auto;
        aspect-ratio: 4 / 3;
        object-position: center 22%;
    }

    .kw-formadores-dialog {
        max-height: 88vh;
    }
}

@media (max-width: 540px) {
    .kw-formadores--cols-2 .kw-formadores-grid {
        grid-template-columns: 1fr;
    }

    .kw-formador-role {
        font-size: 9px;
        letter-spacing: 0.11em;
    }

    .kw-formador-name {
        font-size: 19px;
    }

    .kw-formadores-modal {
        padding: 10px;
    }

    .kw-formadores-copy {
        padding: 28px 22px 24px;
    }

    .kw-formadores-name {
        font-size: 32px;
        margin-bottom: 16px;
    }

    .kw-formadores-close {
        top: 10px;
        right: 10px;
        width: 38px;
        height: 38px;
        font-size: 21px;
    }

    .kw-formadores-nav {
        gap: 8px;
    }

}

@media (prefers-reduced-motion: reduce) {
    .kw-formadores *,
    .kw-formadores *::before,
    .kw-formadores *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
        animation-duration: 0.001ms !important;
    }
}
