/* ============================================================
   Testimonial Cards — desktop + mobile
   Desktop : 512×320 px sticker cards, fan layout, overlap via clamp
   Mobile  : 327 px wide sticker cards, column stack, slight overlap
   ============================================================ */

/* ── Section wrapper ──────────────────────────────────────── */

.testimonials {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
}

.testimonials__header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  align-self: flex-end;
}

.testimonials__annotation {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.75rem;
  align-self: flex-end;
}

.testimonials__sub-label {
  font-family: var(--font-base);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--color-text-dark);
  margin: 0;
}

.testimonials__heading {
  font-family: var(--font-base);
  font-size: var(--font-size-section-heading);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  color: var(--color-text);
  margin: 0;
}

@keyframes testimonials-underline-sweep {
  0% {
    clip-path: inset(0 0 0 100%);
  }
  10% {
    clip-path: inset(0 0 0 0%);
  }
  70% {
    clip-path: inset(0 0 0 0%);
  }
  80% {
    clip-path: inset(0 0 0 100%);
  }
  100% {
    clip-path: inset(0 0 0 100%);
  }
}

.testimonials__heading-decoration {
  display: block;
  width: 100px;
  height: 36px;
  opacity: 1;
  pointer-events: none;
  animation: testimonials-underline-sweep 3.5s ease-out infinite;
  animation-delay: 3000ms;
}

/* ── Grid ─────────────────────────────────────────────────── */

.testimonials__grid {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem 0 6rem;
}

/* ── Card base ────────────────────────────────────────────── */

/* The wrapper (not the card) now owns stacking order. AOS applies its own
   transform/opacity to [data-aos] elements, which makes .testimonial-wrap
   a stacking-context root on its own — so z-index set on .testimonial-card
   itself would only ever compete within its own wrapper, never against the
   other two cards. Giving the wrapper an explicit position + z-index makes
   the left-to-right overlap (and the hover-to-front behavior below)
   resolve at the level where the cards actually compete. */
.testimonial-wrap {
  position: relative;
}

.testimonial-wrap:nth-child(1) {
  z-index: 3;
}

.testimonial-wrap:nth-child(2) {
  z-index: 2;
}

.testimonial-wrap:nth-child(3) {
  z-index: 1;
}

.testimonial-wrap:hover {
  z-index: 10;
}

.testimonial-card {
  position: relative;
  width: 512px;
  height: 320px;
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  border-radius: 1.3rem;
  overflow: hidden;
  transition: filter 0.3s ease;
}

.testimonial-wrap:nth-child(1) .testimonial-card {
  transform: rotate(-4deg);
  margin-right: clamp(-363px, -768px + 45vw, -170px);
  z-index: 3;
}

.testimonial-wrap:nth-child(2) .testimonial-card {
  transform: translateY(3rem);
  z-index: 2;
}

.testimonial-wrap:nth-child(3) .testimonial-card {
  transform: rotate(4deg);
  margin-left: clamp(-363px, -768px + 45vw, -170px);
  z-index: 1;
}

.testimonial-card:hover {
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.45));
}

/* ── Card images ──────────────────────────────────────────── */

.testimonial-card__bg {
  position: absolute;
  inset: -2px;
  object-fit: fill;
  pointer-events: none;
}

.testimonial-card__hover {
  position: absolute;
  inset: -2px;
  object-fit: fill;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.testimonial-card:hover .testimonial-card__hover {
  opacity: 0.6;
}

/* ── Card body ────────────────────────────────────────────── */

.testimonial-card__body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem;
}

.testimonial-card__quote {
  font-family: var(--font-base);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--color-text);
  margin: 0;
}

.testimonial-card__author {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
}

.testimonial-card__author-link {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  cursor: pointer;
  text-decoration: none;
}

.testimonial-card:hover .testimonial-card__name,
.testimonial-card:hover .testimonial-card__role {
  color: var(--color-text-light);
  transition: color 0.2s ease;
}

.testimonial-card__linkedin {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.testimonial-card__linkedin-badge {
  display: block;
  transition: filter 0.2s ease;
}

.testimonial-card__linkedin:hover .testimonial-card__linkedin-badge {
  filter: brightness(0) invert(1);
}

.testimonial-card__name {
  font-family: var(--font-base);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--color-text);
  margin: 0;
}

.testimonial-card__role {
  font-family: var(--font-base);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--color-text);
  margin: 0;
}

/* ── Mobile (≤ 900px) ─────────────────────────────────────── */

@media (max-width: 900px) {
  .testimonials__header {
    width: 100%;
    align-items: flex-end;
  }

  .testimonials__annotation {
    align-self: flex-end;
  }

  .testimonials__sub-label {
    font-size: 1.125rem;
  }

  .testimonials__heading {
    font-size: 3rem;
    text-align: right;
  }

  .testimonials__grid {
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 0 3rem;
    gap: 0;
  }

  /* Card base — the sticker PNG already carries the rounded corners, so no
     clipping needed. overflow:visible lets a card grow past its natural
     size when the quote needs more lines. Below, min-height (not
     aspect-ratio) keeps that natural sticker size as a floor: on a card
     that isn't a flex/grid item, aspect-ratio is a hard, definite size —
     content that needs more room overflows past it instead of growing it —
     whereas min-height is only a floor and lets the box grow with content. */
  .testimonial-card {
    width: clamp(280px, 86vw, 327px);
    height: auto;
    flex-shrink: 0;
    border-radius: 0;
    overflow: visible;
  }

  /* Reset desktop transforms / margins.
     Cards 1 + 3 use pre-rotated mobile stickers — no CSS rotation on top,
     otherwise the tilt doubles and the text leaves the paper. */
  .testimonial-wrap:nth-child(1) .testimonial-card {
    min-height: 342px;
    z-index: 3;
    transform: none;
    margin-right: 0;
    margin-bottom: -4px;
  }

  .testimonial-wrap:nth-child(2) .testimonial-card {
    min-height: 393px;
    z-index: 2;
    transform: none;
    margin-bottom: -5px;
  }

  .testimonial-wrap:nth-child(3) .testimonial-card {
    min-height: 342px;
    height: auto;
    z-index: 1;
    transform: none;
    margin-left: 0;
    margin-bottom: 0;
  }

  /* img tags stay visible — picture element switches src via <source> */
  .testimonial-card__bg,
  .testimonial-card__hover {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
  }

  /* Sticker 1 + 3 sit tilted inside a larger PNG with a transparent margin
     (paper 326px in a 367 / 351px canvas), while sticker 2 is edge-to-edge.
     Scale those two up so the paper itself spans the full card width — same
     visual width as card 2 — and centre the overhang. */
  .testimonial-wrap:nth-child(1) .testimonial-card__bg,
  .testimonial-wrap:nth-child(3) .testimonial-card__bg {
    inset: auto;
    left: 50%;
    top: 50%;
    translate: -50% -50%;
    max-width: none; /* base.css caps images at 100% */
  }

  .testimonial-wrap:nth-child(1) .testimonial-card__bg {
    width: calc(100% * 367 / 326);
    height: calc(100% * 381 / 342);
  }

  .testimonial-wrap:nth-child(3) .testimonial-card__bg {
    width: calc(100% * 351 / 326);
    height: calc(100% * 365 / 342);
  }

  /* Text and the yellow hover scribble follow the tilt baked into the sticker
     (measured from the PNG alpha: -3.81deg / +3.87deg). Both boxes are sized to
     the paper's true rectangle (325.3 x 341.2 inside a 326 x 342 bounding box),
     so their corners land on the paper corners once rotated. */
  .testimonial-wrap:nth-child(1) .testimonial-card__hover,
  .testimonial-wrap:nth-child(3) .testimonial-card__hover {
    inset: auto;
    left: 50%;
    top: 50%;
    width: calc(100% * 325.3 / 326);
    height: calc(100% * 341.2 / 342);
    translate: -50% -50%;
  }

  .testimonial-wrap:nth-child(1) .testimonial-card__body,
  .testimonial-wrap:nth-child(1) .testimonial-card__hover {
    rotate: -3.81deg;
  }

  .testimonial-wrap:nth-child(3) .testimonial-card__body,
  .testimonial-wrap:nth-child(3) .testimonial-card__hover {
    rotate: 3.87deg;
  }

  /* The tilt shifts the paper edge by ~10px between the top and bottom row,
     so cards 1 + 3 need a slightly wider gutter than card 2. */
  .testimonial-card__body {
    padding: 2rem 1.75rem;
    gap: 1.5rem;
  }

  .testimonial-wrap:nth-child(2) .testimonial-card__body {
    padding: 1.25rem 1.125rem;
  }

  .testimonial-card__quote {
    font-size: var(--font-size-18px);
  }

  .testimonial-card__name {
    font-size: var(--font-size-18px);
  }

  .testimonial-wrap:nth-child(1) .testimonial-card__name,
  .testimonial-wrap:nth-child(3) .testimonial-card__name {
    white-space: nowrap;
  }

  .testimonial-wrap:hover {
    z-index: 5;
  }
}

@media (max-width: 355px) {
  /* Tighter vertically, but the inline gutter has to stay wide enough to keep
     the text on the sticker (cards 1 + 3 have an inset paper edge). */
  .testimonial-card__body {
    padding-block: 1rem;
    padding-inline: 1.75rem;
    gap: 1rem;
  }

  /* Name + badge no longer fit side by side on one line here */
  .testimonial-card__author {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .testimonial-card__linkedin {
    margin-left: auto;
  }

  .testimonial-wrap:nth-child(1) .testimonial-card__name,
  .testimonial-wrap:nth-child(3) .testimonial-card__name {
    white-space: normal;
  }
}
