/* ─────────────────────────────────────────────
   TESTIMONIAL LETTERS — the colleague quotes as a
   pile of typed letters. Click / swipe the top one
   to send it to the back of the pile.
   Add-on for amandabaruch.com (needs testimonial-letters.js)
   ───────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Handlee&display=swap');

/* section layout once the pile is built: copy left, pile right */
.testimonials.tl-ready {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  column-gap: 6vw;
  align-items: start;
}
.testimonials.tl-ready > * { grid-column: 1; }
.testimonials.tl-ready .testimonial-controls,
.testimonials.tl-ready .testimonials-grid { display: none !important; }
.testimonials.tl-ready .tl-pile-wrap { grid-column: 2; grid-row: 1 / span 6; }

.tl-lede { font-size: 14px; line-height: 1.7; color: #43546a; max-width: 340px; margin-top: 4px; }

.tl-controls { display: flex; align-items: center; gap: 14px; margin-top: 34px; }
.tl-btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid rgba(35, 76, 136, .3);
  border-radius: 50%;
  background: transparent;
  color: #234c88;
  font-size: 16px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.tl-btn:hover { background: #234c88; color: #fff; }
.tl-btn:focus-visible { outline: 2px solid #234c88; outline-offset: 3px; }
.tl-count { font-family: var(--display, 'Noto Serif', serif); font-size: 24px; color: #172c46; min-width: 64px; text-align: center; font-weight: 600; letter-spacing: -.02em; }
.tl-count small { font-family: 'Noto Sans', sans-serif; font-size: 11px; letter-spacing: .1em; color: #556070; }
.tl-tip { margin-top: 14px; font: 600 10px/1.4 'Noto Sans', sans-serif; letter-spacing: .14em; text-transform: uppercase; color: #556070; }

/* ── THE PILE ── */
.tl-pile-wrap { position: relative; padding: 46px 40px 52px; }
.tl-pile {
  --sp: 1;
  position: relative;
  display: grid;
  max-width: 470px;
  margin: 0 auto;
  outline: none;
}
.tl-pile:focus-visible { outline: 2px dashed #234c88; outline-offset: 18px; }

/* a kraft envelope peeking out from under the letters */
.tl-envelope {
  position: absolute;
  z-index: 0;
  right: -6%;
  bottom: -9%;
  width: 62%;
  aspect-ratio: 1.55;
  background: #abc5d9;
  background-image: linear-gradient(160deg, rgba(255, 255, 255, .25), transparent 55%);
  border-radius: 3px;
  box-shadow: 0 16px 30px -22px rgba(23, 44, 70, .55);
  rotate: 7deg;
}
.tl-envelope::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #95b0c8;
  clip-path: polygon(0 0, 100% 0, 50% 58%);
  border-radius: 3px;
}

.tl-letter {
  --tx: 0px; --ty: 0px; --rot: 0deg; --dx: 0px; --dy: 0px;
  grid-area: 1 / 1;
  position: relative;
  z-index: 1;
  padding: 24px 28px 24px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 18px 36px -24px rgba(23, 44, 70, .55), 0 2px 6px -4px rgba(23, 44, 70, .3);
  transform: translate(calc(var(--tx) * var(--sp) + var(--dx)), calc(var(--ty) * var(--sp) + var(--dy))) rotate(var(--rot));
  transition: transform .55s cubic-bezier(.2, .8, .2, 1);
  user-select: none;
  -webkit-user-select: none;
}
.tl-letter.is-top { cursor: pointer; touch-action: pan-y; }
.tl-letter.is-dragging { transition: none; cursor: grabbing; }

/* where each sheet rests in the pile (0 = on top) */
.tl-letter[data-depth="0"] { --tx: 0px;   --ty: 0px;   --rot: -1.2deg; }
.tl-letter[data-depth="1"] { --tx: -34px; --ty: -32px; --rot: 3deg; }
.tl-letter[data-depth="2"] { --tx: 38px;  --ty: -44px; --rot: -4deg; }
.tl-letter[data-depth="3"] { --tx: -22px; --ty: 34px;  --rot: 4.5deg; }
.tl-letter[data-depth="4"] { --tx: 44px;  --ty: 20px;  --rot: 2deg; }
.tl-letter[data-depth="5"] { --tx: -48px; --ty: 4px;   --rot: -5.5deg; }
.tl-letter[data-depth="6"],
.tl-letter[data-depth="7"],
.tl-letter[data-depth="8"] { --tx: 10px; --ty: -12px; --rot: 6deg; }

/* leaving the pile */
.tl-letter.tl-out-next { --tx: 115%; --ty: -6%; --rot: 13deg; }
.tl-letter.tl-out-prev { --tx: -115%; --ty: -6%; --rot: -13deg; }

/* only the top letter can be read — sheets underneath stay blank */
.tl-letter:not(.is-top) .tl-body,
.tl-letter:not(.is-top) .tl-head { visibility: hidden; }

.tl-head {
  font: 400 11.5px/1.4 'Noto Sans', sans-serif;
  letter-spacing: .02em;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px dashed color-mix(in srgb, var(--ink) 30%, transparent);
}
.tl-head b { font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

.tl-quote {
  margin: 0;
  font: 400 15.5px/1.65 'Noto Sans', sans-serif;
  hyphens: manual;
  -webkit-hyphens: manual;
  text-wrap: pretty;
  overflow-wrap: break-word;
}
.tl-quote p { margin: 0; }

/* hand-drawn ink underline under one phrase */
.tl-mark { position: relative; white-space: nowrap; text-indent: 0; }
.tl-mark svg {
  position: absolute;
  left: -3%; top: 88%;
  width: 106%; height: .55em;
  overflow: visible;
  pointer-events: none;
  color: var(--pen);
}
.tl-mark path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset .9s .35s ease;
}
.tl-letter.is-top .tl-mark path { stroke-dashoffset: 0; }

.tl-sign {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  margin: 20px 0 0; padding: 0; background: none; border: 0;
  color: var(--ink); text-align: left; flex-direction: row;
}
.tl-sign-text { display: grid; gap: 6px; min-width: 0; }
.tl-name { font: 400 22px/1.1 'Handlee', cursive; color: var(--pen); }
.tl-role { font: 600 11px/1.45 'Noto Sans', sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); opacity: .8; }

/* small round postmark */
.tl-postmark { flex: none; width: 68px; height: 68px; color: var(--pen); opacity: .7; rotate: -14deg; }

.tl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── SMALLER SCREENS ── */
@media (max-width: 900px) {
  .testimonials.tl-ready { display: block; }
  .tl-pile-wrap { padding: 44px 18px 50px; margin-top: 10px; }
  .tl-pile { --sp: .55; }
  .tl-controls { justify-content: center; margin-top: 8px; }
  .tl-tip { text-align: center; }
}
@media (max-width: 560px) {
  .tl-pile-wrap { padding: 28px 14px 40px; overflow: hidden; }
  .tl-pile { --sp: .22; }
  .tl-envelope { right: 0; bottom: -4%; }
  .tl-letter { padding: 20px 18px 20px; }
  .tl-letter[data-depth="0"] { --rot: -.6deg; }
  .tl-quote { font-size: 14.5px; line-height: 1.6; }
  .tl-head { font-size: 11.5px; }
  .tl-sign { align-items: flex-end; }
  .tl-postmark { width: 54px; height: 54px; }
  .tl-name { font-size: 20px; }
}

/* respect "Motion off" and reduced-motion settings */
.motion-paused .tl-letter, .motion-paused .tl-mark path { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .tl-letter, .tl-mark path { transition: none !important; }
}
