:root {
  --background: #f5f1e8;
  --surface: #fffdf8;
  --text: #211f1b;
  --muted: #686055;
  --border: #cfc4b1;
  --accent: #a33b28;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--background);
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--text);
}

img {
  max-width: 100%;
}

.wrap {
  width: min(100% - 2rem, 1000px);
  margin: 0 auto;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
}

.site-title {
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  font-weight: bold;
  text-decoration: none;
}

.home {
  padding: 2.5rem 0 4rem;
}

.home-header {
  margin-bottom: 2rem;
}

.home-header h1 {
  margin: 0 0 0.4rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 7vw, 3.5rem);
  line-height: 1.1;
}

.home-header p {
  margin: 0;
  color: var(--muted);
}

.comic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.25rem;
}

.comic-card {
  display: block;
  padding: 0.75rem;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
}

.comic-card img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
}

.comic-card-title {
  display: block;
  margin-top: 0.7rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: bold;
}

.comic-card:hover .comic-card-title {
  text-decoration: underline;
}

.comic-card-meta {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.comic-card-summary {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.comic {
  max-width: 820px;
  padding: 2.5rem 0 4rem;
}

.comic > header {
  margin-bottom: 1.5rem;
}

.comic h1 {
  margin: 0 0 0.5rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 7vw, 3.5rem);
  line-height: 1.1;
}

.subtitle {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 1.15rem;
  font-style: italic;
}

.meta {
  margin: 0.15rem 0;
  color: var(--muted);
}

.reader {
  margin: 1.5rem 0 2.5rem;
}

.pdf-title {
  margin: 0 0 0.5rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
}

.reader-status {
  color: var(--muted);
}

.pdf-pages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 75vh;
  padding: 0.75rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #e9e2d5;
  border: 1px solid var(--border);
}

.pdf-pages canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid var(--border);
}

.description {
  max-width: 700px;
  line-height: 1.75;
}

.description h2,
.description h3,
.description h4 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.25;
}

.description p {
  margin: 1em 0;
}

.description img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
}

.description figure {
  margin: 2rem 0;
}

.description figcaption {
  color: var(--muted);
  font-size: 0.9rem;
}

.description blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  color: var(--muted);
  border-left: 2px solid var(--border);
}

.description code {
  padding: 0.1em 0.3em;
  background: #ebe4d7;
}

.description pre {
  padding: 0.75rem;
  overflow-x: auto;
  background: #ebe4d7;
}

.description pre code {
  padding: 0;
}

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.site-footer .wrap {
  padding: 1rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 600px) {
  .wrap {
    width: min(100% - 1.25rem, 1000px);
  }

  .comic-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.9rem;
  }
}
