/* Testimonials page-specific styles. */

/* ========== Letter cards ========== */
.testimonial-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.4rem;
}
.testimonial-card {
  display: grid;
  grid-template-columns: minmax(0, 0.42fr) minmax(0, 0.58fr);
  background: var(--ink);
  color: var(--white);
  overflow: hidden;
  transition:
    transform var(--t),
    box-shadow var(--t);
}
.testimonial-card:hover,
.testimonial-card:focus-within {
  transform: translateY(-4px);
  box-shadow: 0 18px 36px rgba(31, 53, 100, 0.22);
}

/* The letter is shown whole, as paper on a neutral board. */
.testimonial-letter {
  display: grid;
  place-items: center;
  padding: 1.4rem;
  background: #dfe3e8;
  cursor: zoom-in;
}
.testimonial-letter 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);
}
.testimonial-letter:focus-visible,
.letter-dialog-close:focus-visible,
.letter-text summary:focus-visible {
  outline: 2px solid var(--blue-bright);
  outline-offset: 3px;
}

.testimonial-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.7rem 1.6rem 1.6rem;
  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: 0.98rem;
  line-height: 1.65;
  color: var(--off);
}
.testimonial-signer {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-top: 0.9rem;
  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;
}
/* ========== Hover preview (wide screens with a mouse) ========== */
.letter-preview {
  position: fixed;
  top: 50%;
  z-index: 1400;
  height: min(88vh, 920px);
  aspect-ratio: 1400 / 1812;
  background: var(--white);
  border: 1px solid var(--line-blue);
  box-shadow: 0 35px 110px rgba(0, 0, 0, 0.55);
  transform: translateY(-50%);
  opacity: 0;
  visibility: hidden;
  cursor: zoom-in;
  transition:
    opacity var(--t),
    visibility var(--t);
}
.letter-preview[data-side="right"] {
  right: 1.5rem;
}
.letter-preview[data-side="left"] {
  left: 1.5rem;
}
.letter-preview.is-visible {
  opacity: 1;
  visibility: visible;
}
.letter-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.letter-preview span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.7rem 1rem;
  background: rgba(10, 13, 18, 0.9);
  color: var(--off);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
}

/* ========== 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;
  }
}

/* The site's base blue is too dim for small text on the dark card and dialog. */
.testimonial-card .btn-outline,
.letter-dialog .eyebrow {
  color: var(--blue-bright);
}
.testimonial-card .btn-outline:hover {
  color: var(--white);
}
