:root {
  --bg: #f5efe5;
  --bg-strong: #ebe1d2;
  --paper: rgba(255, 252, 247, 0.94);
  --paper-strong: #fffaf2;
  --ink: #1f2724;
  --muted: #59635f;
  --line: #d6cab7;
  --accent: #1b5967;
  --accent-strong: #0f4450;
  --accent-soft: #e4f0f2;
  --badge: #6f4c27;
  --shadow: 0 18px 40px rgba(41, 44, 38, 0.09);
  --ui-font: "Avenir Next", "Segoe UI", "Helvetica Neue", Helvetica, sans-serif;
  --body-font: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Baskerville, "Times New Roman", serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--body-font);
  line-height: 1.7;
  background:
    radial-gradient(circle at top left, rgba(27, 89, 103, 0.12), transparent 30%),
    linear-gradient(180deg, var(--bg) 0%, #f2ebdf 42%, #f8f3ea 100%);
  min-height: 100vh;
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover,
a:focus-visible {
  color: var(--accent);
}

button,
input {
  font: inherit;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--accent-strong);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  z-index: 100;
}

.skip-link:focus {
  top: 1rem;
}

.site-shell {
  width: min(1180px, calc(100vw - 2rem));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 1rem 0;
  backdrop-filter: blur(14px);
  background: rgba(245, 239, 229, 0.82);
  border-bottom: 1px solid rgba(214, 202, 183, 0.8);
}

.site-header .site-shell {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.site-mark,
.site-nav {
  font-family: var(--ui-font);
}

.site-mark {
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.1rem;
  justify-content: flex-end;
}

.site-nav a {
  text-decoration: none;
  font-size: 0.95rem;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin: 1.5rem 0 0;
  font-family: var(--ui-font);
  color: var(--muted);
  font-size: 0.95rem;
}

.crumb-sep {
  color: #8d8a80;
}

.hero,
.page-main,
.page-sidebar,
.toc-panel,
.reader-note,
.article-card {
  background: var(--paper);
  border: 1px solid rgba(214, 202, 183, 0.8);
  box-shadow: var(--shadow);
}

.hero,
.reader-note,
.toc-panel,
.page-sidebar,
.page-main,
.article-card {
  border-radius: 1.35rem;
}

.hero {
  padding: clamp(1.5rem, 3vw, 2.75rem);
  margin: 1.25rem 0 1.5rem;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -6rem -6rem auto;
  width: 14rem;
  height: 14rem;
  background: radial-gradient(circle, rgba(27, 89, 103, 0.16), transparent 70%);
  pointer-events: none;
}

.eyebrow,
.badge,
.filter-label,
.sidebar-note,
.hero-actions,
.meta-grid,
.quick-links,
.site-footer,
.article-pager {
  font-family: var(--ui-font);
}

.eyebrow {
  margin: 0 0 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
  font-weight: 700;
  max-width: 18ch;
}

.hero-home h1 {
  font-size: clamp(2.2rem, 3.6vw, 3.25rem);
  max-width: 16ch;
}

.hero-summary {
  max-width: 62ch;
  font-size: 1.08rem;
  color: var(--muted);
  margin: 1rem 0 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin: 1.5rem 0;
}

.button-primary,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.78rem 1.15rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
}

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.button-secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(214, 202, 183, 0.95);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 0;
}

.meta-grid div {
  padding: 0.95rem 1rem;
  background: rgba(255, 255, 255, 0.68);
  border-radius: 1rem;
}

.meta-grid dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.meta-grid dd {
  margin: 0;
  font-size: 0.98rem;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 270px) minmax(0, 1fr);
  gap: 1.4rem;
  align-items: start;
  margin-bottom: 3rem;
}

.page-sidebar,
.page-main,
.toc-panel,
.reader-note {
  padding: 1.3rem;
}

.page-sidebar {
  position: sticky;
  top: 6rem;
}

.page-sidebar h2,
.toc-panel h2,
.quick-links h2,
.page-main h2,
.page-main h3,
.page-main h4 {
  margin-top: 0;
}

.sidebar-note {
  color: var(--muted);
  font-size: 0.96rem;
  margin: 0;
}

.filter-label {
  display: block;
  margin: 0.85rem 0 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.filter-input {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(27, 89, 103, 0.22);
  background: rgba(255, 255, 255, 0.92);
}

.toc-group + .toc-group {
  margin-top: 1.2rem;
}

.toc-list,
.toc-sublist,
.quick-links ul {
  margin: 0;
  padding-left: 1.25rem;
}

.toc-entry,
.toc-list li,
.quick-links li {
  margin: 0.45rem 0;
}

.toc-sublist {
  margin-top: 0.45rem;
}

.section-intro {
  margin-bottom: 0.8rem;
}

.reader-note,
.quick-links,
.toc-panel {
  margin-bottom: 1.35rem;
}

.badge {
  display: inline-flex;
  margin: 0 0 0.8rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(111, 76, 39, 0.12);
  color: var(--badge);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.quick-links ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.quick-link {
  display: inline-flex;
  padding: 0.8rem 1rem;
  border-radius: 1rem;
  text-decoration: none;
  background: linear-gradient(180deg, rgba(27, 89, 103, 0.08), rgba(255, 255, 255, 0.88));
  border: 1px solid rgba(27, 89, 103, 0.12);
  color: var(--ink);
  font-family: var(--ui-font);
  font-weight: 700;
}

.page-main {
  padding: clamp(1.25rem, 2vw, 2rem);
}

.page-main > * + * {
  margin-top: 1.35rem;
}

.heading-row {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
  margin-top: 1.2rem;
}

.heading-row:first-child {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.heading-row h2,
.heading-row h3,
.heading-row h4 {
  margin-bottom: 0;
}

.heading-tools {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  font-family: var(--ui-font);
}

.jump-link,
.copy-link {
  border: 1px solid rgba(27, 89, 103, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-strong);
  padding: 0.35rem 0.65rem;
  text-decoration: none;
  font-size: 0.82rem;
}

.copy-link {
  cursor: pointer;
}

.copy-link.is-copied {
  background: var(--accent-soft);
}

.contract-article,
.contract-part,
.contract-section {
  animation: rise-in 0.45s ease both;
}

.contract-article + .contract-article,
.contract-part + .contract-part,
.contract-section + .contract-section {
  margin-top: 1.3rem;
}

.page-main h2,
.page-main h3,
.page-main h4 {
  font-weight: 700;
  line-height: 1.2;
}

.page-main h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.page-main h3 {
  font-size: clamp(1.28rem, 2.1vw, 1.6rem);
}

.page-main h4 {
  font-size: 1.12rem;
}

.contract-paragraph {
  margin: 0.78rem 0 0;
  max-width: 76ch;
  margin-inline-start: var(--left-indent, 0);
  text-indent: var(--first-line-indent, 0);
}

.contract-paragraph.align-center {
  margin-inline: auto;
  text-align: center;
}

.contract-paragraph.align-right {
  text-align: right;
}

.contract-paragraph.styled-heading {
  font-family: var(--ui-font);
  font-weight: 700;
  text-indent: 0;
}

.contract-paragraph.subdivision {
  color: var(--ink);
}

.standalone-link a {
  word-break: break-all;
}

.tab-gap {
  display: inline-block;
  width: 3ch;
}

.is-underlined {
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.12em;
}

.is-struck {
  text-decoration: line-through;
  text-decoration-thickness: 0.08em;
  color: #7a4d44;
}

.is-smallcaps {
  font-variant: small-caps;
}

.is-superscript {
  vertical-align: super;
  font-size: 0.8em;
}

.is-subscript {
  vertical-align: sub;
  font-size: 0.8em;
}

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0 0;
  padding-bottom: 0.35rem;
}

.contract-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  background: var(--paper-strong);
}

.contract-table th,
.contract-table td {
  border: 1px solid rgba(214, 202, 183, 0.95);
  padding: 0.72rem 0.8rem;
  text-align: left;
  vertical-align: top;
}

.contract-table thead th {
  background: rgba(27, 89, 103, 0.08);
  font-family: var(--ui-font);
  font-size: 0.92rem;
}

.contract-table tbody th {
  background: rgba(255, 255, 255, 0.7);
  font-family: var(--ui-font);
  font-weight: 600;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.article-card {
  padding: 1.25rem;
}

.article-card h3 {
  margin: 0.3rem 0 0.7rem;
  font-size: 1.25rem;
}

.article-card p:last-child {
  color: var(--muted);
  margin-bottom: 0;
}

.article-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.pager-link {
  display: inline-flex;
  padding: 0.7rem 0.95rem;
  border-radius: 999px;
  background: rgba(27, 89, 103, 0.07);
  text-decoration: none;
  font-weight: 700;
}

.site-footer {
  padding: 1rem 0 2.75rem;
  color: var(--muted);
  font-size: 0.93rem;
}

.site-footer p {
  margin: 0;
}

.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;
}

[hidden] {
  display: none !important;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 920px) {
  .site-header .site-shell,
  .page-grid {
    grid-template-columns: 1fr;
  }

  .page-sidebar {
    position: static;
    order: 2;
  }

  .site-nav {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .site-shell {
    width: min(100vw - 1rem, 1180px);
  }

  .hero,
  .page-main,
  .page-sidebar,
  .toc-panel,
  .reader-note {
    padding: 1rem;
    border-radius: 1rem;
  }

  .heading-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .heading-tools {
    flex-wrap: wrap;
  }
}

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

  .contract-article,
  .contract-part,
  .contract-section {
    animation: none;
  }
}
