/* Grid wrapper */
.ytgrid-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* Responsiveness */
@media (max-width: 1024px) {
  .ytgrid-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .ytgrid-grid { grid-template-columns: 1fr; }
}

.ytgrid-item { display: flex; flex-direction: column; gap: 8px; }

.ytgrid-thumb {
  position: relative;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
}

.ytgrid-thumb-img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  transition: transform .2s ease;
}

.ytgrid-thumb:hover .ytgrid-thumb-img {
  transform: scale(1.02);
}

.ytgrid-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 48px;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0,0,0,.6);
  pointer-events: none;
}

.ytgrid-title {
  font-size: 16px;
  line-height: 1.4;
  font-weight: 600;
}

/* Modal */
.ytgrid-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 99999;
}

.ytgrid-modal.show { display: block; }

.ytgrid-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.7);
}

.ytgrid-modal-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(900px, 92vw);
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}

.ytgrid-modal-close {
  position: absolute;
  right: 8px;
  top: 4px;
  background: transparent;
  color: #fff;
  border: 0;
  font-size: 28px;
  line-height: 1;
  z-index: 2;
  cursor: pointer;
}

/* Video wrapper keeps 16:9 */
.ytgrid-modal-body {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
}

.ytgrid-modal-body iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
