:root {
  color-scheme: light;
  --color-paper: #fafaf7;
  --color-surface: #fff;
  --color-ink: #171913;
  --color-muted: #606557;
  --color-line: #dedfd4;
  --color-accent: #bbd437;
  --color-tag: #edf2d6;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-heading: "Songti SC", "STSong", "SimSun", Georgia, serif;
  --radius-card: 16px;
  --content-width: 1200px;
  --gutter: clamp(20px, 4.5vw, 64px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; background: var(--color-paper); color: var(--color-ink); font-family: var(--font-body); line-height: 1.65; -webkit-font-smoothing: antialiased; }
body:has(dialog[open]) { overflow: hidden; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2 { font-family: var(--font-heading); line-height: 1.3; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 4px; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #536700; outline-offset: 5px; }
.container { width: min(100%, calc(var(--content-width) + var(--gutter) * 2)); margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--color-muted); }
.eyebrow { font-size: .73rem; letter-spacing: .16em; font-weight: 650; line-height: 1.5; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 10px; left: 10px; transform: translateY(-160%); z-index: 100; padding: 12px 20px; background: var(--color-ink); color: white; }
.skip-link:focus { transform: none; }
.notice { padding: 16px; border: 1px solid var(--color-line); border-radius: 8px; margin-block: 20px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.site-header { min-height: 94px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.site-brand { flex-shrink: 0; }
.site-brand img { height: 39px; width: auto; max-width: 240px; object-fit: contain; }
.site-header nav { display: flex; align-items: center; gap: 28px; font-size: .88rem; }
.site-header nav > a { text-decoration: none; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 16px; border-radius: 100px; padding: 13px 23px; border: 1px solid transparent; background: var(--color-accent); color: var(--color-ink); text-decoration: none; font-size: .9rem; font-weight: 550; transition: background .15s, transform .15s; }
.button:hover { transform: translateY(-2px); }
.button--dark { background: var(--color-ink); color: white; }
.button--outline { background: transparent; border-color: var(--color-ink); }
.button--small { padding: 9px 18px; font-size: .82rem; }
.text-button { background: none; border: 0; padding: 6px 0; text-decoration: underline; text-underline-offset: 4px; text-align: left; font-size: .86rem; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 30px; }
.section-heading h2 { font-size: clamp(1.8rem, 3vw, 2.2rem); }
.section-heading .eyebrow { color: var(--color-muted); margin-bottom: 12px; }
.result-count { font: 400 .86rem var(--font-body); color: var(--color-muted); margin-left: 12px; white-space: nowrap; }
.tag-list { list-style: none; display: flex; gap: 6px; flex-wrap: wrap; padding: 0; margin: 0; }
.tag-list li { font-size: .69rem; background: var(--color-tag); color: #47550e; border-radius: 100px; padding: 3px 9px; line-height: 1.5; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.project-card { min-width: 0; border-radius: 8px; background: var(--color-surface); transition: transform .2s, box-shadow .2s; }
.project-card:hover, .project-card:focus-within { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(17, 17, 17, .16); }
.project-card__link { position: relative; display: block; height: 200px; overflow: hidden; border-radius: inherit; text-decoration: none; }
.project-card__image { position: absolute; inset: 0; background: #edf0e3; }
.project-card__image img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.project-card:hover img, .project-card:focus-within img { transform: scale(1.05); }
.project-card__placeholder { display: block; width: 100%; height: 100%; background: repeating-linear-gradient(45deg, #f2f0e6, #f2f0e6 14px, #e9ecdf 14px, #e9ecdf 15px); }
.project-card__caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 34px 14px 12px; background: linear-gradient(transparent, rgba(17, 17, 17, .78)); color: white; text-align: left; }
.project-card h3 { font: 700 16px/1.3 var(--font-heading); overflow-wrap: anywhere; }
.project-card__tags { display: flex; gap: 6px; flex-wrap: wrap; list-style: none; padding: 0; margin: 8px 0 0; font-size: 11px; line-height: 1; max-height: 0; overflow: hidden; opacity: 0; transition: max-height .25s, opacity .25s; }
.project-card:hover .project-card__tags, .project-card:focus-within .project-card__tags { max-height: 40px; opacity: 1; }
.project-card__tags li { background: rgba(255, 255, 255, .22); padding: 3px 8px; border-radius: 99px; }
.project-card--plain .project-card__caption { background: none; color: var(--color-ink); }
.project-card--plain .project-card__tags li { background: rgba(17, 17, 17, .08); }
.project-filters { min-width: 0; }
.field-label, .project-filters legend { display: block; font-size: .83rem; font-weight: 650; margin-bottom: 10px; }
.project-filters input[type="search"], .catalog__sort select { padding: 10px 0; width: 100%; border: 0; border-bottom: 1px solid var(--color-ink); border-radius: 0; background: transparent; height: 44px; font-size: 14px; color: var(--color-ink); }
.project-filters fieldset { padding: 0; border: 0; margin: 28px 0; }
.project-filters legend small { display: block; font-weight: 400; color: var(--color-muted); font-size: .7rem; margin-top: 5px; }
.filter-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-tag { position: relative; cursor: pointer; }
.filter-tag input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.filter-tag span { display: block; border: 1px solid #c7cbba; border-radius: 100px; padding: 5px 10px; font-size: .74rem; }
.filter-tag input:checked + span { background: var(--color-ink); color: white; border-color: var(--color-ink); }
.filter-tag input:focus-visible + span { outline: 3px solid #536700; outline-offset: 3px; }
.project-filters .text-button { margin-top: 16px; font-size: .83rem; }
.project-filters [data-tag-toggle]:not([hidden]) ~ .text-button { margin-top: 4px; }
.empty-state { text-align: center; padding: 60px 20px; border: 1px dashed var(--color-line); border-radius: var(--radius-card); }
.empty-state p { margin: 10px 0 22px; color: var(--color-muted); }
.contact-cta { display: flex; align-items: center; justify-content: space-between; gap: 35px; padding-block: 48px; background: var(--color-ink); color: white; border-radius: 20px; width: min(calc(100% - var(--gutter) * 2), var(--content-width)); margin-block: 0 48px; }
.contact-cta .eyebrow { color: var(--color-accent); margin-bottom: 16px; }
.contact-cta h2 { font-size: clamp(1.5rem, 2.5vw, 2rem); }
.contact-cta p:not(.eyebrow) { color: #c3c7b8; margin-top: 14px; font-size: .84rem; }
.contact-cta__email { color: var(--color-accent); font-size: clamp(1rem, 2vw, 1.3rem); font-weight: 700; overflow-wrap: anywhere; }
.contact-cta__social { display: flex; align-items: center; gap: 14px; flex: none; color: #c3c7b8; font-size: 13px; line-height: 1.6; }
.contact-cta__qr { display: flex; align-items: center; justify-content: center; width: 92px; height: 92px; flex: none; border: 2px dashed #a8b070; background: white; color: var(--color-muted); font-size: 11px; text-align: center; }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--color-line); padding-block: 26px; font-size: .73rem; color: var(--color-muted); }
dialog { color: var(--color-ink); border: 0; }
dialog::backdrop { background: #11160bb3; backdrop-filter: blur(3px); }
.icon-button { background: white; border: 1px solid var(--color-line); border-radius: 50%; display: grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0; }
.dialog-close { position: absolute; right: 22px; top: 20px; }
.project-preview { position: fixed; inset: 0 0 0 auto; margin: 0; width: 480px; height: 100%; max-width: 100%; max-height: 100%; padding: 56px 44px; overflow-y: auto; background: #fafaf7; color: #111; }
.project-preview[open] { animation: project-drawer-in .3s cubic-bezier(.2, .8, .2, 1); }
.project-preview::backdrop { background: rgba(17, 17, 17, .5); backdrop-filter: none; }
.project-preview .dialog-close { right: 20px; top: 16px; width: 40px; height: 40px; border: 0; background: transparent; }
.project-preview .dialog-close:hover { background: #e2e4da; }
.project-preview__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.project-preview h2 { font-size: 30px; line-height: 1.25; overflow-wrap: anywhere; }
.project-preview__subtitle { font-size: 14px; margin-top: 6px; color: #5f6358; }
.project-preview__github { width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: #edeee6; border-radius: 50%; text-decoration: none; }
.project-preview__github:hover { background: #e2e4da; }
.project-preview__tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 22px; }
.project-preview__tags li { padding: 4px 12px; border: 1px solid #cfd2c4; border-radius: 999px; background: white; font-size: 13px; }
.project-preview__image { width: 100%; height: 170px; object-fit: cover; border-radius: 10px; margin-bottom: 22px; }
img.project-preview__image { width: auto; height: auto; max-width: 100%; max-height: 170px; margin-inline: auto; object-fit: contain; }
.project-preview__placeholder { display: flex; align-items: center; justify-content: center; background: #eee; font: 700 22px var(--font-heading); }
.project-preview__section { border-top: 1px solid #e2e4da; padding: 20px 0; }
.project-preview__label { font: 400 12px var(--font-body); color: #5f6358; margin-bottom: 10px; }
.project-preview__description { line-height: 1.8; }
.project-preview__links { list-style: none; padding: 0; margin: 0; }
.project-preview__resource { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 700; background: #111; color: white; margin-bottom: 10px; text-decoration: none; }
.project-preview__resource--lime { background: #bbd437; color: #111; }
.project-preview__resource-label { display: flex; align-items: center; gap: 10px; }
.project-preview__resource-label svg { flex: none; }
.project-preview__resource-address { min-width: 0; font-weight: 400; font-size: 12px; opacity: .8; word-break: break-all; text-align: right; }
.project-preview__more { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; margin-top: 6px; border-bottom: 2px solid #bbd437; padding-bottom: 4px; text-decoration: none; }
@keyframes project-drawer-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
@media (max-width: 900px) { .project-preview { padding: 56px 24px; } }
.project-links { display: flex; gap: 10px; flex-wrap: wrap; margin: 22px 0; padding: 0; list-style: none; }
.project-links .button { font-size: .8rem; padding: 10px 15px; }
.lightbox { width: min(96vw, 1400px); max-width: 96vw; max-height: 96vh; padding: 14px; background: #171913; color: white; border-radius: 12px; }
.lightbox__toolbar { display: flex; justify-content: end; margin-bottom: 10px; }
.lightbox img { width: auto; height: auto; max-height: 75vh; margin-inline: auto; object-fit: contain; }
.lightbox p { text-align: center; margin: 12px 0 4px; font-size: .84rem; }
.image-zoom { display: block; border: 0; background: transparent; padding: 0; width: 100%; cursor: zoom-in; }
.image-zoom img { margin-inline: auto; }
@media (max-width: 1050px) { .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .site-header { min-height: 80px; gap: 12px; }
  .site-brand img { max-width: 185px; height: 31px; }
  .site-header nav { gap: 12px; }
  .site-header nav > a:first-child { display: none; }
  .button--small { padding: 8px 12px; font-size: .72rem; }
  .section-heading { align-items: start; flex-direction: column; gap: 10px; }
  .contact-cta, .site-footer { flex-direction: column; align-items: start; }
  .contact-cta { padding: 30px 24px; gap: 24px; }
}
@media (max-width: 560px) { .project-grid { grid-template-columns: 1fr; } }

.hero { border-block: 1px solid var(--color-line); background-image: radial-gradient(#d8dccb 1px, transparent 1px); background-size: 22px 22px; }
.hero__grid { display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: 48px; padding-block: 68px; }
.hero h1 { font-size: clamp(2.6rem, 4.7vw, 4.3rem); letter-spacing: -.035em; line-height: 1.22; margin: 24px 0; }
.hero h1 span { background: linear-gradient(transparent 65%, var(--color-accent) 65%); }
.hero__description { color: #474d3d; font-size: .95rem; line-height: 1.95; max-width: 490px; }
.hero__actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 28px; }
.hero__signature { font-size: .72rem; color: var(--color-muted); letter-spacing: .09em; margin-top: 22px; }
.hero__showcase { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: 90px 120px 90px; gap: 16px; padding: 16px 4px; }
.hero__shape { position: absolute; inset: 5% 3%; background: var(--color-accent); border-radius: 42% 58% 67% 33% / 50% 37% 63% 50%; transform: rotate(-15deg); }
.hero-tile { position: relative; min-width: 0; overflow: hidden; text-decoration: none; border-radius: 12px; box-shadow: 0 14px 25px #20270d24; background: white; }
.hero-tile img { width: 100%; height: 100%; object-fit: cover; }
.hero-tile > span { position: absolute; bottom: 0; left: 0; right: 0; padding: 28px 14px 12px; font-size: .82rem; font-weight: 650; background: linear-gradient(transparent, #10170bdf); color: white; }
.hero-tile--1 { grid-column: 1; grid-row: 2 / 4; transform: rotate(-6deg); }
.hero-tile--2 { grid-column: 2; grid-row: 1 / 3; transform: rotate(6deg); }
.hero-tile--invite { grid-column: 2; grid-row: 3 / 4; transform: rotate(-3deg); display: flex; align-items: start; justify-content: center; flex-direction: column; padding: 14px 18px; border: 1px dashed #677341; }
.hero-tile--invite small { color: var(--color-muted); font-size: .65rem; }
.featured-projects { padding-block: 28px 8px; }
.featured-projects__header { display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 28px; margin-bottom: 10px; }
.featured-projects__header h2 { font: 400 13px var(--font-body); color: var(--color-muted); }
.featured-projects__viewport { overflow-x: auto; padding-block: 4px 16px; scrollbar-width: thin; }
.featured-projects--animated .featured-projects__viewport { overflow-x: hidden; }
.featured-projects__track { display: flex; width: max-content; gap: 16px; }
.featured-projects .project-card { flex: 0 0 240px; }
.featured-projects .project-card__link { height: 170px; }
.catalog { padding-block: 48px 80px; }
.catalog__layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; align-items: start; }
.catalog--enhanced .catalog__layout { grid-template-columns: 260px minmax(0, 1fr); }
.catalog--enhanced .project-filters { position: sticky; top: 24px; max-height: calc(100dvh - 48px); overflow-y: auto; }
.catalog__results { min-width: 0; }
.catalog__heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 44px; margin-bottom: 22px; }
.catalog__heading h2 { font-size: clamp(1.65rem, 2.5vw, 2rem); }
.catalog__sort { width: 160px; flex: none; }
.project-page { padding-top: 34px; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 12px; color: var(--color-muted); font-size: .8rem; margin-bottom: 35px; }
.project-header { max-width: 940px; margin-bottom: 38px; }
.project-header h1 { font-size: clamp(2.3rem, 5vw, 3.7rem); margin: 18px 0 12px; overflow-wrap: anywhere; }
.project-header__subtitle { color: var(--color-muted); font-size: 1.05rem; }
.project-header__summary { font-size: 1.12rem; line-height: 1.9; margin-top: 20px; max-width: 840px; }
.project-cover { border-radius: 16px; overflow: hidden; margin-bottom: 48px; max-width: calc(100% - 274px); margin-inline: 0 auto; }
.project-cover img { width: auto; height: auto; max-width: 100%; max-height: 510px; margin-inline: auto; object-fit: contain; object-position: center; border-radius: 16px; }
.project-page__columns { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 64px; }
.article-content { min-width: 0; font-size: 1rem; line-height: 1.95; overflow-wrap: anywhere; }
.article-content > :first-child { margin-top: 0; }
.article-content h2 { font-size: 1.85rem; border-top: 1px solid var(--color-line); padding-top: 28px; margin: 44px 0 22px; }
.article-content h3 { font-size: 1.16rem; margin: 28px 0 12px; }
.article-content p, .article-content ul, .article-content ol, .article-content blockquote, .article-content figure { margin-block: 18px; }
.article-content ul, .article-content ol { padding-left: 1.6em; }
.article-content li + li { margin-top: 8px; }
.article-content blockquote { padding: 16px 22px; background: var(--color-tag); border-left: 3px solid #778e1e; margin-inline: 0; }
.article-content blockquote > p:first-child > strong:only-child { display: block; font-family: var(--font-heading); font-size: 1.2rem; line-height: 1.45; margin-bottom: 4px; }
.article-content img { border: 1px solid var(--color-line); border-radius: 10px; margin-inline: auto; }
.article-content .article-figure--right { float: right; width: min(44%, 360px); margin: 0 0 16px 26px; }
.article-content .article-figure--right img { width: 100%; height: auto; }
.article-content .article-figure--pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.article-content .article-figure--pair img { width: 100%; height: auto; }
.article-content h2 { clear: both; }
.article-content video { display: block; width: 100%; max-width: 100%; height: auto; border-radius: 10px; margin-inline: auto; }
.article-content figcaption { text-align: center; color: var(--color-muted); font-size: .8rem; margin-top: 9px; }
.article-content a { color: #4b6200; }
.article-content code { background: #eceee4; padding: 2px 5px; border-radius: 4px; font-size: .87em; }
.article-content pre { overflow-x: auto; padding: 18px; background: #eceee4; }
.article-content .katex { font-size: 1.05em; overflow-wrap: normal; }
.article-content .math-display { max-width: 100%; overflow-x: auto; overflow-y: hidden; padding-block: .5em; margin-block: 1.25em; }
.article-content .math-display .katex-display { margin: 0; }
.article-content table { width: 100%; border-collapse: collapse; }
.article-content th, .article-content td { border: 1px solid var(--color-line); padding: 9px; text-align: left; }
.article-toc nav { position: sticky; top: 28px; border-left: 1px solid var(--color-line); padding-left: 20px; }
.article-toc h2 { font-family: var(--font-body); font-size: .82rem; margin-bottom: 14px; }
.article-toc ol { list-style: none; padding: 0; margin: 0; }
.article-toc li { font-size: .76rem; line-height: 1.65; margin-block: 9px; }
.article-toc a { text-decoration: none; color: var(--color-muted); }
.article-toc a[aria-current="location"] { color: #4b6200; font-weight: 700; }
.article-toc .article-toc__sub { padding-left: 12px; font-size: .7rem; }
.related-projects { padding-block: 70px 80px; }
.project-grid--related { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.not-found { padding-block: 80px; }
.not-found h1 { font-size: 3rem; margin: 20px 0; }
.not-found p { margin-bottom: 24px; }
@media (max-width: 1000px) {
  .hero__grid { gap: 25px; }
  .catalog--enhanced .catalog__layout { grid-template-columns: 220px minmax(0, 1fr); gap: 24px; }
  .project-page__columns { grid-template-columns: minmax(0, 1fr) 170px; gap: 30px; }
  .project-cover { max-width: calc(100% - 200px); }
}
@media (max-width: 800px) {
  .hero__grid { grid-template-columns: 1fr; padding-block: 42px; }
  .hero__copy { max-width: 600px; }
  .hero__showcase { max-width: 460px; width: 100%; margin: 10px auto 0; grid-template-rows: 60px 110px 90px; }
  .catalog--enhanced .catalog__layout { grid-template-columns: minmax(0, 1fr); }
  .catalog--enhanced .project-filters { position: static; max-height: none; overflow-y: visible; }
  .project-filters fieldset { margin-block: 18px; }
  .project-page__columns { grid-template-columns: minmax(0, 1fr); }
  .article-toc { display: none; }
  .project-cover { max-width: 100%; margin-inline: auto; }
  .article-content .article-figure--right { float: none; width: auto; margin: 18px 0; }
  .article-content .article-figure--pair { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .hero__showcase { gap: 10px; grid-template-rows: 45px 90px 75px; }
  .hero-tile--invite { padding: 10px; }
  .hero-tile--invite small { font-size: .6rem; }
  .catalog { padding-block: 42px 54px; }
  .result-count { margin-left: 6px; }
  .catalog__heading { gap: 12px; }
  .catalog__sort { width: 130px; }
  .project-grid--related { grid-template-columns: 1fr; }
}
