:root {
  color-scheme: light;
  --paper: #ffffff;
  --sheet: #ffffff;
  --ink: #1f1f1f;
  --muted: #6f6f6f;
  --faint: #e9e9e9;
  --line: #d8d8d8;
  --green: #366f60;
  --red: #9b4b3d;
  --blue: #42657f;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(31, 31, 31, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 31, 31, 0.014) 1px, transparent 1px),
    var(--paper);
  background-size: 42px 42px, 42px 42px, auto;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

.page-grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.16;
  background-image:
    radial-gradient(rgba(31, 31, 31, 0.14) 0.55px, transparent 0.55px);
  background-size: 5px 5px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--faint);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.brand,
.topnav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  text-decoration: none;
  font-family: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
  font-size: 20px;
  letter-spacing: 0;
}

.brand-logo {
  width: 34px;
  height: 34px;
  display: block;
}

.topnav a {
  min-width: 64px;
  padding: 8px 0;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
}

.topnav a:hover {
  color: var(--ink);
}

.shell {
  width: min(1240px, calc(100% - 36px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 48px;
  align-items: end;
  min-height: 520px;
  padding: 72px 0 46px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--green);
  font-family: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
  font-size: 18px;
}

.hero h1 {
  max-width: 780px;
  margin: 0;
  font-family: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
  font-size: 82px;
  line-height: 0.93;
  font-weight: 500;
  letter-spacing: 0;
}

.hero-line {
  max-width: 620px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 22px;
}

.hero-note {
  border-left: 1px solid var(--line);
  padding: 20px 0 4px 24px;
}

.hero-note p {
  margin: 0 0 28px;
  font-family: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
  font-size: 28px;
  line-height: 1.35;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0;
}

.stats div {
  border-top: 1px solid var(--faint);
  padding-top: 8px;
}

.stats dt {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.stats dd {
  margin: 2px 0 0;
  color: var(--red);
  font-family: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
  font-size: 26px;
}

.control-band {
  position: sticky;
  top: 64px;
  z-index: 9;
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--faint);
  border-bottom: 1px solid var(--faint);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.search-wrap {
  display: grid;
  gap: 6px;
}

.search-wrap label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.search-wrap input {
  width: 100%;
  height: 44px;
  border: 1px solid #cfcfcf;
  border-radius: 0;
  padding: 0 14px;
  color: var(--ink);
  background: var(--sheet);
  outline: none;
}

.search-wrap input:focus {
  box-shadow: 0 0 0 3px rgba(54, 111, 96, 0.12);
}

.tag-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow: visible;
  padding: 2px 0;
  scrollbar-width: thin;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 72px;
  height: 38px;
  border: 1px solid #cfcfcf;
  border-radius: 999px;
  padding: 0 13px;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}

.tag-chip small {
  color: var(--muted);
}

.tag-chip:hover,
.tag-chip.is-active {
  color: var(--sheet);
  background: var(--ink);
}

.tag-chip:hover small,
.tag-chip.is-active small {
  color: rgba(255, 253, 247, 0.72);
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 14px;
}

.results-head p {
  margin: 0;
  color: var(--muted);
}

.text-button {
  min-width: 72px;
  height: 34px;
  border: 1px solid #cfcfcf;
  background: transparent;
  cursor: pointer;
}

.text-button[hidden] {
  display: none;
}

.masonry {
  columns: 4 260px;
  column-gap: 18px;
  padding-bottom: 80px;
}

.note-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 18px;
  break-inside: avoid;
  animation: cardIn 520ms ease both;
  animation-delay: var(--delay);
}

.card-button {
  width: 100%;
  border: 1px solid #dddddd;
  border-radius: 6px;
  padding: 0;
  overflow: hidden;
  background: var(--sheet);
  box-shadow: none;
  cursor: pointer;
  text-align: left;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.card-button:hover {
  transform: translateY(-2px);
  border-color: #bdbdbd;
  box-shadow: var(--shadow);
}

.card-media {
  background: #ffffff;
  border-bottom: 1px solid #eeeeee;
}

.card-image {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.text-cover {
  min-height: 138px;
  display: flex;
  align-items: center;
  padding: 22px;
  font-family: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
  font-size: 25px;
  line-height: 1.35;
  color: rgba(29, 27, 22, 0.74);
}

.video-cover {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-family: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
  font-size: 24px;
}

.card-body {
  padding: 16px 16px 18px;
}

.card-meta {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.card-body h2 {
  margin: 0 0 8px;
  font-family: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 500;
}

.card-body p {
  margin: 0;
  color: #464035;
  font-size: 15px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.mini-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid #e2e2e2;
  padding: 1px 8px;
  color: var(--muted);
  font-size: 12px;
}

.reader {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
}

.reader.is-open {
  display: block;
}

.reader-open {
  overflow: hidden;
}

.reader-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
}

.reader-sheet {
  position: absolute;
  inset: 22px;
  overflow: auto;
  width: min(920px, calc(100% - 44px));
  margin: 0 auto;
  border: 1px solid #d6d6d6;
  border-radius: 8px;
  background: var(--sheet);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
}

.reader-close {
  position: sticky;
  top: 16px;
  float: right;
  z-index: 2;
  width: 42px;
  height: 42px;
  margin: 16px 16px 0 0;
  border: 1px solid #cfcfcf;
  border-radius: 50%;
  background: var(--sheet);
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

.reader-header,
.reader-body {
  width: min(720px, calc(100% - 48px));
  margin: 0 auto;
}

.reader-header {
  padding: 76px 0 22px;
  border-bottom: 1px solid var(--faint);
}

.reader-header h2 {
  margin: 0;
  font-family: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
  font-size: 46px;
  line-height: 1.15;
  font-weight: 500;
}

.reader-body {
  padding: 26px 0 70px;
  color: #302c25;
  font-size: 18px;
  line-height: 1.9;
}

.reader-body p,
.reader-body ul,
.reader-body ol,
.reader-body blockquote {
  margin: 0 0 22px;
}

.reader-body h3,
.reader-body h4,
.reader-body h5 {
  margin: 34px 0 12px;
  font-family: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
  font-weight: 500;
}

.reader-body blockquote {
  border-left: 2px solid var(--green);
  padding-left: 18px;
  color: var(--muted);
}

.reader-body a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.reader-body code {
  border: 1px solid #e2e2e2;
  padding: 1px 5px;
  background: #fafafa;
}

.note-media {
  margin: 30px 0;
  border: 1px solid #e6e6e6;
  background: #ffffff;
}

.note-media img,
.note-media video {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1px solid rgba(45, 41, 32, 0.28);
  background: rgba(255, 253, 247, 0.6);
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .topbar {
    padding: 0 18px;
  }

  .topnav {
    display: none;
  }

  .shell {
    width: min(100% - 28px, 680px);
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 30px;
    min-height: 0;
    padding: 50px 0 34px;
  }

  .hero h1 {
    font-size: 52px;
  }

  .hero-line {
    font-size: 18px;
  }

  .hero-note p {
    font-size: 24px;
  }

  .control-band {
    position: static;
    grid-template-columns: 1fr;
  }

  .tag-rail {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .masonry {
    columns: 1;
  }

  .reader-sheet {
    inset: 10px;
    width: calc(100% - 20px);
  }

  .reader-header,
  .reader-body {
    width: calc(100% - 34px);
  }

  .reader-header h2 {
    font-size: 34px;
  }

  .reader-body {
    font-size: 16px;
  }
}
