:root {
  --bg: #06080a;
  --fg: #e8edf0;
  --dim: #8c969e;
  --line: rgba(232, 237, 240, 0.12);
  --accent: #7cc8ff;
  --gold: #ffd36b;   /* the gold of "Everyone Lives" on the book's cover */
  --gutter: clamp(20px, 5vw, 72px);
  --display: "Michroma", "Eurostile", "Segoe UI", sans-serif;
  --text: "Saira", "Segoe UI", system-ui, sans-serif;
  --mono: "Share Tech Mono", ui-monospace, "Consolas", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--bg); scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--text);
  font-weight: 300;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.2rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 1px solid var(--accent); outline-offset: 6px; }

h1, h2 {
  font-family: var(--display);
  font-weight: 400;
  margin: 0;
  letter-spacing: 0.01em;
}

h1 { font-size: clamp(1.75rem, 4.4vw, 3.9rem); line-height: 1.18; max-width: 17ch; }
h2 { font-size: clamp(1.3rem, 2.6vw, 2.3rem); line-height: 1.25; }
p { margin: 0; }

.label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

.wrap {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Background visual */
#field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

.veil {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(6, 8, 10, 0.92) 0%, rgba(6, 8, 10, 0.55) 45%, rgba(6, 8, 10, 0) 75%),
    linear-gradient(180deg, rgba(6, 8, 10, 0.6) 0%, rgba(6, 8, 10, 0) 18%, rgba(6, 8, 10, 0) 82%, rgba(6, 8, 10, 0.7) 100%);
}

main, .top { position: relative; z-index: 1; }

/* Scroll progress hairline */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  z-index: 3;
  background: transparent;
}
.progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* Header */
.top {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--gutter);
  background: linear-gradient(180deg, rgba(6, 8, 10, 0.9) 0%, rgba(6, 8, 10, 0.6) 70%, rgba(6, 8, 10, 0) 100%);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.nav { display: flex; gap: clamp(16px, 3vw, 40px); }
.nav a {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  transition: color 0.25s;
}
.nav a:hover { color: var(--fg); }
.nav a.is-current { color: var(--accent); }

/* Hero */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  position: relative;
  padding: 120px 0 96px;
}
.hero .label { margin-bottom: 28px; color: var(--accent); }
.lede { margin-top: 32px; max-width: 46ch; color: var(--dim); }
.cue {
  position: absolute;
  left: var(--gutter);
  bottom: 32px;
  padding-left: 56px;
}
.cue::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 40px;
  height: 1px;
  background: var(--dim);
}

/* The title, set as on the cover: it breaks after its comma, and the second
   line takes the cover's gold. */
.hero h1 { max-width: none; }
.g { color: var(--gold); }
.hero__sub {
  margin-top: 28px;
  max-width: 30ch;
  font-weight: 500;
  font-size: clamp(1.05rem, 0.9rem + 0.9vw, 1.6rem);
  line-height: 1.35;
  letter-spacing: 0.03em;
}
.nb { white-space: nowrap; }
.hero .hero__author { margin-top: 30px; margin-bottom: 0; font-size: 0.9rem; letter-spacing: 0.3em; }

/* A plain text link: a hairline under it, brighter on hover */
.link {
  color: var(--fg);
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 1px no-repeat;
  padding-bottom: 3px;
  transition: color 0.25s;
}
.link:hover { color: var(--accent); }

/* The book: the words on the back cover */
.pitch {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 120px 0;
  border-top: 1px solid var(--line);
}
.pitch h2 { max-width: 40rem; text-wrap: balance; }
.pitch__body { max-width: 38rem; margin-top: 28px; color: var(--dim); }
.pitch__big {
  max-width: 40rem;
  margin-top: 34px;
  font-family: var(--display);
  font-size: clamp(1rem, 1.6vw, 1.45rem);
  line-height: 1.45;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

/* Statement */
.statement {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 120px 0;
  border-top: 1px solid var(--line);
}
.statement .label { margin-bottom: 28px; color: var(--accent); }
.statement h2 { max-width: 40rem; }
.statement__body { max-width: 38rem; margin-top: 28px; color: var(--dim); }

/* Titles: the cover, with the book's details beside it */
.titles {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 120px 0;
  border-top: 1px solid var(--line);
}
.titles h2 { margin-bottom: clamp(36px, 6vh, 56px); }
.book {
  display: grid;
  grid-template-columns: auto minmax(0, 24rem);
  justify-content: start;
  align-items: center;
  gap: clamp(28px, 4vw, 56px);
}
.book__cover {
  display: block;
  width: clamp(190px, 19vw, 280px);
  height: auto;
  outline: 1px solid var(--line);
}
.book h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.05rem, 1.5vw, 1.4rem);
  line-height: 1.35;
  letter-spacing: 0.01em;
  margin: 0;
  text-wrap: balance;
}
.book__sub { margin-top: 14px; }
.book__author { margin-top: 6px; color: var(--dim); }
.book__formats { margin-top: 30px; margin-bottom: 14px; color: var(--accent); }
.book__isbn { margin-top: 6px; }
.book__pub { margin-top: 26px; }

/* Closing section: the notes, with the foot beneath */
.closing {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding: 120px 0 0;
  border-top: 1px solid var(--line);
}
.closing .wrap:first-child { margin-top: auto; margin-bottom: auto; }
.closing .label { margin-bottom: 22px; }
.closing h2 { margin-bottom: 22px; }
.closing .wrap:first-child p { color: var(--dim); max-width: 44ch; }
.closing .wrap:first-child p.more { margin-top: 34px; max-width: none; }
.more a {
  display: inline-block;
  padding: 14px 24px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  transition: border-color 0.25s, background-color 0.25s;
}
.more a:hover { border-color: var(--accent); background-color: rgba(124, 200, 255, 0.08); }
.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 28px;
  padding-bottom: 28px;
  border-top: 1px solid var(--line);
}
.foot a {
  color: var(--fg);
  text-transform: none;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 1px no-repeat;
  padding-bottom: 4px;
  transition: background-size 0.4s ease;
}
.foot a:hover { background-size: 100% 1px; }

/* Notes page. It is long reading matter, so the moving field is held well
   back, the top bar is solid, and the notes themselves are never typed. */
.page-notes .veil { background: rgba(6, 8, 10, 0.88); }
.page-notes .top { background: rgba(6, 8, 10, 0.95); border-bottom: 1px solid var(--line); }
.notes-head { padding: 170px 0 44px; }
.notes-head h1 { max-width: none; }
.notes-head .lede { margin-top: 24px; max-width: 52ch; }
.notes { max-width: 54rem; padding-bottom: 72px; }
.notes__toc {
  padding: 24px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.notes__toc ol { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 48px; }
.notes__toc li { break-inside: avoid; padding: 5px 0; font-size: 0.92rem; line-height: 1.4; }
.notes__toc a { color: var(--dim); transition: color 0.25s; }
.notes__toc a:hover { color: var(--accent); }
.notes section { scroll-margin-top: 96px; }
.notes h2 {
  margin: 56px 0 20px;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.4;
  text-wrap: balance;
}
.notes__list { margin: 0; padding-left: 2.4em; }
.notes__list li {
  margin-bottom: 14px;
  padding-left: 0.3em;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #b9c2c9;
  overflow-wrap: anywhere;
}
.notes__list li::marker { font-family: var(--mono); font-size: 0.8rem; color: var(--dim); }
.notes__list .k { color: var(--fg); font-weight: 500; }
.notes__list a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(124, 200, 255, 0.35);
  text-underline-offset: 3px;
}
.notes__list a:hover { text-decoration-color: var(--accent); }
.notes__up { margin-top: 56px; }
.foot--page { margin-top: 0; }

/* Motion layer: only when JavaScript runs. The visitor's reduce-motion
   setting is not consulted; that is the owner's choice. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Type-on text: characters wait hidden, then appear in order. The newest
   ones carry a highlight that fades out behind the typing front. */
.type .c { opacity: 0; }
.type.done .c { opacity: 1; }
.type.typing .c {
  animation: typeIn calc(var(--step, 10ms) * 12 + 60ms) linear both;
  animation-delay: calc(var(--i) * var(--step, 10ms));
}
@keyframes typeIn {
  0% { opacity: 0; color: #ffffff; background-color: rgba(124, 200, 255, 0.42); }
  12% { opacity: 1; color: #ffffff; background-color: rgba(124, 200, 255, 0.42); }
  55% { opacity: 1; background-color: rgba(124, 200, 255, 0.14); }
  100% { opacity: 1; background-color: rgba(124, 200, 255, 0); }
}

.motion .cue::before { animation: cue 2.4s ease-in-out infinite; transform-origin: 0 50%; }
@keyframes cue {
  0%, 100% { transform: scaleX(0.35); }
  50% { transform: scaleX(1); }
}

@media (max-width: 760px) {
  .top { flex-direction: column; align-items: flex-start; gap: 12px; padding-top: 18px; padding-bottom: 22px; }
  .nav { width: 100%; justify-content: space-between; gap: 8px; }
  .nav a { font-size: 0.64rem; letter-spacing: 0.12em; }
  .veil {
    background:
      linear-gradient(180deg, rgba(6, 8, 10, 0.75) 0%, rgba(6, 8, 10, 0.45) 40%, rgba(6, 8, 10, 0.45) 60%, rgba(6, 8, 10, 0.8) 100%);
  }
  .foot { flex-direction: column; }
  .foot .label { font-size: 0.64rem; letter-spacing: 0.12em; }
  .book { grid-template-columns: minmax(0, 1fr); }
  .book__cover { width: min(58vw, 240px); }
  .notes-head { padding-top: 150px; }
  .notes__toc ol { columns: 1; }
  .notes section { scroll-margin-top: 120px; }
  .notes__list { padding-left: 2em; }
}
