:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --theme-primary: #3ff7f2;
  --theme-primary-rgb: 63, 247, 242;
  --theme-secondary: #ff2b99;
  --theme-secondary-rgb: 255, 43, 153;
  --bg: #05050d;
  --paper: rgba(14, 15, 28, 0.92);
  --paper-soft: rgba(22, 23, 39, 0.88);
  --text: #f7f7fb;
  --muted: #c9cad8;
  --soft: #9295aa;
  --line: rgba(255, 255, 255, 0.14);
  --cyan: var(--theme-primary);
  --magenta: var(--theme-secondary);
  --amber: #ffb84d;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 8%, rgba(var(--theme-secondary-rgb), 0.22), transparent 34%),
    radial-gradient(circle at 82% 18%, rgba(var(--theme-primary-rgb), 0.16), transparent 30%),
    linear-gradient(180deg, rgba(5, 5, 13, 0.24), #05050d 72%),
    repeating-linear-gradient(90deg, transparent 0 88px, rgba(var(--theme-primary-rgb), 0.035) 89px),
    repeating-linear-gradient(0deg, transparent 0 76px, rgba(var(--theme-secondary-rgb), 0.028) 77px),
    var(--bg);
  line-height: 1.62;
  overflow-x: hidden;
}

body::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  height: 44vh;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 0%, rgba(var(--theme-secondary-rgb), 0.13) 38%, rgba(var(--theme-primary-rgb), 0.12) 41%, transparent 44%),
    repeating-linear-gradient(90deg, transparent 0 62px, rgba(var(--theme-primary-rgb), 0.12) 63px),
    repeating-linear-gradient(0deg, transparent 0 34px, rgba(var(--theme-secondary-rgb), 0.11) 35px);
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.78), transparent 88%);
  opacity: 0.72;
}

a,
button {
  font: inherit;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}

header,
main,
footer {
  position: relative;
  z-index: 1;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-height: 68px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 13, 0.9);
  backdrop-filter: blur(18px);
}

nav {
  display: none;
  position: absolute;
  top: 68px;
  left: 0;
  right: 0;
  padding: 10px 18px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 13, 0.97);
}

nav.open {
  display: grid;
  gap: 4px;
}

nav a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: none;
}

nav a:hover {
  color: var(--text);
  background: rgba(var(--theme-primary-rgb), 0.1);
}

.menu {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
}

.section {
  width: min(1060px, calc(100% - 32px));
  margin: 0 auto;
  padding: 72px 0;
  scroll-margin-top: 86px;
}

.hero {
  min-height: calc(100svh - 68px);
  display: grid;
  align-items: center;
  gap: 34px;
  padding-top: 34px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 18px;
  font-size: 3rem;
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 18px;
  font-size: 2rem;
  line-height: 1.04;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 1.25rem;
  line-height: 1.2;
  color: var(--cyan);
}

p,
li {
  color: var(--muted);
}

strong {
  color: var(--text);
}

.hero-text {
  max-width: 720px;
  font-size: 1.1rem;
}

.download-action {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin-top: 22px;
  border-radius: 8px;
  padding: 12px 18px;
  color: #060610;
  background: var(--cyan);
  text-decoration: none;
  font-weight: 850;
  box-shadow: 0 0 26px rgba(var(--theme-primary-rgb), 0.34);
}

.secondary-action {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  box-shadow: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.cover {
  max-width: 520px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(var(--theme-primary-rgb), 0.28);
  border-radius: 8px;
  background: #05050d;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42), 0 0 48px rgba(var(--theme-secondary-rgb), 0.22);
}

.cover img {
  display: block;
  width: 100%;
  height: auto;
}

.paper,
.chapter,
.toc,
.note-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.25);
}

.paper,
.chapter,
.note-box {
  padding: 22px;
}

.toc {
  padding: 22px;
}

.toc-grid {
  display: grid;
  gap: 0;
}

.toc a {
  min-height: 46px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
}

.toc a:last-child {
  border-bottom: 0;
}

.toc a:hover {
  color: var(--cyan);
}

.chapter {
  margin-bottom: 20px;
}

.chapter h2 {
  font-size: 1.9rem;
}

.chapter h3 {
  margin-top: 28px;
}

.chapter p,
.chapter li {
  max-width: 82ch;
}

.chapter ul {
  display: grid;
  gap: 8px;
  max-width: 82ch;
  padding-left: 24px;
}

.note-box {
  margin-top: 20px;
  border-left: 4px solid rgba(var(--theme-secondary-rgb), 0.72);
  background: rgba(var(--theme-secondary-rgb), 0.08);
}

.note-box p:last-child,
.paper p:last-child,
.chapter p:last-child {
  margin-bottom: 0;
}

.source-grid {
  display: grid;
  gap: 12px;
}

.source-grid a {
  min-height: 46px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
}

.source-grid a:last-child {
  border-bottom: 0;
}

.source-grid a:hover {
  color: var(--cyan);
}

footer {
  padding: 34px 18px 42px;
  border-top: 1px solid var(--line);
  text-align: center;
  background: transparent;
}

footer p {
  margin: 0;
  color: var(--soft);
}

[data-animate] {
  opacity: 0;
  transform: translateY(14px);
  animation: enter 520ms ease forwards;
}

[data-animate="2"] {
  animation-delay: 90ms;
}

@keyframes enter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 768px) {
  header {
    padding-inline: 40px;
  }

  .section {
    width: min(1060px, calc(100% - 56px));
  }

  .hero {
    width: min(1180px, calc(100% - 56px));
    grid-template-columns: minmax(0, 0.92fr) minmax(300px, 0.62fr);
    min-height: 86vh;
  }

  h1 {
    font-size: 5.2rem;
  }

  h2 {
    font-size: 3.05rem;
  }

  .chapter h2 {
    font-size: 2.55rem;
  }

  .hero-text {
    font-size: 1.24rem;
  }

  .toc-grid,
  .source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 28px;
  }
}

@media (min-width: 1040px) {
  header {
    justify-content: center;
  }

  nav {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .menu {
    display: none;
  }
}

@media (min-width: 1180px) {
  .hero {
    grid-template-columns: minmax(0, 0.95fr) 460px;
    gap: 64px;
  }
}
