:root {
  --bg: #faf7f2;
  --bg-raised: #ffffff;
  --text: #1a1a1a;
  --text-muted: #5c5c5c;
  --accent: #ff3b3b;
  --accent-2: #ffcc00;
  --accent-3: #2b6fff;
  --border: #e3ddd2;
  --shadow: rgba(0, 0, 0, 0.12);
  --font-display: 'Bungee', system-ui, sans-serif;
  --font-body: 'Literata', Georgia, 'Times New Roman', serif;
  --font-ui: 'Inter', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15140f;
    --bg-raised: #201f19;
    --text: #f0ece2;
    --text-muted: #b3ac9c;
    --border: #35332a;
    --shadow: rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  --bg: #15140f;
  --bg-raised: #201f19;
  --text: #f0ece2;
  --text-muted: #b3ac9c;
  --border: #35332a;
  --shadow: rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html { color-scheme: light dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  transition: background 0.2s ease, color 0.2s ease;
}

a { color: inherit; }

/* ---- Header / chrome ---- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 3px solid var(--accent);
}

.site-brand {
  font-family: var(--font-display);
  font-size: 1.1rem;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.theme-toggle {
  background: var(--bg-raised);
  border: 2px solid var(--border);
  border-radius: 999px;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}

.site-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 2rem 1rem 3rem;
}

/* ---- Home / hero ---- */

.hero {
  padding: 3rem 1.25rem 2rem;
  text-align: center;
  background:
    radial-gradient(circle at 15% 20%, var(--accent-2) 0%, transparent 35%),
    radial-gradient(circle at 85% 10%, var(--accent-3) 0%, transparent 30%),
    radial-gradient(circle at 50% 90%, var(--accent) 0%, transparent 40%);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 3.5rem);
  margin: 0 0 0.5rem;
  color: var(--text);
  text-shadow: 3px 3px 0 var(--accent);
}

.hero-tagline {
  font-family: var(--font-ui);
  color: var(--text-muted);
  margin: 0;
}

.continue-reading {
  max-width: 720px;
  margin: 1.5rem auto 0;
  padding: 0.85rem 1.25rem;
  background: var(--bg-raised);
  border: 2px dashed var(--accent-3);
  border-radius: 10px;
  text-align: center;
  font-size: 0.95rem;
}

.continue-reading a {
  font-weight: 600;
  color: var(--accent-3);
  margin-left: 0.4rem;
}

.series-block {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.series-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  border-bottom: 3px solid var(--accent-2);
  display: inline-block;
  padding-bottom: 0.15rem;
}

.series-blurb {
  color: var(--text-muted);
  max-width: 640px;
}

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

.story-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 4px 14px var(--shadow);
  transition: transform 0.15s ease;
}

.story-card:hover { transform: translateY(-4px); }

.story-cover img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

.story-info { padding: 1rem; }

.story-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0 0 0.2rem;
}

.story-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.6rem;
}

.story-description {
  font-size: 0.88rem;
  line-height: 1.4;
  margin: 0 0 0.75rem;
}

.story-status {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-2);
  color: #1a1a1a;
}

.status-first-draft { background: var(--border); color: var(--text-muted); }

/* ---- Chapter / reading view ---- */

.chapter {
  max-width: 680px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.chapter-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.back-to-home {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 1.25rem;
}

.chapter-story-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  margin: 0;
}

.chapter-story-subtitle {
  color: var(--text-muted);
  margin: 0.25rem 0 0.75rem;
}

.chapter-label {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.chapter-body {
  font-family: var(--font-body);
  font-size: 1.15rem;
  line-height: 1.75;
}

.chapter-body p { margin: 0 0 1.3em; }
.chapter-body h2 {
  font-family: var(--font-ui);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: center;
  margin: 2.5em 0 1.5em;
}
.chapter-body hr {
  border: none;
  text-align: center;
  margin: 2.5em 0;
}
.chapter-body hr::after {
  content: "***";
  color: var(--text-muted);
  letter-spacing: 0.5em;
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-ui);
  font-weight: 600;
}

.chapter-nav a { text-decoration: none; color: var(--accent-3); }

@media (max-width: 480px) {
  .chapter-body { font-size: 1.05rem; }
}
