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

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  font-family: "Newsreader", "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 1.125rem;
  line-height: 1.6;
  font-optical-sizing: auto;
}

body[data-surface="green"] {
  background: #f4f7f2;
  color: #1e3324;
  --line: #c5d4c2;
  --paper: #f4f7f2;
  --footer: #d3e2d1;
  --footer-text: #1e3324;
}

body[data-surface="sand"] {
  background: #f3ebe3;
  color: #3d291c;
  --line: #e0d2c4;
  --paper: #f3ebe3;
  --footer: #6e2f2c;
  --footer-text: #f3ebe3;
}

a {
  color: #9c4030;
  text-underline-offset: 0.18em;
}

a:focus-visible {
  outline: 1px solid #9c4030;
  outline-offset: 3px;
}

.page {
  flex: 1 0 auto;
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
}

.site-footer {
  background: var(--footer);
  color: var(--footer-text);
}

.site-footer p {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.15rem 1.5rem 1.4rem;
  font-size: 0.95rem;
}

.bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1.25rem;
  margin-bottom: 2.25rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
  font-family: "Source Serif 4", Charter, "Iowan Old Style", Georgia, serif;
  font-size: 1rem;
  line-height: 1.4;
}

.bar-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem 1.25rem;
  margin-left: auto;
}

.lang {
  display: flex;
  gap: 0.55rem;
}

.lang button {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.lang button[aria-pressed="true"] {
  color: #9c4030;
  border-bottom: 1px solid #9c4030;
}

.mark {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.sections {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

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

.sections a[aria-current="page"] {
  color: #9c4030;
  border-bottom: 1px solid #9c4030;
}

.menu {
  position: relative;
}

.dropdown {
  display: none;
  position: absolute;
  z-index: 3;
  top: 100%;
  left: 0;
  min-width: 12rem;
  padding: 0.45rem 0.8rem 0.6rem;
  background: var(--paper);
  border: 1px solid var(--line);
}

.dropdown a {
  padding: 0.18rem 0;
}

.menu:hover > .dropdown,
.menu:focus-within > .dropdown,
.menu.is-open > .dropdown {
  display: flex;
  flex-direction: column;
}

html[lang="zh-Hans"] .lang-en { display: none; }
html:not([lang="zh-Hans"]) .lang-zh { display: none; }

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

.reading .video {
  width: 100%;
  aspect-ratio: 16 / 9;
}

.reading .video iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.split {
  display: grid;
  grid-template-columns: 16.5rem minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.tree {
  font-family: "Source Serif 4", Charter, "Iowan Old Style", Georgia, serif;
  font-size: 1rem;
}

.tree ul {
  margin: 0;
  padding: 0;
}

.tree li {
  margin: 0.15rem 0;
}

.tree ul ul {
  margin-left: 0.85rem;
}

.tree-row {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

button.tree-row {
  width: 100%;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0.15rem 0;
  text-align: left;
  cursor: pointer;
}

button.tree-row::after {
  content: "▸";
  font-size: 0.75rem;
}

button.tree-row[aria-expanded="true"]::after {
  content: "▾";
}

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

.tree a[aria-current="page"] {
  color: #9c4030;
}

h1,
h2,
h3 {
  font-family: "Source Serif 4", Charter, "Iowan Old Style", Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h1 {
  margin: 0 0 1rem;
  font-size: 2rem;
}

h2 {
  margin: 1.6rem 0 0.4rem;
  font-size: 1.25rem;
}

h3 {
  margin: 1.1rem 0 0.15rem;
  font-size: 1.05rem;
}

p {
  margin: 0 0 0.75rem;
}

.intro {
  display: grid;
  grid-template-columns: 5.25rem 1fr;
  gap: 0.35rem 1.1rem;
  align-items: start;
  margin-bottom: 1.15rem;
}

.intro img {
  width: 5.25rem;
  height: 6.4rem;
  object-fit: cover;
  object-position: center 18%;
}

.role,
.meta {
  margin: 0;
}

.contact {
  margin: 0.7rem 0 0;
}

.contact a {
  text-decoration: none;
  border-bottom: 1px solid #9c4030;
}

hr {
  border: 0;
  border-top: 1px dashed var(--line);
  margin: 1.8rem 0 0.2rem;
}

ul {
  margin: 0.2rem 0 0.4rem;
  padding: 0;
  list-style: none;
}

li {
  margin: 0.2rem 0;
}

.entry {
  margin: 1.15rem 0 0;
}

.entry h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
}

.entry a {
  color: inherit;
  text-decoration-color: #9c4030;
}

.paper h1 {
  font-size: 1.7rem;
}

@media (max-width: 640px) {
  .page {
    padding: 1.2rem 1.05rem 3rem;
  }

  h1 {
    font-size: 1.7rem;
  }

  .paper h1 {
    font-size: 1.45rem;
  }

  .intro {
    grid-template-columns: 1fr;
  }

  .intro img {
    width: 4.5rem;
    height: 5.5rem;
  }

  .site-footer p {
    padding: 1rem 1.05rem 1.2rem;
  }

  .split {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}
