:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --ink: #09090b;
  --muted: #3f3f46;
  --faint: #52525b;
  --line: #e4e4e7;
  --accent: #1d4ed8;
  --accent-fill: #2563eb;
  --on-accent: #ffffff;
  --soft: #eff6ff;
  --grid: rgba(9, 9, 11, 0.045);
  --header: rgba(250, 250, 250, 0.88);
  --shadow: 0 16px 40px rgba(9, 9, 11, 0.06);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #09090b;
  --surface: #18181b;
  --ink: #fafafa;
  --muted: #d4d4d8;
  --faint: #a1a1aa;
  --line: #27272a;
  --accent: #93c5fd;
  --accent-fill: #2563eb;
  --on-accent: #ffffff;
  --soft: #172554;
  --grid: rgba(250, 250, 250, 0.045);
  --header: rgba(9, 9, 11, 0.88);
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px;
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.75;
}

main { flex: 1; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::selection { background: #2563eb; color: #fff; }

.skip {
  position: absolute;
  left: 16px;
  top: -40px;
  background: var(--accent-fill);
  color: #fff;
  padding: 8px 12px;
  z-index: 20;
}
.skip:focus { top: 12px; }

.wrap {
  width: min(1080px, calc(100% - 40px));
  margin-inline: auto;
}

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: var(--header);
  backdrop-filter: blur(16px);
}

.top-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-height: 44px;
}

.brand strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand small {
  display: block;
  color: var(--faint);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.mark {
  width: 32px;
  height: 32px;
  color: var(--accent);
  flex: none;
}

.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  min-height: 44px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  cursor: pointer;
}

.nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.nav a:hover { color: var(--ink); }

.switch {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--faint);
  font: inherit;
  font-size: 13px;
  min-height: 36px;
  min-width: 52px;
  padding: 0 12px;
  border-radius: 999px;
  cursor: pointer;
}

.switch button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

.hero { padding: 72px 0 28px; }

.kicker {
  margin: 0 0 14px;
  color: var(--accent);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 14em;
  font-size: clamp(40px, 6vw, 68px);
  line-height: 1.12;
  letter-spacing: -0.035em;
  font-weight: 600;
}

.lede {
  max-width: 40em;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  min-height: 44px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.btn-primary {
  background: var(--accent-fill);
  color: var(--on-accent);
}

.btn-primary:hover { background: #1d4ed8; }

.btn-ghost {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.btn-ghost:hover { border-color: var(--accent); }

.section { padding: 28px 0 10px; }

.section h2 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.section > .wrap > p.intro,
.prose p { color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 22px 20px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: border-color 180ms ease, transform 180ms ease;
}

a.card { cursor: pointer; }
a.card:hover { border-color: var(--accent); transform: translateY(-2px); }

.card .idx {
  color: var(--accent);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
}

.card h3 {
  margin: 10px 0 8px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.card p { margin: 0; color: var(--muted); }

.list {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.note {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 18px;
  align-items: start;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 180ms ease;
}

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

.note time {
  color: var(--faint);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
}

.note strong { display: block; color: var(--ink); font-size: 18px; letter-spacing: -0.02em; }
.note span { color: var(--muted); }

article.entry {
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

article.entry h2 {
  margin: 8px 0 12px;
  font-size: 28px;
  letter-spacing: -0.03em;
  line-height: 1.3;
}

article.entry p { margin: 0 0 14px; max-width: 42em; }

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
  padding: 0;
  list-style: none;
}

.toc a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
}

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

.meta-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.meta-table th,
.meta-table td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.meta-table tr:last-child th,
.meta-table tr:last-child td { border-bottom: 0; }

.prose { margin-top: 28px; max-width: 42em; }
.prose h2 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.meta-table th {
  width: 8.5em;
  color: var(--faint);
  font-weight: 500;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
}

.foot {
  margin-top: 48px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.foot-inner {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 28px 0;
}

.foot strong { font-size: 15px; }
.foot p { margin: 6px 0 0; color: var(--faint); font-size: 14px; }
.beian a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .card, .note { transition: none; }
  a.card:hover { transform: none; }
}

@media (max-width: 800px) {
  .grid, .note { grid-template-columns: 1fr; }
  .top-inner { flex-wrap: wrap; padding: 10px 0; }
  .nav { margin-left: 0; order: 3; width: 100%; }
  .foot-inner { flex-direction: column; align-items: start; }
  .hero { padding-top: 40px; }
  .wrap { width: min(1080px, calc(100% - 32px)); }
}

@media (max-width: 380px) {
  .switch button { min-width: 46px; padding: 0 8px; }
  h1 { font-size: 34px; }
}
