@font-face {
  font-family: Figtree;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/figtree-regular.ttf') format('truetype');
}
@font-face {
  font-family: Figtree;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/figtree-semibold.ttf') format('truetype');
}
@font-face {
  font-family: 'League Spartan';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/league-spartan-bold.ttf') format('truetype');
}

:root {
  color-scheme: light;
  --bg: #e8e8e3;
  --surface: #dcdcd6;
  --ink: #181715;
  --muted: #5f5e58;
  --accent: #bfb21a;
  --small: 0.875rem;
  --body: 1.0625rem;
  --lead: clamp(1.375rem, 3vw, 1.625rem);
  --head: clamp(1.75rem, 4vw, 2rem);
  --display: clamp(3.125rem, 8vw, 5.25rem);
  --ease: cubic-bezier(.16, 1, .3, 1);
  font-family: Figtree, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-synthesis: none;
  background: var(--bg);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 2rem; }
body { margin: 0; font-size: var(--body); line-height: 1.8; }
::selection { background: var(--accent); color: var(--ink); }
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: .25em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid currentColor; outline-offset: 5px; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.3; font-weight: 600; text-wrap: balance; }
h1, h2 { letter-spacing: -.035em; }
h2 { font-size: var(--head); }
h3 { font-size: var(--lead); }
p { text-wrap: pretty; }
img { display: block; max-width: 100%; height: auto; }
.frame { width: min(760px, calc(100% - 48px)); margin-inline: auto; }
.meta { color: var(--muted); font-size: var(--small); line-height: 1.65; }
.skip-link { position: fixed; top: 16px; left: 16px; z-index: 10; padding: 12px 20px; background: var(--ink); color: var(--bg); transform: translateY(-200%); }
.skip-link:focus { transform: translateY(0); }

.site-header { display: flex; align-items: center; justify-content: space-between; padding-top: 28px; gap: 24px; }
.wordmark { font-family: 'League Spartan', sans-serif; font-size: 2rem; line-height: 1; text-decoration: none; padding: 10px 0; }
.site-header nav { display: flex; align-items: center; gap: 28px; }
.site-header nav a { text-decoration: none; font-size: var(--small); padding: 10px 0; }
.site-header nav a:hover { text-decoration: underline; }
.site-header .language { margin-left: 12px; font-weight: 600; }

.hero { padding-block: 86px 72px; }
.hero h1 { font-size: var(--display); font-family: 'League Spartan', 'PingFang SC', 'Microsoft YaHei', sans-serif; font-weight: 700; line-height: 1.12; letter-spacing: -.045em; overflow: hidden; }
.hero h1 span { display: inline-block; animation: arrive .85s var(--ease) both; }
.alternate-name { font-size: var(--body); color: var(--muted); margin-top: 8px; }
.lead { font-size: var(--lead); margin-top: 32px; line-height: 1.5; font-weight: 600; }
.intro { max-width: 590px; margin-top: 14px; }
.hero-links { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; margin-top: 28px; }
.button { display: inline-flex; align-items: center; justify-content: space-between; gap: 28px; padding: 11px 18px; background: var(--accent); text-decoration: none; font-weight: 600; transition: transform 180ms var(--ease), background-color 180ms ease; }
.button:hover { background: #d0c331; transform: translateY(-2px); }
.button:active { transform: translateY(0); }

.experiment { background: var(--ink); color: var(--bg); padding: 32px; }
.experiment-intro { display: grid; grid-template-columns: 1fr 1.25fr; gap: 36px; align-items: start; }
.experiment h2 { font-size: var(--lead); letter-spacing: -.02em; }
.experiment-intro p { font-size: var(--small); line-height: 1.7; max-width: 360px; }
.walk-chart { width: 100%; display: block; margin-block: 8px; overflow: visible; }
.walk { fill: none; stroke: #aaa99e; stroke-width: 1.15; opacity: .3; transition: opacity .3s ease; }
.walk.winner { stroke: var(--accent); stroke-width: 2.8; opacity: 1; }
.winner-only .walk:not(.winner) { opacity: 0; }
.toy-controls { display: flex; gap: 16px; align-items: center; justify-content: space-between; }
.toy-controls button { background: transparent; border: 0; color: inherit; padding: 9px 12px; font-size: var(--small); min-height: 44px; transition: background-color .2s ease; }
.view-controls { display: flex; background: #2b2a26; }
.toy-controls button[aria-pressed='true'] { background: var(--bg); color: var(--ink); }
.toy-controls button:hover { background: #46453b; color: var(--bg); }
.toy-controls button[data-again] { padding-right: 0; display: flex; align-items: center; gap: 10px; }
.experiment-status { margin-top: 18px; min-height: 48px; font-size: var(--small); line-height: 1.65; }
.experiment-note { font-size: var(--small); line-height: 1.65; color: #b2b1a8; }

.section { margin-top: 120px; }
.section > h2 { margin-bottom: 26px; }
.section > p + p { margin-top: 20px; }
.project { margin-top: 56px; }
.project + .project { margin-top: 76px; }
.project-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 24px; }
.project-heading p { font-size: var(--small); color: var(--muted); flex-shrink: 0; }
.project-media img { width: 100%; }
.project-media > a { display: block; }
figcaption { color: var(--muted); font-size: var(--small); margin-top: 10px; line-height: 1.6; }
.project > p { margin-top: 24px; }
.project > .meta { margin-top: 12px; }
.project-links { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 18px; }
.retrieval-example { padding: 32px; background: var(--surface); }
.query { font-size: var(--lead); line-height: 1.5; max-width: 540px; }
.retrieval-example > .meta { margin-top: 12px; }
.retrieval-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; margin-top: 28px; }
.retrieval-comparison dt { font-size: var(--small); color: var(--muted); }
.retrieval-comparison dd { margin-top: 8px; line-height: 1.6; }
.retrieval-comparison dd > span { display: block; margin-top: 8px; }
.retrieval-example figcaption { margin-top: 24px; }
.demo { margin-top: 20px; }
.demo summary { cursor: pointer; padding-block: 8px; width: fit-content; text-decoration: underline; text-underline-offset: .25em; }
.demo p { margin: 10px 0 20px; }
.demo img { width: 100%; background: var(--surface); }
.demo img:not([src]) { display: none; }
.note-list { margin-top: 32px; display: grid; gap: 30px; }
.note-link { display: flex; justify-content: space-between; gap: 32px; text-decoration: none; padding-block: 6px; }
.note-link h3 { font-size: var(--lead); }
.note-link p { margin-top: 8px; font-size: var(--body); }
.note-link > .meta { flex-shrink: 0; padding-top: 4px; }
.note-link:hover h3 { text-decoration: underline; text-underline-offset: .2em; }
.about > p { max-width: 650px; }
.about > a { display: inline-block; margin-top: 18px; }
.games { margin-top: 52px; background: var(--surface); padding: 32px; }
.games > p { margin-top: 18px; }
.games dl { margin-top: 26px; display: grid; gap: 16px; }
.games dl > div { display: flex; align-items: baseline; justify-content: space-between; gap: 28px; }
.games dd { font-weight: 600; }
.resume { margin-top: 52px; }
.resume > p { margin-top: 12px; }
.resume-links { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 24px; }
.resume-links a { display: flex; align-items: center; gap: 32px; background: var(--surface); padding: 12px 18px; text-decoration: none; }
.resume-links a:hover { background: var(--accent); }
.contact { margin-bottom: 100px; }
.contact h2 { max-width: 600px; }
.contact-links { display: flex; gap: 30px; margin-top: 24px; }
.site-footer { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 30px; font-size: var(--small); color: var(--muted); }
.site-footer a { color: var(--ink); }

.article { padding-top: 80px; padding-bottom: 110px; }
.back { display: inline-block; margin-bottom: 36px; font-size: var(--small); }
.article-header h1 { font-size: clamp(2rem, 5vw, 3rem); max-width: 720px; }
.article-summary { font-size: var(--lead); margin-top: 24px; }
.article-header .meta { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 24px; }
.prose { max-width: 650px; margin-top: 56px; }
.prose h2 { font-size: var(--lead); margin-top: 48px; margin-bottom: 20px; }
.prose p { margin-bottom: 24px; line-height: 1.9; }
.prose ol { padding-left: 1.5em; margin-block: 0 24px; }
.prose li + li { margin-top: 12px; }
.article > .back:last-child { margin-top: 40px; margin-bottom: 0; }
.not-found h1 { margin-bottom: 24px; font-size: var(--head); }
.not-found p + p { margin-top: 16px; }

@keyframes arrive { from { transform: translateY(110%); } to { transform: translateY(0); } }

@media (max-width: 600px) {
  .frame { width: calc(100% - 40px); }
  .site-header { gap: 16px; padding-top: 18px; }
  .site-header nav { gap: 18px; }
  .site-header .language { margin-left: 0; }
  .hero { padding-block: 58px 48px; }
  .hero h1 { letter-spacing: -.04em; }
  .lead { margin-top: 28px; }
  .intro { margin-top: 12px; }
  .hero-links { align-items: flex-start; gap: 18px; flex-wrap: wrap; }
  .hero-links > a:not(.button) { padding-block: 11px; }
  .button { gap: 20px; }
  .experiment { padding: 24px 20px; }
  .experiment-intro { grid-template-columns: 1fr; gap: 12px; }
  .walk-chart { margin-block: 22px; }
  .toy-controls { gap: 8px; }
  .toy-controls button { padding: 9px 10px; }
  .experiment-status { margin-top: 20px; min-height: 46px; }
  .section { margin-top: 88px; }
  .project { margin-top: 36px; }
  .project + .project { margin-top: 64px; }
  .project-heading { display: block; margin-bottom: 20px; }
  .project-heading p { margin-top: 8px; }
  .retrieval-example { padding: 28px 20px; }
  .retrieval-comparison { grid-template-columns: 1fr; gap: 24px; }
  .note-link { flex-direction: column; gap: 8px; }
  .note-link > .meta { padding-top: 0; }
  .games { padding: 24px 20px; }
  .games dl > div { gap: 20px; }
  .resume-links { flex-direction: column; align-items: stretch; gap: 12px; }
  .resume-links a { justify-content: space-between; }
  .contact { margin-bottom: 80px; }
  .site-footer { flex-direction: column; gap: 12px; padding-bottom: 24px; }
  .article { padding-top: 52px; padding-bottom: 64px; }
  .prose { margin-top: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
