/* Tokens and rules match honghao.me (agate/agate.github.io, src/styles/global.css). */
:root {
  --ground: #fafafa;
  --ink: #171717;
  --soft: #3a3a3a;
  --muted: #8f8f8f;
  --faint: #bdbdbd;
  --rule: #ebebeb;

  --vermillion: #d55e00;
  --amber: #e69f00;
  --green: #009e73;

  --en-head: 'Instrument Serif', Georgia, serif;
  --en-body: 'Inter', system-ui, sans-serif;
  --zh-head: 'LXGW WenKai', 'Kaiti SC', 'STKaiti', serif;
  --zh-body: 'Inter', 'LXGW WenKai', 'Kaiti SC', 'STKaiti', serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  --head: var(--en-head);
  --body: var(--en-body);
}

html[data-lang='zh'] {
  --head: var(--zh-head);
  --body: var(--zh-body);
}

/* Every bilingual string is rendered twice; only the active language shows. */
html[data-lang='en'] [lang='zh'],
html[data-lang='zh'] [lang='en'] {
  display: none !important;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-color: var(--faint);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: var(--ink);
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
}

img {
  max-width: 100%;
  height: auto;
}

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 48px;
}

.mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.tag {
  display: inline-block;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0 8px;
  line-height: 18px;
  color: var(--ink);
  vertical-align: middle;
}

/* Nav */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--rule);
  padding: 20px 0 12px;
  margin-bottom: 56px;
}

nav a {
  text-decoration: none;
}

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

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

.links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.toggle {
  display: inline-flex;
  border: 1px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
}

.toggle button {
  all: unset;
  cursor: pointer;
  padding: 2px 10px;
  font: 11px var(--mono);
  color: var(--ink);
}

.toggle button[aria-pressed='true'] {
  background: var(--ink);
  color: var(--ground);
}

.toggle button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -4px;
}

/* Hero */
.hero {
  margin-bottom: 48px;
}

h1 {
  font-family: var(--head);
  font-weight: 400;
  font-size: 54px;
  line-height: 1.08;
  margin: 10px 0 18px;
}

html[data-lang='zh'] h1 {
  font-size: 40px;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

h1 em {
  font-style: italic;
}

.lede {
  font-size: 18px;
  color: var(--soft);
  max-width: 600px;
  line-height: 1.65;
  margin: 0;
}

html[data-lang='zh'] .lede {
  font-size: 16px;
  line-height: 1.9;
}

.cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin: 26px 0 8px;
}

.btn {
  display: inline-block;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 14px;
  text-decoration: none;
}

.btn.solid {
  background: var(--ink);
  color: var(--ground);
}

.btn:hover {
  background: #fff;
  color: var(--ink);
}

.btn.solid:hover {
  background: #000;
  color: var(--ground);
}

figure {
  margin: 0;
}

.hero-art {
  margin: 36px 0 28px;
  text-align: center;
}

.hero-art img {
  display: block;
  margin: 0 auto 10px;
}

/* Real media: the demo video, screenshot frames and the menu capture */
.demo video {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  background: #fff;
}

.demo figcaption {
  margin-top: 8px;
}

.shot {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--rule);
  background: #fff;
}

.shot img {
  max-height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.shot video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  height: auto;
}

.menu-shot {
  margin: 22px 0 0;
}

.menu-shot img {
  display: block;
  width: 100%;
  max-width: 380px;
  height: auto;
  margin-bottom: 8px;
}

/* Numbered sections */
.sec {
  display: grid;
  grid-template-columns: 48px 1fr;
  border-top: 1px solid var(--rule);
  padding: 28px 0 40px;
  scroll-margin-top: 16px;
}

/* Let long content (code blocks) scroll inside the column instead of widening the page. */
.sec > div,
.steps > div {
  min-width: 0;
}

.num {
  padding-top: 10px;
}

h2 {
  font-family: var(--head);
  font-weight: 400;
  font-size: 32px;
  margin: 0 0 16px;
}

html[data-lang='zh'] h2 {
  font-size: 25px;
}

.prose {
  max-width: 620px;
  font-size: 17px;
  line-height: 1.75;
  color: var(--soft);
}

html[data-lang='zh'] .prose {
  font-size: 16px;
  line-height: 1.95;
}

.prose p {
  margin: 0 0 16px;
}

.intro {
  margin: 0 0 18px;
  max-width: 620px;
  color: var(--soft);
}

.note {
  margin: 18px 0 0;
  max-width: 640px;
  line-height: 1.7;
}

/* Why: the two-figure comparison */
.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-left: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
  margin-top: 12px;
}

.compare figure {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 20px 18px 20px;
}

.compare img {
  display: block;
  margin: 0 auto 14px;
  max-height: 260px;
  width: auto;
}

.compare figcaption b {
  display: block;
  font-family: var(--head);
  font-weight: 400;
  font-size: 22px;
  margin-bottom: 4px;
}

html[data-lang='zh'] .compare figcaption b {
  font-size: 18px;
  font-weight: 600;
}

/* States */
.states {
  border-top: 1px solid var(--rule);
}

.state {
  display: grid;
  grid-template-columns: 36px 170px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dotted var(--faint);
}

.state b {
  font-weight: 500;
}

.state > span {
  color: var(--soft);
  font-size: 15px;
}

.dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  color: #fff;
  font: 600 12px/1 var(--mono);
  font-style: normal;
}

.dot.red {
  background: var(--vermillion);
}

.dot.amber {
  background: var(--amber);
}

.dot.green {
  background: var(--green);
}

.dot.gray {
  background: var(--muted);
}

.dot.hollow {
  border-color: var(--muted);
  background: transparent;
}

.dot.spin {
  animation: spin 3s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dot.spin {
    animation: none;
  }
}

/* Features */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-left: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
}

.cell {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 18px 18px 22px;
}

/* An odd last cell spans the row instead of leaving a hole. */
.cell.wide {
  grid-column: 1 / -1;
}

.cell b {
  font-family: var(--head);
  font-weight: 400;
  font-size: 22px;
}

html[data-lang='zh'] .cell b {
  font-size: 18px;
  font-weight: 600;
}

.cell p {
  margin: 6px 0 0;
  color: #4a4a4a;
  font-size: 15px;
}

/* Install */
.steps {
  display: grid;
  gap: 28px;
}

.steps b {
  font-weight: 500;
}

.steps > div > b {
  font-family: var(--head);
  font-weight: 400;
  font-size: 22px;
}

html[data-lang='zh'] .steps > div > b {
  font-size: 18px;
  font-weight: 600;
}

.steps p {
  margin: 6px 0 10px;
  max-width: 620px;
  color: var(--soft);
}

pre {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  padding: 14px 16px;
  margin: 0;
  border: 1px solid var(--rule);
  background: #fff;
  overflow-x: auto;
}

pre code {
  font-size: inherit;
}

/* Footer */
.foot {
  border-top: 1px solid var(--rule);
  padding: 12px 0 40px;
}

.foot a {
  text-decoration: none;
}

@media (max-width: 640px) {
  .wrap {
    padding: 0 16px;
  }

  nav {
    margin-bottom: 40px;
  }

  .links {
    gap: 12px;
  }

  .hide-sm {
    display: none;
  }

  h1 {
    font-size: 38px;
  }

  html[data-lang='zh'] h1 {
    font-size: 26px;
  }

  .sec {
    grid-template-columns: 1fr;
  }

  .num {
    padding-top: 0;
    margin-bottom: 4px;
  }

  .compare,
  .grid {
    grid-template-columns: 1fr;
  }

  .state {
    grid-template-columns: 30px 1fr;
  }

  .state > span {
    grid-column: 2;
    margin-top: -8px;
  }
}
