/*!
 * YTGridGallery - stylesheet
 * ------------------------------------------------------------- */

.ytg-loading,
.ytg-empty {
  padding: 40px 16px;
  text-align: center;
  color: #666;
  font-size: 14px;
}

.ytg-error {
  padding: 16px;
  border: 1px solid #f5c2c7;
  background: #f8d7da;
  color: #842029;
  border-radius: 8px;
  font-size: 14px;
}

/* ---------- 格狀清單 ---------- */

.ytg-grid {
  --ytg-columns: 4;
  display: grid;
  grid-template-columns: repeat(var(--ytg-columns), 1fr);
  gap: 30px;
}

@media (max-width: 992px) {
  .ytg-grid { --ytg-columns: 3 !important; }
}
@media (max-width: 700px) {
  .ytg-grid { --ytg-columns: 2 !important; }
}
@media (max-width: 460px) {
  .ytg-grid { --ytg-columns: 1 !important; }
}

.ytg-card {
  background: #fff;
  border-radius: 0px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  outline: none;
}

.ytg-card:hover,
.ytg-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.ytg-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

.ytg-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.ytg-card:hover .ytg-thumb {
  transform: scale(1.06);
}

.ytg-play-icon {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 56px;
  height: 56px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  transition: opacity 0.18s ease, background 0.18s ease;
}
.ytg-play-icon::before {
  content: "";
  border-style: solid;
  border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent #fff;
  margin-left: 4px;
}
.ytg-card:hover .ytg-play-icon {
  background: rgba(255, 0, 0, 0.85);
}

.ytg-duration {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 4px;
}

.ytg-body {
  padding: 10px 12px 12px;
}

.ytg-title {
  font-size: 16px;
  font-weight: 600;
  color: #222;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
}

.ytg-stats {
  margin-top: 8px;
  display: flex;
  gap: 12px;
  font-size: 14px;
  color: #666;
}

.ytg-stat-likes { color: #e0245e; }

/* ---------- Magic Popup / Modal ---------- */

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

.ytg-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
}

.ytg-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.ytg-modal {
  position: relative;
  width: 100%;
  max-width: 960px;
  background: #111;
  border-radius: 10px;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}
.ytg-modal-overlay.is-open .ytg-modal {
  transform: scale(1);
}

.ytg-modal-video {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  background: #000;
}
.ytg-modal-iframe-box {
  position: absolute;
  inset: 0;
}
.ytg-modal-iframe-box iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.ytg-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s ease;
}
.ytg-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.ytg-modal-caption {
  padding: 14px 16px;
  color: #fff;
}
.ytg-modal-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.ytg-modal-stats {
  font-size: 12px;
  color: #bbb;
}
