
:root {
  --ink: #292929;
  --muted: #737373;
  --line: #e2e2e2;
  --paper: #ffffff;
  --side: #fafafa;
  --accent: #737373;
  --soft: #eeeeee;
  --top: #292929;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 78px;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 15px/1.65 Arial, Helvetica, sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Top navigation bar */

.topbar {
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 25px;
  padding: 0 24px;
  background: var(--top);
  color: #fff;
  border-bottom: 1px solid #444;
}

.brand {
  display: flex;
  flex-direction: column;
  color: #fff;
  line-height: 1.2;
  min-width: 170px;
}

.brand:hover {
  text-decoration: none;
}

.brand strong {
  font-size: 15px;
  letter-spacing: 1.3px;
}

.brand span {
  font-size: 11px;
  color: #c6c6c6;
}

/* Search */

.search-wrap {
  position: relative;
  margin-left: auto;
  width: min(440px, 48vw);
}

#search {
  width: 100%;
  height: 36px;
  border: 1px solid #555;
  border-radius: 5px;
  background: #3a3a3a;
  color: white;
  padding: 0 42px 0 12px;
  font-size: 14px;
  outline: none;
}

#search::placeholder {
  color: #c0c0c0;
}

#search:focus {
  border-color: #aaa;
}

.search-wrap kbd {
  position: absolute;
  right: 10px;
  top: 8px;
  border: 1px solid #666;
  border-radius: 3px;
  padding: 0 5px;
  color: #bbb;
  font-size: 11px;
}

.version {
  font-size: 11px;
  letter-spacing: 0.6px;
  color: #c6c6c6;
  white-space: nowrap;
}

.mobile-menu {
  display: none;
  background: none;
  border: 0;
  color: white;
  font-size: 22px;
  cursor: pointer;
}

/* Main three-column layout */

.layout {
  display: grid;
  grid-template-columns: 235px minmax(0, 900px) 190px;
  gap: 36px;
  max-width: 1500px;
  margin: auto;
  padding: 0 28px;
}

/* Left sidebar */

.sidebar {
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow: auto;
  padding: 28px 15px 30px 0;
  border-right: 1px solid var(--line);
}

.nav-heading,
.right-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.15px;
  color: #858585;
  margin: 22px 0 7px;
}

.nav-heading:first-child {
  margin-top: 0;
}

.nav-link {
  display: block;
  padding: 5px 9px;
  margin: 1px 0;
  border-radius: 4px;
  color: #444;
  font-size: 13px;
}

.nav-link:hover {
  background: #f0f0f0;
  text-decoration: none;
}

.nav-link.active {
  background: var(--soft);
  color: #444;
  font-weight: 700;
}

/* Main article */

.main {
  min-width: 0;
  padding: 25px 0 50px;
}

.breadcrumbs {
  font-size: 12px;
  color: #8a8a8a;
  margin-bottom: 22px;
}

.breadcrumbs span {
  margin: 0 5px;
}

.main article {
  min-height: 65vh;
}

.main h1 {
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: -0.7px;
  margin: 0 0 18px;
  font-weight: 700;
}

.main h2 {
  font-size: 23px;
  line-height: 1.3;
  margin: 36px 0 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

.main h3 {
  font-size: 17px;
  margin: 25px 0 8px;
}

.main p {
  margin: 10px 0 15px;
}

.main .lead {
  font-size: 17px;
  color: #555;
  line-height: 1.7;
}

.main ul,
.main ol {
  padding-left: 25px;
}

.main li {
  margin: 4px 0;
}

/* Rules tables */

.main table {
  width: 100%;
  border-collapse: collapse;
  margin: 17px 0 23px;
  font-size: 13px;
  line-height: 1.5;
}

.main th,
.main td {
  text-align: left;
  padding: 9px 11px;
  border: 1px solid var(--line);
  vertical-align: top;
}

.main th {
  background: #f0f0f0;
  font-weight: 700;
}

.main tr:nth-child(even) td {
  background: #fafafa;
}

/* Rules callouts */

.callout {
  border-left: 3px solid var(--accent);
  background: #f5f5f5;
  padding: 12px 15px;
  margin: 18px 0;
  color: #454545;
}

.callout strong {
  color: var(--accent);
}

/* Optional rule cards */

.rule-card {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 13px 15px;
  margin: 12px 0;
}

.rule-card h3 {
  margin: 0 0 5px;
}

.rule-card p:last-child {
  margin-bottom: 0;
}

/* Right sidebar / table of contents */

.right-sidebar {
  position: sticky;
  top: 60px;
  align-self: start;
  max-height: calc(100vh - 60px);
  overflow: auto;
  padding: 28px 0;
}

.right-heading {
  margin-top: 0;
}

.toc-link {
  display: block;
  padding: 4px 0;
  color: #777;
  font-size: 12px;
}

.toc-link:hover {
  color: #333;
}

/* Search results */

.search-results {
  position: absolute;
  top: 42px;
  left: 0;
  right: 0;
  max-height: 65vh;
  overflow: auto;
  background: white;
  border: 1px solid #ddd;
  border-radius: 5px;
  box-shadow: 0 8px 25px #0002;
  color: var(--ink);
}

.search-results.hidden {
  display: none;
}

.search-result {
  display: block;
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  color: var(--ink);
}

.search-result:hover {
  background: #eeeeee;
  text-decoration: none;
}

.search-result strong {
  display: block;
  font-size: 13px;
}

.search-result small {
  display: block;
  color: #777;
  font-size: 11px;
  margin-top: 2px;
}

.no-results {
  padding: 13px;
  color: #777;
  font-size: 13px;
}

/* Footer */

footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  margin-top: 55px;
  padding-top: 17px;
  color: #999;
  font-size: 11px;
}

/* Medium screens */

@media (max-width: 1150px) {
  .layout {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 28px;
  }

  .right-sidebar {
    display: none;
  }

  .sidebar {
    padding-right: 12px;
  }
}

/* Mobile screens */

@media (max-width: 760px) {
  .topbar {
    padding: 0 14px;
    gap: 12px;
  }

  .brand {
    min-width: 130px;
  }

  .brand strong {
    font-size: 13px;
  }

  .version {
    display: none;
  }

  .search-wrap {
    width: auto;
    flex: 1;
  }

  .mobile-menu {
    display: block;
  }

  .layout {
    display: block;
    padding: 0 18px;
  }

  .sidebar {
    display: none;
    position: fixed;
    z-index: 30;
    top: 60px;
    left: 0;
    bottom: 0;
    width: 270px;
    height: auto;
    padding: 20px;
    background: white;
    border-right: 1px solid var(--line);
    box-shadow: 8px 0 20px #0001;
  }

  .sidebar.open {
    display: block;
  }

  .main {
    padding-top: 20px;
  }

  .main h1 {
    font-size: 29px;
  }

  .main h2 {
    font-size: 21px;
  }

  .main table {
    display: block;
    overflow-x: auto;
  }

  footer {
    flex-direction: column;
  }
}
