:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #d7dde5;
  --line-strong: #b9c3d0;
  --text: #172033;
  --muted: #637083;
  --accent: #1f6f68;
  --accent-soft: #e4f2ef;
  --danger: #a32920;
  --code-bg: #111827;
  --code-text: #e5e7eb;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

body {
  min-height: 100%;
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover,
a:focus-visible {
  color: #15524d;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 20px 16px;
}

.brand {
  display: grid;
  gap: 3px;
  margin-bottom: 20px;
  color: var(--text);
  text-decoration: none;
}

.brand strong {
  font-size: 18px;
  line-height: 1.2;
}

.brand span,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 3px;
}

.nav a {
  display: block;
  border-radius: 6px;
  color: var(--text);
  overflow-wrap: anywhere;
  padding: 8px 10px;
  text-decoration: none;
}

.nav a:hover,
.nav a:focus-visible {
  background: var(--surface-soft);
  outline: none;
}

.nav a.active {
  background: var(--accent-soft);
  color: #124944;
  font-weight: 700;
}

.content {
  min-width: 0;
  padding: 24px;
}

.content--no-toolbar {
  padding-top: 0;
}

.content--no-toolbar .markdown {
  border-top: 0;
  border-radius: 0 0 8px 8px;
/*  padding-top: 0; */
}

.toolbar {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  justify-content: space-between;
  width: min(980px, 100%);
  margin: 0 auto 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.toolbar h1,
.toolbar p {
  margin: 0;
}

.toolbar h1 {
  margin-top: 4px;
  font-size: 26px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  line-height: 1;
  padding: 0 12px;
  text-decoration: none;
}

.button:hover,
.button:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.markdown {
  width: min(980px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 28px;
  line-height: 1.65;
}

.markdown:focus {
  outline: none;
}

.markdown > :first-child {
  margin-top: 0;
}

.markdown > :last-child {
  margin-bottom: 0;
}

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4 {
  line-height: 1.25;
  margin: 1.5em 0 0.55em;
  overflow-wrap: anywhere;
}

.markdown h1 {
  font-size: 30px;
}

.markdown h2 {
  border-bottom: 1px solid var(--line);
  font-size: 22px;
  padding-bottom: 6px;
}

.markdown h3 {
  font-size: 18px;
}

.markdown p,
.markdown ul,
.markdown ol,
.markdown pre,
.markdown table,
.markdown blockquote {
  margin: 0 0 1em;
}

.markdown ul,
.markdown ol {
  padding-left: 1.45em;
}

.markdown li + li {
  margin-top: 0.25em;
}

.markdown code {
  border-radius: 4px;
  background: #eef2f7;
  color: #8b1e3f;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  padding: 0.12em 0.32em;
}

.markdown pre {
  overflow-x: auto;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 14px 16px;
}

.markdown pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.markdown blockquote {
  border-left: 4px solid var(--line-strong);
  color: var(--muted);
  padding-left: 14px;
}

.markdown table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.markdown th,
.markdown td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.markdown th {
  background: var(--surface-soft);
}

.markdown hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.5em 0;
}

.markdown .error {
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 820px) {
  .shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .content {
    padding: 16px;
  }

  .toolbar {
    display: grid;
    align-items: start;
  }

  .actions {
    justify-content: flex-start;
  }

  .markdown {
    padding: 20px;
  }
}
