:root {
  --paper: #f3efe6;
  --ink: #1c1916;
  --muted: #6f675c;
  --line: #d9d1c4;
  --photo: #e6dfd2;
  --accent: #8d342c;
  --measure: 1080px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

.mast {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.mast-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 16px 32px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
}

.kicker {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.28em;
}

h1 {
  margin: 2px 0 0;
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
  font-size: 40px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.05;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 16px 32px 0;
}

.switches {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px 12px;
}

.filters {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 18px;
  margin-left: auto;
}

.filter-tags-wrap {
  position: relative;
  flex: 1 0 100%;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.filter-tags-wrap.has-more::after,
.filter-tags-wrap.has-before::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 2px;
  z-index: 1;
  width: 40px;
  pointer-events: none;
}

.filter-tags-wrap.has-more::after {
  right: 0;
  background: linear-gradient(to right, transparent, var(--paper));
}

.filter-tags-wrap.has-before::before {
  left: 0;
  background: linear-gradient(to left, transparent, var(--paper));
}

.filter-tags {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0 8px;
  scrollbar-width: none;
}

.filter-tags.is-scrolling {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.filter-tags::-webkit-scrollbar {
  height: 2px;
}

.filter-tags::-webkit-scrollbar-track {
  background: transparent;
}

.filter-tags::-webkit-scrollbar-thumb {
  background: transparent;
  border: 0;
}

.filter-tags.is-scrolling::-webkit-scrollbar-thumb {
  background: var(--line);
}

.filter-tag {
  flex: 0 0 auto;
  padding: 4px 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.filter-tag .count {
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

.filter-tag.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.filter-tag:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.06em;
}

.filter select {
  min-width: 8.5em;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  letter-spacing: 0.04em;
}

.filter select:disabled {
  color: var(--muted);
}

.filter select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0.08em;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.switch-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 32px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink);
  transform: translateY(-50%);
}

.switch input:checked + .switch-track {
  background: var(--ink);
  color: var(--paper);
}

.switch input:checked + .switch-track::after {
  left: auto;
  right: 5px;
  background: var(--paper);
  transform: translateY(-50%);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

main {
  padding-top: calc(var(--mast-h, 92px) + 8px);
}

.lede {
  max-width: 38em;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.timeline {
  list-style: none;
  max-width: var(--measure);
  margin: 8px auto 0;
  padding: 12px 32px 0;
}

.node {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  column-gap: 28px;
}

.node.is-new-year:not(:first-child) .time,
.node.is-new-year:not(:first-child) .person {
  padding-top: 28px;
}

.node.is-new-year:not(:first-child) .dot {
  top: 42px;
}

.time {
  position: relative;
  min-height: 100%;
  padding-top: 6px;
}

.time::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 86px;
  width: 1px;
  background: var(--line);
}

.node:first-child .time::before {
  top: 18px;
}

.node:last-child .time::before {
  bottom: auto;
  height: 22px;
}

.node.is-new-year:last-child .time::before {
  height: 50px;
}

.year {
  display: block;
  width: 72px;
  margin-top: 2px;
  color: var(--ink);
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.year.is-repeat {
  display: none;
}

.dot {
  position: absolute;
  top: 14px;
  left: 82px;
  width: 9px;
  height: 9px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
}

.node.is-new-year .dot {
  background: var(--accent);
  border-color: var(--accent);
}

.person {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 22px 28px;
  padding: 0 0 36px;
  border-bottom: 1px solid transparent;
}

.photos {
  display: flex;
  gap: 8px;
}

.photos.pair .shot {
  width: 60px;
}

.shot {
  position: relative;
  width: 112px;
  height: 140px;
  overflow: hidden;
  background: var(--photo);
}

.shot img,
.monogram {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.shot img {
  object-fit: cover;
  object-position: center 18%;
}

.monogram {
  display: grid;
  place-items: center;
  color: var(--ink);
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-size: 40px;
}

.photos.pair .monogram {
  font-size: 28px;
}

.body h2 {
  margin: 0;
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.25;
}

.headline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 20px;
}

.birth,
.field {
  color: var(--ink);
  font-size: 15px;
  letter-spacing: 0.06em;
  line-height: 1.4;
}

.birth {
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
  font-variant-numeric: tabular-nums;
}

.birth.is-active,
.achievement.is-active {
  color: var(--accent);
}

.meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.achievement {
  margin: 4px 0 10px;
  color: var(--ink);
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.deed {
  margin: 0;
  max-width: 40em;
  font-size: 16px;
  line-height: 1.75;
}

.sentinel {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 8px 32px 72px 192px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.08em;
}

.sentinel.is-end {
  color: var(--ink);
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-size: 18px;
  letter-spacing: 0.06em;
}

@media (max-width: 720px) {
  .mast-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 20px 12px;
  }

  h1 {
    font-size: 32px;
  }

  .toolbar {
    width: auto;
    padding: 14px 20px 0;
  }

  .filters {
    gap: 8px 12px;
  }

  .filter select {
    min-width: 6.2em;
    max-width: 9.5em;
  }

  .timeline {
    padding: 8px 20px 0;
  }

  .node {
    grid-template-columns: 72px minmax(0, 1fr);
    column-gap: 14px;
  }

  .year {
    width: 52px;
    font-size: 16px;
  }

  .time::before {
    left: 56px;
  }

  .dot {
    left: 52px;
  }

  .person {
    grid-template-columns: 1fr;
    gap: 14px;
    padding-bottom: 28px;
  }

  .shot,
  .photos.pair .shot {
    width: 96px;
    height: 120px;
  }

  .body h2 {
    font-size: 24px;
  }

  .sentinel {
    padding: 4px 20px 56px 20px;
  }
}

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

  .switch-track::after {
    transition: none;
  }
}
