:root {
  color-scheme: light dark;
  --bg: #fcfbf8;
  --text: #181816;
  --muted: #6f6c64;
  --line: #ded9cf;
  --accent: #345e57;
  --paper: #fffefa;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514;
    --text: #efede7;
    --muted: #aaa59a;
    --line: #3a3934;
    --accent: #91cabe;
    --paper: #1b1b19;
  }
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--accent), transparent 25%);
  text-underline-offset: 0.22em;
}

a:hover {
  color: var(--accent);
}

.site-header,
.site-footer,
main {
  width: min(720px, calc(100% - 40px));
  margin: 0 auto;
}

main {
  flex: 1;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 34px 0 22px;
}

.brand {
  display: inline-block;
  cursor: default;
  transform-origin: 70% 70%;
}

.plain-home {
  text-decoration: none;
}

.brand:hover {
  animation: wave 0.72s ease-in-out;
}

@keyframes wave {
  0%,
  100% {
    transform: rotate(0deg);
  }

  20% {
    transform: rotate(16deg);
  }

  40% {
    transform: rotate(-10deg);
  }

  60% {
    transform: rotate(12deg);
  }

  80% {
    transform: rotate(-6deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand:hover {
    animation: none;
  }
}

.language-state {
  position: fixed;
  inset: auto auto 100% 100%;
  opacity: 0;
  pointer-events: none;
}

.language-switch {
  display: flex;
  gap: 6px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
}

.language-switch label {
  cursor: pointer;
}

.language-switch label:hover {
  color: var(--accent);
}

[data-lang="zh"] {
  display: none;
}

#lang-zh:checked ~ header [data-lang="en"],
#lang-zh:checked ~ main [data-lang="en"],
#lang-zh:checked ~ footer [data-lang="en"] {
  display: none;
}

#lang-zh:checked ~ header [data-lang="zh"],
#lang-zh:checked ~ main [data-lang="zh"],
#lang-zh:checked ~ footer [data-lang="zh"] {
  display: revert;
}

#lang-en:checked ~ .site-header .language-switch label[for="lang-en"],
#lang-zh:checked ~ .site-header .language-switch label[for="lang-zh"] {
  color: var(--text);
}

.hero {
  padding: 96px 0 28px;
}

.eyebrow,
.essay-links,
.site-footer,
.link-list small {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.eyebrow,
.site-footer,
.link-list small {
  font-size: 0.82rem;
}

.essay-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 18px 0 0;
  color: color-mix(in srgb, var(--muted), transparent 22%);
  font-size: 0.78rem;
  line-height: 1.5;
}

.link-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 0 0 66px;
  border: 1px solid var(--line);
  background: var(--line);
}

.link-list a {
  display: grid;
  min-height: 96px;
  align-content: space-between;
  padding: 14px;
  background: var(--paper);
  text-decoration: none;
}

.link-list span {
  font-style: italic;
}

.link-list small {
  display: block;
  line-height: 1.35;
}

.page {
  padding: 88px 0 56px;
}

.text-page,
.now-page {
  max-width: 620px;
}

.text-page h1,
.text-page h2,
.now-page h1,
.now-page h2 {
  margin: 0;
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: 0;
}

.text-page h1,
.now-page h1 {
  margin-top: 16px;
  font-size: clamp(2.6rem, 9vw, 5.2rem);
}

.text-page h2,
.now-page h2 {
  margin-top: 2.2em;
  font-size: 1.35rem;
}

.text-page p,
.text-page ul,
.now-page p,
.now-page ul {
  margin: 1.2em 0 0;
}

.text-page ul,
.now-page ul {
  padding-left: 1.2em;
}

.plain-links {
  list-style: none;
  padding-left: 0;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  padding: 30px 0 50px;
  border-top: 1px solid var(--line);
}

@media (max-width: 680px) {
  body {
    font-size: 17px;
  }

  .site-header {
    padding-top: 28px;
  }

  .hero {
    padding-top: 66px;
  }

  .page {
    padding-top: 56px;
  }

  .link-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 430px) {
  .site-header,
  .site-footer,
  main {
    width: min(100% - 28px, 720px);
  }

  .link-list {
    grid-template-columns: 1fr;
  }
}
