/* =================================== */
/* === 全域 / 桌面版樣式 (Desktop First) === */
/* =================================== */
/* 定義顏色變數，方便統一管理和修改 */
:root {
  --primary-color: #e86100;
  --icon-bg-color: #495057;
  --icon-color: #ffffff;
}

.social-icons {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  color: var(--icon-color);
  background-color: var(--icon-bg-color);
  border-radius: 50%;
  font-size: 1.5rem;
  text-decoration: none;
  margin-top: 5rem;
  transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.social-icon img {
  width: 52%;
  height: 52%;
  object-fit: contain;
}

.social-icon:hover,
.social-icon:focus {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  outline: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Noto Sans TC', sans-serif;
  background-color: #12151b;
  color: #f2f2f2;
}

h1 {
  font-size: 3rem;
}

a {
  color: inherit;
  text-decoration: none;
}

.about-copy {
  max-width: 40rem;
  width: min(100%, 40rem);
  margin: 0 auto;
  padding: 0 1.25rem;
  text-align: left;
}

.about-copy h1 {
  text-align: center;
  margin: 0 0 1.5rem;
  font-size: 3rem;
  line-height: 1.2;
}

.about-copy p {
  margin: 0 0 1.2rem;
  font-size: 1.0625rem;
  line-height: 1.85;
  color: #e4e4e4;
  text-wrap: pretty;
}

.about-copy p:last-child {
  margin-bottom: 0;
}

.about-copy strong {
  font-weight: 600;
  color: #f0f4f5;
}

#edu p {
  text-align: center;
  width: 80%;
  font-size: 16px;
}

.item-meta {
  width: 50%;
  display: flex;
  justify-content: space-between;
}

.layout {
  display: flex;
}

section table {
  width: 90%;
  margin: 0 auto;
}

section table th {
  text-align: left;
}

/* --- Sidebar (Desktop) --- */
.sidebar {
  width: 220px;
  height: 100vh;
  background-color: #1a071f;
  position: fixed;
  left: 0;
  top: 0;
  padding: 20px;
  box-shadow: 2px 0 10px rgba(0, 255, 255, 0.05);
  z-index: 1000;
}

.sidebar h2 {
  color: #00ddff;
  font-size: 20px;
  margin-bottom: 30px;
  text-align: center;
}

.sidebar nav ul {
  list-style: none;
  padding: 0;
}

.sidebar nav ul li {
  margin: 20px 0;
  text-align: center;
}

.sidebar nav ul li a:hover {
  color: #00ffff;
}

.avatar {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 2px solid white;
  display: block;
  margin: 200px auto 30px auto;
  overflow: hidden;
}

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

/* --- Main Content (Desktop) --- */
.main-content {
  margin-left: 220px;
  width: calc(100% - 220px);
  height: 100vh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
}

.section {
  height: 100vh;
  min-height: 650px;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  scroll-snap-align: start;
}

h1,
h2 {
  color: #e6faff;
}

.skills-list li {
  padding: 8px 0;
}

.skills-list {
  font-size: 32px;
}

/* --- Project --- */
#projects h2 {
  text-align: center;
  margin-bottom: 1.25rem;
  width: 100%;
}

.project-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 0;
  width: min(100%, 56rem);
  padding: 0 1.25rem;
}

.project-card {
  background-color: #1e1f24;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.project-card > img {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #12151b;
  object-fit: contain;
  border-radius: 8px;
}

.project-card--featured {
  border: 1px solid rgba(0, 221, 255, 0.35);
  box-shadow: 0 0 24px rgba(0, 221, 255, 0.12);
}

.project-card-body {
  width: 100%;
  text-align: left;
  font-size: 0.9375rem;
  line-height: 1.65;
}

.project-card-body h3 {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  color: #e6faff;
  line-height: 1.35;
}

.project-slug {
  display: inline-block;
  font-weight: 500;
  font-size: 0.82em;
  color: #00ddff;
}

.project-note {
  margin: 0 0 0.4rem;
  font-size: 0.8125rem;
  color: #888;
  letter-spacing: 0.02em;
}

.project-links {
  margin: 0 0 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-tag-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 221, 255, 0.45);
  color: #00ddff;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.project-tag-link:hover,
.project-tag-link:focus {
  background: rgba(0, 221, 255, 0.12);
  border-color: #00ddff;
  color: #b8f4ff;
  outline: none;
}

.project-card--featured .project-tag-link {
  border-color: rgba(0, 221, 255, 0.55);
}

.project-lead {
  margin: 0 0 0.85rem;
  color: #cfcfcf;
}

.project-points {
  margin: 0;
  padding-left: 1.15rem;
  list-style-type: disc;
}

.project-points li {
  margin-bottom: 0.5rem;
  padding-left: 0.25rem;
  color: #c8c8c8;
}

.project-points li:last-child {
  margin-bottom: 0;
}

.project-k {
  display: inline-block;
  min-width: 5.25rem;
  margin-right: 0;
  font-weight: 600;
  color: var(--primary-color);
}

.project-k::after {
  content: '：';
}

/* --- Contact --- */
.contact-info-center {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 20px;
  background: #1e1f24;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #2a2b30;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.contact-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 221, 255, 0.15);
}

.contact-icon {
  font-size: 3rem;
  flex-shrink: 0;
}

.contact-item h3 {
  color: var(--primary-color);
  font-size: 1.1rem;
  margin-bottom: 8px;
  margin-top: 0;
}

.contact-item p {
  margin: 0;
  font-size: 0.95rem;
}

.contact-item a {
  color: #00ddff;
  text-decoration: none;
  transition: color 0.3s;
}

.contact-item a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 40px 0;
  color: #aaa;
}

/* --- Back to Top Button --- */
#backToTop {
  position: fixed;
  bottom: 20px;
  right: 10px;
  width: 100px;
  height: 100px;
  background-color: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  z-index: 999;
  transition: opacity 0.3s ease;
  padding: 0;
  overflow: hidden;
}

#backToTop img {
  width: 100%;
  height: 100%;
}

/* --- Mobile Header (Hidden on Desktop) --- */
.mobile-header {
  display: none;
}

/* --- 自訂義的進入動畫 --- */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  display: contents;
}

.fade-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ================================== */
/* === 技能（卡片，內容為 side project 技術）=== */
/* ================================== */
.skills-wrap {
  width: min(100%, 1000px);
  margin: 0 auto;
  padding: 0 1.25rem 1.5rem;
}

#skills h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 2.5rem;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
  margin: 0 auto;
  padding: 0;
}

.skill-card {
  background: #1e1f24;
  padding: 30px 20px;
  border-radius: 12px;
  border: 1px solid #2a2b30;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.skill-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 221, 255, 0.15);
  border-color: var(--primary-color);
}

.skill-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  line-height: 1;
}

.skill-card h3 {
  color: var(--primary-color);
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.skill-card p {
  color: #aaa;
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
  text-align: center;
}

/* ================================== */
/* === 學習經歷優化樣式 === */
/* ================================== */
#edu {
  padding: 40px 20px;
}

#edu h2 {
  text-align: center;
  margin-bottom: 30px;
  font-size: 2.5rem;
}

#edu p {
  text-align: left;
  width: 100%;
  font-size: 15px;
}

.edu-section {
  max-width: 900px;
  margin: 0 auto 35px auto;
  width: 90%;
}

.edu-section-title {
  font-size: 1.3rem;
  color: #00ddff;
  margin-bottom: 20px;
  text-align: left;
  padding-left: 10px;
  border-left: 4px solid var(--primary-color);
}

/* 學歷卡片 */
.education-card {
  background: #1e1f24;
  border-left: 4px solid var(--primary-color);
  padding: 16px 20px;
  margin-bottom: 16px;
  border-radius: 8px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.education-card:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(0, 221, 255, 0.1);
}

.education-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.education-title {
  font-size: 1.1rem;
  font-weight: bold;
  color: #fff;
}

.education-date {
  color: #888;
  font-size: 0.9rem;
}

/* ================================== */
/* === Photo Carousel 輪播照片 === */
/* ================================== */

.photo-carousel {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
}

.carousel-container {
  flex: 1;
  overflow: hidden;
  border-radius: 12px;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s ease-in-out;
}

.photo-slide {
  min-width: calc(33.333% - 13.333px);
  margin: 0 6.667px;
  background: #1e1f24;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #2a2b30;
}

.photo-slide img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;  /* 改成 contain，照片不會被裁切 */
  aspect-ratio: 4 / 3;
  background: #12151b;  /* 加上背景色填補空白 */
  cursor: pointer;  /* 滑鼠移上去變成手指，提示可以點擊 */
  transition: transform 0.3s ease;
}

.photo-slide img:hover {
  transform: scale(1.05);  /* 滑鼠移上去放大一點點 */
}


/* 箭頭按鈕 */
.carousel-btn {
  background: rgba(0, 221, 255, 0.2);
  color: #00ddff;
  border: 2px solid #00ddff;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-btn:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
  transform: scale(1.1);
}

.carousel-btn:active {
  transform: scale(0.95);
}

/* 指示點 */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 30px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2a2b30;
  cursor: pointer;
  transition: all 0.3s ease;
}

.dot.active {
  background: var(--primary-color);
  transform: scale(1.3);
}

.dot:hover {
  background: #00ddff;
}

/* ================================== */
/* === Lightbox 照片放大顯示 === */
/* ================================== */

.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;  /* 改用 vw 單位 */
  max-height: 90vh; /* 改用 vh 單位 */
  display: flex;     /* 新增 */
  align-items: center; /* 新增 */
  justify-content: center; /* 新增 */
}

.lightbox-content img {
  max-width: 100%;   /* 保持 */
  max-height: 90vh;  /* 改成 vh，與容器一致 */
  width: auto;       /* 新增：讓寬度自動調整 */
  height: auto;      /* 新增：讓高度自動調整 */
  object-fit: contain; /* 保持 */
  border-radius: 8px;
  box-shadow: 0 0 50px rgba(0, 221, 255, 0.3);
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.lightbox-close:hover {
  background: #00ddff;
  transform: rotate(90deg);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 221, 255, 0.3);
  color: #00ddff;
  border: 2px solid #00ddff;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.lightbox-nav:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

@keyframes zoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* 手機版調整 */
@media (max-width: 768px) {
  .lightbox-close {
    top: 10px;
    right: 10px;
  }
  
  .lightbox-nav {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  
  .lightbox-prev {
    left: 10px;
  }
  
  .lightbox-next {
    right: 10px;
  }
}
/* ================================== */
/* === RWD / 手機版樣式 (Mobile) === */
/* ================================== */
@media (max-width: 768px) {
  h1 {
    text-align: center;
    font-size: 2rem;
  }

  h2 {
    text-align: center;
  }

  p {
    text-align: center;
  }

  .layout {
    flex-direction: column;
  }

  /* --- Mobile Header --- */
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #222;
    color: #fff;
    height: 56px;
    padding: 0 16px;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1200;
  }

  .mobile-header .logo {
    font-size: 1.5rem;
    font-weight: bold;
  }

  .menu-toggle {
    font-size: 2rem;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
  }

  /* --- Sidebar --- */
  .sidebar {
    background: #222;
    width: 100%;
    height: auto;
    padding: 24px 0;
    top: 56px;
    left: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    border-radius: 0 0 16px 16px;
    z-index: 1100;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: transform 0.3s ease-out, opacity 0.3s ease-out, visibility 0s 0.3s;
  }

  .sidebar.open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
  }

  .sidebar h2 {
    display: none;
  }

  .avatar {
    width: 100px;
    height: 100px;
    margin-top: 0;
    margin-bottom: 24px;
  }

  .avatar img {
    object-position: center;
  }

  #nav-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    margin: 0;
  }

  #nav-list li {
    width: 100%;
    text-align: center;
    margin: 16px 0;
  }

  /* --- Main Content --- */
  .main-content {
    width: 100%;
    margin-left: 0;
    padding: 80px 20px 20px 20px;
    height: auto;
    overflow-y: visible;
    scroll-snap-type: none;
  }

  .section {
    height: auto;
    min-height: 0;
    padding: 20px 0;
    margin-bottom: 40px;
  }

  /* 關於我 */
  .about-copy {
    padding: 0 1rem;
  }

  .about-copy h1 {
    font-size: 2rem;
    margin-bottom: 1.25rem;
  }

  .about-copy p {
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 1rem;
  }

  /* 社群圖示 */
  .social-icons {
    flex-direction: row;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
  }

  .social-icon {
    width: 4rem;
    height: 4rem;
    margin-top: 0;
  }

  .social-icon img {
    width: 52%;
    height: 52%;
    object-fit: contain;
  }

  /* 技能卡片 */
  #skills h2 {
    font-size: 1.85rem;
  }

  .skills-wrap {
    padding: 0 0.75rem 1rem;
  }

  .skills-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .skill-card {
    padding: 24px 16px;
  }

  .skill-icon {
    font-size: 2.5rem;
  }

  .skill-card h3 {
    font-size: 1.1rem;
  }

  /* 學習經歷 */
  #edu {
    padding: 20px 10px;
  }

  #edu h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
  }

  .edu-section {
    margin-bottom: 25px;
  }

  .edu-section-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
  }

  .education-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .education-title {
    font-size: 1rem;
  }

  .education-card {
    padding: 14px 16px;
  }

  /* 工作經驗 */
  #exp p {
    font-size: 14px;
    text-align: center;
    padding: 0 10px;
  }

  .item-meta {
    width: 100%;
    display: flex;
    flex-direction: column;
    font-size: 14px;
    text-align: center;
  }

  /* 作品集 */
  .project-list {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 0 10px;
  }

  .project-card {
    padding: 16px;
  }

  .project-card h3 {
    font-size: 1.2rem;
  }

  .project-card-body {
    font-size: 0.875rem;
    line-height: 1.6;
  }

  .project-card-body h3 {
    font-size: 1.1rem;
  }

  .project-lead {
    margin-bottom: 0.65rem;
  }

  .project-points li {
    margin-bottom: 0.4rem;
  }

  .project-k {
    min-width: 4.75rem;
  }

  .project-card > img {
    aspect-ratio: 16 / 9;
  }

  /* 聯絡 */
  #contact {
    padding: 20px 10px;
  }

  .contact-info-center {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 10px;
  }

  .contact-item {
    padding: 16px;
    flex-direction: column;
    text-align: center;
  }

  .contact-icon {
    font-size: 2rem;
  }

  /* 回到頂端 */
  #backToTop {
    position: fixed;
    bottom: 10px;
    width: 60px;
    height: 60px;
  }
  /* Photo Carousel 手機版 */
  .photo-carousel {
    flex-direction: column;
    padding: 10px;
  }

  .photo-slide {
    min-width: 100%;
    margin: 0;
  }

  .carousel-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
  }

  .carousel-btn.prev {
    left: 10px;
  }

  .carousel-btn.next {
    right: 10px;
  }

  .carousel-dots {
    margin-top: 20px;
  }
}