/* testimonials.css - animated testimonial slider on the public company site.
   Markup comes from App/src/Testimonials.php, behaviour from /js/modules/testimonials.js.
   Colours follow company.css: #014B61 / #0B86A6 deep blue, #CC0066 pink, #7B7B7B body text. */

.tst {
    padding: 60px 0;
    background-color: #f4f8f9;
    overflow: hidden;
}

.tst-heading {
    margin: 0 0 45px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #014B61;
}

/* Top-aligned, not centred: the text column is taller than the card, so centring floats
   the name above the top edge of the card and it reads as if it belongs to nothing. */
.tst-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 56px;          /* stacked on a phone, so this is the air under the card */
    align-items: start;
}

@media (min-width: 768px) {
    .tst-grid {
        grid-template-columns: minmax(0, 330px) minmax(0, 1fr);
        gap: 60px;
    }
}

/* ---------- the pile of monogram cards ---------- */

.tst-stack {
    position: relative;
    height: clamp(240px, 68vw, 320px);
    margin: 0 auto;
    width: 100%;
    max-width: 330px;
}

@media (min-width: 768px) {
    .tst-stack {
        height: 330px;
    }
}

.tst-card {
    position: absolute;
    inset: 0;
    transform-origin: bottom center;
    transform: scale(.94) rotate(var(--tst-tilt, 0deg));
    opacity: .55;
    transition: transform .5s cubic-bezier(.22, .61, .36, 1), opacity .5s ease;
    will-change: transform;
}

.tst-card.is-active {
    transform: scale(1) rotate(0deg);
    opacity: 1;
}

.tst-card-bounce {
    height: 100%;
}

/* Only on a real change: the card that is active on page load must not hop. */
.tst-card.is-entering .tst-card-bounce {
    animation: tst-bounce .5s ease-in-out;
}

@keyframes tst-bounce {
    0%   { transform: translateY(0); }
    50%  { transform: translateY(-45px); }
    100% { transform: translateY(0); }
}

.tst-avatar {
    height: 100%;
    width: 100%;
    padding: 24px;
    border-radius: 24px;
    background-color: var(--tst-color, #014B61);
    background-image: linear-gradient(150deg, rgba(255, 255, 255, .14), rgba(0, 0, 0, .22));
    box-shadow: 0 18px 40px rgba(1, 75, 97, .28);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}

.tst-initials {
    font-size: clamp(3.5rem, 16vw, 5.5rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: .06em;
    text-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}

.tst-logo {
    max-width: 78%;
    padding: 10px 16px;
    border-radius: 10px;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tst-logo img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 38px;
}

/* ---------- name, role and quote ---------- */

.tst-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 300px;
}

.tst-slide[hidden] {
    display: none;
}

.tst-slide {
    animation: tst-slide-in .3s ease;
}

@keyframes tst-slide-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
}

.tst-name {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    color: #014B61;
}

.tst-designation {
    margin: 4px 0 0;
    font-size: .95rem;
    color: #9aa4a8;
}

.tst-quote {
    margin: 26px 0 0;
    padding: 0;
    font-size: 1.2rem;
    line-height: 1.75;
    color: #7B7B7B;
}

.tst-quote p {
    margin: 0;
}

/* A long quote is cut to a few lines, with a "read more" button underneath. Only applied
   once testimonials.js has taken over (.tst-live): with JavaScript off the button cannot
   open anything, so there the whole quote has to stay visible.

   A height limit, not -webkit-line-clamp: the quote is animated as one inline-block span
   per word, and a -webkit-box counts every one of those as a line of its own — which cut
   every quote off after six words instead of six lines. */
.tst-live .tst-quote p {
    position: relative;
    max-height: calc(var(--tst-lines, 6) * 1.75em);   /* 1.75em = the line-height above */
    overflow: hidden;
}

.tst-live .tst-slide.is-expanded .tst-quote p {
    max-height: none;
    overflow: visible;
}

/* Fades the last line out, so it reads as "there is more" rather than as a bad line break.
   Only on a quote that is really cut off; is-clamped is set by testimonials.js. */
.tst-live .tst-slide.is-clamped:not(.is-expanded) .tst-quote p::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3em;
    background-image: linear-gradient(rgba(244, 248, 249, 0), #f4f8f9);
    pointer-events: none;
}

.tst-more {
    margin: 14px 0 0;
    padding: 0;
    border: 0;
    background: none;
    color: #CC0066;
    font: inherit;
    font-size: .95rem;
    cursor: pointer;
    border-bottom: 1px solid transparent;
}

.tst-more:hover,
.tst-more:focus-visible {
    border-bottom-color: #CC0066;
}

.tst-more:focus-visible {
    outline: 2px solid #014B61;
    outline-offset: 3px;
}

.tst-more[hidden] {
    display: none;
}

.tst-quote p::before {
    content: "\201C";
    margin-right: .12em;
    color: #CC0066;
    font-size: 2.2rem;
    line-height: 0;
    vertical-align: -.35em;
}

/* One word per span, faded in with a small stagger. Set by testimonials.js. */
.tst-word {
    display: inline-block;
    opacity: 0;
    filter: blur(10px);
    transform: translateY(5px);
    animation: tst-word .3s ease forwards;
    animation-delay: var(--tst-delay, 0s);
}

@keyframes tst-word {
    to { opacity: 1; filter: blur(0); transform: none; }
}

/* ---------- navigation ---------- */

.tst-nav {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 36px;
}

.tst-arrow {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: #e2eaec;
    color: #014B61;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color .25s ease, color .25s ease;
}

.tst-arrow:hover,
.tst-arrow:focus-visible {
    background-color: #CC0066;
    color: #fff;
}

.tst-arrow:focus-visible {
    outline: 2px solid #014B61;
    outline-offset: 2px;
}

.tst-arrow svg {
    width: 18px;
    height: 18px;
    transition: transform .3s ease;
}

.tst-arrow[data-tst-prev]:hover svg { transform: rotate(12deg); }
.tst-arrow[data-tst-next]:hover svg { transform: rotate(-12deg); }

.tst-progress {
    margin: 0 0 0 auto;
    font-size: .9rem;
    letter-spacing: .08em;
    color: #b3bdc1;
}

.tst-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {
    .tst-card,
    .tst-card-bounce,
    .tst-slide,
    .tst-word,
    .tst-arrow svg {
        animation: none !important;
        transition: none !important;
    }

    .tst-word {
        opacity: 1;
        filter: none;
        transform: none;
    }
}
