/* ============================================================
   Sailor Helga — Chapter Styles
   Dark mode by default. Light mode via [data-theme="light"].
   ============================================================ */

/* ---- Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* ---- Color Tokens ---- */
:root {
  --bg:          #0c0c18;
  --bg-card:     #14142a;
  --text:        #e8d5f5;
  --text-muted:  #9a8ab0;
  --accent:      #ff7eb3;
  --accent-dark: #e0558e;
  --purple:      #c084fc;
  --nav-bg:      #09091a;
  --nav-border:  #2a2a4a;
  --btn-bg:      #1e1e3a;
  --btn-text:    #c084fc;
  --border:      #2a2a4a;
  --link:        #ff7eb3;
  --link-vis:    #c084fc;
  --link-hover:  #ff4d94;
}

[data-theme="light"] {
  --bg:          #fdf0f7;
  --bg-card:     #ffffff;
  --text:        #1a0a2e;
  --text-muted:  #6a4a7a;
  --accent:      #c8006a;
  --accent-dark: #a00055;
  --purple:      #6d28d9;
  --nav-bg:      #f3d8ec;
  --nav-border:  #e0b0d0;
  --btn-bg:      #ecddf5;
  --btn-text:    #6d28d9;
  --border:      #ddbbd0;
  --link:        #c8006a;
  --link-vis:    #6d28d9;
  --link-hover:  #a00055;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ---- Base ---- */
html { font-size: 17px; scroll-behavior: smooth; }

body {
  font-family: Georgia, "Times New Roman", serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.85;
  transition: background-color 0.25s, color 0.25s;
  min-height: 100vh;
}

a { color: var(--link); text-decoration: none; }
a:visited { color: var(--link-vis); }
a:hover { color: var(--link-hover); text-decoration: underline; }

/* ---- Site Header ---- */
.site-header {
  background-color: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  padding: 0.7rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header-inner {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-title {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.6rem;
  color: var(--accent);
  text-decoration: none;
  line-height: 1.5;
  flex-shrink: 0;
}
.site-title:hover { color: var(--accent-dark); text-decoration: none; }

.theme-toggle {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 1px solid var(--border);
  border-radius: 2rem;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ---- Chapter Container ---- */
.chapter-container {
  max-width: 740px;
  margin: 2.5rem auto;
  padding: 0 1.5rem 4rem;
}

/* ---- Chapter Header ---- */
.chapter-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.chapter-header h1 {
  font-size: 1.4rem;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.disclaimer {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.6;
}

/* ---- Chapter Text ---- */
.chapter-text {
  font-size: 1rem;
}

.chapter-text p {
  margin-bottom: 1.1rem;
  text-indent: 1.75em;
}

/* No indent on first paragraph after a break */
.chapter-text p:first-child,
.chapter-text hr + p {
  text-indent: 0;
}

.chapter-text hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ---- Chapter Navigation ---- */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.chapter-nav a,
.chapter-nav .nav-spacer {
  display: inline-block;
}

.nav-btn {
  padding: 0.55rem 1.1rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  text-decoration: none;
  font-size: 0.88rem;
  font-family: Georgia, serif;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  text-align: center;
  white-space: nowrap;
}
.nav-btn:hover, .nav-btn:visited:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  text-decoration: none;
}
.nav-btn:visited { color: var(--btn-text); }

/* ---- Responsive ---- */
@media (max-width: 600px) {
  html { font-size: 16px; }

  .chapter-container {
    padding: 0 1rem 2.5rem;
    margin: 1.25rem auto;
  }

  .site-header { padding: 0.6rem 1rem; }

  .site-title { font-size: 0.5rem; }

  .chapter-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-btn {
    text-align: center;
    width: 100%;
  }
}
