/* hero section */
.case-study-detail-hero-title {
  color: var(--black);
  font: var(--heading-h4);
  margin: 0;
  letter-spacing: -1.14px;
  @media (max-width: 991px) {
    letter-spacing: -1.02px;
  }
  @media (max-width: 449px) {
    letter-spacing: -0.84px;
  }
}

.case-study-detail-hero {
  display: flex;
  flex-direction: column;
  gap: 56px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  padding-bottom: 24px;
  max-width: 980px;
  width: 100%;
  @media (max-width: 1279px) {
    gap: 40px;
    padding-bottom: 20px;
  }
  @media (max-width: 991px) {
    gap: 40px;
  }
}

.case-study-image {
  width: 100%;
  margin-top: 40px;
  @media (max-width: 1279px) {
    margin-top: 24px;
  }
}

.case-study-image img {
  border-radius: 12px;
  width: 100%;
}

/* content section css */
.case-study-content {
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}

.post-section-width {
  max-width: 670px;
  margin-left: 0;
}

.content-width {
  max-width: 670px;
  &:first-child {
    margin-top: 0;
  }
  @media (max-width: 991px) {
    max-width: 100%;
  }
}

.case-study-top-content-wrapper {
  position: relative;
  display: flex;
  gap: 80px;
  width: 100%;
  @media (max-width: 991px) {
    gap: 40px;
    flex-direction: column;
  }
}

.case-study-detail-right-content {
  display: flex;
  flex-direction: column;
}

.case-study-detail-left-content {
  position: sticky;
  top: 120px;
  height: 100%;
  max-width: 230px;
  width: 100%;
  @media (max-width: 991px) {
    position: unset;
    max-width: 100%;
  }
}

.toc-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toc-title {
  font: var(--tag);
  color: var(--deep-violet);
  margin: 0;
  text-transform: uppercase;
}

.toc-item-wrapper {
  display: flex;
  flex-direction: column;
}

.toc-item {
  padding: 12px 0 12px 18px;
  display: flex;
  border-bottom: 1px solid var(--soft-grey);
  cursor: pointer;
  position: relative;
  &::before {
    content: "";
    position: absolute;
    left: 0;
    top: 21px;
    width: 6px;
    height: 6px;
    background-color: var(--soft-grey);
    border-radius: 50%;
    transition: background-color 0.3s ease;
  }
  @media (max-width: 991px) {
    padding: 8px 0 8px 18px;
    &::before {
      top: 17px;
    }
  }
}

.toc-item p {
  font: var(--body-b3);
  color: var(--grey);
  margin: 0;
  transition: color 0.3s ease;
}

.toc-item:hover {
  &::before {
    background-color: var(--forest-green);
  }
}

.toc-item:hover p {
  color: var(--black);
}

.toc-item.active {
  p {
    color: var(--black);
  }
  &::before {
    background-color: var(--forest-green);
  }
}

.case-study-detail-back-link {
  @media (max-width: 1279px) {
    position: unset;
  }
}

.case-study-detail-back-link.show-desktop {
  @media (max-width: 1279px) {
    display: none;
  }
}

.case-study-detail-back-link.show-mobile {
  display: none;
  @media (max-width: 1279px) {
    display: flex;
  }
}

.case-study-detail-hero-top-content {
  display: flex;
  gap: 32px;
  flex-direction: column;
  align-items: flex-start;
  @media (max-width: 1279px) {
    gap: 24px;
  }
}

.top-resource-section {
  margin-bottom: 0;
  @media (max-width: 991px) {
    margin-top: 90px;
  }
  @media (max-width: 449px) {
    margin-top: 80px;
  }
}

.case-study-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;

  @media (max-width: 991px) {
    gap: 16px;
    grid-template-columns: repeat(2, 1fr);
  }
  @media (max-width: 550px) {
    grid-template-columns: auto;
  }
}

.case-study-detail-card-list-section {
  .case-study-card-grid .ebooks-card:last-child {
    @media (max-width: 991px) {
      display: none;
    }
  }
}

.case-studies-hero {
  padding: 111px 0 120px;
  @media (max-width: 1279px) {
    padding: 90px 0;
  }
  @media (max-width: 767px) {
    padding: 80px 0;
  }
}

/* Shared case study components */
.case-study-stats-bar {
  background: var(--off-white);
  padding: 32px;
  border-radius: 12px;
  margin-bottom: 80px;
  @media (max-width: 991px) {
    padding: 24px;
    margin-bottom: 64px;
  }
  @media (max-width: 767px) {
    padding: 20px;
    margin-bottom: 40px;
  }
}
/* Fixed column counts per breakpoint, each item spanning 2 tracks, so a short
   last row can be centred and the vertical dividers can be dropped on the first
   item of every row (not just the first item of the grid). */
.case-study-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  column-gap: 0;
  row-gap: 32px;
}
.case-study-stat-item {
  text-align: center;
  padding: 0 20px;
  border-left: 1px solid var(--soft-grey);
}
/* first item of each row: no vertical divider */
.case-study-stat-item:nth-child(5n + 1) {
  border-left: none;
}
@media (max-width: 1279px) {
  /* 3 per row: 3 + 2 centred */
  .case-study-stats-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  .case-study-stat-item {
    grid-column: span 2;
  }
  .case-study-stat-item:nth-child(4) {
    grid-column: 2 / span 2;
  }
  .case-study-stat-item:nth-child(5n + 1) {
    border-left: 1px solid var(--soft-grey);
  }
  .case-study-stat-item:nth-child(3n + 1) {
    border-left: none;
  }
}

@media (max-width: 767px) {
  /* 2 per row: 2 + 2 + 1 centred */
  .case-study-stats-grid {
    grid-template-columns: repeat(4, 1fr);
    row-gap: 24px;
  }
  .case-study-stat-item:nth-child(4) {
    grid-column: span 2;
  }
  .case-study-stat-item:nth-child(5) {
    grid-column: 2 / span 2;
  }
  .case-study-stat-item:nth-child(3n + 1) {
    border-left: 1px solid var(--soft-grey);
  }
  .case-study-stat-item:nth-child(2n + 1) {
    border-left: none;
  }
}

@media (max-width: 600px) {
  .case-study-stats-grid {
    grid-template-columns: 1fr;
    row-gap: 0;
  }
  .case-study-stat-item,
  .case-study-stat-item:nth-child(4),
  .case-study-stat-item:nth-child(5) {
    grid-column: auto;
  }
  .case-study-stat-item {
    border-left: none !important;
    border-bottom: 1px solid var(--soft-grey);
    padding: 16px 0;
  }
  .case-study-stat-item:first-child {
    padding-top: 0;
  }
  .case-study-stat-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
}

.case-study-stat-value {
  font: var(--heading-h6);
  color: var(--black);
  margin: 0;
}

.case-study-stat-label {
  font: var(--body-b3);
  color: var(--grey);
  margin: 4px 0 0;
  text-wrap: balance;
}

.case-study-stat-note {
  font: var(--tag);
  color: var(--grey);
  margin: 4px 0 0;
}

.case-study-blockquote {
  border-left: 4px solid var(--forest-green);
  padding: 32px;
  background: var(--off-white);
  border-radius: 12px;
  margin: 48px 0;
  @media (max-width: 991px) {
    margin: 40px 0;
    padding: 24px;
  }
  @media (max-width: 449px) {
    margin: 32px 0;
    padding: 20px;
  }
}
.case-study-blockquote p {
  font: var(--body-b2);
  font-style: italic;
  color: var(--black);
  margin: 0;
}

.case-study-blockquote footer {
  margin-top: 12px;
}

.case-study-blockquote footer strong {
  font: var(--body-b3);
  color: var(--black);
}

.case-study-blockquote footer span {
  font: var(--body-b3);
  color: var(--grey);
}

/* Optional author row with headshot (used by dtm_quote()) */
.case-study-quote-author {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}

/* two classes so it beats .blog-content img (width: 100%, margin: 48px 0) */
.case-study-blockquote .case-study-quote-avatar {
  width: 50px;
  height: 50px;
  margin: 0;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.case-study-quote-author-text {
  display: flex;
  flex-direction: column;
}

.case-study-quote-author-text strong {
  font: var(--body-b3);
  font-weight: 600;
  color: var(--black);
}

.case-study-quote-author-text span {
  font: var(--body-b3);
  color: var(--grey);
}

.case-study-timeline {
  display: flex;
  flex-direction: column;
  margin: 24px 0;
}

.case-study-timeline-row {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--soft-grey);
  @media (max-width: 600px) {
    flex-direction: column;
    gap: 4px;
  }
}

.case-study-timeline-label {
  font: var(--tag);
  color: var(--black);
  text-transform: uppercase;
  min-width: 140px;
  padding-top: 2px;
  letter-spacing: 0.05em;
}

.case-study-timeline-text {
  font: var(--body-b3);
  color: var(--black);
}

.case-study-factors-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 24px 0;
  @media (max-width: 600px) {
    grid-template-columns: 1fr;
  }
}

.case-study-factor-card {
  border: 1px solid var(--soft-grey);
  border-radius: 12px;
  padding: 24px;
  @media (max-width: 991px) {
    padding: 20px;
  }
}

.case-study-factor-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.case-study-factor-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--black);
  background: var(--off-white);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.case-study-factor-title {
  font: var(--body-b2);
  font-weight: 600;
  color: var(--black);
  margin: 0 !important;
}

.case-study-factor-desc {
  font: var(--body-b3);
  color: var(--grey);
  margin: 0;
}

.case-study-hero-logo {
  height: 28px;
  width: auto;
}

.case-study-hero-subtitle {
  font: var(--body-b2);
  color: var(--grey);
  margin: 0;
}

.case-study-hero-eyebrow {
  font: var(--tag);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--deep-violet);
  margin: 0 0 4px;
}

.case-study-content-wrapper {
  padding: 80px 0;
}
