/* ===== World Gate canonical theme (migrated from TOC + Chapter templates) ===== */

body {
  max-width: 720px;
  margin: 2rem auto;
  padding: 0 1rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.7;

  background-color: #0d0f12;
  color: #d4d4d4;
}

/* Override the global 720px centered body layout
   when using full-bleed background layouts */
body.wg-bg {
  max-width: none;
  margin: 0;
  padding: 0;

  background-color: #000;
  color: #d6d6d6;
}

body.wg-bg h1,
body.wg-bg h2,
body.wg-bg h3 {
  color: #e2e2e2;
}

header { margin-bottom: 2rem; }

/* Chapter template uses footer margin-bottom too */
footer { margin-bottom: 2rem; }

h1 {
  margin: 0.5rem 0 1rem;
  font-size: 1.75rem;
  color: #e0e0e0;
}

h2 {
  color: #e0e0e0;
  margin-top: 1.5rem;
}

a {
  color: #7fb7ff;
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ===== Site nav (full-width feel) ===== */
.site-nav {
  display: flex;
  align-items: center;
  padding: 0.25rem 0 1.25rem;
}

.site-nav a {
  color: #7fb7ff;
  text-decoration: none;
}
.site-nav a:hover { text-decoration: underline; }

ul { padding-left: 1.2rem; }

::selection {
  background: #2a5bd7;
  color: #ffffff;
}

/* ===== TOC: Chapter list layout ===== */
#chapter-list { margin-top: 0.75rem; }

li.chapter-item {
  margin: 0.5rem 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.chapter-date {
  color: #9aa4b2;
  opacity: 0.85;
  font-size: 0.95em;
  white-space: nowrap;
}

/* ===== Overview + credits ===== */
.book-overview { margin: 0.75rem 0; }

.book-credits {
  margin: 0.75rem 0 0.5rem;
  font-size: 0.95rem;
  opacity: 0.95;
}
.book-credits div { margin: 0.15rem 0; }

.book-hero {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.book-hero-main {
  flex: 1 1 auto;
  min-width: 0;
}

.book-hero-aside {
  flex: 0 0 auto;
}

.book-cover {
  display: block;
  width: 220px;
  max-width: 35vw;
  height: auto;
  border-radius: 12px;
}

/* Responsive: stack on small screens */
@media (max-width: 780px) {
  .book-hero {
    flex-direction: column;
  }
  .book-cover {
    width: 240px;
    max-width: 100%;
  }
}

/* ===== Collapsible blocks ===== */
details.collapsible {
  margin-top: 1rem;
  border: 1px solid #2a2d33;
  border-radius: 10px;
  background: #11141a;
  padding: 0.75rem 1rem;
}

summary.collapsible-summary {
  cursor: pointer;
  list-style: none;

  color: #e0e0e0;
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0;
}

summary.collapsible-summary::-webkit-details-marker {
  display: none;
}

summary.collapsible-summary::before {
  content: "▶";
  display: inline-block;
  width: 1.25rem;
  margin-right: 0.25rem;
  opacity: 0.85;
  transform: translateY(-1px);
}

details.collapsible[open] summary.collapsible-summary::before {
  content: "▼";
}

.collapsible-body {
  margin-top: 0.75rem;
}

.collapsible-body p {
  margin: 0.6rem 0;
  font-size: 0.95rem;
  line-height: 1.55;
}

.courtesy-note {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  opacity: 0.85;
}

/* ===== Read/unread styling ===== */
a.chapter-link strong { font-weight: 700; }
a.chapter-link.read strong { font-weight: 400; }
a.chapter-link.read { opacity: 0.6; }

/* ===== Chapter page content spacing ===== */
main p {
  margin: 1.25rem 0;
}

/* ===== Chapter prev/next nav ===== */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  margin: 3rem 0;
  font-size: 0.95rem;
}
.chapter-nav a.next-link { margin-left: auto; }
.chapter-nav .disabled { visibility: hidden; }

/* ===== Footer styling (shared) ===== */
footer {
  font-size: 0.9rem;
  color: #a8a8a8;
  border-top: 1px solid #2a2d33;
  padding-top: 1.5rem;
  margin-top: 2.5rem;
}

footer a {
  color: #7fb7ff;
  text-decoration: none;
}
footer a:hover { text-decoration: underline; }

.footer-links a {
  color: #7fb7ff;
  text-decoration: none;
}
.footer-links a:hover { text-decoration: underline; }

.footer-meta {
  margin-top: 0.75rem;
  opacity: 0.95;
}

.footer-meta p {
  margin: 0.5rem 0;
}

/* ===== Homepage hero text ===== */
.home-hero p {
  margin: 0.75rem 0 0;
  color: #d4d4d4;
  opacity: 0.95;
}

body.wg-bg .home-hero p {
  color: inherit;
}

/* ===================================================================== */
/* === World Gate: fixed background + centered reading panel system === */
/* ===================================================================== */

.wg-bg {
  min-height: 100vh;
}

/* Homepage background */
.wg-bg-home {
  background-image: var(--wg-bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* Global dim overlay */
.wg-bg::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 0;
}

/* Centering shell */
.wg-shell {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 1;
}

/* Readable panel (~80% width, capped) */
.wg-panel {
  width: min(70vw, 860px);

  padding:
    clamp(28px, 4vh, 40px)
    clamp(32px, 4vw, 44px)
    clamp(30px, 4vh, 36px);

  background: rgba(0, 0, 0, 0.82);
  box-shadow: 0 10px 35px rgba(0,0,0,0.55);
}

/* Footer inside panel */
.wg-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ===== Mobile adjustments + iOS fallback ===== */
@media (max-width: 720px) {
  .wg-shell {
    padding: 22px 0;
  }

  .wg-panel {
    width: min(92vw, 980px);
    padding: 20px 16px;
    border-radius: 12px;
  }

  /* iOS Safari ignores fixed backgrounds */
  .wg-bg-home {
    background-attachment: scroll;
  }
}

.site-nav {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0.25rem 0 1.25rem;
}

.site-brand {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #7fb7ff;
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}

.site-nav-link {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(127, 183, 255, 0.85);
  text-decoration: none;
}

.site-nav-link:hover {
  color: #7fb7ff;
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}

.site-nav-sep {
  opacity: 0.35;
}

.wg-comments {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.giscus {
  opacity: 0.95;
}

.latest-chapter {
  margin: 1.25rem 0 1.75rem;
  padding-left: 0.75rem;
  border-left: 2px solid rgba(127, 183, 255, 0.4);
  font-size: 0.95rem;
}

.latest-label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  opacity: 0.6;
  margin-bottom: 0.25rem;
}

.latest-link {
  font-weight: 600;
}

.latest-date {
  margin-left: 0.5rem;
  opacity: 0.6;
  font-size: 0.85em;
}

.latest-link.read {
  opacity: 0.6;
}

.author-portrait img {
  display: block;
  width: clamp(160px, 22vw, 220px);
  max-width: 100%;
  height: auto;

  margin: 0 auto;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}

.author-tribute {
  margin-bottom: 1.75rem;
}

.author-tribute::after {
  content: "";
  display: block;
  margin: 1.25rem auto 0;
  width: 60%;
  height: 1px;
  background: rgba(255,255,255,0.06);
}

.wg-surface {
  padding-inline: clamp(1.25rem, 4vw, 2.25rem);
  padding-block: clamp(1.5rem, 4vh, 2.5rem);
}

