/* ============================================================
   CONSTITUTION — Document layout
   ============================================================ */

.doc-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: var(--sp-8);
  align-items: start;
}

.doc-toc {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
}
.doc-toc h5 {
  font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: var(--sp-4);
}
.doc-toc ol { display: flex; flex-direction: column; gap: .1rem; }
.doc-toc a {
  display: block; padding: .55rem .8rem; border-radius: var(--r-sm);
  font-size: .87rem; color: var(--muted); text-decoration: none;
  border-left: 2px solid transparent;
  transition: all .18s;
}
.doc-toc a:hover { background: var(--paper); color: var(--chai-brown); }
.doc-toc a.is-active {
  background: rgba(166,83,53,.07); color: var(--terracotta);
  border-left-color: var(--terracotta); font-weight: 600;
}

/* Mobile collapsible TOC */
.doc-toc__toggle {
  display: none;
  width: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  font-weight: 700;
  color: var(--chai-brown);
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
  font-size: .95rem;
}
.doc-toc__toggle i { transition: transform .25s; }
.doc-toc__toggle[aria-expanded="true"] i { transform: rotate(180deg); }

@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; gap: var(--sp-5); }
  .doc-toc__toggle { display: flex; }
  .doc-toc {
    position: static;
    max-height: none;
    margin-bottom: var(--sp-5);
    display: none;
  }
  .doc-toc.is-open { display: block; }
}

/* Document body */
.doc {
  max-width: 72ch;
  font-family: var(--font-display);
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--text);
}
.doc__section {
  margin-bottom: var(--sp-8);
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.doc__section:last-child { margin-bottom: 0; }
.doc__section h2 {
  font-size: 1.55rem;
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 2px solid var(--paper-dk);
  font-family: var(--font-display);
}
.doc__section h3 {
  font-size: 1.1rem;
  margin: var(--sp-5) 0 var(--sp-3);
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--chai-brown);
}
.doc__section p { margin-bottom: var(--sp-4); }
.doc__section p:last-child { margin-bottom: 0; }
.doc__section ul,
.doc__section ol {
  margin: 0 0 var(--sp-4) var(--sp-5);
}
.doc__section li { margin-bottom: var(--sp-3); }
.doc__section ul li { list-style: disc; }
.doc__section ol li { list-style: decimal; }
.doc__section li::marker { color: var(--biscuit); }

.clause {
  background: var(--paper);
  border-left: 3px solid var(--biscuit);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  font-size: .97rem;
  font-family: var(--font-body);
  color: var(--chai-brown);
}
.clause strong {
  color: var(--chai-dark);
  font-family: var(--font-body);
  font-weight: 700;
}

/* Amendment chip */
.amend {
  display: inline-block;
  background: rgba(214,161,93,.2);
  color: var(--biscuit-dk);
  font-size: .7rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  padding: .2rem .6rem; border-radius: var(--r-full);
  margin-left: .4rem;
  vertical-align: middle;
  font-family: var(--font-body);
}

/* Document header block */
.doc-header {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  margin-bottom: var(--sp-7);
  text-align: center;
}
.doc-header__seal {
  width: 68px; height: 68px; margin: 0 auto var(--sp-4);
  border-radius: 50%; background: var(--terracotta);
  display: grid; place-items: center;
  color: var(--cream); font-size: 1.6rem;
  border: 2px dashed rgba(255,248,234,.5);
  padding: 6px;
  background-clip: padding-box;
}
.doc-header h1 { margin-bottom: var(--sp-2); font-size: clamp(1.8rem, 4vw, 2.5rem); }
.doc-header p { color: var(--muted); font-size: .95rem; margin: 0; }

/* Print */
@media print {
  .doc-toc, .doc-toc__toggle, .breadcrumbs { display: none !important; }
  .doc-layout { grid-template-columns: 1fr; }
  .doc { font-size: 11pt; line-height: 1.5; max-width: 100%; }
  .doc__section { page-break-inside: avoid; }
  .doc__section h2 { page-break-after: avoid; }
  .clause { background: #f5f5f5; border-left-color: #999; }
  .doc-header { background: #fff; border-color: #ccc; }
}