/* =========================================================
   風格三：柔和玻璃 Bento  Soft Glass Bento
   ========================================================= */

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

:root {
  --ink: #171528;
  --ink-2: #4c4a66;
  --ink-3: #7b7994;
  --card: rgba(255, 255, 255, .62);
  --card-hover: rgba(255, 255, 255, .8);
  --stroke: rgba(255, 255, 255, .85);
  --stroke-2: rgba(23, 21, 40, .07);
  --shadow: 0 22px 45px -26px rgba(38, 30, 80, .3);
  --v1: #7c6bff;   /* 紫 */
  --v2: #ff7eb3;   /* 粉 */
  --v3: #35d6a7;   /* 綠 */
  --page: #f2f1fb;
  --sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --r: 22px;
}

body.dark {
  --ink: #f0eeff;
  --ink-2: #b3b0cc;
  --ink-3: #8a87a6;
  --card: rgba(30, 28, 48, .58);
  --card-hover: rgba(38, 35, 60, .74);
  --stroke: rgba(255, 255, 255, .1);
  --stroke-2: rgba(255, 255, 255, .07);
  --shadow: 0 22px 45px -26px rgba(0, 0, 0, .6);
  --page: #0d0c16;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .5s, color .5s;
}

::selection { background: var(--v1); color: #fff; }
a { color: inherit; }

/* ---------------- 雙語切換 ----------------
   只隱藏非當前語言，被顯示的元素保留原本的 display 型態 */
body[data-lang="en"] [lang="zh-Hant"] { display: none; }
body[data-lang="zh"] [lang="en"] { display: none; }
body[data-lang="zh"] { font-feature-settings: "palt" 1; }

/* ---------------- 背景 ---------------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.blob { position: absolute; display: block; border-radius: 50%; filter: blur(90px); opacity: .55; }
body.dark .blob { opacity: .34; }
.b1 { width: 46vw; height: 46vw; background: #8f7cff; top: -14vw; left: -8vw; animation: float1 22s ease-in-out infinite; }
.b2 { width: 40vw; height: 40vw; background: #ff8fc0; top: 18vw; right: -10vw; animation: float2 26s ease-in-out infinite; }
.b3 { width: 36vw; height: 36vw; background: #5fe3bc; bottom: 6vw; left: 12vw; animation: float3 30s ease-in-out infinite; }
.b4 { width: 30vw; height: 30vw; background: #ffd28f; bottom: -8vw; right: 16vw; animation: float1 34s ease-in-out infinite reverse; }
@keyframes float1 { 50% { transform: translate(6vw, 8vw) scale(1.12); } }
@keyframes float2 { 50% { transform: translate(-8vw, 6vw) scale(.9); } }
@keyframes float3 { 50% { transform: translate(7vw, -7vw) scale(1.08); } }
.noise {
  position: absolute; inset: 0; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
}

/* ---------------- 導覽 ---------------- */
.nav-wrap { position: sticky; top: 0; z-index: 50; display: flex; justify-content: center; padding: 18px 16px; }
.nav {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 8px 18px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--stroke);
  backdrop-filter: blur(18px) saturate(1.4); box-shadow: var(--shadow);
  max-width: 100%;
}
.brand { font-weight: 700; font-size: 15px; text-decoration: none; letter-spacing: -0.01em; margin-right: 6px; }
.nav-links { display: flex; gap: 2px; }
.nav-links a {
  font-size: 13.5px; text-decoration: none; color: var(--ink-2);
  padding: 7px 13px; border-radius: 999px; transition: .25s; white-space: nowrap;
}
.nav-links a:hover { color: var(--ink); background: rgba(124,107,255,.12); }
.nav-links a.active { color: #fff; background: var(--v1); }
.lang-btn {
  flex: none; height: 34px; padding: 0 13px; border-radius: 999px; cursor: pointer;
  font-family: var(--sans); font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  background: rgba(124,107,255,.1); border: 1px solid var(--stroke-2); transition: .25s;
}
.lang-btn:hover { color: var(--ink); background: rgba(124,107,255,.2); }
.theme-btn {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: 50%; cursor: pointer; color: var(--ink-2);
  background: rgba(124,107,255,.1); border: 1px solid var(--stroke-2); transition: .25s;
}
.theme-btn:hover { color: var(--ink); transform: rotate(-18deg); }
.theme-btn .moon { display: none; }
body.dark .theme-btn .sun { display: none; }
body.dark .theme-btn .moon { display: block; }

/* ---------------- 通用容器 ---------------- */
main { max-width: 1120px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px) 40px; }
.section { padding: clamp(48px, 8vw, 88px) 0 0; }

.sec-title {
  display: flex; align-items: center; gap: 14px;
  font-size: clamp(20px, 2.6vw, 27px); font-weight: 700; letter-spacing: -0.02em;
  margin: 0 0 26px;
}
.sec-title > span:first-child {
  font-family: var(--mono); font-size: 12px; font-weight: 400; color: #fff;
  background: linear-gradient(135deg, var(--v1), var(--v2));
  padding: 4px 10px; border-radius: 999px;
}

.card {
  background: var(--card); border: 1px solid var(--stroke); border-radius: var(--r);
  backdrop-filter: blur(16px) saturate(1.3); box-shadow: var(--shadow);
  padding: 26px 28px;
  transition: background .35s, transform .4s cubic-bezier(.2,.8,.2,1), box-shadow .4s;
}

/* ---------------- Hero ---------------- */
.hero { padding: clamp(40px, 9vw, 96px) 0 clamp(10px, 3vw, 24px); max-width: 900px; }
.badge {
  display: inline-flex; align-items: center; gap: 9px; margin-bottom: 26px;
  font-size: 12.5px; color: var(--ink-2); padding: 7px 15px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--stroke); backdrop-filter: blur(10px);
}
.badge .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--v3);
  box-shadow: 0 0 0 4px rgba(53,214,167,.2); animation: beat 2.2s infinite;
}
@keyframes beat { 50% { transform: scale(.7); opacity: .6; } }

.hero h1 {
  margin: 0 0 22px; font-size: clamp(34px, 6.4vw, 68px); font-weight: 800;
  line-height: 1.12; letter-spacing: -0.035em;
}
.grad {
  background: linear-gradient(100deg, var(--v1) 0%, var(--v2) 46%, var(--v3) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { margin: 0 0 32px; font-size: clamp(15px, 1.7vw, 18px); color: var(--ink-2); max-width: 58ch; line-height: 1.85; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 9px; text-decoration: none;
  padding: 13px 24px; border-radius: 999px; font-size: 14.5px; font-weight: 600;
  transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s, background .3s;
}
.btn svg { transition: transform .3s; }
.btn:hover svg { transform: translateX(4px); }
.primary {
  color: #fff; background: linear-gradient(120deg, var(--v1), #a262ff 55%, var(--v2));
  box-shadow: 0 14px 30px -12px rgba(124,107,255,.7);
}
.primary:hover { transform: translateY(-3px); box-shadow: 0 20px 36px -12px rgba(124,107,255,.75); }
.ghost { background: var(--card); border: 1px solid var(--stroke); color: var(--ink); backdrop-filter: blur(10px); }
.ghost:hover { transform: translateY(-3px); background: var(--card-hover); }

/* ---------------- Bento ---------------- */
.bento { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.c-about { grid-column: span 2; grid-row: span 2; }
.c-now { grid-column: span 2; }
.c-loc { grid-column: span 2; }
.card h3 { margin: 0 0 12px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.c-about p { margin: 0 0 14px; color: var(--ink-2); font-size: 14.5px; line-height: 1.9; }
.pillrow { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.pill {
  font-family: var(--mono); font-size: 11px; padding: 5px 11px; border-radius: 999px;
  background: rgba(124,107,255,.1); border: 1px solid rgba(124,107,255,.22); color: var(--ink-2);
}
body.dark .pill { background: rgba(124,107,255,.16); }
.pillrow.small { margin-top: 14px; }

.c-stat { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 2px; }
.stat-num {
  font-size: clamp(38px, 5vw, 54px); font-weight: 800; line-height: 1; letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--v1), var(--v2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-label { font-size: 13px; color: var(--ink-3); }

.now { margin: 0; padding: 0; list-style: none; }
.now li { display: flex; align-items: flex-start; gap: 11px; font-size: 14px; color: var(--ink-2); padding: 5px 0; }
.now i {
  flex: none; width: 7px; height: 7px; margin-top: 9px; border-radius: 50%;
  background: linear-gradient(135deg, var(--v1), var(--v3));
}
.loc-main { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.loc-sub { margin: 6px 0 0; font-size: 13px; color: var(--ink-3); }

/* ---------------- 經歷時間軸 ---------------- */
.timeline { display: flex; flex-direction: column; gap: 16px; }
.tl-item { display: grid; grid-template-columns: 150px 1fr; gap: 24px; }
.tl-item:hover { transform: translateY(-3px); background: var(--card-hover); }
.tl-when { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); padding-top: 4px; }
.tl-body h3 { margin: 0 0 4px; font-size: 18px; }
.tl-org {
  margin: 0 0 14px; font-size: 13.5px; font-weight: 600;
  background: linear-gradient(120deg, var(--v1), var(--v2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tl-body ul { margin: 0; padding: 0; list-style: none; }
.tl-body li {
  position: relative; padding-left: 18px; margin-bottom: 7px;
  font-size: 14.5px; color: var(--ink-2); line-height: 1.85;
}
.tl-body li::before {
  content: ""; position: absolute; left: 0; top: 11px; width: 8px; height: 2px;
  border-radius: 2px; background: linear-gradient(90deg, var(--v1), var(--v2));
}

/* ---------------- 作品 ---------------- */
.works { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.work { padding: 0; overflow: hidden; text-decoration: none; display: flex; flex-direction: column; }
.work:hover { transform: translateY(-6px); background: var(--card-hover); }
.work-visual {
  height: 168px; display: grid; place-items: center; position: relative; overflow: hidden;
  border-bottom: 1px solid var(--stroke-2);
}
.work-visual span {
  font-size: 25px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15;
  text-align: center; color: rgba(255,255,255,.94);
  text-shadow: 0 4px 20px rgba(30,20,60,.28); z-index: 1;
}
.work-visual::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.4), transparent 55%);
}
.v1 { background: linear-gradient(135deg, #7c6bff, #4f8dff); }
.v2 { background: linear-gradient(135deg, #ff7eb3, #ff9a6b); }
.v3 { background: linear-gradient(135deg, #35d6a7, #2bb6d6); }
.v4 { background: linear-gradient(135deg, #6b7280, #2f3542); }
.work-body { padding: 20px 24px 26px; }
.work-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.work-top h3 { margin: 0 0 8px; font-size: 17px; }
.year { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.work-body p { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.85; }

/* ---------------- 學歷與認證 ---------------- */
.edu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.edu:hover { transform: translateY(-3px); background: var(--card-hover); }
.edu-item { padding: 14px 0; border-bottom: 1px solid var(--stroke-2); }
.edu-item:last-child { border-bottom: 0; padding-bottom: 0; }
.edu-deg { margin: 0 0 4px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.edu-school { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.edu-year { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.certs { margin: 0; padding: 0; list-style: none; }
.certs li {
  display: flex; align-items: center; gap: 12px; padding: 11px 0;
  font-size: 14px; color: var(--ink-2); border-bottom: 1px solid var(--stroke-2);
}
.certs li:last-child { border-bottom: 0; padding-bottom: 0; }
.cert-mark {
  flex: none; width: 40px; text-align: center; font-family: var(--mono); font-size: 10px;
  font-weight: 500; letter-spacing: .04em; color: #fff; padding: 4px 0; border-radius: 6px;
  background: linear-gradient(135deg, #ff9a3c, #ff6b3d);
}
.cert-mark.alt { background: linear-gradient(135deg, var(--v1), var(--v2)); }

/* ---------------- 興趣 ---------------- */
.hobbies { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.hob:hover { transform: translateY(-5px); background: var(--card-hover); }
.hob-ic {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  margin-bottom: 14px; color: #fff;
  background: linear-gradient(135deg, var(--v1), var(--v2));
  box-shadow: 0 10px 22px -12px rgba(124,107,255,.9);
}
.hob-ic svg { width: 21px; height: 21px; }
.hob:nth-child(2) .hob-ic { background: linear-gradient(135deg, #35d6a7, #2bb6d6); }
.hob:nth-child(3) .hob-ic { background: linear-gradient(135deg, #ff9a6b, #ff5f8f); }
.hob:nth-child(4) .hob-ic { background: linear-gradient(135deg, #4f8dff, #7c6bff); }
.hob:nth-child(5) .hob-ic { background: linear-gradient(135deg, #ffc75f, #ff8f5f); }
.hob:nth-child(6) .hob-ic { background: linear-gradient(135deg, #a262ff, #ff7eb3); }
.hob p { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.85; }

/* ---------------- 聯絡 ---------------- */
.contact { text-align: center; padding: clamp(38px, 6vw, 62px) 28px; }
.contact h2 { margin: 0 0 12px; font-size: clamp(26px, 3.6vw, 38px); font-weight: 800; letter-spacing: -0.03em; }
.contact p { margin: 0 auto 26px; max-width: 46ch; color: var(--ink-2); font-size: 15px; }
.mail {
  display: inline-block; text-decoration: none; font-size: clamp(19px, 2.8vw, 29px); font-weight: 700;
  letter-spacing: -0.02em; padding-bottom: 4px;
  background: linear-gradient(100deg, var(--v1), var(--v2), var(--v3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.mail:hover { filter: brightness(1.1); }
.social { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; }
.social a {
  font-size: 13px; text-decoration: none; color: var(--ink-2);
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--stroke-2);
  background: rgba(124,107,255,.07); transition: .25s;
}
.social a:hover { color: var(--ink); transform: translateY(-2px); background: rgba(124,107,255,.16); }
.social-static {
  font-size: 13px; color: var(--ink-3); padding: 8px 16px; border-radius: 999px;
  border: 1px dashed var(--stroke-2);
}

.foot {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  margin-top: clamp(46px, 7vw, 80px); padding-top: 24px;
  border-top: 1px solid var(--stroke-2); font-size: 12.5px; color: var(--ink-3);
}

/* ---------------- 進場動畫 ---------------- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .75s ease, transform .75s cubic-bezier(.2,.8,.2,1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------------- RWD ---------------- */
@media (max-width: 900px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
  .c-about { grid-column: span 2; grid-row: auto; }
  .hobbies { grid-template-columns: repeat(2, 1fr); }
  .works { grid-template-columns: 1fr; }
  .tl-item { grid-template-columns: 1fr; gap: 10px; }
  .edu-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .nav { padding: 8px; gap: 4px; }
  .brand { display: none; }
  .nav-links { overflow-x: auto; scrollbar-width: none; }
  .nav-links::-webkit-scrollbar { display: none; }
  .bento, .hobbies { grid-template-columns: 1fr; }
  .card { padding: 22px 20px; }
  .blob { filter: blur(60px); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .blob { animation: none; }
  html { scroll-behavior: auto; }
}
