@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=DM+Serif+Display:ital@0;1&family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap");

:root {
  --navy-deep: #102a6b;
  --navy-mid: #015185;
  --blue-light: #5990c0;
  --gold: #cea273;
  --gold-dark: #a87d50;
  --cream: #fcedd3;
  --cream-dark: #f0d9b5;
  --cream-card: #fffbf4;
  --text-dark: #1a1410;
  --text-muted: #6b5c45;
  --text-light: #9e8a72;
  --border: rgba(16, 42, 107, 0.12);
  --sidebar-w: 300px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "DM Sans", sans-serif;
  color: var(--text-dark);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background: linear-gradient(
    135deg,
    var(--cream) 0%,
    var(--cream-dark) 40%,
    #e8dcc8 70%,
    #ddd0bd 100%
  );
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
/* =============================================
   語言切換器
   ============================================= */

.lang-switcher {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 1000;
}

.lang-globe {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(16, 42, 107, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(206, 162, 115, 0.35);
  color: rgba(255, 255, 255, 0.85);
  border-radius: 20px;
  padding: 0.48rem 0.86rem;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-globe:hover {
  background: rgba(16, 42, 107, 0.95);
  border-color: var(--gold);
  color: var(--gold);
}

/* 
  箭頭圖示：預設朝下
  選單展開時（父元素有 .open），旋轉 180deg 朝上
  transition 讓旋轉有動畫
*/
.lang-arrow {
  transition: transform 0.25s ease;
}

.lang-switcher:has(.open) .lang-arrow {
  /*
    :has() 是 CSS 新選擇器：
    「選取包含 .open 子元素的 .lang-switcher」
    等於說：「如果選單是開著的，箭頭就旋轉」
    支援度：Chrome 105+, Safari 15.4+, Firefox 121+
  */
  transform: rotate(180deg);
}
/* 語言縮寫文字（EN / 中） */
.lang-current {
  font-weight: 500;
  min-width: 20px;
  text-align: center;
}
/* =============================================
   下拉選單
   ============================================= */
.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  gap: 4px;
  background: rgba(16, 42, 107, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(206, 162, 115, 0.35);
  color: rgba(255, 255, 255, 0.65);
  border-radius: 14px;
  padding: 6px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  min-width: 140px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
}
.lang-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}
.lang-option:hover {
  background: rgba(115, 115, 206, 0.15);
  color: #fff;
}
/* 目前選中的語言：金色底線標示 */
.lang-option.active {
  color: var(--gold);
  background: rgba(115, 115, 206, 0.1);
}

.lang-flag {
  font-size: 1rem;
  line-height: 1;
}
/* =============================================
   主要版面
   ============================================= */
.layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  display: flex;
  flex-direction: column;
  padding: 2.5rem 2rem;
  background: linear-gradient(
    170deg,
    var(--navy-deep) 0%,
    #0d2260 50%,
    var(--navy-mid) 100%
  );
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  top: 0;
  height: 100vh;
  overflow-y: auto;
  position: sticky; /*stays on screen while scroll*/
  border-right: 1px solid rgba(206, 162, 115, 0.3);
}
.avatar-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  margin-bottom: 1.5rem;
}
.avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 3px solid var(--gold);
  box-shadow: 0 0 8px 6px rgba(206, 162, 115, 0.15);
}
.icon-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px solid rgba(200, 85, 61, 0.4);
  z-index: 0;
}

.name {
  font-family: "DM Serif Display", serif;
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.15;
  color: #fff;
  margin-bottom: 0.4rem;
}
.name em {
  color: var(--gold);
}
.role {
  color: var(--blue-light);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: "Montserrat", sans-serif;
  margin-bottom: 1.2rem;
}
.bio {
  font-size: 0.87rem;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 1.5rem;
  letter-spacing: 0.03em;
}

/*=====DIVIDER=========================*/
.divider {
  border: none;
  border-top: 1px solid rgba(206, 162, 115, 0.2);

  margin: 1rem 0;
}

.links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.link-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  transition:
    color 0.2s ease,
    background 0.2s ease;
}
.link-item:hover {
  color: var(--gold);
  background: rgba(206, 162, 115, 0.1);
}

.link-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.8;
}
.section-label {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 0.75rem;
  font-weight: 500;
}
.skill-tags {
  display: flex;
  flex-wrap: wrap; /* wrap to next line if not enough space */
  gap: 0.4rem;
}
.tag {
  font-size: 0.72rem;
  padding: 0.3rem 0.7rem;
  border-radius: 100px; /* pill shape */
  border: 1px solid rgba(206, 162, 115, 0.35);
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.03em;
  transition: all 0.2s ease;
}
.tag:hover {
  background-color: var(--cream-dark);
  color: var(--navy-mid);
}

/* ===== MAIN CONTENT =================================== */
main {
  flex: 1;
  padding: 50px 24px 50px 50px;
  max-width: 860px;
}

/* ===== PAGE HEADER ==================================== */
.page-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 1.2rem;
  border-left: 3px solid var(--gold);
  margin-bottom: 2.5rem;
}
.sub-title {
  font-family: "Montserrat", sans-serif;
  text-transform: uppercase;
  color: var(--navy-mid);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12rem;
}
.title {
  font-family: "DM Serif Display", serif;
  color: var(--navy-deep);
  font-size: 2.4rem;
  font-weight: 400;
  line-height: 1.2;
}
.title em {
  color: var(--gold-dark);
}
.section-sub {
  font-size: 0.96rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ===== PROJECT CARDS =================================== */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
.project-card {
  background-color: var(--cream-card);
  border-radius: 20px;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  border: 1px solid var(--border);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 48px rgba(16, 42, 107, 0.12);
}

/* Left side: project image */
.project-image-wrap {
  position: relative;
  width: 220px;
  min-width: 220px;
  overflow: hidden;
  background: var(--cream-dark);
}
.project-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.project-card:hover .project-img {
  transform: scale(1.05);
}
.project-overlay {
  position: absolute;
  inset: 0; /* shorthand for top:0; right:0; bottom:0; left:0 */
  opacity: 0;
  background: rgba(16, 42, 107, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}
.project-card:hover .project-overlay {
  opacity: 1;
}
.overlay-btn {
  background: var(--gold);
  color: var(--navy-deep);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 10px 24px;
  border-radius: 100px;
  text-decoration: none;
  transition: background 0.2s;
}
.overlay-btn:hover {
  background: #fff;
}

.project-info {
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.6rem;
  flex: 1;
}
.project-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.project-tag {
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: rgba(89, 144, 192, 0.12); /* light blue tint */
  color: var(--navy-mid);
  padding: 0.2rem 0.65rem;
  border-radius: 100px;
  font-weight: 500;
}
.project-name {
  font-family: "DM Serif Display", serif;
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--navy-deep);
  letter-spacing: 1.2;
  line-height: 1.2;
}
.project-desc {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-muted);
}
.project-tech {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}
.project-tech span {
  font-size: 0.7rem;
  color: var(--text-light);
  background: rgba(16, 42, 107, 0.06);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-weight: 500;
}

/* ===== PAGE FOOTER ==================================== */
footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== RESPONSIVE DESIGN ==================================== */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    min-width: unset;
    height: auto;
    position: static;
    padding: 3rem 2rem;
  }
  main {
    padding: 28px 36px;
  }
  .project-card {
    flex-direction: column;
  }

  .project-image-wrap {
    width: 100%;
    min-width: unset;
    height: 180px;
  }
  /* mobile 上語言切換器縮小一點 */
  .lang-globe {
    padding: 0.4rem 0.7rem;
    font-size: 0.72rem;
  }
}
