
:root {
  --bg: #0b1020;
  --panel: #151c33;
  --panel-soft: #1b2440;
  --text: #e9eefc;
  --muted: #aab6da;
  --line: #2a355e;
  --accent: #8fb4ff;
  --accent-2: #c9a7ff;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  --backdrop-blur: blur(10px);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  line-height: 1.6;
  background:
    linear-gradient(rgba(10, 10, 20, 0.5), rgba(10, 10, 20, 0.85)),
    url("book-cover-bg.png");

  background-size: cover;
  background-position: top center;
  background-repeat: no-repeat;
  background-attachment: fixed; /* desktop */

  color: #e6e6f0;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.xwrap {
      width: min(1180px, calc(100% - 2rem));
      margin: 0 auto;
      padding: 2rem 0 4rem;
    }

.wrap { width: min(1080px, calc(100% - 2rem)); margin: 0 auto; }
.hero {
  padding: 5rem 0 4rem;
  background:
    radial-gradient(circle at top right, rgba(143, 180, 255, 0.20), transparent 26%),
    radial-gradient(circle at top left, rgba(201, 167, 255, 0.18), transparent 20%);
  border-bottom: 1px solid var(--line);
}
a.code {
  font-family: "Courier New", Courier, monospace;
  font-size: 0.95rem;

  color: #c9d1ff;
  background-color: rgba(80, 80, 120, 0.25);

  padding: 2px 6px;
  border-radius: 4px;

  text-decoration: none;
  border: 1px solid rgba(120, 120, 180, 0.3);

  transition: all 0.15s ease;
}
a.code:hover {
  color: #ffffff;
  background-color: rgba(120, 120, 200, 0.35);
  border-color: rgba(160, 160, 220, 0.5);
}
.eyebrow {
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-size: 0.82rem;
}
h1, h2, h3 { line-height: 1.2; margin-top: 0; }
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); margin-bottom: 1rem; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); margin-bottom: 1rem; }
h3 { font-size: 1.15rem; margin-bottom: 0.75rem; }
xh1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.08;
  font-weight: normal;
}

.subhead {
  width: min(760px, 100%);
  margin: 1rem auto 0;
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--muted);
}

.subtitle {
  max-width: 700px;
  color: var(--muted);
  font-size: 1.15rem;
  margin-bottom: 1.5rem;
}
.hero-actions, .footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.button {
  display: inline-block;
  padding: 0.8rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  text-decoration: none;
}
.button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #09101f;
  border: none;
  font-weight: 700;
}
.section { padding: 3.5rem 0; }
.section.alt { background: rgba(255,255,255,0.025); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.35rem;
  box-shadow: var(--shadow);
}
.card p:last-child, .card ul:last-child, .card ol:last-child { margin-bottom: 0; }
.feature a { font-weight: 600; }
ul, ol { padding-left: 1.2rem; }
.chapter-list li { margin-bottom: 0.45rem; }
.footer {
  padding: 2rem 0 3rem;
}
.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}
code, pre {
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
}
.page-hero {
  padding: 3rem 0 1rem;
}
.page-hero p { color: var(--muted); max-width: 800px; }
.back-link { display: inline-block; margin-bottom: 1rem; }
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 16px;
  overflow: hidden;
}
th, td {
  text-align: left;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { background: var(--panel-soft); }
tr:last-child td { border-bottom: none; }
.note {
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--accent);
  background: rgba(143, 180, 255, 0.08);
  border-radius: 12px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: var(--backdrop-blur);
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);

}

.nav-wrap {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.95rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand,
.site-nav a {
  text-decoration: none;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.brand {
  font-size: 1rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

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

.site-nav a {
  font-size: 0.95rem;
  color: var(--muted);
  transition: color 0.15s ease;
}

.site-nav a:hover,
.brand:hover {
  color: #ffffff;
}

@media (max-width: 960px) {
  body {
    background-attachment: fixed;
    background-position: center top;
  }

  .stage {
    grid-template-columns: 1fr;
  }

  .book-stack {
    position: static;
  }

  .page-spread.active {
    grid-template-columns: 1fr;
  }

  .page-right::before,
  .page-left::before {
    display: none;
  }
}

@media (max-width: 700px) {
  .nav-wrap {
    width: min(100% - 1rem, 1100px);
    padding: 0.85rem 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    gap: 0.75rem 1rem;
  }

  .site-nav a {
    font-size: 0.92rem;
  }

  .wrap {
    width: min(100% - 1rem, 1180px);
    padding: 1rem 0 2rem;
  }

  .viewer-shell {
    padding: 1rem;
    border-radius: 18px;
  }

  .page,
  .single-panel .page {
    min-height: auto;
    padding: 1.5rem 1.25rem 2.25rem;
    border-radius: 14px;
  }

  .page h2 {
    font-size: 1.6rem;
  }

  .page p {
    font-size: 1rem;
    line-height: 1.72;
  }
}

@media (max-width: 840px) {
  .grid.two, .grid.three, .footer-grid { grid-template-columns: 1fr; display: grid; }
}
