/* Xenon theme guide: the documentation website's styles. */

:root {
  --bg: #ffffff;
  --bg-soft: #f4f7fa;
  --text: #071827;
  --muted: #475569;
  --line: #d5dde6;
  --brand: #0b5f91;
  --brand-text: #ffffff;
  --link: #0b5f91;
  --notice: #eef5fa;
  --code: #eef2f6;
  --radius: 8px;
  --font-heading: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

/* Dark colors: the device's dark mode, unless the page is set to light, and
   the dark setting itself. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1622;
    --bg-soft: #102030;
    --text: #e6edf3;
    --muted: #a7b4c2;
    --line: #26394d;
    --brand: #4fa3d9;
    --brand-text: #071827;
    --link: #7cc0eb;
    --notice: #12293d;
    --code: #16283a;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b1622;
  --bg-soft: #102030;
  --text: #e6edf3;
  --muted: #a7b4c2;
  --line: #26394d;
  --brand: #4fa3d9;
  --brand-text: #071827;
  --link: #7cc0eb;
  --notice: #12293d;
  --code: #16283a;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
}

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 10;
  padding: 8px 16px;
  background: var(--brand);
  color: var(--brand-text);
  border-radius: var(--radius);
}

.skip:focus {
  top: 8px;
}

/* Header */

.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand__mark {
  width: 32px;
  height: 32px;
  color: var(--brand);
  flex: none;
}

.brand__name {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
}

.brand__sub {
  color: var(--muted);
  font-size: 0.9375rem;
}

.top__support {
  margin-left: auto;
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--brand-text);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

/* Search */

.search {
  position: relative;
  flex: 1 1 320px;
  max-width: 420px;
  margin-left: auto;
}

.search:not([hidden]) + .top__support {
  margin-left: 0;
}

.search input {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
}

.search__results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 70vh;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgb(7 24 39 / 18%);
}

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

.search__results a:hover,
.search__results a:focus-visible {
  background: var(--bg-soft);
}

.search__results strong {
  display: block;
  color: var(--link);
}

.search__results small {
  display: block;
  color: var(--muted);
  line-height: 1.45;
}

.search__empty {
  padding: 8px 10px;
  color: var(--muted);
}

/* Layout */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 16px;
}

.sidebar__summary {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
}

.sidebar__list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.sidebar__list a {
  display: block;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}

.sidebar__list a:hover {
  background: var(--bg-soft);
}

.sidebar__list a[aria-current='page'] {
  background: var(--notice);
  color: var(--link);
  font-weight: 600;
}

.toc {
  display: none;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 40px;
    padding: 24px;
  }

  .sidebar {
    position: sticky;
    top: 76px;
    align-self: start;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
  }

  /* Wide screens open the list as the page loads; without JavaScript it
     stays closed, and its button stays usable. */
  .sidebar__details[open] > .sidebar__summary {
    display: none;
  }
}

@media (min-width: 1240px) {
  .layout {
    grid-template-columns: 240px minmax(0, 1fr) 220px;
  }

  .toc {
    display: block;
    position: sticky;
    top: 76px;
    align-self: start;
    font-size: 0.875rem;
  }

  .toc__title {
    margin: 0 0 8px;
    font-weight: 600;
  }

  .toc ul {
    margin: 0;
    padding: 0 0 0 12px;
    list-style: none;
    border-left: 2px solid var(--line);
  }

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

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

@media (max-width: 640px) {
  .brand__sub {
    display: none;
  }

  .top {
    flex-wrap: wrap;
  }

  .search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }
}

/* Content */

.content {
  min-width: 0;
}

.content:focus {
  outline: none;
}

.prose {
  max-width: 46rem;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--font-heading);
  line-height: 1.25;
  scroll-margin-top: 84px;
}

.prose h1 {
  margin: 8px 0 16px;
  font-size: clamp(1.875rem, 1.5rem + 1.5vw, 2.5rem);
  font-weight: 800;
}

.prose h2 {
  margin: 2.25em 0 0.6em;
  padding-top: 0.6em;
  border-top: 1px solid var(--line);
  font-size: 1.5rem;
}

.prose h3 {
  margin: 1.75em 0 0.5em;
  font-size: 1.1875rem;
}

.prose h4 {
  margin: 1.5em 0 0.5em;
  font-size: 1rem;
}

.prose h5 {
  margin: 1.25em 0 0.5em;
  font-size: 0.9375rem;
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1em;
}

.prose li + li {
  margin-top: 0.3em;
}

.prose li > ul,
.prose li > ol {
  margin: 0.3em 0 0;
}

.prose code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--code);
  font-size: 0.875em;
  overflow-wrap: anywhere;
}

.prose pre {
  padding: 14px 16px;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--code);
}

.prose pre code {
  padding: 0;
  background: none;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
}

.table-wrap {
  margin: 0 0 1.25em;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

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

.prose th {
  background: var(--bg-soft);
  font-weight: 600;
}

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

.button {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--brand-text);
  font-weight: 600;
  text-decoration: none;
}

.notice {
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--notice);
}

/* Previous and next chapter */

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  max-width: 46rem;
  margin: 48px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.pager__link {
  display: grid;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
}

.pager__link span {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 400;
}

.pager__link--next {
  margin-left: auto;
  text-align: right;
}

/* Footer */

.foot {
  margin-top: 48px;
  padding: 24px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.foot p {
  margin: 4px 0;
}
