/* cube.css */

/* ---------- 0. 全域重置 & 關閉捲軸 ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;       /* 關鍵：全頁不出捲軸 */
  font-family: 'Noto Serif TC', serif;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #e0eaff, #fdf4ff);
}

/* ---------- 1. 封面 ---------- */
.cover {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: black;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  transition: opacity 1s ease;
}
.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover.hide {
  opacity: 0;
  pointer-events: none;
}

/* ---------- 2. 虹光裁切容器 ---------- */
.glow-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;      /* 關鍵：裁切超出畫面部分 */
  z-index: 0;
}

/* 旋轉的虹光方塊 */
.rainbow-glow {
  position: absolute;
  top: -10%;
  left: -10%;
  width: 120%;
  height: 120%;
  background: conic-gradient(from 0deg, #f0f, #0ff, #ff0, #f0f);
  filter: blur(80px);
  opacity: 0.2;
  animation: rotateGlow 15s linear infinite;
}
@keyframes rotateGlow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ---------- 3. 立方體場景 & 動畫 ---------- */
.scene.hidden {
  opacity: 0;
  pointer-events: none;
}
.scene {
  width: 300px;
  height: 300px;
  perspective: 1000px;
  z-index: 1;
  transition: all 0.5s ease;
  transform: scale(0.7);
}
.scene.moved {
  position: absolute;
  top: -100px;
  left: -100px;
  transform: scale(0.15);
  z-index: 9999;
}
.cube {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(0deg) rotateY(0deg);
}
.scene:hover .cube {
  animation-play-state: paused;
}
.face {
  position: absolute;
  width: 300px;
  height: 300px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border: 5px solid rgba(255, 255, 255, 1);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
  transition: transform 0.3s ease;
  z-index: 1;
}
.face:nth-child(1) { transform: rotateY(0deg)   translateZ(150px); }
.face:nth-child(2) { transform: rotateY(90deg)  translateZ(150px); }
.face:nth-child(3) { transform: rotateY(180deg) translateZ(150px); }
.face:nth-child(4) { transform: rotateY(-90deg) translateZ(150px); }
.face:nth-child(5) { transform: rotateX(90deg)  translateZ(150px); }
.face:nth-child(6) { transform: rotateX(-90deg) translateZ(150px); }

/* Hover 效果 */
.face:hover { cursor: pointer; }
.scene:not(.moved) .face:hover { /* 大立方體時推出效果 */
  transform: none;
}
.scene:not(.moved) .face:nth-child(1):hover { transform: rotateY(0deg)   translateZ(190px); }
.scene:not(.moved) .face:nth-child(2):hover { transform: rotateY(90deg)  translateZ(190px); }
.scene:not(.moved) .face:nth-child(3):hover { transform: rotateY(180deg) translateZ(190px); }
.scene:not(.moved) .face:nth-child(4):hover { transform: rotateY(-90deg) translateZ(190px); }
.scene:not(.moved) .face:nth-child(5):hover { transform: rotateX(90deg)  translateZ(190px); }
.scene:not(.moved) .face:nth-child(6):hover { transform: rotateX(-90deg) translateZ(190px); }

/* 金光特效 */
.face::before {
  content: '';
  position: absolute;
  top: -4px; left: -4px; right: -4px; bottom: -4px;
  border: 4px solid transparent;
  pointer-events: none;
  opacity: 0;
  z-index: 2;
  transition: opacity 0.3s ease;
  border-image: linear-gradient(90deg, gold, #fffbc1, gold) 1;
  animation: glowPulse 1.2s ease-in-out infinite;
}
@keyframes glowPulse {
  0%,100% { filter: drop-shadow(0 0 6px gold); }
  50%    { filter: drop-shadow(0 0 12px #ffec8b); }
}
.scene:not(.moved) .face:hover::before { opacity: 1; }

/* 其他 hover 效果 */
.scene:not(.moved):hover .face {
  opacity: 0.15;
  filter: brightness(1.5) blur(1px);
}
.scene:not(.moved):hover .face:hover {
  opacity: 1;
  filter: brightness(1.2) drop-shadow(0 0 15px gold);
  z-index: 5;
}

/* 小立方體樣式 */
.scene.moved .face {
  background: none !important;
  backdrop-filter: blur(8px);
  border: 5px solid rgba(255,255,255,0.6);
  box-shadow: 0 0 20px rgba(255,255,255,0.2);
}

/* Popup 樣式 */
.title {
  position: absolute;
  bottom: 40px;
  font-size: 1.5rem;
  color: #222;
  text-shadow: 0 0 8px rgba(255,255,255,0.8);
  z-index: 2;
  transition: opacity 0.5s ease;
}

.title.hidden { opacity: 0; }
/* 小標文字 */
.subtitle {
  position: absolute;
  bottom: 80px;           /* 調整到在主標題之上 */
  width: 100%;
  text-align: center;
  font-size: 0.9rem;      /* 較小字型 */
  color: #444;            /* 可自行調整顏色 */
  z-index: 2;             /* 確保蓋在背景之上 */
}
.subtitle.hidden { opacity: 0; }

.popup {
  position: absolute;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  transform: scale(0);
  background: white;
  padding: 30px;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.3s ease;
}
.popup.show { transform: scale(1); }
.popup-content {
  text-align: center;
  font-size: 2rem;
  color: #222;
  line-height: 2;
  max-width: 90%;
}
/* 可自行加上各色 popup 背景 */


/* popup 色系 */
.popup.red    {
  background: url('image/266bfa88-9e18-462d-ba46-1f8c786aa96f.jfif') center/cover no-repeat;
  color: white;
}
.popup.yellow {
  background: url('image/266bfa88-9e18-462d-ba46-1f8c786aa96f.jfif') center/cover no-repeat;
  color: white;
}
.popup.green  {  
  background: url('image/266bfa88-9e18-462d-ba46-1f8c786aa96f.jfif') center/cover no-repeat;
  color: white;
}
.popup.blue   {  
  background: url('image/266bfa88-9e18-462d-ba46-1f8c786aa96f.jfif') center/cover no-repeat;
  color: white;
}
.popup.brown  {
  background: url('image/266bfa88-9e18-462d-ba46-1f8c786aa96f.jfif') center/cover no-repeat;
  color: white;
}
.popup.black  {
  background: url('image/266bfa88-9e18-462d-ba46-1f8c786aa96f.jfif') center/cover no-repeat;
  color: white;
}

/* 六面圖片 */
.face:nth-child(1) { background: url('https://i.postimg.cc/D0bK2nzN/IMG-1522.png') center/cover no-repeat; backdrop-filter: none; box-shadow: none; }
.face:nth-child(2) { background: url('https://i.postimg.cc/Ws0k60Wj/IMG-1523.png') center/cover no-repeat; backdrop-filter: none; box-shadow: none; }
.face:nth-child(3) { background: url('https://i.postimg.cc/t4nD2JMw/IMG-1528.png') center/cover no-repeat; backdrop-filter: none; box-shadow: none; }
.face:nth-child(4) { background: url('https://i.postimg.cc/cLz2LPpy/IMG-1526.png') center/cover no-repeat; backdrop-filter: none; box-shadow: none; }
.face:nth-child(5) { background: url('https://i.postimg.cc/jSB3bPfR/IMG-1527.png') center/cover no-repeat; backdrop-filter: none; box-shadow: none; }
.face:nth-child(6) { background: url('https://i.postimg.cc/hGHkpNsb/IMG-1525.png') center/cover no-repeat; backdrop-filter: none; box-shadow: none; }

/* hover 閃光效果 */
.face:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px gold, 0 0 40px gold, 0 0 60px gold;
}

/* 小立方體時不再閃光 */
.scene.moved .face:hover {
  transform: none;
  box-shadow: none;
}

/* hover 時其他面變淡 */
.scene:not(.moved):hover .face {
  opacity: 0.15;
  filter: brightness(1.5) blur(1px);
}

/* hover 時當前面亮起 */
.scene:not(.moved):hover .face:hover {
  opacity: 1;
  filter: brightness(1.2) drop-shadow(0 0 15px gold);
  z-index: 5;
}

/* 小立方體樣式 */
.scene.moved .face {
  background: none !important;
  backdrop-filter: blur(8px);
  border: 5px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

/* 封面圖 */
.cover {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: black;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  transition: opacity 1s ease;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover.hide {
  opacity: 0;
  pointer-events: none;
}

.popup-image {
  max-width: 100%;
  height: auto;
  position: absolute;
  top: 2%;
  left: 51%;
  transform: translateX(-50%);
  z-index: 1;
  /* 移除 pointer-events: none; */
  cursor: pointer; /* 加上手型游標提示 */
}
.popup-image#che-2{
  top: 70%;
}
.popup-image#bio-1{
  max-width: 100%;
  top: 66%;
  left: 50%;
}
.popup-image#bio-2{
  max-width: 100%;
  top: 1.6%;
  left: 77%;
}

.popup-image#bio-3{
  max-width: 100%;
  top: 2%;
  left: 25%;
}

.popup-image#math-1{
  max-width: 100%;
  top: 1%;
  left: 50%;
}

.popup-image#math-2{
  max-width: 100%;
  top: 66%;
  left: 50%;
}

.popup-image#phy-1{
  max-width: 100%;
  top: 63.6%;
  left: 50%;
}

.popup-image#com-1{
  max-width: 100%;
  top: 65.7%;
  left: 50%;
}

.popup-image#liv-1{
  max-width: 100%;
  top: 51.5%;
  left: 76.2%;
}

.popup-image#liv-2{
  max-width: 100%;
  top: 7.8%;
  left: 77%;
}

.popup-image#liv-3{
  max-width: 100%;
  top: 10.5%;
  left: 25%;
}

.popup-image#liv-4{
  max-width: 100%;
  top: 71%;
  left: 50%;
}

.popup-image#liv-5{
  max-width: 100%;
  top: 50%;
  left: 26%;
}