:root {
  --bg: #f4efe7;
  --bg-strong: #eee4d5;
  --paper: rgba(255, 252, 246, 0.97);
  --paper-solid: #fffaf2;
  --ink: #17130d;
  --muted: #6d665e;
  --line: rgba(77, 57, 28, 0.14);
  --line-strong: rgba(77, 57, 28, 0.24);
  --accent: #8a4e17;
  --accent-deep: #5d320f;
  --accent-soft: #f3e1cc;
  --shadow-soft: 0 20px 50px rgba(42, 29, 15, 0.08);
  --shadow-strong: 0 28px 80px rgba(42, 29, 15, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --font-body: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-ui: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 244, 228, 0.92), transparent 34%),
    radial-gradient(circle at top right, rgba(233, 214, 186, 0.48), transparent 22%),
    linear-gradient(180deg, #faf5ed 0%, var(--bg) 100%);
  font-family: var(--font-body);
  line-height: 1.75;
}

a {
  color: var(--accent-deep);
  text-underline-offset: 0.16em;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

.home-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 44px 0 80px;
}

.report-shell {
  width: min(1560px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0 80px;
}

.report-page-shell {
  display: grid;
  grid-template-columns: minmax(190px, 220px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.report-main {
  min-width: 0;
}

.site-header,
.report-header,
.docx-content,
.toc-card,
.report-card {
  border: 1px solid var(--line);
  background: var(--paper);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
}

.site-header,
.report-header {
  border-radius: var(--radius-xl);
  padding: 30px 30px 28px;
}

.eyebrow {
  margin: 0 0 12px;
  font: 700 12px/1.2 var(--font-ui);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.site-header h1,
.report-header h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.lede {
  max-width: 56rem;
  margin: 14px 0 0;
  color: var(--muted);
  font: 500 16px/1.7 var(--font-ui);
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin-top: 26px;
}

.report-card {
  border-radius: var(--radius-lg);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.report-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-strong);
}

.report-link {
  display: block;
  padding: 22px 22px 20px;
  color: inherit;
  text-decoration: none;
}

.report-date {
  color: var(--accent);
  font: 700 13px/1.2 var(--font-ui);
}

.report-link h2 {
  margin: 10px 0 12px;
  font-size: 29px;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.report-cta {
  display: inline-flex;
  align-items: center;
  margin-top: 14px;
  padding: 9px 13px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font: 700 13px/1.2 var(--font-ui);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--accent-deep);
  text-decoration: none;
  font: 700 14px/1.2 var(--font-ui);
}

.report-sidebar {
  position: sticky;
  top: 22px;
}

.toc-card {
  border-radius: var(--radius-lg);
  padding: 18px;
  max-height: calc(100vh - 44px);
  overflow: auto;
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toc-link {
  display: block;
  padding: 8px 10px;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font: 600 13px/1.4 var(--font-ui);
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.toc-link:hover,
.toc-link.is-active {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.toc-link.is-active {
  box-shadow: inset 3px 0 0 var(--accent);
  transform: translateX(2px);
}

.toc-link.level-1 {
  margin-top: 6px;
  color: var(--ink);
  font-weight: 700;
}

.toc-link.level-2,
.toc-link.level-3,
.toc-link.level-4 {
  padding-left: 18px;
}

.docx-content {
  margin-top: 22px;
  border-radius: var(--radius-xl);
  padding: 34px 34px 44px;
}

.docx-content #title-block-header,
.docx-content .title {
  display: none;
}

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

.docx-content h1,
.docx-content h2,
.docx-content h3,
.docx-content h4 {
  scroll-margin-top: 22px;
  line-height: 1.14;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.docx-content h1 {
  margin: 2.2rem 0 1rem;
  padding-top: 1.6rem;
  border-top: 1px solid rgba(77, 57, 28, 0.08);
  font-size: clamp(30px, 3vw, 40px);
}

.docx-content h1:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.docx-content h4 {
  margin: 1.6rem 0 0.7rem;
  color: var(--accent-deep);
  font-size: 22px;
}

.docx-content p,
.docx-content li {
  max-width: 76ch;
  font-size: 18px;
}

.docx-content h5 {
  max-width: 44rem;
  margin: 1.2rem 0 0.35rem;
  color: var(--accent-deep);
  font: 700 20px/1.35 var(--font-ui);
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

.docx-content h5 + p {
  margin-top: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.72;
  max-width: 78ch;
}

.docx-content ul,
.docx-content ol {
  padding-left: 1.35em;
}

.docx-content p + p {
  margin-top: 0.7em;
}

.docx-content img {
  margin: 20px auto;
  border-radius: 16px;
  overflow: hidden;
}

.docx-content .media-block {
  max-width: none;
  margin: 24px -10px;
}

.docx-content .media-block img {
  width: 100%;
}

.docx-content table {
  width: 100%;
  margin: 22px 0 26px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper-solid);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  display: block;
  overflow-x: auto;
}

.docx-content thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6ebdc;
}

.docx-content th,
.docx-content td {
  min-width: 120px;
  border-right: 1px solid rgba(77, 57, 28, 0.08);
  border-bottom: 1px solid rgba(77, 57, 28, 0.08);
  padding: 12px 14px;
  vertical-align: top;
  font-size: 15px;
}

.docx-content th:last-child,
.docx-content td:last-child {
  border-right: 0;
}

.docx-content tr:last-child td {
  border-bottom: 0;
}

.docx-content .observation-table th,
.docx-content .observation-table td {
  font-family: var(--font-ui);
  line-height: 1.55;
}

.docx-content .observation-table td:last-child,
.docx-content .observation-table th:last-child {
  min-width: 420px;
}

.docx-content .observation-table td:nth-child(4),
.docx-content .observation-table th:nth-child(4) {
  min-width: 220px;
}

.analysis-disclosure {
  border: 1px solid rgba(77, 57, 28, 0.1);
  border-radius: 14px;
  background: rgba(243, 225, 204, 0.22);
  padding: 10px 12px;
}

.analysis-trigger {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.analysis-preview {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.analysis-meta {
  display: inline-flex;
  margin-top: 8px;
  color: var(--accent-deep);
  font: 700 12px/1.2 var(--font-ui);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.analysis-full {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(77, 57, 28, 0.1);
  color: var(--muted);
}

.analysis-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.analysis-drawer.is-open {
  pointer-events: auto;
}

.analysis-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 16, 10, 0.36);
  opacity: 0;
  transition: opacity 180ms ease;
}

.analysis-drawer.is-open .analysis-drawer-backdrop {
  opacity: 1;
}

.analysis-drawer-panel {
  position: relative;
  width: min(560px, 92vw);
  height: 100%;
  padding: 26px 24px 32px;
  background: rgba(255, 252, 246, 0.98);
  border-left: 1px solid var(--line);
  box-shadow: -14px 0 40px rgba(30, 20, 10, 0.12);
  transform: translateX(100%);
  transition: transform 220ms ease;
  overflow: auto;
}

.analysis-drawer.is-open .analysis-drawer-panel {
  transform: translateX(0);
}

.analysis-drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: auto;
  border: 1px solid rgba(77, 57, 28, 0.12);
  border-radius: 999px;
  background: var(--paper-solid);
  color: var(--accent-deep);
  cursor: pointer;
  font: 700 18px/1 var(--font-ui);
}

.analysis-drawer-title {
  margin: 12px 0 8px;
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.analysis-drawer-meta {
  color: var(--muted);
  font: 600 13px/1.5 var(--font-ui);
}

.analysis-drawer-body {
  margin-top: 18px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.78;
}

.list-disclosure {
  border: 1px solid rgba(77, 57, 28, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
  padding: 8px 10px;
}

.list-disclosure summary {
  display: block;
  cursor: pointer;
  list-style: none;
}

.list-disclosure summary::-webkit-details-marker {
  display: none;
}

.list-preview {
  color: var(--ink);
  font: 600 13px/1.5 var(--font-ui);
}

.list-full {
  margin-top: 8px;
  color: var(--muted);
  font: 500 13px/1.6 var(--font-ui);
}

.empty-state {
  color: var(--muted);
  font: 600 15px/1.6 var(--font-ui);
}

@media (max-width: 1100px) {
  .report-page-shell {
    grid-template-columns: 1fr;
  }

  .report-sidebar {
    position: static;
    order: -1;
  }

  .toc-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 6px;
  }

  .toc-card {
    max-height: none;
    overflow: visible;
  }

  .docx-content .media-block {
    margin-left: 0;
    margin-right: 0;
  }
}

@media (max-width: 720px) {
  .home-shell,
  .report-shell {
    width: min(100%, calc(100% - 20px));
    padding-top: 18px;
    padding-bottom: 40px;
  }

  .site-header,
  .report-header,
  .docx-content,
  .toc-card {
    padding: 18px 16px;
    border-radius: 20px;
  }

  .report-link h2 {
    font-size: 24px;
  }

  .docx-content p,
  .docx-content li {
    font-size: 16px;
  }

  .docx-content th,
  .docx-content td {
    font-size: 14px;
    min-width: 100px;
    padding: 10px 11px;
  }

  .docx-content .observation-table td:last-child,
  .docx-content .observation-table th:last-child {
    min-width: 280px;
  }
}

/* Scroll containment and drawer polish */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

html.drawer-open,
body.drawer-open {
  overflow: hidden;
}

.report-shell,
.report-page-shell,
.report-main,
.docx-content,
.docx-content > * {
  min-width: 0;
  max-width: 100%;
}

.docx-content {
  overflow-x: clip;
}

.docx-content img,
.docx-content svg,
.docx-content video,
.media-block img {
  max-width: 100% !important;
  height: auto !important;
}

.docx-content table {
  max-width: 100%;
  width: 100%;
  display: block;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.docx-content table tbody,
.docx-content table thead,
.docx-content table tr {
  max-width: 100%;
}

.docx-content .observation-table th,
.docx-content .observation-table td {
  min-width: 92px;
}

.docx-content .observation-table th:nth-child(1),
.docx-content .observation-table td:nth-child(1) {
  min-width: 72px;
}

.docx-content .observation-table th:nth-child(2),
.docx-content .observation-table td:nth-child(2) {
  min-width: 110px;
}

.docx-content .observation-table th:nth-child(3),
.docx-content .observation-table td:nth-child(3) {
  min-width: 150px;
}

.docx-content .observation-table th:nth-child(4),
.docx-content .observation-table td:nth-child(4) {
  min-width: 140px;
  max-width: 190px;
}

.docx-content .observation-table th:last-child,
.docx-content .observation-table td:last-child {
  min-width: 240px;
  max-width: 320px;
}

.analysis-card {
  max-width: 100%;
}

.analysis-preview {
  -webkit-line-clamp: 2;
}

.analysis-drawer {
  width: 100vw;
  max-width: 100vw;
  overflow: hidden;
}

.analysis-drawer-panel {
  width: min(520px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.toc-card {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

@media (max-width: 980px) {
  .report-shell {
    width: min(100%, calc(100% - 24px));
  }

  .report-page-shell {
    display: block;
  }

  .toc-card {
    max-height: 42vh;
    margin-bottom: 16px;
  }
}
/* End scroll containment and drawer polish */

/* Report reading layout refinement */
.report-shell.report-page-shell {
  width: min(1720px, calc(100% - 48px));
  display: block;
  position: relative;
  padding-left: 304px;
}

.report-sidebar {
  position: fixed;
  top: 24px;
  left: max(24px, calc((100vw - 1720px) / 2 + 24px));
  width: 260px;
  height: calc(100dvh - 48px);
  z-index: 20;
  align-self: start;
}

.report-sidebar .toc-card {
  position: static;
  height: 100%;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
}

.report-main {
  width: 100%;
  min-width: 0;
}

.report-header,
.docx-content {
  width: 100%;
}

.docx-content {
  padding: clamp(28px, 3vw, 48px);
}

.docx-content p,
.docx-content li,
.docx-content h5,
.docx-content h5 + p,
.lede {
  max-width: none;
}

.docx-content p,
.docx-content li {
  text-wrap: pretty;
}

.docx-content h1,
.docx-content h2,
.docx-content h3,
.docx-content h4,
.docx-content h5 {
  max-width: 1120px;
}

.docx-content .media-block,
.docx-content table {
  width: 100%;
}

@media (max-width: 900px) {
  .report-shell.report-page-shell {
    width: min(100%, calc(100% - 24px));
    display: block;
    padding-left: 0;
  }

  .report-sidebar {
    position: sticky;
    top: 0;
    left: auto;
    width: auto;
    z-index: 12;
    height: auto;
    margin-bottom: 16px;
  }

  .report-sidebar .toc-card {
    position: static;
    height: auto;
    max-height: 36vh;
    overflow-x: hidden;
    overflow-y: auto;
  }
}
/* End report reading layout refinement */
