/* Dong YaoZe — one stylesheet, no scripts. Ink-and-paper palette, serif display, system sans body. */

:root {
  --paper: #f4f0e8;
  --paper-deep: #e9e3d8;
  --card: #ece7dc;
  --line: rgba(23, 32, 39, 0.14);
  --ink: #172027;
  --muted: #57626a;
  --accent: #285f6f;
  --accent-soft: #dbe6e4;
  --warm: #8a4f3d;
  --warm-soft: #f0e2da;
  --max: 72rem;
  --reading: 44rem;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --serif: "Iowan Old Style", Charter, "Source Serif 4", "Noto Serif CJK SC", "Songti SC", SimSun, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 1rem;
  --ease: 180ms ease;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.02rem;
  line-height: 1.62;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt";
}
p { text-wrap: pretty; }
a { color: inherit; text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; transition: color var(--ease); }
a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--warm); outline-offset: 4px; border-radius: 0.2rem; }
main:focus { outline: none; }
img, svg { max-width: 100%; height: auto; }
time { white-space: nowrap; }

.shell { width: min(calc(100% - 2rem), var(--max)); margin-inline: auto; }
.skip-link { position: absolute; top: -5rem; left: 1rem; z-index: 20; padding: 0.6rem 0.8rem; background: var(--ink); color: var(--paper); border-radius: 0.4rem; }
.skip-link:focus { top: 1rem; }

/* Header ---------------------------------------------------------------- */
.site-header { padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.wordmark { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; text-decoration: none; letter-spacing: -0.02em; white-space: nowrap; }
.wordmark-mark { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--ink); color: var(--paper); font-family: var(--serif); font-size: 1.05rem; }
.site-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.35rem 1.1rem; font-size: 0.9rem; }
.site-nav a { color: var(--muted); text-decoration: none; padding-bottom: 0.15rem; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }
.site-nav a[aria-current="true"] { border-bottom-style: dotted; }

/* Type ------------------------------------------------------------------ */
.eyebrow { margin: 0 0 0.8rem; color: var(--accent); font-size: 0.74rem; font-weight: 750; letter-spacing: 0.13em; text-transform: uppercase; }
.eyebrow a { text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.03em; line-height: 1.06; text-wrap: balance; }
h1 { margin: 0; font-size: clamp(2.5rem, 6.4vw, 5.4rem); }
h2 { margin: 0; font-size: clamp(1.9rem, 3.8vw, 3rem); }
h3 { margin: 0; font-size: 1.45rem; }
.lede { max-width: 46rem; margin: 1.4rem 0 0; color: var(--muted); font-family: var(--serif); font-size: clamp(1.15rem, 1.9vw, 1.4rem); line-height: 1.5; }
.section-note { margin: 1.8rem 0 0; color: var(--muted); font-size: 0.92rem; }
.notice { max-width: 46rem; margin: 1.6rem 0 0; padding: 0.9rem 1.1rem; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 0.6rem 0.6rem 0; font-size: 0.95rem; }
.notice p { margin: 0; }

/* Buttons and chips ----------------------------------------------------- */
.button { display: inline-block; padding: 0.75rem 1.15rem; border-radius: 999px; background: var(--ink); color: var(--paper); text-decoration: none; font-size: 0.92rem; font-weight: 650; transition: background var(--ease), transform var(--ease); }
.button:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }
.text-link { font-weight: 650; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.chip { display: inline-block; padding: 0.35rem 0.8rem; border: 1px solid var(--line); border-radius: 999px; font-size: 0.84rem; font-weight: 600; text-decoration: none; transition: border-color var(--ease), color var(--ease); }
.chip:hover { border-color: var(--accent); }
.chip-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.article-links, .utility-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.4rem 0 0; }
.badge { display: inline-block; padding: 0.12rem 0.55rem; border-radius: 999px; background: var(--paper-deep); font-size: 0.74rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.badge-project { background: var(--accent-soft); color: var(--accent); }
.badge-conclusion { background: var(--warm-soft); color: var(--warm); }
.badge-fork { background: transparent; border: 1px dashed var(--line); }
.badge-hold { background: var(--warm-soft); color: var(--warm); }
.badges { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.9rem 0 0; }

/* Hero ------------------------------------------------------------------ */
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(16rem, 0.7fr); gap: clamp(2rem, 7vw, 6rem); align-items: end; padding: clamp(4.5rem, 11vw, 9rem) 0 clamp(3.5rem, 8vw, 6rem); }
.hero-copy h1 { max-width: 17ch; font-size: clamp(2.4rem, 5.4vw, 4.75rem); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.3rem; margin-top: 2rem; }
.hero-mark { position: absolute; right: -0.5rem; top: 0.5rem; z-index: -1; font-family: var(--serif); font-size: clamp(9rem, 22vw, 20rem); line-height: 1; color: var(--ink); opacity: 0.045; pointer-events: none; user-select: none; }
.site-map { padding: 0; }
.site-map ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.site-map li { display: grid; grid-template-columns: 6rem 1fr; gap: 0.8rem; padding: 0.62rem 0; border-bottom: 1px solid var(--line); }
.site-map li > span { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; padding-top: 0.2rem; }
.site-map li a { font-weight: 650; text-decoration: none; }
.site-map li a::after { content: " →"; color: var(--muted); font-weight: 400; }
.site-map li a:hover::after { color: var(--accent); }

/* Sections and cards ---------------------------------------------------- */
.section-block { padding: clamp(2.6rem, 6vw, 5rem) 0; }
.section-block + .section-block { border-top: 1px solid var(--line); }
.section-heading { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: end; margin-bottom: 2rem; }
.section-heading > p { max-width: 34rem; margin: 0 0 0.3rem; color: var(--muted); }
.card-grid, .collection-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.card { display: flex; flex-direction: column; gap: 0.6rem; min-height: 13rem; padding: 1.35rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); transition: border-color var(--ease), transform var(--ease), box-shadow var(--ease); }
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 10px 30px -18px rgba(23, 32, 39, 0.35); }
.card h2, .card h3 { margin: 0; font-size: 1.5rem; line-height: 1.12; }
.card h2 a, .card h3 a { text-decoration: none; }
.card h2 a:hover, .card h3 a:hover { text-decoration: underline; }
.card > p { margin: 0; color: var(--muted); }
.card > p:not(.card-kind):not(.card-links):not(.badges):not(.status) { flex: 1; }
.card-kind { display: flex; flex-wrap: wrap; gap: 0.45rem 0.8rem; margin: 0 0 0.3rem; color: var(--muted); font-size: 0.74rem; letter-spacing: 0.05em; text-transform: uppercase; }
.card-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.88rem; font-weight: 600; }
.card-links a { text-decoration: none; }
.card-links a:hover { text-decoration: underline; }
.status { font-size: 0.82rem; font-style: italic; }
.empty-state { grid-column: 1 / -1; max-width: 40rem; color: var(--muted); }
.intro-block { padding: 0 0 1.5rem; }
.prose-compact { margin-top: 0; font-family: var(--sans); font-size: 1rem; }

/* Directory (homepage) -------------------------------------------------- */
.directory { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 0; padding: 0; counter-reset: dir; }
.directory a { display: grid; grid-template-columns: 2.6rem 1fr; grid-template-rows: auto auto auto; column-gap: 0.6rem; row-gap: 0.35rem; height: 100%; padding: 1.2rem 1.3rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; transition: border-color var(--ease), background var(--ease); }
.directory a:hover { border-color: var(--accent); background: var(--card); }
.directory-index { grid-row: 1 / span 3; font-family: var(--serif); font-size: 1.6rem; color: var(--muted); line-height: 1; }
.directory-title { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; letter-spacing: -0.02em; }
.directory-promise { color: var(--muted); font-size: 0.95rem; }
.directory-cta { color: var(--accent); font-size: 0.85rem; font-weight: 650; }

.principles-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; }
.principles-strip p { margin: 0; color: var(--muted); }
.principles-strip .eyebrow { color: var(--ink); }

/* Page hero for indexes -------------------------------------------------- */
.page-hero { padding: clamp(4rem, 9vw, 7rem) 0 2.6rem; }
.page-hero h1 { max-width: 14ch; }
.collection-grid { padding-bottom: 6rem; }

/* Repository catalog ----------------------------------------------------- */
.catalog-group { margin: 2.4rem 0 0.2rem; font-size: 1.35rem; }
.catalog-blurb { margin: 0 0 0.6rem; color: var(--muted); font-size: 0.95rem; max-width: 46rem; }
.repo-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.repo-list li { display: grid; grid-template-columns: minmax(12rem, 0.9fr) minmax(0, 2fr) minmax(10rem, auto); gap: 0.4rem 1.5rem; padding: 0.9rem 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.repo-name { font-family: var(--mono); font-size: 0.92rem; font-weight: 600; overflow-wrap: anywhere; }
.repo-name a { text-decoration: none; }
.repo-name a:hover { text-decoration: underline; }
.repo-name .badge { margin-left: 0.4rem; vertical-align: 0.1em; font-family: var(--sans); }
.repo-line { margin: 0; font-size: 0.95rem; }
.repo-original { display: block; margin-top: 0.15rem; color: var(--muted); font-size: 0.88rem; }
.repo-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.3rem 0.9rem; margin: 0; font-size: 0.85rem; font-weight: 600; }
.repo-links span { color: var(--muted); font-weight: 500; }
.repo-links a { text-decoration: none; }
.repo-links a:hover { text-decoration: underline; }

/* Article ---------------------------------------------------------------- */
.article { padding-top: clamp(4rem, 9vw, 7rem); padding-bottom: 6rem; }
.article-header { max-width: 56rem; }
.article-header h1 { font-size: clamp(2.3rem, 5.6vw, 4.4rem); }
.article-meta { display: flex; flex-wrap: wrap; gap: 0.6rem 2rem; margin: 1.6rem 0 0; color: var(--muted); font-size: 0.86rem; }
.article-meta div { display: flex; gap: 0.5rem; align-items: baseline; }
.article-meta dt { font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.72rem; }
.article-meta dd { margin: 0; }
.prose { max-width: var(--reading); margin-top: 3.2rem; font-family: var(--serif); font-size: 1.12rem; line-height: 1.75; overflow-wrap: anywhere; }
.prose h2 { margin: 2.6rem 0 0.9rem; font-size: 1.9rem; }
.prose h3 { margin: 2rem 0 0.7rem; font-size: 1.35rem; }
.prose p, .prose ul, .prose ol { margin: 1rem 0; }
.prose li + li { margin-top: 0.35rem; }
.prose blockquote { margin: 1.4rem 0; padding: 0.2rem 0 0.2rem 1.2rem; border-left: 3px solid var(--accent-soft); color: var(--muted); }
.prose code { font-family: var(--mono); font-size: 0.86em; background: var(--paper-deep); padding: 0.1em 0.35em; border-radius: 0.3rem; }
.prose pre { padding: 1rem 1.1rem; border-radius: 0.7rem; background: var(--paper-deep); overflow-x: auto; font-size: 0.9rem; line-height: 1.5; }
.prose pre code { background: none; padding: 0; font-size: 0.9em; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.4rem 0; font-family: var(--sans); font-size: 0.92rem; }
.prose th, .prose td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { font-size: 0.78rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
.prose .planned { color: var(--muted); font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.05em; text-transform: uppercase; }
.poem { text-align: left; font-size: 1.25rem; line-height: 2.1; }
.poem p { margin: 1.6rem 0; }
.provenance { max-width: var(--reading); margin-top: 3rem; padding: 1.1rem 1.3rem; border: 1px solid var(--line); border-radius: 0.8rem; font-size: 0.92rem; color: var(--muted); }
.provenance ul { margin: 0; padding-left: 1.1rem; }
.article-footer { margin-top: 3.5rem; font-size: 0.92rem; }
.article-footer a { text-decoration: none; }
.article-footer a:hover { text-decoration: underline; }

/* Education record ------------------------------------------------------- */
.meta-table { max-width: 56rem; margin: 2.6rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.meta-table div { display: grid; grid-template-columns: 10rem 1fr; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.meta-table dt { color: var(--muted); font-size: 0.78rem; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; padding-top: 0.2rem; }
.meta-table dd { margin: 0; }
.meta-table .badge { margin-right: 0.4rem; }

/* About ------------------------------------------------------------------ */
.about-grid { display: grid; grid-template-columns: 1.4fr 0.75fr; gap: clamp(2rem, 7vw, 6rem); padding-bottom: 6rem; align-items: start; }
.about-grid .prose { margin-top: 0; }
.principles { padding: 1.4rem; border-radius: var(--radius); background: var(--accent-soft); }
.principles ul { margin: 0; padding-left: 1.2rem; }
.principles li + li { margin-top: 0.65rem; }
.principles .eyebrow { color: var(--ink); }

/* Footer ----------------------------------------------------------------- */
.site-footer { padding: 2rem 0 2.6rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.84rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-inner p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 900px) {
  .hero, .section-heading, .about-grid { grid-template-columns: 1fr; }
  .hero { gap: 2.6rem; }
  .card-grid, .collection-grid, .directory { grid-template-columns: 1fr 1fr; }
  .principles-strip { grid-template-columns: 1fr; gap: 1.4rem; }
  .repo-list li { grid-template-columns: 1fr; gap: 0.25rem; }
  .repo-links { justify-content: flex-start; }
}
@media (max-width: 600px) {
  .shell { width: min(calc(100% - 1.5rem), var(--max)); }
  .header-inner { align-items: flex-start; flex-direction: column; gap: 0.8rem; }
  .site-nav { justify-content: flex-start; gap: 0.3rem 0.9rem; font-size: 0.86rem; }
  .card-grid, .collection-grid, .directory { grid-template-columns: 1fr; }
  .card { min-height: 0; }
  .hero { padding-top: 3.2rem; }
  .hero-actions { align-items: flex-start; flex-direction: column; gap: 1rem; }
  .site-map li { grid-template-columns: 6rem 1fr; gap: 0.6rem; }
  .meta-table div { grid-template-columns: 1fr; gap: 0.2rem; }
  .prose { font-size: 1.06rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .card:hover, .button:hover { transform: none; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111416;
    --paper-deep: #1d2427;
    --card: #181e21;
    --line: rgba(232, 227, 216, 0.16);
    --ink: #e8e3d8;
    --muted: #a4adb0;
    --accent: #91bec6;
    --accent-soft: #1b3034;
    --warm: #d69a83;
    --warm-soft: #3a2a24;
  }
  .button { color: #111416; background: #e8e3d8; }
  .button:hover { color: #111416; background: var(--accent); }
  .chip-primary { color: #111416; background: #e8e3d8; border-color: #e8e3d8; }
  .wordmark-mark { color: #111416; background: #e8e3d8; }
  .card:hover { box-shadow: none; }
  .hero-mark { opacity: 0.07; }
}

@media print {
  .site-nav, .skip-link, .footer-links, .hero-mark, .hero-actions { display: none; }
  body { background: #fff; color: #000; }
  a { text-decoration: none; }
  .card, .directory a { break-inside: avoid; }
}

/* Language switch and Chinese typography ---------------------------------- */
.lang-switch { padding: 0.15rem 0.65rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.site-nav a.lang-switch { border-bottom: 1px solid var(--line); }
.site-nav a.lang-switch:hover { color: var(--ink); border-color: var(--accent); }
:lang(zh) h1, :lang(zh) h2, :lang(zh) h3, :lang(zh) .directory-title { letter-spacing: 0; line-height: 1.22; }
:lang(zh) .hero-copy h1 { max-width: 13em; font-size: clamp(2.1rem, 4.6vw, 4rem); }
:lang(zh) .article-header h1 { font-size: clamp(1.9rem, 4.4vw, 3.5rem); }
:lang(zh) .card h2, :lang(zh) .card h3 { line-height: 1.32; }
:lang(zh) .lede { line-height: 1.7; }
:lang(zh) .prose { font-size: 1.08rem; line-height: 1.95; }
:lang(zh) .eyebrow, :lang(zh) .card-kind, :lang(zh) .badge, :lang(zh) .article-meta dt, :lang(zh) .meta-table dt, :lang(zh) .site-map li > span { letter-spacing: 0.1em; }
:lang(zh) .repo-line { line-height: 1.7; }
