:root {
  color-scheme: light;
  --bg: #f5f2ea;
  --surface: #ebe7dc;
  --surface-2: #ded9cc;
  --ink: #151817;
  --muted: #5c625f;
  --accent: #1c5d99;
  --line: rgba(21, 24, 23, 0.2);
  --code-bg: #171b1f;
  --code-ink: #f3efe5;
  --focus: #b74319;
  --font-sans: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: clamp(1.1rem, 1.5vw, 1.25rem);
  --text-xl: clamp(1.8rem, 3vw, 3rem);
  --text-2xl: clamp(3rem, 7.3vw, 7.5rem);
  --lh-tight: 0.98;
  --lh-body: 1.8;
  --dur-1: 160ms;
  --dur-2: 280ms;
  --dur-3: 560ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 8%, rgba(28, 93, 153, 0.08), transparent 24rem),
    var(--bg);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(21, 24, 23, 0.13) 0.55px, transparent 0.55px);
  background-size: 6px 6px;
  opacity: 0.16;
  content: "";
  pointer-events: none;
}

a {
  color: inherit;
}

a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  padding: 8px 14px;
  color: var(--bg);
  background: var(--ink);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
.site-footer,
main {
  width: min(100% - 48px, 1440px);
  margin-inline: auto;
}

.site-header {
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand,
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--bg);
  background: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.site-header nav {
  display: flex;
  gap: clamp(20px, 4vw, 52px);
}

.site-header nav a,
.footer-links a {
  color: var(--muted);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: color var(--dur-1) var(--ease-out);
}

.site-header nav a:hover,
.footer-links a:hover {
  color: var(--accent);
}

.hero {
  display: grid;
  min-height: calc(100vh - 88px);
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.7fr);
  gap: clamp(48px, 7vw, 120px);
  align-items: center;
  padding-block: 80px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 28px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow span {
  color: var(--accent);
}

.eyebrow::after {
  width: 56px;
  height: 1px;
  background: currentColor;
  content: "";
}

h1,
h2,
h3,
p {
  text-wrap: pretty;
}

h1 {
  max-width: 9em;
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 750;
  letter-spacing: -0.075em;
  line-height: var(--lh-tight);
}

.hero-intro {
  max-width: 650px;
  margin: 38px 0 30px;
  color: var(--muted);
  font-size: var(--text-lg);
}

.text-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid currentColor;
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

.text-link span {
  transition: transform var(--dur-2) var(--ease-out);
}

.text-link:hover span {
  transform: translate(4px, 4px);
}

.code-window {
  position: relative;
  overflow: hidden;
  color: var(--code-ink);
  background: var(--code-bg);
  box-shadow: 22px 22px 0 var(--surface-2);
  animation: enter var(--dur-3) var(--ease-out) both;
}

.code-window::after {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  content: "";
  pointer-events: none;
}

.code-window-bar {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 7px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.code-window-bar span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
}

.code-window-bar b {
  margin-left: auto;
  color: #949da3;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
}

pre {
  overflow-x: auto;
  margin: 0;
  padding: clamp(28px, 4vw, 58px) clamp(22px, 3vw, 42px);
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 1.15vw, 0.95rem);
  line-height: 2;
}

.code-dim { color: #576168; }
.code-keyword { color: #7fb8e8; }
.code-string { color: #e2c68d; }
.code-boolean { color: #a3d3b2; }

.code-flow {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 18px 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #949da3;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.code-flow i {
  position: relative;
  height: 1px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.22);
}

.code-flow i::after {
  position: absolute;
  top: 0;
  width: 34%;
  height: 100%;
  background: #7fb8e8;
  content: "";
  animation: flow 2.8s linear infinite;
}

.topics,
.about {
  border-top: 1px solid var(--line);
  padding-block: clamp(80px, 10vw, 150px);
}

.section-heading {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-bottom: 58px;
}

.section-heading .eyebrow {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.section-heading h2,
.about h2,
.legal-page h1 {
  margin: 0;
  font-size: var(--text-xl);
  letter-spacing: -0.045em;
  line-height: 1.12;
}

.section-heading > p:last-child,
.about-grid p,
.legal-page p {
  max-width: 660px;
  margin: 0;
  color: var(--muted);
}

.topic-list {
  border-top: 1px solid var(--line);
}

.topic-list article {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
  padding: 32px 8px;
  border-bottom: 1px solid var(--line);
  transition:
    padding var(--dur-2) var(--ease-out),
    background var(--dur-2) var(--ease-out);
}

.topic-list article:hover {
  padding-inline: 20px;
  background: rgba(255, 255, 255, 0.32);
}

.topic-index,
.topic-tag {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.topic-list h3 {
  margin: 0 0 8px;
  font-size: var(--text-lg);
}

.topic-list p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
}

.topic-tag {
  color: var(--muted);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}

.about-grid p + p {
  margin-top: 24px;
}

.legal-page {
  min-height: calc(100vh - 88px);
  max-width: 900px;
  padding-block: clamp(72px, 9vw, 130px);
}

.legal-page > .eyebrow {
  margin-bottom: 24px;
}

.legal-page h1 {
  max-width: none;
  font-size: clamp(2.8rem, 7vw, 6rem);
}

.legal-lead {
  margin: 24px 0 72px !important;
  font-size: var(--text-lg);
}

.legal-page section {
  padding: 38px 0;
  border-top: 1px solid var(--line);
}

.legal-page section h2 {
  margin: 0 0 14px;
  font-size: var(--text-lg);
}

.site-footer {
  display: flex;
  min-height: 160px;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 18px 28px;
}

@keyframes enter {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes flow {
  from { transform: translateX(-100%); }
  to { transform: translateX(400%); }
}

@media (max-width: 900px) {
  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .code-window {
    max-width: 680px;
  }

  .section-heading,
  .about-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    gap: 20px;
  }
}

@media (max-width: 620px) {
  .site-header,
  .site-footer,
  main {
    width: min(100% - 32px, 1440px);
  }

  .site-header {
    min-height: 72px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .site-header nav a:first-child {
    display: none;
  }

  .hero {
    gap: 56px;
    padding-block: 64px 88px;
  }

  h1 {
    font-size: clamp(2.75rem, 14vw, 4.5rem);
  }

  .code-window {
    box-shadow: 10px 10px 0 var(--surface-2);
  }

  .topic-list article {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 14px;
  }

  .topic-tag {
    display: none;
  }

  .site-footer {
    min-height: 190px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
  }

  .footer-links {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
