:root {
  --bg: #f5f6f8;
  --paper: #ffffff;
  --ink: #1f2328;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --code-bg: #f6f8fa;
  --contact: #374151;
  --strong: #111827;
  --shadow: 0 6px 24px rgba(15, 23, 42, 0.08);
  --skeleton-base: #ebedf0;
  --skeleton-shine: #f6f7f9;
  --radius: 10px;
  --max-width: 820px;
  --font-zh: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC",
    "Source Han Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-en: Inter, "Aptos", "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

:root[data-theme="dark"] {
  --bg: #0d1117;
  --paper: #161b22;
  --ink: #e6edf3;
  --muted: #9aa4b2;
  --line: #2d333b;
  --accent: #58a6ff;
  --code-bg: #1f2630;
  --contact: #c9d1d9;
  --strong: #f0f6fc;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  --skeleton-base: #21262d;
  --skeleton-shine: #2d333b;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-zh);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

html:lang(en) body {
  font-family: var(--font-en);
}

html:lang(zh-CN) body,
html:lang(zh) body {
  font-family: var(--font-zh);
}

.resume {
  max-width: var(--max-width);
  margin: 16px auto 64px;
  padding: 48px 56px;
  background: var(--paper);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  transition: background-color 0.25s ease, box-shadow 0.25s ease, opacity 0.18s ease,
    transform 0.22s ease;
  transform: translateY(0) scale(1);
}

.resume--switching {
  opacity: 0.45;
  pointer-events: none;
}

.resume--lang-out {
  opacity: 0;
  transform: translateY(-10px) scale(0.985);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}

.resume--lang-in {
  animation: resumeLangIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes resumeLangIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  z-index: 1;
}

::view-transition-new(root) {
  z-index: 9999;
}

#toggle-lang.is-switching {
  animation: langFlip 0.42s cubic-bezier(0.34, 1.3, 0.64, 1);
}

#toggle-theme.is-switching svg {
  animation: themeIconIn 0.48s cubic-bezier(0.34, 1.45, 0.64, 1);
  transform-origin: center;
}

@keyframes langFlip {
  0% {
    transform: rotateY(0deg) scale(1);
    opacity: 1;
  }
  45% {
    transform: rotateY(90deg) scale(0.85);
    opacity: 0.15;
  }
  100% {
    transform: rotateY(0deg) scale(1);
    opacity: 1;
  }
}

@keyframes themeIconIn {
  from {
    transform: rotate(-120deg) scale(0.35);
    opacity: 0;
  }
  to {
    transform: rotate(0deg) scale(1);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .resume--lang-out,
  .resume--lang-in {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }

  #toggle-lang.is-switching,
  #toggle-theme.is-switching svg {
    animation: none !important;
  }

  .skeleton {
    animation: none !important;
    background: var(--skeleton-base) !important;
  }
}

.resume__skeleton {
  pointer-events: none;
}

.skeleton {
  display: block;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--skeleton-base) 0%,
    var(--skeleton-shine) 45%,
    var(--skeleton-base) 90%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.35s ease-in-out infinite;
}

.skeleton--name {
  width: 38%;
  height: 34px;
  margin-bottom: 10px;
}

.skeleton--tagline {
  width: 72%;
  height: 14px;
  margin-bottom: 14px;
}

.skeleton--contacts {
  width: 88%;
  height: 14px;
  margin-bottom: 10px;
}

.skeleton--highlights {
  width: 64%;
  height: 13px;
}

.skeleton__divider {
  height: 2px;
  margin: 22px 0 28px;
  background: var(--line);
  border-radius: 1px;
}

.skeleton__section {
  margin-bottom: 28px;
}

.skeleton--h2 {
  width: 22%;
  height: 18px;
  margin-bottom: 14px;
}

.skeleton--line {
  width: 100%;
  height: 12px;
  margin-bottom: 8px;
}

.skeleton--line-md {
  width: 92%;
}

.skeleton--line-sm {
  width: 76%;
}

@keyframes skeletonShimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.resume__header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--ink);
}

.resume__name {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: 0.5px;
}

html:lang(en) .resume__name {
  letter-spacing: 0.02em;
}

html:lang(zh-CN) .resume__name,
html:lang(zh) .resume__name {
  letter-spacing: 0.5px;
}

.resume__tagline {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 12px;
}

.resume__contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--contact);
}

.resume__contacts a {
  color: var(--contact);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
}

.resume__contacts a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.resume__highlights {
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.7;
}

.resume__sep {
  margin: 0 10px;
  color: var(--line);
}

.resume__body h2 {
  font-size: 19px;
  font-weight: 700;
  margin: 36px 0 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.resume__body h2:first-child {
  margin-top: 8px;
}

.resume__body h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 22px 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.resume__entries {
  margin: 8px 0 0;
}

.resume__entry {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 4px;
  font-size: 15px;
}

.resume__entry-title {
  flex: 1;
  min-width: 0;
}

.resume__entry-meta,
.resume__body h3 .meta {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
}

.resume__body p {
  margin: 8px 0;
}

.resume__body ul {
  margin: 8px 0 14px;
  padding-left: 22px;
}

.resume__body li {
  margin: 4px 0;
}

.resume__body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.resume__body a:hover {
  border-bottom-color: var(--accent);
}

.resume__body strong {
  font-weight: 600;
  color: var(--strong);
}

.resume__body code {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.toolbar {
  max-width: var(--max-width);
  margin: 16px auto 0;
  padding: 0 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 26px;
  font-size: 13px;
  color: var(--muted);
}

.toolbar__left,
.toolbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar__actions {
  gap: 16px;
  margin-left: auto;
}

.toolbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  font: inherit;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease;
  white-space: nowrap;
}

.toolbar__btn:hover {
  color: var(--accent);
}

#toggle-theme,
#toggle-lang {
  align-items: center;
  justify-content: center;
  line-height: 0;
}

#toggle-lang {
  width: 1.75em;
  font-size: 13px;
  font-weight: 600;
}

#toggle-theme {
  width: 18px;
  height: 18px;
}

#export-pdf {
  min-width: 6.5rem;
  justify-content: flex-end;
}

#export-md {
  min-width: 8.5rem;
  justify-content: flex-end;
}

@media print {
  :root, :root[data-theme="dark"] {
    --bg: #ffffff;
    --paper: #ffffff;
    --ink: #1f2328;
    --muted: #6b7280;
    --line: #e5e7eb;
    --accent: #2563eb;
    --code-bg: #f6f8fa;
    --contact: #374151;
    --strong: #111827;
  }

  body {
    background: #fff;
  }

  .resume {
    margin: 0;
    padding: 0;
    box-shadow: none;
    max-width: 100%;
  }

  .toolbar {
    display: none;
  }

  @page {
    margin: 16mm 12mm;
  }
}

@media (max-width: 640px) {
  .toolbar {
    margin: 0 auto;
    padding: 12px 22px;
  }

  .toolbar__actions {
    display: none;
  }

  .resume {
    margin: 0;
    padding: 0 22px 40px;
    border-radius: 0;
    box-shadow: none;
  }

  .resume__name {
    font-size: 26px;
  }
}
