@font-face {
  font-family: "JetBrainsMono Nerd Font Mono";
  src: url("fonts/JetBrainsMonoNerdFontMono-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "JetBrainsMono Nerd Font Mono";
  src: url("fonts/JetBrainsMonoNerdFontMono-SemiBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f7f3e9;
  --paper-deep: #ece4d2;
  --ink: #24231f;
  --ink-soft: #4f4d47;
  --muted: #716b61;
  --rule: #c8bda9;
  --teal: #2d6264;
  --sun: #a35c37;
  --reader-font-size: 18px;
  --reader-measure: 68ch;
  --site-measure: 76ch;
  font-family: "JetBrainsMono Nerd Font Mono", "JetBrains Mono", ui-monospace,
    SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html {
  background: var(--paper-deep);
  font-size: var(--reader-font-size);
  scroll-behavior: smooth;
}

body {
  min-width: 20rem;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% -10%, rgb(255 255 255 / 76%), transparent 34rem),
    linear-gradient(90deg, transparent, rgb(255 255 255 / 19%), transparent),
    var(--paper);
  line-height: 1.78;
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--teal) 58%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: .17em;
}

a:hover { color: var(--teal); }

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

button {
  color: inherit;
  font: inherit;
}

button:not(:disabled) { cursor: pointer; }

img { max-width: 100%; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 3rem, 86rem);
  min-height: 4.35rem;
  margin: 0 auto;
  border-bottom: 1px solid var(--rule);
  gap: 1rem;
}

.wordmark {
  color: var(--ink);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: -.06em;
  text-decoration: none;
}

.wordmark span { color: var(--sun); }

.site-header nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.site-header nav a {
  text-decoration: none;
}

.site-header nav a[aria-current="page"] { color: var(--teal); }

.library-page {
  width: min(100% - 3rem, 86rem);
  margin: 0 auto;
}

.library-hero {
  max-width: var(--site-measure);
  padding: clamp(4.5rem, 12vw, 10rem) 0 clamp(4rem, 9vw, 7rem);
}

.lumin-mark {
  display: block;
  width: clamp(4rem, 10vw, 7.5rem);
  height: auto;
  margin: 0 0 2.25rem;
}

.eyebrow,
.pronunciation,
.reader-tools-label {
  margin: 0;
  color: var(--teal);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  line-height: 1.5;
  text-transform: uppercase;
}

.library-hero h1,
.book-masthead h1,
.section-heading h2 {
  margin: .7rem 0 1.25rem;
  font-size: clamp(2.15rem, 7vw, 5rem);
  font-weight: 600;
  letter-spacing: -.08em;
  line-height: 1.04;
}

.lede {
  max-width: 56ch;
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2.25vw, 1.22rem);
  line-height: 1.75;
}

.continue-reading {
  max-width: 53rem;
  margin-top: 2.7rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--rule);
  background: rgb(255 255 255 / 27%);
}

.continue-reading p { margin: 0; }

.continue-reading a {
  display: inline-block;
  margin-top: .25rem;
  color: var(--teal);
  font-size: .78rem;
  font-weight: 600;
}

.library-list {
  padding: 2.4rem 0 8rem;
  border-top: 1px solid var(--rule);
}

.section-heading { margin-bottom: 2.15rem; }

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 4vw, 2.45rem);
}

.library-list ol {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 1rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.book-card a {
  display: block;
  min-height: 14.75rem;
  padding: 1.4rem;
  border: 1px solid var(--rule);
  background: rgb(255 255 255 / 22%);
  text-decoration: none;
  transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.book-card a:hover {
  border-color: var(--teal);
  background: rgb(255 255 255 / 46%);
  color: var(--ink);
  transform: translateY(-2px);
}

.book-card h2 {
  margin: .8rem 0 .7rem;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -.05em;
  line-height: 1.24;
}

.book-subtitle {
  margin: 0;
  color: var(--ink-soft);
  font-size: .8rem;
  line-height: 1.65;
}

.book-card .read-link {
  display: block;
  margin-top: 2.15rem;
  color: var(--teal);
  font-size: .72rem;
  font-weight: 600;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 3rem, 86rem);
  min-height: 6rem;
  margin: 0 auto;
  padding: 1.25rem 0;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: .64rem;
  line-height: 1.5;
}

.site-footer p { margin: 0; }

.site-footer a { text-decoration: none; }

.reader-page-shell { width: min(100% - 3rem, 90rem); margin: 0 auto; }

.book-masthead {
  width: min(100%, 52rem);
  padding: clamp(4rem, 10vw, 8rem) 0 clamp(3rem, 7vw, 5.6rem);
}

.book-masthead .lumin-mark { width: clamp(3.7rem, 8vw, 5.7rem); margin-bottom: 2rem; }

.book-masthead h1 { margin-bottom: .85rem; }

.book-masthead .book-subtitle {
  color: var(--ink-soft);
  font-size: 1rem;
}

.pronunciation { margin-top: 1.7rem; color: var(--muted); }

.book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-top: 2.25rem;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  padding: .35rem .75rem;
  border: 1px solid var(--rule);
  background: rgb(255 255 255 / 23%);
  color: var(--ink);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .035em;
  text-decoration: none;
  text-transform: uppercase;
}

.button:hover { border-color: var(--teal); color: var(--teal); }

.button-primary {
  border-color: var(--teal);
  background: var(--teal);
  color: var(--paper);
}

.button-primary:hover { background: #224f51; color: white; }

.reading-progress {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 2px;
  background: color-mix(in srgb, var(--rule) 67%, transparent);
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--sun);
  transition: width 70ms linear;
}

.reader-layout {
  display: grid;
  grid-template-columns: minmax(11rem, 15rem) minmax(0, var(--reader-measure));
  justify-content: center;
  gap: clamp(2rem, 6vw, 6rem);
  padding: 3rem 0 8rem;
}

.reader-sidebar {
  position: sticky;
  top: 2rem;
  align-self: start;
  max-height: calc(100vh - 4rem);
  overflow: auto;
}

.contents { font-size: .68rem; line-height: 1.55; }

.contents summary {
  color: var(--teal);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
}

.contents ol {
  padding: 0;
  margin: 1rem 0;
  list-style: none;
}

.contents li { margin: .55rem 0; }

.contents a {
  color: var(--muted);
  text-decoration: none;
}

.contents a:hover,
.contents a[aria-current="location"] { color: var(--teal); }

.reader-column { min-width: 0; }

.reader-tools {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

html[data-reader-ready="true"] .reader-tools { display: flex; }

.reader-tools-label { color: var(--muted); }

.reader-tools-controls { display: flex; flex-wrap: wrap; gap: .35rem; }

.reader-tools button {
  min-width: 2.1rem;
  min-height: 2rem;
  padding: .15rem .42rem;
  border: 1px solid var(--rule);
  background: transparent;
  font-size: .62rem;
}

.reader-tools button:hover { border-color: var(--teal); color: var(--teal); }

.book-content {
  min-width: 0;
  color: var(--ink);
  font-size: 1rem;
}

.book-content > :first-child { margin-top: 0; }

.book-content h2,
.book-content h3,
.book-content h4 {
  scroll-margin-top: 4rem;
  color: var(--ink);
  line-height: 1.25;
  text-wrap: balance;
}

.book-content h2 {
  margin: 5.5rem 0 1.75rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
  font-size: clamp(1.35rem, 3.5vw, 1.95rem);
  font-weight: 600;
  letter-spacing: -.065em;
}

.book-content h3 {
  margin: 3.25rem 0 1.25rem;
  color: var(--teal);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .04em;
}

.book-content h4 {
  margin: 2.5rem 0 1rem;
  font-size: .88rem;
  font-weight: 600;
}

.book-content p,
.book-content li { max-width: var(--reader-measure); }

.book-content p { margin: 0 0 1.35rem; }

.book-content ul,
.book-content ol {
  padding-left: 1.6rem;
  margin: 1.5rem 0;
}

.book-content li { margin: .55rem 0; }

.book-content blockquote {
  max-width: calc(var(--reader-measure) - 3ch);
  margin: 2.35rem 0;
  padding: .25rem 0 .25rem 1.25rem;
  border-left: 2px solid var(--sun);
  color: var(--ink-soft);
}

.book-content blockquote p:last-child { margin-bottom: 0; }

.book-content hr {
  width: 7rem;
  margin: 3.8rem 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

.book-content em { color: var(--ink-soft); }

.book-content strong { font-weight: 700; }

.book-content code {
  padding: .05em .25em;
  background: rgb(45 98 100 / 9%);
  font-family: inherit;
  font-size: .9em;
}

.book-content pre {
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid var(--rule);
  background: rgb(255 255 255 / 28%);
}

@media (max-width: 900px) {
  .reader-layout { display: block; padding-top: 2rem; }

  .reader-sidebar {
    position: static;
    max-height: none;
    margin: 0 0 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--rule);
  }

  .contents:not([open]) nav { display: none; }
}

@media (max-width: 620px) {
  :root { --reader-font-size: 16px; --reader-measure: 100%; }

  .site-header,
  .library-page,
  .site-footer,
  .reader-page-shell { width: min(100% - 2rem, 90rem); }

  .site-header { min-height: 3.7rem; }

  .site-header nav { gap: .8rem; font-size: .61rem; }

  .library-hero { padding: 4.4rem 0 3.8rem; }

  .library-hero h1,
  .book-masthead h1 { letter-spacing: -.075em; }

  .site-footer { align-items: flex-start; flex-direction: column; gap: .45rem; }

  .book-masthead { padding: 4rem 0 3.2rem; }

  .reader-tools { align-items: flex-start; flex-direction: column; }

  .book-content h2 { margin-top: 4rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}

@media print {
  @page { margin: 20mm 18mm 22mm; }

  html, body { background: white; }

  .site-header,
  .site-footer,
  .book-actions,
  .reading-progress,
  .reader-sidebar,
  .reader-tools { display: none !important; }

  .reader-page-shell,
  .book-masthead,
  .reader-layout { display: block; width: auto; padding: 0; }

  .book-masthead { margin-bottom: 2rem; }

  .book-content { font-size: 10.5pt; }

  .book-content h2 { break-before: page; }

  .book-content h2,
  .book-content h3,
  .book-content h4,
  .book-content blockquote { break-inside: avoid; }
}
