:root {
  color-scheme: light;
  --navy-950: #0a1422;
  --navy-900: #101e30;
  --navy-800: #14243a;
  --navy-700: #223a58;
  --ink: #182131;
  --ink-soft: #526070;
  --paper: #f6f2e9;
  --paper-deep: #eee7da;
  --surface: #fffdf8;
  --surface-raised: #ffffff;
  --line: #d9d1c3;
  --line-strong: #bcb09e;
  --gold: #a67b3d;
  --gold-bright: #c6a56a;
  --oxblood: #7c2f3d;
  --mark: #f6dda4;
  --shadow: 0 18px 50px rgb(20 36 58 / 0.12);
  --serif: Georgia, "Times New Roman", Times, serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --reader-size: 1.12rem;
  --reader-width: 45rem;
  --topbar-h: 4.25rem;
  --sidebar-w: 19rem;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 1.25rem);
}

body {
  margin: 0;
  min-width: 20rem;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  text-rendering: optimizeLegibility;
}

body.nav-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--gold-bright);
  outline-offset: 3px;
}

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

.skip-link {
  position: fixed;
  top: 0.7rem;
  left: 0.8rem;
  z-index: 200;
  transform: translateY(-150%);
  padding: 0.7rem 1rem;
  border-radius: 0.35rem;
  background: var(--surface-raised);
  color: var(--navy-900);
  font-weight: 700;
  box-shadow: var(--shadow);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 80;
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0 1.25rem;
  border-bottom: 1px solid rgb(198 165 106 / 0.24);
  background: rgb(16 30 48 / 0.97);
  color: #f9f5ec;
  backdrop-filter: blur(14px);
}

.reading-meter {
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: rgb(255 255 255 / 0.08);
}

.reading-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--gold-bright);
  transition: width 140ms linear;
}

.wordmark {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
}

.wordmark-mark {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border: 1px solid var(--gold-bright);
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.wordmark-copy {
  display: grid;
  line-height: 1.05;
}

.wordmark-copy strong {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.wordmark-copy small {
  margin-top: 0.18rem;
  color: var(--gold-bright);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.icon-button,
.utility-button,
.quiet-button,
.primary-button,
.text-button,
.tool-button,
.segmented button {
  border: 0;
  cursor: pointer;
}

.icon-button,
.utility-button {
  min-height: 2.55rem;
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 0.35rem;
  background: rgb(255 255 255 / 0.06);
  color: #fff;
}

.icon-button {
  min-width: 2.55rem;
  padding: 0 0.65rem;
  font-weight: 700;
}

.utility-button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.utility-button kbd {
  padding: 0.08rem 0.35rem;
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 0.25rem;
  color: #dcd5c7;
  font: inherit;
}

.icon-button:hover,
.utility-button:hover {
  border-color: rgb(198 165 106 / 0.7);
  background: rgb(255 255 255 / 0.1);
}

.nav-toggle {
  display: none;
}

.shell {
  min-height: 100vh;
  padding-top: var(--topbar-h);
}

.book-nav {
  position: fixed;
  inset: var(--topbar-h) auto 0 0;
  z-index: 60;
  width: var(--sidebar-w);
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
  scrollbar-width: thin;
}

.nav-head {
  padding: 1.6rem 1.35rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.nav-kicker,
.eyebrow,
.chapter-label,
.page-kicker {
  margin: 0 0 0.55rem;
  color: var(--oxblood);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.17em;
  line-height: 1.35;
  text-transform: uppercase;
}

.nav-title {
  display: inline-block;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.12;
  text-decoration: none;
}

.overall-progress {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 1.25rem;
  color: var(--ink-soft);
  font-size: 0.69rem;
  font-weight: 700;
}

.overall-track {
  height: 3px;
  margin-top: 0.55rem;
  background: var(--paper-deep);
}

.overall-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--oxblood);
  transition: width 250ms ease;
}

#primary-nav {
  padding: 0.8rem 0.7rem 1rem;
}

.nav-group-title {
  margin: 1rem 0.65rem 0.45rem;
  color: var(--ink-soft);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.nav-link {
  position: relative;
  display: grid;
  grid-template-columns: 1.7rem minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.45rem;
  padding: 0.62rem 0.6rem;
  border-radius: 0.35rem;
  color: var(--ink-soft);
  font-size: 0.75rem;
  line-height: 1.25;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--paper);
  color: var(--ink);
}

.nav-link.active {
  background: var(--navy-800);
  color: #fff;
}

.nav-link .nav-num {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 700;
}

.nav-link.active .nav-num {
  color: var(--gold-bright);
}

.nav-link .nav-check {
  color: var(--gold);
  opacity: 0;
}

.nav-link.visited .nav-check {
  opacity: 1;
}

.nav-foot {
  margin: 0 1.3rem;
  padding: 1rem 0 1.8rem;
  border-top: 1px solid var(--line);
}

.nav-foot p {
  margin: 0.8rem 0 0;
  color: var(--ink-soft);
  font-size: 0.67rem;
  line-height: 1.45;
}

.quiet-button {
  padding: 0;
  background: transparent;
  color: var(--oxblood);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.quiet-button:hover,
.text-button:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.nav-scrim {
  display: none;
}

#main-content {
  min-height: calc(100vh - var(--topbar-h));
  margin-left: var(--sidebar-w);
}

.home {
  min-height: calc(100vh - var(--topbar-h));
}

.cover {
  position: relative;
  min-height: min(43rem, calc(100vh - var(--topbar-h)));
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(17rem, 0.85fr);
  overflow: hidden;
  background:
    radial-gradient(circle at 76% 28%, rgb(198 165 106 / 0.16), transparent 27%),
    linear-gradient(135deg, var(--navy-950), var(--navy-700));
  color: #fff;
}

.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgb(255 255 255 / 0.018) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 0.018) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to right, black, transparent 80%);
}

.cover-copy {
  position: relative;
  z-index: 1;
  align-self: center;
  max-width: 50rem;
  padding: clamp(3.8rem, 8vw, 8rem) clamp(2rem, 8vw, 7rem);
}

.cover-rule {
  width: 4.5rem;
  height: 2px;
  margin: 1.1rem 0 1.8rem;
  background: var(--gold-bright);
}

.cover h1 {
  max-width: 12ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3.2rem, 7vw, 6.7rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.93;
}

.cover-subtitle {
  max-width: 36rem;
  margin: 1.8rem 0 0;
  color: #dcd7ce;
  font-family: var(--serif);
  font-size: clamp(1.05rem, 2vw, 1.36rem);
  line-height: 1.55;
}

.cover-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.2rem;
}

.primary-button,
.text-button,
.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.8rem;
  padding: 0.72rem 1rem;
  border-radius: 0.25rem;
  text-decoration: none;
}

.primary-button {
  background: var(--gold-bright);
  color: var(--navy-950);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.primary-button:hover {
  background: #d4b77e;
}

.text-button {
  background: transparent;
  color: inherit;
  font-size: 0.8rem;
  font-weight: 800;
}

.cover-art {
  position: relative;
  min-height: 34rem;
  align-self: stretch;
}

.court-lines {
  position: absolute;
  inset: 12% 5% 10% 0;
  opacity: 0.88;
}

.court-lines span {
  position: absolute;
  display: block;
  border: 1px solid rgb(198 165 106 / 0.62);
}

.court-lines span:nth-child(1) {
  inset: 8% 18% 10% 13%;
}

.court-lines span:nth-child(2) {
  inset: 17% 9% 19% 23%;
}

.court-lines span:nth-child(3) {
  top: 50%;
  left: -4%;
  width: 100%;
  transform: rotate(-21deg);
  border-width: 1px 0 0;
}

.court-lines::before,
.court-lines::after {
  content: "§";
  position: absolute;
  color: rgb(198 165 106 / 0.82);
  font-family: var(--serif);
}

.court-lines::before {
  top: 8%;
  right: 12%;
  font-size: 9rem;
}

.court-lines::after {
  right: 38%;
  bottom: 7%;
  font-size: 3.5rem;
}

.cover-meta {
  position: absolute;
  right: 2rem;
  bottom: 2rem;
  z-index: 1;
  display: grid;
  gap: 0.25rem;
  padding-left: 1rem;
  border-left: 2px solid var(--gold-bright);
  color: #d9d4ca;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  line-height: 1.45;
  text-transform: uppercase;
}

.home-section,
.front-page {
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(3.5rem, 7vw, 6rem) clamp(1.35rem, 6vw, 5rem);
}

.home-intro {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(2rem, 8vw, 7rem);
  align-items: start;
}

.display-heading,
.front-page h1,
.front-page h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.08;
}

.display-heading {
  font-size: clamp(2.1rem, 5vw, 4rem);
}

.home-intro-copy p,
.front-page > p,
.front-section p,
.legal-list li {
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.75;
}

.home-intro-copy p:first-child {
  margin-top: 0;
  color: var(--ink);
  font-size: 1.28rem;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 3.4rem;
  border: 1px solid var(--line);
  background: var(--line);
}

.chapter-card {
  position: relative;
  min-height: 14rem;
  display: grid;
  grid-template-columns: 3.3rem 1fr;
  gap: 1.1rem;
  padding: 1.6rem;
  background: var(--surface);
  text-decoration: none;
  transition: background 180ms ease, transform 180ms ease;
}

.chapter-card:hover {
  z-index: 2;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card-number {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 2.6rem;
  line-height: 1;
}

.card-copy h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.38rem;
  font-weight: 600;
  line-height: 1.22;
}

.card-copy p {
  margin: 1rem 0 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.45;
}

.card-status {
  position: absolute;
  right: 1.1rem;
  bottom: 1.1rem;
  color: var(--oxblood);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem clamp(1.35rem, 6vw, 5rem);
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.73rem;
}

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

.home-footer a:hover {
  color: var(--oxblood);
}

.front-page {
  max-width: 62rem;
}

.front-page h1 {
  max-width: 18ch;
  font-size: clamp(2.6rem, 6vw, 5rem);
}

.front-deck {
  max-width: 44rem;
  margin: 1.3rem 0 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.65;
}

.front-section {
  max-width: 46rem;
  margin-top: 3.5rem;
}

.front-section h2 {
  margin-bottom: 1rem;
  font-size: 1.9rem;
}

.steps {
  display: grid;
  gap: 1.25rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: steps;
}

.steps li {
  position: relative;
  min-height: 3rem;
  padding-left: 4rem;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.65;
  counter-increment: steps;
}

.steps li::before {
  content: counter(steps, decimal-leading-zero);
  position: absolute;
  top: 0.1rem;
  left: 0;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 1.55rem;
}

.shortcut-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem 1.2rem;
  align-items: center;
  margin-top: 1.5rem;
}

.shortcut-list dt,
.shortcut-list dd {
  margin: 0;
}

.shortcut-list kbd {
  display: inline-block;
  min-width: 2rem;
  padding: 0.28rem 0.45rem;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 0.25rem;
  background: var(--surface-raised);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.shortcut-list dd {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.contents-list {
  display: grid;
  gap: 0;
  margin: 3rem 0 0;
  padding: 0;
  border-top: 1px solid var(--line-strong);
  list-style: none;
}

.contents-link {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  gap: 1.2rem;
  align-items: center;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.contents-link:hover .contents-title {
  color: var(--oxblood);
}

.contents-num {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 1.8rem;
}

.contents-title {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.35;
}

.contents-meta {
  color: var(--ink-soft);
  font-size: 0.7rem;
  white-space: nowrap;
}

.reader-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15.5rem;
  gap: clamp(2rem, 5vw, 5rem);
  max-width: calc(var(--reader-width) + 23rem);
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 5.5rem) clamp(1.35rem, 4vw, 4rem) 5rem;
}

.chapter-article {
  min-width: 0;
  max-width: var(--reader-width);
}

.chapter-masthead {
  margin-bottom: 4rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line-strong);
}

.chapter-masthead h1 {
  max-width: 17ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5vw, 4.7rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.03;
}

.chapter-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.3rem;
  margin-top: 1.5rem;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chapter-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.5rem;
}

.tool-button {
  min-height: 2.35rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.tool-button:hover,
.tool-button.is-active {
  border-color: var(--gold);
  color: var(--oxblood);
}

.search-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: -2rem 0 2.4rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.chapter-body {
  font-family: var(--serif);
  font-size: var(--reader-size);
  line-height: 1.82;
}

.chapter-body h2,
.chapter-body h3 {
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 600;
  text-wrap: balance;
}

.chapter-body h2 {
  margin: 4.6rem 0 1.15rem;
  font-size: 1.95em;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.chapter-body h2::before {
  content: "";
  display: block;
  width: 2.8rem;
  height: 2px;
  margin-bottom: 1.15rem;
  background: var(--gold);
}

.chapter-body h3 {
  margin: 2.8rem 0 0.8rem;
  font-size: 1.3em;
  line-height: 1.28;
}

.chapter-body p {
  margin: 0 0 1.25em;
  hanging-punctuation: first last;
}

.chapter-body h2 + p::first-letter {
  float: left;
  margin: 0.08em 0.1em 0 0;
  color: var(--oxblood);
  font-size: 3.4em;
  font-weight: 500;
  line-height: 0.82;
}

mark {
  padding: 0.04em 0.08em;
  background: var(--mark);
  color: #241c10;
}

.chapter-end {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 5rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line-strong);
}

.chapter-end-link {
  min-height: 7rem;
  display: grid;
  align-content: center;
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
  text-decoration: none;
}

.chapter-end-link:last-child {
  text-align: right;
}

.chapter-end-link:hover {
  border-color: var(--gold);
}

.chapter-end-link span {
  color: var(--ink-soft);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chapter-end-link strong {
  margin-top: 0.35rem;
  font-family: var(--serif);
  font-size: 0.9rem;
  line-height: 1.35;
}

.chapter-rail {
  position: sticky;
  top: calc(var(--topbar-h) + 1.7rem);
  max-height: calc(100vh - var(--topbar-h) - 3rem);
  align-self: start;
  overflow-y: auto;
  padding-left: 1.2rem;
  border-left: 1px solid var(--line);
  scrollbar-width: thin;
}

.rail-title {
  margin: 0 0 0.7rem;
  color: var(--ink-soft);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.rail-link {
  display: block;
  padding: 0.38rem 0;
  color: var(--ink-soft);
  font-size: 0.7rem;
  line-height: 1.35;
  text-decoration: none;
}

.rail-link.level-2 {
  padding-left: 0.8rem;
  font-size: 0.66rem;
}

.rail-link:hover,
.rail-link.active {
  color: var(--oxblood);
}

.rail-link.active {
  font-weight: 800;
}

.legal-list {
  margin: 1.2rem 0 0;
  padding-left: 1.2rem;
}

.legal-list li {
  padding-left: 0.4rem;
  margin-bottom: 0.9rem;
}

.modal {
  width: min(44rem, calc(100% - 2rem));
  max-height: min(48rem, calc(100vh - 2rem));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 0.3rem;
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.28);
}

.modal::backdrop {
  background: rgb(4 12 22 / 0.72);
  backdrop-filter: blur(4px);
}

.compact-modal {
  width: min(34rem, calc(100% - 2rem));
}

.modal-frame {
  margin: 0;
  padding: 1.5rem;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: start;
}

.modal-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.15;
}

.modal .icon-button {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 1.25rem;
}

.search-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.7rem;
  align-items: center;
  margin-top: 1.5rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line-strong);
  background: var(--paper);
}

.search-box input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
}

.search-status {
  margin: 0.8rem 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.search-results {
  max-height: 24rem;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.search-result {
  width: 100%;
  display: block;
  padding: 1rem 0.2rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.search-result:hover {
  background: var(--paper);
}

.search-result strong,
.search-result span,
.search-result small {
  display: block;
}

.search-result small {
  margin-bottom: 0.25rem;
  color: var(--oxblood);
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.search-result strong {
  font-family: var(--serif);
  font-size: 0.94rem;
}

.search-result span {
  margin-top: 0.35rem;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 0.8rem;
  line-height: 1.45;
}

.settings-group {
  margin: 1.7rem 0 0;
  padding: 0;
  border: 0;
}

.settings-group legend {
  margin-bottom: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  background: var(--line);
}

.settings-group:nth-of-type(2) .segmented {
  grid-template-columns: repeat(2, 1fr);
}

.segmented button {
  min-height: 2.6rem;
  padding: 0.5rem;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 800;
}

.segmented button:hover,
.segmented button.is-active {
  background: var(--navy-800);
  color: #fff;
}

.settings-note {
  margin: 1.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.notes-modal label {
  display: block;
  margin-top: 1.5rem;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.notes-modal textarea {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.9rem;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 0.2rem;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.55;
}

.notes-actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.8rem;
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.toast {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 140;
  max-width: 20rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--gold-bright);
  background: var(--navy-900);
  color: #fff;
  font-size: 0.75rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.8rem);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.noscript {
  position: fixed;
  inset: var(--topbar-h) 0 auto;
  z-index: 200;
  padding: 1rem;
  background: #fff1c7;
  color: #2c2112;
  text-align: center;
}

html[data-font="small"] {
  --reader-size: 1rem;
}

html[data-font="large"] {
  --reader-size: 1.28rem;
}

html[data-width="wide"] {
  --reader-width: 54rem;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #eef1f4;
  --ink-soft: #aeb8c5;
  --paper: #101924;
  --paper-deep: #182435;
  --surface: #142130;
  --surface-raised: #1a293a;
  --line: #314055;
  --line-strong: #526279;
  --gold: #c6a56a;
  --gold-bright: #d1b57d;
  --oxblood: #e6a0aa;
  --mark: #775b23;
  --shadow: 0 18px 50px rgb(0 0 0 / 0.3);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    color-scheme: dark;
    --ink: #eef1f4;
    --ink-soft: #aeb8c5;
    --paper: #101924;
    --paper-deep: #182435;
    --surface: #142130;
    --surface-raised: #1a293a;
    --line: #314055;
    --line-strong: #526279;
    --gold: #c6a56a;
    --gold-bright: #d1b57d;
    --oxblood: #e6a0aa;
    --mark: #775b23;
    --shadow: 0 18px 50px rgb(0 0 0 / 0.3);
  }
}

@media (max-width: 74rem) {
  .reader-shell {
    grid-template-columns: minmax(0, 1fr);
    max-width: calc(var(--reader-width) + 8rem);
  }

  .chapter-rail {
    display: none;
  }
}

@media (max-width: 58rem) {
  .nav-toggle {
    display: inline-grid;
    place-items: center;
  }

  .wordmark-copy small,
  .utility-button kbd {
    display: none;
  }

  .book-nav {
    transform: translateX(-102%);
    box-shadow: var(--shadow);
    transition: transform 180ms ease;
  }

  body.nav-open .book-nav {
    transform: translateX(0);
  }

  .nav-scrim {
    position: fixed;
    inset: var(--topbar-h) 0 0;
    z-index: 50;
    border: 0;
    background: rgb(4 12 22 / 0.55);
  }

  body.nav-open .nav-scrim {
    display: block;
  }

  #main-content {
    margin-left: 0;
  }

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

  .cover-copy {
    padding-bottom: 3rem;
  }

  .cover-art {
    min-height: 17rem;
  }

  .court-lines {
    inset: -25% 8% 4% 28%;
  }

  .home-intro {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 42rem) {
  :root {
    --topbar-h: 3.9rem;
  }

  .topbar {
    padding: 0 0.75rem;
  }

  .wordmark-mark {
    width: 2rem;
    height: 2rem;
  }

  .wordmark-copy strong {
    font-size: 0.87rem;
  }

  .utility-button {
    min-width: 2.55rem;
    padding: 0;
    justify-content: center;
  }

  .utility-button span:nth-child(2) {
    display: none;
  }

  .cover-copy {
    padding: 4.5rem 1.35rem 2rem;
  }

  .cover h1 {
    font-size: clamp(3rem, 16vw, 4.5rem);
  }

  .cover-meta {
    right: 1.35rem;
    bottom: 1.35rem;
  }

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

  .contents-link {
    grid-template-columns: 2.25rem minmax(0, 1fr);
    gap: 0.8rem;
  }

  .contents-meta {
    grid-column: 2;
  }

  .reader-shell {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
  }

  .chapter-masthead {
    margin-bottom: 3rem;
  }

  .chapter-body {
    line-height: 1.72;
  }

  .chapter-body h2 {
    margin-top: 3.8rem;
  }

  .chapter-end {
    grid-template-columns: 1fr;
  }

  .chapter-end-link:last-child {
    text-align: left;
  }

  .home-footer {
    display: block;
  }

  .home-footer nav {
    margin-top: 0.8rem;
  }

  .modal-frame {
    padding: 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  :root {
    --ink: #000;
    --paper: #fff;
    --reader-size: 11pt;
    --reader-width: none;
  }

  @page {
    size: letter;
    margin: 0.75in;
  }

  .topbar,
  .book-nav,
  .chapter-rail,
  .chapter-tools,
  .search-context,
  .chapter-end,
  .nav-scrim,
  .toast {
    display: none !important;
  }

  .shell {
    padding: 0;
  }

  #main-content {
    margin: 0;
  }

  .reader-shell {
    display: block;
    max-width: none;
    padding: 0;
  }

  .chapter-article {
    max-width: none;
  }

  .chapter-masthead {
    break-after: avoid;
  }

  .chapter-body h2,
  .chapter-body h3 {
    break-after: avoid;
  }

  .chapter-body p {
    orphans: 3;
    widows: 3;
  }
}
