:root {
  /* Starfall Color Bible v1.0 — Glenhaven palette (this site's baseline; the
     Catacombs/Castle palettes are reserved for later, darker chapters). */
  --purple: #491784;       /* Xo-El skin — fixed series anchor color */
  --purple-dark: #34115e;  /* darker shade of the same, for hover/footer */
  --cream: #faf3e1;        /* pale tint of Farmland Wheat Gold */
  --ink: #1c2e1e;          /* Forest Shadow */
  --forest: #3d5a3e;       /* Glenhaven Forest Green */
  --accent: #c8920a;       /* Amber Gold — speckles / recommended tank top */
  --accent-warm: #d4882a;  /* Lantern Amber — hover/secondary warmth */
  --card-bg: #ffffff;
  --border: #e8c97a44;     /* Farmland Wheat Gold, low opacity */
}

* {
  box-sizing: border-box;
}

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

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

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
.site-header {
  background: var(--purple);
  color: white;
}

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

.site-header .brand {
  color: white;
  font-size: 1.5rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.site-header nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.site-header nav a {
  color: white;
  text-decoration: none;
  opacity: 0.85;
  font-weight: 600;
}

.site-header nav a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Main containers */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

main.prose {
  max-width: 720px;
}

h1 {
  font-size: 2.25rem;
  margin-top: 0;
}

/* Hero */
.hero {
  text-align: center;
  padding: 3rem 1rem;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 0.25rem;
}

.hero .tagline {
  font-size: 1.25rem;
  color: var(--purple-dark);
  margin-top: 0;
}

/* Error pages */
.error-page {
  text-align: center;
  padding: 4rem 1rem;
}

.error-status {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

.error-page h1 {
  margin-bottom: 0.5rem;
}

.error-page p:not(.error-status) {
  color: #5a5147;
  max-width: 480px;
  margin: 0 auto 1.5rem;
}

.cta {
  display: inline-block;
  margin-top: 1rem;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-weight: 700;
  padding: 0.85rem 2rem;
  border-radius: 999px;
  transition: transform 0.15s ease, background 0.15s ease;
}

.cta:hover {
  background: var(--accent-warm);
  transform: translateY(-2px);
}

/* Chapter / book cards */
.book-section {
  margin-bottom: 2.5rem;
}

.chapter-grid,
.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.chapter-card {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chapter-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.chapter-card img {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
}

.chapter-card div {
  padding: 1rem;
}

.chapter-card h3 {
  margin: 0 0 0.4rem;
}

.chapter-card p {
  margin: 0;
  color: #5a5147;
  font-size: 0.95rem;
}

.latest {
  margin-top: 3rem;
}

/* Reader */
.reader h1 {
  text-align: center;
  margin-bottom: 0.25rem;
}

.chapter-meta {
  text-align: center;
  color: #5a5147;
  max-width: 640px;
  margin: 0 auto 2rem;
}

.pages {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 760px;
  margin: 0 auto;
}

.pages img {
  width: 100%;
  display: block;
}

.reactions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 2rem 0;
}

.reactions button {
  background: var(--purple);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.4rem;
  font-weight: 700;
  cursor: pointer;
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.chapter-nav a {
  text-decoration: none;
  font-weight: 600;
}

/* Comments */
.comments {
  max-width: 640px;
  margin: 0 auto;
}

.comment {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.comment p {
  margin: 0.25rem 0 0;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

.comment-form input,
.comment-form textarea {
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.comment-form textarea {
  min-height: 90px;
  resize: vertical;
}

.comment-form button {
  align-self: flex-start;
  background: var(--forest);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.4rem;
  font-weight: 700;
  cursor: pointer;
}

/* Characters */
.character-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
}

.character-card {
  display: block;
  text-decoration: none;
  color: var(--ink);
}

.character-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--purple);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 auto 0.75rem;
}

.character-photo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 0.75rem;
  display: block;
}

.character-card p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.character-role {
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  margin: 0 0 0.5rem;
}

/* Character detail page */
.character-detail-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.character-photo-lg {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.character-avatar-lg {
  width: 140px;
  height: 140px;
  font-size: 3rem;
  flex-shrink: 0;
  margin: 0;
}

.character-meta {
  color: var(--ink);
  opacity: 0.75;
  margin: 0.25rem 0;
}

.status-badge {
  display: inline-block;
  background: var(--forest);
  color: white;
  border-radius: 999px;
  padding: 0.15rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.character-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.character-gallery img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.color-swatch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem 0.3rem 0.3rem;
  font-size: 0.85rem;
}

.swatch-chip {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.swatch-label {
  font-weight: 600;
}

.swatch-hex {
  color: var(--ink);
  opacity: 0.6;
  font-family: monospace;
  font-size: 0.8em;
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

/* Forms: newsletter / waitlist */
.newsletter-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.newsletter-row input {
  flex: 1;
  min-width: 200px;
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.newsletter-row button,
.waitlist-box button {
  background: var(--purple);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-weight: 700;
  cursor: pointer;
}

.newsletter-success {
  font-weight: 600;
  color: var(--forest);
}

.waitlist-box {
  margin-top: 1.5rem;
}

/* App badges */
.app-badges {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.app-badge {
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  color: #5a5147;
}

/* Footer */
.site-footer {
  background: var(--purple-dark);
  color: white;
  padding: 2rem 0;
  margin-top: 3rem;
}

.site-footer label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.site-footer .copyright {
  opacity: 0.7;
  font-size: 0.85rem;
  margin-top: 1.5rem;
  margin-bottom: 0;
}
