@font-face {
  font-family: 'Ma Shan Zheng';
  src: url('./assets/ma-shan-zheng.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f9eed3;
  --cream: #fff8e9;
  --ink: #29261b;
  --red: #b4212a;
  --wine: #8e1921;
  --green: #244634;
  --dark-green: #193628;
  --mustard: #f3cf76;
  --muted: #5e4c36;
  --line: #bfa981;
  --gutter: clamp(1.25rem, 5.5vw, 6rem);
  --brush: 'Ma Shan Zheng', 'Kaiti SC', KaiTi, 'Noto Serif CJK SC', serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--cream);
  font-family: var(--brush);
  font-size: 1.125rem;
  line-height: 1.62;
}
h1, h2, h3, p, figure, dl, dd { margin: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; }
[hidden] { display: none !important; }
[id] { scroll-margin-top: 1.25rem; }
:focus-visible { outline: 3px solid #386ac3; outline-offset: 5px; }
.skip-link {
  position: absolute;
  z-index: 5;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--cream);
  color: var(--green);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
  width: min(100%, 108rem);
  min-height: 4.8rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.brand, .song-link, .main-nav a { text-decoration: none; }
.brand {
  display: inline-flex;
  justify-self: start;
  align-items: center;
  gap: 0.55rem;
  color: var(--red);
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  width: 2.3rem;
  height: 2.3rem;
  place-items: center;
  border-radius: 50%;
  color: var(--paper);
  background: var(--red);
  font-size: 1.45rem;
  line-height: 1;
}
.brand-name { font: 400 2rem/1 var(--brush); }
.main-nav { display: flex; gap: clamp(1rem, 3vw, 3rem); align-items: center; }
.main-nav a {
  padding-block: 0.55rem;
  color: var(--ink);
  font-size: 1.07rem;
  white-space: nowrap;
}
.main-nav a:hover, .main-nav a:focus-visible { color: var(--wine); text-decoration: underline; text-underline-offset: 0.35em; }
.song-link {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 0.55rem;
  min-height: 2.55rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid #8b9b76;
  border-radius: 100vmax;
  color: var(--green);
  background: #eef0d6;
  font-size: 1rem;
  white-space: nowrap;
}
.song-link span { font-size: 1.18rem; line-height: 1; }
.song-link:hover { background: #e1e8c6; }

.hero {
  --copy-share: 43%;
  display: grid;
  grid-template-columns: var(--copy-share) minmax(0, 1fr);
  position: relative;
  min-height: clamp(35rem, 44.5vw, 51rem);
  background-color: var(--paper);
}
.hero-copy {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background-image: radial-gradient(ellipse at 94% 100%, #edce83b0 0, transparent 68%), radial-gradient(#5b392813 0.6px, transparent 0.7px);
  background-size: auto, 4px 4px;
}
.hero-content {
  position: relative;
  z-index: 1;
  width: min(100%, 43rem);
  padding: 2.9rem clamp(1.5rem, 2.9vw, 3.5rem) 3.35rem var(--gutter);
}
.hero-kicker {
  display: flex;
  align-items: center;
  gap: 0.48rem;
  margin-bottom: 1.28rem;
  color: var(--green);
  font-size: 1.08rem;
  letter-spacing: 0.12em;
}
.hero-kicker span { color: var(--red); font-size: 1.2em; }
.hero-title {
  margin-inline-start: -0.07em;
  font: 400 clamp(5rem, 9.1vw, 10rem)/0.96 var(--brush);
  letter-spacing: -0.06em;
  white-space: nowrap;
}
.hero-title span { display: block; }
.hero-title span:first-child { color: var(--red); transform: rotate(-2deg); transform-origin: 22% 56%; }
.hero-title span:last-child {
  margin-top: 0.12em;
  padding-inline-start: 0.17em;
  color: var(--green);
  font-size: 0.5em;
  line-height: 1.11;
  letter-spacing: -0.05em;
}
.hero-deck {
  margin: 1.5rem 0 1.95rem;
  color: var(--muted);
  font-size: clamp(1.125rem, 1.55vw, 1.42rem);
  line-height: 1.65;
}
.hero-actions, .player-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.85rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0.6rem 1.4rem;
  border: 1px solid transparent;
  border-radius: 0.2rem;
  font-size: 1.12rem;
  text-decoration: none;
  transition: background-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}
.button-green { background: var(--green); color: var(--cream); box-shadow: 4px 4px 0 #c5aa6e; }
.button-green:hover { background: var(--dark-green); box-shadow: 5px 5px 0 #c5aa6e; transform: translate(-1px, -1px); }
.button-red { background: var(--red); color: var(--cream); box-shadow: 4px 4px 0 #e4b65d; }
.button-red:hover { background: var(--wine); box-shadow: 5px 5px 0 #e4b65d; transform: translate(-1px, -1px); }
.button-outline { color: var(--wine); background: #fff5d7; border-color: #a16946; }
.button-outline:hover { background: #f6e7bd; }
.hero-play {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 3.25rem;
  padding: 0.3rem 0.22rem;
  border: 0;
  color: var(--wine);
  background: transparent;
  font-size: 1.08rem;
  text-decoration: underline;
  text-underline-offset: 0.28em;
  cursor: pointer;
}
.hero-play:hover { color: var(--red); }
.play-icon, .track-icon {
  display: grid;
  flex: none;
  width: 1.7rem;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: var(--red);
}
.play-icon::before, .track-icon::before {
  width: 0.5rem;
  height: 0.62rem;
  background: var(--cream);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  content: '';
}
[data-music-playing] .play-icon::before, [data-music-playing] [aria-pressed='true'] .track-icon::before {
  background: linear-gradient(90deg, var(--cream) 0 35%, transparent 35% 65%, var(--cream) 65%);
  clip-path: none;
}
.hero-photo { position: relative; min-width: 0; background: #978265; border-inline-start: 1px solid #9a7856; }
.hero-photo picture, .hero-photo img { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-photo img { object-fit: cover; object-position: 57% 54%; }
.hero-photo figcaption {
  position: absolute;
  right: 1.25rem;
  bottom: 1.2rem;
  max-width: calc(100% - 2.5rem);
  padding: 0.4rem 0.8rem;
  border: 1px solid #ffefd481;
  color: #fff8e9;
  background: #243023e8;
  font-size: 0.94rem;
  letter-spacing: 0.03em;
}
.hero-photo figcaption span { margin-inline: 0.25rem; }
.hero-seal {
  display: grid;
  position: absolute;
  z-index: 2;
  bottom: 2.9rem;
  left: var(--copy-share);
  width: clamp(5.3rem, 8.25vw, 8.3rem);
  aspect-ratio: 1;
  place-items: center;
  padding: 0.43rem;
  color: var(--paper);
  border: 1px solid var(--paper);
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 2px 8px #2e1a1945;
  transform: translateX(-49%) rotate(-11deg);
}
.hero-seal span {
  display: grid;
  width: 100%;
  height: 100%;
  place-content: center;
  border: 1px dashed #f5db9a;
  border-radius: 50%;
  font: 400 clamp(1.35rem, 2.25vw, 2.2rem)/0.94 var(--brush);
  text-align: center;
}
.floral-band {
  height: 3.55rem;
  border-block: 5px solid var(--red);
  box-shadow: inset 0 1px #f8dc90, inset 0 -1px #f8dc90;
  background: #a12429 url('./assets/peony-cloth.webp') repeat-x 50% 49% / 25rem auto;
}

.section-wrap { width: min(100%, 96rem); margin-inline: auto; padding-inline: var(--gutter); }
.visit { padding-block: 4.6rem 5.6rem; }
.section-heading { margin-bottom: 2rem; }
.section-heading h2, .song-copy h2 {
  color: var(--green);
  font: 400 clamp(2.75rem, 4.95vw, 4.65rem)/1.08 var(--brush);
  letter-spacing: -0.032em;
}
.section-heading p { margin-top: 0.55rem; color: var(--muted); }
.chapter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(0.9rem, 2vw, 2rem); }
.chapter { min-width: 0; }
.chapter-link {
  display: flex;
  height: 100%;
  flex-direction: column;
  padding: 0.45rem;
  border: 1px solid #bfa583;
  background: #fff4dc;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 3px 4px 0 #e8d5b0;
  transition: box-shadow 150ms ease, transform 150ms ease;
}
.chapter-link:hover { box-shadow: 5px 7px 0 #dfc494; transform: translateY(-0.2rem); }
.chapter-photo { overflow: hidden; aspect-ratio: 1.42; background: #7e5b43; }
.chapter-photo img { width: 100%; height: 100%; object-fit: cover; }
.chapter-text { display: flex; flex: 1; flex-direction: column; padding: 1.05rem 0.9rem 0.85rem; }
.chapter-text h3 { color: var(--wine); font: 400 clamp(1.92rem, 3.35vw, 2.9rem)/1.1 var(--brush); }
.chapter-text p { margin: 0.45rem 0 0.9rem; color: var(--muted); }
.chapter-action {
  align-self: flex-start;
  margin-top: auto;
  color: var(--green);
  font-size: 0.99rem;
  text-decoration: underline;
  text-decoration-color: #a59b76;
  text-underline-offset: 0.31em;
}

.inventory {
  position: relative;
  color: var(--cream);
  border-block: 1px solid #19372a;
  background-color: var(--green);
  background-image: radial-gradient(circle at 5% 0, #3a6648 0, transparent 56%), radial-gradient(#ffffff16 0.55px, transparent 0.65px);
  background-size: auto, 5px 5px;
}
.inventory-inner { padding-block: 4.25rem 4.75rem; }
.inventory-heading h2 { color: #fae4ab; }
.inventory-heading p { color: #f1e6c9; }
.room-tabs {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.35rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid #ebdfbc65;
}
.room-tabs button {
  flex: 0 1 8.15rem;
  min-height: 2.9rem;
  padding-inline: 0.65rem;
  border: 1px solid #e8dfba8f;
  border-radius: 0.15rem;
  color: var(--cream);
  background: var(--dark-green);
  cursor: pointer;
}
.room-tabs button:hover { background: #35583e; }
.room-tabs button[aria-selected='true'] { color: #30281d; background: var(--mustard); border-color: var(--mustard); }
.inventory :focus-visible { outline-color: #f7d880; }
.room-panel[role='tabpanel'] .room-title { display: none; }
.room-title { margin: 1.6rem 0 0.8rem; color: #fae4ab; font: 400 2.35rem/1.15 var(--brush); }
.object-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.object-grid div {
  min-height: 7.75rem;
  padding: 0.9rem 1.1rem 1rem;
  border: 1px solid #d3c7885e;
  background: #132f2269;
}
.object-grid dt { color: #f6d484; font: 400 1.95rem/1.2 var(--brush); }
.object-grid dd { margin-top: 0.35rem; color: #fff0d5; }

.song-section {
  color: var(--ink);
  background-color: #f2dfab;
  background-image: radial-gradient(#81592926 0.65px, transparent 0.8px);
  background-size: 4px 4px;
}
.song-layout {
  display: grid;
  grid-template-columns: minmax(10rem, 0.62fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 6.5vw, 6rem);
  padding-block: 3.75rem;
}
.record-sleeve {
  display: grid;
  width: min(100%, 17rem);
  justify-self: center;
  aspect-ratio: 1;
  place-items: center;
  padding: 0.8rem;
  border: 1px solid var(--wine);
  background: var(--red) url('./assets/peony-cloth.webp') center / auto 125%;
  box-shadow: 5px 6px 0 #a9743e6b;
  transform: rotate(-4deg);
}
.record {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid #3c3029;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, #27211f 0 1px, #191615 2px 4px);
  box-shadow: 3px 2px 8px #351414b3;
  animation: record-spin 8s linear infinite paused;
}
[data-music-playing] .record { animation-play-state: running; }
@keyframes record-spin { to { transform: rotate(1turn); } }
.record span {
  display: grid;
  width: 40%;
  aspect-ratio: 1;
  place-items: center;
  border: 3px double #9d2c20;
  border-radius: 50%;
  color: var(--wine);
  background: var(--mustard);
  font: 400 clamp(1.35rem, 2.65vw, 2.85rem)/1 var(--brush);
}
.song-copy { max-width: 41rem; }
.song-copy h2 { margin-bottom: 0.5rem; }
.song-name { margin-bottom: 0.25rem; color: var(--green); font-size: 1.3rem; }
.song-copy audio { max-width: 100%; }
.track-status { margin-bottom: 0.8rem; color: var(--wine); }
.player-actions { margin-bottom: 0.85rem; }
.player-actions button { min-height: 2.75rem; padding-block: 0.35rem; cursor: pointer; }
.seek-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.7rem; color: var(--muted); font-size: 1rem; }
.seek-row input { width: 100%; min-width: 0; margin: 0; accent-color: var(--red); }
.seek-row span { flex: none; }
.playlist { display: grid; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.playlist button {
  display: flex;
  width: 100%;
  min-height: 2.9rem;
  align-items: center;
  gap: 0.65rem;
  padding: 0.38rem 0.65rem;
  border: 1px solid #ba9d67;
  border-radius: 0.16rem;
  color: var(--ink);
  background: #f9edce;
  text-align: start;
  cursor: pointer;
}
.playlist button:hover { border-color: var(--red); }
.playlist button[aria-pressed='true'] { color: var(--wine); border-color: #aa5549; background: #fff6dd; }
.playlist small { margin-inline-start: 0.3rem; color: var(--muted); font-size: 0.95rem; }
.track-icon { width: 1.43rem; background: var(--green); }
.playlist button[aria-pressed='true'] .track-icon { background: var(--red); }

.site-footer { color: var(--cream); background: var(--wine); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; padding-block: 1.8rem 2rem; }
.footer-title { font: 400 2.3rem/1.12 var(--brush); }
.credits { margin-top: 0.45rem; color: #ffe6bf; font-size: 0.99rem; }
.back-to-top { color: var(--cream); white-space: nowrap; text-underline-offset: 0.35em; }
.site-footer :focus-visible { outline-color: #ffde8d; }

@media (max-width: 1000px) {
  .hero { --copy-share: 45%; min-height: clamp(30rem, 58vw, 37rem); }
  .hero-title { font-size: clamp(4.35rem, 9.55vw, 7rem); }
  .chapter-text { padding-inline: 0.65rem; }
}

@media (max-width: 740px) {
  .header-inner { grid-template-columns: 1fr 1fr; gap: 0.35rem 1rem; padding-top: 0.75rem; }
  .brand-mark { width: 2.05rem; height: 2.05rem; font-size: 1.25rem; }
  .brand-name { font-size: 1.9rem; }
  .song-link { grid-area: 1 / 2; min-height: 2.35rem; }
  .main-nav { grid-column: 1 / -1; justify-content: space-between; gap: 0.48rem; }
  .main-nav a { font-size: clamp(0.91rem, 3.85vw, 1.04rem); padding-block: 0.57rem; }
  .hero { --photo-height: clamp(18.5rem, 77vw, 32rem); display: block; min-height: auto; }
  .hero-copy { justify-content: flex-start; }
  .hero-content { padding: 1.7rem var(--gutter) 2.15rem; }
  .hero-kicker { margin-bottom: 0.8rem; }
  .hero-title { font-size: clamp(4.7rem, 16.8vw, 8rem); }
  .hero-deck { margin-block: 0.8rem 1.15rem; }
  .hero-photo { min-height: var(--photo-height); border-inline: 0; border-top: 1px solid #9a7856; }
  .hero-photo img { object-position: 57% 45%; }
  .hero-photo figcaption { right: 0.75rem; bottom: 0.65rem; }
  .hero-seal { bottom: calc(var(--photo-height) - 2.55rem); left: auto; right: 1.1rem; width: 5rem; transform: rotate(-11deg); }
  .hero-seal span { font-size: 1.45rem; }
  .floral-band { height: 2.65rem; }
  .visit, .inventory-inner { padding-block: 2.65rem 3.1rem; }
  .section-heading { margin-bottom: 1.45rem; }
  .chapter-grid { grid-template-columns: 1fr; gap: 1.15rem; }
  .chapter-photo { aspect-ratio: 1.56; }
  .chapter-text { padding: 0.9rem 0.8rem 0.7rem; }
  .object-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; }
  .object-grid div { padding: 0.7rem 0.75rem; }
  .song-layout { display: block; padding-block: 2.7rem; }
  .record-sleeve { float: right; width: clamp(6.2rem, 24vw, 10rem); margin: 0.3rem 0.25rem 1rem 1rem; padding: 0.45rem; }
  .seek-row { clear: both; }
  .song-copy h2 { font-size: clamp(2rem, 6vw, 3.4rem); }
  .footer-inner { align-items: flex-start; }
}

@media (max-width: 435px) {
  .hero-content { padding-bottom: 1.9rem; }
  .hero-seal { right: 0.9rem; }
  .record-sleeve { padding: 0.32rem; }
  .record span { font-size: 0.9rem; }
  .credits { max-width: 18rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .record { animation: none; }
  *, *::before, *::after { transition-duration: 0s !important; }
}
