:root {
  color-scheme: dark;
  --bg: #101312;
  --surface: #1b211f;
  --surface-strong: #232b28;
  --text: #f0f2ec;
  --muted: #a1aaa3;
  --faint: #68736c;
  --line: rgba(235, 240, 232, 0.13);
  --line-strong: rgba(235, 240, 232, 0.25);
  --accent: #8fe7c5;
  --accent-deep: #18372d;
  --radius: 18px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f4ef;
  --surface: #e1e7e0;
  --surface-strong: #d1dbd1;
  --text: #17201b;
  --muted: #526158;
  --faint: #738078;
  --line: rgba(23, 32, 27, 0.14);
  --line-strong: rgba(23, 32, 27, 0.28);
  --accent: #176849;
  --accent-deep: #c6eadc;
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f2f4ef;
    --surface: #e1e7e0;
    --surface-strong: #d1dbd1;
    --text: #17201b;
    --muted: #526158;
    --faint: #738078;
    --line: rgba(23, 32, 27, 0.14);
    --line-strong: rgba(23, 32, 27, 0.28);
    --accent: #176849;
    --accent-deep: #c6eadc;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  transition: background-color 240ms ease, color 240ms ease;
}
a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; }
.shell { width: min(1160px, calc(100% - 48px)); margin: 0 auto; }

.site-header {
  width: min(1160px, calc(100% - 48px));
  height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand, .site-nav, .card-topline, .site-footer { display: flex; align-items: center; }
.brand { gap: 10px; font-size: 16px; letter-spacing: -0.03em; font-weight: 650; }
.brand-mark { width: 22px; height: 22px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; align-items: end; }
.brand-mark i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transform: skewY(-24deg); }
.brand-mark i:nth-child(2) { height: 72%; opacity: .75; }
.brand-mark i:nth-child(3) { height: 45%; opacity: .48; }
.site-nav { gap: 24px; font-size: 14px; color: var(--muted); }
.site-nav a { transition: color 180ms ease; }
.site-nav a:hover, .site-nav a:focus-visible { color: var(--text); }
.theme-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; background: transparent; cursor: pointer; font-size: 12px; color: var(--muted); transition: border-color 180ms ease, color 180ms ease; }
.theme-toggle:hover, .theme-toggle:focus-visible { color: var(--text); border-color: var(--line-strong); }
.theme-icon { color: var(--accent); font-size: 16px; line-height: 1; }

.eyebrow { margin: 0 0 16px; color: var(--accent); font: 600 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -0.06em; }

.projects { padding: 58px 0 96px; }
.category-section + .category-section { margin-top: 106px; }
.category-heading { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 22px; align-items: end; padding-top: 18px; margin-bottom: 24px; border-top: 1px solid var(--line); }
.category-heading .eyebrow { margin-bottom: 10px; }
.category-heading h1, .category-heading h2 { margin: 0; font-size: clamp(34px, 4vw, 52px); line-height: 1; font-weight: 500; }
.category-note { max-width: 240px; margin: 0 0 2px auto; color: var(--muted); font-size: 14px; }
.project-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }

.project-card { position: relative; min-height: 278px; overflow: hidden; display: flex; flex-direction: column; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: transform 260ms var(--ease), border-color 260ms ease, background-color 260ms ease; }
.project-card:hover, .project-card:focus-visible { transform: translateY(-5px); border-color: var(--line-strong); background: var(--surface-strong); }
.project-card-compact { grid-column: span 4; }
.project-card-feature { grid-column: span 8; min-height: 340px; background: var(--surface-strong); }
.project-card-feature .card-copy { flex: 1; }
.project-card-resume { background: linear-gradient(140deg, var(--surface) 15%, var(--accent-deep)); }
.project-card-upgrade { background: linear-gradient(140deg, var(--surface) 20%, rgba(49, 78, 66, .5)); }
.card-copy { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; }
.card-topline { justify-content: space-between; margin-bottom: 48px; }
.card-kind { margin-bottom: 12px; color: var(--accent); font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.project-card h3 { margin-bottom: 12px; font-size: clamp(28px, 3vw, 42px); line-height: 1; font-weight: 500; }
.project-card > p:not(.card-kind), .card-copy > p:not(.card-kind) { max-width: 270px; margin-bottom: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.project-card-feature .card-copy > p:not(.card-kind) { max-width: 560px; }
.card-link { margin-top: auto; padding-top: 30px; color: var(--text); font-size: 13px; }
.card-link span, .card-arrow { color: var(--accent); }
.project-glyph { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line-strong); border-radius: 12px; color: var(--accent); font: 600 14px ui-monospace, SFMono-Regular, Menlo, monospace; }
.glyph-record { font-size: 20px; }
.glyph-interview { font-size: 11px; }
.glyph-upgrade { font-size: 24px; font-family: inherit; }
.card-arrow { font-size: 20px; transition: transform 180ms var(--ease); }
.project-card:hover .card-arrow { transform: translate(3px, -3px); }
.project-card-record::after { position: absolute; right: 24px; bottom: 25px; width: 42%; height: 72px; content: ""; background: repeating-linear-gradient(90deg, transparent 0 7px, rgba(143,231,197,.2) 7px 9px, transparent 9px 13px); mask-image: linear-gradient(90deg, transparent, #000 30%, #000 72%, transparent); opacity: .65; }
.record-wave { position: absolute; right: 30px; bottom: 36px; display: flex; align-items: center; gap: 4px; height: 32px; }
.record-wave i { width: 3px; height: 10px; border-radius: 2px; background: var(--accent); opacity: .75; }
.record-wave i:nth-child(2), .record-wave i:nth-child(6) { height: 22px; }
.record-wave i:nth-child(3), .record-wave i:nth-child(5) { height: 30px; }
.record-wave i:nth-child(4) { height: 17px; }

.site-footer { justify-content: space-between; gap: 24px; min-height: 100px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; }
.footer-brand { color: var(--text); font-weight: 650; letter-spacing: -.03em; }
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 700ms var(--ease), transform 700ms var(--ease); }
[data-reveal].is-visible { opacity: 1; transform: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

@media (max-width: 800px) {
  .shell, .site-header { width: min(100% - 32px, 620px); }
  .site-header { height: 64px; }
  .projects { padding-top: 48px; }
  .category-heading { grid-template-columns: 1fr; gap: 6px; }
  .category-note { grid-column: 1; margin: 6px 0 0; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card-compact, .project-card-feature { grid-column: 1; }
  .project-card-feature { min-height: 360px; }
  .site-footer { flex-wrap: wrap; padding: 28px 0; }
}

@media (max-width: 560px) {
  .theme-label { display: none; }
  .category-section + .category-section { margin-top: 78px; }
  .category-note { margin: 6px 0 0; }
  .project-card-feature { min-height: 360px; }
  .site-footer { display: grid; gap: 8px; padding: 24px 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  [data-reveal] { opacity: 1; transform: none; }
}
