* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  color: #111;
}

/* 前台：底色與文字色由 storage.js → applySiteTheme() 設定 CSS 變數 */
body.site-front {
  background: var(--page-bg, #000);
  color: var(--page-text, #fff);
  overflow-x: hidden;
}
body.site-front .site-header {
  border-bottom-color: var(--page-border, rgba(255, 255, 255, 0.15));
}
body.site-front .site-nav a,
body.site-front .social-links a {
  color: var(--page-text, #fff);
}

.site-header {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #eee;
}
.site-nav {
  grid-column: 2;
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.site-nav a {
  color: #111;
  text-decoration: none;
  opacity: 0.4;
  transition: opacity 0.28s ease;
  position: relative;
}
.site-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transition: transform 0.28s ease;
  transform-origin: center;
}
.site-nav a:hover,
.site-nav a.active {
  opacity: 1;
}
.site-nav a.active::after {
  transform: scaleX(1);
}
.social-links {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 14px;
}
.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111;
  opacity: 0.45;
  transition: opacity 0.28s ease;
}
.social-links a:hover {
  opacity: 1;
}
.social-links svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
}
.social-links svg.icon-instagram {
  fill: none;
  stroke: currentColor;
}
@media (max-width: 600px) {
  .site-header {
    padding: 16px;
  }
  .site-nav {
    gap: 24px;
    font-size: 12px;
  }
  .social-links {
    gap: 12px;
  }
  .social-links svg {
    width: 16px;
    height: 16px;
  }
  #page-about {
    margin-top: 48px;
    padding-left: 20px;
    padding-right: 20px;
  }
}

body.site-front.is-home .site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  border-bottom: none;
  background: transparent;
}
body.site-front.is-home .site-nav a,
body.site-front.is-home .social-links a {
  color: #fff;
}
body.site-front.is-home .site-footer {
  display: none;
}

/* Home 蓋板影片 */
#page-home {
  position: relative;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  padding: 0;
  overflow: hidden;
  background: var(--page-bg, #000);
}
#page-home.page.active,
#page-home.page.page-leave {
  display: block;
}
.home-hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.home-hero-video.is-playing {
  opacity: 1;
}
.home-hero-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  z-index: 1;
  opacity: 1;
  transition: opacity 0.45s ease;
}
.home-hero-poster.is-hidden {
  opacity: 0;
}
.home-tap-play {
  position: absolute;
  left: 50%;
  bottom: 18%;
  z-index: 2;
  transform: translateX(-50%);
  width: 56px;
  height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
@media (prefers-reduced-motion: reduce) {
  .home-hero-poster {
    transition: none;
  }
}

/* 全站頁尾 copyright */
.site-footer {
  text-align: center;
  padding: 48px 24px 80px;
}
.site-footer p {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.45;
}

/* 前台頁面切換 */
.page {
  display: none;
}
.page.active,
.page.page-leave {
  display: block;
}
.page.page-leave {
  animation: page-out 0.28s ease forwards;
  pointer-events: none;
}
.page.page-enter {
  animation: page-in 0.28s ease forwards;
}
@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes page-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .page.page-enter,
  .page.page-leave {
    animation: none;
  }
  .site-nav a::after {
    transition: none;
  }
}

/* 兩頁都有的媒體項目框架:位置由行內 style 決定(x/y/w/h 是動態資料),
   但「長什麼樣子」這件事共用同一份規則 */
.item {
  position: absolute;
  overflow: hidden;
  border-radius: 4px;
}
.item img,
.item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 前台：影片項目 — 封面 + hover 白底文字 */
.item-video {
  cursor: pointer;
}
.item-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.item-hover {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  pointer-events: none;
}
.item-video:hover .item-hover {
  opacity: 1;
}
@media (hover: none) {
  .item-video.revealed .item-hover {
    opacity: 1;
  }
}
.item-hover-title {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #111;
}
.item-hover-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: #444;
}

/* 前台：點擊後的影片播放器 modal */
.video-modal {
  --modal-inset: max(1.5rem, 3vmin);
  --video-modal-duration: 0.28s;
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--modal-inset);
  box-sizing: border-box;
  pointer-events: none;
}
.video-modal.hidden {
  display: none;
}
.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transition: opacity var(--video-modal-duration) ease;
}
.video-modal.is-open .video-modal-backdrop {
  opacity: 1;
}
.video-modal-hint {
  position: absolute;
  bottom: max(0.75rem, 1.5vmin);
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity var(--video-modal-duration) ease 0.06s;
}
.video-modal.is-open .video-modal-hint {
  opacity: 1;
}
.video-modal-content {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  opacity: 0;
  transform: scale(0.94);
  transition:
    opacity var(--video-modal-duration) ease,
    transform var(--video-modal-duration) ease;
}
.video-modal.is-open .video-modal-content {
  opacity: 1;
  transform: scale(1);
}
.video-modal-content video {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}
.video-modal-content video.hidden,
.video-modal-embed.hidden {
  display: none;
}
.video-modal-embed {
  display: block;
  border: none;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  background: #000;
}
.video-modal-content.is-youtube .video-modal-embed {
  width: min(92vw, 960px);
  height: min(52vw, 540px);
}
.video-modal-content.is-instagram .video-modal-embed {
  width: min(92vw, 400px);
  height: min(110vw, 680px);
}
@media (prefers-reduced-motion: reduce) {
  .video-modal {
    --video-modal-duration: 0.01s;
  }
  .video-modal-content {
    transform: none;
  }
}

/* About 頁：區塊排版 */
#about-content .about-inner + .about-inner {
  margin-top: 8px;
}
.about-block-heading {
  margin: 0;
  font-weight: 400;
}
.about-block-heading.size-large {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 40px;
}
.about-block-heading.size-medium {
  font-size: 18px;
  letter-spacing: 0.02em;
  margin-bottom: 24px;
}
.about-block-heading.size-small {
  font-size: 14px;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
  opacity: 0.9;
}
.about-block-text.size-body p {
  margin: 0 0 1.4em;
  font-size: 15px;
  line-height: 1.8;
}
.about-block-text.size-small p {
  margin: 0 0 1em;
  font-size: 12px;
  line-height: 1.6;
  opacity: 0.85;
}
.about-block-gallery .about-gallery-wrap {
  margin: 40px 0;
}

/* About 頁：橫向圖片列（寬度與文字同欄） */
.about-gallery-wrap {
  position: relative;
  width: 100%;
  margin: 40px 0;
}
.about-gallery-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0;
}
.about-gallery-track::-webkit-scrollbar {
  display: none;
}
.about-gallery-item {
  flex: 0 0 140px;
  aspect-ratio: 1;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  overflow: hidden;
}
@media (min-width: 480px) {
  .about-gallery-item {
    flex: 0 0 180px;
  }
}
.about-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.about-gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #333;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.about-gallery-prev { left: -4px; }
.about-gallery-next { right: -4px; }
@media (max-width: 600px) {
  .about-gallery-arrow {
    width: 32px;
    height: 32px;
    font-size: 18px;
  }
  .about-gallery-item {
    flex: 0 0 120px;
  }
}

/* 點擊 About 圖片放大：限制在內容欄寬度內，保留頁面層次 */
.image-modal {
  --modal-inset: max(1.5rem, 3vmin);
  --image-modal-duration: 0.28s;
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--modal-inset);
  box-sizing: border-box;
  pointer-events: none;
}
.image-modal.hidden {
  display: none;
}
.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transition: opacity var(--image-modal-duration) ease;
}
.image-modal.is-open .image-modal-backdrop {
  opacity: 1;
}
.image-modal .video-modal-hint {
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--image-modal-duration) ease 0.06s;
}
.image-modal.is-open .video-modal-hint {
  opacity: 1;
}
.image-modal-content {
  position: relative;
  z-index: 2;
  max-width: min(640px, 100%);
  pointer-events: auto;
  opacity: 0;
  transform: scale(0.94);
  transition:
    opacity var(--image-modal-duration) ease,
    transform var(--image-modal-duration) ease;
}
.image-modal.is-open .image-modal-content {
  opacity: 1;
  transform: scale(1);
}
.image-modal-content img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}
@media (prefers-reduced-motion: reduce) {
  .image-modal {
    --image-modal-duration: 0.01s;
  }
  .image-modal-content {
    transform: none;
  }
}
