@charset "UTF-8";

:root {
  /* 預設：柔和亮色系配色 */
  --bg-main: #F5F7FA;
  --bg-card: #FFFFFF;
  --bg-nav: rgba(255, 255, 255, 0.85);

  --text-main: #4A5568;
  --text-muted: #718096;
  --text-light: #A0AEC0;

  --color-cyan: #64D2D6;
  --color-purple: #B794F4;
  --color-orange: #F6AD55;
  --color-pink: #F687B3;
  --color-gold: #F6E05E;

  --shadow-soft: 0 8px 24px rgba(149, 157, 165, 0.1);
  --shadow-hover: 0 12px 32px rgba(149, 157, 165, 0.15);
  --border-light: rgba(0, 0, 0, 0.04);

  --font-en: 'Space Grotesk', 'Nunito', sans-serif;
  --font-tw: 'Noto Sans TC', sans-serif;
}

/* ======================================================
   暗色模式變數 (科技可愛版)
   ====================================================== */
html.dark-theme {
  --bg-main: #0F172A;
  /* 深邃科技藍黑 */
  --bg-card: #1E293B;
  /* 卡片深色背景 */
  --bg-nav: rgba(30, 41, 59, 0.85);

  --text-main: #F8FAFC;
  /* 亮白色文字 */
  --text-muted: #94A3B8;
  /* 次要文字 */
  --text-light: #64748B;

  /* 恢復科技版的霓虹鮮明色系 */
  --color-cyan: #2DD4BF;
  --color-purple: #A78BFA;
  --color-orange: #FB923C;
  --color-pink: #F472B6;
  --color-gold: #FACC15;

  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 12px 48px rgba(45, 212, 191, 0.2);
  --border-light: rgba(255, 255, 255, 0.05);
}

/* 暗色模式下的網格與文字微調 */
html.dark-theme .hero-grid-bg {
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
}

html.dark-theme .proj-num {
  color: rgba(255, 255, 255, 0.05);
}

html.dark-theme .btn-soft {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: var(--border-light);
}

html.dark-theme .btn-soft:hover {
  background: var(--bg-card);
  color: var(--color-cyan);
}

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

html {
  scroll-behavior: smooth;
}

/* 平滑過渡 */
body,
nav,
.research-card,
.project-card,
.prof-container,
.award-item,
.team-card,
footer,
.hero-chip,
.service-item,
.expertise-tags span {
  transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

body {
  font-family: var(--font-en), var(--font-tw);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ====== CUSTOM CURSOR HIDING (僅限桌機) ====== */
@media (min-width: 769px) {

  body,
  a,
  button,
  .theme-toggle,
  .nav-links a {
    cursor: none !important;
  }
}

/* ====== THEME TOGGLE BUTTON ====== */
.theme-toggle {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-hover);
  font-size: 26px;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.5s, box-shadow 0.5s;
}

.theme-toggle:hover {
  transform: translateY(-5px) scale(1.1);
}

@keyframes jelly {
  0% {
    transform: scale(1);
  }

  30% {
    transform: scale(1.25) rotate(10deg);
  }

  50% {
    transform: scale(0.9) rotate(-10deg);
  }

  70% {
    transform: scale(1.15) rotate(5deg);
  }

  100% {
    transform: scale(1);
  }
}

/* ====== CURSOR GLOW ====== */
.cursor-glow {
  position: fixed;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(100, 210, 214, 0.12) 0%, transparent 60%);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 9998;
  /* 在無人機下方 */
  transition: background 0.3s ease;
  display: none;
}

/* ====== DRONE CURSOR ====== */
.drone-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 45px;
  /* 無人機大小 */
  height: 45px;
  pointer-events: none;
  /* 確保滑鼠點擊可以穿透圖案點到下方的按鈕 */
  z-index: 10000;
  display: none;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
  /* 加上陰影更有立體感 */
}

@media (min-width: 769px) {

  .cursor-glow,
  .drone-cursor {
    display: block;
  }
}

/* ====== NAV ====== */
nav {
  position: fixed;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 1200px;
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 30px;
  z-index: 1000;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-logo-box {
  width: 40px;
  height: 40px;
  background: var(--bg-main);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.02);
  animation: spin-slow 10s linear infinite;
}

@keyframes spin-slow {
  100% {
    transform: rotate(360deg);
  }
}

.nav-logo-icon {
  font-size: 20px;
}

.logo-text {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-main);
}

.logo-text span {
  color: var(--color-cyan);
}

.nav-links {
  display: flex;
  gap: 25px;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.3s, transform 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-purple);
  transform: translateY(-2px);
}

.nav-toggle {
  display: none;
}

/* ====== HERO ====== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 120px 20px 60px;
  overflow: hidden;
}

.hero-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: -2;
}

.hero-deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

.float-icon {
  position: absolute;
  font-size: 30px;
  opacity: 0.9;
  animation: float-jelly 6s ease-in-out infinite alternate;
}

.f1 {
  top: 20%;
  left: 15%;
  animation-delay: 0s;
}

.f2 {
  top: 30%;
  right: 20%;
  animation-delay: 1s;
}

.f3 {
  bottom: 30%;
  left: 25%;
  animation-delay: 2s;
}

.f4 {
  bottom: 20%;
  right: 15%;
  animation-delay: 1.5s;
  font-size: 40px;
}

.f5 {
  top: 15%;
  right: 40%;
  font-size: 20px;
  animation-delay: 0.5s;
}

.f6 {
  bottom: 15%;
  left: 45%;
  font-size: 25px;
  animation-delay: 2.5s;
}

@keyframes float-jelly {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
  }

  50% {
    transform: translateY(-15px) rotate(5deg) scale(1.1);
  }

  100% {
    transform: translateY(5px) rotate(-5deg) scale(0.95);
  }
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  box-shadow: var(--shadow-soft);
  margin-bottom: 20px;
  border: 1px solid var(--border-light);
}

.chip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-cyan);
  box-shadow: 0 0 10px rgba(100, 210, 214, 0.4);
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

.hero h1 {
  font-size: 4rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 10px;
  color: var(--text-main);
}

.gradient-text {
  background: linear-gradient(135deg, var(--color-cyan), var(--color-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 50px;
}

.btn {
  padding: 14px 30px;
  border-radius: 50px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-glow {
  background: var(--color-cyan);
  color: #fff;
  box-shadow: 0 8px 20px rgba(100, 210, 214, 0.3);
}

.btn-glow:hover {
  transform: translateY(-5px) scale(1.03);
  box-shadow: 0 12px 25px rgba(100, 210, 214, 0.4);
}

.btn-soft {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
}

.btn-soft:hover {
  transform: translateY(-5px) scale(1.03);
  box-shadow: var(--shadow-hover);
  color: var(--color-purple);
}

.hero-stats {
  display: flex;
  gap: 30px;
  justify-content: center;
  align-items: center;
  background: var(--bg-nav);
  padding: 20px 40px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
}

.stat-num {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-purple);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-divider {
  width: 2px;
  height: 40px;
  background: rgba(128, 128, 128, 0.2);
}

.hero-scroll {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-light);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 2px;
}

.scroll-line {
  width: 2px;
  height: 30px;
  background: var(--text-light);
  border-radius: 2px;
  animation: scroll-down 2s infinite;
}

@keyframes scroll-down {
  0% {
    transform: scaleY(0);
    transform-origin: top;
  }

  50% {
    transform: scaleY(1);
    transform-origin: top;
  }

  50.1% {
    transform: scaleY(1);
    transform-origin: bottom;
  }

  100% {
    transform: scaleY(0);
    transform-origin: bottom;
  }
}

/* ====== SECTIONS GLOBAL ====== */
section {
  padding: 100px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-badge {
  display: inline-block;
  padding: 6px 16px;
  background: var(--bg-card);
  border-radius: 20px;
  font-weight: 700;
  color: var(--color-purple);
  box-shadow: var(--shadow-soft);
  margin-bottom: 15px;
  border: 1px solid var(--border-light);
}

.section-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 15px;
  color: var(--text-main);
}

.section-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
}

/* ====== RESEARCH ====== */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}

.research-card {
  background: var(--bg-card);
  padding: 30px;
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.research-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
}

.card-icon-wrap {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 28px;
  margin-bottom: 20px;
}

.card-icon-wrap.cyan {
  background: rgba(100, 210, 214, 0.15);
}

.card-icon-wrap.purple {
  background: rgba(183, 148, 244, 0.15);
}

.card-icon-wrap.orange {
  background: rgba(246, 173, 85, 0.15);
}

.card-icon-wrap.pink {
  background: rgba(246, 135, 179, 0.15);
}

.research-card h3 {
  font-size: 1.3rem;
  margin-bottom: 12px;
  color: var(--text-main);
}

.research-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-tag {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-light);
}

.card-arrow {
  font-weight: bold;
  color: var(--text-light);
  transition: 0.3s;
}

.research-card:hover .card-arrow {
  transform: translateX(5px);
  color: var(--color-cyan);
}

/* ====== PROJECTS ====== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.project-card {
  background: var(--bg-card);
  padding: 30px;
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
}

.project-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
}

.proj-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.proj-num {
  font-size: 2rem;
  font-weight: 800;
  color: rgba(0, 0, 0, 0.04);
}

.proj-emoji {
  font-size: 30px;
  background: var(--bg-main);
  padding: 10px;
  border-radius: 50%;
}

.project-card h3 {
  font-size: 1.4rem;
  margin-bottom: 15px;
  color: var(--text-main);
}

.project-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.proj-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.proj-tags span {
  background: var(--bg-main);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ====== PROFESSOR ====== */
.prof-container {
  background: var(--bg-card);
  border-radius: 30px;
  padding: 40px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
}

.prof-card {
  display: flex;
  gap: 40px;
  align-items: center;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.prof-avatar {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  overflow: hidden;
  border: 6px solid var(--bg-main);
  box-shadow: var(--shadow-soft);
  background: var(--bg-card);
}

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

.prof-info h3 {
  font-size: 2rem;
  margin-bottom: 5px;
  color: var(--text-main);
}

.prof-name-en {
  color: var(--text-light);
  font-size: 1.1rem;
  margin-bottom: 10px;
  font-weight: 600;
}

.prof-title {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(183, 148, 244, 0.15);
  color: #9F7AEA;
  border-radius: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}

.prof-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.prof-detail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.prof-detail-item a {
  color: var(--color-cyan);
  text-decoration: none;
  font-weight: 600;
}

.prof-expertise h4,
.prof-service h4 {
  font-size: 1.2rem;
  margin-bottom: 20px;
  color: var(--text-main);
}

.expertise-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 40px;
}

.expertise-tags span {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  color: var(--text-muted);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.service-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.service-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-main);
  padding: 15px;
  border-radius: 12px;
  font-size: 0.95rem;
  color: var(--text-main);
  font-weight: 500;
}

.si-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.si-dot.cyan {
  background: var(--color-cyan);
}

.si-dot.purple {
  background: var(--color-purple);
}

.si-dot.orange {
  background: var(--color-orange);
}

.si-dot.pink {
  background: var(--color-pink);
}

.expand-btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 15px;
  background: none;
  border: 2px dashed var(--border-light);
  border-radius: 15px;
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
  transition: 0.3s;
}

.expand-btn:hover {
  background: var(--bg-main);
  border-style: solid;
  color: var(--color-purple);
}

.service-extra {
  display: none;
  margin-top: 15px;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

/* ====== TEAM ====== */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}

.team-card {
  background: var(--bg-card);
  padding: 40px 20px;
  border-radius: 24px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
}

.team-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
}

.team-avatar-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 20px;
}

.team-avatar {
  width: 100%;
  height: 100%;
  background: var(--bg-main);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 40px;
  position: relative;
  z-index: 2;
}

.avatar-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px dashed var(--color-cyan);
  animation: spin-slow 10s linear infinite;
}

.team-card h4 {
  font-size: 1.2rem;
  color: var(--text-main);
  margin-bottom: 5px;
}

.team-card .role {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

/* ====== AWARDS ====== */
.awards-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.award-item {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--bg-card);
  padding: 20px 30px;
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
}

.award-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.award-icon {
  font-size: 30px;
  background: var(--bg-main);
  padding: 15px;
  border-radius: 16px;
}

.award-body {
  flex: 1;
}

.award-body h4 {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 5px;
}

.award-body p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.award-year-badge {
  background: rgba(100, 210, 214, 0.15);
  color: var(--color-cyan);
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 1rem;
}

/* ====== FOOTER ====== */
footer {
  background: var(--bg-card);
  padding: 60px 20px 20px;
  margin-top: 100px;
  border-top: 1px solid var(--border-light);
}

.footer-top {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand-area {
  display: flex;
  align-items: center;
  gap: 15px;
}

.footer-logo-box {
  width: 50px;
  height: 50px;
  background: var(--bg-main);
  border-radius: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
}

.footer-brand {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 5px;
}

.footer-brand-area p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.footer-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.footer-item a {
  color: var(--color-cyan);
  text-decoration: none;
  font-weight: 600;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: 600;
}

/* ====== ANIMATIONS & RESPONSIVE ====== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 2.5rem;
  }

  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
  }

  .nav-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--text-main);
    margin: 5px 0;
    border-radius: 3px;
  }

  .hero-stats {
    flex-direction: column;
    gap: 15px;
  }

  .stat-divider {
    width: 40px;
    height: 2px;
  }

  .prof-card {
    flex-direction: column;
    text-align: center;
  }

  .service-list,
  .service-extra {
    grid-template-columns: 1fr;
  }

  .award-item {
    flex-direction: column;
    text-align: center;
  }

  .theme-toggle {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 20px;
  }
}

/* ====== LAB PHOTO FLOAT CARDS ====== */
.lab-photo-float {
  position: absolute;
  width: 160px;
  height: 120px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  animation: float-jelly 10s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

.lab-photo-float img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.45;
}

html.dark-theme .lab-photo-float {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

/* ====== INNER PAGE TOP PADDING ====== */
/* Ensures first section clears the fixed nav on non-hero pages */
.page-section {
  padding-top: 130px;
}

/* ======================================================
   彩蛋 Easter Egg — Melvin
   ====================================================== */

/* ── Matrix 全螢幕覆蓋層 ── */
.egg-matrix-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  opacity: 0;
  transition: opacity 0.3s ease;
  overflow: hidden;
}
.egg-matrix-overlay.visible { opacity: 1; }
.egg-matrix-overlay.fading { opacity: 0; }

.egg-matrix-cols {
  position: absolute;
  inset: 0;
  display: flex;
  gap: 6px;
  padding: 8px;
  pointer-events: none;
}

.egg-matrix-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  animation: eggMatrixFall linear infinite;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.2;
}

@keyframes eggMatrixFall {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

.egg-matrix-char       { color: #2DD4BF; opacity: 0.75; }
.egg-matrix-char.bright { color: #ffffff; opacity: 1; }

.egg-access-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Courier New', monospace;
  font-size: 22px;
  font-weight: 700;
  color: #2DD4BF;
  text-shadow: 0 0 15px #2DD4BF, 0 0 30px #2DD4BF;
  text-align: center;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid #2DD4BF;
  border-radius: 6px;
  padding: 18px 32px;
  white-space: nowrap;
  animation: eggGlitch 0.35s ease-in-out infinite;
  pointer-events: none;
}

.egg-access-sub {
  display: block;
  font-size: 12px;
  color: #64748B;
  margin-top: 6px;
  font-weight: 400;
  letter-spacing: 0.05em;
}

@keyframes eggGlitch {
  0%, 93%  { transform: translate(-50%, -50%); }
  94%      { transform: translate(calc(-50% - 3px), calc(-50% + 1px)); }
  95%      { transform: translate(calc(-50% + 3px), calc(-50% - 2px)); }
  96%      { transform: translate(calc(-50% - 1px), calc(-50% + 2px)); }
  97%      { transform: translate(calc(-50% + 1px), -50%); }
  100%     { transform: translate(-50%, -50%); }
}

/* ── 彩帶粒子 ── */
.egg-confetti {
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  border-radius: 2px;
  animation: eggConfettiFall linear forwards;
}

@keyframes eggConfettiFall {
  0%   { opacity: 1; transform: translateY(0) translateX(0) rotate(0deg); }
  80%  { opacity: 1; }
  100% {
    opacity: 0;
    transform: translateY(var(--fall-y)) translateX(var(--fall-x)) rotate(var(--fall-rot));
  }
}

/* ── 成就通知 ── */
.egg-achievement {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9998;
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(167, 139, 250, 0.5);
  border-radius: 14px;
  padding: 14px 18px;
  min-width: 240px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(167, 139, 250, 0.2);
  animation: eggAchievementIn 0.4s ease-out forwards;
}

.egg-achievement.hiding {
  animation: eggAchievementOut 0.5s ease-in forwards;
}

@keyframes eggAchievementIn {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes eggAchievementOut {
  from { transform: translateY(0);   opacity: 1; }
  to   { transform: translateY(10px); opacity: 0; }
}

.egg-achievement-header {
  font-size: 11px;
  color: #A78BFA;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  font-weight: 700;
}

.egg-achievement-body {
  display: flex;
  align-items: center;
  gap: 10px;
}

.egg-achievement-icon { font-size: 26px; flex-shrink: 0; }

.egg-achievement-text {
  font-size: 13px;
  font-weight: 700;
  color: #F8FAFC;
  line-height: 1.4;
}

.egg-achievement-bar {
  height: 2px;
  background: linear-gradient(90deg, #A78BFA, #2DD4BF);
  border-radius: 2px;
  margin-top: 10px;
  transform: scaleX(0);
  transform-origin: left;
  animation: eggBarFill 1s ease-out 0.3s forwards;
}

@keyframes eggBarFill {
  to { transform: scaleX(1); }
}

/* ====== PROJECT DETAIL PAGES ====== */
.project-detail {
  padding-top: 120px;
}

.pd-back {
  margin-bottom: 40px;
}

.pd-hero {
  text-align: center;
  margin-bottom: 70px;
  padding: 60px 40px;
  background: var(--bg-card);
  border-radius: 30px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}

.pd-hero-deco {
  position: absolute;
  top: -60px;
  right: -60px;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  opacity: 0.06;
  pointer-events: none;
}

.pd-hero-deco.purple { background: var(--color-purple); }
.pd-hero-deco.orange { background: var(--color-orange); }
.pd-hero-deco.pink   { background: var(--color-pink); }
.pd-hero-deco.cyan   { background: var(--color-cyan); }

.pd-icon-wrap {
  width: 90px;
  height: 90px;
  border-radius: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 44px;
  margin: 0 auto 20px;
}

.pd-icon-wrap.purple { background: rgba(183, 148, 244, 0.15); }
.pd-icon-wrap.orange { background: rgba(246, 173, 85, 0.15); }
.pd-icon-wrap.pink   { background: rgba(246, 135, 179, 0.15); }
.pd-icon-wrap.cyan   { background: rgba(100, 210, 214, 0.15); }

.pd-num {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.pd-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 20px;
}

.pd-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 700px;
  margin: 0 auto 30px;
  line-height: 1.9;
}

.pd-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.pd-tags span {
  background: var(--bg-main);
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.pd-section {
  margin-bottom: 70px;
}

.pd-section-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border-light);
}

.pd-overview-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 25px;
  align-items: start;
}

.pd-overview-text {
  background: var(--bg-card);
  padding: 35px;
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  line-height: 1.9;
  font-size: 1rem;
}

.pd-overview-text p + p {
  margin-top: 15px;
}

.pd-highlights {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.pd-highlight-item {
  background: var(--bg-card);
  padding: 20px 22px;
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 15px;
  transition: transform 0.3s, box-shadow 0.3s;
}

.pd-highlight-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.pd-hi-icon {
  font-size: 26px;
  flex-shrink: 0;
}

.pd-hi-text h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 3px;
}

.pd-hi-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.pd-topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 22px;
}

.pd-topic-card {
  background: var(--bg-card);
  padding: 28px;
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
  transition: transform 0.3s, box-shadow 0.3s;
}

.pd-topic-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

.pd-topic-icon {
  font-size: 30px;
  margin-bottom: 14px;
}

.pd-topic-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
}

.pd-topic-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.pd-tech-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.pd-tech-tag {
  background: var(--bg-card);
  color: var(--text-muted);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
  transition: transform 0.2s, color 0.2s;
}

.pd-tech-tag:hover {
  transform: translateY(-3px);
  color: var(--color-cyan);
}

.pd-goal-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.pd-goal-item {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  background: var(--bg-card);
  padding: 22px;
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
}

.pd-goal-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
  line-height: 1;
}

html.dark-theme .pd-goal-num {
  color: rgba(255, 255, 255, 0.05);
}

.pd-goal-content h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.pd-goal-content p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}

@media (max-width: 768px) {
  .pd-overview-grid {
    grid-template-columns: 1fr;
  }

  .pd-title {
    font-size: 1.6rem;
  }

  .pd-hero {
    padding: 40px 20px;
  }
}

/* ====== GALLERY PREVIEW (Homepage) ====== */
/* ===== GALLERY PREVIEW CAROUSEL ===== */
.gallery-preview {
  padding: 80px 0;
  overflow: hidden;
}

.gp-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 5%;
}

/* gp-wrap：包住 stage + controls，scroll 時整體展開 */
.gp-wrap {
  margin: 40px 5%;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
}

.gp-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.gp-carousel {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.gp-track {
  display: flex;
  height: 100%;
  transition: transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gp-slide {
  flex: 0 0 100%;
  height: 100%;
  position: relative;
}

.gp-slide iframe,
.gp-slide > div iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
  display: block;
}

/* YT.Player 產生的容器 div 需填滿 slide */
.gp-slide > div {
  position: absolute;
  inset: 0;
}

.gp-video-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: pointer;
}

.gp-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 20px 20px 16px;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.3s;
}

.gp-stage:hover .gp-caption { opacity: 1; }

/* 左右箭頭 */
.gp-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
}

.gp-arrow:hover {
  background: rgba(255,255,255,0.32);
  transform: translateY(-50%) scale(1.1);
}

.gp-arrow-left  { left: 20px; }
.gp-arrow-right { right: 20px; }

.gp-stage.gp-single .gp-arrow,
.gp-stage.gp-single .gp-dots { display: none; }

/* Dots */
.gp-dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.gp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  border: none;
  cursor: pointer;
  transition: background 0.3s, transform 0.3s;
  padding: 0;
}

.gp-dot.active {
  background: #fff;
  transform: scale(1.35);
}

/* ── 無人機控制列 ── */
.gp-controls {
  background: rgba(8, 8, 18, 0.95);
  padding: 10px 20px 14px;
  border-top: 1px solid rgba(100, 210, 214, 0.15);
}

/* 進度條區 */
.gp-progress-area {
  padding: 14px 0 6px;
  cursor: pointer;
}

.gp-progress-track {
  position: relative;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  margin: 12px 0;
}

.gp-progress-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--color-cyan, #64D2D6), var(--color-purple, #B794F4));
  border-radius: 4px;
  transition: width 0.25s linear;
  pointer-events: none;
}

/* 無人機 thumb */
.gp-drone-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translateX(-50%) translateY(-50%);
  z-index: 5;
  pointer-events: none;
  line-height: 1;
}

.gp-drone-icon {
  display: block;
  font-size: 1.5rem;
  animation: gpDroneFloat 1.8s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(100,210,214,0.7));
}

@keyframes gpDroneFloat {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50%       { transform: translateY(-5px) rotate(8deg); }
}

.gp-progress-track:hover .gp-progress-fill {
  height: 6px;
  top: -1px;
}

/* 控制按鈕列 */
.gp-ctrl-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gp-ctrl-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.gp-ctrl-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.gp-ctrl-btn svg {
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.gp-time {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.6);
  font-family: 'Space Grotesk', monospace;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.gp-ctrl-space { flex: 1; }

.gp-cta {
  text-align: center;
  margin-top: 40px;
}

@media (max-width: 768px) {
  .gp-wrap {
    margin: 24px 0;
    border-radius: 0;
  }
  .gp-arrow { width: 40px; height: 40px; font-size: 1.5rem; }
  .gp-arrow-left  { left: 10px; }
  .gp-arrow-right { right: 10px; }
  .gp-drone-icon { font-size: 1.2rem; }
}

/* ====== GALLERY PAGE ====== */
.gallery-page {
  padding-top: 120px;
  padding-bottom: 80px;
}

.gallery-page .page-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 5% 80px;
}

.gl-section-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border-light);
}

/* Photo masonry grid */
.gl-photo-grid {
  columns: 3;
  column-gap: 16px;
}

.gl-item {
  break-inside: avoid;
  margin-bottom: 16px;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s, box-shadow 0.3s;
}

.gl-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.gl-item img {
  width: 100%;
  display: block;
  transition: transform 0.5s;
}

.gl-item:hover img {
  transform: scale(1.04);
}

.gl-item-placeholder {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
}

.gl-item-placeholder span {
  font-size: 2.4rem;
}

.gl-item-placeholder p {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
  font-weight: 600;
}

.gl-item-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s;
}

.gl-item:hover .gl-item-caption {
  opacity: 1;
}

/* Video section */
.gl-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.gl-video-card {
  background: var(--bg-card);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
  transition: transform 0.3s, box-shadow 0.3s;
}

.gl-video-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.gl-video-embed {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
}

.gl-video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.gl-video-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: pointer;
}

.gl-video-info {
  padding: 18px 20px;
}

.gl-video-info h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.gl-video-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Lightbox */
.gl-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.gl-lightbox.active {
  display: flex;
}

.gl-lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: 0 0 60px rgba(0,0,0,0.5);
}

.gl-lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
  line-height: 1;
  background: none;
  border: none;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.gl-lightbox-close:hover {
  opacity: 1;
}

@media (max-width: 900px) {
  .gl-photo-grid {
    columns: 2;
  }
}

@media (max-width: 540px) {
  .gl-photo-grid {
    columns: 1;
  }
}