/* ==== Video Portfolio Grid ==== */
.video-portfolio-section {
  padding: 64px 0 32px 0;
  background: var(--color-white);
  margin-bottom: 3rem;
}

.video-portfolio-section h2 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--color-ink);
}

.video-portfolio-intro {
  max-width: 700px;
  margin: 0 auto 2.5rem auto;
  text-align: center;
  font-size: 1.1rem;
  color: var(--color-text);
}

.video-portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (max-width: 900px) {
  .video-portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .video-portfolio-grid {
    grid-template-columns: 1fr;
  }
}

/* Open layout to match the homepage and /blog: no box, border, shadow or rounded corners.
   Hover: the image grows slightly in its frame, the play button turns red and the title
   underlines. */
.video-portfolio-item {
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.video-portfolio-trigger {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.video-portfolio-trigger:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: -3px;
}

.video-portfolio-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--color-ink);
  overflow: hidden;
}

.video-portfolio-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 300ms ease-out;
}

/* Subtle grow inside the thumbnail frame on hover or keyboard focus */
.video-portfolio-item:hover .video-portfolio-thumb img,
.video-portfolio-trigger:focus-visible .video-portfolio-thumb img {
  transform: scale(1.04);
}

@media (prefers-reduced-motion: reduce) {
  .video-portfolio-thumb img {
    transition: none;
  }
  .video-portfolio-item:hover .video-portfolio-thumb img,
  .video-portfolio-trigger:focus-visible .video-portfolio-thumb img {
    transform: none;
  }
}

/* Play button */
.video-portfolio-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 68px;
  height: 68px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  transition: background-color 150ms;
}

.video-portfolio-play::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 12px 0 12px 20px;
  border-color: transparent transparent transparent var(--color-white);
}

.video-portfolio-item:hover .video-portfolio-play {
  background: var(--color-accent);
}

.video-portfolio-item:hover .video-portfolio-title {
  text-decoration: underline;
}

.video-portfolio-content {
  display: block;
  padding: 1rem 0 0; /* no box, so the title lines up with the thumbnail edge */
}

.video-portfolio-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-ink);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==== Video Modal ==== */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  animation: video-modal-fade 0.2s ease;
}

.video-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 1100px;
  animation: video-modal-fade 0.2s ease;
}

.video-modal-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 100px);
  background: var(--color-ink);
  border-radius: 8px;
  overflow: hidden;
}

.video-modal-frame iframe,
.video-modal-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-modal-close {
  position: absolute;
  top: -48px;
  right: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-white);
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
}

.video-modal-close:focus-visible {
  outline: 2px solid var(--color-white);
}

body.video-modal-open {
  overflow: hidden;
}

@keyframes video-modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
