:root {
  --parchment: #f5f4ed;
  --ivory: #faf9f5;
  --warm-sand: #e8e6dc;
  --brand: #1b365d;
  --brand-light: #2d5a8a;
  --brand-tint: #eef2f7;
  --near-black: #141413;
  --dark-warm: #3d3d3a;
  --olive: #504e49;
  --stone: #6b6a64;
  --border: #e8e6dc;
  --border-soft: #e5e3d8;
  --serif: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC", Georgia, serif;
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --content: 1120px;
  --radius-card: 16px;
  --radius-control: 8px;
}

@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: page-out 240ms ease both;
}

::view-transition-new(root) {
  animation: page-in 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  background: var(--parchment);
  scroll-behavior: smooth;
}

body {
  min-height: 100svh;
  margin: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--parchment);
  color: var(--near-black);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.js [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 720ms cubic-bezier(0.16, 1, 0.3, 1), transform 720ms cubic-bezier(0.16, 1, 0.3, 1);
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
}

::selection {
  background: var(--brand-tint);
  color: var(--brand);
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 30;
  padding: 8px 14px;
  transform: translateY(-160%);
  background: var(--brand);
  color: var(--ivory);
  border-radius: 4px;
  font-family: var(--ui);
  font-size: 13px;
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  max-width: calc(var(--content) + 128px);
  margin: 0 auto;
  padding: 20px 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--parchment);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--near-black);
  text-decoration: none;
  font-size: 21px;
  font-weight: 500;
  letter-spacing: 0.12em;
}

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 7px;
  mix-blend-mode: multiply;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 26px;
  font-family: var(--ui);
  font-size: 14px;
  letter-spacing: 0.05em;
}

.site-nav a {
  position: relative;
  padding: 8px 0;
  color: var(--olive);
  text-decoration: none;
}

.site-nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  height: 1px;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 220ms ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--brand);
}

.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after {
  transform: scaleX(1);
  transform-origin: left;
}

.page-shell {
  min-width: 0;
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: 72px 64px 112px;
}

.site-footer {
  width: 100%;
  max-width: calc(var(--content) + 128px);
  margin: 0 auto;
  padding: 28px 64px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--border);
  color: var(--stone);
  font-size: 13px;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--brand);
}

.site-footer-simple p:last-child {
  font-style: italic;
}

.kicker,
.section-note {
  margin: 0 0 16px;
  color: var(--brand);
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
}

.hero {
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  align-items: center;
  gap: 40px;
}

.hero-copy {
  padding-bottom: 24px;
  animation: rise-in 720ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero h1 {
  margin: 0;
  max-width: 680px;
  font-size: clamp(58px, 7.2vw, 88px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: 0.03em;
  text-wrap: balance;
}

.hero h1 span {
  color: var(--brand);
}

.hero-lede {
  max-width: 620px;
  margin: 28px 0 32px;
  color: var(--olive);
  font-size: 19px;
  line-height: 1.75;
}

.search-bar {
  width: min(100%, 620px);
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 6px;
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(20, 20, 19, 0.04);
}

.search-bar:focus-within {
  box-shadow: 0 0 0 2px var(--brand-tint);
}

.search-bar input {
  min-width: 0;
  padding: 12px 18px;
  background: transparent;
  color: var(--near-black);
  border: 0;
  outline: 0;
}

.search-bar input::placeholder,
.query-field input::placeholder {
  color: #76736b;
}

.search-bar button,
.search-panel > button {
  min-height: 46px;
  padding: 10px 24px;
  background: var(--brand);
  color: var(--ivory);
  border: 1px solid var(--brand);
  border-radius: 999px;
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 500;
  transition: background-color 180ms ease, transform 180ms ease;
}

.search-bar button:hover,
.search-panel > button:hover,
.action-button-primary:hover {
  background: var(--brand-light);
  transform: translateY(-1px);
}

.hero-art {
  position: relative;
  min-height: 430px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--ivory);
  box-shadow: 0 18px 54px rgba(20, 20, 19, 0.06);
  isolation: isolate;
  animation: fade-in 900ms 120ms both;
}

.hero-art img {
  width: 100%;
  height: 100%;
  min-height: 430px;
  display: block;
  object-fit: cover;
  object-position: 58% center;
  mix-blend-mode: multiply;
  animation: ink-breathe 14s ease-in-out infinite alternate;
}

.hero-mist {
  position: absolute;
  z-index: 1;
  width: 58%;
  height: 30%;
  border-radius: 50%;
  background: var(--parchment);
  opacity: 0.16;
  pointer-events: none;
  animation: mist-drift 13s ease-in-out infinite alternate;
}

.mist-one {
  top: 18%;
  left: 4%;
}

.mist-two {
  right: -8%;
  bottom: 12%;
  animation-delay: -6s;
}

.discovery-ribbon {
  margin: 2px 0 72px;
  padding: 17px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 22px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--stone);
  font-family: var(--ui);
  font-size: 13px;
}

.discovery-ribbon > span {
  margin-right: 4px;
  letter-spacing: 0.08em;
}

.discovery-ribbon a {
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.discovery-ribbon a:hover {
  color: var(--brand-light);
  border-color: currentColor;
  transform: translateY(-1px);
}

.daily-section {
  padding-top: 72px;
  border-top: 1px solid var(--border);
}

.section-heading,
.results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.section-heading .section-note {
  margin-bottom: 6px;
}

.section-heading h2,
.results-head h2 {
  margin: 0;
  font-size: 34px;
  font-weight: 500;
  line-height: 1.25;
}

.text-button {
  padding: 8px 0;
  background: transparent;
  color: var(--brand);
  border: 0;
  border-bottom: 1px solid var(--brand);
  font-family: var(--ui);
  font-size: 13px;
}

.text-button:hover {
  color: var(--brand-light);
}

.featured-poem {
  min-height: 360px;
  padding: 58px 64px;
  display: grid;
  grid-template-columns: minmax(180px, 0.58fr) minmax(0, 1fr);
  gap: 72px;
  align-items: center;
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 12px 36px rgba(20, 20, 19, 0.04);
}

.featured-poem.is-loading,
.poem-reader.is-loading {
  display: grid;
  place-items: center;
}

.featured-poem.is-loading,
.feihua-poem.is-loading {
  grid-template-columns: 1fr;
}

.poem-heading h3,
.reader-heading h1 {
  margin: 0;
  font-weight: 500;
  line-height: 1.2;
  text-wrap: balance;
}

.poem-heading h3 {
  font-size: clamp(34px, 4vw, 52px);
}

.poem-meta {
  margin: 16px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--stone);
  font-family: var(--ui);
  font-size: 13px;
}

.poem-meta span:not(:last-child)::after {
  content: "·";
  margin-left: 12px;
  color: #aaa89f;
}

.poem-lines {
  display: grid;
  gap: 11px;
  color: var(--dark-warm);
  font-size: 22px;
  line-height: 1.75;
  letter-spacing: 0.1em;
}

.poem-lines p {
  margin: 0;
}

.poem-link {
  justify-self: start;
  margin-top: 22px;
  color: var(--brand);
  font-family: var(--ui);
  font-size: 13px;
}

.loading-line,
.error-message {
  margin: 0;
  color: var(--stone);
  font-size: 16px;
  text-align: center;
}

.loading-line {
  animation: loading-pulse 1.6s ease-in-out infinite;
}

.poem-skeleton {
  width: min(100%, 660px);
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.poem-skeleton span {
  width: var(--skeleton-width);
  height: 15px;
  display: block;
  border-radius: 999px;
  background: var(--warm-sand);
  animation: loading-pulse 1.6s ease-in-out infinite;
}

.poem-skeleton span:nth-child(even) {
  justify-self: end;
  animation-delay: -0.6s;
}

.error-message strong {
  display: block;
  margin-bottom: 8px;
  color: var(--near-black);
  font-size: 20px;
  font-weight: 500;
}

.stats-strip {
  margin-top: 28px;
  padding: 24px 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 28px;
  border-bottom: 1px solid var(--border);
  color: var(--stone);
}

.stats-strip > div {
  padding-right: 28px;
  border-right: 1px solid var(--border-soft);
}

.stats-strip strong {
  display: block;
  color: var(--brand);
  font-size: 24px;
  font-weight: 500;
  font-variant-numeric: lining-nums tabular-nums;
}

.stats-strip span {
  font-family: var(--ui);
  font-size: 12px;
}

.page-intro {
  max-width: 780px;
  margin-bottom: 48px;
}

.page-intro h1 {
  margin: 0;
  font-size: clamp(52px, 7vw, 76px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0.04em;
}

.page-intro > p:last-child,
.favorites-intro > div > p:last-child {
  max-width: 640px;
  margin: 20px 0 0;
  color: var(--olive);
  font-size: 17px;
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 136px 120px auto;
  gap: 14px;
  align-items: end;
  padding: 24px;
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 10px 30px rgba(20, 20, 19, 0.035);
}

.query-field,
.select-field {
  display: grid;
  gap: 7px;
}

.query-field label,
.select-field label {
  color: var(--stone);
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.query-field input,
.select-field select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  background: var(--parchment);
  color: var(--near-black);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  outline: 0;
}

.query-field input:focus,
.select-field select:focus {
  border-color: var(--brand);
}

.search-panel > button {
  border-radius: var(--radius-control);
}

.results-section {
  margin-top: 72px;
}

.results-head {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.results-head h2 {
  font-size: 28px;
}

.results-head p {
  margin: 0;
  color: var(--stone);
  font-family: var(--ui);
  font-size: 13px;
  font-variant-numeric: lining-nums tabular-nums;
}

.result-list {
  counter-reset: result;
}

.result-item {
  counter-increment: result;
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(180px, 0.45fr) minmax(0, 1fr) 18px;
  gap: 24px;
  align-items: center;
  padding: 28px 8px;
  color: var(--near-black);
  border-bottom: 1px solid var(--border-soft);
  text-decoration: none;
  transition: background-color 180ms ease, padding 180ms ease;
}

.result-item::before {
  content: counter(result, decimal-leading-zero);
  color: var(--stone);
  font-family: var(--ui);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.result-item:hover {
  padding-right: 14px;
  padding-left: 14px;
  background: var(--ivory);
}

.result-title {
  margin: 0;
  color: var(--brand);
  font-size: 23px;
  font-weight: 500;
  line-height: 1.35;
}

.result-meta {
  margin: 7px 0 0;
  color: var(--stone);
  font-family: var(--ui);
  font-size: 12px;
}

.result-excerpt {
  margin: 0;
  color: var(--olive);
  line-height: 1.75;
}

.result-arrow {
  color: var(--brand);
  font-family: var(--ui);
}

.empty-state {
  min-height: 320px;
  padding: 56px 20px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}

.empty-state .empty-mark {
  width: 72px;
  height: 72px;
  margin: 0 0 18px;
  display: grid;
  place-items: center;
  color: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 50%;
  font-size: 30px;
}

.empty-state h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 500;
}

.empty-state p:last-child {
  margin: 10px 0 0;
  color: var(--stone);
}

.pagination {
  margin-top: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pagination a,
.pagination span {
  min-height: 42px;
  padding: 9px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--ui);
  font-size: 13px;
  text-decoration: none;
}

.pagination a:hover {
  background: var(--brand-tint);
  border-color: var(--brand);
}

.pagination span {
  margin: 0 auto;
  color: var(--stone);
  border-color: transparent;
  font-variant-numeric: tabular-nums;
}

.pagination .page-control {
  margin: 0;
  color: #9a988f;
  border-color: var(--border);
  opacity: 0.62;
}

.reader-page {
  max-width: 920px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  font-family: var(--ui);
  font-size: 13px;
  text-decoration: none;
}

.poem-reader {
  min-height: 560px;
  margin-top: 44px;
  padding: 72px 24px;
  text-align: center;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  animation: fade-in 720ms both;
}

.reader-heading h1 {
  font-size: clamp(42px, 6vw, 64px);
  letter-spacing: 0.08em;
}

.reader-heading .poem-meta {
  justify-content: center;
  margin-top: 20px;
}

.reader-lines {
  max-width: 680px;
  margin: 54px auto 0;
  display: grid;
  gap: 18px;
  color: var(--dark-warm);
  font-size: clamp(22px, 3.5vw, 30px);
  line-height: 1.75;
  letter-spacing: 0.14em;
}

.reader-lines p {
  margin: 0;
}

.reader-related {
  margin-top: 52px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 24px;
  font-family: var(--ui);
  font-size: 12px;
}

.reader-related a {
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.reader-related a:hover {
  border-color: var(--brand);
}

.reader-actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.action-button {
  min-width: 132px;
  min-height: 44px;
  padding: 10px 20px;
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 999px;
  font-family: var(--ui);
  font-size: 13px;
  transition: background-color 180ms ease, transform 180ms ease;
}

.action-button:hover {
  background: var(--brand-tint);
  transform: translateY(-1px);
}

.action-button-primary {
  background: var(--brand);
  color: var(--ivory);
}

.action-status {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--stone);
  font-family: var(--ui);
  font-size: 12px;
  text-align: center;
}

.favorites-intro {
  max-width: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

.danger-button {
  color: #74483a;
  border-bottom-color: #74483a;
}

.search-bar button:active,
.search-panel > button:active,
.action-button:active,
.text-button:active,
.site-nav a:active,
.discovery-ribbon a:active {
  transform: scale(0.98);
}

.action-button.action-button-primary:hover {
  background: var(--brand-light);
  color: var(--ivory);
}

.is-revealing > p {
  animation: line-unfold 660ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--line-index, 0) * 72ms);
}

.section-heading-stacked {
  align-items: flex-start;
  flex-direction: column;
  gap: 7px;
}

.section-heading-stacked p {
  max-width: 650px;
  margin: 0;
  color: var(--stone);
  font-family: var(--ui);
  font-size: 13px;
}

/* Poetry archive */

.archive-hero {
  min-height: 500px;
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.28fr);
  align-items: center;
  gap: 54px;
}

.archive-intro {
  margin: 0;
}

.chapter-art {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--ivory);
  box-shadow: 0 18px 54px rgba(20, 20, 19, 0.055);
}

.chapter-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  mix-blend-mode: multiply;
  animation: ink-breathe 16s ease-in-out infinite alternate;
}

.archive-metrics {
  margin-top: 8px;
  padding: 26px 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.archive-metrics > div {
  padding: 0 24px;
  border-right: 1px solid var(--border-soft);
}

.archive-metrics > div:first-child {
  padding-left: 0;
}

.archive-metrics > div:last-child {
  border-right: 0;
}

.archive-metrics strong,
.archive-metrics span {
  display: block;
}

.archive-metrics strong {
  color: var(--brand);
  font-size: 28px;
  font-weight: 500;
  font-variant-numeric: lining-nums tabular-nums;
}

.archive-metrics span {
  margin-top: 3px;
  color: var(--stone);
  font-family: var(--ui);
  font-size: 12px;
}

.filter-section,
.dynasty-section,
.archive-index {
  margin-top: 96px;
}

.filter-panel {
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) minmax(220px, 1fr) 140px;
  gap: 18px;
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 12px 36px rgba(20, 20, 19, 0.035);
}

.type-picker {
  min-width: 0;
  margin: 10px 0 0;
  padding: 0;
  grid-column: 1 / -1;
  border: 0;
}

.type-picker legend {
  margin-bottom: 10px;
  color: var(--stone);
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.type-options {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.type-option {
  min-height: 34px;
  padding: 7px 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--parchment);
  color: var(--dark-warm);
  font-family: var(--ui);
  font-size: 12px;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.type-option:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}

.type-option:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-tint);
  color: var(--brand);
}

.type-option:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.45;
}

.type-option input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--brand);
}

.type-option small {
  color: var(--stone);
  font-variant-numeric: tabular-nums;
}

.loading-chip {
  color: var(--stone);
  font-family: var(--ui);
  font-size: 12px;
  animation: loading-pulse 1.6s ease-in-out infinite;
}

.filter-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.filter-actions .action-button {
  min-width: 138px;
}

.archive-poem {
  margin-top: 32px;
}

.dynasty-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(176px, 218px);
  gap: 14px;
  padding: 2px 2px 18px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline proximity;
  scrollbar-color: var(--border) transparent;
}

.dynasty-card {
  position: relative;
  min-height: 196px;
  padding: 24px 22px 26px;
  overflow: hidden;
  display: grid;
  align-content: start;
  gap: 6px;
  scroll-snap-align: start;
  text-align: left;
  color: var(--near-black);
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 8px 24px rgba(20, 20, 19, 0.025);
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1), border-color 240ms ease, box-shadow 240ms ease;
}

.dynasty-card::after {
  content: "";
  position: absolute;
  right: 22px;
  bottom: 18px;
  left: 22px;
  width: var(--ink-share);
  max-width: calc(100% - 44px);
  height: 2px;
  background: var(--brand);
  transform-origin: left;
  opacity: 0.72;
}

.dynasty-card:hover {
  border-color: #d6d4ca;
  box-shadow: 0 14px 34px rgba(20, 20, 19, 0.05);
  transform: translateY(-4px);
}

.dynasty-range,
.dynasty-count,
.dynasty-card small {
  color: var(--stone);
  font-family: var(--ui);
  font-size: 11px;
  font-variant-numeric: lining-nums tabular-nums;
}

.dynasty-card strong {
  margin: 15px 0 9px;
  color: var(--brand);
  font-size: 28px;
  font-weight: 500;
}

.archive-index {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.92fr);
  gap: 64px;
}

.author-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 26px;
}

.author-entry {
  min-width: 0;
  padding: 17px 4px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 3px 10px;
  text-align: left;
  background: transparent;
  color: var(--near-black);
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  transition: color 180ms ease, transform 180ms ease;
}

.author-entry:hover {
  color: var(--brand);
  transform: translateX(4px);
}

.author-entry strong {
  font-size: 20px;
  font-weight: 500;
}

.author-entry span,
.author-entry small {
  color: var(--stone);
  font-family: var(--ui);
  font-size: 11px;
}

.author-entry span {
  grid-column: 1;
}

.author-entry small {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-variant-numeric: tabular-nums;
}

.type-cloud {
  min-height: 220px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: baseline;
  gap: 12px 20px;
}

.type-cloud-item {
  padding: 4px 0;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: var(--brand);
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  font-family: var(--serif);
  font-size: calc(15px * var(--cloud-scale));
  transition: color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.type-cloud-item:hover {
  color: var(--brand-light);
  border-color: currentColor;
  transform: translateY(-2px);
}

.type-cloud-item:disabled {
  color: var(--stone);
  cursor: not-allowed;
  opacity: 0.42;
}

.type-cloud-item small {
  color: var(--stone);
  font-family: var(--ui);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.compact-error {
  min-height: 120px;
  display: grid;
  place-items: center;
}

/* Flying flower game */

.feihua-hero {
  min-height: 650px;
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(360px, 0.76fr);
  align-items: center;
  gap: 64px;
}

.feihua-copy h1 {
  margin: 0;
  font-size: clamp(58px, 7vw, 82px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: 0.05em;
}

.feihua-copy > p:not(.kicker, .field-help) {
  max-width: 580px;
  margin: 24px 0 0;
  color: var(--olive);
  font-size: 18px;
  line-height: 1.75;
}

.character-form {
  max-width: 610px;
  margin-top: 32px;
  display: grid;
  grid-template-columns: 112px 132px minmax(126px, auto);
  align-items: end;
  gap: 14px;
}

.character-field,
.character-form .select-field {
  display: grid;
  gap: 7px;
}

.character-field label,
.character-form .select-field label {
  color: var(--stone);
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.character-field input,
.character-form .select-field select {
  width: 100%;
  height: 64px;
  padding: 8px 12px;
  color: var(--near-black);
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  outline: 0;
}

.character-field input {
  text-align: center;
  color: var(--brand);
  font-family: var(--serif);
  font-size: 40px;
  line-height: 1;
}

.character-field input:focus,
.character-form .select-field select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-tint);
}

.character-form .action-button {
  min-height: 64px;
  min-width: 126px;
}

.field-help {
  margin: 9px 0 0;
  color: var(--stone);
  font-family: var(--ui);
  font-size: 12px;
}

.field-help.is-error {
  color: #74483a;
}

.char-suggestions {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  color: var(--stone);
  font-family: var(--ui);
  font-size: 12px;
}

.char-suggestions button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: var(--brand-tint);
  border: 1px solid transparent;
  border-radius: 50%;
  transition: border-color 180ms ease, transform 180ms ease;
}

.char-suggestions button:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
}

.feihua-art {
  position: relative;
  width: min(100%, 500px);
  aspect-ratio: 4 / 5;
  margin: 0;
  justify-self: end;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--ivory);
  box-shadow: 0 18px 54px rgba(20, 20, 19, 0.055);
  isolation: isolate;
}

.feihua-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  mix-blend-mode: multiply;
  animation: ink-breathe 15s ease-in-out infinite alternate;
}

.petal {
  position: absolute;
  z-index: 2;
  width: 9px;
  height: 14px;
  border-radius: 70% 30% 70% 30%;
  background: #a96859;
  opacity: 0;
  pointer-events: none;
}

.petal-one { top: 24%; right: 30%; }
.petal-two { top: 36%; right: 18%; }
.petal-three { top: 42%; right: 38%; }
.petal-four { top: 52%; right: 25%; }
.petal-five { top: 32%; right: 46%; }

.feihua-result-section {
  margin-top: 68px;
  padding-top: 72px;
  border-top: 1px solid var(--border);
}

.round-status {
  margin: 7px 0 0;
  color: var(--stone);
  font-family: var(--ui);
  font-size: 12px;
}

.feihua-poem {
  min-height: 390px;
  padding: 58px 64px;
  display: grid;
  grid-template-columns: minmax(180px, 0.58fr) minmax(0, 1fr);
  gap: 72px;
  align-items: center;
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 12px 36px rgba(20, 20, 19, 0.04);
}

.feihua-poem.is-loading {
  display: grid;
  place-items: center;
}

.character-hit {
  padding: 0 0.05em;
  color: var(--brand);
  background: transparent;
  font-weight: 500;
  border-bottom: 1px solid var(--brand);
}

.rule-flow {
  margin-top: 56px;
  padding: 28px 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.rule-flow p {
  min-width: 0;
  margin: 0;
  padding: 0 24px;
  display: grid;
  gap: 5px;
  border-right: 1px solid var(--border-soft);
}

.rule-flow p:first-child {
  padding-left: 0;
}

.rule-flow p:last-child {
  border-right: 0;
}

.rule-flow strong {
  color: var(--brand);
  font-size: 20px;
  font-weight: 500;
}

.rule-flow span {
  color: var(--stone);
  font-family: var(--ui);
  font-size: 12px;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes page-out {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ink-breathe {
  from { transform: scale(1); }
  to { transform: scale(1.018); }
}

@keyframes mist-drift {
  from { transform: translate3d(-3%, 0, 0) scale(0.94); }
  to { transform: translate3d(7%, -5%, 0) scale(1.08); }
}

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

@keyframes loading-pulse {
  0%, 100% { opacity: 0.42; }
  50% { opacity: 1; }
}

@media (max-width: 880px) {
  .site-header,
  .site-footer {
    padding-right: 32px;
    padding-left: 32px;
  }

  .page-shell {
    padding: 56px 32px 84px;
  }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .hero-copy {
    padding: 20px 0 0;
  }

  .hero h1 {
    max-width: 760px;
  }

  .hero-art,
  .hero-art img {
    min-height: 430px;
  }

  .featured-poem {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 48px;
  }

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

  .search-panel {
    grid-template-columns: minmax(0, 1fr) 136px 120px;
  }

  .search-panel > button {
    grid-column: 1 / -1;
  }

  .result-item {
    grid-template-columns: 36px minmax(170px, 0.55fr) minmax(0, 1fr) 16px;
    gap: 16px;
  }

  .archive-hero,
  .feihua-hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 38px;
  }

  .archive-intro {
    padding-top: 18px;
  }

  .chapter-art {
    width: 100%;
  }

  .filter-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .filter-panel > .select-field:nth-of-type(3) {
    grid-column: 1 / -1;
  }

  .archive-index {
    grid-template-columns: 1fr;
    gap: 72px;
  }

  .feihua-copy {
    padding-top: 18px;
  }

  .feihua-art {
    width: min(100%, 560px);
    justify-self: center;
  }

  .feihua-poem {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 48px;
  }
}

@media (max-width: 600px) {
  .site-header {
    padding: 14px 20px;
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .brand {
    gap: 8px;
    font-size: 18px;
  }

  .brand img {
    width: 34px;
    height: 34px;
  }

  .site-nav {
    width: 100%;
    gap: 22px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    font-size: 13px;
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  .site-nav a {
    flex: 0 0 auto;
  }

  .page-shell {
    padding: 48px 20px 72px;
  }

  .site-footer {
    padding: 24px 20px 30px;
    display: grid;
    gap: 6px;
  }

  .hero-copy {
    padding-top: 6px;
  }

  .hero h1 {
    font-size: clamp(48px, 15vw, 66px);
  }

  .hero-lede {
    margin: 22px 0 26px;
    font-size: 17px;
  }

  .hero-art,
  .hero-art img {
    min-height: 310px;
  }

  .hero-art img {
    object-position: 61% center;
  }

  .discovery-ribbon {
    margin-bottom: 54px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .discovery-ribbon::-webkit-scrollbar {
    display: none;
  }

  .discovery-ribbon > * {
    flex: 0 0 auto;
  }

  .search-bar {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 7px;
    border-radius: 12px;
  }

  .search-bar input,
  .search-bar button {
    width: 100%;
  }

  .search-bar button {
    border-radius: 7px;
  }

  .daily-section {
    padding-top: 54px;
  }

  .section-heading {
    align-items: center;
  }

  .section-heading h2 {
    font-size: 30px;
  }

  .featured-poem {
    min-height: 340px;
    padding: 36px 26px;
    gap: 30px;
    border-radius: var(--radius-card);
  }

  .poem-lines {
    font-size: 19px;
  }

  .stats-strip {
    gap: 16px;
  }

  .stats-strip > div {
    padding-right: 12px;
  }

  .stats-strip strong {
    font-size: 19px;
  }

  .page-intro {
    margin-bottom: 36px;
  }

  .page-intro h1 {
    font-size: 52px;
  }

  .search-panel {
    grid-template-columns: 1fr 1fr;
    padding: 18px;
  }

  .query-field,
  .search-panel > button {
    grid-column: 1 / -1;
  }

  .results-section {
    margin-top: 54px;
  }

  .results-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .result-item {
    grid-template-columns: 30px minmax(0, 1fr) 16px;
    gap: 12px;
    padding: 24px 2px;
  }

  .result-item > div {
    grid-column: 2;
  }

  .result-excerpt {
    grid-column: 2 / -1;
    font-size: 15px;
  }

  .result-arrow {
    grid-column: 3;
    grid-row: 1;
  }

  .pagination {
    flex-wrap: wrap;
  }

  .pagination .page-status {
    order: -1;
    width: 100%;
  }

  .reader-page {
    padding-top: 34px;
  }

  .poem-reader {
    min-height: 500px;
    margin-top: 30px;
    padding: 54px 8px;
  }

  .reader-heading h1 {
    font-size: 42px;
  }

  .reader-lines {
    margin-top: 42px;
    font-size: 22px;
    letter-spacing: 0.09em;
  }

  .reader-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .reader-actions .action-button-primary {
    grid-column: 1 / -1;
  }

  .favorites-intro {
    display: grid;
    align-items: start;
  }

  .favorites-intro .text-button {
    justify-self: start;
  }

  .archive-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .archive-metrics > div {
    padding: 16px 18px;
  }

  .archive-metrics > div:first-child {
    padding-left: 18px;
  }

  .archive-metrics > div:nth-child(even) {
    border-right: 0;
  }

  .archive-metrics > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border-soft);
  }

  .filter-section,
  .dynasty-section,
  .archive-index {
    margin-top: 72px;
  }

  .filter-panel {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .filter-panel > .select-field:nth-of-type(3),
  .type-picker,
  .filter-actions {
    grid-column: 1;
  }

  .filter-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .filter-actions .action-button {
    min-width: 0;
  }

  .archive-poem {
    padding: 36px 26px;
  }

  .dynasty-rail {
    grid-auto-columns: minmax(168px, 78vw);
  }

  .archive-index {
    gap: 62px;
  }

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

  .feihua-copy h1 {
    font-size: 58px;
  }

  .feihua-copy > p:not(.kicker, .field-help) {
    font-size: 17px;
  }

  .character-form {
    grid-template-columns: 1fr 1fr;
  }

  .character-form .action-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .feihua-art {
    width: min(100%, 420px);
  }

  .feihua-result-section {
    margin-top: 54px;
    padding-top: 54px;
  }

  .feihua-result-section .section-heading {
    align-items: flex-start;
  }

  .feihua-poem {
    min-height: 350px;
    padding: 36px 26px;
  }

  .rule-flow {
    grid-template-columns: 1fr;
  }

  .rule-flow p,
  .rule-flow p:first-child {
    padding: 17px 0;
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
  }

  .rule-flow p:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 360px) {
  .site-nav {
    gap: 12px;
  }

  .site-nav a {
    padding-right: 1px;
    padding-left: 1px;
  }

  .hero h1,
  .page-intro h1 {
    font-size: 46px;
  }

  .search-panel {
    grid-template-columns: 1fr;
  }

  .query-field,
  .select-field,
  .search-panel > button {
    grid-column: 1;
  }
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
