:root {
  --ink: #24211c;
  --muted: #736b5f;
  --paper: #f7f2e7;
  --paper-deep: #eee5d4;
  --line: #cfc1a8;
  --seal: #9f2d22;
  --link: #7d261e;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(109, 91, 62, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(109, 91, 62, .035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  font-size: 17px;
  line-height: 1.85;
}

a { color: var(--link); text-underline-offset: .2em; }
a:hover { color: #b04134; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 99; padding: .5rem 1rem; background: #fff; }
.skip-link:focus { top: 1rem; }

.masthead {
  border-bottom: 1px solid var(--line);
  background: rgba(238, 229, 212, .72);
}
.masthead__inner {
  width: min(var(--max), calc(100% - 3rem));
  min-height: 330px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: clamp(2rem, 7vw, 6rem);
}
.seal {
  width: 138px;
  height: 138px;
  flex: 0 0 138px;
  border: 6px double var(--seal);
  color: var(--seal);
  display: grid;
  place-content: center;
  transform: rotate(-2deg);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 31px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: .18em;
  text-align: center;
}
.seal span { display: block; }
.eyebrow, .section-kicker, .toc__title {
  margin: 0 0 .5rem;
  color: var(--seal);
  font-family: system-ui, sans-serif;
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .16em;
  text-transform: uppercase;
}
h1 { margin: 0; font-size: clamp(3rem, 7vw, 5.7rem); font-weight: 700; line-height: .98; letter-spacing: -.05em; }
.dates { margin: 1.5rem 0 0; color: var(--muted); font-size: .9rem; }

.layout {
  width: min(var(--max), calc(100% - 3rem));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5.5rem);
  align-items: start;
}
.toc { position: sticky; top: 2rem; padding: 4rem 0; }
.toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; }
.toc li { counter-increment: toc; border-top: 1px solid var(--line); }
.toc li:last-child { border-bottom: 1px solid var(--line); }
.toc a { display: grid; grid-template-columns: 2rem 1fr; gap: .35rem; padding: .55rem 0; color: var(--ink); text-decoration: none; font-size: .87rem; }
.toc a::before { content: counter(toc, decimal-leading-zero); color: var(--muted); font-family: ui-monospace, monospace; font-size: .75rem; }

.document { min-width: 0; padding: 4rem 0 6rem; }
.document section { scroll-margin-top: 2rem; padding: 3.5rem 0; border-bottom: 1px solid var(--line); }
.document .preamble { padding-top: 2rem; }
.document h2 { margin: 0 0 1.5rem; font-size: clamp(1.65rem, 3vw, 2.55rem); line-height: 1.28; letter-spacing: -.035em; }
.document h3 { margin: 2.2rem 0 .6rem; font-size: 1.08rem; font-family: system-ui, sans-serif; }
.document p { margin: 0 0 1rem; }
.document li + li { margin-top: .55rem; }
.document strong { font-weight: 700; }
.release-note {
  padding: 1.1rem 1.35rem;
  border: 1px solid #c89d63;
  border-left: 5px solid var(--seal);
  background: #fff9e9;
  font-family: system-ui, sans-serif;
  font-size: .9rem;
}
.release-note strong { color: var(--seal); }
.release-note p { display: inline; margin-left: .6rem; }
mark { padding: .08em .22em; color: #6f281f; background: #ffe59c; }
.scope { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.4rem 0; }
.scope span { padding: .28rem .72rem; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.38); font-family: system-ui, sans-serif; font-size: .78rem; }

.table-wrap { max-width: 100%; margin: 1.5rem 0; overflow-x: auto; border: 1px solid var(--line); background: rgba(255,255,255,.25); }
table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: .88rem; line-height: 1.55; }
th, td { padding: .85rem .9rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th:last-child, td:last-child { border-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
th { background: #332e27; color: #fff; font-family: system-ui, sans-serif; font-size: .78rem; letter-spacing: .03em; }
.services th:nth-child(1) { width: 25%; }
.services th:nth-child(2) { width: 20%; }
.services th:nth-child(3) { width: 35%; }

.contact { border-bottom: 0 !important; }
.contact dl { margin: 1.5rem 0; border-top: 1px solid var(--line); }
.contact dl div { display: grid; grid-template-columns: 12rem 1fr; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.contact dt { color: var(--muted); font-family: system-ui, sans-serif; font-size: .83rem; }
.contact dd { margin: 0; }
.document__footer { display: flex; justify-content: space-between; gap: 2rem; padding-top: 2rem; color: var(--muted); font-size: .78rem; font-family: system-ui, sans-serif; }

@media (max-width: 780px) {
  body { font-size: 16px; }
  .masthead__inner { min-height: 290px; width: min(100% - 2rem, var(--max)); gap: 1.25rem; }
  .seal { width: 84px; height: 84px; flex-basis: 84px; border-width: 4px; font-size: 18px; }
  h1 { font-size: clamp(2.55rem, 13vw, 4rem); }
  .dates { font-size: .78rem; }
  .layout { width: min(100% - 2rem, var(--max)); display: block; }
  .toc { position: static; padding: 1.5rem 0 0; }
  .toc ol { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
  .document { padding-top: 1.5rem; }
  .document section { padding: 2.7rem 0; }
  .contact dl div { grid-template-columns: 1fr; gap: .15rem; }
  .document__footer { display: block; }
}

@media print {
  body { background: #fff; font-size: 11pt; }
  .masthead__inner, .layout { width: 100%; }
  .masthead__inner { min-height: 0; padding: 2cm 0 1cm; }
  .toc, .release-note, .document__footer a { display: none; }
  .layout { display: block; }
  .document { padding: 0; }
  .document section { break-inside: avoid-page; }
  a { color: inherit; text-decoration: none; }
}

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