

:root {
  --bg: #272e33;
  --bg-deep: #232a2e;
  --sheet: #2e383e;
  --sheet-top: #313b41;
  --text: #d3c6aa;
  --muted: #859289;
  --faint: #9da9a0;
  --links: #a7c080;
  --border: #414b50;
  --highlight: #475258;
  --code: #e67e80;
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --display: "Lora", Georgia, serif;
  --mono: "Cascadia Code", "Courier New", monospace;
  --measure: 42rem;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.9;
}

::selection { background: var(--highlight); color: var(--text); }

:focus-visible { outline: 2px solid var(--links); outline-offset: 3px; }

a { color: var(--links); text-underline-offset: 0.18em; }
a:hover { color: var(--text); }


.grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}


.sheet {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  background: linear-gradient(180deg, var(--sheet-top) 0%, var(--sheet) 14%, #2b3339 100%);
}

@media (min-width: 720px) {
  .sheet {
    margin: 2.5rem auto;
    padding: 3.5rem 4rem 4rem;
    border: 1px solid var(--border);
    border-radius: 16px;
  }
}


.masthead { text-align: center; margin-bottom: 2.5rem; }


.pfp {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 1.4rem;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 50%;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.6rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}
.nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.nav a:hover { color: var(--links); }
.nav a[aria-current="page"] { color: var(--links); text-decoration: underline; }


.go-back-wrap { margin: 0 0 2.2rem; }
.go-back {
  display: inline-block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--muted);
  text-decoration: none;
  background: var(--sheet);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 1.15rem;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}
.go-back:hover { color: var(--links); border-color: var(--links); }


h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
}
h1 {
  font-size: clamp(2rem, 6vw, 2.9rem);
  text-align: center;
  margin: 0.4rem 0 1.4rem;
}
h2 { font-size: 2.2rem; color: var(--links); margin: 2.4em 0 0.6em; }
h3 { font-size: 1.75rem; color: var(--links); margin: 2em 0 0.5em; }

.page-label {
  margin: 0;
  text-align: center;
  font-size: 0.82rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede { font-size: 1.15rem; }
.quiet { color: var(--muted); font-size: 0.98rem; }

.fleuron {
  text-align: center;
  color: var(--muted);
  font-size: 1.05rem;
  margin: 2.4rem 0;
}


.title-page { text-align: center; padding-top: clamp(2rem, 10vh, 6rem); }
 .book-title {
  font-weight: 700;
  font-size: clamp(3.4rem, 14vw, 6rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
  margin: 0;
}
.wave-equation {
  margin:0 0 1.1rem;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.epigraph {
  max-width: 34rem;
  margin: 0 auto;
  border: 0;
  padding: 0;
  font-style: italic;
  font-size: 1.35rem;
  line-height: 1.7;
}
.epigraph p { margin: 0; }

.contents { list-style: none; margin: 0; padding: 0; }
.contents-entry { margin: 1.7rem 0; }
.contents-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.6rem;
  text-decoration: none;
  color: var(--text);
}
.chapter-no {
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.contents-dots {
  flex: 1 1 auto;
  min-width: 1.5rem;
  border-bottom: 1px dotted var(--border);
  transform: translateY(-4px);
}
.contents-date { font-size: 0.95rem; color: var(--muted); white-space: nowrap; }
.contents-name {
  display: block;
  flex: 1 1 100%;
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.25;
}
.contents-title:hover .contents-name { color: var(--links); }
.contents-tags { margin: 0.35rem 0 0; font-size: 0.85rem; }
.tag {
  display: inline-block;
  margin: 0 0.35rem 0.35rem 0;
  padding: 0.05rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
}
a.tag:hover { color: var(--links); border-color: var(--links); }


.chapter-date {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 0.6rem;
}
.chapter-tags { text-align: center; margin: 1.2rem 0 0; }
.prose p { margin: 1.1em 0; }
 .prose > p:first-of-type::first-letter {
  font-family: var(--display);
  font-weight: 700;
  font-size: 3.4em;
  float: left;
  line-height: 0.85;
  padding-right: 0.12em;
  padding-top: 0.06em;
}
@media (min-width: 640px) {
  .prose p { text-align: justify; hyphens: auto; }
}
.prose a { text-decoration-color: #a7c08088; text-decoration-thickness: 1px; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin: 0.4em 0; }
.prose blockquote {
  margin: 1.6em 0;
  padding-left: 1.2rem;
  border-left: 2px solid var(--border);
  font-style: italic;
  color: var(--text);
}
.prose blockquote p { margin: 0.4em 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.4em 0.6em; text-align: left; }

code { font-family: var(--mono); font-size: 0.92em; font-weight: 500; }
.prose :not(pre) > code {
  background: var(--highlight);
  color: var(--code);
  padding: 0.1em 0.4em;
  border-radius: 6px;
}
.prose pre {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
  overflow-x: auto;
  font-size: 1rem;
  line-height: 1.7;
}
.prose pre code { background: none; color: var(--text); padding: 0; }


.hljs-comment, .hljs-quote { color: var(--muted); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-doctag, .hljs-template-tag { color: #e67e80; }
.hljs-string, .hljs-regexp { color: #a7c080; }
.hljs-number, .hljs-literal { color: #d699b6; }
.hljs-title, .hljs-title.function_, .hljs-section, .hljs-name { color: #83c092; }
.hljs-built_in, .hljs-type, .hljs-class { color: #dbbc7f; }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable { color: var(--text); }
.hljs-meta { color: var(--muted); }
.hljs-operator, .hljs-punctuation { color: #9da9a0; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

figure { margin: 2.2rem 0; text-align: center; }
figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 3px;
}
figcaption { margin-top: 0.6rem; font-size: 0.92rem; font-style: italic; color: var(--muted); }

.chapter-nav {
  display: grid;
  gap: 1.2rem;
  margin-top: 1rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
}
@media (min-width: 640px) {
  .chapter-nav { grid-template-columns: 1fr 1fr; }
  .chapter-nav-next { text-align: right; }
}
.chapter-nav-link { text-decoration: none; color: var(--text); display: block; }
.chapter-nav-link:hover .chapter-nav-title { color: var(--links); }
.chapter-nav-dir {
  display: block;
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.chapter-nav-title { font-family: var(--display); font-size: 1.25rem; font-weight: 700; }


 .coming-soon {
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 700;
  text-align: center;
  margin: 2rem 0 1rem;
}
.papers { list-style: none; margin: 0; padding: 0; }
.paper { margin: 2rem 0; padding-bottom: 1.6rem; border-bottom: 1px solid var(--border); }
.paper-title { font-family: var(--display); font-size: 1.5rem; font-weight: 700; margin: 0; }
.paper-meta { color: var(--muted); font-size: 0.95rem; margin: 0.2rem 0; }


.contact-group { margin: 2.4rem 0; }
.contact-group h2 { margin-top: 0; }
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list a, .contact-list code { overflow-wrap: anywhere; }
.contact-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.8rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #414b5055;
}
.contact-label {
  flex: 0 0 8.5rem;
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  padding: 0.05rem 0.7rem;
  cursor: pointer;
}
.copy-btn:hover { color: var(--links); border-color: var(--links); }
.pgp-key {
  margin-top: 1.2rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.8rem 1.1rem;
}
.pgp-key summary { cursor: pointer; font-family: var(--display); font-size: 1.2rem; font-weight: 700; }
.pgp-key pre {
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 1rem 0 0.2rem;
}


.colophon {
  margin-top: 4rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}
.colophon p { margin: 0.3rem 0; }


@media print {
  body { background: #fff; color: #222; font-size: 12pt; }
  .grain, .nav, .go-back, .copy-btn, script { display: none !important; }
  .sheet { border: 0; margin: 0; max-width: none; background: none; }
  a { color: #222; }
}
