:root {
  --ink: #141414;
  --paper: #f3f3ef;
  --panel: #fafaf7;
  --muted: #666660;
  --line: #c8c8c1;
  --accent: #9f1f18;
  --green: #244d3b;
  --font-sans: "Noto Sans SC", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  --font-display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: var(--font-sans);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  letter-spacing: 0;
  --scroll-progress: 0%;
}

body::before {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 20;
  width: var(--scroll-progress);
  height: 3px;
  content: "";
  background: var(--accent);
  pointer-events: none;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.masthead {
  position: relative;
  min-height: 52vh;
  overflow: hidden;
  color: #ffffff;
  isolation: isolate;
}

.masthead-media,
.masthead-scrim {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
}

.masthead-media {
  inset: -24px 0;
  height: calc(100% + 48px);
  object-fit: cover;
  object-position: center 58%;
  scale: 1.035;
  transform: translate3d(0, var(--masthead-shift, 0), 0);
  will-change: transform, scale;
  animation: masthead-media-settle 2200ms var(--ease-out) forwards;
}

.masthead-scrim {
  z-index: -1;
  background: linear-gradient(90deg, rgba(10, 10, 10, 0.82), rgba(10, 10, 10, 0.2) 62%, rgba(10, 10, 10, 0.45));
  animation: masthead-scrim-in 1200ms ease-out both;
}

.masthead nav,
.masthead-copy,
main {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.masthead nav {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.38);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  animation: masthead-item-in 720ms 100ms var(--ease-out) both;
}

.brand {
  text-decoration: none;
}

.masthead-copy {
  padding: clamp(72px, 11vh, 128px) 0 58px;
}

.masthead-copy > * {
  animation: masthead-item-in 820ms var(--ease-out) both;
}

.masthead-copy > :nth-child(1) {
  animation-delay: 180ms;
}

.masthead-copy > :nth-child(2) {
  animation-delay: 260ms;
}

.masthead-copy > :nth-child(3) {
  animation-delay: 340ms;
}

.eyebrow,
.section-heading p {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.masthead h1 {
  margin: 18px 0 14px;
  font-family: var(--font-display);
  font-size: clamp(46px, 6vw, 82px);
  font-weight: 500;
  line-height: 1.08;
}

.masthead-copy > p:last-child {
  margin: 0;
  font-size: clamp(16px, 2vw, 23px);
}

main {
  padding: 0 0 100px;
}

.notice {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 28px;
  padding: 34px 0;
  border-bottom: 1px solid var(--line);
}

.notice strong {
  color: var(--accent);
  font-size: 13px;
}

.notice p {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.study-controls {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  padding: 40px 0 28px;
}

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.tab {
  min-height: 38px;
  padding: 0 15px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease;
}

.tab.is-active {
  color: #ffffff;
  background: var(--ink);
}

.search {
  display: grid;
  gap: 8px;
  width: min(360px, 100%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
}

.search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.view {
  padding-top: 44px;
}

.section-heading {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 28px;
  align-items: baseline;
  margin-bottom: 30px;
}

.section-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(32px, 4.4vw, 52px);
  font-weight: 500;
}

.chapter {
  display: grid;
  grid-template-columns: 90px minmax(260px, 0.75fr) minmax(360px, 1.25fr);
  gap: 26px;
  padding: 30px 0 34px;
  border-top: 1px solid var(--line);
}

.chapter-link {
  position: relative;
  color: inherit;
  text-decoration: none;
  transition:
    color 180ms ease,
    border-color 180ms ease,
    transform 240ms var(--ease-out);
}

.chapter-link::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  content: "";
  background: var(--accent);
  scale: 0 1;
  transform-origin: left;
  transition: scale 280ms var(--ease-out);
}

.chapter-link:hover,
.chapter-link:focus-visible {
  color: var(--green);
  outline: none;
  transform: translate3d(6px, 0, 0);
}

.chapter-link:hover::after,
.chapter-link:focus-visible::after {
  scale: 1 1;
}

.chapter-number {
  color: var(--accent);
  font-size: 28px;
  font-weight: 300;
}

.chapter-title h3 {
  margin: 0 0 8px;
  font-size: 21px;
  line-height: 1.35;
}

.chapter-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.chapter-detail > p {
  margin: 0 0 20px;
  line-height: 1.75;
}

.focus-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.focus-list li {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 12px;
}

.exam {
  margin: 0;
  padding-left: 14px;
  color: var(--accent);
  border-left: 3px solid var(--accent);
  font-size: 13px;
  line-height: 1.7;
}

.chapter-action {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-top: 22px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.chapter-action span {
  transition: transform 180ms ease;
}

.chapter-link:hover .chapter-action span,
.chapter-link:focus-visible .chapter-action span {
  transform: translateX(4px);
}

.term-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.term-item {
  min-height: 120px;
  padding: 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.term-item strong {
  display: block;
  margin-bottom: 9px;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 5px;
}

.term-item span {
  color: var(--muted);
}

.term-item small {
  display: block;
  margin-top: 18px;
  color: var(--green);
}

.research-item {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) minmax(260px, 0.65fr);
  gap: 26px;
  padding: 26px 0;
  border-top: 1px solid var(--line);
}

.research-item .chapter-tag {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.research-item h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.45;
}

.research-item h3 a {
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.research-item .citation,
.research-item .annotation {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

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

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px max(24px, calc((100vw - 1180px) / 2));
  color: #d8d8d2;
  background: var(--ink);
  font-size: 12px;
}

footer a {
  text-decoration: none;
}

body.motion-ready [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
}

body.motion-ready [data-reveal].is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition:
    opacity 720ms var(--ease-out),
    transform 720ms var(--ease-out);
  transition-delay: min(calc(var(--reveal-order, 0) * 45ms), 270ms);
}

@keyframes masthead-media-settle {
  to {
    scale: 1;
  }
}

@keyframes masthead-scrim-in {
  from {
    opacity: 0.35;
  }
}

@keyframes masthead-item-in {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
  }
}

@media (max-width: 840px) {
  .masthead nav,
  .masthead-copy,
  main {
    width: min(100% - 32px, 720px);
  }

  .masthead {
    min-height: 48vh;
  }

  .masthead-media {
    object-position: 68% center;
  }

  .notice,
  .section-heading,
  .chapter,
  .research-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .study-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .tab {
    padding: 0 8px;
  }

  .search {
    width: 100%;
  }

  .chapter-number {
    font-size: 20px;
  }

  .chapter-link:hover,
  .chapter-link:focus-visible {
    transform: none;
  }

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

@media (max-width: 520px) {
  .masthead nav {
    font-size: 10px;
  }

  .masthead h1 {
    font-size: clamp(42px, 12vw, 58px);
  }

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

  footer {
    flex-direction: column;
  }
}

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

  .masthead-media,
  .masthead-scrim,
  .masthead nav,
  .masthead-copy > *,
  body.motion-ready [data-reveal] {
    opacity: 1;
    scale: 1;
    transform: none;
    animation: none;
    transition: none;
  }
}
