* { margin: 0; padding: 0; box-sizing: border-box; }

:root { --pad: clamp(20px, 4vw, 40px); }

body {
  background-color: #000;
  color: #fff;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  padding: var(--pad);
  opacity: 0;
  animation: fadeIn 1s ease forwards;
}
@keyframes fadeIn { to { opacity: 1; } }

a:focus-visible,
button:focus-visible,
.gallery-item:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- 作品格線（預設：商業/MV） ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: clamp(12px, 2vw, 24px);
  max-width: 1600px;
  margin: 0 auto;
}
.gallery-item {
  background-color: #111;
  border-radius: 5px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease;
}
.gallery-item:hover { transform: scale(1.02); }
.gallery-item img,
.gallery-item video { width: 100%; display: block; }

/* Reels：直式短影音用較窄欄位、較圓的卡片 */
body[data-category="reels"] .gallery {
  grid-template-columns: repeat(auto-fill, minmax(clamp(130px, 22vw, 220px), 1fr));
  gap: clamp(10px, 1.5vw, 24px);
  max-width: 1500px;
}
body[data-category="reels"] .gallery-item { border-radius: clamp(14px, 2vw, 24px); }

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #777;
  padding: 60px 20px;
  font-size: 16px;
}

/* 懸停預覽影片 */
video.hover-preview {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 1;
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .gallery-item:hover video.hover-preview { opacity: 1; }
}
@media (hover: none) {
  video.hover-preview { display: none; }
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}
.lightbox-content { display: flex; align-items: center; justify-content: center; }
.lightbox-content video,
.lightbox-content img {
  max-width: 90vw;
  max-height: 90vh;
  width: auto; height: auto;
  display: block;
}

/* ---------- 導覽列 ---------- */
.nav-links {
  position: absolute;
  top: clamp(28px, 5vw, 68px);
  right: clamp(20px, 4vw, 55px);
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.5vw, 16px);
  z-index: 3;
}
.nav-links a,
.dropdown-trigger {
  color: #fff;
  text-decoration: none;
  font-size: clamp(15px, 2.2vw, 25px);
  font-weight: 600;
  letter-spacing: 1px;
  position: relative;
  display: inline-block;
  text-align: center;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.nav-links a:hover,
.dropdown-trigger:hover { transform: scale(1.05); opacity: 0.8; }

.dropdown { position: relative; }
.dropdown-content {
  position: absolute;
  top: 100%; left: 0;
  background-color: #111;
  min-width: 160px;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.dropdown-content a {
  color: #fff;
  background-color: #111;
  padding: 10px 20px;
  text-align: left;
  text-decoration: none;
  font-size: 16px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.dropdown-content a:hover { background-color: #fff; color: #000; }
.dropdown:hover .dropdown-content,
.dropdown.open .dropdown-content {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.dropdown:hover .dropdown-content a,
.dropdown.open .dropdown-content a {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- LOGO ---------- */
.logo-container {
  display: flex;
  justify-content: center;
  margin-bottom: clamp(24px, 4vw, 40px);
}
.logo-container img { height: clamp(44px, 6vw, 60px); }

/* ---------- 聯絡 popup ---------- */
#ig-popup {
  display: none;
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 360px);
  background: #111;
  color: #fff;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
  z-index: 10000;
  text-align: center;
}
#ig-popup a { color: #fff; font-weight: bold; text-decoration: underline; }
#ig-popup button {
  margin-top: 20px;
  padding: 8px 16px;
  background: #fff; color: #000;
  border: none; border-radius: 8px;
  cursor: pointer;
}
#popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
}

/* ---------- 窄螢幕：LOGO 與選單置中疊在頂部 ---------- */
@media (max-width: 768px) {
  .logo-container {
    position: absolute;
    top: 5%; left: 50%;
    transform: translateX(-50%);
    margin: 0; z-index: 3;
  }
  .nav-links {
    position: absolute;
    top: 11%; left: 50%; right: auto;
    transform: translateX(-50%);
    flex-direction: row;
    justify-content: center;
    gap: 14px;
  }
  .dropdown-content { left: 50%; transform: translateX(-50%); }
  .gallery { margin-top: clamp(120px, 22vw, 160px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  body { opacity: 1 !important; animation: none; }
}
