@font-face {
  font-family: "Suyz Brush";
  src: url("assets/fonts/suyz-brush.woff2?v=2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Suyz Serif";
  src: url("assets/fonts/suyz-serif.woff2?v=2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --paper: #f3eddf;
  --paper-deep: #e8deca;
  --ink: #28251f;
  --ink-soft: #6f6658;
  --cinnabar: #a33a32;
  --paper-rgb: 243, 237, 223;
  --content-width: 72rem;
  --serif: "Suyz Serif", "Noto Serif SC", "Songti SC", SimSun, serif;
  --brush: "Suyz Brush", "FZKai-Z03", "KaiTi", "STKaiti", cursive;
}

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

html {
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  min-width: 20rem;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 18%, rgba(163, 58, 50, 0.025), transparent 26rem),
    radial-gradient(circle at 88% 62%, rgba(40, 37, 31, 0.035), transparent 34rem),
    var(--paper);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.8;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.25;
  background-image:
    repeating-linear-gradient(6deg, transparent 0 13px, rgba(111, 102, 88, 0.025) 14px, transparent 15px),
    repeating-linear-gradient(94deg, transparent 0 21px, rgba(111, 102, 88, 0.02) 22px, transparent 23px);
}

::selection {
  color: #fff9ec;
  background: var(--cinnabar);
}

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

a:focus-visible {
  outline: 2px solid var(--cinnabar);
  outline-offset: 5px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 1rem;
  color: #fff;
  background: var(--ink);
  transform: translateY(-180%);
  transition: transform 160ms ease;
}

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

.page-shell {
  width: 100%;
  overflow: hidden;
}

#main-content:focus {
  outline: none;
}

.hero {
  position: relative;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  isolation: isolate;
  overflow: hidden;
  background: var(--paper);
}

.hero::before,
.hero::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  content: "";
  pointer-events: none;
}

.hero::before {
  background: linear-gradient(90deg, rgba(var(--paper-rgb), 0.99) 0%, rgba(var(--paper-rgb), 0.9) 34%, rgba(var(--paper-rgb), 0.16) 72%, rgba(var(--paper-rgb), 0) 100%);
}

.hero::after {
  background: linear-gradient(180deg, rgba(var(--paper-rgb), 0.35), transparent 25%, transparent 78%, rgba(var(--paper-rgb), 0.72));
}

.hero-art {
  position: absolute;
  z-index: 0;
  right: 0;
  bottom: -1rem;
  left: 0;
  width: 100%;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  transform-origin: center bottom;
  will-change: transform;
}

.hero-art img {
  display: block;
  width: 100%;
  height: auto;
  mix-blend-mode: multiply;
}

@media (min-width: 768px) {
  .hero-art::before {
    position: absolute;
    z-index: 1;
    top: -1px;
    right: 0;
    left: 0;
    height: clamp(4rem, 8vw, 8rem);
    content: "";
    pointer-events: none;
    background: linear-gradient(
      180deg,
      var(--paper) 0%,
      rgba(var(--paper-rgb), 0.96) 12%,
      rgba(var(--paper-rgb), 0.72) 48%,
      rgba(var(--paper-rgb), 0) 100%
    );
  }
}

.hero-content {
  position: relative;
  z-index: 2;
  align-self: center;
  width: min(52rem, 58vw);
  margin-left: clamp(2rem, 8vw, 9rem);
  padding: 7rem 0 8rem;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.7rem;
  color: var(--ink-soft);
  font-size: 0.83rem;
  letter-spacing: 0.42em;
}

.eyebrow::before {
  width: 3.5rem;
  height: 1px;
  content: "";
  background: currentColor;
  opacity: 0.55;
}

.name-lockup {
  display: flex;
  align-items: flex-end;
  gap: clamp(1rem, 2vw, 2rem);
}

h1,
h2,
p,
blockquote,
figure {
  margin-top: 0;
}

h1 {
  margin-bottom: 1.1rem;
  font-family: var(--brush);
  font-size: clamp(6.2rem, 12vw, 11.5rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: 0.045em;
  white-space: nowrap;
  text-shadow: 0 0.03em 0.08em rgba(40, 37, 31, 0.08);
}

.name-accent {
  color: var(--cinnabar);
}

.seal {
  display: grid;
  place-items: center;
  width: clamp(2.8rem, 4.5vw, 4.1rem);
  aspect-ratio: 1;
  margin-bottom: 1.7rem;
  border: 1px solid rgba(163, 58, 50, 0.78);
  color: #fff7e8;
  background: var(--cinnabar);
  font-family: var(--brush);
  font-size: clamp(1.5rem, 2.5vw, 2.3rem);
  line-height: 1;
  transform: rotate(-2.5deg);
  box-shadow: inset 0 0 0 2px rgba(243, 237, 223, 0.2);
}

.hero-quote {
  width: fit-content;
  max-width: 100%;
  margin-bottom: 0;
  padding-top: 1.45rem;
  border-top: 1px solid rgba(40, 37, 31, 0.25);
}

.hero-quote p {
  margin-bottom: 0.45rem;
  font-size: clamp(1.15rem, 1.75vw, 1.45rem);
  letter-spacing: 0.11em;
}

.hero-quote cite {
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-style: normal;
  letter-spacing: 0.25em;
}

.unroll {
  position: absolute;
  bottom: 2rem;
  left: 0;
  display: inline-flex;
  min-width: 2.75rem;
  min-height: 5.25rem;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  color: var(--ink-soft);
  font-size: 0.75rem;
  letter-spacing: 0.28em;
  text-decoration: none;
  writing-mode: vertical-rl;
}

.unroll i {
  display: block;
  width: 1px;
  height: 2.2rem;
  background: currentColor;
  transform-origin: top;
  animation: breathe-line 2.4s ease-in-out infinite;
}

@keyframes breathe-line {
  0%, 100% { transform: scaleY(0.62); opacity: 0.45; }
  50% { transform: scaleY(1); opacity: 1; }
}

@keyframes ink-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(0, 16px, 0); }
}

@media (min-width: 960px) {
  .hero-art {
    animation: ink-drift 14s ease-in-out infinite alternate;
  }
}

.chapter {
  position: relative;
  width: min(var(--content-width), calc(100% - 4rem));
  margin: 0 auto;
  padding: clamp(7rem, 11vw, 11rem) 0;
}

.chapter-heading {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  margin-bottom: clamp(4rem, 7vw, 7rem);
}

.chapter-number {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border: 1px solid rgba(163, 58, 50, 0.62);
  color: var(--cinnabar);
  font-family: var(--brush);
  font-size: 1.75rem;
  transform: rotate(-2deg);
}

.chapter-heading p {
  margin-bottom: 0.25rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
  letter-spacing: 0.32em;
}

.chapter-heading h2 {
  margin-bottom: 0;
  font-family: var(--brush);
  font-size: clamp(3rem, 5vw, 5rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.12em;
}

.story-composition {
  position: relative;
  display: flex;
  min-height: 34rem;
  align-items: center;
  justify-content: center;
  padding: 1rem 3rem;
}

.story-composition::before {
  position: absolute;
  z-index: -1;
  width: min(46rem, 75vw);
  height: 26rem;
  content: "";
  border-radius: 50%;
  opacity: 0.5;
  background: radial-gradient(ellipse, rgba(111, 102, 88, 0.12), rgba(111, 102, 88, 0) 68%);
  filter: blur(1.5rem);
}

.classical-quote {
  height: 32rem;
  margin: 0;
  color: var(--ink);
  font-size: 1.1rem;
  letter-spacing: 0.16em;
  line-height: 2.25;
  text-align: start;
  text-orientation: upright;
  writing-mode: vertical-rl;
}

.classical-quote p {
  margin: 0;
}

.classical-quote strong {
  display: inline-block;
  padding: 0.28em 0.08em;
  color: #fff8e9;
  background: var(--cinnabar);
  font-weight: 600;
  letter-spacing: 0.12em;
}

.ink-divider {
  display: flex;
  height: 4rem;
  align-items: center;
  justify-content: center;
}

.ink-divider span {
  display: block;
  width: min(23rem, 62vw);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(40, 37, 31, 0.4) 18%, rgba(163, 58, 50, 0.48) 50%, rgba(40, 37, 31, 0.4) 82%, transparent);
  transform: rotate(-0.5deg);
}

.meaning-grid {
  display: grid;
  grid-template-columns: minmax(15rem, 0.72fr) minmax(18rem, 1fr);
  align-items: center;
  gap: clamp(3rem, 8vw, 8rem);
}

.meaning-glyph {
  position: relative;
  color: rgba(40, 37, 31, 0.83);
  font-family: var(--brush);
  font-size: clamp(13rem, 25vw, 21rem);
  line-height: 0.88;
  text-align: center;
}

.meaning-glyph::after {
  position: absolute;
  z-index: -1;
  top: 45%;
  left: 50%;
  width: 82%;
  aspect-ratio: 1;
  border: 1px solid rgba(163, 58, 50, 0.18);
  content: "";
  transform: translate(-50%, -50%) rotate(5deg);
}

.meaning-copy {
  font-size: clamp(1rem, 1.4vw, 1.12rem);
  line-height: 2;
}

.meaning-copy > p {
  margin-bottom: 1.55rem;
}

.meaning-copy .lead {
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
  line-height: 1.7;
  letter-spacing: 0.05em;
}

.shuowen {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  margin: 2.5rem 0;
  padding: 1.5rem 0;
  border-top: 1px solid rgba(40, 37, 31, 0.2);
  border-bottom: 1px solid rgba(40, 37, 31, 0.2);
}

.shuowen blockquote {
  margin-bottom: 0;
  font-family: var(--brush);
  font-size: clamp(1.9rem, 3.2vw, 2.8rem);
  letter-spacing: 0.08em;
}

.shuowen figcaption {
  flex: 0 0 auto;
  color: var(--ink-soft);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
}

.blessing {
  width: 100%;
  max-width: none;
  padding-right: max(2rem, calc((100vw - var(--content-width)) / 2));
  padding-left: max(2rem, calc((100vw - var(--content-width)) / 2));
  color: #f9f2e4;
  background:
    radial-gradient(circle at 72% 25%, rgba(243, 237, 223, 0.08), transparent 27rem),
    linear-gradient(145deg, #302c25, #211f1a 72%);
}

.chapter-heading.light .chapter-number {
  color: #f2c5b6;
  border-color: rgba(242, 197, 182, 0.5);
}

.chapter-heading.light p {
  color: #c4bba9;
}

.blessing-copy {
  width: min(64rem, 100%);
  margin: 0 auto;
  padding: 1rem 0 2rem;
  text-align: center;
}

.blessing-copy > p:not(.wish) {
  margin-bottom: 0.65rem;
  font-family: var(--brush);
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  line-height: 1.5;
  letter-spacing: 0.13em;
  white-space: nowrap;
}

.blessing-rule {
  width: 1px;
  height: 5rem;
  margin: 3.5rem auto;
  background: linear-gradient(180deg, transparent, var(--cinnabar), transparent);
}

.blessing-copy .wish {
  margin-bottom: 0;
  color: #ded4c2;
  font-size: clamp(1rem, 1.7vw, 1.2rem);
  line-height: 2.2;
  letter-spacing: 0.16em;
}

.site-footer {
  display: flex;
  width: min(var(--content-width), calc(100% - 4rem));
  min-height: 12rem;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  color: var(--ink-soft);
}

.footer-mark {
  margin-bottom: 0.35rem;
  color: var(--ink);
  font-family: var(--brush);
  font-size: 1.4rem;
  letter-spacing: 0.12em;
}

.footer-separator {
  font-family: var(--serif);
}

.sources {
  display: flex;
  margin-bottom: 0;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

.sources a,
.back-to-top {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
}

.back-to-top {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-decoration: none;
}

.back-to-top::after {
  margin-left: 0.8rem;
  content: "↑";
  color: var(--cinnabar);
}

.error-page {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  padding: 2rem;
}

.error-card {
  width: min(35rem, 100%);
  text-align: center;
}

.error-code {
  margin-bottom: 0.5rem;
  color: var(--cinnabar);
  font-family: var(--brush);
  font-size: clamp(5rem, 18vw, 10rem);
  line-height: 1;
  white-space: nowrap;
}

.error-card h1 {
  margin-bottom: 1rem;
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  white-space: normal;
}

.error-card p {
  color: var(--ink-soft);
}

.home-link {
  display: inline-flex;
  min-height: 2.75rem;
  margin-top: 1.5rem;
  align-items: center;
  padding: 0 1.25rem;
  border: 1px solid var(--cinnabar);
  color: var(--cinnabar);
  text-decoration: none;
}

@media (hover: hover) {
  .sources a,
  .back-to-top,
  .unroll {
    transition: color 180ms ease;
  }

  .sources a:hover,
  .back-to-top:hover,
  .unroll:hover {
    color: var(--cinnabar);
  }

  .home-link {
    transition: color 180ms ease, background-color 180ms ease;
  }

  .home-link:hover {
    color: #fff8e9;
    background: var(--cinnabar);
  }
}

@media (max-width: 899px) {
  .classical-quote {
    width: min(42rem, 100%);
    height: auto;
    font-size: 1.05rem;
    letter-spacing: 0.07em;
    line-height: 2.05;
    text-align: justify;
    text-orientation: mixed;
    writing-mode: horizontal-tb;
  }

  .classical-quote br {
    display: block;
    content: "";
    margin-top: 1.15rem;
  }

  .classical-quote strong {
    padding: 0.12em 0.35em;
  }

  .story-composition {
    min-height: auto;
    flex-direction: column;
    gap: 3rem;
  }

}

@media (max-width: 767px) {
  body {
    font-size: 1rem;
  }

  .hero {
    min-height: max(42rem, 100svh);
  }

  .hero::before {
    background: linear-gradient(180deg, rgba(var(--paper-rgb), 0.99) 0%, rgba(var(--paper-rgb), 0.96) 31%, rgba(var(--paper-rgb), 0.48) 56%, rgba(var(--paper-rgb), 0.05) 82%);
  }

  .hero::after {
    background: linear-gradient(180deg, transparent 52%, rgba(var(--paper-rgb), 0.05) 80%, rgba(var(--paper-rgb), 0.75));
  }

  .hero-art {
    bottom: 0;
  }

  .hero-content {
    align-self: start;
    width: 100%;
    margin-left: 0;
    padding: max(5rem, env(safe-area-inset-top)) 1.25rem 16rem;
    text-align: center;
  }

  .eyebrow {
    justify-content: center;
    margin-bottom: 1.9rem;
    font-size: 0.76rem;
    letter-spacing: 0.32em;
  }

  .eyebrow::before,
  .eyebrow::after {
    width: 2rem;
    height: 1px;
    content: "";
    background: currentColor;
    opacity: 0.5;
  }

  .name-lockup {
    justify-content: center;
    gap: 0.8rem;
  }

  h1 {
    margin-bottom: 1.2rem;
    font-size: clamp(4.75rem, 23vw, 6rem);
  }

  .seal {
    width: 2.8rem;
    margin-bottom: 1.45rem;
    font-size: 1.55rem;
  }

  .hero-quote {
    margin-right: auto;
    margin-left: auto;
    padding-top: 1.15rem;
  }

  .hero-quote p {
    font-size: 1rem;
    letter-spacing: 0.06em;
  }

  .hero-quote cite {
    font-size: 0.75rem;
  }

  .unroll {
    bottom: max(1rem, env(safe-area-inset-bottom));
    left: 50%;
    min-height: 4.5rem;
    transform: translateX(-50%);
  }

  .unroll i {
    height: 1.65rem;
  }

  .chapter {
    width: min(100% - 2rem, 42rem);
    padding: 5.5rem 0;
  }

  .chapter-heading {
    gap: 1rem;
    margin-bottom: 3.5rem;
  }

  .chapter-number {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.45rem;
  }

  .chapter-heading p {
    font-size: 0.78rem;
    letter-spacing: 0.18em;
  }

  .chapter-heading h2 {
    font-size: 3rem;
  }

  .story-composition {
    padding: 0 0.25rem;
  }

  .classical-quote {
    font-size: 1rem;
    line-height: 2;
  }

  .ink-divider {
    height: 2rem;
  }

  .meaning-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .meaning-glyph {
    font-size: 12rem;
  }

  .meaning-glyph::after {
    width: 12rem;
  }

  .meaning-copy {
    line-height: 1.95;
  }

  .meaning-copy .lead {
    font-size: 1.32rem;
  }

  .shuowen {
    display: block;
  }

  .shuowen blockquote {
    font-size: 2rem;
  }

  .shuowen figcaption {
    margin-top: 0.45rem;
    font-size: 0.68rem;
    text-align: right;
  }

  .blessing {
    width: 100%;
    padding-right: 1.25rem;
    padding-left: 1.25rem;
  }

  .blessing-copy > p:not(.wish) {
    font-size: clamp(1.68rem, 7.2vw, 2rem);
    letter-spacing: 0.04em;
    white-space: normal;
  }

  .blessing-rule {
    height: 3.5rem;
    margin: 2.5rem auto;
  }

  .blessing-copy .wish {
    font-size: 1rem;
    line-height: 2.1;
    letter-spacing: 0.08em;
  }

  .site-footer {
    width: calc(100% - 2.5rem);
    min-height: 16rem;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 1.25rem;
  }
}

@media (max-width: 359px) {
  .hero-content {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  h1 {
    font-size: 4.5rem;
  }

  .hero-quote p {
    font-size: 0.96rem;
  }

  .blessing-copy > p:not(.wish) {
    font-size: 1.55rem;
    letter-spacing: 0.03em;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .hero-art {
    transform: none !important;
  }
}
