:root {
  --bg: #fff;
  --surface: #f7f9fc;
  --ink: #1a2233;
  --muted: #56607a;
  --line: #e2e8f2;
  --brand: #4f46e5;
  --accent: #06b6d4;
  --tint: #eef0ff;
  --shadow: 0 1px 3px #1018280f, 0 10px 30px #1018280d;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gradient: linear-gradient(135deg, var(--brand), var(--accent));
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1320;
  --surface: #161d2e;
  --ink: #e7ecf5;
  --muted: #9aa6c0;
  --line: #27324a;
  --brand: #818cf8;
  --accent: #22d3ee;
  --tint: #1b2340;
  --shadow: 0 1px 3px #0005, 0 10px 30px #0006;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 65px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.75 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  transition: background .3s, color .3s;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.wrap { max-width: 1080px; padding-inline: 22px; margin-inline: auto; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(160%) blur(10px);
}
.header-inner { display: flex; align-items: center; gap: 18px; padding-block: 12px; }
.logo { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 18px; font-weight: 800; }
.logo::before { content: ""; width: 12px; height: 12px; border-radius: 4px; background: var(--gradient); }
.header-inner nav { margin-left: auto; display: flex; gap: 18px; }
.header-inner nav a { color: var(--muted); font-size: 14.5px; font-weight: 600; }
.header-inner nav a:hover { color: var(--brand); text-decoration: none; }
.theme, .close {
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}
.hero {
  padding: 90px 0 70px;
  background:
    radial-gradient(900px 400px at 80% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent),
    radial-gradient(700px 360px at 0% 0%, color-mix(in srgb, var(--brand) 16%, transparent), transparent);
}
.eyebrow, .date { font: 13px/1.75 var(--mono); color: var(--brand); }
.hero .eyebrow { letter-spacing: .08em; }
.hero h1 { margin: 14px 0 10px; font-size: clamp(34px, 6vw, 56px); font-weight: 850; line-height: 1.1; letter-spacing: -.02em; }
.gradient-text { background: var(--gradient); background-clip: text; color: transparent; }
.intro { max-width: 680px; margin: 0 0 26px; color: var(--muted); font-size: 19px; }
.actions, .stats, .skills, .socials, .filters { display: flex; flex-wrap: wrap; }
.actions { gap: 12px; }
.button { display: inline-block; padding: 12px 22px; border: 1px solid transparent; border-radius: 11px; font-size: 15px; font-weight: 700; }
.primary { background: var(--gradient); color: white; }
.secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.stats { margin-top: 40px; gap: 30px; }
.stats b { display: block; font-size: 26px; font-weight: 850; }
.stats span { font-size: 13.5px; color: var(--muted); }
.section { padding: 64px 0; border-bottom: 1px solid var(--line); }
.section-heading { margin-bottom: 30px; }
.section-heading h2 { margin: 6px 0 8px; font-size: 28px; font-weight: 850; }
.section-heading p { max-width: 680px; margin: 0; color: var(--muted); }
.about-grid, .contact-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 30px; }
.bio p { margin: 0 0 14px; }
.skills { gap: 8px; margin-top: 14px; }
.pill { padding: 6px 12px; border-radius: 999px; background: var(--tint); color: var(--brand); font-size: 13px; font-weight: 600; }
.panel { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.panel h3 { margin-top: 0; }
.profile p { margin: 6px 0; }
.timeline { margin-left: 14px; padding-left: 28px; border-left: 2px solid var(--line); }
.milestone { position: relative; margin-bottom: 28px; }
.milestone::before { content: ""; position: absolute; left: -37px; top: 4px; width: 20px; height: 20px; border: 3px solid var(--bg); border-radius: 50%; background: var(--brand); }
.milestone h3 { margin: 2px 0; font-size: 17px; }
.milestone p { margin: 0; color: var(--muted); font-size: 14.5px; }
.milestone p + p { margin-top: 6px; }
.filters { gap: 4px; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.filters button { padding: 7px 14px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.filters button:hover { background: var(--surface); color: var(--ink); }
.filters [aria-pressed="true"] { background: var(--ink); color: var(--bg); }
[data-theme="dark"] .filters [aria-pressed="true"] { background: var(--brand); color: white; }
.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 14px; }
.project {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 284px;
  padding: 26px 22px 20px;
  box-shadow: inset -1px -1px 0 var(--line);
}
.project.featured { background: linear-gradient(165deg, var(--tint), var(--bg) 52%); }
.project:hover, .project:focus-within { background: var(--surface); }
.project::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: var(--gradient); transform-origin: left; transform: scaleX(0); transition: transform .35s; }
.project:is(:hover, :focus-within, .featured)::before { transform: scaleX(1); }
.project-top, .project-footer, .metric { display: flex; gap: 10px; }
.project-top { align-items: flex-start; margin-bottom: 18px; }
.project-number { color: var(--brand); font: 800 30px/1 var(--mono); letter-spacing: -.06em; }
.project-category { display: block; margin-top: 4px; color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; }
.featured-label { display: inline-block; padding: 1px 7px; border-radius: 4px; background: var(--brand); color: white; font-size: 10px; font-weight: 700; }
.project-icon { margin-left: auto; color: var(--brand); opacity: .55; font-size: 24px; line-height: 1.2; }
.project h3 { margin: 0 0 8px; font-size: 19px; font-weight: 800; line-height: 1.35; }
.project:hover h3 { color: var(--brand); }
.project p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.metric { flex-wrap: wrap; align-items: baseline; margin-top: 16px; color: var(--muted); font-size: 11.5px; }
.metric b { color: var(--ink); font: 800 23px/1 var(--mono); letter-spacing: -.04em; }
.featured .metric b { color: var(--brand); }
.project-footer { justify-content: space-between; align-items: center; margin-top: auto; padding-top: 18px; }
.project-meta { color: var(--muted); font: 11px/1.5 var(--mono); }
.card-link { border: 0; padding: 0; background: transparent; color: var(--brand); font-size: 12px; font-weight: 700; white-space: nowrap; }
.card-link::after { content: ""; position: absolute; inset: 0; }
.post { position: relative; display: flex; gap: 18px; align-items: flex-start; padding: 18px 10px; border-bottom: 1px dashed var(--line); border-radius: 10px; }
.post:last-child { border-bottom: none; }
.post:hover, .post:focus-within { background: var(--surface); }
.post .date { flex: 0 0 96px; padding-top: 3px; color: var(--muted); }
.post h3 { margin: 0 0 4px; font-size: 18px; }
.post:hover h3 { color: var(--brand); }
.post p { margin: 0 0 6px; color: var(--muted); font-size: 14.5px; }
.post .card-link { margin-top: 8px; font-size: 13px; }
.tags { color: var(--brand); font: 12.5px/1.75 var(--mono); }
.contact-grid { grid-template-columns: repeat(2, 1fr); gap: 26px; }
.contact-grid:has(form[hidden]) { grid-template-columns: 1fr; }
.contact-info p { margin: 8px 0; overflow-wrap: anywhere; }
.contact-note, .form-status { color: var(--muted); font-size: 14px; }
.form-status:empty { display: none; }
.socials { gap: 10px; margin-top: 16px; }
.socials a { padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); font-size: 14px; font-weight: 600; }
.socials a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
#contact-form label { display: block; margin: 12px 0 5px; font-size: 13.5px; font-weight: 600; }
#contact-form :is(input, textarea, select) { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit; font-size: 14.5px; }
#contact-form textarea { min-height: 110px; resize: vertical; }
.send { width: 100%; margin-top: 14px; }
footer { padding-block: 40px; text-align: center; color: var(--muted); font-size: 13.5px; }
.quick-links { position: fixed; right: 14px; top: 50%; z-index: 20; transform: translateY(-50%); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.quick-title { padding-right: 4px; color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.quick-item { display: flex; align-items: center; gap: 10px; max-width: 46px; padding: 9px 11px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap; transition: max-width .25s, color .2s; }
.quick-item:is(:hover, :focus-visible) { max-width: 230px; border-color: var(--brand); color: var(--brand); text-decoration: none; }
.quick-icon { flex: none; font-size: 17px; }
.quick-text { opacity: 0; }
.quick-item:is(:hover, :focus-visible) .quick-text { opacity: 1; }
.modal { width: min(620px, calc(100% - 40px)); max-height: 86vh; padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); color: var(--ink); box-shadow: 0 20px 60px #0006; }
.modal[open] { animation: pop .2s ease; }
.modal::backdrop { background: #0a0f1c8c; backdrop-filter: blur(4px); }
#evidence::backdrop { background: #0a0f1c66; backdrop-filter: none; }
.modal-heading { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-heading h3 { margin: 0; font-size: 20px; }
.modal-heading form { margin-left: auto; flex: none; }
.modal-icon { display: grid; place-items: center; flex: 0 0 42px; height: 42px; border-radius: 12px; background: var(--tint); color: var(--brand); font: 800 15px/1 var(--mono); }
.close { width: 34px; height: 34px; }
.modal-body { padding: 18px 22px 24px; }
.modal-body h4 { margin: 18px 0 6px; color: var(--brand); font-size: 14px; }
.modal-body h4:first-child { margin-top: 0; }
.modal-body p { margin: 0; color: var(--muted); font-size: 14.5px; white-space: pre-line; }
.article h4 { padding-left: 10px; border-left: 3px solid var(--brand); color: var(--ink); font-size: 15.5px; }
.article p + p, .modal-body img + p { margin-top: 12px; }
.evidence-button { padding: 9px 14px; border: 1px solid var(--brand); border-radius: 10px; background: var(--tint); color: var(--brand); font-size: 13px; font-weight: 700; }
.evidence-button:hover { background: var(--brand); color: white; }
.example-preview { display: grid; gap: 12px; padding: 22px 22px 22px 42px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.example-preview + p { margin-top: 14px; }

@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
@media (max-width: 900px) {
  .project-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-links { top: auto; bottom: 14px; transform: none; flex-direction: row; }
  .quick-title, .quick-text { display: none; }
  .quick-item, .quick-item:is(:hover, :focus-visible) { width: 44px; height: 44px; justify-content: center; border-radius: 50%; }
  footer { padding-bottom: 66px; }
}
@media (max-width: 820px) { .about-grid, .contact-grid { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .header-inner nav { display: none; } }
@media (max-width: 600px) {
  .project-grid { grid-template-columns: 1fr; }
  .modal-body { padding: 16px; }
  .post .date { flex-basis: 63px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
