/* Related media list under content pages. Colours come from the theme variables. */

.related-media {
  --rm-accent: var(--tj-color-theme-primary, #1e8a8a);
  --rm-tint: #f2f8f8;
  --rm-border: #dce8e8;
  --rm-ink: var(--tj-color-heading-primary, #0c1e21);
  --rm-muted: #5d7275;
  margin: 24px 0 64px;
}

.related-media__heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  color: var(--rm-ink);
}

.related-media__heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rm-border);
}

.related-media__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.related-media__item[hidden] {
  display: none;
}

.related-media__card {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  padding: 12px 14px 12px 12px;
  background: #fff;
  border: 1px solid var(--rm-border);
  border-left: 3px solid var(--rm-accent);
  border-radius: 8px;
  color: var(--rm-ink);
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.related-media__card:hover,
.related-media__card:focus-visible {
  border-color: var(--rm-accent);
  box-shadow: 0 6px 18px rgba(12, 30, 33, 0.08);
  transform: translateY(-2px);
  color: var(--rm-ink);
}

.related-media__thumb {
  position: relative;
  flex: 0 0 96px;
  width: 96px;
  height: 72px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--rm-tint);
}

/* responsive.css forces content images to fixed sizes; keep the thumbnail square-cropped. */
.related-media__thumb img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover;
}

.related-media__play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(12, 30, 33, 0.65);
}

.related-media__play::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 55%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent #fff;
}

.related-media__body {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.related-media__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  line-height: 1;
  color: var(--rm-muted);
}

.related-media__tag {
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--rm-tint);
  color: var(--rm-accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.related-media__title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.related-media__arrow {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.35;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.related-media__card:hover .related-media__arrow {
  opacity: 1;
  color: var(--rm-accent);
  transform: translateX(3px) rotate(45deg);
}

.related-media__more {
  margin-top: 20px;
  text-align: center;
}

.related-media__toggle {
  padding: 10px 22px;
  border: 1px solid var(--rm-accent);
  border-radius: 6px;
  background: #fff;
  color: var(--rm-accent);
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease;
}

.related-media__toggle:hover {
  background: var(--rm-accent);
  color: #fff;
}

@media (max-width: 1199px) {
  .related-media__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .related-media__list {
    grid-template-columns: 1fr;
  }

  .related-media__thumb {
    flex-basis: 80px;
    width: 80px;
    height: 60px;
  }
}
