/* Testimonials — a stack of paper notes held by a paper clip.
   Next: the clip pops off, the front note lifts with its corner curling, turns away
   and slides in behind; the note beneath rises and catches the light.
   Previous: the back note comes out and covers the stack.
   Behaviour: /assets/testimonials.js */
.tm {
  --tm-ink: #3f4a1d;      /* deep olive, from the hero's olive */
  --tm-olive: #5b6b25;
  --tm-paper: #fcfbf8;
  --tm-clip: #d4322a;
  --tm-ease: cubic-bezier(.22, 1, .36, 1);
}
.tm__panel { position: relative; text-align: center; }
.tm__title { /* same script and olive as "Meet the" in the hero */
  margin: 0;
  padding: .12em .2em .02em; /* room for the script's tall loops */
  font-family: var(--f-hero-script);
  font-weight: 400;
  font-size: clamp(64px, 7.6vw, 136px);
  line-height: 1.1;
  letter-spacing: 0;
  color: var(--hero-olive);
}

/* Stage: arrow · stack · arrow */
.tm__stage {
  display: grid;
  grid-template-columns: auto minmax(0, 700px) auto;
  justify-content: center;
  align-items: center;
  gap: clamp(48px, 8vw, 150px);
  margin-top: clamp(36px, 4vw, 64px);
}
.tm__arrow--prev { grid-column: 1; }
.tm__arrow--next { grid-column: 3; }
.tm__stack {
  grid-column: 2; /* stays centred even when the arrows are hidden */
  position: relative;
  display: grid;
  width: 100%;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

/* Paper — cards and the two blank sheets underneath share one grid cell */
.tcard, .tm__paper {
  grid-area: 1 / 1;
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / .9), rgb(255 255 255 / 0) 30%),
    radial-gradient(120% 90% at 0% 100%, rgb(232 224 210 / .35), transparent 60%),
    var(--tm-paper);
  box-shadow: 0 0 0 1px rgb(60 40 20 / .05), 0 2px 6px rgb(60 40 20 / .06), 0 22px 44px -22px rgb(60 40 20 / .34);
}
.tm__paper--a { transform: translate(3.5%, 3%) rotate(7deg); }
.tm__paper--b { transform: translate(-3%, 4.5%) rotate(-8deg); }

.tcard {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: clamp(320px, 26vw, 410px);
  padding: clamp(26px, 2.8vw, 46px) clamp(24px, 3.8vw, 60px) clamp(24px, 2.6vw, 40px);
  text-align: left;
  color: var(--tm-ink);
  transform-origin: 50% 60%;
  transition: transform .85s var(--tm-ease), box-shadow .5s var(--tm-ease);
  transition-delay: var(--lag, 0s);
  will-change: transform;
}
.tcard.is-lifted { box-shadow: 0 0 0 1px rgb(60 40 20 / .05), 0 14px 20px -8px rgb(60 40 20 / .22), 0 50px 80px -30px rgb(60 40 20 / .45); }

/* Content shows on the front note only */
.tcard > :not(.tcard__fx) { opacity: 0; transition: opacity .25s ease; }
.tcard.is-front > :not(.tcard__fx) { opacity: 1; transition: opacity .5s ease .3s; }
.tcard.is-leaving > :not(.tcard__fx) { opacity: 1; transition: none; } /* keeps its words while it is tossed away */

/* Words ink in one after another */
.tcard .tw { display: inline-block; opacity: 0; transform: translateY(.35em); filter: blur(3px); transition: opacity .5s ease, transform .6s var(--tm-ease), filter .5s ease; }
.tcard.is-front .tw { opacity: 1; transform: none; filter: none; transition-delay: calc(.5s + var(--w) * 16ms); }
.tcard.is-leaving .tw { opacity: 1; transform: none; filter: none; transition: none; }

.tcard__sample {
  position: absolute; top: 14px; right: 16px;
  padding: 3px 9px; border: 1px dashed currentColor; border-radius: 99px;
  font-family: var(--f-ui); font-size: 12px; letter-spacing: .04em;
}

.tcard__stars { display: flex; justify-content: center; gap: clamp(8px, .9vw, 14px); }
.tcard__stars svg { width: clamp(26px, 2.4vw, 38px); fill: var(--tm-olive); transform: scale(0) rotate(-30deg); transition: transform .6s cubic-bezier(.34, 1.56, .64, 1); }
.tcard.is-front .tcard__stars svg { transform: none; }
.tcard.is-leaving .tcard__stars svg { transform: none; transition: none; }
.tcard.is-front .tcard__stars svg:nth-child(1) { transition-delay: .35s; }
.tcard.is-front .tcard__stars svg:nth-child(2) { transition-delay: .42s; }
.tcard.is-front .tcard__stars svg:nth-child(3) { transition-delay: .49s; }
.tcard.is-front .tcard__stars svg:nth-child(4) { transition-delay: .56s; }
.tcard.is-front .tcard__stars svg:nth-child(5) { transition-delay: .63s; }
.tcard__stars--empty svg { fill: none; stroke: var(--tm-olive); stroke-width: 1.4; }
.tcard--invite:hover .tcard__stars--empty svg { fill: var(--tm-olive); }

.tcard__text { margin: clamp(18px, 2vw, 30px) 0 0; }
.tcard__text p {
  margin: 0 0 .5em;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(16px, 1.22vw, 19px);
  line-height: 1.6;
  letter-spacing: -.005em;
}
.tcard__text p:last-child { margin-bottom: 0; }

.tcard__sign { display: grid; justify-items: end; margin-top: auto; padding-top: clamp(16px, 1.8vw, 26px); }
.tcard__name { font-family: var(--f-hero-script); font-size: clamp(38px, 3.4vw, 56px); line-height: 1.15; letter-spacing: 0; padding-top: .1em; }
.tcard__meta { margin-top: 8px; font-family: var(--f-ui); font-size: clamp(13px, 1vw, 15px); letter-spacing: .06em; text-transform: uppercase; color: #8a8270; }
.tcard__sign--invite { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 14px 24px; }
.tcard__link { font-family: var(--f-ui); font-size: 15px; color: var(--tm-olive); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgb(91 107 37 / .35); }
.tcard__link:hover { text-decoration-color: currentColor; }

/* Effects layered on each note (added by the script) */
.tcard__fx { position: absolute; pointer-events: none; }
.tcard__curl { /* folded-up corner: a triangle of the paper's back, with its shadow */
  right: 0; bottom: 0; width: 0; aspect-ratio: 1;
  filter: drop-shadow(-5px -5px 7px rgb(60 40 20 / .22));
}
.tcard__curl::before {
  content: ""; position: absolute; inset: 0;
  clip-path: polygon(0 0, 100% 0, 0 100%);
  background: linear-gradient(135deg, #fbf9f4 0%, #efe9de 45%, #ddd5c6 100%);
}
.tcard__sheen { inset: 0; overflow: hidden; border-radius: inherit; opacity: 0; }
.tcard__sheen::before {
  content: ""; position: absolute; top: -20%; bottom: -20%; left: 0; width: 45%;
  background: linear-gradient(100deg, transparent, rgb(255 255 255 / .9) 45%, rgb(255 255 255 / .9) 55%, transparent);
  transform: translateX(-120%) skewX(-12deg);
}
.tcard__sheen.is-run { opacity: .75; }
.tcard__sheen.is-run::before { animation: tm-sheen 1.1s cubic-bezier(.45, 0, .2, 1) forwards; }
@keyframes tm-sheen { to { transform: translateX(260%) skewX(-12deg); } }
.tcard__shade { inset: 0; border-radius: inherit; background: rgb(50 40 20 / .16); opacity: 0; }

/* Paper clip — sits on the front note's top-left corner */
.tm__clip {
  position: absolute; z-index: 80;
  left: clamp(26px, 5%, 52px); top: clamp(-34px, -3.2vw, -22px);
  width: clamp(24px, 2.4vw, 34px); height: auto;
  stroke: var(--tm-clip);
  transform: rotate(-24deg);
  transform-origin: 50% 80%;
  filter: drop-shadow(-2px 3px 2px rgb(80 20 10 / .25));
  pointer-events: none;
}

/* Arrows */
.tm__arrow {
  position: relative;
  display: grid; place-items: center;
  width: clamp(48px, 4vw, 60px); height: clamp(48px, 4vw, 60px);
  border: 1px solid rgb(63 74 29 / .2); border-radius: 50%;
  background: #fff;
  color: var(--tm-ink);
  overflow: hidden;
  box-shadow: 0 10px 24px -14px rgb(60 40 20 / .4);
  transition: transform .4s var(--tm-ease), border-color .3s, color .4s;
}
.tm__arrow::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--tm-ink); transform: scale(0); transition: transform .45s var(--tm-ease); }
.tm__arrow:hover { color: var(--tm-paper); border-color: var(--tm-ink); }
.tm__arrow:hover::before { transform: scale(1); }
.tm__arrow svg { position: relative; width: 22px; transition: transform .4s var(--tm-ease); }
.tm__arrow--prev:hover svg { transform: translateX(-3px); }
.tm__arrow--next:hover svg { transform: translateX(3px); }
.tm__arrow:active { transform: scale(.92); }
.tm__arrow:focus-visible { outline: 2px solid var(--tm-ink); outline-offset: 3px; }
.tm__arrow[hidden], .tm__count[hidden] { display: none; }
.tm__count { margin: clamp(28px, 2.6vw, 40px) 0 0; font-family: var(--f-ui); font-size: 15px; letter-spacing: .08em; color: #8a8270; }
.tm__count b { color: var(--tm-ink); font-weight: 500; }

/* Tablets and phones: arrows move under the notes so nothing is ever cut off */
@media (max-width: 1100px) {
  .tm__stage { grid-template-columns: 1fr 1fr; gap: 40px 20px; max-width: 700px; margin-inline: auto; }
  .tm__stack { grid-column: 1 / -1; grid-row: 1; }
  .tm__arrow--prev { grid-row: 2; justify-self: end; }
  .tm__arrow--next { grid-row: 2; grid-column: 2; justify-self: start; }
  .tm__count { margin-top: 18px; }
}
@media (max-width: 600px) {
  .tm__stage { gap: 34px 16px; margin-top: 28px; }
  .tm__stack { width: calc(100% - 10px); margin-inline: auto; }
  .tcard { min-height: 0; padding: 26px 20px 22px; }
  .tcard__sample { top: 10px; right: 10px; font-size: 10.5px; padding: 2px 7px; }
  .tcard__stars { margin-top: 10px; }
  .tcard__stars svg { width: 22px; }
  .tcard__text { margin-top: 16px; }
  .tcard__text p { font-size: 15.5px; line-height: 1.6; }
  .tcard__name { font-size: 36px; }
  .tcard__meta { font-size: 11.5px; }
  .tcard__sign--invite .zbtn { width: 100%; }
  .tm__clip { width: 22px; left: 22px; top: -20px; }
  .tm__arrow { width: 52px; height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  .tcard, .tcard > *, .tcard .tw, .tcard__stars svg { transition: opacity .2s ease !important; transform: none; filter: none; }
  .tcard__sheen.is-run::before { animation: none; }
}
/* Without JavaScript the first note is simply shown on top. */
html:not(.js) .tcard:first-of-type > * { opacity: 1; }
html:not(.js) .tcard__stars svg { transform: none; }
