/* ============================================================
   Yang · Personal Portfolio
   个人简历页 —— 纯 HTML/CSS + 少量 JS
   深/浅双主题、中/英双语切换、零外部依赖
   ============================================================ */

/* ---------- 主题 ---------- */
:root {
  color-scheme: dark;

  --bg: #0a0b0d;
  --surface: #121418;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #e9ecf2;
  --text-2: #9aa1b0;
  --text-3: #6e7686;

  --accent: #34d399;
  --accent-ink: #6ee7b7;
  --accent-soft: rgba(52, 211, 153, 0.12);
  --accent-line: rgba(52, 211, 153, 0.28);

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);

  --font-sans: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;

  --shell: 1040px;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: rgba(10, 15, 30, 0.09);
  --border-strong: rgba(10, 15, 30, 0.18);

  --text: #0f1319;
  --text-2: #545d6e;
  --text-3: #868ea0;

  --accent: #10b981;
  --accent-ink: #047857;
  --accent-soft: rgba(16, 185, 129, 0.11);
  --accent-line: rgba(16, 185, 129, 0.32);

  --shadow: 0 1px 2px rgba(10, 15, 30, 0.06), 0 10px 24px -18px rgba(10, 15, 30, 0.25);
}

/* ---------- 基础 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
}

/* ---------- 背景：缓慢漂移的光斑 + 细噪点 ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.aurora span {
  position: absolute;
  width: 52vw;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.34;
}

.aurora__a {
  top: -18vw;
  left: -8vw;
  background: radial-gradient(circle, #10b981 0%, transparent 68%);
  animation: drift-a 26s ease-in-out infinite;
}

.aurora__b {
  top: -22vw;
  right: -10vw;
  background: radial-gradient(circle, #6366f1 0%, transparent 68%);
  opacity: 0.26;
  animation: drift-b 32s ease-in-out infinite;
}

.aurora__c {
  top: 40vh;
  left: 44vw;
  background: radial-gradient(circle, #22d3ee 0%, transparent 68%);
  opacity: 0.16;
  animation: drift-c 38s ease-in-out infinite;
}

:root[data-theme="light"] .aurora span { opacity: 0.26; }
:root[data-theme="light"] .aurora__b { opacity: 0.2; }
:root[data-theme="light"] .aurora__c { opacity: 0.14; }

.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 140px 140px;
}
:root[data-theme="light"] .grain { opacity: 0.045; mix-blend-mode: multiply; }

@keyframes drift-a { 50% { transform: translate3d(6vw, 5vw, 0) scale(1.1); } }
@keyframes drift-b { 50% { transform: translate3d(-5vw, 7vw, 0) scale(1.06); } }
@keyframes drift-c { 50% { transform: translate3d(-8vw, -6vw, 0) scale(0.92); } }

h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }
img, svg { display: block; }

.shell {
  width: min(var(--shell), 100% - 48px);
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: 50%;
  top: 10px;
  translate: -50% -200%;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #04120c;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  z-index: 100;
  transition: translate 0.22s var(--ease);
}
.skip:focus-visible { translate: -50% 0; }

:where(a, button):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
}

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text) 20%, transparent);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}

/* ---------- 语言切换 ---------- */
html:not([lang="en"]) .l-en { display: none; }
html[lang="en"] .l-zh { display: none; }

.mono { font-family: var(--font-mono); }

/* ---------- 顶栏 ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--border);
  /* 刘海屏 / 横屏 PWA 时给状态栏让位（普通浏览时为 0） */
  padding-top: env(safe-area-inset-top);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .bar { background: var(--bg); }
}

.bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 62px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  border-radius: 8px;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 40%, #6366f1));
  color: #04120c;
  font-size: 13px;
  font-weight: 700;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand__name { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.brand__sub { font-size: 10.5px; color: var(--text-3); letter-spacing: 0.02em; }

.nav {
  display: flex;
  gap: 26px;
}
.nav a {
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  padding: 3px 0;
  transition: color 0.2s var(--ease);
}
.nav a:hover { color: var(--text); }

.tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  border: 1px solid var(--border);
}
.seg__btn {
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.18s var(--ease), background-color 0.18s var(--ease);
}
.seg__btn:hover { color: var(--text-2); }
.seg__btn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.18s var(--ease), background-color 0.18s var(--ease);
}
.icon-btn:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 6%, transparent);
}
.icon-btn__sun { display: none; }
.icon-btn__moon { display: block; }
:root[data-theme="light"] .icon-btn__sun { display: block; }
:root[data-theme="light"] .icon-btn__moon { display: none; }

/* ---------- 首屏 ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(290px, 0.9fr);
  align-items: start;
  gap: clamp(28px, 5vw, 64px);
  padding: clamp(44px, 7vw, 78px) 0 clamp(36px, 5vw, 56px);
}

/* 头像 + 名字并排，构成一个紧凑的人物头卡 */
.hero__top {
  display: flex;
  align-items: center;
  gap: 22px;
}

.hero__id {
  min-width: 0;
}

.avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  box-shadow: 0 10px 26px -14px rgba(0, 0, 0, 0.55);
  color: var(--accent-ink);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* 照片盖在字母上面；照片加载失败时自动退回字母 */
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 20%;
}

.hero__name {
  margin-top: 0;
  font-size: clamp(40px, 6.5vw, 62px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.04;
}

.hero__role {
  margin-top: 6px;
  font-size: clamp(15px, 1.8vw, 17px);
  color: var(--text-2);
  letter-spacing: 0.005em;
}

.hero__bio {
  margin-top: 22px;
  max-width: 44ch;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text-2);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12.5px;
  font-weight: 550;
}

.status__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent);
  animation: pulse 2.6s ease-out infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.info { padding: 22px; }

.info__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.info__title {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.bin {
  flex: 0 1 auto;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--text-3);
  opacity: 0.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.facts { display: grid; }

.fact {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.fact:last-child { border-bottom: 0; padding-bottom: 2px; }

.fact dt { font-size: 12.5px; color: var(--text-3); }
.fact dd {
  font-size: 13.2px;
  color: var(--text);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.fact a {
  color: var(--accent-ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.18s var(--ease);
}
.fact a:hover { border-bottom-color: currentColor; }

/* ---------- 分区 ---------- */
.sec {
  padding: 22px 0 clamp(34px, 4vw, 46px);
  scroll-margin-top: 84px;
}

.sec__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 13px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--border);
}

.sec__title {
  display: flex;
  align-items: baseline;
  gap: 11px;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
}

.sec__num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0;
  color: var(--accent-ink);
  opacity: 0.75;
}

/* ---------- 时间线 ---------- */
.timeline { display: grid; }

.entry {
  position: relative;
  padding-left: 30px;
  padding-bottom: 28px;
}
.entry:last-child { padding-bottom: 0; }

.entry::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 9px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.entry:last-child::before { display: none; }

.entry::after {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--bg);
}

.entry__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 18px;
  flex-wrap: wrap;
}

.entry__title {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.012em;
}

.entry__date {
  font-family: var(--font-mono);
  font-size: 11.8px;
  color: var(--text-3);
  white-space: nowrap;
}

.entry__sub {
  margin-top: 3px;
  font-size: 13.2px;
  color: var(--accent-ink);
}

.entry__list {
  margin-top: 12px;
  display: grid;
  gap: 5px;
  font-size: 13.8px;
  color: var(--text-2);
}

.entry__list li {
  position: relative;
  padding-left: 14px;
}
.entry__list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.72em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-3);
  opacity: 0.7;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  color: var(--text-2);
}

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

.skill { padding: 20px; }

.skill__name {
  font-size: 13.5px;
  font-weight: 650;
  margin-bottom: 16px;
  letter-spacing: -0.005em;
}

.bar + .bar { margin-top: 13px; }

.bar__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  font-size: 12.5px;
  color: var(--text-2);
}

.bar__val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
}

.bar__track {
  height: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  overflow: hidden;
}

.bar__fill {
  height: 100%;
  width: var(--w);
  border-radius: inherit;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent) 78%, transparent),
    var(--accent));
  animation: bar-in 1s var(--ease) backwards;
}

@keyframes bar-in {
  from { width: 0; }
}

/* ---------- 页脚 ---------- */
.foot {
  margin-top: 18px;
  padding: 24px 0 calc(40px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}

.foot__line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-3);
}

.foot__bin {
  margin-top: 9px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--text-3);
  opacity: 0.4;
  word-break: break-all;
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  /* 单列后信息卡不再需要撑满整行 */
  .info { max-width: 520px; }
  /* 英文导航更宽，900px 以下收起，避免和品牌、开关挤在一起 */
  .nav { display: none; }
}

@media (max-width: 780px) {
  .shell { width: calc(100% - 36px); }
  .bar__inner { height: 58px; }
  .bin { display: none; }
  .hero { padding-top: 40px; }
  .entry__list { font-size: 13.5px; }

  /* 大面积模糊在手机上很吃 GPU，光斑收小并去掉第三团 */
  .aurora span { filter: blur(64px); opacity: 0.26; }
  .aurora__c { display: none; }
  .grain { opacity: 0.025; }
}

@media (max-width: 520px) {
  .shell { width: calc(100% - 32px); }
  .brand__sub { display: none; }
  .brand__name { font-size: 13.5px; }
  .hero__name { font-size: 38px; }
  .hero__bio { font-size: 14px; }
  .hero__top { gap: 16px; }
  .avatar { width: 72px; height: 72px; font-size: 27px; }
  .fact { grid-template-columns: 72px minmax(0, 1fr); }
  .entry { padding-left: 26px; }
  .entry__title { font-size: 16px; }
  .skills { grid-template-columns: 1fr; }
  .info, .skill { padding: 17px; }
  .sec__title { font-size: 12px; letter-spacing: 0.06em; }

  /* 触摸目标放大一点 */
  .seg__btn { padding: 6px 9px; font-size: 12px; }
  .icon-btn { width: 36px; height: 36px; }
}

/* ---------- 减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .bar__fill { width: var(--w); }
}

/* ---------- 打印 ---------- */
@media print {
  :root { color-scheme: light; }
  body { background: #fff; color: #000; }
  .bar, .tools, .seg, .skip, .bin, .foot__bin, .status__dot { display: none !important; }
  .aurora, .grain { display: none !important; }
  .shell { width: 100%; }
  .card { border-color: #ddd; box-shadow: none; }
  .hero { padding: 0 0 18px; }
  .sec { padding: 14px 0; break-inside: avoid; }
  .entry { break-inside: avoid; }
  .bar__fill { animation: none; }
  a { text-decoration: none; color: #000; }
}
