/*==============================================
   KIMST home page: Student testimonials
   Spotlight quote + author tabs. Driven by testimonials.js.
   Light section on purpose: it sits directly above the dark footer.
   Uses .kh-reveal from home.css for the scroll reveal.
===============================================*/

.kh-testi {
    --kh-green: #108543;
    --kh-green-700: #0b6a34;
    --kh-green-900: #073d20;
    --kh-green-300: #8fe0b0;
    --kh-green-50: #eef7f1;
    --kh-red: #d02010;
    --kh-ink: #14231a;
    --kh-muted: #5b6b61;
    --kh-line: #e3eae5;
    --kh-ease: cubic-bezier(.22, 1, .36, 1);
    --kh-delay: 8000ms;

    position: relative;
    overflow: hidden;
    padding: 96px 0 100px;
    color: var(--kh-ink);
    font-family: var(--kh-font-ui);
    background:
        radial-gradient(760px 420px at 0% 0%, rgba(16, 133, 67, .10), transparent 62%),
        radial-gradient(640px 400px at 100% 100%, rgba(16, 133, 67, .07), transparent 62%),
        #ffffff;
}

/* Dotted texture + a large ring, same visual language as the hero (in green on light) */
.kh-testi::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(16, 133, 67, .16) 1.5px, transparent 1.6px);
    background-size: 28px 28px;
    -webkit-mask-image: linear-gradient(110deg, #000 0%, transparent 55%);
    mask-image: linear-gradient(110deg, #000 0%, transparent 55%);
    pointer-events: none;
}

.kh-testi::after {
    content: "";
    position: absolute;
    right: -200px;
    top: -220px;
    width: 560px;
    height: 560px;
    border: 1px solid rgba(16, 133, 67, .14);
    border-radius: 50%;
    box-shadow: 0 0 0 60px rgba(16, 133, 67, .03), 0 0 0 120px rgba(16, 133, 67, .02);
    pointer-events: none;
}

.kh-testi .container {
    position: relative;
    z-index: 1;
}

.kh-testi__grid {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    gap: 64px;
    align-items: center;
}

/*---------- Intro + controls ----------*/

.kh-testi .kh-testi__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--kh-red);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.kh-testi__eyebrow::before {
    content: "";
    width: 28px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    opacity: .55;
}

.kh-testi h2.kh-testi__title {
    margin: 16px 0 14px;
    color: var(--kh-ink);
    font-family: var(--kh-font-ui);
    font-size: clamp(30px, 3.6vw, 46px);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -.01em;
}

.kh-testi__title em {
    color: var(--kh-green);
    font-style: normal;
}

.kh-testi p.kh-testi__sub {
    margin: 0;
    color: var(--kh-muted);
    font-family: var(--kh-font-body);
    font-size: 17px;
    line-height: 1.7;
}

.kh-testi__ctrls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 34px;
}

.kh-testi__ctrl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    padding: 0;
    border: 1.5px solid var(--kh-green);
    border-radius: 50%;
    background: #fff;
    color: var(--kh-green-700);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}

.kh-testi__ctrl:hover {
    background: var(--kh-green);
    color: #fff;
}

.kh-testi__ctrl:active {
    transform: scale(.94);
}

.kh-testi__ctrl--pause {
    font-size: 15px;
}

.kh-testi__count {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-left: 12px;
    color: var(--kh-muted);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .06em;
}

.kh-testi__count b {
    color: var(--kh-ink);
    font-size: 22px;
    font-weight: 700;
}

/*---------- Spotlight quote ----------*/

.kh-testi__stage {
    min-width: 0;
}

/* All quotes share one grid cell, so the card never changes height between slides */
.kh-testi__slides {
    position: relative;
    display: grid;
    padding: 56px 56px 40px;
    overflow: hidden;
    border: 1px solid var(--kh-line);
    border-radius: 30px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(7, 61, 32, .05), 0 30px 70px rgba(7, 61, 32, .13);
}

/* Accent bar along the top of the card */
.kh-testi__slides::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--kh-green), #2bb86b 55%, var(--kh-red));
}

.kh-testi__slides::before {
    content: "\201C";
    position: absolute;
    top: -36px;
    left: 36px;
    color: rgba(16, 133, 67, .13);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 260px;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
}

.kh-quote {
    grid-area: 1 / 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 36px;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(18px);
    transition: opacity .5s ease, transform .7s var(--kh-ease), visibility 0s linear .5s;
}

.kh-quote.is-active {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: .1s, .1s, 0s;
}

.kh-testi blockquote.kh-quote__text {
    position: relative;
    margin: auto 0; /* centres the text in whatever room the tallest quote leaves */
    padding: 36px 0 0;
    border: 0;
    color: var(--kh-ink);
    font-family: var(--kh-font-ui);
    font-size: clamp(21px, 2.3vw, 29px);
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: -.005em;
    quotes: none;
}

/* Short quotes (flagged by testimonials.js) are set larger so the card never looks half empty */
.kh-testi .kh-quote--short blockquote.kh-quote__text {
    font-size: clamp(26px, 3.2vw, 42px);
    line-height: 1.38;
}

.kh-quote__who {
    display: flex;
    align-items: center;
    gap: 18px;
    padding-top: 26px;
    border-top: 1px solid var(--kh-line);
}

/* Initials avatar; the span is empty until JS fills it, so the icon shows as a no-JS fallback */
.kh-quote__avatar {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2bb86b, #108543);
    box-shadow: 0 0 0 4px var(--kh-green-50), 0 10px 22px rgba(16, 133, 67, .28);
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.kh-quote__avatar:empty::before {
    content: "\f007";
    font-family: FontAwesome;
    font-size: 26px;
    font-weight: 400;
}

.kh-quote:nth-child(3n + 2) .kh-quote__avatar,
.kh-testi__tab:nth-child(3n + 2) .kh-quote__avatar {
    background: linear-gradient(135deg, #e5483a, #d02010);
    box-shadow: 0 0 0 4px #fdeeec, 0 10px 22px rgba(208, 32, 16, .25);
}

.kh-quote:nth-child(3n) .kh-quote__avatar,
.kh-testi__tab:nth-child(3n) .kh-quote__avatar {
    background: linear-gradient(135deg, #3d5e4c, #1d2f25);
    box-shadow: 0 0 0 4px #e9eeeb, 0 10px 22px rgba(20, 35, 26, .25);
}

.kh-quote__id {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    min-width: 0;
}

.kh-quote__id b {
    color: var(--kh-ink);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .01em;
}

.kh-quote__id small {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--kh-green-50);
    color: var(--kh-green-700);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1.3;
    text-transform: uppercase;
}

/*---------- Author tabs (also the autoplay timeline) ----------*/

.kh-testi__tabs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 14px;
    margin-top: 18px;
}

.kh-testi__tab {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px 16px 16px;
    overflow: hidden;
    border: 1px solid var(--kh-line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(7, 61, 32, .05);
    color: var(--kh-muted);
    text-align: left;
    cursor: pointer;
    transition: background .25s ease, border-color .25s ease, color .25s ease, transform .25s ease;
}

.kh-testi__tab:hover {
    border-color: rgba(16, 133, 67, .4);
    color: var(--kh-ink);
}

.kh-testi__tab.is-active {
    border-color: var(--kh-green);
    background: var(--kh-green-50);
    color: var(--kh-ink);
}

.kh-quote__avatar--sm {
    width: 40px;
    height: 40px;
    font-size: 15px;
    box-shadow: 0 0 0 3px var(--kh-green-50);
}

.kh-testi__tab:nth-child(3n + 2) .kh-quote__avatar--sm {
    box-shadow: 0 0 0 3px #fdeeec;
}

.kh-testi__tab:nth-child(3n) .kh-quote__avatar--sm {
    box-shadow: 0 0 0 3px #e9eeeb;
}

.kh-quote__avatar--sm:empty::before {
    font-size: 17px;
}

.kh-testi__tab-name {
    min-width: 0;
    overflow: hidden;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kh-testi__fill {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--kh-green);
    transform: scaleX(0);
    transform-origin: left center;
}

.kh-testi__tab.is-active .kh-testi__fill {
    animation: khTestiFill var(--kh-delay) linear forwards;
}

@keyframes khTestiFill {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* Temporary pause (hover / focus / off-screen) freezes the bar; stopped (user pause) shows it full */
.kh-testi.is-paused .kh-testi__fill {
    animation-play-state: paused;
}

.kh-testi.is-stopped .kh-testi__tab.is-active .kh-testi__fill {
    animation: none;
    transform: scaleX(1);
}

/* One testimonial only: no navigation needed */
.kh-testi.is-single .kh-testi__ctrls,
.kh-testi.is-single .kh-testi__tabs {
    display: none;
}

.kh-testi :focus-visible {
    outline: 2px solid var(--kh-green);
    outline-offset: 3px;
}

/*---------- Responsive ----------*/

@media (max-width: 1199.98px) {
    .kh-testi__grid {
        gap: 44px;
    }

    .kh-testi__slides {
        padding: 50px 40px 34px;
    }
}

@media (max-width: 991.98px) {
    .kh-testi {
        padding: 68px 0 72px;
    }

    .kh-testi__grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 36px;
    }

    .kh-testi__ctrls {
        margin-top: 26px;
    }
}

@media (max-width: 575.98px) {
    .kh-testi {
        padding: 54px 0 58px;
    }

    .kh-testi p.kh-testi__sub {
        font-size: 16px;
    }

    .kh-testi__slides {
        padding: 44px 24px 28px;
        border-radius: 24px;
    }

    .kh-testi__slides::before {
        top: -28px;
        left: 20px;
        font-size: 200px;
    }

    .kh-testi blockquote.kh-quote__text {
        padding-top: 28px;
        font-size: 20px;
    }

    .kh-testi .kh-quote--short blockquote.kh-quote__text {
        font-size: 25px;
    }

    .kh-quote__who {
        gap: 14px;
    }

    .kh-quote__avatar {
        width: 54px;
        height: 54px;
        font-size: 19px;
    }

    .kh-quote__id b {
        font-size: 17px;
    }

    /* Tabs shrink to avatars only; the active quote already shows the name */
    .kh-testi__tabs {
        gap: 10px;
    }

    .kh-testi__tab {
        justify-content: center;
        padding: 12px 8px 15px;
    }

    .kh-testi__tab-name {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .kh-quote {
        transform: none;
        transition: opacity .2s ease;
        transition-delay: 0s;
    }

    .kh-testi__ctrl,
    .kh-testi__tab {
        transition: none;
    }
}
