/* ===== iron_127 個人網站 ===== */
:root {
  --bg: #0b0e14;
  --bg-soft: #11151f;
  --card: #151a26;
  --card-hover: #1a2130;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8ecf4;
  --text-dim: #9aa3b5;
  --accent: #5eead4;
  --accent-2: #818cf8;
  --accent-grad: linear-gradient(120deg, #5eead4, #818cf8);
  --radius: 16px;
  --nav-h: 68px;
  --nav-bg: rgba(11, 14, 20, 0.72);
  --nav-mobile-bg: rgba(17, 21, 31, 0.98);
  font-size: 16px;
}

/* 淺色主題 */
:root[data-theme="light"] {
  --bg: #f5f7fb;
  --bg-soft: #eef1f7;
  --card: #ffffff;
  --card-hover: #f0f3fa;
  --border: rgba(15, 23, 42, 0.1);
  --text: #1e2433;
  --text-dim: #5b6472;
  --accent: #0d9488;
  --accent-2: #4f46e5;
  --accent-grad: linear-gradient(120deg, #0d9488, #4f46e5);
  --nav-bg: rgba(255, 255, 255, 0.78);
  --nav-mobile-bg: rgba(255, 255, 255, 0.98);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft JhengHei", "Noto Sans TC", system-ui, -apple-system, sans-serif;
  line-height: 1.7;
  overflow-x: hidden;
}

.accent {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* 背景光暈 */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.16;
  pointer-events: none;
  z-index: 0;
}
.glow-1 { width: 520px; height: 520px; background: #5eead4; top: -180px; right: -120px; }
.glow-2 { width: 460px; height: 460px; background: #818cf8; bottom: -160px; left: -120px; }

main { position: relative; z-index: 1; }

/* ===== 導覽列 ===== */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5vw;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  background: var(--card);
}

.nav-avatar.avatar-missing {
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  content: "i";
}
.nav-avatar.avatar-missing::before { content: "i"; }

.nav-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px;
  margin-left: 4px;
}
.nav-toggle span {
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* 導覽列右側：主題 + 語言 + 選單 */
.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-btn {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s;
}
.nav-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}
/* 深色顯示太陽（點一下變淺），淺色顯示月亮（點一下變深） */
[data-theme="dark"] .ic-moon { display: none; }
[data-theme="light"] .ic-sun { display: none; }

/* ===== 主視覺 ===== */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--nav-h) + 40px) 6vw 40px;
  position: relative;
}

.hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6vw;
  width: 100%;
  max-width: 1100px;
}

.hero-hi {
  color: var(--accent);
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.hero-name {
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.01em;
}
.hero-name .underscore {
  color: var(--text-dim);
  animation: blink 1.2s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0.25; } }

.hero-tag {
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  color: var(--text-dim);
  margin: 18px 0 30px;
  min-height: 1.8em;
}
#typed { color: var(--text); font-weight: 600; }
.caret { color: var(--accent); margin-left: 2px; animation: blink 1s steps(1) infinite; }

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 12px 26px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
.btn-primary {
  background: var(--accent-grad);
  color: #0b0e14;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(94, 234, 212, 0.28);
}
.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

.hero-socials { display: flex; gap: 16px; margin-top: 36px; }
.hero-socials a {
  color: var(--text-dim);
  transition: color 0.2s, transform 0.2s;
  display: inline-flex;
}
.hero-socials a:hover { color: var(--accent); transform: translateY(-3px); }

/* 頭像 */
.hero-avatar-wrap { position: relative; flex-shrink: 0; }
.avatar-ring {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: var(--accent-grad);
  opacity: 0.85;
  filter: blur(22px);
  animation: pulse 3.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.06); opacity: 0.55; }
}
.hero-avatar {
  position: relative;
  width: clamp(180px, 26vw, 280px);
  height: clamp(180px, 26vw, 280px);
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(94, 234, 212, 0.5);
  background: var(--card);
  display: grid;
  place-items: center;
}
.hero-avatar.avatar-missing::before {
  content: "i";
  font-size: 5rem;
  font-weight: 800;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.scroll-hint {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  animation: bob 1.8s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* ===== 區塊 ===== */
.section { padding: 90px 6vw; max-width: 1100px; margin: 0 auto; }

.section-title {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 36px;
  letter-spacing: 0.02em;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  color: var(--text-dim);
  font-size: 1.02rem;
}
.about-grid strong { color: var(--text); }

/* 技能 */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.skill-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: transform 0.25s, background 0.25s, border-color 0.25s;
}
.skill-card:hover {
  transform: translateY(-5px);
  background: var(--card-hover);
  border-color: rgba(94, 234, 212, 0.35);
}
.skill-icon {
  width: 50px; height: 50px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(94, 234, 212, 0.1);
  color: var(--accent);
  margin-bottom: 16px;
}
.skill-card h3 { font-size: 1.08rem; margin-bottom: 8px; }
.skill-card p { color: var(--text-dim); font-size: 0.95rem; }

/* 作品 */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
}

.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s, border-color 0.25s;
}
.project-card:hover { transform: translateY(-5px); border-color: rgba(129, 140, 248, 0.4); }

.project-thumb {
  height: 150px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.5);
}
.thumb-1 { background: linear-gradient(135deg, #134e4a, #0f172a); }
.thumb-2 { background: linear-gradient(135deg, #312e81, #0f172a); }
.thumb-3 { background: linear-gradient(135deg, #7c2d12, #0f172a); }

.project-body { padding: 22px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.project-body h3 { font-size: 1.12rem; }
.project-body p { color: var(--text-dim); font-size: 0.95rem; flex: 1; }

.project-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.project-tags span {
  font-size: 0.78rem;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(94, 234, 212, 0.1);
  color: var(--accent);
  border: 1px solid rgba(94, 234, 212, 0.25);
}

.project-links { display: flex; gap: 18px; }
.link { color: var(--accent); text-decoration: none; font-size: 0.92rem; font-weight: 600; }
.link:hover { text-decoration: underline; }

/* 友情連結 */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.link-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.25s, border-color 0.25s, background 0.25s;
}
.link-card:hover {
  transform: translateY(-5px);
  background: var(--card-hover);
  border-color: rgba(94, 234, 212, 0.35);
}
.link-icon {
  flex-shrink: 0;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(129, 140, 248, 0.12);
  color: var(--accent-2);
  overflow: hidden;
}
.link-icon img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 10px;
}
.link-text h3 { font-size: 1.05rem; margin-bottom: 6px; }
.link-text p { color: var(--text-dim); font-size: 0.92rem; flex: 1; }
.link-card-cta {
  display: inline-block;
  margin-top: 12px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}
.link-card:hover .link-card-cta { text-decoration: underline; }

/* 聯絡 */
.contact-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 50px 32px;
  text-align: center;
}
.contact-lead { color: var(--text-dim); font-size: 1.08rem; margin-bottom: 26px; }
.contact-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 26px;
}
.contact-links a { color: var(--text-dim); text-decoration: none; font-size: 0.95rem; }
.contact-links a:hover { color: var(--accent); }

/* 頁尾 */
.footer {
  border-top: 1px solid var(--border);
  padding: 26px 6vw;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
  position: relative;
  z-index: 1;
}

/* ===== 進場動畫 ===== */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible { opacity: 1; transform: none; }

/* ===== 側邊選單 ===== */
.side-menu {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: var(--nav-mobile-bg);
  border-right: 1px solid var(--border);
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: none;
}
.side-menu.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.3); }

.side-menu-inner {
  padding: calc(var(--nav-h) + 28px) 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  overflow-y: auto;
}

.side-link {
  display: block;
  padding: 14px 16px;
  border-radius: 10px;
  color: var(--text-dim);
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  transition: background 0.18s, color 0.18s;
}
.side-link:hover, .side-link.active {
  background: rgba(94, 234, 212, 0.1);
  color: var(--accent);
}

/* 背景遮罩 */
.menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 150;
}
.menu-overlay.show { display: block; }

/* 當側邊選單開啟時禁止 body 滾動 */
body.menu-open { overflow: hidden; }

/* ===== 行動裝置 ===== */
@media (max-width: 820px) {
  .hero-inner { flex-direction: column-reverse; text-align: center; gap: 48px; }
  .hero-actions, .hero-socials { justify-content: center; }
  .section { padding: 70px 6vw; }
}
