.tp-video-library-page {
  width: min(1120px, 100%);
  margin-inline: auto;
  padding-block: clamp(32px, 6vw, 80px);
}

.tp-video-library-page > .wp-block-post-title {
  margin: 0 0 1rem;
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 1;
  letter-spacing: -.06em;
}

.tp-video-library .tp-video-library-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding: 0;
  list-style: none;
}

.tp-video-library-nav a {
  display: inline-block;
  padding: .4rem .8rem;
  border-radius: 999px;
  border: 1px solid #dcd9d3;
  color: #181818;
  background: #fff;
  text-decoration: none;
  font-size: .88rem;
}

.tp-video-library-nav a:hover { text-decoration: underline; }

.tp-video-library .tp-video-library-section {
  margin-block-start: clamp(34px, 6vw, 68px);
  padding-top: clamp(22px, 3.5vw, 40px);
  border-top: 1px solid #dcd9d3;
}

.tp-video-library-section h2 {
  margin: 0 0 1.1rem;
  scroll-margin-top: 24px;
  font-size: clamp(1.7rem, 3.6vw, 2.65rem);
  letter-spacing: -.04em;
  line-height: 1.1;
}

.tp-video-library .tp-video-library-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.tp-video-library-grid > .tp-video-library-card {
  min-width: 0;
  margin: 0;
}

.tp-video-library .tp-video-library-vertical {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tp-video-library-card h3 {
  margin: .65rem 0 .2rem;
  font-size: 1.02rem;
  line-height: 1.3;
}

.tp-video-library-card .tp-video-library-role {
  margin: 0;
  color: #55514c;
  font-size: .88rem;
}

.tp-video-library-card .wp-block-embed,
.tp-video-library-card .wp-block-video {
  margin: 0;
  overflow: hidden;
  border-radius: 15px;
  background: #222;
}

.tp-video-library-card .wp-block-video video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: contain;
}

.tp-video-library-card .wp-block-embed__wrapper iframe {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

.tp-video-library-vertical .wp-block-embed__wrapper iframe {
  aspect-ratio: 9 / 16;
}

/* WordPress positions responsive iframes over its own aspect-ratio spacer. */
.tp-video-library-card .wp-has-aspect-ratio .wp-block-embed__wrapper iframe {
  height: 100%;
}

.tp-video-library .tp-video-library-long { max-width: 800px; }

@media (max-width: 780px) {
  .tp-video-library .tp-video-library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 500px) {
  .tp-video-library .tp-video-library-grid:not(.tp-video-library-vertical) {
    grid-template-columns: minmax(0, 1fr);
  }
}

.tp-video-library-page {
  position: relative;
  isolation: isolate;
}

.tp-video-library-page::before {
  content: "";
  position: absolute;
  inset: 0 50%;
  width: 100vw;
  transform: translateX(-50%);
  z-index: -1;
  background: #f2f0eb url("https://images.squarespace-cdn.com/content/v1/68b69e7d4d48361244af411b/d9c73cbd-df96-40d8-bbff-b8568019eac1/background-paper.png?format=1500w") center top / 1500px auto repeat-y;
  pointer-events: none;
}

.tp-video-library-section h2 {
  font-family: Georgia, serif;
  letter-spacing: -.02em;
}

.tp-video-library-section h2::after {
  content: "";
  display: block;
  width: 32px;
  height: 2px;
  margin-top: 8px;
  background: #c8393a;
}

.tp-video-library-card h3 {
  text-align: center;
  font: italic 500 1rem/1.4 Georgia, serif;
}

.tp-video-library-card .tp-video-library-role { text-align: center; }

.tp-video-library-card .wp-block-embed,
.tp-video-library-card .wp-block-video { border-radius: 4px; }

.tp-video-carousel {
  position: relative;
  --tp-slides: 3;
  --tp-gap: 18px;
}

/* Two larger landscape players; additional videos remain in the carousel. */
.tp-video-carousel-landscape {
  --tp-slides: 2;
}

.tp-video-library .tp-video-carousel > :is(.tp-video-library-grid, .tp-video-library-long) {
  display: grid;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - (var(--tp-slides) - 1) * var(--tp-gap)) / var(--tp-slides));
  gap: var(--tp-gap);
  max-width: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.tp-video-carousel > .wp-block-group > .tp-video-library-card {
  margin: 0;
  min-width: 0;
  scroll-snap-align: start;
}

.tp-video-carousel-arrow {
  position: absolute;
  top: calc(50% - 26px);
  z-index: 1;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: #181818d9;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}

.tp-video-carousel-arrow:disabled {
  opacity: .28;
  cursor: default;
}

.tp-video-carousel-previous { left: -20px; }
.tp-video-carousel-next { right: -20px; }

.tp-video-carousel-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: .6rem;
}

.tp-video-carousel-dot {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.tp-video-carousel-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  background: #777;
  border-radius: 10px;
}

.tp-video-carousel-dot[aria-pressed="true"]::before {
  width: 16px;
  background: #c8393a;
}

.tp-video-carousel [hidden] { display: none; }

.tp-video-carousel :focus-visible {
  outline: 2px solid #c8393a;
  outline-offset: 2px;
}

@media (max-width: 780px) {
  .tp-video-carousel { --tp-slides: 2; }
  .tp-video-carousel-previous { left: 4px; }
  .tp-video-carousel-next { right: 4px; }
}

@media (max-width: 520px) {
  .tp-video-carousel { --tp-slides: 1; }
}
