/* Testimonials page-specific styles. */

/* ========== Letter cards ========== */
.testimonial-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.6rem;
}
.testimonial-card {
  display: grid;
  grid-template-columns: minmax(0, 0.42fr) minmax(0, 0.58fr);
  background: var(--ink);
  color: var(--white);
  border: 1px solid rgba(15, 19, 24, 0.9);
  overflow: hidden;
  /* Keeps the card clear of the fixed header when a link lands on it. */
  scroll-margin-top: 7rem;
  transition:
    transform 260ms ease,
    box-shadow 260ms ease,
    border-color 260ms ease;
}
.testimonial-card:hover,
.testimonial-card:focus-within {
  transform: translateY(-3px);
  border-color: var(--line-blue);
  box-shadow: 0 22px 44px rgba(20, 34, 66, 0.2);
}

/* The letter is shown whole, as paper on a neutral board. */
.testimonial-letter {
  position: relative;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: #e4e7eb;
}
.testimonial-letter img {
  width: 100%;
  height: auto;
  background: var(--white);
  border: 1px solid rgba(15, 19, 24, 0.12);
  box-shadow: 0 6px 18px rgba(15, 19, 24, 0.16);
  transition:
    transform 260ms ease,
    box-shadow 260ms ease;
}
/* The paper lifts off the board; nothing covers the neighbouring card. */
.testimonial-card:hover .testimonial-letter img,
.testimonial-letter:focus-visible img {
  transform: translateY(-5px);
  box-shadow: 0 18px 34px rgba(15, 19, 24, 0.26);
}
.testimonial-letter-cue {
  position: absolute;
  left: 50%;
  bottom: 2.3rem;
  padding: 0.55rem 0.95rem;
  background: rgba(10, 13, 18, 0.9);
  color: var(--white);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
  pointer-events: none;
}
.testimonial-card:hover .testimonial-letter-cue,
.testimonial-letter:focus-visible .testimonial-letter-cue {
  opacity: 1;
  transform: translate(-50%, 0);
}
.testimonial-letter:focus-visible,
.letter-dialog-close:focus-visible,
.letter-text summary:focus-visible {
  outline: 2px solid var(--blue-bright);
  outline-offset: 3px;
}
.testimonial-letter:focus-visible {
  outline-offset: -4px;
}

.testimonial-body {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1.9rem 1.8rem 1.7rem;
  min-width: 0;
}
.testimonial-company {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue-bright);
}
.testimonial-quote p {
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--off);
}
.testimonial-signer {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.testimonial-signer .name {
  font-size: 0.94rem;
  font-weight: 700;
}
.testimonial-signer .role {
  font-size: 0.8rem;
  color: var(--muted);
}
.testimonial-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem 1.2rem;
  margin-top: auto;
  padding-top: 0.4rem;
}
.testimonial-card .btn-outline:hover {
  color: var(--white);
}

/* ========== Full letter dialog ========== */
html:has(.letter-dialog[open]) {
  overflow: hidden;
}
.letter-dialog {
  width: min(960px, calc(100% - 2rem));
  max-height: min(900px, 92vh);
  margin: auto;
  padding: 0;
  background: linear-gradient(
    180deg,
    rgba(16, 20, 27, 0.98),
    rgba(8, 11, 16, 0.99)
  );
  color: var(--white);
  border: 1px solid rgba(59, 130, 246, 0.28);
  box-shadow:
    0 35px 110px rgba(0, 0, 0, 0.72),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.letter-dialog[open] {
  display: flex;
  flex-direction: column;
}
.letter-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
}
.letter-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--line);
}
.letter-dialog-head .eyebrow {
  margin-bottom: 0.4rem;
}
.letter-dialog-head h2 {
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.letter-dialog-close {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(59, 130, 246, 0.45);
  background: rgba(0, 0, 0, 0.52);
  color: var(--white);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}
.letter-dialog-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
}
.letter-page {
  padding: 1.4rem;
  background: #dfe3e8;
}
.letter-page img {
  width: 100%;
  height: auto;
  background: var(--white);
  border: 1px solid rgba(15, 19, 24, 0.14);
  box-shadow: 0 8px 22px rgba(15, 19, 24, 0.2);
}
.letter-dialog-foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.2rem;
  padding: 1.4rem;
}
.letter-text {
  width: 100%;
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
}
.letter-text summary {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue-bright);
  cursor: pointer;
}
.letter-text-body {
  max-width: 68ch;
  padding-top: 1rem;
}
.letter-text-body p {
  margin-bottom: 0.9rem;
  color: var(--off);
  font-size: 0.95rem;
  line-height: 1.7;
}
.letter-text-body .letter-text-sign {
  color: var(--white);
  font-weight: 600;
}

@media (max-width: 1100px) {
  .testimonial-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 620px) {
  .testimonial-card {
    grid-template-columns: 1fr;
  }
  .testimonial-letter img {
    max-width: 240px;
  }
  .letter-page {
    padding: 0.8rem;
  }
}
/* Touch screens have no hover, so the cue would never show; the button below does that job. */
@media (hover: none) {
  .testimonial-letter-cue {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .testimonial-card,
  .testimonial-letter img,
  .testimonial-letter-cue {
    transition: none;
  }
  .testimonial-card:hover,
  .testimonial-card:focus-within,
  .testimonial-card:hover .testimonial-letter img,
  .testimonial-letter:focus-visible img {
    transform: none;
  }
  .testimonial-card:hover .testimonial-letter-cue,
  .testimonial-letter:focus-visible .testimonial-letter-cue {
    transform: translate(-50%, 0);
  }
}

/* The dialog eyebrow sits on a dark panel. */
.letter-dialog .eyebrow {
  color: var(--blue-bright);
}
