:root {
  --bg: #fbfbfa;
  --paper: #ffffff;
  --text: #111111;
  --muted: #5d5d5d;
  --faint: #8a8a8a;
  --line: #d9d9d6;
  --line-strong: #bdbdb8;
  --accent: #111111;
  --container: 1120px;
  --font-serif: Georgia, "Times New Roman", "Songti SC", SimSun, serif;
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.8;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.container {
  width: min(var(--container), 100%);
  margin: 0 auto;
  padding-left: max(28px, env(safe-area-inset-left, 0px));
  padding-right: max(28px, env(safe-area-inset-right, 0px));
}

.section {
  padding-top: 64px;
  padding-bottom: 64px;
  border-top: 1px solid var(--line);
}

.home-main>.section {
    border-top: 0;
}
main section[id] {
  scroll-margin-top: 80px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 251, 250, 0.88);
  backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 24px;
}

.brand {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(28px, 5vw, 68px);
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 72px;
  color: #161616;
  font-size: 14px;
  line-height: 1;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 180ms ease;
}

.nav-link:hover::after,
.nav-link.is-active::after {
  transform: scaleX(1);
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
}

.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 1px;
  margin: 0 auto 5px;
  background: currentColor;
  transition: transform 180ms ease, opacity 160ms ease;
}

.nav-toggle-bar:last-child {
  margin-bottom: 0;
}

.site-header.is-menu-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.site-header.is-menu-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.site-header.is-menu-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.hero {
  position: relative;
  min-height: clamp(640px, calc(100svh - 72px), 800px);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.hero-media {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(62vw, 980px);
  z-index: 0;
  pointer-events: none;
}

.hero-media::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, var(--bg) 0%, rgba(251, 251, 250, 0.72) 38%, rgba(251, 251, 250, 0.08) 72%);
}

.hero-media picture {
    display: block;
    width: 100%;
    height: 100%;
}
.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center right;
  filter: grayscale(1) contrast(0.96) brightness(1.04);
  opacity: 0.9;
}

.hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  min-height: clamp(640px, calc(100svh - 72px), 800px);
  padding-top: 72px;
  padding-bottom: 54px;
}

.hero-copy {
  max-width: 620px;
}

.hero h1,
.archive-heading h1,
.project-detail-header h1,
.post-header h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.055em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(82px, 12vw, 156px);
  line-height: 0.95;
}

.hero-desc {
  max-width: 480px;
  margin: 40px 0 64px;
  color: #292929;
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.9;
  letter-spacing: 0.02em;
}

.hero-index {
  width: min(280px, 100%);
  border-top: 1px solid var(--line);
}

.hero-index a {
  display: grid;
  grid-template-columns: 36px 1fr 24px;
  align-items: center;
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.hero-index span,
.hero-index em {
  color: var(--muted);
  font-style: normal;
}

.hero-index strong {
  font-weight: 400;
}

.hero-index a:hover strong,
.text-link:hover,
.back-link:hover,
.footer-nav a:hover,
.contact-content a:hover {
  text-decoration: underline;
  text-underline-offset: 0.35em;
}

.hero-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 60px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.hero-contact a {
  color: var(--text);
  border-bottom: 1px solid currentColor;
}

.about,
.footer-panel {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: clamp(32px, 8vw, 96px);
}

.section-aside h2,
.section-heading h2,
.project-placeholder h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(31px, 3.4vw, 41px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.section-aside p,
.section-heading p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.about-content {
  max-width: 780px;
}

.about-content > p {
  margin: 0 0 12px;
  color: #202020;
  font-size: clamp(16px, 1.4vw, 18px);
  line-height: 2;
}

.fact-list,
.project-meta-list {
  margin: 42px 0 0;
  border-top: 1px solid var(--line);
}

.fact-list div,
.project-meta-list div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 28px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.fact-list dt,
.project-meta-list dt {
  color: var(--muted);
  font-size: 14px;
}

.fact-list dd,
.project-meta-list dd {
  margin: 0;
  color: #1d1d1d;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.text-link,
.back-link {
  display: inline-flex;
  align-items: center;
  color: #1b1b1b;
  font-size: 14px;
  line-height: 1.5;
}

.article-list,
.project-list {
  border-top: 1px solid var(--line-strong);
}

.article-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 34px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.article-row time,
.post-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.article-row h3 {
  margin: 0;
  color: #111111;
  font-size: clamp(17px, 1.8vw, 21px);
  font-weight: 500;
  line-height: 1.5;
}

.article-row p,
.project-row p,
.project-placeholder p,
.project-detail-header > p,
.archive-heading p,
.contact-content p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.85;
}

.article-row > span,
.project-action {
  color: var(--muted);
  justify-self: end;
  transition: transform 180ms ease;
}

.article-row:hover > span,
.project-row:hover .project-action {
  transform: translateX(4px);
}

.project-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) minmax(190px, 0.42fr) 96px;
  align-items: center;
  gap: 28px;
  padding: 31px 0;
  border-bottom: 1px solid var(--line);
}

.project-number {
  font-family: var(--font-serif);
  font-size: clamp(32px, 4vw, 45px);
  line-height: 1;
}

.project-row h3 {
  margin: 0;
  font-size: clamp(17px, 1.7vw, 21px);
  font-weight: 600;
  line-height: 1.45;
}

.project-stack {
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.8;
}

.project-action {
  color: #111111;
  font-size: 14px;
}

.footer-panel {
  padding-bottom: 56px;
}

.contact-content {
display: flex;
    flex-direction: column;
    gap: 8px;
  max-width: 780px;
}

.contact-content p {
  margin-top: 0;
}

.contact-list {
    margin-top: 18px;
}

.contact-list dd a {
    border-bottom: 1px solid currentColor;
}

.site-footer {
  padding: 0 0 32px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.footer-inner p,
.footer-nav a {
  color: var(--muted);
  font-size: 13px;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.archive-hero,
.project-main,
.post-main {
  padding-top: 72px;
}

.archive-heading,
.project-detail,
.post-shell {
  max-width: 880px;
}

.archive-heading h1,
.project-detail-header h1 {
  margin: 52px 0 18px;
  font-size: clamp(58px, 8vw, 104px);
  line-height: 0.98;
}

.section-label {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-main {
  padding-bottom: 72px;
}

.post-shell {
  margin: 0 auto;
}

.post-header {
  border-bottom: 1px solid var(--line);
  padding: 48px 0 34px;
}

.post-header h1 {
  margin: 16px 0;
  font-size: clamp(42px, 6vw, 78px);
  line-height: 1.08;
}

.post-header > p:not(.post-meta) {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.9;
}

.post-content {
  padding-top: 42px;
  color: #202020;
}

.post-content p,
.post-content li {
  font-size: 17px;
  line-height: 2.05;
}

.post-content p {
  margin: 0 0 22px;
}

.post-content img {
    width: 100%;
    height: auto;
}
.post-content h2,
.post-content h3 {
  margin: 44px 0 16px;
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.post-content h2 {
  font-size: 30px;
}

.post-content h3 {
position: relative;
    margin: 56px 0 22px;
    padding-bottom: 14px;
    font-size: 26px;
    font-weight: 600;
}

.post-content h3::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 52px;
    height: 2px;
    background: var(--accent);
}

.post-content h4 {
    margin: 38px 0 12px;
    font-family: var(--font-sans);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text);
}

.post-content ul,
.post-content ol {
  padding-left: 1.25em;
}

.post-content blockquote {
  margin: 34px 0;
  padding-left: 20px;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
}

.post-content code:not(pre code) {
    border: 1px solid var(--line);
    background: var(--paper);
    padding: 0.12em 0.34em;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.88em;
}

.post-content pre {
    overflow-x: auto;
    margin: 30px 0;
    border: 1px solid var(--line);
    background: #f4f4f1;
    padding: 18px 20px;
    line-height: 1.75;
}

.post-content pre code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 14px;
}

.post-content table {
    width: 100%;
    margin: 30px 0;
    border: 1px solid var(--line);
    border-collapse: collapse;
    font-size: 15px;
    line-height: 1.7;
    table-layout: auto;
}

.post-content table thead {
    background: var(--paper);
    border-bottom: 2px solid var(--line-strong);
}

.post-content table th,
.post-content table td {
    padding: 12px 16px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.post-content table th:last-child,
.post-content table td:last-child {
    border-right: 0;
}

.post-content table tbody tr:last-child th,
.post-content table tbody tr:last-child td {
    border-bottom: 0;
}

.post-content table th {
    font-weight: 600;
    color: var(--text);
}

.post-content table tbody tr:nth-child(even) {
    background: #fafaf8;
}

.post-content .katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    margin: 30px 0;
    padding: 6px 0;
}
.project-main {
  padding-bottom: 72px;
}

.project-detail {
  margin: 0 auto;
}

.project-detail-header {
  padding: 48px 0 38px;
  border-bottom: 1px solid var(--line);
}

.project-meta-list {
  margin-top: 0;
}

.project-placeholder {
  min-height: 320px;
  margin-top: 58px;
  padding: 42px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.project-placeholder p {
  max-width: 560px;
  margin-top: 16px;
}

.project-pager {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 28px;
}

.project-pager a {
  max-width: 46%;
  color: #111111;
  font-size: 14px;
  line-height: 1.7;
}

.project-pager a:last-child {
  text-align: right;
}

.reveal {
  opacity: 1;
  transform: none;
  transition: opacity 560ms ease, transform 560ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay,
.reveal-delay-2 {
  transition-delay: 80ms;
}

.reveal-delay-3 {
  transition-delay: 140ms;
}

@media (max-width: 900px) {
  .container {
    padding-left: max(20px, env(safe-area-inset-left, 0px));
    padding-right: max(20px, env(safe-area-inset-right, 0px));
  }

  .nav-toggle {
    display: inline-block;
  }

  .header-inner {
    flex-wrap: wrap;
    min-height: 64px;
  }

  .nav {
    order: 3;
    flex-basis: 100%;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    transition: max-height 220ms ease, padding 220ms ease;
  }

  .site-header.is-menu-open .nav {
    max-height: 360px;
    padding: 8px 0 12px;
  }

  .nav-link {
    min-height: 46px;
    border-top: 1px solid var(--line);
  }

  .nav-link::after {
    display: none;
  }

  body.is-nav-open {
    overflow: hidden;
  }

  .hero,
  .hero-inner {
    min-height: auto;
  }

  .hero {
    padding-top: 0;
  }

  .hero-media {
    position: relative;
    width: 100%;
    height: 330px;
    margin-top: 0;
    opacity: 0.82;
  }

  .hero-media::before {
    background: linear-gradient(180deg, rgba(251, 251, 250, 0.04), var(--bg) 92%);
  }

  .hero-inner {
    display: block;
    padding-top: 44px;
    padding-bottom: 56px;
  }

  .hero h1 {
    font-size: clamp(68px, 24vw, 108px);
  }

  .hero-desc {
    margin: 28px 0 42px;
    font-size: 17px;
  }

  .about,
  .footer-panel {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .section {
    padding-top: 50px;
    padding-bottom: 50px;
  }

  .section-heading {
    display: block;
  }

  .section-heading .text-link {
    margin-top: 16px;
  }

  .article-row {
    grid-template-columns: 1fr 24px;
    gap: 18px;
  }

  .article-row time {
    grid-column: 1 / -1;
  }

  .project-row {
    grid-template-columns: 56px minmax(0, 1fr) 24px;
    gap: 18px;
  }

  .project-stack {
    grid-column: 2 / 3;
  }

  .project-action {
    grid-column: 3 / 4;
    grid-row: 1 / 3;
    align-self: center;
    font-size: 0;
  }

  .project-action::after {
    content: "→";
    font-size: 18px;
  }

  .footer-inner,
  .project-pager {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-pager a,
  .project-pager a:last-child {
    max-width: 100%;
    text-align: left;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }

  .hero-media {
    height: 260px;
  }

  .hero h1 {
    font-size: clamp(58px, 25vw, 86px);
  }

  .fact-list div,
  .project-meta-list div {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 15px 0;
  }

  .article-row {
    padding: 20px 0;
  }

  .project-row {
    padding: 25px 0;
  }

  .archive-heading h1,
  .project-detail-header h1,
  .post-header h1 {
    font-size: clamp(40px, 16vw, 62px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
