/* Ghosts n Goblins — Style guide + layout */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --bg: #0d0d0f;
  --surface: #18181b;
  --text: #e6e2dd;
  --text-muted: #78716c;
  --accent: #8b7cb8;
  --accent-hover: #a89ad4;
  --border: #27272a;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4, h5 {
  font-family: 'Libre Baskerville', serif;
  font-weight: 700;
  color: var(--text);
  margin: 0.5em 0 0.25em;
}
h1 { font-size: 48px; line-height: 1.2; }
h2 { font-size: 38px; line-height: 1.25; }
h3 { font-size: 28px; line-height: 1.3; }
h4 { font-size: 22px; line-height: 1.35; }
h5 { font-size: 18px; line-height: 1.4; }

p { margin: 0.75rem 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
ul, ol { padding-left: 1.5rem; margin: 0.75rem 0; }
ul { list-style-type: disc; }
ol { list-style-type: decimal; }
li { margin: 0.25rem 0; }
blockquote {
  font-family: 'Libre Baskerville', serif;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text-muted);
  border-left: 4px solid var(--accent);
  padding-left: 1rem;
  margin: 1rem 0;
}
strong { font-weight: 700; }
i { font-style: italic; }

button, .btn-donate {
  font-size: 16px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  cursor: pointer;
}
button:hover, .btn-donate:hover {
  background: var(--accent-hover);
}

/* ---- Header (fixed, hide on scroll down) ---- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transition: transform 0.3s ease;
}
.site-header.header-hidden {
  transform: translateY(-100%);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  gap: 1rem;
}
.header-logo {
  font-family: 'Libre Baskerville', serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
}
.header-logo:hover { color: var(--accent); text-decoration: none; }

.header-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0;
}
.hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  margin: 0 auto;
  transition: transform 0.2s, opacity 0.2s;
}
.header-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.header-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) { opacity: 0; }
.header-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}
.nav-item { position: relative; }
.nav-item > a {
  display: inline-block;
  padding: 0.4rem 0.5rem;
  color: var(--text);
}
.nav-item > a:hover { color: var(--accent); }
.nav-item > a.active,
.nav-item > a.child_active { color: var(--accent); font-weight: 600; }
.nav-toggle {
  background: none;
  border: none;
  color: var(--text);
  padding: 0.2rem 0.4rem;
  font-size: 0.65rem;
  cursor: pointer;
  vertical-align: middle;
}
.nav-sublist {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.nav-item.has-children.open .nav-sublist { display: block; }
.nav-sublist a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text);
}
.nav-sublist a:hover { background: var(--border); }
.header-cta.btn-donate {
  white-space: nowrap;
  margin-left: 0.5rem;
}
.header-editor-link {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}
.header-editor-link:hover { color: var(--accent); }

/* Mobile nav */
@media (max-width: 768px) {
  .header-menu-toggle { display: flex; }
  .header-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(300px, 100%);
    background: var(--surface);
    border-left: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 4rem 1rem 1rem;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
  }
  .header-nav.open { transform: translateX(0); }
  .nav-list {
    flex-direction: column;
    align-items: stretch;
  }
  .nav-item.has-children .nav-sublist {
    position: static;
    box-shadow: none;
    border: none;
    padding-left: 1rem;
    margin-top: 0.25rem;
  }
  .nav-item { display: flex; flex-wrap: wrap; align-items: center; }
  .nav-item > a { flex: 1; }
  .header-cta { margin: 1rem 0 0; }
}

/* Main content (offset for fixed header) */
.main-content-wrap { padding-top: 60px; }
.container { max-width: 900px; margin: 0 auto; padding: 0 1.25rem; }

/* Hero */
.hero {
  position: relative;
  min-height: 320px;
  display: flex;
  align-items: flex-end;
  padding: 2rem 1.25rem;
  background: var(--surface) no-repeat center/cover;
}
.hero h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  max-width: 900px;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(13,13,15,0.85), transparent 50%);
  pointer-events: none;
}

/* CTA strip */
.cta-strip {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 2rem 1.25rem;
  text-align: center;
}
.cta-strip .container { max-width: 600px; }
.cta-strip p { margin-top: 0; }
.cta-strip .btn-donate { margin-top: 1rem; }

/* Content sections */
.content-section { padding: 2rem 0; }
.content-section + .content-section { border-top: 1px solid var(--border); }

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 2rem 1.25rem 1rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  max-width: 1000px;
  margin: 0 auto 1.5rem;
}
.footer-brand { flex-shrink: 0; }
.footer-logo {
  font-family: 'Libre Baskerville', serif;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 2rem; }
.footer-nav-block { min-width: 120px; }
.footer-nav-title {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  display: block;
  margin-bottom: 0.5rem;
}
.footer-nav-sublist {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-nav-sublist a { font-size: 0.9rem; }
.footer-bottom {
  max-width: 1000px;
  margin: 0 auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.footer-legal .sep { margin: 0 0.5rem; }

/* Login */
.error-msg { color: #c75c5c; }

/* Chatbot */
#chatbot-root { position: relative; }
.chatbot-panel {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 360px;
  max-width: calc(100vw - 2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 9999;
}
.chatbot-panel textarea {
  width: 100%;
  min-height: 80px;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  border-radius: 4px;
  resize: vertical;
}
.chatbot-drop-zone {
  border: 2px dashed var(--border);
  border-radius: 4px;
  padding: 0.75rem;
  margin: 0.5rem 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.chatbot-drop-zone.dragover { border-color: var(--accent); }
.chatbot-panel select {
  width: 100%;
  margin: 0.5rem 0;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
}
.chatbot-panel button[type="button"] { margin-top: 0.5rem; }
.chatbot-status { font-size: 0.875rem; margin-top: 0.5rem; color: var(--text-muted); }
.chatbot-bubble {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  z-index: 9998;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
