:root {
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --surface-blue: #eef4f8;
  --text: #1b2733;
  --muted: #667480;
  --line: #dce5ea;
  --navy: #0b2a3b;
  --navy-2: #153d53;
  --blue: #2f6f91;
  --teal: #267672;
  --teal-soft: #e4f2f0;
  --gold: #a77a2d;
  --gold-soft: #f6efe2;
  --shadow: 0 18px 46px rgba(14, 42, 58, .09);
  --shadow-sm: 0 8px 24px rgba(14, 42, 58, .06);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --max: 1360px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", "Noto Sans TC", Arial, sans-serif;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: fixed;
  left: 16px;
  top: -70px;
  z-index: 1000;
  padding: 9px 13px;
  background: white;
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
}
.skip-link:focus { top: 12px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(220,229,234,.94);
}
.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  min-height: 70px;
  padding: 9px 24px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 24px;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  text-decoration: none;
}
.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--navy);
  color: white;
  font-size: .83rem;
  font-weight: 800;
  letter-spacing: .05em;
  box-shadow: 0 8px 18px rgba(11,42,59,.16);
}
.brand-copy { display: grid; min-width: 0; line-height: 1.15; }
.brand-copy strong { color: var(--navy); font-size: .95rem; }
.brand-copy span { margin-top: 4px; color: var(--muted); font-size: .73rem; }
.primary-nav { display: flex; align-items: center; gap: 22px; }
.primary-nav a {
  position: relative;
  color: #4e5d68;
  text-decoration: none;
  font-size: .82rem;
  font-weight: 700;
}
.primary-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -8px;
  height: 2px;
  background: var(--teal);
  transition: .18s ease;
}
.primary-nav a:hover { color: var(--navy); }
.primary-nav a:hover::after { right: 0; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.language-switcher {
  display: flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
}
.lang-link {
  min-width: 33px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: .74rem;
  font-weight: 800;
}
.lang-link.active { background: white; color: var(--navy); box-shadow: 0 2px 8px rgba(13,42,61,.08); }
.button {
  min-height: 39px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  text-decoration: none;
  font-size: .81rem;
  font-weight: 800;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--navy); color: white; border: 1px solid var(--navy); }
.button-primary:hover { background: var(--navy-2); }
.button-secondary { background: white; color: var(--navy); border: 1px solid #cbd8df; }
.button-secondary:hover, .button-ghost:hover { border-color: #aabec8; }
.button-ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.text-link { color: var(--teal); font-size: .86rem; font-weight: 800; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 24px 0;
}
.hero-card {
  min-height: 430px;
  display: grid;
  grid-template-columns: 255px minmax(0, 1fr);
  gap: 36px;
  padding: 30px;
  border: 1px solid #d9e5ea;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 96% 8%, rgba(47,111,145,.10), transparent 28%),
    linear-gradient(135deg, #ffffff 0%, #f9fbfc 52%, #f0f6f7 100%);
  box-shadow: var(--shadow);
}
.portrait-column { display: flex; flex-direction: column; min-width: 0; }
.portrait-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 11 / 15;
  border-radius: 22px;
  background: #dfe9ed;
  border: 1px solid #d6e2e7;
  box-shadow: 0 14px 30px rgba(18,57,74,.12);
}
.portrait-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
  pointer-events: none;
}
.profile-photo { width: 100%; height: 100%; object-fit: cover; object-position: center 14%; display: block; }
.portrait-links { display: grid; gap: 5px; margin-top: 13px; padding-left: 2px; }
.portrait-links span { color: var(--muted); font-size: .82rem; }
.portrait-links a { color: var(--navy-2); font-size: .82rem; font-weight: 750; text-decoration: none; overflow-wrap: anywhere; }
.portrait-links a:hover { color: var(--teal); }
.hero-copy { align-self: center; min-width: 0; }
.eyebrow, .section-kicker {
  margin: 0 0 7px;
  color: var(--teal);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(2.7rem, 5.2vw, 4.55rem);
  line-height: .98;
  letter-spacing: -.045em;
}
.hero h2 {
  margin: 17px 0 0;
  max-width: 920px;
  color: var(--navy-2);
  font-size: clamp(1.28rem, 2.35vw, 2.05rem);
  line-height: 1.24;
  letter-spacing: -.025em;
  font-weight: 680;
}
.hero-summary {
  max-width: 920px;
  margin: 18px 0 0;
  color: #485865;
  font-size: .98rem;
  line-height: 1.78;
}
.credential-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.credential {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--gold-soft);
  border: 1px solid #ead9b8;
  color: #73561f;
  font-size: .75rem;
  font-weight: 800;
}
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; }
.focus-strip {
  margin: 14px 10px 0;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 16px;
  border: 1px solid #dde7eb;
  background: rgba(255,255,255,.82);
  box-shadow: var(--shadow-sm);
}
.focus-label { flex: 0 0 auto; color: var(--muted); font-size: .72rem; font-weight: 850; text-transform: uppercase; letter-spacing: .1em; }
.focus-items { display: flex; flex-wrap: wrap; gap: 7px; }
.focus-chip {
  border: 1px solid #d9e4e9;
  background: var(--surface-soft);
  color: var(--navy-2);
  border-radius: 999px;
  padding: 7px 10px;
  font: inherit;
  font-size: .76rem;
  font-weight: 750;
  cursor: pointer;
}
.focus-chip:hover, .focus-chip.active { background: var(--teal-soft); border-color: #bcdad6; color: #155f5b; }

.portfolio-shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 24px 76px;
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.profile-sidebar { position: sticky; top: 90px; display: grid; gap: 14px; }
.sidebar-card {
  padding: 19px;
  border-radius: var(--radius-lg);
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.sidebar-card h3 { margin: 0 0 13px; color: var(--navy); font-size: 1.02rem; }
.slim-card { padding: 18px 19px; }
.filter-reset {
  width: 100%;
  margin-bottom: 9px;
  padding: 9px 11px;
  border: 0;
  border-radius: 10px;
  background: var(--teal-soft);
  color: #155f5b;
  font: inherit;
  font-size: .8rem;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}
.filter-reset:not(.active) { background: var(--surface-soft); color: var(--navy); }
.expertise-list { display: grid; gap: 4px; }
.expertise-item {
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #44535f;
  font: inherit;
  font-size: .79rem;
  line-height: 1.38;
  text-align: left;
  cursor: pointer;
}
.expertise-item:hover { background: var(--surface-soft); }
.expertise-item.active { background: var(--teal-soft); color: #155f5b; font-weight: 800; }
.language-list { display: grid; gap: 8px; }
.language-item { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: .81rem; }
.language-item strong { color: var(--navy); }
.language-item span { color: var(--muted); text-align: right; }
.credential-list { display: grid; gap: 11px; }
.credential-item { display: grid; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid #edf1f3; }
.credential-item:last-child { padding-bottom: 0; border-bottom: 0; }
.credential-item strong { color: var(--navy); font-size: .8rem; line-height: 1.38; }
.credential-item span { color: var(--muted); font-size: .73rem; line-height: 1.4; }

.content-column { min-width: 0; }
.cv-section { margin-bottom: 44px; scroll-margin-top: 92px; }
.section-heading { margin-bottom: 16px; }
.section-heading h2 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.55rem, 2.5vw, 2.1rem);
  letter-spacing: -.03em;
  line-height: 1.12;
}
.compact-heading { margin-bottom: 14px; }

.executive-timeline { display: grid; gap: 12px; }
.timeline-card {
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  gap: 16px;
  transition: .18s ease;
}
.timeline-date {
  padding: 15px 0 0;
  display: grid;
  align-content: start;
  gap: 4px;
  color: var(--navy-2);
  font-size: .78rem;
  font-weight: 800;
}
.timeline-date small { color: var(--muted); font-size: .72rem; font-weight: 650; }
.timeline-body {
  position: relative;
  padding: 18px 20px 18px 23px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.timeline-body::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--teal);
}
.timeline-body h3 { margin: 0; color: var(--navy); font-size: 1.05rem; line-height: 1.35; }
.company { margin: 4px 0 0; color: #53626d; font-size: .87rem; font-weight: 750; }
.tech-line { margin: 10px 0 0; color: var(--teal); font-size: .79rem; line-height: 1.5; font-weight: 700; }
.intro { margin: 9px 0 0; color: #4e5e69; font-size: .87rem; }
.achievement-list { margin: 11px 0 0; padding-left: 1rem; color: #45545f; font-size: .87rem; }
.achievement-list li { margin: 5px 0; padding-left: 3px; }
.achievement-list li::marker { color: var(--teal); }
.earlier-experience {
  margin-top: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #f9fbfc;
  overflow: hidden;
}
.earlier-experience summary {
  list-style: none;
  cursor: pointer;
  padding: 13px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--navy);
  font-size: .86rem;
  font-weight: 850;
}
.earlier-experience summary::-webkit-details-marker { display: none; }
.earlier-experience summary span { color: var(--teal); font-size: 1.15rem; }
.earlier-experience[open] summary { border-bottom: 1px solid var(--line); }
.compact-timeline { padding: 14px; }
.compact-timeline .timeline-body { box-shadow: none; background: white; }

.skill-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.skill-card {
  padding: 17px 18px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.skill-card h3 { margin: 0 0 12px; color: var(--navy); font-size: .94rem; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.skill-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--surface-blue);
  color: #345366;
  font-size: .74rem;
  line-height: 1.35;
  font-weight: 700;
}

.two-section-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
.stack-list { display: grid; gap: 10px; }
.stack-card {
  padding: 16px 17px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.date-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-blue);
  color: var(--navy-2);
  font-size: .7rem;
  font-weight: 850;
}
.stack-card h3 { margin: 9px 0 5px; color: var(--navy); font-size: .92rem; line-height: 1.42; }
.stack-card p { margin: 0; color: var(--muted); font-size: .79rem; line-height: 1.5; }
.project-card h3 a { text-decoration: none; }
.project-card h3 a:hover { color: var(--teal); }
.project-links { display: flex; gap: 8px; margin-top: 10px; }
.project-links a { padding: 6px 9px; border-radius: 999px; background: var(--teal-soft); color: #155f5b; text-decoration: none; font-size: .73rem; font-weight: 800; }

[data-filterable].is-hidden, [data-filter-group].is-hidden { display: none !important; }
.filter-status {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 120;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 9px 11px 9px 14px;
  border-radius: 999px;
  background: rgba(11,42,59,.95);
  color: white;
  box-shadow: 0 14px 30px rgba(11,42,59,.24);
  font-size: .78rem;
}
.filter-status[hidden] { display: none; }
.filter-status button { border: 0; border-radius: 999px; background: white; color: var(--navy); padding: 6px 9px; font: inherit; font-size: .72rem; font-weight: 850; cursor: pointer; }

.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 23px 24px 36px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .79rem;
}
.site-footer div { display: grid; gap: 3px; }
.site-footer strong { color: var(--navy); }
.site-footer a { color: var(--teal); text-decoration: none; font-weight: 800; }

@media (max-width: 1120px) {
  .header-inner { grid-template-columns: 1fr auto; }
  .primary-nav { display: none; }
  .hero-card { grid-template-columns: 220px minmax(0,1fr); }
  .portfolio-shell { grid-template-columns: 1fr; }
  .profile-sidebar { position: static; grid-template-columns: repeat(3, minmax(0,1fr)); }
  .profile-sidebar .sidebar-card:first-child { grid-column: span 2; }
}

@media (max-width: 780px) {
  .header-inner { padding: 8px 15px; gap: 10px; }
  .brand-copy span, .header-link { display: none; }
  .button { min-height: 36px; padding: 0 11px; font-size: .75rem; }
  .hero { padding: 16px 15px 0; }
  .hero-card { grid-template-columns: 1fr; gap: 20px; padding: 20px; min-height: 0; }
  .portrait-column { max-width: 230px; }
  .hero h1 { font-size: 2.55rem; }
  .hero h2 { font-size: 1.2rem; }
  .hero-summary { font-size: .93rem; }
  .focus-strip { margin: 10px 0 0; align-items: flex-start; flex-direction: column; }
  .portfolio-shell { padding: 22px 15px 55px; }
  .profile-sidebar { grid-template-columns: 1fr; }
  .profile-sidebar .sidebar-card:first-child { grid-column: auto; }
  .timeline-card { grid-template-columns: 1fr; gap: 6px; }
  .timeline-date { padding: 0; display: flex; gap: 8px; align-items: center; }
  .skill-grid, .two-section-grid { grid-template-columns: 1fr; }
}

@media print {
  body { background: white; }
  .site-header, .focus-strip, .profile-sidebar, .filter-status, .site-footer { display: none !important; }
  .hero { max-width: none; padding: 0; }
  .hero-card { box-shadow: none; border: 0; padding: 0; min-height: 0; }
  .portfolio-shell { display: block; max-width: none; padding: 0; }
  .earlier-experience { border: 0; background: white; }
  .earlier-experience summary { display: none; }
  .earlier-experience > div { display: grid !important; }
}

/* Protected credential / portfolio document previews */
.document-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.document-link {
  appearance: none;
  border: 1px solid rgba(31,103,99,.22);
  background: var(--teal-soft, #e8f3f2);
  color: var(--teal, #1f6763);
  border-radius: 999px;
  padding: 7px 10px;
  font: inherit;
  font-size: .76rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.document-link:hover { border-color: rgba(31,103,99,.42); transform: translateY(-1px); }
.project-links button.document-link { border: 0; }

.document-modal[hidden] { display: none !important; }
.document-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 24px;
}
.document-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4,20,30,.78);
  backdrop-filter: blur(8px);
}
.document-modal-panel {
  position: relative;
  z-index: 1;
  width: min(980px, 96vw);
  max-height: 92vh;
  overflow: auto;
  background: #f7fafb;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(0,0,0,.32);
}
.document-modal-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px 14px;
  background: rgba(247,250,251,.96);
  border-bottom: 1px solid #dce6ea;
  backdrop-filter: blur(10px);
}
.document-modal-header h2 { margin: 0; color: var(--navy); font-size: 1.1rem; }
.document-modal-close {
  width: 38px;
  height: 38px;
  border: 1px solid #d4e0e5;
  border-radius: 50%;
  background: white;
  color: var(--navy);
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.document-preview-notice {
  margin: 0;
  padding: 10px 20px;
  background: #eef5f6;
  color: #50626d;
  font-size: .8rem;
  border-bottom: 1px solid #dce6ea;
}
.document-pages { display: grid; gap: 18px; padding: 20px; }
.document-page {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 10px;
  box-shadow: 0 9px 30px rgba(13,42,61,.13);
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
body.document-modal-open { overflow: hidden; }

@media print {
  .document-modal { display: none !important; }
}
