
:root {
  --bg: #07111f;
  --bg-soft: #0d1a2d;
  --panel: rgba(16, 31, 52, 0.78);
  --panel-strong: #12233a;
  --text: #f5f7fb;
  --muted: #a9b8cc;
  --accent: #7c9cff;
  --accent-2: #74e0cf;
  --line: rgba(255,255,255,.10);
  --shadow: 0 20px 60px rgba(0,0,0,.35);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  background:
    radial-gradient(circle at 15% 20%, rgba(124,156,255,.18), transparent 30%),
    radial-gradient(circle at 85% 10%, rgba(116,224,207,.12), transparent 28%),
    var(--bg);
  color: var(--text);
  line-height: 1.7;
}

body.light {
  --bg: #eef3fa;
  --bg-soft: #ffffff;
  --panel: rgba(255,255,255,.84);
  --panel-strong: #ffffff;
  --text: #102037;
  --muted: #5d6c7f;
  --line: rgba(20,40,70,.10);
  --shadow: 0 18px 50px rgba(31,55,88,.14);
}

img {
  max-width: 100%;
  display: block;
}

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

.container {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(18px);
  background: rgba(7,17,31,.72);
  border-bottom: 1px solid var(--line);
}

body.light .site-header {
  background: rgba(238,243,250,.78);
}

.nav {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: .4px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #08111f;
  font-weight: 900;
}

.nav-links {
  display: flex;
  gap: 6px;
  align-items: center;
}

.nav-links a {
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--muted);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: rgba(255,255,255,.07);
}

.theme-toggle,
.menu-toggle {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

.menu-toggle {
  display: none;
}

.hero {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  align-items: center;
  gap: 60px;
  padding: 80px 0;
}

.eyebrow {
  color: var(--accent-2);
  font-size: .9rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-weight: 700;
}

.hero h1 {
  margin: 14px 0 20px;
  font-size: clamp(3rem, 7vw, 6.4rem);
  line-height: .98;
  letter-spacing: -.055em;
}

.gradient-text {
  background: linear-gradient(135deg, #ffffff, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body.light .gradient-text {
  background: linear-gradient(135deg, #102037, #4f6fd8, #2a9f8f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-copy {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.12rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 14px;
  font-weight: 700;
  border: 1px solid var(--line);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #5f7cf5);
  color: white;
  box-shadow: 0 14px 35px rgba(95,124,245,.28);
}

.btn-secondary {
  background: var(--panel);
}

.hero-card {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.profile-photo {
  aspect-ratio: 4 / 5;
  border-radius: 22px;
  background:
    linear-gradient(rgba(7,17,31,.1), rgba(7,17,31,.4)),
    url("../images/profile-placeholder.svg") center/cover no-repeat;
}

.hero-card .badge {
  position: absolute;
  right: 14px;
  bottom: 18px;
  background: rgba(7,17,31,.82);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 15px;
  font-size: .9rem;
}

section {
  padding: 92px 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 34px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: -.04em;
}

.section-head p {
  margin: 0;
  max-width: 580px;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 22px;
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 10px;
}

.card p {
  color: var(--muted);
}

.stat {
  font-size: 2.1rem;
  font-weight: 800;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(124,156,255,.12);
  border: 1px solid rgba(124,156,255,.2);
  color: #c9d4ff;
  font-size: .86rem;
}

body.light .tag {
  color: #304caa;
}

.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(var(--accent), var(--accent-2));
}

.timeline-item {
  position: relative;
  padding: 0 0 30px 20px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -27px;
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 5px rgba(116,224,207,.12);
}

.project-card,
.gallery-card {
  overflow: hidden;
  padding: 0;
}

.project-cover,
.gallery-image {
  aspect-ratio: 16/10;
  background-size: cover;
  background-position: center;
}

.project-body,
.gallery-body {
  padding: 22px;
}

.gallery-card {
  transition: transform .25s ease, border-color .25s ease;
}

.gallery-card:hover {
  transform: translateY(-7px);
  border-color: rgba(124,156,255,.5);
}

.gallery-image {
  cursor: zoom-in;
}

.code-window {
  background: #020712;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.08);
  overflow: hidden;
}

.code-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.dots {
  display: flex;
  gap: 7px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #526076;
}

.copy-btn {
  border: 0;
  background: rgba(255,255,255,.08);
  color: #dbe5f6;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
}

pre {
  margin: 0;
  padding: 22px;
  overflow: auto;
  color: #dce8ff;
  font-family: "Fira Code", Consolas, monospace;
  font-size: .92rem;
}

.page-hero {
  padding: 90px 0 36px;
}

.page-hero h1 {
  margin: 10px 0 12px;
  font-size: clamp(2.8rem, 6vw, 5rem);
  letter-spacing: -.05em;
}

.page-hero p {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.08rem;
}

.contact-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

footer {
  border-top: 1px solid var(--line);
  padding: 30px 0 42px;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 28px;
  background: rgba(0,0,0,.82);
  z-index: 100;
}

.modal.open {
  display: grid;
}

.modal img {
  max-width: min(1100px, 95vw);
  max-height: 86vh;
  border-radius: 18px;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 22px;
  border: 0;
  color: white;
  background: rgba(255,255,255,.12);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.3rem;
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: .7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .grid-3, .grid-2 {
    grid-template-columns: 1fr;
  }
  .nav-links {
    position: absolute;
    top: 72px;
    left: 20px;
    right: 20px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    background: var(--panel-strong);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
  }
  .nav-links.open {
    display: flex;
  }
  .menu-toggle {
    display: inline-block;
  }
  .contact-strip,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .container {
    width: min(100% - 24px, 1120px);
  }
  .hero {
    padding: 54px 0;
  }
  section {
    padding: 68px 0;
  }
  .hero h1 {
    font-size: 3.2rem;
  }
}
