:root {
  color-scheme: light;
  --paper: #f6f5ef;
  --surface: #fffefa;
  --ink: #1d271f;
  --muted: #4f5e54;
  --accent: #264e40;
  --accent-wash: #e1ebe3;
  --rule: #d5dbd0;
  --outline: #356653;
  --gutter: clamp(16px, 3vw, 44px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  line-height: 1.6;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-underline-offset: 0.2em; }
:focus-visible { outline: 2px solid var(--outline); outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h1 {
  font: 500 clamp(2.25rem, 5vw, 4.1rem)/1.04 Georgia, serif;
  letter-spacing: -0.045em;
  margin-bottom: 0.26em;
  overflow-wrap: anywhere;
}
h2 { font-size: 1.25rem; line-height: 1.3; }
h3 { font-size: 1.09rem; }
.skip {
  position: absolute;
  z-index: 2;
  padding: 12px;
  background: var(--surface);
  transform: translateY(-110%);
}
.skip:focus { transform: translateY(0); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.wordmark {
  color: var(--ink);
  text-decoration: none;
  font: 600 1.36rem Georgia, serif;
  letter-spacing: -0.03em;
  white-space: nowrap;
}
.top {
  display: grid;
  grid-template-columns: minmax(140px, 210px) minmax(0, 480px) auto;
  align-items: center;
  gap: var(--gutter);
  padding: 14px var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.top > form:last-child { justify-self: end; }
.search { display: flex; align-items: stretch; gap: 8px; }
.search input { min-width: 0; flex: 1; }
input, .search button, .quiet, .export {
  min-height: 44px;
  border: 1px solid #8d998f;
  color: var(--ink);
  background: var(--surface);
  border-radius: 7px;
  padding: 8px 12px;
}
.search button, .quiet, .export { font-weight: 570; }
.search button:hover, .quiet:hover, .export:hover { background: var(--accent-wash); }
.workspace {
  display: grid;
  grid-template-columns: minmax(158px, 210px) minmax(0, 960px) minmax(0, 182px);
  justify-content: start;
  gap: var(--gutter);
  max-width: 1560px;
  margin: 0 auto;
  padding: 40px var(--gutter) 72px;
}
.desktop-menu { align-self: start; }
.menu ul, .outline ul { padding: 0; margin: 0; list-style: none; }
.menu section { margin-top: 24px; }
.menu h2, .outline p {
  font-size: 0.83rem;
  line-height: 1.3;
  color: var(--muted);
  margin: 0 0 6px;
}
.menu a, .outline a {
  display: block;
  padding: 8px 10px;
  min-height: 38px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.menu a:hover, .outline a:hover { background: var(--surface); text-decoration: underline; }
.menu a[aria-current="page"] { background: var(--accent-wash); color: #193a2d; font-weight: 620; }
.mobile-menu { display: none; }

.intro { padding: clamp(6px, 1vw, 16px) 0 30px; border-bottom: 1px solid var(--rule); }
.intro p { max-width: 55ch; margin: 12px 0 0; font-size: 1.04rem; color: var(--muted); }
.doc-intro { margin-bottom: 28px; }
.doc-intro h1 { font-size: clamp(2rem, 4vw, 3.45rem); }
.export { display: inline-flex; align-items: center; gap: 10px; margin-top: 12px; text-decoration: none; font-size: 0.91rem; }

.projects, .next { margin-top: 32px; }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.project {
  display: grid;
  align-content: start;
  gap: 11px;
  min-height: 166px;
  padding: 19px 21px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
}
.project:hover { border-color: var(--outline); }
.project-name { color: var(--ink); font: 500 1.75rem/1.2 Georgia, serif; }
.project-action { color: var(--accent); font-size: 0.88rem; font-weight: 650; }
.project:hover .project-action { text-decoration: underline; }
.next a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 2px;
  border-top: 1px solid var(--rule);
  text-decoration: none;
}
.next a:hover { text-decoration: underline; }
.outline { align-self: start; padding-left: 14px; border-left: 1px solid var(--rule); }
.outline a { font-size: 0.86rem; padding: 7px 0; color: var(--muted); }
.prose { overflow-wrap: anywhere; }
.prose p, .prose li { max-width: 76ch; }
.prose h2 { margin: 1.8em 0 0.65em; scroll-margin-top: 16px; }
.prose ul, .prose ol { padding-left: 1.24em; }
.prose img { max-width: 100%; height: auto; }
.prose code { font-size: 0.88em; background: var(--accent-wash); padding: 0.12em 0.28em; border-radius: 4px; }
.prose pre { padding: 16px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); white-space: pre-wrap; }
.prose pre code { background: none; padding: 0; }
.table-wrap { overflow-x: auto; margin: 18px 0; }
table { width: 100%; min-width: 430px; border-collapse: collapse; text-align: left; background: var(--surface); }
th, td { border: 1px solid var(--rule); padding: 10px 12px; vertical-align: top; font-size: 0.92rem; }
th { background: var(--accent-wash); }
.results { list-style: none; padding: 0; }
.results li { padding: 14px 0; border-top: 1px solid var(--rule); }
.results a { font-weight: 650; }
.results p { color: var(--muted); margin: 4px 0 0; }

.sign-in { min-height: 100dvh; display: grid; place-items: center; padding: var(--gutter); }
.sign-in-card {
  width: min(100%, 420px);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: clamp(22px, 6vw, 38px);
}
.sign-in-card .wordmark { margin-bottom: 25px; }
.sign-in-card h1 { font-size: clamp(1.95rem, 7vw, 2.65rem); }
.sign-in-card form { display: grid; gap: 8px; margin-top: 25px; }
.sign-in-card button { margin-top: 8px; }
.sign-in-card label { font-weight: 620; }
.primary { min-height: 46px; color: #fff; background: var(--accent); padding: 8px 14px; border: 0; border-radius: 7px; }
.primary:hover { background: #1b4033; }
.form-error { color: #8f2925; font-size: 0.9rem; margin: 0; }
input[aria-invalid="true"] { border-color: #8f2925; }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: minmax(158px, 198px) minmax(0, 1fr); }
  .outline { display: none; }
}
@media (max-width: 720px) {
  .top { grid-template-columns: 1fr auto; gap: 10px; }
  .search { grid-row: 2; grid-column: 1 / -1; }
  .workspace { display: block; padding-top: 16px; }
  .desktop-menu { display: none; }
  .mobile-menu { display: block; margin-bottom: 23px; }
  .mobile-menu summary {
    padding: 9px 12px;
    min-height: 44px;
    border: 1px solid #8d998f;
    border-radius: 7px;
    background: var(--surface);
    cursor: pointer;
  }
  .mobile-menu .menu { margin-top: 10px; padding: 12px; background: var(--surface); border: 1px solid var(--rule); }
  .menu a { min-height: 44px; }
}
@media (max-width: 480px) {
  .project-grid { grid-template-columns: 1fr; }
  .project { min-height: auto; padding: 16px; gap: 8px; }
}
