@font-face {
  font-family: Montserrat;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/montserrat-400.woff2") format("woff2");
}
@font-face {
  font-family: Montserrat;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/montserrat-500.woff2") format("woff2");
}
@font-face {
  font-family: Montserrat;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/montserrat-600.woff2") format("woff2");
}
@font-face {
  font-family: Montserrat;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/montserrat-700.woff2") format("woff2");
}

:root {
  --primary: #204e60;
  --primary-dark: #132f39;
  --background: #f4f5f5;
  --surface: #ffffff;
  --foreground: #001824;
  --muted: #808689;
  --border: #dddedf;
  --font: Montserrat, system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  padding: 8px 12px;
  z-index: 10;
}
.skip:focus { left: 8px; top: 8px; }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.logo-mark { display: block; flex: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.site-nav a {
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--muted);
  text-decoration: none;
  transition: background-color .15s, color .15s;
}
.site-nav a:hover { background: var(--background); color: var(--foreground); }
.site-nav a[aria-current="page"] { background: var(--primary); color: #fff; }
.site-nav a[aria-current="page"]:hover { background: var(--primary-dark); color: #fff; }

.page {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.home { max-width: 48rem; margin: 0 auto; text-align: center; padding-top: 1.5rem; }
.home-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}
.home h1 { margin: 0 0 1rem; font-size: 1.875rem; line-height: 1.2; font-weight: 700; }
.home .intro { margin: 0 auto 0.75rem; max-width: 40rem; color: var(--muted); font-size: 1rem; line-height: 1.7; }
.home a:not(.card) { color: var(--primary); text-underline-offset: 2px; }
.home a:not(.card):hover { text-decoration: underline; }
.cards {
  display: grid;
  gap: 1rem;
  margin-top: 2.5rem;
  text-align: left;
}
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--foreground);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover {
  border-color: color-mix(in srgb, var(--primary) 30%, transparent);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -2px rgba(0, 0, 0, .1);
  transform: translateY(-2px);
  color: var(--foreground);
}
.card-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.card h2 { margin: 0 0 0.35rem; font-size: 1.125rem; font-weight: 600; line-height: 1.4; }
.card p { margin: 0 0 1rem; color: var(--muted); font-size: 0.875rem; line-height: 1.6; }
.card .more { color: var(--primary); font-size: 0.875rem; font-weight: 500; }

.doc-layout { display: block; }
.doc-main { min-width: 0; max-width: 860px; }
.doc-head { margin-bottom: 2rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
.eyebrow {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  color: var(--primary);
}
.doc-head h1 {
  margin: 0.5rem 0 0;
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 700;
}
.meta {
  margin: 1.5rem 0 0;
  display: grid;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}
.meta div { margin: 0; }
.meta dt { font-weight: 500; color: var(--foreground); }
.meta dd { margin: 0; }

.toc-mobile {
  margin: 0 0 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
}
.toc-mobile summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
}
.toc-mobile nav { margin-top: 0.75rem; }
.toc-desktop { display: none; }
.toc-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
}
.toc-title { margin: 0 0 0.75rem; font-size: 0.875rem; font-weight: 600; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0.35rem 0; }
.toc a {
  color: var(--foreground);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  line-height: 1.45;
}
.toc a:hover { color: var(--primary); }

.chapter { scroll-margin-top: 1.5rem; margin-bottom: 3.5rem; }
.chapter:last-child { margin-bottom: 0; }
.chapter h2 {
  margin: 0 0 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid color-mix(in srgb, var(--primary) 20%, transparent);
  font-size: 1.25rem;
  line-height: 1.35;
  font-weight: 700;
}
.chapter-body > * + * { margin-top: 1rem; }
.chapter-body p { margin: 0; font-size: 0.98rem; line-height: 2rem; }
.chapter-body ul { margin: 0; padding-left: 1.5rem; }
.chapter-body li { margin: 0.35rem 0; font-size: 0.98rem; line-height: 1.75; }
.chapter-body a { color: var(--primary); text-underline-offset: 2px; }
.chapter-body a:hover { text-decoration: underline; }
.also {
  margin: 2.5rem 0 0;
  font-size: 0.98rem;
  line-height: 2rem;
}
.also a { color: var(--primary); text-underline-offset: 2px; }
.also a:hover { text-decoration: underline; }

.table-wrap {
  overflow-x: auto;
  margin: 0.25rem 0;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
}
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; line-height: 1.55; }
th, td { text-align: left; vertical-align: top; padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--border); }
thead th { background: color-mix(in srgb, var(--primary) 8%, white); color: var(--primary); font-weight: 600; }
tbody th { font-weight: 600; }
tr:last-child th, tr:last-child td { border-bottom: 0; }

.site-footer {
  margin-top: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.footer-inner {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.875rem;
}
.footer-inner p { margin: 0; }
.footer-inner .who { font-weight: 600; color: var(--foreground); }
.footer-inner a { color: var(--primary); text-underline-offset: 2px; text-decoration: none; }
.footer-inner a:hover { text-decoration: underline; }
.footer-inner .copy { padding-top: 0.5rem; font-size: 0.75rem; }

@media (max-width: 700px) {
  .table-wrap { border: 0; background: transparent; }
  thead { display: none; }
  table, tbody, tr, th, td { display: block; width: 100%; }
  tr {
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    background: var(--surface);
    padding: 0.35rem 0;
  }
  th, td { border: 0; padding: 0.4rem 0.9rem; }
  td::before, tbody th::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
  }
}

@media (min-width: 640px) {
  .header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  .page { padding: 2.5rem 1.5rem 4rem; }
  .footer-inner { padding-left: 1.5rem; padding-right: 1.5rem; }
  .doc-head h1 { font-size: 1.875rem; }
  .meta { grid-template-columns: 1fr 1fr; }
  .chapter h2 { font-size: 1.5rem; }
  .cards { grid-template-columns: 1fr 1fr; }
  .home h1 { font-size: 2.25rem; }
}

@media (min-width: 1024px) {
  .doc-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 2.5rem;
    align-items: start;
  }
  .toc-mobile { display: none; }
  .toc-desktop { display: block; }
  .toc-desktop .toc-panel {
    position: sticky;
    top: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
  }
}

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

@media print {
  .site-header, .skip, .toc-mobile, .toc-desktop, .site-footer { display: none; }
  body { background: #fff; }
  .page { max-width: none; padding: 0; }
  .chapter { break-inside: avoid; }
}
