:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-alt: #eef3f2;
  --ink: #171a21;
  --muted: #5b6270;
  --line: #d7dde5;
  --teal: #08746f;
  --teal-dark: #075f5b;
  --red: #b42318;
  --gold: #a06500;
  --green: #287a42;
  --code: #eff2f5;
  --shadow: 0 12px 32px rgba(25, 31, 45, 0.08);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
}

a {
  color: var(--teal-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--red);
}

img,
svg {
  max-width: 100%;
}

code {
  background: var(--code);
  border-radius: 4px;
  padding: 0.12rem 0.32rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  background: var(--ink);
  color: #fff;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  text-decoration: none;
}

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

.page-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 1rem;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.brand strong {
  font-size: 1rem;
  line-height: 1.2;
}

.brand span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.45rem 0.7rem;
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: 7px;
  font: inherit;
  cursor: pointer;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(248px, 300px) minmax(0, 1fr) minmax(210px, 260px);
  gap: 1.5rem;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 1.5rem;
}

.sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sidebar-inner {
  padding: 1rem;
}

.search-box {
  position: relative;
  margin-bottom: 1rem;
}

.search-box svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  color: var(--muted);
}

.search-box input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.55rem 0.7rem 0.55rem 2.25rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.nav-section + .nav-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.nav-heading {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-nav ul {
  display: grid;
  gap: 0.18rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: block;
  padding: 0.48rem 0.55rem;
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.94rem;
  text-decoration: none;
}

.site-nav a:hover {
  background: var(--surface-alt);
}

.site-nav a[aria-current="page"] {
  background: #dcefed;
  color: var(--teal-dark);
  font-weight: 750;
}

.content {
  min-width: 0;
}

.doc {
  display: grid;
  gap: 1.25rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(240px, 0.9fr);
  gap: 1.5rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(1.1rem, 3vw, 2rem);
  box-shadow: var(--shadow);
}

.hero.compact {
  grid-template-columns: 1fr;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 0 0 0.7rem;
  padding: 0.15rem 0.45rem;
  border-left: 4px solid var(--teal);
  background: #edf7f6;
  color: var(--teal-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  line-height: 1.16;
}

h1 {
  max-width: 900px;
  font-size: clamp(2rem, 4vw, 3.35rem);
}

h2 {
  margin-top: 0.5rem;
  font-size: clamp(1.45rem, 2.2vw, 2rem);
}

h3 {
  font-size: 1.08rem;
}

p {
  margin: 0;
}

.lead {
  max-width: 820px;
  margin-top: 1rem;
  color: #394150;
  font-size: 1.08rem;
}

.hero-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-visual img {
  width: min(100%, 460px);
  height: auto;
}

.doc-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(1rem, 2vw, 1.45rem);
}

.doc-section > * + * {
  margin-top: 0.85rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.topic-card,
.note,
.example,
.callout {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.topic-card {
  display: grid;
  gap: 0.55rem;
  padding: 1rem;
  color: var(--ink);
  text-decoration: none;
}

.topic-card:hover {
  border-color: #9bbebb;
  box-shadow: 0 8px 22px rgba(8, 116, 111, 0.12);
}

.topic-card span {
  color: var(--muted);
  font-size: 0.94rem;
}

.topic-card .tag,
.tag {
  width: fit-content;
  color: var(--teal-dark);
  background: #e1f3f1;
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  font-size: 0.76rem;
  font-weight: 750;
}

.note,
.callout {
  padding: 1rem;
}

.note {
  border-left: 4px solid var(--gold);
}

.callout {
  border-left: 4px solid var(--teal);
  background: #f4fbfa;
}

.example {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}

.example > div {
  padding: 1rem;
}

.example > div + div {
  border-left: 1px solid var(--line);
}

.example .weak {
  background: #fff7f6;
}

.example .strong {
  background: #f3fbf5;
}

.label {
  display: inline-block;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.checklist,
.plain-list,
.steps {
  margin: 0;
  padding-left: 1.2rem;
}

.checklist li,
.plain-list li,
.steps li {
  margin: 0.4rem 0;
}

.model-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.model-table th,
.model-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.model-table th {
  background: #edf3f6;
  font-size: 0.84rem;
}

.model-table tr:last-child td {
  border-bottom: 0;
}

.source-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.93rem;
}

.toc {
  position: sticky;
  top: 88px;
  align-self: start;
  color: var(--muted);
  font-size: 0.88rem;
}

.toc h2 {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.toc ul {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc a {
  display: block;
  padding: 0.28rem 0;
  color: var(--muted);
  text-decoration: none;
}

.toc a:hover {
  color: var(--teal-dark);
}

.toc .toc-h3 {
  padding-left: 0.75rem;
  border-left: 1px solid var(--line);
}

.footer {
  margin-top: 1.5rem;
  padding: 1rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.footer a {
  color: inherit;
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 820px) {
  .topbar {
    position: sticky;
  }

  .layout {
    display: block;
    padding: 1rem;
  }

  .sidebar {
    display: none;
    position: static;
    max-height: none;
    margin-bottom: 1rem;
  }

  .sidebar.is-open {
    display: block;
  }

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

  .grid.two,
  .grid.three,
  .example {
    grid-template-columns: 1fr;
  }

  .example > div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (min-width: 821px) {
  .icon-button {
    display: none;
  }
}

@media print {
  .topbar,
  .sidebar,
  .toc {
    display: none;
  }

  body {
    background: #fff;
  }

  .layout {
    display: block;
    padding: 0;
  }

  .doc-section,
  .hero {
    break-inside: avoid;
    box-shadow: none;
  }
}
