/* ==================== 基础设置 ==================== */
:root {
  --paper: #f3eee2;
  --paper-light: #fbf8f0;
  --ink: #27251f;
  --gray: #746e63;
  --red: #a64232;
  --green: #40584b;
  --line: rgba(39, 37, 31, 0.16);
  --shadow: 0 22px 55px rgba(62, 48, 28, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Serif SC", "Songti SC", serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.container {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
}

.eyebrow {
  color: var(--red);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 4px;
}

.section-title {
  margin: 10px 0 15px;
  font-size: clamp(32px, 5vw, 54px);
  font-weight: 500;
  letter-spacing: 3px;
}

.muted {
  color: var(--gray);
  line-height: 2;
}

/* ==================== 公共导航 ==================== */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 74px;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 238, 226, 0.94);
  backdrop-filter: blur(12px);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 2px;
}

.logo-seal {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--red);
  border-radius: 3px 8px 4px 6px;
  font-size: 23px;
}

.logo small {
  display: block;
  margin-top: 3px;
  color: var(--gray);
  font-size: 8px;
  letter-spacing: 3px;
}

.nav {
  display: flex;
  gap: 34px;
}

.nav a {
  padding: 25px 0;
  color: var(--gray);
  font-size: 14px;
}

.nav a:hover,
.nav a.active {
  color: var(--red);
}

.menu-button {
  display: none;
  border: 0;
  background: transparent;
  font-size: 24px;
}

/* ==================== 按钮与书籍封面 ==================== */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 25px;
  border: 1px solid var(--ink);
  letter-spacing: 2px;
  transition: 0.25s;
}

.button-dark {
  color: white;
  background: var(--ink);
}

.button-light {
  background: transparent;
}

.button:hover {
  color: white;
  border-color: var(--red);
  background: var(--red);
  transform: translateY(-3px);
}

.book-cover {
  position: relative;
  height: 100%;
  padding: 28px 24px;
  overflow: hidden;
  color: #f8efdd;
  background: var(--cover-color, var(--green));
  border-radius: 2px 8px 8px 2px;
  box-shadow: inset 6px 0 12px rgba(0, 0, 0, 0.14);
}

.book-cover::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid currentColor;
  opacity: 0.3;
}

.book-cover::after {
  content: "";
  position: absolute;
  right: -55px;
  bottom: -55px;
  width: 150px;
  height: 150px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.25;
}

.book-title {
  position: relative;
  z-index: 1;
  display: block;
  max-width: 5em;
  font-size: 28px;
  line-height: 1.5;
  letter-spacing: 4px;
}

.book-author {
  position: absolute;
  left: 24px;
  bottom: 24px;
  z-index: 1;
  font-size: 11px;
  letter-spacing: 2px;
}

/* ==================== 首页 ==================== */
.hero {
  min-height: 680px;
  display: grid;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(circle at 76% 40%, #e4d6b9 0, transparent 25%);
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 80px;
}

.hero h1 {
  margin: 20px 0;
  font-size: clamp(54px, 7vw, 94px);
  font-weight: 500;
  line-height: 1.15;
}

.hero h1 em {
  color: var(--red);
  font-style: normal;
}

.hero-text {
  max-width: 490px;
  color: var(--gray);
  line-height: 2.1;
}

.hero-buttons {
  display: flex;
  gap: 15px;
  margin-top: 32px;
}

.hero-books {
  position: relative;
  height: 480px;
}

.hero-book-main {
  position: absolute;
  top: 35px;
  right: 75px;
  width: 235px;
  height: 340px;
  transform: rotate(5deg);
  box-shadow: var(--shadow);
}

.hero-book-small {
  position: absolute;
  left: 15px;
  bottom: 30px;
  width: 160px;
  height: 235px;
  transform: rotate(-9deg);
  box-shadow: var(--shadow);
}

.section {
  padding: 95px 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 42px;
}

.search-box {
  display: flex;
  gap: 10px;
}

.search-box input {
  width: 245px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  outline: 0;
  background: var(--paper-light);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 34px;
}

.book-card {
  transition: 0.3s;
}

.book-card:hover {
  transform: translateY(-9px);
}

.book-card-cover {
  height: 330px;
  box-shadow: 9px 14px 25px rgba(48, 38, 22, 0.16);
}

.book-card h3 {
  margin: 18px 0 7px;
  font-size: 18px;
}

.book-card p {
  margin: 0;
  color: var(--gray);
  font-size: 12px;
}

.quote {
  padding: 95px 20px;
  color: white;
  background: var(--ink);
  text-align: center;
}

.quote blockquote {
  margin: 25px auto;
  max-width: 800px;
  font-size: clamp(25px, 4vw, 42px);
  line-height: 1.8;
}

/* ==================== 内页公共样式 ==================== */
.page-title {
  padding: 130px 0 65px;
  border-bottom: 1px solid var(--line);
}

.page-title h1 {
  margin: 12px 0;
  font-size: clamp(44px, 7vw, 76px);
  font-weight: 500;
}

.two-column {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 90px;
  align-items: start;
}

/* ==================== 作者页面 ==================== */
.portrait {
  position: relative;
  height: 520px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(145deg, #cdbb9d, #45574c);
  box-shadow: var(--shadow);
  font-size: 170px;
}

.author-info h2 {
  margin: 0 0 22px;
  font-size: 52px;
  font-weight: 500;
}

.author-info p {
  color: var(--gray);
  line-height: 2.15;
}

.author-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 35px;
  padding-top: 25px;
  border-top: 1px solid var(--line);
}

.author-stats strong {
  display: block;
  font-size: 28px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-item time {
  color: var(--red);
}

.timeline-item h3,
.timeline-item p {
  margin: 0 0 8px;
}

/* ==================== 创作页面 ==================== */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 35px;
  border: 1px solid var(--line);
  background: var(--paper-light);
}

.metric {
  padding: 25px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.work-list {
  border: 1px solid var(--line);
  background: var(--paper-light);
}

.work-item {
  display: grid;
  grid-template-columns: 75px 1fr auto;
  align-items: center;
  gap: 22px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.work-item:last-child {
  border-bottom: 0;
}

.work-cover {
  width: 75px;
  height: 105px;
}

/* 小封面使用更紧凑的排版，避免书名超出边框 */
.work-cover .book-cover {
  display: grid;
  place-items: center;
  padding: 12px 10px;
  overflow: hidden;
}

.work-cover .book-title {
  width: 100%;
  max-width: 100%;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 1px;
  text-align: center;
  word-break: break-all;
}

.progress {
  width: 180px;
  height: 3px;
  background: #ddd3bf;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--red);
}

.small-button {
  padding: 9px 16px;
  border: 1px solid var(--line);
  background: transparent;
}

/* ==================== 书籍详情页 ==================== */
.detail-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 90px;
  align-items: start;
}

.detail-cover {
  height: 490px;
  box-shadow: var(--shadow);
}

.detail-info h1 {
  margin: 10px 0;
  font-size: clamp(46px, 6vw, 72px);
  font-weight: 500;
}

.tags {
  display: flex;
  gap: 8px;
  margin: 22px 0;
}

.tag {
  padding: 5px 10px;
  border: 1px solid var(--line);
  color: var(--gray);
  font-size: 11px;
}

.detail-actions {
  display: flex;
  gap: 12px;
  margin: 32px 0;
}

.chapter-list {
  margin-top: 38px;
  border-top: 1px solid var(--line);
}

.chapter-link {
  display: grid;
  grid-template-columns: 55px 1fr auto;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}

.chapter-link:hover {
  color: var(--red);
}

/* ==================== 阅读页面 ==================== */
.reader-body {
  background: var(--reader-background, var(--paper));
}

.reader-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--reader-background, var(--paper));
}

.reader-tools {
  display: flex;
  gap: 8px;
}

.reader-tools button {
  min-width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
}

.reader-progress {
  position: fixed;
  top: 63px;
  left: 0;
  z-index: 21;
  width: 0;
  height: 2px;
  background: var(--red);
}

.reader-article {
  max-width: 720px;
  margin: 0 auto;
  padding: 125px 22px 100px;
  font-size: var(--reader-size, 19px);
  line-height: 2.25;
  letter-spacing: 1px;
}

.reader-article h1 {
  margin-bottom: 45px;
  text-align: center;
  font-weight: 500;
}

.reader-article p {
  margin-bottom: 1.7em;
  text-align: justify;
  text-indent: 2em;
}

.theme-green {
  --reader-background: #dfe5d9;
}

.theme-night {
  --reader-background: #292b28;
  color: #ded8cb;
}

/* ==================== 弹窗、提示和页脚 ==================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  background: rgba(30, 27, 22, 0.55);
}

.modal.show {
  display: grid;
}

.modal-box {
  width: min(440px, calc(100% - 30px));
  padding: 38px;
  background: var(--paper-light);
  box-shadow: var(--shadow);
}

.modal-box label,
.modal-box input,
.modal-box select {
  display: block;
  width: 100%;
}

.modal-box label {
  margin: 18px 0;
}

.modal-box input,
.modal-box select {
  margin-top: 7px;
  padding: 11px;
  border: 1px solid var(--line);
  background: white;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 60;
  padding: 12px 22px;
  color: white;
  background: var(--ink);
  opacity: 0;
  transform: translate(-50%, 15px);
  transition: 0.25s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.footer {
  padding: 42px 0;
  border-top: 1px solid var(--line);
  color: var(--gray);
  text-align: center;
  font-size: 12px;
}

/* ==================== 手机适配 ==================== */
@media (max-width: 760px) {
  .menu-button {
    display: block;
  }

  .nav {
    position: absolute;
    top: 74px;
    right: 0;
    left: 0;
    display: none;
    flex-direction: column;
    gap: 0;
    padding: 15px 20px;
    background: var(--paper-light);
  }

  .nav.show {
    display: flex;
  }

  .nav a {
    padding: 13px 0;
  }

  .hero {
    padding: 70px 0;
  }

  .hero-inner,
  .two-column,
  .detail-layout {
    grid-template-columns: 1fr;
    gap: 45px;
  }

  .hero-books {
    height: 350px;
  }

  .hero-book-main {
    width: 180px;
    height: 270px;
    right: 35px;
  }

  .hero-book-small {
    width: 120px;
    height: 180px;
  }

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

  .book-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 28px 15px;
  }

  .book-card-cover {
    height: 245px;
  }

  .book-title {
    font-size: 21px;
  }

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

  .metric {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .work-item {
    grid-template-columns: 60px 1fr;
  }

  .work-item .small-button {
    grid-column: 2;
  }

  .detail-cover {
    width: 260px;
    height: 390px;
    margin: auto;
  }
}
