@font-face {
  font-family: "Michel Sketch";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./assets/fonts/comic-neue-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Michel Sketch";
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
  src: url("./assets/fonts/comic-neue-latin-700-normal.woff2") format("woff2");
}

:root {
  color-scheme: only light;
  --paper: #fefaf2;
  --paper-card: #fffef9;
  --ink: #2d2d2d;
  --muted: #746c60;
  --red: #ff4d4d;
  --yellow: #ffe66d;
  --blue: #2d5da1;
  --shadow: 7px 7px 0 #2d2d2d;
  --shadow-small: 4px 4px 0 #2d2d2d;
  --sketch: "Michel Sketch", "Comic Sans MS", "Marker Felt", "Trebuchet MS", cursive;
}

* { box-sizing: border-box; }
.book-page [hidden] { display:none !important; }

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sketch);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .5;
  background-image:
    linear-gradient(rgba(45, 45, 45, .055) 1px, transparent 1px),
    radial-gradient(rgba(45, 45, 45, .11) .7px, transparent 1px);
  background-size: 100% 34px, 18px 18px;
}

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

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

.book-site-header,
.book-page {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.book-site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 34px;
}

.book-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  border: 3px solid var(--ink);
  border-radius: 18px 10px 16px 12px / 12px 18px 10px 16px;
  background: #fffdf4;
  box-shadow: var(--shadow-small);
  font-size: 16px;
  font-weight: 700;
  padding: 0 16px 0 12px;
  transform: rotate(-.45deg);
}

.book-brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--red);
}

.book-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.book-nav a {
  border: 2px solid var(--ink);
  border-radius: 13px 9px 12px 10px / 10px 13px 9px 12px;
  background: #fffdf4;
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 8px 13px;
  text-transform: uppercase;
}

.book-nav a:hover { transform: translate(-1px, -1px); }

.book-page { padding: clamp(74px, 10vw, 126px) 0 120px; }

.book-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: clamp(44px, 8vw, 100px);
  min-height: 0;
}

.book-kicker {
  margin: 0 0 18px;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.book-hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 900;
  letter-spacing: -.045em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.book-summary {
  max-width: 620px;
  margin: 28px 0 0;
  color: var(--muted);
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 17px;
  line-height: 1.65;
}

.book-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 34px;
}

.book-continue,
.book-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 3px solid var(--ink);
  border-radius: 15px 10px 14px 11px / 10px 15px 9px 14px;
  box-shadow: var(--shadow-small);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .035em;
  padding: 0 18px;
  text-transform: uppercase;
}

.book-continue { gap: 24px; background: var(--red); color: #fff; }
.book-back { background: #fffdf4; }
.book-continue span { font-size: 20px; line-height: 1; }

.book-continue:hover,
.book-back:hover {
  box-shadow: 5px 5px 0 var(--ink);
  transform: translate(-1px, -1px);
}

.book-progress-note {
  margin: 16px 0 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.book-index {
  margin-top: 64px;
}

.book-index-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(45, 45, 45, .2);
}

.book-index-heading .book-kicker { margin-bottom: 8px; }

.book-index-heading h2 {
  margin: 0;
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 900;
  letter-spacing: -.035em;
  line-height: 1.2;
}

.book-index-heading > span {
  max-width: 300px;
  color: var(--muted);
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: 13px;
  line-height: 1.5;
  text-align: right;
}

.book-contents {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}

.book-contents a {
  position: relative;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  padding: 34px 32px 30px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  background:
    linear-gradient(90deg, transparent 31px, rgba(255,77,77,.12) 32px, transparent 33px),
    repeating-linear-gradient(180deg, transparent 0 31px, rgba(45,45,45,.07) 32px),
    #fffdf7;
  box-shadow: 7px 8px 0 rgba(45,45,45,.22);
  color: var(--ink);
  text-decoration: none;
  transform: rotate(var(--paper-tilt, 0deg));
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.book-contents a:hover,
.book-contents a:focus-visible {
  transform: translateY(-7px) rotate(0);
  box-shadow: 10px 13px 0 rgba(45,45,45,.22);
  outline: none;
}

.book-contents a::before {
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.book-chapter-title {
  margin: 22px 0 12px;
  font-size: clamp(24px, 2.4vw, 34px);
  line-height: 1.05;
}

.book-chapter-excerpt {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.book-chapter-meta {
  margin-top: auto;
  padding-top: 30px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.book-contents{margin:28px 0 0;padding:0;list-style:none;counter-reset:chapter}
.book-contents li{counter-increment:chapter;min-width:0}
.book-contents li:nth-child(3n+1){--paper-tilt:-1deg}
.book-contents li:nth-child(3n+2){--paper-tilt:.7deg}
.book-contents li:nth-child(3n){--paper-tilt:-.4deg}
.book-contents a{height:100%}
.book-contents a::before{content:counter(chapter,decimal-leading-zero)}
.book-chapter-title{display:block;overflow-wrap:anywhere;font-weight:700;line-height:1.4}
.book-chapter-meta{display:block}
.book-contents a:focus-visible{outline:2px dashed var(--blue);outline-offset:5px}
.book-contents .is-last-read a{border-color:var(--blue)}
.book-contents .is-last-read .book-chapter-title::after{content:"上次读到";display:block;width:max-content;margin-top:12px;padding:5px 9px;background:var(--blue);color:white;border-radius:4px;font:700 12px/1.5 var(--sketch)}
@media(max-width:900px){.book-contents{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:620px){.book-contents{grid-template-columns:1fr}.book-contents a{min-height:240px}}
.book-empty {
  margin: 30px 0 0;
  color: var(--muted);
  font-family: Georgia, "Noto Serif SC", serif;
}

@media (max-width: 820px) {
  .book-hero { grid-template-columns: 1fr; min-height: 0; }
  .book-index { margin-top: 56px; }
}

@media (max-width: 620px) {
  .book-site-header,
  .book-page { width: min(100% - 28px, 1180px); }

  .book-site-header { align-items: flex-start; flex-wrap:wrap; padding-top: 20px; }
  .book-brand { min-height: 42px; font-size: 14px; padding: 0 12px 0 10px; }
  .book-nav { gap: 7px; }
  .book-nav a { font-size: 10px; padding: 7px 9px; }
  .book-page { padding-top: 72px; }
  .book-index-heading { align-items: flex-start; flex-direction: column; }
  .book-index-heading > span { text-align: left; }
  .book-contents { grid-template-columns: 1fr; }




  .book-contents li.is-last-read .book-chapter-title::after { display: block; width: max-content; margin: 8px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .book-contents a { transition: none; transform:none; }
}
