/* ============================================
   Reset & Base
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0e1a;
  --bg-soft: #111726;
  --surface: rgba(20, 28, 45, 0.6);
  --border: rgba(100, 255, 218, 0.15);
  --border-hover: rgba(100, 255, 218, 0.4);
  --text: #d6e1ff;
  --text-dim: #8892b0;
  --accent: #64ffda;
  --accent-soft: rgba(100, 255, 218, 0.1);
  --purple: #a78bfa;
  --font-mono: "SF Mono", "Fira Code", "JetBrains Mono", Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC",
    "Microsoft JhengHei", sans-serif;
}

html {
  scroll-behavior: smooth;
}

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

#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.5;
}

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

/* ============================================
   Navbar
   ============================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 3rem;
  background: rgba(10, 14, 26, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: padding 0.3s;
}

.navbar.scrolled {
  padding: 0.8rem 3rem;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.logo-bracket {
  color: var(--accent);
}

.logo-text {
  color: var(--text);
  margin: 0 2px;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2.2rem;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-dim);
  position: relative;
  transition: color 0.25s;
}

.nav-links a::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s;
}

.nav-links a:hover {
  color: var(--accent);
}

.nav-links a:hover::before {
  width: 100%;
}

/* ============================================
   Hero
   ============================================ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3rem;
  position: relative;
}

.hero-content {
  max-width: 900px;
  width: 100%;
}

.hero-greeting {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 1.2rem;
  opacity: 0;
  animation: fadeUp 0.7s ease forwards;
}

.hero-name {
  font-size: clamp(2.8rem, 7vw, 5.5rem);
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.1;
  background: linear-gradient(120deg, #ffffff 30%, var(--accent) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.8rem;
  opacity: 0;
  animation: fadeUp 0.7s ease 0.15s forwards;
}

.hero-title {
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  color: var(--text-dim);
  font-weight: 500;
  margin-bottom: 1.8rem;
  font-family: var(--font-mono);
  min-height: 2.2em;
  opacity: 0;
  animation: fadeUp 0.7s ease 0.3s forwards;
}

.cursor {
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-dim);
  max-width: 620px;
  margin-bottom: 2.4rem;
  line-height: 1.8;
  opacity: 0;
  animation: fadeUp 0.7s ease 0.45s forwards;
}

.highlight {
  color: var(--accent);
  font-weight: 500;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp 0.7s ease 0.6s forwards;
}

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

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 0.85rem 1.8rem;
  border-radius: 4px;
  transition: all 0.25s;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: rgba(100, 255, 218, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(100, 255, 218, 0.15);
}

.btn-outline {
  border-color: var(--text-dim);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.btn-large {
  padding: 1.1rem 2.5rem;
  font-size: 1rem;
}

/* ============================================
   Scroll Indicator
   ============================================ */
.scroll-indicator {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.scroll-indicator span {
  display: block;
  width: 1px;
  height: 40px;
  margin: 0 auto 0.6rem;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: scrollHint 1.8s ease-in-out infinite;
}

@keyframes scrollHint {
  0%, 100% { transform: scaleY(1); opacity: 1; }
  50% { transform: scaleY(0.4); opacity: 0.4; }
}

/* ============================================
   Sections
   ============================================ */
.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 6rem 3rem;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 3.5rem;
}

.section-num {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1.05rem;
}

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.section-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
  margin-left: 0.5rem;
}

/* ============================================
   Skills
   ============================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.6rem 1.4rem;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.skill-more {
  display: inline-block;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.25s, transform 0.25s;
}

.skill-card:hover .skill-more {
  opacity: 1;
  transform: translateX(0);
}

.skill-card::before {
  content: attr(data-category);
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  opacity: 0.6;
  letter-spacing: 0.5px;
}

.skill-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.skill-icon {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  color: var(--accent);
  margin-bottom: 0.8rem;
  display: inline-block;
}

.skill-card h3 {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.skill-card p {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ============================================
   Projects
   ============================================ */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.project-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem 2.2rem;
  transition: all 0.3s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.project-card::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--accent), var(--purple));
  opacity: 0;
  transition: opacity 0.3s;
}

.project-card:hover {
  border-color: var(--border-hover);
  transform: translateX(4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.project-card:hover::after {
  opacity: 1;
}

.project-index {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.5px;
  align-self: start;
  padding-top: 0.3rem;
}

.project-title {
  font-size: 1.35rem;
  color: var(--text);
  margin-bottom: 0.8rem;
  font-weight: 600;
}

.project-desc {
  color: var(--text-dim);
  line-height: 1.75;
  margin-bottom: 1.2rem;
  font-size: 0.96rem;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
}

.project-tags li {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.3rem 0.7rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.project-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.4rem;
  padding: 0.55rem 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 4px;
  transition: all 0.25s;
}

.project-cta:hover {
  background: var(--accent-soft);
  transform: translateX(4px);
  box-shadow: 0 6px 16px rgba(100, 255, 218, 0.15);
}

.project-cta .arrow {
  transition: transform 0.25s;
}

.project-cta:hover .arrow {
  transform: translateX(3px);
}

/* ============================================
   Contact
   ============================================ */
.contact-box {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.contact-lead {
  font-size: 1.1rem;
  color: var(--text-dim);
  margin-bottom: 2.5rem;
  line-height: 2;
}

.contact-card {
  background: #0d1422;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 2.5rem;
  text-align: left;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35);
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: #1a2236;
  border-bottom: 1px solid var(--border);
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }

.terminal-title {
  margin-left: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-dim);
}

.terminal-body {
  padding: 1.4rem 1.6rem;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.9;
}

.prompt {
  color: var(--accent);
  margin-right: 0.5rem;
}

.cmd {
  color: var(--text);
}

.output {
  color: var(--text-dim);
  padding-left: 1.2rem;
  margin-bottom: 0.3rem;
}

/* ============================================
   Skill Detail Page
   ============================================ */
.skill-page {
  padding-top: 5rem;
}

.skill-detail {
  max-width: 880px;
  margin: 0 auto;
  padding: 3rem 2.5rem 5rem;
  animation: skillFadeIn 0.5s ease;
}

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

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: var(--text-dim);
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: 30px;
  margin-bottom: 2.5rem;
  transition: all 0.25s;
  background: var(--surface);
}

.back-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateX(-4px);
}

.back-arrow {
  font-size: 1.1rem;
  transition: transform 0.25s;
}

.back-btn:hover .back-arrow {
  transform: translateX(-3px);
}

.skill-hero {
  display: flex;
  align-items: center;
  gap: 1.8rem;
  padding-bottom: 2rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.skill-hero-icon {
  font-family: var(--font-mono);
  font-size: 3rem;
  color: var(--accent);
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border: 1px solid var(--border-hover);
  border-radius: 14px;
  flex-shrink: 0;
}

.skill-hero-category {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-bottom: 0.6rem;
  text-transform: uppercase;
}

.skill-hero-name {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: var(--text);
  margin-bottom: 0.5rem;
  background: linear-gradient(120deg, #ffffff 30%, var(--accent) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.skill-hero-tagline {
  color: var(--text-dim);
  font-size: 1.02rem;
  font-style: italic;
}

.skill-section {
  margin-bottom: 2.5rem;
}

.skill-section-title {
  font-size: 1.15rem;
  color: var(--text);
  margin-bottom: 1rem;
  font-weight: 600;
}

.skill-section-title .num {
  font-family: var(--font-mono);
  color: var(--accent);
  margin-right: 0.4rem;
  font-weight: 400;
}

.skill-text {
  color: var(--text-dim);
  line-height: 1.85;
  font-size: 1rem;
}

.skill-highlights {
  list-style: none;
  padding-left: 0;
}

.skill-highlights li {
  color: var(--text-dim);
  line-height: 1.8;
  padding: 0.5rem 0 0.5rem 1.6rem;
  position: relative;
  border-bottom: 1px dashed rgba(100, 255, 218, 0.08);
}

.skill-highlights li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.skill-highlights li:last-child {
  border-bottom: none;
}

.skill-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  list-style: none;
  padding: 0;
}

.skill-tools li {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
}

.skill-projects {
  list-style: none;
  padding: 0;
}

.skill-projects li {
  margin-bottom: 0.5rem;
}

.skill-projects li a {
  color: var(--text-dim);
  transition: color 0.2s;
  font-family: var(--font-mono);
  font-size: 0.95rem;
}

.skill-projects li a:hover {
  color: var(--accent);
}

.skill-footer-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 3rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}

/* ============================================
   Project Detail Page
   ============================================ */
.project-page {
  padding-top: 5rem;
}

.project-detail {
  max-width: 920px;
  margin: 0 auto;
  padding: 3rem 2.5rem 5rem;
  animation: skillFadeIn 0.5s ease;
}

.project-hero {
  padding-bottom: 2.4rem;
  margin-bottom: 2.8rem;
  border-bottom: 1px solid var(--border);
}

.project-hero-index {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: 1px;
  margin-bottom: 0.8rem;
}

.project-hero-name {
  font-size: clamp(1.9rem, 4.2vw, 2.8rem);
  margin-bottom: 0.6rem;
  background: linear-gradient(120deg, #ffffff 25%, var(--accent) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.project-hero-subtitle {
  color: var(--text-dim);
  font-size: 1.1rem;
  font-style: italic;
  margin-bottom: 1.6rem;
}

.project-meta {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
}

.project-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.meta-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.meta-value {
  color: var(--text);
  font-size: 0.96rem;
}

.project-section {
  margin-bottom: 2.8rem;
}

.project-section-title {
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 1.1rem;
  font-weight: 600;
}

.project-section-title .num {
  font-family: var(--font-mono);
  color: var(--accent);
  margin-right: 0.4rem;
  font-weight: 400;
}

.project-text {
  color: var(--text-dim);
  line-height: 1.9;
  font-size: 1rem;
}

.project-bullets {
  list-style: none;
  padding: 0;
}

.project-bullets li {
  color: var(--text-dim);
  line-height: 1.8;
  padding: 0.6rem 0 0.6rem 1.6rem;
  position: relative;
  border-bottom: 1px dashed rgba(100, 255, 218, 0.08);
}

.project-bullets li:last-child {
  border-bottom: none;
}

.project-bullets li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.project-outcomes li::before {
  content: "★";
  color: var(--purple);
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  counter-reset: workflow;
}

.workflow-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem 1.2rem 1.2rem 1rem;
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  transition: all 0.25s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.workflow-step:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}

.workflow-step-num {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border-hover);
  border-radius: 8px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.workflow-step-body h4 {
  color: var(--text);
  font-size: 0.98rem;
  margin-bottom: 0.3rem;
  font-weight: 600;
}

.workflow-step-body p {
  color: var(--text-dim);
  font-size: 0.86rem;
  line-height: 1.55;
}

.skill-not-found {
  text-align: center;
  padding: 4rem 1rem;
}

.skill-not-found h1 {
  font-size: 6rem;
  color: var(--accent);
  font-family: var(--font-mono);
  margin-bottom: 1rem;
}

.skill-not-found p {
  color: var(--text-dim);
  margin-bottom: 2rem;
}

/* ============================================
   Footer
   ============================================ */
.footer {
  text-align: center;
  padding: 2.5rem 2rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

/* ============================================
   Reveal Animation
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .navbar {
    padding: 1rem 1.4rem;
  }

  .nav-links {
    gap: 1.2rem;
  }

  .nav-links a {
    font-size: 0.82rem;
  }

  .hero {
    padding: 0 1.5rem;
  }

  .section {
    padding: 4.5rem 1.5rem;
  }

  .project-card {
    grid-template-columns: 1fr;
    gap: 0.8rem;
    padding: 1.6rem;
  }

  .project-index {
    font-size: 1.1rem;
    padding-top: 0;
  }

  .hero-buttons {
    width: 100%;
  }

  .btn {
    flex: 1;
    text-align: center;
  }

  .skill-detail {
    padding: 2rem 1.4rem 4rem;
  }

  .skill-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.2rem;
    text-align: left;
  }

  .skill-hero-icon {
    width: 70px;
    height: 70px;
    font-size: 2.2rem;
  }

  .skill-footer-cta .btn {
    flex: 1 1 100%;
  }

  .project-detail {
    padding: 2rem 1.4rem 4rem;
  }

  .project-meta {
    gap: 1.5rem;
  }

  .workflow-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .nav-links {
    gap: 0.8rem;
  }

  .nav-links a {
    font-size: 0.75rem;
  }

  .terminal-body {
    font-size: 0.78rem;
    padding: 1rem;
  }
}
