:root {
  --background: #f7f7f4;
  --text: #181916;
  --muted: #62665f;
  --line: #d9dbd4;
  --surface: #eeefea;
  --accent: #6f5b83;
  --selection: #ddd2e8;
  --page-gutter: clamp(1.5rem, 10vw, 11rem);
}

:root[data-theme="dark"] {
  --background: #111210;
  --text: #ecede8;
  --muted: #a4a99f;
  --line: #34372f;
  --surface: #1d1f1b;
  --accent: #bca9d2;
  --selection: #4a3d58;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --background: #111210;
    --text: #ecede8;
    --muted: #a4a99f;
    --line: #34372f;
    --surface: #1d1f1b;
    --accent: #bca9d2;
    --selection: #4a3d58;
  }
}

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

html {
  min-width: 320px;
  background: var(--background);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family:
    "MiSans VF",
    "MiSans",
    "Noto Sans CJK SC",
    "Source Han Sans SC",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  transition:
    background-color 180ms ease,
    color 180ms ease;
}

::selection {
  background: var(--selection);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.24em;
}

a:hover {
  text-decoration-thickness: 0.13em;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}

.page {
  display: grid;
  grid-template-rows: 1fr auto;
  width: min(calc(100% - (2 * var(--page-gutter))), 38rem);
  min-height: 100vh;
  min-height: 100svh;
  margin-left: var(--page-gutter);
}

.profile {
  align-self: center;
  padding: clamp(6rem, 14vh, 9.5rem) 0 clamp(4.5rem, 10vh, 7rem);
}

.identity {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: clamp(2.75rem, 7vh, 4rem);
}

.avatar {
  display: block;
  flex: 0 0 auto;
  width: 3.75rem;
  height: 3.75rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  object-fit: cover;
}

h1 {
  margin: 0 0 0.38rem;
  font-size: clamp(1.65rem, 4vw, 1.85rem);
  font-weight: 620;
  line-height: 1.08;
  letter-spacing: 0.02em;
}

.identity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.85rem;
  align-items: baseline;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.handle {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  letter-spacing: -0.015em;
}

.lead {
  max-width: 25ch;
  margin: 0 0 clamp(2.5rem, 7vh, 3.75rem);
  font-size: clamp(1.35rem, 3.5vw, 1.65rem);
  font-weight: 520;
  line-height: 1.45;
  letter-spacing: -0.018em;
}

.about {
  max-width: 36rem;
  color: var(--muted);
  font-size: 0.975rem;
  line-height: 1.9;
}

.about p {
  margin: 0;
}

.about p + p {
  margin-top: 1.45rem;
}

.about p:first-child {
  color: var(--text);
}

.links {
  display: flex;
  gap: 1.6rem;
  margin-top: clamp(2.5rem, 7vh, 3.75rem);
  font-size: 0.925rem;
  font-weight: 560;
}

.footer {
  padding-bottom: clamp(1.75rem, 5vh, 3rem);
  color: var(--muted);
  font-family:
    "Yu Mincho",
    "Hiragino Mincho ProN",
    "Noto Serif CJK JP",
    "Source Han Serif JP",
    serif;
  font-size: 0.8rem;
  line-height: 1.7;
}

.footer p {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin: 0;
}

.theme-toggle {
  position: fixed;
  z-index: 1;
  top: clamp(1.25rem, 4vw, 2.25rem);
  right: clamp(1.25rem, 4vw, 2.25rem);
  display: none;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--background);
  color: var(--text);
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 150ms ease;
}

.has-js .theme-toggle {
  display: grid;
}

.theme-toggle:hover {
  background: var(--surface);
}

.theme-toggle:active {
  transform: scale(0.94);
}

.theme-icon {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.theme-icon--sun {
  display: none;
}

:root[data-theme="dark"] .theme-icon--moon {
  display: none;
}

:root[data-theme="dark"] .theme-icon--sun {
  display: block;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 40rem) {
  :root {
    --page-gutter: 1.5rem;
  }

  .page {
    width: calc(100% - (2 * var(--page-gutter)));
    margin-inline: var(--page-gutter);
  }

  .profile {
    padding-top: 6.75rem;
  }

  .identity {
    margin-bottom: 2.75rem;
  }

  .avatar {
    width: 3.25rem;
    height: 3.25rem;
  }

  .about {
    font-size: 0.95rem;
    line-height: 1.85;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}


/* Blog */
:root {
  --blog-width: 54rem;
  --article-width: 43rem;
  --accent-soft: #eee9f2;
}

:root[data-theme="dark"] {
  --accent-soft: #28212e;
}

.site-shell {
  width: min(calc(100% - 3rem), var(--blog-width));
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: 2rem 0 2.25rem;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1.35rem;
  border-bottom: 1px solid var(--line);
}

.site-brand {
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 620;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.site-brand span {
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.site-nav a {
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--text);
}

.site-nav a.is-active {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 0.11em;
  text-underline-offset: 0.35em;
}

.blog-page {
  padding: clamp(4.5rem, 10vw, 8rem) 0 4rem;
}

.blog-intro {
  max-width: 43rem;
  padding-left: clamp(1.15rem, 3vw, 1.75rem);
  border-left: 2px solid var(--accent);
}

.eyebrow {
  margin: 0 0 1.2rem;
  color: var(--accent);
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
}

.blog-intro h1 {
  max-width: 14ch;
  margin: 0;
  font-size: clamp(1.9rem, 5.5vw, 3.45rem);
  font-weight: 560;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.blog-intro > p:last-child {
  max-width: 38rem;
  margin: 1.6rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.9;
}

.post-list {
  margin-top: clamp(4.5rem, 10vw, 7.5rem);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 0.8rem;
}

.section-heading h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 620;
}

.section-heading span {
  color: var(--muted);
  font-size: 0.78rem;
}

.post-card {
  padding: 1.7rem 0 1.8rem;
  border-top: 1px solid var(--line);
}

.post-card:last-child {
  border-bottom: 1px solid var(--line);
}

.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.post-card h3 {
  max-width: 38rem;
  margin: 0.65rem 0 0.5rem;
  font-size: clamp(1.28rem, 3vw, 1.55rem);
  font-weight: 580;
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.post-card h3 a {
  text-decoration: none;
}

.post-card h3 a:hover {
  color: var(--accent);
}

.post-card p {
  max-width: 39rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.8;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.05rem;
}

.post-tags span {
  padding: 0.18rem 0.52rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.3;
}

.empty-state {
  margin: 0;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.post-page {
  width: min(100%, var(--article-width));
  margin: 0 auto;
  padding: clamp(4rem, 9vw, 7rem) 0 4rem;
}

.back-link,
.post-navigation a {
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
}

.back-link:hover,
.post-navigation a:hover {
  color: var(--text);
}

.post-header {
  margin-top: 2.5rem;
  padding-bottom: 2.25rem;
  border-bottom: 1px solid var(--line);
}

.post-header h1 {
  margin: 1.1rem 0 0;
  font-size: clamp(2.25rem, 6vw, 4rem);
  font-weight: 560;
  letter-spacing: -0.045em;
  line-height: 1.1;
}

.post-summary {
  max-width: 38rem;
  margin: 1.2rem 0 0;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.85;
}

.post-content {
  padding-top: 2.6rem;
  font-family:
    "Noto Serif CJK SC",
    "Source Han Serif SC",
    "Songti SC",
    "STSong",
    serif;
  font-size: 1.02rem;
  line-height: 2;
}

.post-content > :first-child {
  margin-top: 0;
}

.post-content h2,
.post-content h3 {
  margin: 2.7rem 0 0.9rem;
  font-family:
    "MiSans VF",
    "MiSans",
    "Noto Sans CJK SC",
    "Source Han Sans SC",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  font-weight: 620;
  letter-spacing: -0.025em;
  line-height: 1.35;
}

.post-content h2 {
  font-size: 1.45rem;
}

.post-content h3 {
  font-size: 1.18rem;
}

.post-content p {
  margin: 1.15rem 0;
}

.post-content a {
  color: var(--accent);
}

.post-content ul,
.post-content ol {
  margin: 1.2rem 0;
  padding-left: 1.5rem;
}

.post-content li + li {
  margin-top: 0.35rem;
}

.post-content blockquote {
  margin: 1.8rem 0;
  padding: 0.2rem 1.25rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}

.post-content blockquote p {
  margin: 0;
}

.post-content hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.post-content code {
  padding: 0.12em 0.32em;
  border-radius: 0.25rem;
  background: var(--accent-soft);
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82em;
}

.post-content pre {
  overflow-x: auto;
  margin: 1.7rem 0;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--surface);
  line-height: 1.65;
}

.post-content pre code {
  padding: 0;
  background: none;
  font-size: 0.8rem;
}

.post-navigation {
  margin-top: 3rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family:
    "Yu Mincho",
    "Hiragino Mincho ProN",
    "Noto Serif CJK JP",
    "Source Han Serif JP",
    serif;
  font-size: 0.78rem;
  line-height: 1.7;
}

.site-footer a {
  font-family:
    "MiSans VF",
    "MiSans",
    "Noto Sans CJK SC",
    "Source Han Sans SC",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  text-decoration: none;
}

@media (max-width: 40rem) {
  .site-shell {
    width: calc(100% - 3rem);
    padding-top: 1.5rem;
  }

  .site-header {
    align-items: flex-start;
  }

  .site-brand {
    max-width: 12rem;
    line-height: 1.5;
  }

  .site-brand span {
    display: block;
  }

  .site-nav {
    flex: 0 0 auto;
    padding-top: 0.2rem;
  }

  .blog-page {
    padding-top: 4.5rem;
  }

  .blog-intro h1 {
    font-size: clamp(1.9rem, 10vw, 2.75rem);
  }

  .post-page {
    padding-top: 4rem;
  }

  .post-header {
    margin-top: 2.25rem;
  }

  .post-header h1 {
    font-size: clamp(2.15rem, 11vw, 3rem);
  }

  .post-content {
    font-size: 0.98rem;
  }

  .site-footer {
    margin-top: 1rem;
  }
}
