@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/space-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --preview-ratio: 880 / 560;
  --preview-width: 750px;
  --ground: #fafafa;
  --panel: #fff;
  --hover: #f4f4f5;
  --border: #dddde1;
  --ink: #18181b;
  --muted: #52525b;
  --accent: #24242a;
  --sans: "Space Grotesk", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 78px; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 1rem/1.65 var(--sans); }
h1, h2, h3, p, figure, ul, dl, dd { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .22em; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.wrap { width: min(1280px, calc(100% - 80px)); margin-inline: auto; }
.skip { position: fixed; inset: 12px auto auto 14px; z-index: 10; background: var(--panel); padding: 7px 12px; transform: translateY(-160%); }
.skip:focus { transform: none; }

.topbar { position: sticky; top: 0; z-index: 5; background: var(--ground); border-bottom: 1px solid var(--border); }
.topbar-inner, .footer-inner { display: flex; min-height: 57px; align-items: center; justify-content: space-between; gap: 8px 24px; }
.wordmark { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-weight: 650; white-space: nowrap; }
.wordmark > span:first-child { font-size: 1.25rem; }
.wordmark-slash { color: var(--accent); }
.top-links, .footer-inner nav, .related-links { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 21px; }
.top-links a, .footer-inner a, .related-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: .875rem; }
.top-links a[aria-current], .top-links a:hover, .footer-inner a:hover, .related-links a:hover { color: var(--ink); }

.repository { padding: 34px 0 42px; }
.repo-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.repo-heading h1 { font-size: clamp(2.2rem, 5vw, 4.25rem); letter-spacing: -.065em; line-height: 1.08; margin-bottom: 8px; }
.repo-heading p { color: var(--muted); }
.index-section { margin-top: 34px; }
.index-head { display: flex; justify-content: space-between; align-items: center; gap: 10px 24px; flex-wrap: wrap; }
.index-head h2 { font-size: 1.65rem; line-height: 1.25; }
#result-count { color: var(--muted); font-size: .85rem; margin-top: 3px; }
.search-field { display: flex; align-items: center; gap: 10px; min-width: min(100%, 345px); border: 1px solid var(--border); border-radius: 7px; background: var(--panel); padding: 0 10px 0 12px; }
.search-field:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.search-field label { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.search-field input { width: 100%; min-width: 0; min-height: 44px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: .9rem; }
.search-field input::placeholder { color: var(--muted); }
.search-field kbd { font: .75rem var(--mono); color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 2px 5px; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.filters button, #reset-search { color: var(--muted); min-height: 44px; padding: 5px 12px; background: transparent; border: 1px solid var(--border); border-radius: 5px; font-size: .86rem; }
.filters button:hover, #reset-search:hover { border-color: var(--accent); color: var(--ink); }
.filters button[aria-pressed="true"] { color: #fff; border-color: var(--accent); background: var(--accent); }
.filters span { font: .75rem var(--mono); margin-left: 4px; }

.catalog-groups { display: grid; gap: 26px; margin-top: 23px; }
.catalog-group { border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
.group-heading { padding: 17px 20px; background: var(--hover); border-radius: 8px 8px 0 0; }
.group-heading h3 { font-size: 1.22rem; line-height: 1.3; }
.group-heading p { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.repo-list { list-style: none; padding: 0; }
.repo-row { border-top: 1px solid var(--border); }
.repo-main {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, .8fr) 20px;
  column-gap: 16px;
  align-items: center;
  padding: 11px 20px;
  color: var(--ink);
  min-height: 65px;
  transition: background .15s ease;
}
.repo-main:focus-visible { outline-offset: -3px; }
.repo-main:hover { text-decoration: none; background: var(--hover); }
.repo-name, .repo-desc { grid-column: 1; overflow-wrap: anywhere; }
.repo-name { font-size: 1rem; font-weight: 650; grid-row: 1; align-self: end; }
.repo-desc { color: var(--muted); font-size: .88rem; grid-row: 2; align-self: start; }
.repo-tech, .row-arrow { grid-row: 1 / 3; color: var(--muted); font-size: .85rem; }
.repo-tech { grid-column: 2; overflow-wrap: anywhere; }
.row-arrow { grid-column: 3; color: var(--accent); text-align: right; }
.no-results { margin-top: 15px; padding: 20px; border: 1px solid var(--border); border-radius: 8px; }
.no-results p { margin-bottom: 8px; }
.related-links { margin-top: 14px; }
.site-footer { border-top: 1px solid var(--border); }

.reader { max-width: 900px; padding: 26px 0 52px; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: var(--muted); font-size: .86rem; }
.breadcrumbs a { display: inline-flex; align-items: center; min-height: 44px; }
.project-heading { margin: 14px 0 22px; }
.project-heading h1 { font-size: clamp(2rem, 5vw, 3.8rem); line-height: 1.05; letter-spacing: -.05em; margin-bottom: 12px; overflow-wrap: anywhere; }
.project-heading p { color: var(--muted); max-width: 46em; }
.technology, .source-links, .chapter-nav, .inline-links { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; list-style: none; padding: 0; }
.technology { margin-top: 14px; }
.technology li { border: 1px solid var(--border); border-radius: 4px; padding: 3px 7px; color: var(--muted); font: .8rem/1.5 var(--mono); }
.source-links a { min-height: 44px; display: inline-flex; align-items: center; padding-inline: 10px; border: 1px solid var(--border); border-radius: 4px; font-size: .88rem; }
.source-links:not(:empty) { margin-top: 13px; }
.chapter-nav { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 2px 9px; }
.chapter-nav a { display: inline-flex; min-height: 44px; align-items: center; padding: 0 6px; color: var(--ink); font-size: .87rem; }
.chapter-nav a:hover { color: var(--accent); }
.chapter { padding: 21px 0; border-bottom: 1px solid var(--border); }
.chapter h2 { font-size: clamp(1.2rem, 2.4vw, 1.55rem); line-height: 1.35; margin-bottom: 9px; }
.chapter p + p, .chapter ol + p, .chapter figure + p { margin-top: 9px; }
.chapter ol { padding-left: 1.5em; }
.chapter code { font: .87em var(--mono); overflow-wrap: anywhere; }
.chapter pre { padding: 14px 16px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); overflow: auto; }
.chapter figure { margin-top: 13px; }
.chapter figure img, .chapter figure video { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 5px; }
.chapter .doc-compact-media { max-width: 560px; }
.chapter .credit { color: var(--muted); font-size: .85rem; }
.feature-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.feature-list div { border: 1px solid var(--border); padding: 11px 13px; border-radius: 5px; background: var(--panel); }
.feature-list dt { font-weight: 650; }
.feature-list dd { color: var(--muted); font-size: .9rem; }
.inline-links a, .back-index a { display: inline-flex; align-items: center; min-height: 44px; }
.back-index { margin-top: 12px; }
.article-list { padding: 0; list-style: none; }
.article-list li { display: flex; justify-content: space-between; gap: 3px 12px; flex-wrap: wrap; border-top: 1px solid var(--border); padding: 8px 0; }
.article-list span { color: var(--muted); font-size: .83rem; }

@media (max-width: 870px) {
  .wrap { width: calc(100% - 44px); }
}

@media (max-width: 590px) {
  .wrap { width: calc(100% - 28px); }
  .topbar-inner, .footer-inner { gap: 4px 10px; }
  .top-links, .footer-inner nav { gap: 0 9px; }
  .wordmark { gap: 4px; font-size: .82rem; }
  .wordmark > span:first-child { font-size: 1rem; }
  .top-links a, .footer-inner a { font-size: .79rem; }
  .repo-heading { align-items: start; flex-direction: column; padding-bottom: 10px; }
  .repository { padding-top: 24px; }
  .search-field { width: 100%; }
  .search-field kbd { display: none; }
  .group-heading { padding: 12px; }
  .repo-main { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 12px; }
  .repo-tech { display: none; }
  .row-arrow { grid-column: 2; grid-row: 1 / 4; }
  .feature-list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}

/* Project showcases share a neutral canvas and keep the proof next to the entry points. */
.showcase-home { max-width: 1120px; padding-top: clamp(26px, 5vw, 65px); }
.showcase-home .repo-heading h1 { font-size: clamp(2rem, 4vw, 3.3rem); }
.featured-entry {
  display: grid;
  grid-template-columns: minmax(0, 290px) minmax(0, 1fr);
  gap: clamp(14px, 3.5vw, 44px);
  align-items: center;
  padding: 18px 20px;
}
.featured-copy { min-width: 0; }
.featured-copy h4 { margin: 0; font-size: clamp(1.05rem, 2.1vw, 1.55rem); line-height: 1.3; overflow-wrap: anywhere; }
.featured-copy h4 a { color: var(--ink); }
.featured-copy h4 a span { color: var(--muted); font-size: .75em; font-weight: 400; }
.featured-copy p { max-width: 42em; color: var(--muted); margin-top: 6px; }
.featured-copy .featured-tech { font-size: .82rem; }
.featured-actions { display: flex; flex-wrap: wrap; gap: 0 16px; margin-top: 5px; }
.featured-actions a { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; font-size: .875rem; font-weight: 600; }
.showcase-reader { max-width: 1080px; padding-top: 34px; }
.showcase-reader .project-heading { margin: 14px 0 22px; }
.showcase-reader .project-heading p { max-width: 52em; }
.showcase-reader .source-links { margin-top: 17px; }
.showcase-reader .source-links a { padding-inline: 14px; border-radius: 20px; }
.showcase-reader .source-links a:first-child {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}
.showcase-reader .source-links a:hover { text-decoration: underline; text-underline-offset: .18em; }
.showcase-preview {
  display: grid;
  grid-template-columns: minmax(0, var(--preview-width)) minmax(135px, 1fr);
  align-items: start;
  gap: clamp(16px, 3.5vw, 38px);
  margin-bottom: 22px;
}
.project-evidence a { display: block; }
.project-evidence img, .project-evidence video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--preview-ratio);
  object-fit: contain;
  background: var(--hover);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.project-evidence figcaption { margin-top: 7px; color: var(--muted); font-size: .86rem; }
.project-facts dt { font-size: .85rem; font-weight: 650; }
.project-facts dd { margin: 3px 0 14px; font-size: .9rem; color: var(--muted); }
.project-facts .technology { margin-top: 0; gap: 5px; }
.project-facts .technology li { font-size: .73rem; }
.scenario { padding: clamp(16px, 3vw, 26px); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; }
.scenario h2, .scenario h3 { font-size: clamp(1.08rem, 2vw, 1.35rem); line-height: 1.4; }
.scenario p { color: var(--muted); font-size: .9rem; margin-top: 5px; }
.scenario ol { padding-left: 1.25rem; margin: 13px 0 0; }
.scenario li { padding: 8px 0 8px 4px; }
.scenario li + li { border-top: 1px solid var(--border); }
.scenario strong, .scenario span { display: block; }
.scenario span { font-size: .9rem; color: var(--muted); }

@media (max-width: 650px) {
  .featured-entry { grid-template-columns: minmax(72px, 34%) minmax(0, 1fr); padding: 12px; }
  .featured-copy p { font-size: .88rem; }
  .showcase-preview { grid-template-columns: 1fr; }
  .project-facts dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; }
  .project-facts dd { margin: 0; }
}

.featured-preview {
  display: block;
  aspect-ratio: var(--preview-ratio);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--hover);
  transition: border-color .15s ease;
}
.featured-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.featured-preview:hover { border-color: var(--muted); }
.featured-preview img { transition: transform .2s ease; }
.featured-preview:hover img { transform: scale(1.02); }
.sdk-preview pre {
  display: grid;
  align-items: center;
  height: 100%;
  overflow: hidden;
  margin: 0;
  padding: 15px;
  background: var(--hover);
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: .8rem/1.6 var(--mono);
}

@media (max-width: 650px) {
  .sdk-preview pre { padding: 5px; font-size: clamp(.4rem, 1.45vw, .7rem); }
}

@media (prefers-reduced-motion: reduce) {
  .featured-preview:hover img { transform: none; }
}
